@seclai/sdk 1.1.2 → 1.1.4

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
@@ -58,6 +58,69 @@ interface components {
58
58
  * @enum {string}
59
59
  */
60
60
  AgentEvaluationTier: "fast" | "balanced" | "thorough";
61
+ /**
62
+ * AgentExportResponse
63
+ * @description Portable JSON snapshot of an agent definition.
64
+ */
65
+ AgentExportResponse: {
66
+ /**
67
+ * Agent
68
+ * @description Agent metadata and full definition. Keys: name, description, schema_version, definition, default_evaluation_tier, evaluation_mode, sampling_config, max_retries, retry_on_failure, prompt_model_auto_upgrade_strategy, prompt_model_auto_rollback_enabled, prompt_model_auto_rollback_triggers, created_at, updated_at.
69
+ */
70
+ agent: {
71
+ [key: string]: unknown;
72
+ };
73
+ /**
74
+ * Alert Configs
75
+ * @description Alert configurations.
76
+ */
77
+ alert_configs?: {
78
+ [key: string]: unknown;
79
+ }[] | null;
80
+ /**
81
+ * Dependencies
82
+ * @description Resolved dependency manifest. Keys: knowledge_bases, memory_banks, source_connections, agents, users — each a list of {id, name, description, …}.
83
+ */
84
+ dependencies?: {
85
+ [key: string]: unknown;
86
+ } | null;
87
+ /**
88
+ * Evaluation Criteria
89
+ * @description Evaluation criteria for agent steps.
90
+ */
91
+ evaluation_criteria?: {
92
+ [key: string]: unknown;
93
+ }[] | null;
94
+ /**
95
+ * Export Version
96
+ * @description Schema version of the export format (currently "2").
97
+ */
98
+ export_version: string;
99
+ /**
100
+ * Exported At
101
+ * @description ISO-8601 timestamp of when the export was generated.
102
+ */
103
+ exported_at: string;
104
+ /**
105
+ * Governance Policies
106
+ * @description Agent-scoped governance policies.
107
+ */
108
+ governance_policies?: {
109
+ [key: string]: unknown;
110
+ }[] | null;
111
+ /**
112
+ * Software Version
113
+ * @description Application version that produced this export.
114
+ */
115
+ software_version: string;
116
+ /**
117
+ * Trigger
118
+ * @description Trigger configuration with schedules.
119
+ */
120
+ trigger?: {
121
+ [key: string]: unknown;
122
+ } | null;
123
+ };
61
124
  /** AgentRunAttemptResponse */
62
125
  AgentRunAttemptResponse: {
63
126
  /**
@@ -176,6 +239,11 @@ interface components {
176
239
  * @description Timestamp when the step attempt ended.
177
240
  */
178
241
  ended_at: string | null;
242
+ /**
243
+ * Input
244
+ * @description Input provided to the step, if any.
245
+ */
246
+ input: string | null;
179
247
  /**
180
248
  * Output
181
249
  * @description Output produced by the step, if any.
@@ -1707,6 +1775,16 @@ interface components {
1707
1775
  */
1708
1776
  accepted: boolean;
1709
1777
  };
1778
+ /** MeResponse */
1779
+ MeResponse: {
1780
+ /**
1781
+ * Account Id
1782
+ * Format: uuid
1783
+ */
1784
+ account_id: string;
1785
+ /** Organizations */
1786
+ organizations: components["schemas"]["OrganizationInfoResponse"][];
1787
+ };
1710
1788
  /**
1711
1789
  * MemoryBankAiAssistantResponse
1712
1790
  * @description Response from the memory bank AI assistant.
@@ -1916,6 +1994,21 @@ interface components {
1916
1994
  /** Total */
1917
1995
  total: number;
1918
1996
  };
1997
+ /** OrganizationInfoResponse */
1998
+ OrganizationInfoResponse: {
1999
+ /**
2000
+ * Account Id
2001
+ * Format: uuid
2002
+ */
2003
+ account_id: string;
2004
+ /**
2005
+ * Id
2006
+ * Format: uuid
2007
+ */
2008
+ id: string;
2009
+ /** Name */
2010
+ name: string;
2011
+ };
1919
2012
  /**
1920
2013
  * PaginationResponse
1921
2014
  * @description Pagination information.
@@ -3639,7 +3732,7 @@ interface components {
3639
3732
  };
3640
3733
  responses: never;
3641
3734
  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. */
