@axonflow/sdk 4.3.1 → 5.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.
Files changed (49) hide show
  1. package/dist/cjs/adapters/governed-tool.d.ts +89 -0
  2. package/dist/cjs/adapters/governed-tool.d.ts.map +1 -0
  3. package/dist/cjs/adapters/governed-tool.js +131 -0
  4. package/dist/cjs/adapters/governed-tool.js.map +1 -0
  5. package/dist/cjs/client.d.ts +15 -1
  6. package/dist/cjs/client.d.ts.map +1 -1
  7. package/dist/cjs/client.js +34 -16
  8. package/dist/cjs/client.js.map +1 -1
  9. package/dist/cjs/index.d.ts +2 -0
  10. package/dist/cjs/index.d.ts.map +1 -1
  11. package/dist/cjs/index.js +5 -1
  12. package/dist/cjs/index.js.map +1 -1
  13. package/dist/cjs/telemetry.d.ts.map +1 -1
  14. package/dist/cjs/telemetry.js +1 -19
  15. package/dist/cjs/telemetry.js.map +1 -1
  16. package/dist/cjs/types/config.d.ts +1 -1
  17. package/dist/cjs/types/masfeat.d.ts +2 -2
  18. package/dist/cjs/types/masfeat.d.ts.map +1 -1
  19. package/dist/cjs/types/planning.d.ts +1 -0
  20. package/dist/cjs/types/planning.d.ts.map +1 -1
  21. package/dist/cjs/types/proxy.d.ts +4 -4
  22. package/dist/cjs/types/proxy.d.ts.map +1 -1
  23. package/dist/cjs/version.d.ts +1 -1
  24. package/dist/cjs/version.js +1 -1
  25. package/dist/esm/adapters/governed-tool.d.ts +89 -0
  26. package/dist/esm/adapters/governed-tool.d.ts.map +1 -0
  27. package/dist/esm/adapters/governed-tool.js +126 -0
  28. package/dist/esm/adapters/governed-tool.js.map +1 -0
  29. package/dist/esm/client.d.ts +15 -1
  30. package/dist/esm/client.d.ts.map +1 -1
  31. package/dist/esm/client.js +34 -16
  32. package/dist/esm/client.js.map +1 -1
  33. package/dist/esm/index.d.ts +2 -0
  34. package/dist/esm/index.d.ts.map +1 -1
  35. package/dist/esm/index.js +2 -0
  36. package/dist/esm/index.js.map +1 -1
  37. package/dist/esm/telemetry.d.ts.map +1 -1
  38. package/dist/esm/telemetry.js +1 -19
  39. package/dist/esm/telemetry.js.map +1 -1
  40. package/dist/esm/types/config.d.ts +1 -1
  41. package/dist/esm/types/masfeat.d.ts +2 -2
  42. package/dist/esm/types/masfeat.d.ts.map +1 -1
  43. package/dist/esm/types/planning.d.ts +1 -0
  44. package/dist/esm/types/planning.d.ts.map +1 -1
  45. package/dist/esm/types/proxy.d.ts +4 -4
  46. package/dist/esm/types/proxy.d.ts.map +1 -1
  47. package/dist/esm/version.d.ts +1 -1
  48. package/dist/esm/version.js +1 -1
  49. package/package.json +1 -1
