@kortexya/reasoninglayer 0.3.0 → 0.4.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,7 +109,7 @@ 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.3.0";
112
+ declare const SDK_VERSION = "0.4.1";
113
113
  /**
114
114
  * Configuration for the Reasoning Layer client.
115
115
  *
@@ -138,6 +138,11 @@ interface ClientConfig {
138
138
  namespaceId?: string;
139
139
  /** Authenticated user identifier for `X-Authenticated-User` header. */
140
140
  authenticatedUser?: string;
141
+ /**
142
+ * Bearer token for `Authorization: Bearer <token>` header.
143
+ * Optional — omit when using cookie-based authentication.
144
+ */
145
+ bearerToken?: string;
141
146
  /** Default request timeout in milliseconds. Overridable per-call. Default: 30000. */
142
147
  timeoutMs?: number;
143
148
  /** Maximum number of retry attempts. Default: 3. */
@@ -170,6 +175,8 @@ interface ResolvedConfig {
170
175
  namespaceId: string | undefined;
171
176
  /** Authenticated user identifier, or undefined if not set. */
172
177
  authenticatedUser: string | undefined;
178
+ /** Bearer token, or undefined if using cookie-based auth. */
179
+ bearerToken: string | undefined;
173
180
  /** Request timeout in milliseconds. */
174
181
  timeoutMs: number;
175
182
  /** Maximum number of retry attempts. */
@@ -20827,8 +20834,8 @@ declare class CognitiveClient {
20827
20834
  * @returns The agent's basic state.
20828
20835
  *
20829
20836
  * @remarks
20830
- * Uses a direct HTTP request fallback because this endpoint
20831
- * is not present in the generated route class.
20837
+ * Uses GET `/api/v1/cognitive/agents/{agent_id}`.
20838
+ * Tenant is identified by the `X-Tenant-Id` header (set automatically).
20832
20839
  */
20833
20840
  getAgent(agentId: string): Promise<AgentStateDto>;
20834
20841
  /**
@@ -20837,8 +20844,8 @@ declare class CognitiveClient {
20837
20844
  * @param agentId - Agent UUID.
20838
20845
  *
20839
20846
  * @remarks
20840
- * Uses a direct HTTP request fallback because this endpoint
20841
- * is not present in the generated route class.
20847
+ * Uses DELETE `/api/v1/cognitive/agents/{agent_id}`.
20848
+ * Tenant is identified by the `X-Tenant-Id` header (set automatically).
20842
20849
  */
20843
20850
  deleteAgent(agentId: string): Promise<void>;
20844
20851
  /**
@@ -20854,23 +20861,24 @@ declare class CognitiveClient {
20854
20861
  /**
20855
20862
  * Get agent drives and motivation state.
20856
20863
  *
20857
- * @param request - Agent ID and tenant ID.
20864
+ * @param request - Agent ID.
20858
20865
  * @returns The agent's motivation state including drives, deficits, and curiosity targets.
20859
20866
  *
20860
20867
  * @remarks
20861
- * Uses GET with agent_id as path parameter and tenant_id as query parameter.
20862
- * Returns drives, deficits, curiosity targets, and the dominant drive.
20868
+ * Uses GET `/api/v1/cognitive/agents/{agent_id}/drives`.
20869
+ * Tenant is identified by the `X-Tenant-Id` header (set automatically).
20863
20870
  */
20864
20871
  getAgentDrives(request: Omit<GetAgentDrivesRequest, 'tenantId'>): Promise<MotivationStateDto>;
20865
20872
  /**
20866
20873
  * Get extended agent state including full cognitive state.
20867
20874
  *
20868
- * @param request - Agent ID and tenant ID.
20875
+ * @param request - Agent ID.
20869
20876
  * @returns The agent's extended state including beliefs, goals, intentions,
20870
20877
  * pending perceptions, activations, recent episodes, and rule utilities.
20871
20878
  *
20872
20879
  * @remarks
20873
- * Uses GET with agent_id as path parameter and tenant_id as query parameter.
20880
+ * Uses GET `/api/v1/cognitive/agents/{agent_id}/extended-state`.
20881
+ * Tenant is identified by the `X-Tenant-Id` header (set automatically).
20874
20882
  */
20875
20883
  getExtendedAgentState(request: Omit<GetExtendedAgentStateRequest, 'tenantId'>): Promise<ExtendedAgentStateDto>;
20876
20884
  /**
package/dist/index.d.ts CHANGED
@@ -109,7 +109,7 @@ 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.3.0";
112
+ declare const SDK_VERSION = "0.4.1";
113
113
  /**
114
114
  * Configuration for the Reasoning Layer client.
115
115
  *
@@ -138,6 +138,11 @@ interface ClientConfig {
138
138
  namespaceId?: string;
139
139
  /** Authenticated user identifier for `X-Authenticated-User` header. */
140
140
  authenticatedUser?: string;
141
+ /**
142
+ * Bearer token for `Authorization: Bearer <token>` header.
143
+ * Optional — omit when using cookie-based authentication.
144
+ */
145
+ bearerToken?: string;
141
146
  /** Default request timeout in milliseconds. Overridable per-call. Default: 30000. */
142
147
  timeoutMs?: number;
143
148
  /** Maximum number of retry attempts. Default: 3. */
@@ -170,6 +175,8 @@ interface ResolvedConfig {
170
175
  namespaceId: string | undefined;
171
176
  /** Authenticated user identifier, or undefined if not set. */
172
177
  authenticatedUser: string | undefined;
178
+ /** Bearer token, or undefined if using cookie-based auth. */
179
+ bearerToken: string | undefined;
173
180
  /** Request timeout in milliseconds. */
174
181
  timeoutMs: number;
175
182
  /** Maximum number of retry attempts. */
@@ -20827,8 +20834,8 @@ declare class CognitiveClient {
20827
20834
  * @returns The agent's basic state.
20828
20835
  *
20829
20836
  * @remarks
20830
- * Uses a direct HTTP request fallback because this endpoint
20831
- * is not present in the generated route class.
20837
+ * Uses GET `/api/v1/cognitive/agents/{agent_id}`.
20838
+ * Tenant is identified by the `X-Tenant-Id` header (set automatically).
20832
20839
  */
20833
20840
  getAgent(agentId: string): Promise<AgentStateDto>;
20834
20841
  /**
@@ -20837,8 +20844,8 @@ declare class CognitiveClient {
20837
20844
  * @param agentId - Agent UUID.
20838
20845
  *
20839
20846
  * @remarks
20840
- * Uses a direct HTTP request fallback because this endpoint
20841
- * is not present in the generated route class.
20847
+ * Uses DELETE `/api/v1/cognitive/agents/{agent_id}`.
20848
+ * Tenant is identified by the `X-Tenant-Id` header (set automatically).
20842
20849
  */
20843
20850
  deleteAgent(agentId: string): Promise<void>;
20844
20851
  /**
@@ -20854,23 +20861,24 @@ declare class CognitiveClient {
20854
20861
  /**
20855
20862
  * Get agent drives and motivation state.
20856
20863
  *
20857
- * @param request - Agent ID and tenant ID.
20864
+ * @param request - Agent ID.
20858
20865
  * @returns The agent's motivation state including drives, deficits, and curiosity targets.
20859
20866
  *
20860
20867
  * @remarks
20861
- * Uses GET with agent_id as path parameter and tenant_id as query parameter.
20862
- * Returns drives, deficits, curiosity targets, and the dominant drive.
20868
+ * Uses GET `/api/v1/cognitive/agents/{agent_id}/drives`.
20869
+ * Tenant is identified by the `X-Tenant-Id` header (set automatically).
20863
20870
  */
20864
20871
  getAgentDrives(request: Omit<GetAgentDrivesRequest, 'tenantId'>): Promise<MotivationStateDto>;
20865
20872
  /**
20866
20873
  * Get extended agent state including full cognitive state.
20867
20874
  *
20868
- * @param request - Agent ID and tenant ID.
20875
+ * @param request - Agent ID.
20869
20876
  * @returns The agent's extended state including beliefs, goals, intentions,
20870
20877
  * pending perceptions, activations, recent episodes, and rule utilities.
20871
20878
  *
20872
20879
  * @remarks
20873
- * Uses GET with agent_id as path parameter and tenant_id as query parameter.
20880
+ * Uses GET `/api/v1/cognitive/agents/{agent_id}/extended-state`.
20881
+ * Tenant is identified by the `X-Tenant-Id` header (set automatically).
20874
20882
  */
20875
20883
  getExtendedAgentState(request: Omit<GetExtendedAgentStateRequest, 'tenantId'>): Promise<ExtendedAgentStateDto>;
20876
20884
  /**
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/config.ts
2
- var SDK_VERSION = "0.3.0";
2
+ var SDK_VERSION = "0.4.1";
3
3
  function resolveConfig(config) {
4
4
  if (!config.baseUrl) {
5
5
  throw new Error("ClientConfig.baseUrl is required");
@@ -13,6 +13,7 @@ function resolveConfig(config) {
13
13
  userId: config.userId,
14
14
  namespaceId: config.namespaceId,
15
15
  authenticatedUser: config.authenticatedUser,
16
+ bearerToken: config.bearerToken,
16
17
  timeoutMs: config.timeoutMs ?? 3e4,
17
18
  maxRetries: config.maxRetries ?? 3,
18
19
  retryOn503: config.retryOn503 ?? false,
@@ -368,6 +369,9 @@ var WebSocketClient = class {
368
369
  buildUrl(path, params) {
369
370
  const baseUrl = this.config.baseUrl.replace(/^http:/, "ws:").replace(/^https:/, "wss:");
370
371
  const queryParams = new URLSearchParams({ tenant_id: this.config.tenantId });
372
+ if (this.config.bearerToken) {
373
+ queryParams.set("token", this.config.bearerToken);
374
+ }
371
375
  if (params) {
372
376
  for (const [key, value] of Object.entries(params)) {
373
377
  const wireKey = key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
@@ -581,6 +585,7 @@ function buildAuthHeaders(config) {
581
585
  if (config.userId) headers["X-User-Id"] = config.userId;
582
586
  if (config.namespaceId) headers["X-Namespace-Id"] = config.namespaceId;
583
587
  if (config.authenticatedUser) headers["X-Authenticated-User"] = config.authenticatedUser;
588
+ if (config.bearerToken) headers["Authorization"] = `Bearer ${config.bearerToken}`;
584
589
  return headers;
585
590
  }
586
591
  function transformRequestInit(init) {
@@ -8603,8 +8608,8 @@ var CognitiveClient = class {
8603
8608
  * @returns The agent's basic state.
8604
8609
  *
8605
8610
  * @remarks
8606
- * Uses a direct HTTP request fallback because this endpoint
8607
- * is not present in the generated route class.
8611
+ * Uses GET `/api/v1/cognitive/agents/{agent_id}`.
8612
+ * Tenant is identified by the `X-Tenant-Id` header (set automatically).
8608
8613
  */
8609
8614
  async getAgent(agentId) {
8610
8615
  const response = await this.api.http.request({
@@ -8612,7 +8617,7 @@ var CognitiveClient = class {
8612
8617
  method: "GET",
8613
8618
  format: "json"
8614
8619
  });
8615
- return response.data;
8620
+ return response.data.agent;
8616
8621
  }
8617
8622
  /**
8618
8623
  * Delete a cognitive agent.
@@ -8620,8 +8625,8 @@ var CognitiveClient = class {
8620
8625
  * @param agentId - Agent UUID.
8621
8626
  *
8622
8627
  * @remarks
8623
- * Uses a direct HTTP request fallback because this endpoint
8624
- * is not present in the generated route class.
8628
+ * Uses DELETE `/api/v1/cognitive/agents/{agent_id}`.
8629
+ * Tenant is identified by the `X-Tenant-Id` header (set automatically).
8625
8630
  */
8626
8631
  async deleteAgent(agentId) {
8627
8632
  await this.api.http.request({
@@ -8645,32 +8650,37 @@ var CognitiveClient = class {
8645
8650
  /**
8646
8651
  * Get agent drives and motivation state.
8647
8652
  *
8648
- * @param request - Agent ID and tenant ID.
8653
+ * @param request - Agent ID.
8649
8654
  * @returns The agent's motivation state including drives, deficits, and curiosity targets.
8650
8655
  *
8651
8656
  * @remarks
8652
- * Uses GET with agent_id as path parameter and tenant_id as query parameter.
8653
- * Returns drives, deficits, curiosity targets, and the dominant drive.
8657
+ * Uses GET `/api/v1/cognitive/agents/{agent_id}/drives`.
8658
+ * Tenant is identified by the `X-Tenant-Id` header (set automatically).
8654
8659
  */
8655
8660
  async getAgentDrives(request) {
8656
- const response = await this.api.getAgentDrives(request.agentId, {
8657
- tenant_id: this.tenantId
8661
+ const response = await this.api.http.request({
8662
+ path: `/api/v1/cognitive/agents/${request.agentId}/drives`,
8663
+ method: "GET",
8664
+ format: "json"
8658
8665
  });
8659
8666
  return response.data;
8660
8667
  }
8661
8668
  /**
8662
8669
  * Get extended agent state including full cognitive state.
8663
8670
  *
8664
- * @param request - Agent ID and tenant ID.
8671
+ * @param request - Agent ID.
8665
8672
  * @returns The agent's extended state including beliefs, goals, intentions,
8666
8673
  * pending perceptions, activations, recent episodes, and rule utilities.
8667
8674
  *
8668
8675
  * @remarks
8669
- * Uses GET with agent_id as path parameter and tenant_id as query parameter.
8676
+ * Uses GET `/api/v1/cognitive/agents/{agent_id}/extended-state`.
8677
+ * Tenant is identified by the `X-Tenant-Id` header (set automatically).
8670
8678
  */
8671
8679
  async getExtendedAgentState(request) {
8672
- const response = await this.api.getExtendedAgentState(request.agentId, {
8673
- tenant_id: this.tenantId
8680
+ const response = await this.api.http.request({
8681
+ path: `/api/v1/cognitive/agents/${request.agentId}/extended-state`,
8682
+ method: "GET",
8683
+ format: "json"
8674
8684
  });
8675
8685
  return response.data.agent;
8676
8686
  }
@@ -8918,8 +8928,10 @@ var CognitiveClient = class {
8918
8928
  * @returns Whether the plan was deleted.
8919
8929
  */
8920
8930
  async deletePlan(request) {
8921
- const response = await this.planLibrary.deletePlan(request.planId, {
8922
- tenant_id: this.tenantId
8931
+ const response = await this.api.http.request({
8932
+ path: `/api/v1/cognitive/agents/plans/${request.planId}`,
8933
+ method: "DELETE",
8934
+ format: "json"
8923
8935
  });
8924
8936
  return response.data;
8925
8937
  }