@kortexya/reasoninglayer 0.23.1 → 1.0.1

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.
package/dist/index.d.cts CHANGED
@@ -109,21 +109,53 @@ type JsonValue$1 = string | number | boolean | null | JsonValue$1[] | object;
109
109
  * This is the single source of truth for the version constant.
110
110
  * The `scripts/release.sh` script updates this value alongside `package.json`.
111
111
  */
112
- declare const SDK_VERSION = "0.23.1";
112
+ declare const SDK_VERSION = "1.0.1";
113
+ /**
114
+ * Authentication mode for the SDK.
115
+ *
116
+ * Two modes are supported:
117
+ *
118
+ * - `bearer` — send `Authorization: Bearer <token>` on every request. Use this
119
+ * for server-to-server SDK usage where you hold a long-lived API token (e.g.
120
+ * a service-account token issued by the auth gateway).
121
+ * - `cookie` — rely on the browser's session cookie set by the auth gateway
122
+ * after an interactive login. The SDK will issue requests with
123
+ * `credentials: 'include'` so the cookie is attached. Use this for
124
+ * in-browser SPAs.
125
+ *
126
+ * The choice is **required and explicit** — there is no implicit "no auth"
127
+ * fallback. This prevents silently shipping unauthenticated requests that the
128
+ * gateway will reject at runtime.
129
+ */
130
+ type AuthConfig = {
131
+ readonly mode: 'bearer';
132
+ readonly token: string;
133
+ } | {
134
+ readonly mode: 'cookie';
135
+ };
113
136
  /**
114
137
  * Configuration for the Reasoning Layer client.
115
138
  *
116
139
  * @remarks
117
- * Required fields: `baseUrl` and `tenantId`. All other fields have sensible defaults.
118
- * No environment variable auto-detection — configuration is always explicit.
140
+ * Required fields: `baseUrl`, `tenantId`, and `auth`. All other fields have
141
+ * sensible defaults. No environment variable auto-detection — configuration
142
+ * is always explicit.
119
143
  *
120
- * @example
144
+ * @example Bearer token (server-side)
121
145
  * ```typescript
122
146
  * const config: ClientConfig = {
123
147
  * baseUrl: 'http://localhost:8083',
124
148
  * tenantId: '550e8400-e29b-41d4-a716-446655440000',
125
- * timeoutMs: 15000,
126
- * maxRetries: 2,
149
+ * auth: { mode: 'bearer', token: process.env.RL_API_TOKEN! },
150
+ * };
151
+ * ```
152
+ *
153
+ * @example Session cookie (browser)
154
+ * ```typescript
155
+ * const config: ClientConfig = {
156
+ * baseUrl: 'https://platform.ovh.reasoninglayer.ai',
157
+ * tenantId: '550e8400-e29b-41d4-a716-446655440000',
158
+ * auth: { mode: 'cookie' },
127
159
  * };
128
160
  * ```
129
161
  */