3735
+ /** @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
3736
  "X-Account-Id": string;
3644
3737
  };
3645
3738
  requestBodies: never;
@@ -3671,6 +3764,8 @@ type PaginationResponse = components["schemas"]["PaginationResponse"];
3671
3764
  type AgentListResponse = components["schemas"]["routers__api__agents__AgentListResponse"];
3672
3765
  /** Full agent configuration including definition and metadata. */
3673
3766
  type AgentDefinitionResponse = components["schemas"]["AgentDefinitionResponse"];
3767
+ /** Portable JSON snapshot of an agent definition. */
3768
+ type AgentExportResponse = components["schemas"]["AgentExportResponse"];
3674
3769
  /** Summary of an agent (returned on create/update). */
3675
3770
  type AgentSummaryResponse = components["schemas"]["AgentSummaryResponse"];
3676
3771
  /** Request body for creating an agent. */
@@ -4089,6 +4184,14 @@ declare class Seclai {
4089
4184
  * @param agentId - Agent identifier.
4090
4185
  */
4091
4186
  deleteAgent(agentId: string): Promise<void>;
4187
+ /**
4188
+ * Export an agent definition as a portable JSON snapshot.
4189
+ *
4190
+ * @param agentId - Agent identifier.
4191
+ * @param download - When true (default), the server sets Content-Disposition: attachment.
4192
+ * @returns The exported agent snapshot.
4193
+ */
4194
+ exportAgent(agentId: string, download?: boolean): Promise<AgentExportResponse>;
4092
4195
  /**
4093
4196
  * Get an agent's full definition (steps, model config, etc.).
4094
4197
  *
@@ -5087,7 +5190,7 @@ declare class Seclai {
5087
5190
 
5088
5191
  /** Resolved SSO profile settings. */
5089
5192
  interface SsoProfile {
5090
- ssoAccountId: string;
5193
+ ssoAccountId?: string | undefined;
5091
5194
  ssoRegion: string;
5092
5195
  ssoClientId: string;
5093
5196
  ssoDomain: string;
@@ -5102,6 +5205,49 @@ interface SsoCacheEntry {
5102
5205
  region: string;
5103
5206
  cognitoDomain: string;
5104
5207
  }
5208
+ /** Default SSO domain (production Cognito). Override with `SECLAI_SSO_DOMAIN` or config file. */
5209
+ declare const DEFAULT_SSO_DOMAIN = "auth.seclai.com";
5210
+ /** Default SSO client ID (production public client). Override with `SECLAI_SSO_CLIENT_ID` or config file. */
5211
+ declare const DEFAULT_SSO_CLIENT_ID = "4bgf8v9qmc5puivbaqon9n5lmr";
5212
+ /** Default SSO region. Override with `SECLAI_SSO_REGION` or config file. */
5213
+ declare const DEFAULT_SSO_REGION = "us-west-2";
5214
+ /**
5215
+ * Load and resolve an SSO profile from the config file.
5216
+ * Non-default profiles inherit unset keys from `[default]`.
5217
+ * All profiles fall back to built-in defaults and environment variable overrides.
5218
+ *
5219
+ * **Node.js only** — this function uses `node:fs` and `node:path` internally
5220
+ * and will throw in browser/edge-worker runtimes.
5221
+ *
5222
+ * @param configDir - Resolved config directory path.
5223
+ * @param profileName - Profile name to look up (`"default"` or a named profile).
5224
+ * @returns The resolved profile. Always returns a valid profile using built-in defaults.
5225
+ */
5226
+ declare function loadSsoProfile(configDir: string, profileName: string): Promise<SsoProfile>;
5227
+ declare function readSsoCache(configDir: string, profile: SsoProfile): Promise<SsoCacheEntry | null>;
5228
+ /**
5229
+ * Write a cached SSO token to disk atomically.
5230
+ * Creates the cache directory if it doesn't exist.
5231
+ *
5232
+ * @param configDir - Resolved config directory path.
5233
+ * @param profile - SSO profile (used to derive the cache filename).
5234
+ * @param entry - Token data to persist.
5235
+ */
5236
+ declare function writeSsoCache(configDir: string, profile: SsoProfile, entry: SsoCacheEntry): Promise<void>;
5237
+ /**
5238
+ * Delete a cached SSO token file.
5239
+ *
5240
+ * @param configDir - Resolved config directory path.
5241
+ * @param profile - SSO profile (used to derive the cache filename).
5242
+ */
5243
+ declare function deleteSsoCache(configDir: string, profile: SsoProfile): Promise<void>;
5244
+ /**
5245
+ * Check if a cached token is still valid (with 30s buffer).
5246
+ *
5247
+ * @param entry - The cached token entry to check.
5248
+ * @returns `true` if the token expires more than 30 seconds in the future.
5249
+ */
5250
+ declare function isTokenValid(entry: SsoCacheEntry): boolean;
5105
5251
  /** Options for resolving the credential chain. */
5106
5252
  interface CredentialChainOptions {
5107
5253
  /** Explicit API key (highest priority). */
@@ -5207,4 +5353,4 @@ declare class SeclaiStreamingError extends SeclaiError {
5207
5353
  constructor(message: string, runId?: string);
5208
5354
  }
5209
5355
 
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 };
5356
+ export { type AccessTokenProvider, type AddCommentRequest, type AddConversationTurnRequest, type AgentDefinitionResponse, type AgentEvaluationTier, type AgentExportResponse, 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
@@ -58,6 +58,69 @@ interface components {
58
58
  * @enum {string}
59
59
  */
60
60
  AgentEvaluationTier: "fast" | "balanced" | "thorough";
61
+ /**
62
+ * AgentExportResponse
63
+ * @description Portable JSON snapshot of an agent definition.
64
+ */
65
+ AgentExportResponse: {
66
+ /**
67
+ * Agent
68
+ * @description Agent metadata and full definition. Keys: name, description, schema_version, definition, default_evaluation_tier, evaluation_mode, sampling_config, max_retries, retry_on_failure, prompt_model_auto_upgrade_strategy, prompt_model_auto_rollback_enabled, prompt_model_auto_rollback_triggers, created_at, updated_at.
69
+ */
70
+ agent: {
71
+ [key: string]: unknown;
72
+ };
73
+ /**
74
+ * Alert Configs
75
+ * @description Alert configurations.
76
+ */
77
+ alert_configs?: {
78
+ [key: string]: unknown;
79
+ }[] | null;
80
+ /**
81
+ * Dependencies
82
+ * @description Resolved dependency manifest. Keys: knowledge_bases, memory_banks, source_connections, agents, users — each a list of {id, name, description, …}.
83
+ */
84
+ dependencies?: {
85
+ [key: string]: unknown;
86
+ } | null;
87
+ /**
88
+ * Evaluation Criteria
89
+ * @description Evaluation criteria for agent steps.
90
+ */
91
+ evaluation_criteria?: {
92
+ [key: string]: unknown;
93
+ }[] | null;
94
+ /**
95
+ * Export Version
96
+ * @description Schema version of the export format (currently "2").
97
+ */
98
+ export_version: string;
99
+ /**
100
+ * Exported At
101
+ * @description ISO-8601 timestamp of when the export was generated.
102
+ */
103
+ exported_at: string;
104
+ /**
105
+ * Governance Policies
106
+ * @description Agent-scoped governance policies.
107
+ */
108
+ governance_policies?: {
109
+ [key: string]: unknown;
110
+ }[] | null;
111
+ /**
112
+ * Software Version
113
+ * @description Application version that produced this export.
114
+ */
115
+ software_version: string;
116
+ /**
117
+ * Trigger
118
+ * @description Trigger configuration with schedules.
119
+ */
120
+ trigger?: {
121
+ [key: string]: unknown;
122
+ } | null;
123
+ };
61
124
  /** AgentRunAttemptResponse */
62
125
  AgentRunAttemptResponse: {
63
126
  /**
@@ -176,6 +239,11 @@ interface components {
176
239
  * @description Timestamp when the step attempt ended.
177
240
  */
178
241
  ended_at: string | null;
242
+ /**
243
+ * Input
244
+ * @description Input provided to the step, if any.
245
+ */
246
+ input: string | null;
179
247
  /**
180
248
  * Output
181
249
  * @description Output produced by the step, if any.
@@ -1707,6 +1775,16 @@ interface components {
1707
1775
  */
1708
1776
  accepted: boolean;
1709
1777
  };
1778
+ /** MeResponse */
1779
+ MeResponse: {
1780
+ /**
1781
+ * Account Id
1782
+ * Format: uuid
1783
+ */
1784
+ account_id: string;
1785
+ /** Organizations */
1786
+ organizations: components["schemas"]["OrganizationInfoResponse"][];
1787
+ };
1710
1788
  /**
1711
1789
  * MemoryBankAiAssistantResponse
1712
1790
  * @description Response from the memory bank AI assistant.
@@ -1916,6 +1994,21 @@ interface components {
1916
1994
  /** Total */
1917
1995
  total: number;
1918
1996
  };
1997
+ /** OrganizationInfoResponse */
1998
+ OrganizationInfoResponse: {
1999
+ /**
2000
+ * Account Id
2001
+ * Format: uuid
2002
+ */
2003
+ account_id: string;
2004
+ /**
2005
+ * Id
2006
+ * Format: uuid
2007
+ */
2008
+ id: string;
2009
+ /** Name */
2010
+ name: string;
2011
+ };
1919
2012
  /**
1920
2013
  * PaginationResponse
1921
2014
  * @description Pagination information.
@@ -3639,7 +3732,7 @@ interface components {
3639
3732
  };
3640
3733
  responses: never;
3641
3734
  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. */
3735
+ /** @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
3736
  "X-Account-Id": string;
3644
3737
  };
3645
3738
  requestBodies: never;
@@ -3671,6 +3764,8 @@ type PaginationResponse = components["schemas"]["PaginationResponse"];
3671
3764
  type AgentListResponse = components["schemas"]["routers__api__agents__AgentListResponse"];
3672
3765
  /** Full agent configuration including definition and metadata. */
3673
3766
  type AgentDefinitionResponse = components["schemas"]["AgentDefinitionResponse"];
3767
+ /** Portable JSON snapshot of an agent definition. */
3768
+ type AgentExportResponse = components["schemas"]["AgentExportResponse"];
3674
3769
  /** Summary of an agent (returned on create/update). */
3675
3770
  type AgentSummaryResponse = components["schemas"]["AgentSummaryResponse"];
3676
3771
  /** Request body for creating an agent. */
@@ -4089,6 +4184,14 @@ declare class Seclai {
4089
4184
  * @param agentId - Agent identifier.
4090
4185
  */
4091
4186
  deleteAgent(agentId: string): Promise<void>;
4187
+ /**
4188
+ * Export an agent definition as a portable JSON snapshot.
4189
+ *
4190
+ * @param agentId - Agent identifier.
4191
+ * @param download - When true (default), the server sets Content-Disposition: attachment.
4192
+ * @returns The exported agent snapshot.
4193
+ */
4194
+ exportAgent(agentId: string, download?: boolean): Promise<AgentExportResponse>;
4092
4195
  /**
4093
4196
  * Get an agent's full definition (steps, model config, etc.).
4094
4197
  *
@@ -5087,7 +5190,7 @@ declare class Seclai {
5087
5190
 
5088
5191
  /** Resolved SSO profile settings. */
5089
5192
  interface SsoProfile {
5090
- ssoAccountId: string;
5193
+ ssoAccountId?: string | undefined;
5091
5194
  ssoRegion: string;
5092
5195
  ssoClientId: string;
5093
5196
  ssoDomain: string;
@@ -5102,6 +5205,49 @@ interface SsoCacheEntry {
5102
5205
  region: string;
5103
5206
  cognitoDomain: string;
5104
5207
  }
5208
+ /** Default SSO domain (production Cognito). Override with `SECLAI_SSO_DOMAIN` or config file. */
5209
+ declare const DEFAULT_SSO_DOMAIN = "auth.seclai.com";
5210
+ /** Default SSO client ID (production public client). Override with `SECLAI_SSO_CLIENT_ID` or config file. */
5211
+ declare const DEFAULT_SSO_CLIENT_ID = "4bgf8v9qmc5puivbaqon9n5lmr";
5212
+ /** Default SSO region. Override with `SECLAI_SSO_REGION` or config file. */
5213
+ declare const DEFAULT_SSO_REGION = "us-west-2";
5214
+ /**
5215
+ * Load and resolve an SSO profile from the config file.
5216
+ * Non-default profiles inherit unset keys from `[default]`.
5217
+ * All profiles fall back to built-in defaults and environment variable overrides.
5218
+ *
5219
+ * **Node.js only** — this function uses `node:fs` and `node:path` internally
5220
+ * and will throw in browser/edge-worker runtimes.
5221
+ *
5222
+ * @param configDir - Resolved config directory path.
5223
+ * @param profileName - Profile name to look up (`"default"` or a named profile).
5224
+ * @returns The resolved profile. Always returns a valid profile using built-in defaults.
5225
+ */
5226
+ declare function loadSsoProfile(configDir: string, profileName: string): Promise<SsoProfile>;
5227
+ declare function readSsoCache(configDir: string, profile: SsoProfile): Promise<SsoCacheEntry | null>;
5228
+ /**
5229
+ * Write a cached SSO token to disk atomically.
5230
+ * Creates the cache directory if it doesn't exist.
5231
+ *
5232
+ * @param configDir - Resolved config directory path.
5233
+ * @param profile - SSO profile (used to derive the cache filename).
5234
+ * @param entry - Token data to persist.
5235
+ */
5236
+ declare function writeSsoCache(configDir: string, profile: SsoProfile, entry: SsoCacheEntry): Promise<void>;
5237
+ /**
5238
+ * Delete a cached SSO token file.
5239
+ *
5240
+ * @param configDir - Resolved config directory path.
5241
+ * @param profile - SSO profile (used to derive the cache filename).
5242
+ */
5243
+ declare function deleteSsoCache(configDir: string, profile: SsoProfile): Promise<void>;
5244
+ /**
5245
+ * Check if a cached token is still valid (with 30s buffer).
5246
+ *
5247
+ * @param entry - The cached token entry to check.
5248
+ * @returns `true` if the token expires more than 30 seconds in the future.
5249
+ */
5250
+ declare function isTokenValid(entry: SsoCacheEntry): boolean;
5105
5251
  /** Options for resolving the credential chain. */
5106
5252
  interface CredentialChainOptions {
5107
5253
  /** Explicit API key (highest priority). */
@@ -5207,4 +5353,4 @@ declare class SeclaiStreamingError extends SeclaiError {
5207
5353
  constructor(message: string, runId?: string);
5208
5354
  }
5209
5355
 
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 };
5356
+ export { type AccessTokenProvider, type AddCommentRequest, type AddConversationTurnRequest, type AgentDefinitionResponse, type AgentEvaluationTier, type AgentExportResponse, 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;
@@ -735,6 +747,21 @@ var Seclai = class {
735
747
  await this.request("DELETE", `/agents/${agentId}`);
736
748
  }
737
749
  // ═══════════════════════════════════════════════════════════════════════════
750
+ // Agent Export
751
+ // ═══════════════════════════════════════════════════════════════════════════
752
+ /**
753
+ * Export an agent definition as a portable JSON snapshot.
754
+ *
755
+ * @param agentId - Agent identifier.
756
+ * @param download - When true (default), the server sets Content-Disposition: attachment.
757
+ * @returns The exported agent snapshot.
758
+ */
759
+ async exportAgent(agentId, download = true) {
760
+ return await this.request("GET", `/agents/${agentId}/export`, {
761
+ query: { download }
762
+ });
763
+ }
764
+ // ═══════════════════════════════════════════════════════════════════════════
738
765
  // Agent Definitions
739
766
  // ═══════════════════════════════════════════════════════════════════════════
740
767
  /**
@@ -2230,12 +2257,20 @@ var Seclai = class {
2230
2257
  }
2231
2258
  };
2232
2259
  export {
2260
+ DEFAULT_SSO_CLIENT_ID,
2261
+ DEFAULT_SSO_DOMAIN,
2262
+ DEFAULT_SSO_REGION,
2233
2263
  SECLAI_API_URL,
2234
2264
  Seclai,
2235
2265
  SeclaiAPIStatusError,
2236
2266
  SeclaiAPIValidationError,
2237
2267
  SeclaiConfigurationError,
2238
2268
  SeclaiError,
2239
- SeclaiStreamingError
2269
+ SeclaiStreamingError,
2270
+ deleteSsoCache,
2271
+ isTokenValid,
2272
+ loadSsoProfile,
2273
+ readSsoCache,
2274
+ writeSsoCache
2240
2275
  };
2241
2276
  //# sourceMappingURL=index.js.map