@kortexya/reasoninglayer 0.3.0 → 0.4.2

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/README.md CHANGED
@@ -115,6 +115,7 @@ console.log(result.solutions); // Solutions with bindings
115
115
  const client = new ReasoningLayerClient({
116
116
  baseUrl: 'http://localhost:8083', // Required
117
117
  tenantId: 'your-tenant-uuid', // Required, sent as X-Tenant-Id
118
+ bearerToken: 'eyJhbGciOi...', // Optional, sent as Authorization: Bearer
118
119
  userId: 'user-uuid', // Optional, sent as X-User-Id
119
120
  namespaceId: 'ns-uuid', // Optional, sent as X-Namespace-Id
120
121
  maxRetries: 3, // Default: 3
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  // src/config.ts
4
- var SDK_VERSION = "0.3.0";
4
+ var SDK_VERSION = "0.4.2";
5
5
  function resolveConfig(config) {
6
6
  if (!config.baseUrl) {
7
7
  throw new Error("ClientConfig.baseUrl is required");
@@ -15,6 +15,7 @@ function resolveConfig(config) {
15
15
  userId: config.userId,
16
16
  namespaceId: config.namespaceId,
17
17
  authenticatedUser: config.authenticatedUser,
18
+ bearerToken: config.bearerToken,
18
19
  timeoutMs: config.timeoutMs ?? 3e4,
19
20
  maxRetries: config.maxRetries ?? 3,
20
21
  retryOn503: config.retryOn503 ?? false,
@@ -370,6 +371,9 @@ var WebSocketClient = class {
370
371
  buildUrl(path, params) {
371
372
  const baseUrl = this.config.baseUrl.replace(/^http:/, "ws:").replace(/^https:/, "wss:");
372
373
  const queryParams = new URLSearchParams({ tenant_id: this.config.tenantId });
374
+ if (this.config.bearerToken) {
375
+ queryParams.set("token", this.config.bearerToken);
376
+ }
373
377
  if (params) {
374
378
  for (const [key, value] of Object.entries(params)) {
375
379
  const wireKey = key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
@@ -583,6 +587,7 @@ function buildAuthHeaders(config) {
583
587
  if (config.userId) headers["X-User-Id"] = config.userId;
584
588
  if (config.namespaceId) headers["X-Namespace-Id"] = config.namespaceId;
585
589
  if (config.authenticatedUser) headers["X-Authenticated-User"] = config.authenticatedUser;
590
+ if (config.bearerToken) headers["Authorization"] = `Bearer ${config.bearerToken}`;
586
591
  return headers;
587
592
  }
588
593
  function transformRequestInit(init) {
@@ -8605,8 +8610,8 @@ var CognitiveClient = class {
8605
8610
  * @returns The agent's basic state.
8606
8611
  *
8607
8612
  * @remarks
8608
- * Uses a direct HTTP request fallback because this endpoint
8609
- * is not present in the generated route class.
8613
+ * Uses GET `/api/v1/cognitive/agents/{agent_id}`.
8614
+ * Tenant is identified by the `X-Tenant-Id` header (set automatically).
8610
8615
  */
8611
8616
  async getAgent(agentId) {
8612
8617
  const response = await this.api.http.request({
@@ -8614,7 +8619,7 @@ var CognitiveClient = class {
8614
8619
  method: "GET",
8615
8620
  format: "json"
8616
8621
  });
8617
- return response.data;
8622
+ return response.data.agent;
8618
8623
  }
8619
8624
  /**
8620
8625
  * Delete a cognitive agent.
@@ -8622,8 +8627,8 @@ var CognitiveClient = class {
8622
8627
  * @param agentId - Agent UUID.
8623
8628
  *
8624
8629
  * @remarks
8625
- * Uses a direct HTTP request fallback because this endpoint
8626
- * is not present in the generated route class.
8630
+ * Uses DELETE `/api/v1/cognitive/agents/{agent_id}`.
8631
+ * Tenant is identified by the `X-Tenant-Id` header (set automatically).
8627
8632
  */
8628
8633
  async deleteAgent(agentId) {
8629
8634
  await this.api.http.request({
@@ -8647,32 +8652,37 @@ var CognitiveClient = class {
8647
8652
  /**
8648
8653
  * Get agent drives and motivation state.
8649
8654
  *
8650
- * @param request - Agent ID and tenant ID.
8655
+ * @param request - Agent ID.
8651
8656
  * @returns The agent's motivation state including drives, deficits, and curiosity targets.
8652
8657
  *
8653
8658
  * @remarks
8654
- * Uses GET with agent_id as path parameter and tenant_id as query parameter.
8655
- * Returns drives, deficits, curiosity targets, and the dominant drive.
8659
+ * Uses GET `/api/v1/cognitive/agents/{agent_id}/drives`.
8660
+ * Tenant is identified by the `X-Tenant-Id` header (set automatically).
8656
8661
  */
8657
8662
  async getAgentDrives(request) {
8658
- const response = await this.api.getAgentDrives(request.agentId, {
8659
- tenant_id: this.tenantId
8663
+ const response = await this.api.http.request({
8664
+ path: `/api/v1/cognitive/agents/${request.agentId}/drives`,
8665
+ method: "GET",
8666
+ format: "json"
8660
8667
  });
8661
8668
  return response.data;
8662
8669
  }
8663
8670
  /**
8664
8671
  * Get extended agent state including full cognitive state.
8665
8672
  *
8666
- * @param request - Agent ID and tenant ID.
8673
+ * @param request - Agent ID.
8667
8674
  * @returns The agent's extended state including beliefs, goals, intentions,
8668
8675
  * pending perceptions, activations, recent episodes, and rule utilities.
8669
8676
  *
8670
8677
  * @remarks
8671
- * Uses GET with agent_id as path parameter and tenant_id as query parameter.
8678
+ * Uses GET `/api/v1/cognitive/agents/{agent_id}/extended-state`.
8679
+ * Tenant is identified by the `X-Tenant-Id` header (set automatically).
8672
8680
  */
8673
8681
  async getExtendedAgentState(request) {
8674
- const response = await this.api.getExtendedAgentState(request.agentId, {
8675
- tenant_id: this.tenantId
8682
+ const response = await this.api.http.request({
8683
+ path: `/api/v1/cognitive/agents/${request.agentId}/extended-state`,
8684
+ method: "GET",
8685
+ format: "json"
8676
8686
  });
8677
8687
  return response.data.agent;
8678
8688
  }
@@ -8920,8 +8930,10 @@ var CognitiveClient = class {
8920
8930
  * @returns Whether the plan was deleted.
8921
8931
  */
8922
8932
  async deletePlan(request) {
8923
- const response = await this.planLibrary.deletePlan(request.planId, {
8924
- tenant_id: this.tenantId
8933
+ const response = await this.api.http.request({
8934
+ path: `/api/v1/cognitive/agents/plans/${request.planId}`,
8935
+ method: "DELETE",
8936
+ format: "json"
8925
8937
  });
8926
8938
  return response.data;
8927
8939
  }