@axonflow/sdk 1.14.0 → 2.1.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,4 +1,4 @@
1
- import { AxonFlowConfig, ConnectorMetadata, ConnectorInstallRequest, ConnectorResponse, ConnectorHealthStatus, PlanResponse, PlanExecutionResponse, PolicyApprovalResult, PolicyApprovalOptions, AuditResult, AuditOptions, ExecuteQueryOptions, ExecuteQueryResponse, HealthStatus, StaticPolicy, DynamicPolicy, PolicyOverride, ListStaticPoliciesOptions, ListDynamicPoliciesOptions, CreateStaticPolicyRequest, UpdateStaticPolicyRequest, CreateDynamicPolicyRequest, UpdateDynamicPolicyRequest, CreatePolicyOverrideRequest, TestPatternResult, PolicyVersion, EffectivePoliciesOptions, GitProviderType, ConfigureGitProviderRequest, ConfigureGitProviderResponse, ValidateGitProviderRequest, ValidateGitProviderResponse, ListGitProvidersResponse, CreatePRRequest, CreatePRResponse, PRRecord, ListPRsOptions, ListPRsResponse, CodeGovernanceMetrics, ExportOptions, ExportResponse, ExecutionSnapshot, TimelineEntry, ExecutionDetail, ListExecutionsResponse, ListExecutionsOptions, ExecutionExportOptions, Budget, BudgetsResponse, BudgetStatus, BudgetAlertsResponse, BudgetDecision, UsageSummary, UsageBreakdown, UsageRecordsResponse, PricingListResponse, CreateBudgetRequest, UpdateBudgetRequest, ListBudgetsOptions, BudgetCheckRequest, ListUsageRecordsOptions } from './types';
1
+ import { AxonFlowConfig, ConnectorMetadata, ConnectorInstallRequest, ConnectorResponse, ConnectorHealthStatus, PlanResponse, PlanExecutionResponse, PolicyApprovalResult, PolicyApprovalOptions, AuditResult, AuditOptions, AuditSearchRequest, AuditQueryOptions, AuditSearchResponse, ExecuteQueryOptions, ExecuteQueryResponse, HealthStatus, StaticPolicy, DynamicPolicy, PolicyOverride, ListStaticPoliciesOptions, ListDynamicPoliciesOptions, CreateStaticPolicyRequest, UpdateStaticPolicyRequest, CreateDynamicPolicyRequest, UpdateDynamicPolicyRequest, CreatePolicyOverrideRequest, TestPatternResult, PolicyVersion, EffectivePoliciesOptions, GitProviderType, ConfigureGitProviderRequest, ConfigureGitProviderResponse, ValidateGitProviderRequest, ValidateGitProviderResponse, ListGitProvidersResponse, CreatePRRequest, CreatePRResponse, PRRecord, ListPRsOptions, ListPRsResponse, CodeGovernanceMetrics, ExportOptions, ExportResponse, ExecutionSnapshot, TimelineEntry, ExecutionDetail, ListExecutionsResponse, ListExecutionsOptions, ExecutionExportOptions, Budget, BudgetsResponse, BudgetStatus, BudgetAlertsResponse, BudgetDecision, UsageSummary, UsageBreakdown, UsageRecordsResponse, PricingListResponse, CreateBudgetRequest, UpdateBudgetRequest, ListBudgetsOptions, BudgetCheckRequest, ListUsageRecordsOptions } from './types';
2
2
  /**
3
3
  * Main AxonFlow client for invisible AI governance
4
4
  */