@@ -132,17 +164,17 @@ interface ClientConfig {
132
164
  baseUrl: string;
133
165
  /** Tenant UUID. Set once, NOT overridable per-call. */
134
166
  tenantId: string;
167
+ /**
168
+ * Authentication mode. Required — pick one of {@link AuthConfig}.
169
+ * There is no unauthenticated mode.
170
+ */
171
+ auth: AuthConfig;
135
172
  /** Default user UUID for `X-User-Id` header. Overridable per-call via `RequestOptions`. */
136
173
  userId?: string;
137
174
  /** Default namespace UUID for `X-Namespace-Id` header. Overridable per-call via `RequestOptions`. */
138
175
  namespaceId?: string;
139
176
  /** Authenticated user identifier for `X-Authenticated-User` header. */
140
177
  authenticatedUser?: string;
141
- /**
142
- * Bearer token for `Authorization: Bearer <token>` header.
143
- * Optional — omit when using cookie-based authentication.
144
- */
145
- bearerToken?: string;
146
178
  /** Default request timeout in milliseconds. Overridable per-call. Default: 30000. */
147
179
  timeoutMs?: number;
148
180
  /** Maximum number of retry attempts. Default: 3. */
@@ -175,8 +207,8 @@ interface ResolvedConfig {
175
207
  namespaceId: string | undefined;
176
208
  /** Authenticated user identifier, or undefined if not set. */
177
209
  authenticatedUser: string | undefined;
178
- /** Bearer token, or undefined if using cookie-based auth. */
179
- bearerToken: string | undefined;
210
+ /** Resolved authentication mode. */
211
+ auth: AuthConfig;
180
212
  /** Request timeout in milliseconds. */
181
213
  timeoutMs: number;
182
214
  /** Maximum number of retry attempts. */
@@ -38045,8 +38077,13 @@ interface ComponentHealthDto {
38045
38077
  }
38046
38078
  /** Enriched health response with component statuses and build info. */
38047
38079
  interface EnrichedHealthResponse {
38048
- /** Build information for the running server. */
38049
- buildInfo: BuildInfoDto;
38080
+ /**
38081
+ * Build information for the running server.
38082
+ *
38083
+ * Optional: some deployments (typically the gateway-fronted production
38084
+ * health endpoint) omit build info and return `null` here.
38085
+ */
38086
+ buildInfo?: BuildInfoDto;
38050
38087
  /** Health status of individual components. */
38051
38088
  components: ComponentHealthDto[];
38052
38089
  /** Overall health status. */
@@ -42646,4 +42683,4 @@ declare function toUntaggedFeatures(features: PlainFeatureMap): Record<string, F
42646
42683
  */
42647
42684
  declare function toTermInputDto(input: PsiTermInput | TermInputDto): TermInputDto;
42648
42685
 
42649
- export { ANY_ROLE, actionReviews as ActionReviews, type AddFactRequest, type AddFactResponse, type AddRuleRequest, type AddRuleResponse, admin as Admin, type AiGroup, analysis as Analysis, type AnalysisGroup, ApiError, type ApiResponse, AuthenticationError, type BackwardChainRequest, type BackwardChainResponse, BadRequestError, type BulkAddTermsRequest, type BulkAddTermsResponse, type BulkCreateSortsRequest, type BulkCreateSortsResponse, cdl as CDL, causal as Causal, type ClearTermsResponse, type ClientConfig, cognitive as Cognitive, collections as Collections, communities as Communities, type ConstrainedPlainVar, ConstraintViolationError, constraints as Constraints, control as Control, conversation as Conversation, type ConversationMessageRequest, type ConversationMessageResponse, type ConversationSummaryDto, type ConversationTurnsResponse, type CoreGroup, type CreateResearchSessionRequest, type CreateResearchSessionResponse, type CreateSortRequest, type CreateTermRequest, type DataGroup, discovery as Discovery, type ErrorResponse$1 as ErrorResponse, execution as Execution, extract as Extract, type FeatureInputValueDto, type FeatureValueDto, ForbiddenError, type ForwardChainRequest, type ForwardChainResponse, functions as Functions, fuzzy as Fuzzy, FuzzyShape, type FuzzyShapeDto, generation as Generation, type GlbRequest, type GlbResponse, health as Health, homoiconic as Homoiconic, ilp as ILP, imageExtraction as ImageExtraction, inference as Inference, type IngestPaperRequest, type IngestPaperResponse, ingestion as Ingestion, IngestionFailedError, IngestionSession, type IngestionSyncOptions, type Interceptor, InternalServerError, type JsonValue$1 as JsonValue, LP, type ListConversationsResponse, type LubRequest, type LubResponse, namespaces as Namespaces, NetworkError, neuroSymbolic as NeuroSymbolic, NotFoundError, ontology as Ontology, optimize as Optimize, type OsfSearchRequest, type OsfSearchResponse, osfql as Osfql, type OsfqlRequest, type OsfqlResponse, type OsfqlValue, oversight as Oversight, type PaginationParams, type PaperMetadataDto, type PaperSource, type PlainFeatureMap, type PlainFeatureValue, plainValues as PlainValues, preferences as Preferences, proofEngine as ProofEngine, type PsiTermDto, type PsiTermInput, query as Query, rag as RAG, RateLimitError, type RateLimitInfo, reasoning as Reasoning, type ReasoningGroup, ReasoningLayerClient, ReasoningLayerError, type RequestOptions, research as Research, type ResearchContradictionsResponse, type ResearchCycleResponse, type ResearchFindingsResponse, type ResearchGapsResponse, type ResearchReportResponse, type ResearchSessionResponse, reviews as Reviews, row as Row, SDK_VERSION, scenarios as Scenarios, scheduling as Scheduling, type SearchPapersRequest, type SearchPapersResponse, SortBuilder, type SortDto, type SortInfoDto, sorts as Sorts, sources as Sources, spaces as Spaces, statistical as Statistical, synthetic as Synthetic, type SystemGroup, type TermDto, type TermInputArg, type TermInputDto, type TermListResponse, type TermPatternDto, type TermResponse, terms as Terms, TimeoutError, type TurnDto, type UpdateTermRequest, utilities as Utilities, ValidationError, Value, type ValueDto, values as Values, type VerifyClaimRequest, type VerifyClaimResponse, visualization as Visualization, WebSocketClient, WebSocketConnection, webhookActions as WebhookActions, type WorkflowGroup, allen, constrained, discriminateFeatureValue, guard, isConstrainedPlainVar, isPsiTermInput, isTaggedValueDto, isUuid, psi, toTaggedFeatures, toTaggedValue, toTermInputDto, toUntaggedFeatures, toUntaggedValue };
42686
+ export { ANY_ROLE, actionReviews as ActionReviews, type AddFactRequest, type AddFactResponse, type AddRuleRequest, type AddRuleResponse, admin as Admin, type AiGroup, analysis as Analysis, type AnalysisGroup, ApiError, type ApiResponse, type AuthConfig, AuthenticationError, type BackwardChainRequest, type BackwardChainResponse, BadRequestError, type BulkAddTermsRequest, type BulkAddTermsResponse, type BulkCreateSortsRequest, type BulkCreateSortsResponse, cdl as CDL, causal as Causal, type ClearTermsResponse, type ClientConfig, cognitive as Cognitive, collections as Collections, communities as Communities, type ConstrainedPlainVar, ConstraintViolationError, constraints as Constraints, control as Control, conversation as Conversation, type ConversationMessageRequest, type ConversationMessageResponse, type ConversationSummaryDto, type ConversationTurnsResponse, type CoreGroup, type CreateResearchSessionRequest, type CreateResearchSessionResponse, type CreateSortRequest, type CreateTermRequest, type DataGroup, discovery as Discovery, type ErrorResponse$1 as ErrorResponse, execution as Execution, extract as Extract, type FeatureInputValueDto, type FeatureValueDto, ForbiddenError, type ForwardChainRequest, type ForwardChainResponse, functions as Functions, fuzzy as Fuzzy, FuzzyShape, type FuzzyShapeDto, generation as Generation, type GlbRequest, type GlbResponse, health as Health, homoiconic as Homoiconic, ilp as ILP, imageExtraction as ImageExtraction, inference as Inference, type IngestPaperRequest, type IngestPaperResponse, ingestion as Ingestion, IngestionFailedError, IngestionSession, type IngestionSyncOptions, type Interceptor, InternalServerError, type JsonValue$1 as JsonValue, LP, type ListConversationsResponse, type LubRequest, type LubResponse, namespaces as Namespaces, NetworkError, neuroSymbolic as NeuroSymbolic, NotFoundError, ontology as Ontology, optimize as Optimize, type OsfSearchRequest, type OsfSearchResponse, osfql as Osfql, type OsfqlRequest, type OsfqlResponse, type OsfqlValue, oversight as Oversight, type PaginationParams, type PaperMetadataDto, type PaperSource, type PlainFeatureMap, type PlainFeatureValue, plainValues as PlainValues, preferences as Preferences, proofEngine as ProofEngine, type PsiTermDto, type PsiTermInput, query as Query, rag as RAG, RateLimitError, type RateLimitInfo, reasoning as Reasoning, type ReasoningGroup, ReasoningLayerClient, ReasoningLayerError, type RequestOptions, research as Research, type ResearchContradictionsResponse, type ResearchCycleResponse, type ResearchFindingsResponse, type ResearchGapsResponse, type ResearchReportResponse, type ResearchSessionResponse, reviews as Reviews, row as Row, SDK_VERSION, scenarios as Scenarios, scheduling as Scheduling, type SearchPapersRequest, type SearchPapersResponse, SortBuilder, type SortDto, type SortInfoDto, sorts as Sorts, sources as Sources, spaces as Spaces, statistical as Statistical, synthetic as Synthetic, type SystemGroup, type TermDto, type TermInputArg, type TermInputDto, type TermListResponse, type TermPatternDto, type TermResponse, terms as Terms, TimeoutError, type TurnDto, type UpdateTermRequest, utilities as Utilities, ValidationError, Value, type ValueDto, values as Values, type VerifyClaimRequest, type VerifyClaimResponse, visualization as Visualization, WebSocketClient, WebSocketConnection, webhookActions as WebhookActions, type WorkflowGroup, allen, constrained, discriminateFeatureValue, guard, isConstrainedPlainVar, isPsiTermInput, isTaggedValueDto, isUuid, psi, toTaggedFeatures, toTaggedValue, toTermInputDto, toUntaggedFeatures, toUntaggedValue };
package/dist/index.d.ts CHANGED
@@ -109,21 +109,53 @@ type JsonValue$1 = string | number | boolean | null | JsonValue$1[] | object;
109
109
  * This is the single source of truth for the version constant.
110
110
  * The `scripts/release.sh` script updates this value alongside `package.json`.
111
111
  */
112
- declare const SDK_VERSION = "0.23.1";
112
+ declare const SDK_VERSION = "1.0.1";
113
+ /**
114
+ * Authentication mode for the SDK.
115
+ *
116
+ * Two modes are supported:
117
+ *
118
+ * - `bearer` — send `Authorization: Bearer <token>` on every request. Use this
119
+ * for server-to-server SDK usage where you hold a long-lived API token (e.g.
120
+ * a service-account token issued by the auth gateway).
121
+ * - `cookie` — rely on the browser's session cookie set by the auth gateway
122
+ * after an interactive login. The SDK will issue requests with
123
+ * `credentials: 'include'` so the cookie is attached. Use this for
124
+ * in-browser SPAs.
125
+ *
126
+ * The choice is **required and explicit** — there is no implicit "no auth"
127
+ * fallback. This prevents silently shipping unauthenticated requests that the
128
+ * gateway will reject at runtime.
129
+ */
130
+ type AuthConfig = {
131
+ readonly mode: 'bearer';
132
+ readonly token: string;
133
+ } | {
134
+ readonly mode: 'cookie';
135
+ };
113
136
  /**
114
137
  * Configuration for the Reasoning Layer client.
115
138
  *
116
139
  * @remarks
117
- * Required fields: `baseUrl` and `tenantId`. All other fields have sensible defaults.
118
- * No environment variable auto-detection — configuration is always explicit.
140
+ * Required fields: `baseUrl`, `tenantId`, and `auth`. All other fields have
141
+ * sensible defaults. No environment variable auto-detection — configuration
142
+ * is always explicit.
119
143
  *
120
- * @example
144
+ * @example Bearer token (server-side)
121
145
  * ```typescript
122
146
  * const config: ClientConfig = {
123
147
  * baseUrl: 'http://localhost:8083',
124
148
  * tenantId: '550e8400-e29b-41d4-a716-446655440000',
125
- * timeoutMs: 15000,
126
- * maxRetries: 2,
149
+ * auth: { mode: 'bearer', token: process.env.RL_API_TOKEN! },
150
+ * };
151
+ * ```
152
+ *
153
+ * @example Session cookie (browser)
154
+ * ```typescript
155
+ * const config: ClientConfig = {
156
+ * baseUrl: 'https://platform.ovh.reasoninglayer.ai',
157
+ * tenantId: '550e8400-e29b-41d4-a716-446655440000',
158
+ * auth: { mode: 'cookie' },
127
159
  * };
128
160
  * ```
129
161
  */
@@ -132,17 +164,17 @@ interface ClientConfig {
132
164
  baseUrl: string;
133
165
  /** Tenant UUID. Set once, NOT overridable per-call. */
134
166
  tenantId: string;
167
+ /**
168
+ * Authentication mode. Required — pick one of {@link AuthConfig}.
169
+ * There is no unauthenticated mode.
170
+ */
171
+ auth: AuthConfig;
135
172
  /** Default user UUID for `X-User-Id` header. Overridable per-call via `RequestOptions`. */
136
173
  userId?: string;
137
174
  /** Default namespace UUID for `X-Namespace-Id` header. Overridable per-call via `RequestOptions`. */
138
175
  namespaceId?: string;
139
176
  /** Authenticated user identifier for `X-Authenticated-User` header. */
140
177
  authenticatedUser?: string;
141
- /**
142
- * Bearer token for `Authorization: Bearer <token>` header.
143
- * Optional — omit when using cookie-based authentication.
144
- */
145
- bearerToken?: string;
146
178
  /** Default request timeout in milliseconds. Overridable per-call. Default: 30000. */
147
179
  timeoutMs?: number;
148
180
  /** Maximum number of retry attempts. Default: 3. */
@@ -175,8 +207,8 @@ interface ResolvedConfig {
175
207
  namespaceId: string | undefined;
176
208
  /** Authenticated user identifier, or undefined if not set. */
177
209
  authenticatedUser: string | undefined;
178
- /** Bearer token, or undefined if using cookie-based auth. */
179
- bearerToken: string | undefined;
210
+ /** Resolved authentication mode. */
211
+ auth: AuthConfig;
180
212
  /** Request timeout in milliseconds. */
181
213
  timeoutMs: number;
182
214
  /** Maximum number of retry attempts. */
@@ -38045,8 +38077,13 @@ interface ComponentHealthDto {
38045
38077
  }
38046
38078
  /** Enriched health response with component statuses and build info. */
38047
38079
  interface EnrichedHealthResponse {
38048
- /** Build information for the running server. */
38049
- buildInfo: BuildInfoDto;
38080
+ /**
38081
+ * Build information for the running server.
38082
+ *
38083
+ * Optional: some deployments (typically the gateway-fronted production
38084
+ * health endpoint) omit build info and return `null` here.
38085
+ */
38086
+ buildInfo?: BuildInfoDto;
38050
38087
  /** Health status of individual components. */
38051
38088
  components: ComponentHealthDto[];
38052
38089
  /** Overall health status. */
@@ -42646,4 +42683,4 @@ declare function toUntaggedFeatures(features: PlainFeatureMap): Record<string, F
42646
42683
  */
42647
42684
  declare function toTermInputDto(input: PsiTermInput | TermInputDto): TermInputDto;
42648
42685
 
42649
- export { ANY_ROLE, actionReviews as ActionReviews, type AddFactRequest, type AddFactResponse, type AddRuleRequest, type AddRuleResponse, admin as Admin, type AiGroup, analysis as Analysis, type AnalysisGroup, ApiError, type ApiResponse, AuthenticationError, type BackwardChainRequest, type BackwardChainResponse, BadRequestError, type BulkAddTermsRequest, type BulkAddTermsResponse, type BulkCreateSortsRequest, type BulkCreateSortsResponse, cdl as CDL, causal as Causal, type ClearTermsResponse, type ClientConfig, cognitive as Cognitive, collections as Collections, communities as Communities, type ConstrainedPlainVar, ConstraintViolationError, constraints as Constraints, control as Control, conversation as Conversation, type ConversationMessageRequest, type ConversationMessageResponse, type ConversationSummaryDto, type ConversationTurnsResponse, type CoreGroup, type CreateResearchSessionRequest, type CreateResearchSessionResponse, type CreateSortRequest, type CreateTermRequest, type DataGroup, discovery as Discovery, type ErrorResponse$1 as ErrorResponse, execution as Execution, extract as Extract, type FeatureInputValueDto, type FeatureValueDto, ForbiddenError, type ForwardChainRequest, type ForwardChainResponse, functions as Functions, fuzzy as Fuzzy, FuzzyShape, type FuzzyShapeDto, generation as Generation, type GlbRequest, type GlbResponse, health as Health, homoiconic as Homoiconic, ilp as ILP, imageExtraction as ImageExtraction, inference as Inference, type IngestPaperRequest, type IngestPaperResponse, ingestion as Ingestion, IngestionFailedError, IngestionSession, type IngestionSyncOptions, type Interceptor, InternalServerError, type JsonValue$1 as JsonValue, LP, type ListConversationsResponse, type LubRequest, type LubResponse, namespaces as Namespaces, NetworkError, neuroSymbolic as NeuroSymbolic, NotFoundError, ontology as Ontology, optimize as Optimize, type OsfSearchRequest, type OsfSearchResponse, osfql as Osfql, type OsfqlRequest, type OsfqlResponse, type OsfqlValue, oversight as Oversight, type PaginationParams, type PaperMetadataDto, type PaperSource, type PlainFeatureMap, type PlainFeatureValue, plainValues as PlainValues, preferences as Preferences, proofEngine as ProofEngine, type PsiTermDto, type PsiTermInput, query as Query, rag as RAG, RateLimitError, type RateLimitInfo, reasoning as Reasoning, type ReasoningGroup, ReasoningLayerClient, ReasoningLayerError, type RequestOptions, research as Research, type ResearchContradictionsResponse, type ResearchCycleResponse, type ResearchFindingsResponse, type ResearchGapsResponse, type ResearchReportResponse, type ResearchSessionResponse, reviews as Reviews, row as Row, SDK_VERSION, scenarios as Scenarios, scheduling as Scheduling, type SearchPapersRequest, type SearchPapersResponse, SortBuilder, type SortDto, type SortInfoDto, sorts as Sorts, sources as Sources, spaces as Spaces, statistical as Statistical, synthetic as Synthetic, type SystemGroup, type TermDto, type TermInputArg, type TermInputDto, type TermListResponse, type TermPatternDto, type TermResponse, terms as Terms, TimeoutError, type TurnDto, type UpdateTermRequest, utilities as Utilities, ValidationError, Value, type ValueDto, values as Values, type VerifyClaimRequest, type VerifyClaimResponse, visualization as Visualization, WebSocketClient, WebSocketConnection, webhookActions as WebhookActions, type WorkflowGroup, allen, constrained, discriminateFeatureValue, guard, isConstrainedPlainVar, isPsiTermInput, isTaggedValueDto, isUuid, psi, toTaggedFeatures, toTaggedValue, toTermInputDto, toUntaggedFeatures, toUntaggedValue };
42686
+ export { ANY_ROLE, actionReviews as ActionReviews, type AddFactRequest, type AddFactResponse, type AddRuleRequest, type AddRuleResponse, admin as Admin, type AiGroup, analysis as Analysis, type AnalysisGroup, ApiError, type ApiResponse, type AuthConfig, AuthenticationError, type BackwardChainRequest, type BackwardChainResponse, BadRequestError, type BulkAddTermsRequest, type BulkAddTermsResponse, type BulkCreateSortsRequest, type BulkCreateSortsResponse, cdl as CDL, causal as Causal, type ClearTermsResponse, type ClientConfig, cognitive as Cognitive, collections as Collections, communities as Communities, type ConstrainedPlainVar, ConstraintViolationError, constraints as Constraints, control as Control, conversation as Conversation, type ConversationMessageRequest, type ConversationMessageResponse, type ConversationSummaryDto, type ConversationTurnsResponse, type CoreGroup, type CreateResearchSessionRequest, type CreateResearchSessionResponse, type CreateSortRequest, type CreateTermRequest, type DataGroup, discovery as Discovery, type ErrorResponse$1 as ErrorResponse, execution as Execution, extract as Extract, type FeatureInputValueDto, type FeatureValueDto, ForbiddenError, type ForwardChainRequest, type ForwardChainResponse, functions as Functions, fuzzy as Fuzzy, FuzzyShape, type FuzzyShapeDto, generation as Generation, type GlbRequest, type GlbResponse, health as Health, homoiconic as Homoiconic, ilp as ILP, imageExtraction as ImageExtraction, inference as Inference, type IngestPaperRequest, type IngestPaperResponse, ingestion as Ingestion, IngestionFailedError, IngestionSession, type IngestionSyncOptions, type Interceptor, InternalServerError, type JsonValue$1 as JsonValue, LP, type ListConversationsResponse, type LubRequest, type LubResponse, namespaces as Namespaces, NetworkError, neuroSymbolic as NeuroSymbolic, NotFoundError, ontology as Ontology, optimize as Optimize, type OsfSearchRequest, type OsfSearchResponse, osfql as Osfql, type OsfqlRequest, type OsfqlResponse, type OsfqlValue, oversight as Oversight, type PaginationParams, type PaperMetadataDto, type PaperSource, type PlainFeatureMap, type PlainFeatureValue, plainValues as PlainValues, preferences as Preferences, proofEngine as ProofEngine, type PsiTermDto, type PsiTermInput, query as Query, rag as RAG, RateLimitError, type RateLimitInfo, reasoning as Reasoning, type ReasoningGroup, ReasoningLayerClient, ReasoningLayerError, type RequestOptions, research as Research, type ResearchContradictionsResponse, type ResearchCycleResponse, type ResearchFindingsResponse, type ResearchGapsResponse, type ResearchReportResponse, type ResearchSessionResponse, reviews as Reviews, row as Row, SDK_VERSION, scenarios as Scenarios, scheduling as Scheduling, type SearchPapersRequest, type SearchPapersResponse, SortBuilder, type SortDto, type SortInfoDto, sorts as Sorts, sources as Sources, spaces as Spaces, statistical as Statistical, synthetic as Synthetic, type SystemGroup, type TermDto, type TermInputArg, type TermInputDto, type TermListResponse, type TermPatternDto, type TermResponse, terms as Terms, TimeoutError, type TurnDto, type UpdateTermRequest, utilities as Utilities, ValidationError, Value, type ValueDto, values as Values, type VerifyClaimRequest, type VerifyClaimResponse, visualization as Visualization, WebSocketClient, WebSocketConnection, webhookActions as WebhookActions, type WorkflowGroup, allen, constrained, discriminateFeatureValue, guard, isConstrainedPlainVar, isPsiTermInput, isTaggedValueDto, isUuid, psi, toTaggedFeatures, toTaggedValue, toTermInputDto, toUntaggedFeatures, toUntaggedValue };
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ var __export = (target, all) => {
5
5
  };
6
6
 
7
7
  // src/config.ts
8
- var SDK_VERSION = "0.23.1";
8
+ var SDK_VERSION = "1.0.1";
9
9
  function resolveConfig(config) {
10
10
  if (!config.baseUrl) {
11
11
  throw new Error("ClientConfig.baseUrl is required");
@@ -13,13 +13,21 @@ function resolveConfig(config) {
13
13
  if (!config.tenantId) {
14
14
  throw new Error("ClientConfig.tenantId is required");
15
15
  }
16
+ if (!config.auth) {
17
+ throw new Error(
18
+ "ClientConfig.auth is required \u2014 pass { mode: 'bearer', token } or { mode: 'cookie' }"
19
+ );
20
+ }
21
+ if (config.auth.mode === "bearer" && !config.auth.token) {
22
+ throw new Error("ClientConfig.auth.token is required when mode is 'bearer'");
23
+ }
16
24
  return {
17
25
  baseUrl: config.baseUrl.replace(/\/+$/, ""),
18
26
  tenantId: config.tenantId,
19
27
  userId: config.userId,
20
28
  namespaceId: config.namespaceId,
21
29
  authenticatedUser: config.authenticatedUser,
22
- bearerToken: config.bearerToken,
30
+ auth: config.auth,
23
31
  timeoutMs: config.timeoutMs ?? 3e4,
24
32
  maxRetries: config.maxRetries ?? 3,
25
33
  retryOn503: config.retryOn503 ?? false,
@@ -375,8 +383,8 @@ var WebSocketClient = class {
375
383
  buildUrl(path, params) {
376
384
  const baseUrl = this.config.baseUrl.replace(/^http:/, "ws:").replace(/^https:/, "wss:");
377
385
  const queryParams = new URLSearchParams({ tenant_id: this.config.tenantId });
378
- if (this.config.bearerToken) {
379
- queryParams.set("token", this.config.bearerToken);
386
+ if (this.config.auth.mode === "bearer") {
387
+ queryParams.set("token", this.config.auth.token);
380
388
  }
381
389
  if (params) {
382
390
  for (const [key, value] of Object.entries(params)) {
@@ -615,7 +623,7 @@ function buildAuthHeaders(config) {
615
623
  if (config.userId) headers["X-User-Id"] = config.userId;
616
624
  if (config.namespaceId) headers["X-Namespace-Id"] = config.namespaceId;
617
625
  if (config.authenticatedUser) headers["X-Authenticated-User"] = config.authenticatedUser;
618
- if (config.bearerToken) headers["Authorization"] = `Bearer ${config.bearerToken}`;
626
+ if (config.auth.mode === "bearer") headers["Authorization"] = `Bearer ${config.auth.token}`;
619
627
  return headers;
620
628
  }
621
629
  function transformRequestInit(init) {
@@ -642,10 +650,14 @@ function createCustomFetch(config) {
642
650
  const response = await executeFetch(input, transformedInit, timeoutMs, config);
643
651
  if (response.ok) return response;
644
652
  let body;
653
+ const rawText = await response.clone().text().catch(() => "");
645
654
  try {
646
- body = await response.clone().json();
655
+ body = rawText ? JSON.parse(rawText) : { error: "unknown", message: `HTTP ${response.status}` };
647
656
  } catch {
648
- body = { error: "unknown", message: `HTTP ${response.status}` };
657
+ body = {
658
+ error: "unknown",
659
+ message: rawText.trim() || `HTTP ${response.status}`
660
+ };
649
661
  }
650
662
  const apiError = createApiError(response.status, body, response.headers);
651
663
  if (response.status === 429 && attempt < maxRetries) {
@@ -683,7 +695,11 @@ async function executeFetch(input, init, timeoutMs, config) {
683
695
  const existingSignal = init?.signal;
684
696
  const combinedSignal = existingSignal ? AbortSignal.any([timeoutController.signal, existingSignal]) : timeoutController.signal;
685
697
  const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
686
- const request = new Request(url, { ...init, signal: combinedSignal });
698
+ const request = new Request(url, {
699
+ ...init,
700
+ signal: combinedSignal,
701
+ credentials: config.auth.mode === "cookie" ? "include" : "same-origin"
702
+ });
687
703
  try {
688
704
  const fetchFn = config.fetch;
689
705
  const baseFetch = (req) => fetchFn(req);
@@ -19391,10 +19407,14 @@ function ComponentHealthDtoFromApiToFront(dto) {
19391
19407
  };
19392
19408
  }
19393
19409
  function EnrichedHealthResponseFromApiToFront(dto) {
19410
+ if (dto == null) {
19411
+ return { buildInfo: void 0, components: [], status: "unknown" };
19412
+ }
19413
+ const rawBuildInfo = dto.build_info;
19394
19414
  return {
19395
- buildInfo: BuildInfoDtoFromApiToFront(dto.build_info),
19396
- components: dto.components.map(ComponentHealthDtoFromApiToFront),
19397
- status: dto.status
19415
+ buildInfo: rawBuildInfo == null ? void 0 : BuildInfoDtoFromApiToFront(rawBuildInfo),
19416
+ components: (dto.components ?? []).map(ComponentHealthDtoFromApiToFront),
19417
+ status: dto.status ?? "unknown"
19398
19418
  };
19399
19419
  }
19400
19420