@seclai/sdk 1.1.2 → 1.1.3

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
@@ -1707,6 +1707,16 @@ interface components {
1707
1707
  */
1708
1708
  accepted: boolean;
1709
1709
  };
1710
+ /** MeResponse */
1711
+ MeResponse: {
1712
+ /**
1713
+ * Account Id
1714
+ * Format: uuid
1715
+ */
1716
+ account_id: string;
1717
+ /** Organizations */
1718
+ organizations: components["schemas"]["OrganizationInfoResponse"][];
1719
+ };
1710
1720
  /**
1711
1721
  * MemoryBankAiAssistantResponse
1712
1722
  * @description Response from the memory bank AI assistant.
@@ -1916,6 +1926,21 @@ interface components {
1916
1926
  /** Total */
1917
1927
  total: number;
1918
1928
  };
1929
+ /** OrganizationInfoResponse */
1930
+ OrganizationInfoResponse: {
1931
+ /**
1932
+ * Account Id
1933
+ * Format: uuid
1934
+ */
1935
+ account_id: string;
1936
+ /**
1937
+ * Id
1938
+ * Format: uuid
1939
+ */
1940
+ id: string;
1941
+ /** Name */
1942
+ name: string;
1943
+ };
1919
1944
  /**
1920
1945
  * PaginationResponse
1921
1946
  * @description Pagination information.
@@ -3639,7 +3664,7 @@ interface components {
3639
3664
  };
3640
3665
  responses: never;
3641
3666
  parameters: {
3642
- /** @description Target a different organization account. When omitted, the user's default account is used. For API key authentication the key's account is always used; the header is accepted but has no effect. */
3667
+ /** @description Target a different organization account (OAuth only). When omitted, the user's default account is used. Ignored for API key authentication the key's account is always used. */
3643
3668
  "X-Account-Id": string;
3644
3669
  };
3645
3670
  requestBodies: never;