@@ -239,6 +239,61 @@ export declare class AxonFlow {
239
239
  * ```
240
240
  */
241
241
  auditLLMCall(options: AuditOptions): Promise<AuditResult>;
242
+ /**
243
+ * Search audit logs with optional filters.
244
+ *
245
+ * Query the AxonFlow orchestrator for audit logs matching the specified
246
+ * criteria. Use this for compliance dashboards, security investigations,
247
+ * and operational monitoring.
248
+ *
249
+ * @param request - Search filters and pagination options
250
+ * @returns Promise resolving to audit search response
251
+ *
252
+ * @example
253
+ * ```typescript
254
+ * // Search for logs from a specific user in the last 24 hours
255
+ * const yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000);
256
+ * const result = await client.searchAuditLogs({
257
+ * userEmail: 'analyst@company.com',
258
+ * startTime: yesterday,
259
+ * limit: 100,
260
+ * });
261
+ *
262
+ * for (const entry of result.entries) {
263
+ * console.log(`[${entry.timestamp}] ${entry.userEmail}: ${entry.querySummary}`);
264
+ * }
265
+ * ```
266
+ */
267
+ searchAuditLogs(request?: AuditSearchRequest): Promise<AuditSearchResponse>;
268
+ /**
269
+ * Get recent audit logs for a specific tenant.
270
+ *
271
+ * Convenience method for tenant-scoped audit queries. Use this when you
272
+ * need to view all recent activity for a specific tenant.
273
+ *
274
+ * @param tenantId - The tenant identifier to query
275
+ * @param options - Pagination options (limit, offset)
276
+ * @returns Promise resolving to audit search response
277
+ * @throws Error if tenantId is empty
278
+ *
279
+ * @example
280
+ * ```typescript
281
+ * // Get the last 50 audit logs for a tenant
282
+ * const result = await client.getAuditLogsByTenant('tenant-abc');
283
+ * console.log(`Found ${result.entries.length} entries`);
284
+ *
285
+ * // With custom options
286
+ * const result2 = await client.getAuditLogsByTenant('tenant-abc', {
287
+ * limit: 100,
288
+ * offset: 50,
289
+ * });
290
+ * ```
291
+ */
292
+ getAuditLogsByTenant(tenantId: string, options?: AuditQueryOptions): Promise<AuditSearchResponse>;
293
+ /**
294
+ * Parse a raw audit log entry from the API into the typed interface
295
+ */
296
+ private parseAuditLogEntry;
242
297
  /**
243
298
  * Build authentication headers for API requests
244
299
  */
@@ -742,21 +797,17 @@ export declare class AxonFlow {
742
797
  */
743
798
  exportCodeGovernanceDataCSV(options?: ExportOptions): Promise<string>;
744
799
  /**
745
- * Get the orchestrator URL for Execution Replay API.
746
- * Falls back to agent endpoint with port 8081 if not configured.
800
+ * Get the endpoint URL for API requests.
801
+ * All routes now go through the single Agent endpoint (ADR-026).
747
802
  */
748
- private getOrchestratorUrl;
803
+ private getEndpointUrl;
749
804
  /**
750
- * Generic HTTP request helper for orchestrator APIs
805
+ * Generic HTTP request helper for APIs (routes through single endpoint per ADR-026)
751
806
  */
752
807
  private orchestratorRequest;
753
- /**
754
- * Get the portal URL for enterprise PR workflow features.
755
- * Falls back to agent endpoint with port 8082 if not configured.
756
- */
757
- private getPortalUrl;
758
808
  /**
759
809
  * Generic HTTP request helper for Customer Portal APIs (enterprise features).
810
+ * Routes through single endpoint per ADR-026.
760
811
  * Requires prior authentication via loginToPortal().
761
812
  */
762
813
  private portalRequest;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,E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Key,
24
24
  endpoint,
25
- orchestratorEndpoint: config.orchestratorEndpoint,
26
- portalEndpoint: config.portalEndpoint,
27
25
  mode: config.mode || (hasCredentials ? 'production' : 'sandbox'),
28
26
  tenant: config.tenant || 'default',
29
27
  debug: config.debug || false,
@@ -327,7 +325,7 @@ class AxonFlow {
327
325
  * ```
328
326
  */