@@ -78,21 +78,19 @@ export class AxonFlow {
78
78
  * Get authentication headers based on configured credentials.
79
79
  *
80
80
  * Uses OAuth2-style Basic auth: Authorization: Basic base64(clientId:clientSecret)
81
- * Also adds X-Tenant-ID header from clientId for tenant context.
81
+ * Tenant identity is derived server-side from the client credentials.
82
82
  *
83
83
  * @returns Headers object with authentication headers
84
84
  */
85
85
  getAuthHeaders() {
86
86
  const headers = {};
87
- // OAuth2-style client credentials
88
- if (this.config.clientId && this.config.clientSecret) {
89
- const credentials = Buffer.from(`${this.config.clientId}:${this.config.clientSecret}`).toString('base64');
87
+ // Always send Basic auth when clientId is set — server derives tenant from it.
88
+ // clientSecret defaults to empty string for community/no-secret mode.
89
+ const effectiveClientId = this.getEffectiveClientId();
90
+ if (effectiveClientId) {
91
+ const credentials = Buffer.from(`${effectiveClientId}:${this.config.clientSecret || ''}`).toString('base64');
90
92
  headers['Authorization'] = `Basic ${credentials}`;
91
93
  }
92
- // Always add X-Tenant-ID when clientId is set (required for multi-tenant APIs)
93
- if (this.config.clientId) {
94
- headers['X-Tenant-ID'] = this.config.clientId;
95
- }
96
94
  // Include SDK version for version discovery and compatibility checks
97
95
  headers['User-Agent'] = `axonflow-sdk-typescript/${VERSION}`;
98
96
  return headers;
@@ -364,10 +362,12 @@ export class AxonFlow {
364
362
  };
365
363
  }
366
364
  const data = await response.json();
367
- // Warn if SDK version is below platform minimum
368
- if (data.sdk_compatibility?.min_sdk_version &&
369
- compareSemver(VERSION, data.sdk_compatibility.min_sdk_version) < 0) {
370
- console.warn(`[AxonFlow SDK] WARNING: SDK version ${VERSION} is below minimum supported version ${data.sdk_compatibility.min_sdk_version}. Please upgrade.`);
365
+ // Warn if SDK version is below platform minimum for TypeScript
366
+ const minVersion = typeof data.sdk_compatibility?.min_sdk_version === 'string'
367
+ ? data.sdk_compatibility.min_sdk_version
368
+ : data.sdk_compatibility?.min_sdk_version?.typescript;
369
+ if (minVersion && compareSemver(VERSION, minVersion) < 0) {
370
+ console.warn(`[AxonFlow SDK] WARNING: SDK version ${VERSION} is below minimum supported version ${minVersion}. Please upgrade.`);
371
371
  }
372
372
  return {
373
373
  status: data.status === 'healthy' ? 'healthy' : 'degraded',
@@ -956,6 +956,24 @@ export class AxonFlow {
956
956
  }
957
957
  return responseData;
958
958
  }
959
+ /**
960
+ * Alias for {@link mcpCheckInput}. Validates tool input against configured policies.
961
+ *
962
+ * @param options - Input check options including connector type and statement
963
+ * @returns MCPCheckInputResponse with allowed status and policy evaluation details
964
+ */
965
+ async checkToolInput(options) {
966
+ return this.mcpCheckInput(options);
967
+ }
968
+ /**
969
+ * Alias for {@link mcpCheckOutput}. Validates tool output against configured policies.
970
+ *
971
+ * @param options - Output check options including connector type and response data
972
+ * @returns MCPCheckOutputResponse with allowed status, redacted data, and policy details
973
+ */
974
+ async checkToolOutput(options) {
975
+ return this.mcpCheckOutput(options);
976
+ }
959
977
  /**
960
978
  * Generate a multi-agent execution plan from a natural language query
961
979
  * @param query - Natural language query describing the task
@@ -1005,6 +1023,7 @@ export class AxonFlow {
1005
1023
  }
1006
1024
  return {
1007
1025
  planId,
1026
+ status: agentResponse.data?.status || 'pending',
1008
1027
  steps: agentResponse.data?.steps || [],
1009
1028
  domain: agentResponse.data?.domain || domain || 'generic',
1010
1029
  complexity: agentResponse.data?.complexity || 0,
@@ -1915,7 +1934,6 @@ export class AxonFlow {
1915
1934
  'Content-Type': 'application/json',
1916
1935
  ...this.getAuthHeaders(),
1917
1936
  };
1918
- // Note: X-Tenant-ID is set by getAuthHeaders() from clientId
1919
1937
  // Do NOT set X-Org-ID here - the server derives org from tenant context
1920
1938
  // Setting X-Org-ID to 'default' breaks budget queries which expect org_id to match client.OrgID
1921
1939
  return headers;
@@ -4275,8 +4293,8 @@ export class AxonFlow {
4275
4293
  params.append('status', options.status);
4276
4294
  if (options?.useCase)
4277
4295
  params.append('use_case', options.useCase);
4278
- if (options?.materiality)
4279
- params.append('materiality', options.materiality);
4296
+ if (options?.materialityClassification)
4297
+ params.append('materiality', options.materialityClassification);
4280
4298
  if (options?.limit)
4281
4299
  params.append('limit', options.limit.toString());
4282
4300
  if (options?.offset)
@@ -4745,7 +4763,7 @@ export class AxonFlow {
4745
4763
  customerImpact: data.customer_impact ?? data.risk_rating_impact,
4746
4764
  modelComplexity: data.model_complexity ?? data.risk_rating_complexity,
4747
4765
  humanReliance: data.human_reliance ?? data.risk_rating_reliance,
4748
- materiality: data.materiality || data.materiality_classification,
4766
+ materialityClassification: data.materiality_classification,
4749
4767
  status: data.status,
4750
4768
  metadata: data.metadata,
4751
4769
  createdAt: new Date(data.created_at),