@@ -5087,7 +5112,7 @@ declare class Seclai {
5087
5112
 
5088
5113
  /** Resolved SSO profile settings. */
5089
5114
  interface SsoProfile {
5090
- ssoAccountId: string;
5115
+ ssoAccountId?: string | undefined;
5091
5116
  ssoRegion: string;
5092
5117
  ssoClientId: string;
5093
5118
  ssoDomain: string;
@@ -5102,6 +5127,49 @@ interface SsoCacheEntry {
5102
5127
  region: string;
5103
5128
  cognitoDomain: string;
5104
5129
  }
5130
+ /** Default SSO domain (production Cognito). Override with `SECLAI_SSO_DOMAIN` or config file. */
5131
+ declare const DEFAULT_SSO_DOMAIN = "auth.seclai.com";
5132
+ /** Default SSO client ID (production public client). Override with `SECLAI_SSO_CLIENT_ID` or config file. */
5133
+ declare const DEFAULT_SSO_CLIENT_ID = "4bgf8v9qmc5puivbaqon9n5lmr";
5134
+ /** Default SSO region. Override with `SECLAI_SSO_REGION` or config file. */
5135
+ declare const DEFAULT_SSO_REGION = "us-west-2";
5136
+ /**
5137
+ * Load and resolve an SSO profile from the config file.
5138
+ * Non-default profiles inherit unset keys from `[default]`.
5139
+ * All profiles fall back to built-in defaults and environment variable overrides.
5140
+ *
5141
+ * **Node.js only** — this function uses `node:fs` and `node:path` internally
5142
+ * and will throw in browser/edge-worker runtimes.
5143
+ *
5144
+ * @param configDir - Resolved config directory path.
5145
+ * @param profileName - Profile name to look up (`"default"` or a named profile).
5146
+ * @returns The resolved profile. Always returns a valid profile using built-in defaults.
5147
+ */
5148
+ declare function loadSsoProfile(configDir: string, profileName: string): Promise<SsoProfile>;
5149
+ declare function readSsoCache(configDir: string, profile: SsoProfile): Promise<SsoCacheEntry | null>;
5150
+ /**
5151
+ * Write a cached SSO token to disk atomically.
5152
+ * Creates the cache directory if it doesn't exist.
5153
+ *
5154
+ * @param configDir - Resolved config directory path.
5155
+ * @param profile - SSO profile (used to derive the cache filename).
5156
+ * @param entry - Token data to persist.
5157
+ */
5158
+ declare function writeSsoCache(configDir: string, profile: SsoProfile, entry: SsoCacheEntry): Promise<void>;
5159
+ /**
5160
+ * Delete a cached SSO token file.
5161
+ *
5162
+ * @param configDir - Resolved config directory path.
5163
+ * @param profile - SSO profile (used to derive the cache filename).
5164
+ */
5165
+ declare function deleteSsoCache(configDir: string, profile: SsoProfile): Promise<void>;
5166
+ /**
5167
+ * Check if a cached token is still valid (with 30s buffer).
5168
+ *
5169
+ * @param entry - The cached token entry to check.
5170
+ * @returns `true` if the token expires more than 30 seconds in the future.
5171
+ */
5172
+ declare function isTokenValid(entry: SsoCacheEntry): boolean;
5105
5173
  /** Options for resolving the credential chain. */
5106
5174
  interface CredentialChainOptions {
5107
5175
  /** Explicit API key (highest priority). */
@@ -5207,4 +5275,4 @@ declare class SeclaiStreamingError extends SeclaiError {
5207
5275
  constructor(message: string, runId?: string);
5208
5276
  }
5209
5277
 
5210
- export { type AccessTokenProvider, type AddCommentRequest, type AddConversationTurnRequest, type AgentDefinitionResponse, type AgentEvaluationTier, type AgentListResponse, type AgentRunAttemptResponse, type AgentRunEvent, type AgentRunListResponse, type AgentRunRequest, type AgentRunResponse, type AgentRunStepResponse, type AgentRunStreamRequest, type AgentSummaryResponse, type AgentTraceMatchResponse, type AgentTraceSearchRequest, type AgentTraceSearchResponse, type AiAssistantAcceptRequest, type AiAssistantAcceptResponse, type AiAssistantFeedbackRequest, type AiAssistantFeedbackResponse, type AiAssistantGenerateRequest, type AiAssistantGenerateResponse, type AiConversationHistoryResponse, type AiConversationTurnResponse, type AuthState, type ChangeStatusRequest, type CompactionEvaluationModel, type CompactionTestResponse, type CompatibleRunListResponse, type CompatibleRunResponse, type ContentDetailResponse, type ContentEmbeddingResponse, type ContentEmbeddingsListResponse, type ContentFileUploadResponse, type CreateAgentRequest, type CreateAlertConfigRequest, type CreateEvaluationCriteriaRequest, type CreateEvaluationResultRequest, type CreateExportRequest, type CreateKnowledgeBaseBody, type CreateMemoryBankBody, type CreateSolutionRequest, type CreateSourceBody, type CredentialChainOptions, type EstimateExportRequest, type EstimateExportResponse, type EvaluationCriteriaResponse, type EvaluationResultListResponse, type EvaluationResultResponse, type EvaluationResultSummaryResponse, type EvaluationResultWithCriteriaListResponse, type EvaluationResultWithCriteriaResponse, type EvaluationRunSummaryListResponse, type EvaluationRunSummaryResponse, type EvaluationStatus, type ExamplePrompt, type ExecutedActionResponse, type ExportFormat, type ExportListResponse, type ExportResponse, type FetchLike, type FileUploadResponse, type GenerateAgentStepsRequest, type GenerateAgentStepsResponse, type GenerateStepConfigRequest, type GenerateStepConfigResponse, type GovernanceAiAcceptResponse, type GovernanceAiAssistantRequest, type GovernanceAiAssistantResponse, type GovernanceAppliedActionResponse, type GovernanceConversationResponse, type GovernanceProposedPolicyActionResponse, type HTTPValidationError, type InlineTextReplaceRequest, type InlineTextUploadRequest, type JSONValue, type KnowledgeBaseListResponse, type KnowledgeBaseResponse, type LinkResourcesRequest, type ListOptions, type MarkAiSuggestionRequest, type MarkConversationTurnRequest, type MemoryBankAcceptRequest, type MemoryBankAiAssistantRequest, type MemoryBankAiAssistantResponse, type MemoryBankConfigResponse, type MemoryBankConversationTurnResponse, type MemoryBankLastConversationResponse, type MemoryBankListResponse, type MemoryBankResponse, type NonManualEvaluationModeStatResponse, type NonManualEvaluationSummaryResponse, type OrganizationAlertPreferenceListResponse, type OrganizationAlertPreferenceResponse, type PaginationResponse, type PendingProcessingCompletedFailedStatus, type PromptModelAutoUpgradeStrategy, type ProposedActionResponse, SECLAI_API_URL, Seclai, SeclaiAPIStatusError, SeclaiAPIValidationError, SeclaiConfigurationError, SeclaiError, type SeclaiOptions, SeclaiStreamingError, type SolutionAgentResponse, type SolutionConversationResponse, type SolutionKnowledgeBaseResponse, type SolutionListResponse, type SolutionResponse, type SolutionSourceConnectionResponse, type SolutionSummaryResponse, type SortableListOptions, type SourceConnectionResponse, type SourceEmbeddingMigrationResponse, type SourceListResponse, type SourceResponse, type SsoCacheEntry, type SsoProfile, type StandaloneTestCompactionRequest, type StartSourceEmbeddingMigrationRequest, type TestCompactionRequest, type TestDraftEvaluationRequest, type TestDraftEvaluationResponse, type UnlinkResourcesRequest, type UpdateAgentDefinitionRequest, type UpdateAgentRequest, type UpdateAlertConfigRequest, type UpdateEvaluationCriteriaRequest, type UpdateKnowledgeBaseBody, type UpdateMemoryBankBody, type UpdateOrganizationAlertPreferenceRequest, type UpdateSolutionRequest, type UpdateSourceBody, type UploadAgentInputApiResponse, type ValidationError };
5278
+ export { type AccessTokenProvider, type AddCommentRequest, type AddConversationTurnRequest, type AgentDefinitionResponse, type AgentEvaluationTier, type AgentListResponse, type AgentRunAttemptResponse, type AgentRunEvent, type AgentRunListResponse, type AgentRunRequest, type AgentRunResponse, type AgentRunStepResponse, type AgentRunStreamRequest, type AgentSummaryResponse, type AgentTraceMatchResponse, type AgentTraceSearchRequest, type AgentTraceSearchResponse, type AiAssistantAcceptRequest, type AiAssistantAcceptResponse, type AiAssistantFeedbackRequest, type AiAssistantFeedbackResponse, type AiAssistantGenerateRequest, type AiAssistantGenerateResponse, type AiConversationHistoryResponse, type AiConversationTurnResponse, type AuthState, type ChangeStatusRequest, type CompactionEvaluationModel, type CompactionTestResponse, type CompatibleRunListResponse, type CompatibleRunResponse, type ContentDetailResponse, type ContentEmbeddingResponse, type ContentEmbeddingsListResponse, type ContentFileUploadResponse, type CreateAgentRequest, type CreateAlertConfigRequest, type CreateEvaluationCriteriaRequest, type CreateEvaluationResultRequest, type CreateExportRequest, type CreateKnowledgeBaseBody, type CreateMemoryBankBody, type CreateSolutionRequest, type CreateSourceBody, type CredentialChainOptions, DEFAULT_SSO_CLIENT_ID, DEFAULT_SSO_DOMAIN, DEFAULT_SSO_REGION, type EstimateExportRequest, type EstimateExportResponse, type EvaluationCriteriaResponse, type EvaluationResultListResponse, type EvaluationResultResponse, type EvaluationResultSummaryResponse, type EvaluationResultWithCriteriaListResponse, type EvaluationResultWithCriteriaResponse, type EvaluationRunSummaryListResponse, type EvaluationRunSummaryResponse, type EvaluationStatus, type ExamplePrompt, type ExecutedActionResponse, type ExportFormat, type ExportListResponse, type ExportResponse, type FetchLike, type FileUploadResponse, type GenerateAgentStepsRequest, type GenerateAgentStepsResponse, type GenerateStepConfigRequest, type GenerateStepConfigResponse, type GovernanceAiAcceptResponse, type GovernanceAiAssistantRequest, type GovernanceAiAssistantResponse, type GovernanceAppliedActionResponse, type GovernanceConversationResponse, type GovernanceProposedPolicyActionResponse, type HTTPValidationError, type InlineTextReplaceRequest, type InlineTextUploadRequest, type JSONValue, type KnowledgeBaseListResponse, type KnowledgeBaseResponse, type LinkResourcesRequest, type ListOptions, type MarkAiSuggestionRequest, type MarkConversationTurnRequest, type MemoryBankAcceptRequest, type MemoryBankAiAssistantRequest, type MemoryBankAiAssistantResponse, type MemoryBankConfigResponse, type MemoryBankConversationTurnResponse, type MemoryBankLastConversationResponse, type MemoryBankListResponse, type MemoryBankResponse, type NonManualEvaluationModeStatResponse, type NonManualEvaluationSummaryResponse, type OrganizationAlertPreferenceListResponse, type OrganizationAlertPreferenceResponse, type PaginationResponse, type PendingProcessingCompletedFailedStatus, type PromptModelAutoUpgradeStrategy, type ProposedActionResponse, SECLAI_API_URL, Seclai, SeclaiAPIStatusError, SeclaiAPIValidationError, SeclaiConfigurationError, SeclaiError, type SeclaiOptions, SeclaiStreamingError, type SolutionAgentResponse, type SolutionConversationResponse, type SolutionKnowledgeBaseResponse, type SolutionListResponse, type SolutionResponse, type SolutionSourceConnectionResponse, type SolutionSummaryResponse, type SortableListOptions, type SourceConnectionResponse, type SourceEmbeddingMigrationResponse, type SourceListResponse, type SourceResponse, type SsoCacheEntry, type SsoProfile, type StandaloneTestCompactionRequest, type StartSourceEmbeddingMigrationRequest, type TestCompactionRequest, type TestDraftEvaluationRequest, type TestDraftEvaluationResponse, type UnlinkResourcesRequest, type UpdateAgentDefinitionRequest, type UpdateAgentRequest, type UpdateAlertConfigRequest, type UpdateEvaluationCriteriaRequest, type UpdateKnowledgeBaseBody, type UpdateMemoryBankBody, type UpdateOrganizationAlertPreferenceRequest, type UpdateSolutionRequest, type UpdateSourceBody, type UploadAgentInputApiResponse, type ValidationError, deleteSsoCache, isTokenValid, loadSsoProfile, readSsoCache, writeSsoCache };
package/dist/index.d.ts CHANGED
@@ -1707,6 +1707,16 @@ interface components {
1707
1707
  */
1708
1708
  accepted: boolean;
1709
1709
  };
1710
+ /** MeResponse */
1711
+ MeResponse: {
1712
+ /**
1713
+ * Account Id
1714
+ * Format: uuid
1715
+ */
1716
+ account_id: string;
1717
+ /** Organizations */
1718
+ organizations: components["schemas"]["OrganizationInfoResponse"][];
1719
+ };
1710
1720
  /**
1711
1721
  * MemoryBankAiAssistantResponse
1712
1722
  * @description Response from the memory bank AI assistant.
@@ -1916,6 +1926,21 @@ interface components {
1916
1926
  /** Total */
1917
1927
  total: number;
1918
1928
  };
1929
+ /** OrganizationInfoResponse */
1930
+ OrganizationInfoResponse: {
1931
+ /**
1932
+ * Account Id
1933
+ * Format: uuid
1934
+ */
1935
+ account_id: string;
1936
+ /**
1937
+ * Id
1938
+ * Format: uuid
1939
+ */
1940
+ id: string;
1941
+ /** Name */
1942
+ name: string;
1943
+ };
1919
1944
  /**
1920
1945
  * PaginationResponse
1921
1946
  * @description Pagination information.
@@ -3639,7 +3664,7 @@ interface components {
3639
3664
  };
3640
3665
  responses: never;
3641
3666
  parameters: {
3642
- /** @description Target a different organization account. When omitted, the user's default account is used. For API key authentication the key's account is always used; the header is accepted but has no effect. */
3667
+ /** @description Target a different organization account (OAuth only). When omitted, the user's default account is used. Ignored for API key authentication the key's account is always used. */
3643
3668
  "X-Account-Id": string;
3644
3669
  };
3645
3670
  requestBodies: never;
@@ -5087,7 +5112,7 @@ declare class Seclai {
5087
5112
 
5088
5113
  /** Resolved SSO profile settings. */
5089
5114
  interface SsoProfile {
5090
- ssoAccountId: string;
5115
+ ssoAccountId?: string | undefined;
5091
5116
  ssoRegion: string;
5092
5117
  ssoClientId: string;
5093
5118
  ssoDomain: string;
@@ -5102,6 +5127,49 @@ interface SsoCacheEntry {
5102
5127
  region: string;
5103
5128
  cognitoDomain: string;
5104
5129
  }
5130
+ /** Default SSO domain (production Cognito). Override with `SECLAI_SSO_DOMAIN` or config file. */
5131
+ declare const DEFAULT_SSO_DOMAIN = "auth.seclai.com";
5132
+ /** Default SSO client ID (production public client). Override with `SECLAI_SSO_CLIENT_ID` or config file. */
5133
+ declare const DEFAULT_SSO_CLIENT_ID = "4bgf8v9qmc5puivbaqon9n5lmr";
5134
+ /** Default SSO region. Override with `SECLAI_SSO_REGION` or config file. */
5135
+ declare const DEFAULT_SSO_REGION = "us-west-2";
5136
+ /**
5137
+ * Load and resolve an SSO profile from the config file.
5138
+ * Non-default profiles inherit unset keys from `[default]`.
5139
+ * All profiles fall back to built-in defaults and environment variable overrides.
5140
+ *
5141
+ * **Node.js only** — this function uses `node:fs` and `node:path` internally
5142
+ * and will throw in browser/edge-worker runtimes.
5143
+ *
5144
+ * @param configDir - Resolved config directory path.
5145
+ * @param profileName - Profile name to look up (`"default"` or a named profile).
5146
+ * @returns The resolved profile. Always returns a valid profile using built-in defaults.
5147
+ */
5148
+ declare function loadSsoProfile(configDir: string, profileName: string): Promise<SsoProfile>;
5149
+ declare function readSsoCache(configDir: string, profile: SsoProfile): Promise<SsoCacheEntry | null>;
5150
+ /**
5151
+ * Write a cached SSO token to disk atomically.
5152
+ * Creates the cache directory if it doesn't exist.
5153
+ *
5154
+ * @param configDir - Resolved config directory path.
5155
+ * @param profile - SSO profile (used to derive the cache filename).
5156
+ * @param entry - Token data to persist.
5157
+ */
5158
+ declare function writeSsoCache(configDir: string, profile: SsoProfile, entry: SsoCacheEntry): Promise<void>;
5159
+ /**
5160
+ * Delete a cached SSO token file.
5161
+ *
5162
+ * @param configDir - Resolved config directory path.
5163
+ * @param profile - SSO profile (used to derive the cache filename).
5164
+ */
5165
+ declare function deleteSsoCache(configDir: string, profile: SsoProfile): Promise<void>;
5166
+ /**
5167
+ * Check if a cached token is still valid (with 30s buffer).
5168
+ *
5169
+ * @param entry - The cached token entry to check.
5170
+ * @returns `true` if the token expires more than 30 seconds in the future.
5171
+ */
5172
+ declare function isTokenValid(entry: SsoCacheEntry): boolean;
5105
5173
  /** Options for resolving the credential chain. */
5106
5174
  interface CredentialChainOptions {
5107
5175
  /** Explicit API key (highest priority). */
@@ -5207,4 +5275,4 @@ declare class SeclaiStreamingError extends SeclaiError {
5207
5275
  constructor(message: string, runId?: string);
5208
5276
  }
5209
5277
 
5210
- export { type AccessTokenProvider, type AddCommentRequest, type AddConversationTurnRequest, type AgentDefinitionResponse, type AgentEvaluationTier, type AgentListResponse, type AgentRunAttemptResponse, type AgentRunEvent, type AgentRunListResponse, type AgentRunRequest, type AgentRunResponse, type AgentRunStepResponse, type AgentRunStreamRequest, type AgentSummaryResponse, type AgentTraceMatchResponse, type AgentTraceSearchRequest, type AgentTraceSearchResponse, type AiAssistantAcceptRequest, type AiAssistantAcceptResponse, type AiAssistantFeedbackRequest, type AiAssistantFeedbackResponse, type AiAssistantGenerateRequest, type AiAssistantGenerateResponse, type AiConversationHistoryResponse, type AiConversationTurnResponse, type AuthState, type ChangeStatusRequest, type CompactionEvaluationModel, type CompactionTestResponse, type CompatibleRunListResponse, type CompatibleRunResponse, type ContentDetailResponse, type ContentEmbeddingResponse, type ContentEmbeddingsListResponse, type ContentFileUploadResponse, type CreateAgentRequest, type CreateAlertConfigRequest, type CreateEvaluationCriteriaRequest, type CreateEvaluationResultRequest, type CreateExportRequest, type CreateKnowledgeBaseBody, type CreateMemoryBankBody, type CreateSolutionRequest, type CreateSourceBody, type CredentialChainOptions, type EstimateExportRequest, type EstimateExportResponse, type EvaluationCriteriaResponse, type EvaluationResultListResponse, type EvaluationResultResponse, type EvaluationResultSummaryResponse, type EvaluationResultWithCriteriaListResponse, type EvaluationResultWithCriteriaResponse, type EvaluationRunSummaryListResponse, type EvaluationRunSummaryResponse, type EvaluationStatus, type ExamplePrompt, type ExecutedActionResponse, type ExportFormat, type ExportListResponse, type ExportResponse, type FetchLike, type FileUploadResponse, type GenerateAgentStepsRequest, type GenerateAgentStepsResponse, type GenerateStepConfigRequest, type GenerateStepConfigResponse, type GovernanceAiAcceptResponse, type GovernanceAiAssistantRequest, type GovernanceAiAssistantResponse, type GovernanceAppliedActionResponse, type GovernanceConversationResponse, type GovernanceProposedPolicyActionResponse, type HTTPValidationError, type InlineTextReplaceRequest, type InlineTextUploadRequest, type JSONValue, type KnowledgeBaseListResponse, type KnowledgeBaseResponse, type LinkResourcesRequest, type ListOptions, type MarkAiSuggestionRequest, type MarkConversationTurnRequest, type MemoryBankAcceptRequest, type MemoryBankAiAssistantRequest, type MemoryBankAiAssistantResponse, type MemoryBankConfigResponse, type MemoryBankConversationTurnResponse, type MemoryBankLastConversationResponse, type MemoryBankListResponse, type MemoryBankResponse, type NonManualEvaluationModeStatResponse, type NonManualEvaluationSummaryResponse, type OrganizationAlertPreferenceListResponse, type OrganizationAlertPreferenceResponse, type PaginationResponse, type PendingProcessingCompletedFailedStatus, type PromptModelAutoUpgradeStrategy, type ProposedActionResponse, SECLAI_API_URL, Seclai, SeclaiAPIStatusError, SeclaiAPIValidationError, SeclaiConfigurationError, SeclaiError, type SeclaiOptions, SeclaiStreamingError, type SolutionAgentResponse, type SolutionConversationResponse, type SolutionKnowledgeBaseResponse, type SolutionListResponse, type SolutionResponse, type SolutionSourceConnectionResponse, type SolutionSummaryResponse, type SortableListOptions, type SourceConnectionResponse, type SourceEmbeddingMigrationResponse, type SourceListResponse, type SourceResponse, type SsoCacheEntry, type SsoProfile, type StandaloneTestCompactionRequest, type StartSourceEmbeddingMigrationRequest, type TestCompactionRequest, type TestDraftEvaluationRequest, type TestDraftEvaluationResponse, type UnlinkResourcesRequest, type UpdateAgentDefinitionRequest, type UpdateAgentRequest, type UpdateAlertConfigRequest, type UpdateEvaluationCriteriaRequest, type UpdateKnowledgeBaseBody, type UpdateMemoryBankBody, type UpdateOrganizationAlertPreferenceRequest, type UpdateSolutionRequest, type UpdateSourceBody, type UploadAgentInputApiResponse, type ValidationError };
5278
+ export { type AccessTokenProvider, type AddCommentRequest, type AddConversationTurnRequest, type AgentDefinitionResponse, type AgentEvaluationTier, type AgentListResponse, type AgentRunAttemptResponse, type AgentRunEvent, type AgentRunListResponse, type AgentRunRequest, type AgentRunResponse, type AgentRunStepResponse, type AgentRunStreamRequest, type AgentSummaryResponse, type AgentTraceMatchResponse, type AgentTraceSearchRequest, type AgentTraceSearchResponse, type AiAssistantAcceptRequest, type AiAssistantAcceptResponse, type AiAssistantFeedbackRequest, type AiAssistantFeedbackResponse, type AiAssistantGenerateRequest, type AiAssistantGenerateResponse, type AiConversationHistoryResponse, type AiConversationTurnResponse, type AuthState, type ChangeStatusRequest, type CompactionEvaluationModel, type CompactionTestResponse, type CompatibleRunListResponse, type CompatibleRunResponse, type ContentDetailResponse, type ContentEmbeddingResponse, type ContentEmbeddingsListResponse, type ContentFileUploadResponse, type CreateAgentRequest, type CreateAlertConfigRequest, type CreateEvaluationCriteriaRequest, type CreateEvaluationResultRequest, type CreateExportRequest, type CreateKnowledgeBaseBody, type CreateMemoryBankBody, type CreateSolutionRequest, type CreateSourceBody, type CredentialChainOptions, DEFAULT_SSO_CLIENT_ID, DEFAULT_SSO_DOMAIN, DEFAULT_SSO_REGION, type EstimateExportRequest, type EstimateExportResponse, type EvaluationCriteriaResponse, type EvaluationResultListResponse, type EvaluationResultResponse, type EvaluationResultSummaryResponse, type EvaluationResultWithCriteriaListResponse, type EvaluationResultWithCriteriaResponse, type EvaluationRunSummaryListResponse, type EvaluationRunSummaryResponse, type EvaluationStatus, type ExamplePrompt, type ExecutedActionResponse, type ExportFormat, type ExportListResponse, type ExportResponse, type FetchLike, type FileUploadResponse, type GenerateAgentStepsRequest, type GenerateAgentStepsResponse, type GenerateStepConfigRequest, type GenerateStepConfigResponse, type GovernanceAiAcceptResponse, type GovernanceAiAssistantRequest, type GovernanceAiAssistantResponse, type GovernanceAppliedActionResponse, type GovernanceConversationResponse, type GovernanceProposedPolicyActionResponse, type HTTPValidationError, type InlineTextReplaceRequest, type InlineTextUploadRequest, type JSONValue, type KnowledgeBaseListResponse, type KnowledgeBaseResponse, type LinkResourcesRequest, type ListOptions, type MarkAiSuggestionRequest, type MarkConversationTurnRequest, type MemoryBankAcceptRequest, type MemoryBankAiAssistantRequest, type MemoryBankAiAssistantResponse, type MemoryBankConfigResponse, type MemoryBankConversationTurnResponse, type MemoryBankLastConversationResponse, type MemoryBankListResponse, type MemoryBankResponse, type NonManualEvaluationModeStatResponse, type NonManualEvaluationSummaryResponse, type OrganizationAlertPreferenceListResponse, type OrganizationAlertPreferenceResponse, type PaginationResponse, type PendingProcessingCompletedFailedStatus, type PromptModelAutoUpgradeStrategy, type ProposedActionResponse, SECLAI_API_URL, Seclai, SeclaiAPIStatusError, SeclaiAPIValidationError, SeclaiConfigurationError, SeclaiError, type SeclaiOptions, SeclaiStreamingError, type SolutionAgentResponse, type SolutionConversationResponse, type SolutionKnowledgeBaseResponse, type SolutionListResponse, type SolutionResponse, type SolutionSourceConnectionResponse, type SolutionSummaryResponse, type SortableListOptions, type SourceConnectionResponse, type SourceEmbeddingMigrationResponse, type SourceListResponse, type SourceResponse, type SsoCacheEntry, type SsoProfile, type StandaloneTestCompactionRequest, type StartSourceEmbeddingMigrationRequest, type TestCompactionRequest, type TestDraftEvaluationRequest, type TestDraftEvaluationResponse, type UnlinkResourcesRequest, type UpdateAgentDefinitionRequest, type UpdateAgentRequest, type UpdateAlertConfigRequest, type UpdateEvaluationCriteriaRequest, type UpdateKnowledgeBaseBody, type UpdateMemoryBankBody, type UpdateOrganizationAlertPreferenceRequest, type UpdateSolutionRequest, type UpdateSourceBody, type UploadAgentInputApiResponse, type ValidationError, deleteSsoCache, isTokenValid, loadSsoProfile, readSsoCache, writeSsoCache };
package/dist/index.js CHANGED
@@ -54,6 +54,9 @@ var SSO_CACHE_DIR = "sso/cache";
54
54
  var CONFIG_FILE = "config";
55
55
  var EXPIRY_BUFFER_MS = 3e4;
56
56
  var DEFAULT_API_KEY_HEADER = "x-api-key";
57
+ var DEFAULT_SSO_DOMAIN = "auth.seclai.com";
58
+ var DEFAULT_SSO_CLIENT_ID = "4bgf8v9qmc5puivbaqon9n5lmr";
59
+ var DEFAULT_SSO_REGION = "us-west-2";
57
60
  function getEnv(name) {
58
61
  const p = globalThis?.process;
59
62
  return p?.env?.[name];
@@ -127,19 +130,21 @@ async function resolveConfigDir(override) {
127
130
  async function loadSsoProfile(configDir, profileName) {
128
131
  const fs = await getFs();
129
132
  const pathMod = await getPath();
133
+ let merged = {};
130
134
  const configPath = pathMod.join(configDir, CONFIG_FILE);
131
- if (!fs.existsSync(configPath)) return null;
132
- const content = fs.readFileSync(configPath, "utf-8");
133
- const sections = parseIni(content);
134
- const defaultSection = sections["default"] ?? {};
135
- const profileSection = profileName === "default" ? defaultSection : sections[profileName];
136
- if (!profileSection) return null;
137
- const merged = profileName === "default" ? profileSection : { ...defaultSection, ...profileSection };
138
- const ssoAccountId = merged["sso_account_id"];
139
- const ssoRegion = merged["sso_region"];
140
- const ssoClientId = merged["sso_client_id"];
141
- const ssoDomain = merged["sso_domain"];
142
- if (!ssoAccountId || !ssoRegion || !ssoClientId || !ssoDomain) return null;
135
+ if (fs.existsSync(configPath)) {
136
+ const content = fs.readFileSync(configPath, "utf-8");
137
+ const sections = parseIni(content);
138
+ const defaultSection = sections["default"] ?? {};
139
+ const profileSection = profileName === "default" ? defaultSection : sections[profileName];
140
+ if (profileSection) {
141
+ merged = profileName === "default" ? profileSection : { ...defaultSection, ...profileSection };
142
+ }
143
+ }
144
+ const ssoDomain = getEnv("SECLAI_SSO_DOMAIN") ?? merged["sso_domain"] ?? DEFAULT_SSO_DOMAIN;
145
+ const ssoClientId = getEnv("SECLAI_SSO_CLIENT_ID") ?? merged["sso_client_id"] ?? DEFAULT_SSO_CLIENT_ID;
146
+ const ssoRegion = getEnv("SECLAI_SSO_REGION") ?? merged["sso_region"] ?? DEFAULT_SSO_REGION;
147
+ const ssoAccountId = merged["sso_account_id"] || void 0;
143
148
  return { ssoAccountId, ssoRegion, ssoClientId, ssoDomain };
144
149
  }
145
150
  async function resolveCachePath(configDir, profile) {
@@ -174,6 +179,13 @@ async function writeSsoCache(configDir, profile, entry) {
174
179
  }
175
180
  fs.renameSync(tmpPath, cachePath);
176
181
  }
182
+ async function deleteSsoCache(configDir, profile) {
183
+ const fs = await getFs();
184
+ const cachePath = await resolveCachePath(configDir, profile);
185
+ if (fs.existsSync(cachePath)) {
186
+ fs.unlinkSync(cachePath);
187
+ }
188
+ }
177
189
  function isTokenValid(entry) {
178
190
  const expiresAt = new Date(entry.expiresAt).getTime();
179
191
  return Date.now() + EXPIRY_BUFFER_MS < expiresAt;
@@ -249,17 +261,15 @@ async function resolveCredentialChain(opts) {
249
261
  const configDir = await resolveConfigDir(opts.configDir);
250
262
  const profileName = opts.profile ?? getEnv("SECLAI_PROFILE") ?? "default";
251
263
  const ssoProfile = await loadSsoProfile(configDir, profileName);
252
- if (ssoProfile) {
253
- return {
254
- mode: "sso",
255
- apiKeyHeader,
256
- accountId: opts.accountId ?? ssoProfile.ssoAccountId,
257
- ssoProfile,
258
- configDir,
259
- autoRefresh: opts.autoRefresh !== false,
260
- fetcher: opts.fetch
261
- };
262
- }
264
+ return {
265
+ mode: "sso",
266
+ apiKeyHeader,
267
+ accountId: opts.accountId ?? ssoProfile.ssoAccountId,
268
+ ssoProfile,
269
+ configDir,
270
+ autoRefresh: opts.autoRefresh !== false,
271
+ fetcher: opts.fetch
272
+ };
263
273
  } catch {
264
274
  }
265
275
  throw new Error(
@@ -329,7 +339,9 @@ function getEnv2(name) {
329
339
  return p?.env?.[name];
330
340
  }
331
341
  function buildURL(baseUrl, path, query) {
332
- const url = new URL(path, baseUrl);
342
+ const base = baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`;
343
+ const relative = path.startsWith("/") ? path.slice(1) : path;
344
+ const url = new URL(relative, base);
333
345
  if (query) {
334
346
  for (const [key, value] of Object.entries(query)) {
335
347
  if (value === void 0 || value === null) continue;
@@ -2230,12 +2242,20 @@ var Seclai = class {
2230
2242
  }
2231
2243
  };
2232
2244
  export {
2245
+ DEFAULT_SSO_CLIENT_ID,
2246
+ DEFAULT_SSO_DOMAIN,
2247
+ DEFAULT_SSO_REGION,
2233
2248
  SECLAI_API_URL,
2234
2249
  Seclai,
2235
2250
  SeclaiAPIStatusError,
2236
2251
  SeclaiAPIValidationError,
2237
2252
  SeclaiConfigurationError,
2238
2253
  SeclaiError,
2239
- SeclaiStreamingError
2254
+ SeclaiStreamingError,
2255
+ deleteSsoCache,
2256
+ isTokenValid,
2257
+ loadSsoProfile,
2258
+ readSsoCache,
2259
+ writeSsoCache
2240
2260
  };
2241
2261
  //# sourceMappingURL=index.js.map