329
327
  async orchestratorHealthCheck() {
330
- const url = `${this.getOrchestratorUrl()}/health`;
328
+ const url = `${this.config.endpoint}/health`;
331
329
  try {
332
330
  const response = await fetch(url, {
333
331
  method: 'GET',
@@ -785,6 +783,7 @@ class AxonFlow {
785
783
  const result = {
786
784
  contextId: data.context_id,
787
785
  approved: data.approved,
786
+ requiresRedaction: data.requires_redaction || false,
788
787
  approvedData: data.approved_data || {},
789
788
  policies: data.policies || [],
790
789
  expiresAt,
@@ -889,6 +888,153 @@ class AxonFlow {
889
888
  return result;
890
889
  }
891
890
  // ============================================================================
891
+ // Audit Log Read Methods
892
+ // ============================================================================
893
+ /**
894
+ * Search audit logs with optional filters.
895
+ *
896
+ * Query the AxonFlow orchestrator for audit logs matching the specified
897
+ * criteria. Use this for compliance dashboards, security investigations,
898
+ * and operational monitoring.
899
+ *
900
+ * @param request - Search filters and pagination options
901
+ * @returns Promise resolving to audit search response
902
+ *
903
+ * @example
904
+ * ```typescript
905
+ * // Search for logs from a specific user in the last 24 hours
906
+ * const yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000);
907
+ * const result = await client.searchAuditLogs({
908
+ * userEmail: 'analyst@company.com',
909
+ * startTime: yesterday,
910
+ * limit: 100,
911
+ * });
912
+ *
913
+ * for (const entry of result.entries) {
914
+ * console.log(`[${entry.timestamp}] ${entry.userEmail}: ${entry.querySummary}`);
915
+ * }
916
+ * ```
917
+ */
918
+ async searchAuditLogs(request) {
919
+ const limit = Math.min(request?.limit ?? 100, 1000);
920
+ const offset = request?.offset ?? 0;
921
+ // Build request body with only defined values
922
+ const body = { limit };
923
+ if (request?.userEmail)
924
+ body.user_email = request.userEmail;
925
+ if (request?.clientId)
926
+ body.client_id = request.clientId;
927
+ if (request?.startTime)
928
+ body.start_time = request.startTime.toISOString();
929
+ if (request?.endTime)
930
+ body.end_time = request.endTime.toISOString();
931
+ if (request?.requestType)
932
+ body.request_type = request.requestType;
933
+ if (offset > 0)
934
+ body.offset = offset;
935
+ if (this.config.debug) {
936
+ (0, helpers_1.debugLog)('Searching audit logs', { limit, offset });
937
+ }
938
+ const response = await this.orchestratorRequest('POST', '/api/v1/audit/search', body);
939
+ // Handle both array and wrapped response formats
940
+ if (Array.isArray(response)) {
941
+ const entries = response.map(e => this.parseAuditLogEntry(e));
942
+ return {
943
+ entries,
944
+ total: entries.length,
945
+ limit,
946
+ offset,
947
+ };
948
+ }
949
+ const data = response;
950
+ const entries = (data.entries || []).map(e => this.parseAuditLogEntry(e));
951
+ return {
952
+ entries,
953
+ total: data.total ?? entries.length,
954
+ limit: data.limit ?? limit,
955
+ offset: data.offset ?? offset,
956
+ };
957
+ }
958
+ /**
959
+ * Get recent audit logs for a specific tenant.
960
+ *
961
+ * Convenience method for tenant-scoped audit queries. Use this when you
962
+ * need to view all recent activity for a specific tenant.
963
+ *
964
+ * @param tenantId - The tenant identifier to query
965
+ * @param options - Pagination options (limit, offset)
966
+ * @returns Promise resolving to audit search response
967
+ * @throws Error if tenantId is empty
968
+ *
969
+ * @example
970
+ * ```typescript
971
+ * // Get the last 50 audit logs for a tenant
972
+ * const result = await client.getAuditLogsByTenant('tenant-abc');
973
+ * console.log(`Found ${result.entries.length} entries`);
974
+ *
975
+ * // With custom options
976
+ * const result2 = await client.getAuditLogsByTenant('tenant-abc', {
977
+ * limit: 100,
978
+ * offset: 50,
979
+ * });
980
+ * ```
981
+ */
982
+ async getAuditLogsByTenant(tenantId, options) {
983
+ if (!tenantId) {
984
+ throw new Error('tenantId is required');
985
+ }
986
+ const limit = Math.min(options?.limit ?? 50, 1000);
987
+ const offset = options?.offset ?? 0;
988
+ if (this.config.debug) {
989
+ (0, helpers_1.debugLog)('Getting audit logs for tenant', { tenantId, limit, offset });
990
+ }
991
+ const path = `/api/v1/audit/tenant/${encodeURIComponent(tenantId)}?limit=${limit}&offset=${offset}`;
992
+ const response = await this.orchestratorRequest('GET', path);
993
+ // Handle both array and wrapped response formats
994
+ if (Array.isArray(response)) {
995
+ const entries = response.map(e => this.parseAuditLogEntry(e));
996
+ return {
997
+ entries,
998
+ total: entries.length,
999
+ limit,
1000
+ offset,
1001
+ };
1002
+ }
1003
+ const data = response;
1004
+ const entries = (data.entries || []).map(e => this.parseAuditLogEntry(e));
1005
+ return {
1006
+ entries,
1007
+ total: data.total ?? entries.length,
1008
+ limit: data.limit ?? limit,
1009
+ offset: data.offset ?? offset,
1010
+ };
1011
+ }
1012
+ /**
1013
+ * Parse a raw audit log entry from the API into the typed interface
1014
+ */
1015
+ parseAuditLogEntry(raw) {
1016
+ const data = raw;
1017
+ return {
1018
+ id: data.id ?? '',
1019
+ requestId: data.request_id ?? '',
1020
+ timestamp: data.timestamp ? new Date(data.timestamp) : new Date(),
1021
+ userEmail: data.user_email ?? '',
1022
+ clientId: data.client_id ?? '',
1023
+ tenantId: data.tenant_id ?? '',
1024
+ requestType: data.request_type ?? '',
1025
+ querySummary: data.query_summary ?? '',
1026
+ success: data.success ?? true,
1027
+ blocked: data.blocked ?? false,
1028
+ riskScore: data.risk_score ?? 0,
1029
+ provider: data.provider ?? '',
1030
+ model: data.model ?? '',
1031
+ tokensUsed: data.tokens_used ?? 0,
1032
+ latencyMs: data.latency_ms ?? 0,
1033
+ policyViolations: data.policy_violations ?? [],
1034
+ metadata: data.metadata ?? {},
1035
+ };
1036
+ }
1037
+ // ============================================================================
892
1038
  // Policy CRUD Methods - Static Policies
893
1039
  // ============================================================================
894
1040
  /**
@@ -898,9 +1044,9 @@ class AxonFlow {
898
1044
  const headers = {
899
1045
  'Content-Type': 'application/json',
900
1046
  };
901
- // Always include tenant ID for policy APIs
1047
+ // Always include tenant ID for policy APIs (X-Org-ID header for server compatibility)
902
1048
  if (this.config.tenant) {
903
- headers['X-Tenant-ID'] = this.config.tenant;
1049
+ headers['X-Org-ID'] = this.config.tenant;
904
1050
  }
905
1051
  // Add auth headers only when credentials are provided
906
1052
  // Community/self-hosted mode works without credentials
@@ -1172,7 +1318,16 @@ class AxonFlow {
1172
1318
  (0, helpers_1.debugLog)('Getting static policy versions', { id });
1173
1319
  }
1174
1320
  const response = await this.policyRequest('GET', `/api/v1/static-policies/${id}/versions`);
1175
- return response.versions;
1321
+ // Transform snake_case API response to camelCase
1322
+ return response.versions.map(v => ({
1323
+ version: v.version,
1324
+ changedBy: v.changed_by,
1325
+ changedAt: v.changed_at,
1326
+ changeType: v.change_type,
1327
+ changeDescription: v.change_description,
1328
+ previousValues: v.previous_values,
1329
+ newValues: v.new_values,
1330
+ }));
1176
1331
  }
1177
1332
  // ============================================================================
1178
1333
  // Policy Override Methods (Enterprise)
@@ -1273,11 +1428,14 @@ class AxonFlow {
1273
1428
  if (options?.search)
1274
1429
  params.set('search', options.search);
1275
1430
  const queryString = params.toString();
1276
- const path = `/api/v1/policies/dynamic${queryString ? `?${queryString}` : ''}`;
1431
+ const path = `/api/v1/dynamic-policies${queryString ? `?${queryString}` : ''}`;
1277
1432
  if (this.config.debug) {
1278
1433
  (0, helpers_1.debugLog)('Listing dynamic policies', { options });
1279
1434
  }
1280
- return this.orchestratorRequest('GET', path);
1435
+ // API returns {"policies": [...]} wrapper via Agent proxy
1436
+ const response = await this.orchestratorRequest('GET', path);
1437
+ // Handle both wrapped and unwrapped responses for compatibility
1438
+ return Array.isArray(response) ? response : response.policies;
1281
1439
  }
1282
1440
  /**
1283
1441
  * Get a specific dynamic policy by ID.
@@ -1289,7 +1447,10 @@ class AxonFlow {
1289
1447
  if (this.config.debug) {
1290
1448
  (0, helpers_1.debugLog)('Getting dynamic policy', { id });
1291
1449
  }
1292
- return this.orchestratorRequest('GET', `/api/v1/policies/dynamic/${id}`);
1450
+ // API returns {"policy": {...}} wrapper via Agent proxy
1451
+ const response = await this.orchestratorRequest('GET', `/api/v1/dynamic-policies/${id}`);
1452
+ // Handle both wrapped and unwrapped responses for compatibility
1453
+ return 'policy' in response ? response.policy : response;
1293
1454
  }
1294
1455
  /**
1295
1456
  * Create a new dynamic policy.
@@ -1314,7 +1475,10 @@ class AxonFlow {
1314
1475
  if (this.config.debug) {
1315
1476
  (0, helpers_1.debugLog)('Creating dynamic policy', { name: policy.name });
1316
1477
  }
1317
- return this.orchestratorRequest('POST', '/api/v1/policies/dynamic', policy);
1478
+ // API returns {"policy": {...}} wrapper via Agent proxy
1479
+ const response = await this.orchestratorRequest('POST', '/api/v1/dynamic-policies', policy);
1480
+ // Handle both wrapped and unwrapped responses for compatibility
1481
+ return 'policy' in response ? response.policy : response;
1318
1482
  }
1319
1483
  /**
1320
1484
  * Update an existing dynamic policy.
@@ -1327,7 +1491,10 @@ class AxonFlow {
1327
1491
  if (this.config.debug) {
1328
1492
  (0, helpers_1.debugLog)('Updating dynamic policy', { id, updates: Object.keys(policy) });
1329
1493
  }
1330
- return this.orchestratorRequest('PUT', `/api/v1/policies/dynamic/${id}`, policy);
1494
+ // API returns {"policy": {...}} wrapper via Agent proxy
1495
+ const response = await this.orchestratorRequest('PUT', `/api/v1/dynamic-policies/${id}`, policy);
1496
+ // Handle both wrapped and unwrapped responses for compatibility
1497
+ return 'policy' in response ? response.policy : response;
1331
1498
  }
1332
1499
  /**
1333
1500
  * Delete a dynamic policy.
@@ -1338,7 +1505,7 @@ class AxonFlow {
1338
1505
  if (this.config.debug) {
1339
1506
  (0, helpers_1.debugLog)('Deleting dynamic policy', { id });
1340
1507
  }
1341
- await this.orchestratorRequest('DELETE', `/api/v1/policies/dynamic/${id}`);
1508
+ await this.orchestratorRequest('DELETE', `/api/v1/dynamic-policies/${id}`);
1342
1509
  }
1343
1510
  /**
1344
1511
  * Toggle a dynamic policy's enabled status.
@@ -1351,9 +1518,10 @@ class AxonFlow {
1351
1518
  if (this.config.debug) {
1352
1519
  (0, helpers_1.debugLog)('Toggling dynamic policy', { id, enabled });
1353
1520
  }
1354
- return this.orchestratorRequest('PATCH', `/api/v1/policies/dynamic/${id}`, {
1355
- enabled,
1356
- });
1521
+ // API returns {"policy": {...}} wrapper via Agent proxy
1522
+ const response = await this.orchestratorRequest('PUT', `/api/v1/dynamic-policies/${id}`, { enabled });
1523
+ // Handle both wrapped and unwrapped responses for compatibility
1524
+ return 'policy' in response ? response.policy : response;
1357
1525
  }
1358
1526
  /**
1359
1527
  * Get effective dynamic policies with tier inheritance applied.
@@ -1368,11 +1536,14 @@ class AxonFlow {
1368
1536
  if (options?.includeDisabled)
1369
1537
  params.set('include_disabled', 'true');
1370
1538
  const queryString = params.toString();
1371
- const path = `/api/v1/policies/dynamic/effective${queryString ? `?${queryString}` : ''}`;
1539
+ const path = `/api/v1/dynamic-policies/effective${queryString ? `?${queryString}` : ''}`;
1372
1540
  if (this.config.debug) {
1373
1541
  (0, helpers_1.debugLog)('Getting effective dynamic policies', { options });
1374
1542
  }
1375
- return this.orchestratorRequest('GET', path);
1543
+ // API returns {"policies": [...]} wrapper via Agent proxy
1544
+ const response = await this.orchestratorRequest('GET', path);
1545
+ // Handle both wrapped and unwrapped responses for compatibility
1546
+ return Array.isArray(response) ? response : response.policies;
1376
1547
  }
1377
1548
  // ============================================================================
1378
1549
  // Portal Authentication Methods (Enterprise)
@@ -1395,7 +1566,7 @@ class AxonFlow {
1395
1566
  * ```
1396
1567
  */
1397
1568
  async loginToPortal(orgId, password) {
1398
- const url = `${this.getPortalUrl()}/api/v1/auth/login`;
1569
+ const url = `${this.config.endpoint}/api/v1/auth/login`;
1399
1570
  const response = await fetch(url, {
1400
1571
  method: 'POST',
1401
1572
  headers: { 'Content-Type': 'application/json' },
@@ -1438,7 +1609,7 @@ class AxonFlow {
1438
1609
  return;
1439
1610
  }
1440
1611
  try {
1441
- await fetch(`${this.getPortalUrl()}/api/v1/auth/logout`, {
1612
+ await fetch(`${this.config.endpoint}/api/v1/auth/logout`, {
1442
1613
  method: 'POST',
1443
1614
  headers: { Cookie: `axonflow_session=${this.sessionCookie}` },
1444
1615
  signal: AbortSignal.timeout(this.config.timeout),
@@ -1919,28 +2090,17 @@ class AxonFlow {
1919
2090
  // Execution Replay Methods
1920
2091
  // ============================================================================
1921
2092
  /**
1922
- * Get the orchestrator URL for Execution Replay API.
1923
- * Falls back to agent endpoint with port 8081 if not configured.
2093
+ * Get the endpoint URL for API requests.
2094
+ * All routes now go through the single Agent endpoint (ADR-026).
1924
2095
  */
1925
- getOrchestratorUrl() {
1926
- if (this.config.orchestratorEndpoint) {
1927
- return this.config.orchestratorEndpoint;
1928
- }
1929
- // Default: assume orchestrator is on same host as agent, port 8081
1930
- try {
1931
- const url = new URL(this.config.endpoint);
1932
- url.port = '8081';
1933
- return url.toString().replace(/\/$/, '');
1934
- }
1935
- catch {
1936
- return 'http://localhost:8081';
1937
- }
2096
+ getEndpointUrl() {
2097
+ return this.config.endpoint;
1938
2098
  }
1939
2099
  /**
1940
- * Generic HTTP request helper for orchestrator APIs
2100
+ * Generic HTTP request helper for APIs (routes through single endpoint per ADR-026)
1941
2101
  */
1942
2102
  async orchestratorRequest(method, path, body) {
1943
- const url = `${this.getOrchestratorUrl()}${path}`;
2103
+ const url = `${this.config.endpoint}${path}`;
1944
2104
  const headers = this.buildAuthHeaders();
1945
2105
  const options = {
1946
2106
  method,
@@ -1967,33 +2127,18 @@ class AxonFlow {
1967
2127
  }
1968
2128
  return response.json();
1969
2129
  }
1970
- /**
1971
- * Get the portal URL for enterprise PR workflow features.
1972
- * Falls back to agent endpoint with port 8082 if not configured.
1973
- */
1974
- getPortalUrl() {
1975
- if (this.config.portalEndpoint) {
1976
- return this.config.portalEndpoint;
1977
- }
1978
- // Default: assume portal is on same host as agent, port 8082
1979
- try {
1980
- const url = new URL(this.config.endpoint);
1981
- url.port = '8082';
1982
- return url.toString().replace(/\/$/, '');
1983
- }
1984
- catch {
1985
- return 'http://localhost:8082';
1986
- }
1987
- }
2130
+ // Note: getPortalUrl() was removed in v2.0.0 (ADR-026 Single Entry Point).
2131
+ // All routes now go through the single Agent endpoint (this.config.endpoint).
1988
2132
  /**
1989
2133
  * Generic HTTP request helper for Customer Portal APIs (enterprise features).
2134
+ * Routes through single endpoint per ADR-026.
1990
2135
  * Requires prior authentication via loginToPortal().
1991
2136
  */
1992
2137
  async portalRequest(method, path, body) {
1993
2138
  if (!this.sessionCookie) {
1994
2139
  throw new errors_1.AuthenticationError('Not logged in to Customer Portal. Call loginToPortal() first.');
1995
2140
  }
1996
- const url = `${this.getPortalUrl()}${path}`;
2141
+ const url = `${this.config.endpoint}${path}`;
1997
2142
  const headers = {
1998
2143
  'Content-Type': 'application/json',
1999
2144
  Cookie: `axonflow_session=${this.sessionCookie}`,
@@ -2591,7 +2736,7 @@ class AxonFlow {
2591
2736
  if (!this.sessionCookie) {
2592
2737
  throw new errors_1.AuthenticationError('Not logged in to Customer Portal. Call loginToPortal() first.');
2593
2738
  }
2594
- const url = `${this.getPortalUrl()}${path}`;
2739
+ const url = `${this.config.endpoint}${path}`;
2595
2740
  const headers = {
2596
2741
  Cookie: `axonflow_session=${this.sessionCookie}`,
2597
2742
  };