@openagentpack/sdk 0.3.0 → 0.3.1-beta-85cd4b6-20260727

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.ts CHANGED
@@ -142,6 +142,8 @@ interface AgentDecl {
142
142
  skills?: AgentSkillDecl[];
143
143
  vault?: string;
144
144
  memory_stores?: string[];
145
+ /** Resources mounted into every managed session created for this agent. */
146
+ resources?: SessionResourceDecl[];
145
147
  multiagent?: MultiagentDecl;
146
148
  metadata?: Record<string, string>;
147
149
  /** Provider-specific remote materialization. Omitted means the existing managed Agent resource. */
@@ -170,6 +172,8 @@ interface AgentSkillRefDecl {
170
172
  }
171
173
  interface AgentToolsDecl {
172
174
  builtin: string[];
175
+ /** Permission inherited by every enabled builtin without an explicit override. */
176
+ default_permission?: "allow" | "ask";
173
177
  mcp?: AgentMcpToolkitDecl[];
174
178
  permissions?: Record<string, "allow" | "ask">;
175
179
  }
@@ -210,6 +214,12 @@ interface DeploymentDecl {
210
214
  environment_variables?: string;
211
215
  }
212
216
  type DeploymentResourceDecl = DeploymentFileResource | DeploymentMemoryStoreResource | DeploymentGithubRepoResource;
217
+ /** Provider-neutral resources that can be attached directly when a session is created. */
218
+ interface SessionGithubRepoResourceDecl extends Omit<DeploymentGithubRepoResource, "authorization_token"> {
219
+ /** Required for private repositories; interpolate this value from an environment variable. */
220
+ authorization_token: string;
221
+ }
222
+ type SessionResourceDecl = SessionGithubRepoResourceDecl;
213
223
  interface DeploymentFileResource {
214
224
  type: "file";
215
225
  file_id?: string;
@@ -390,9 +400,22 @@ interface SessionFileResource {
390
400
  file_id: string;
391
401
  mount_path: string;
392
402
  }
403
+ interface SessionGithubRepositoryResource {
404
+ type: "github_repository";
405
+ url: string;
406
+ checkout?: {
407
+ branch?: string;
408
+ commit?: string;
409
+ };
410
+ mount_path?: string;
411
+ authorization_token: string;
412
+ }
413
+ type SessionResource = SessionGithubRepositoryResource;
393
414
  interface CommonSessionBindings {
394
415
  /** Uploaded files to mount in the session sandbox. */
395
416
  files?: SessionFileResource[];
417
+ /** Provider-neutral resources to mount when the session is created. */
418
+ resources?: SessionResource[];
396
419
  title?: string;
397
420
  metadata?: Record<string, string>;
398
421
  }
@@ -722,6 +745,19 @@ interface ProviderAdapter {
722
745
  downloadAllSkillFiles?(): Promise<Map<string, SkillFile[]>>;
723
746
  }
724
747
 
748
+ declare class ApiError extends Error {
749
+ readonly statusCode: number;
750
+ readonly responseBody: string;
751
+ constructor(statusCode: number, responseBody: string, prefix: string);
752
+ static isNotFound(err: unknown): boolean;
753
+ }
754
+ declare class ConflictError extends ApiError {
755
+ }
756
+
757
+ type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
758
+ /** Install the fetch implementation used by all provider clients; pass undefined to reset. */
759
+ declare function setDefaultFetch(fetchImpl: FetchLike | undefined): void;
760
+
725
761
  interface IStateManager {
726
762
  getResource(address: ResourceAddress): ResourceState | undefined;
727
763
  setResource(resource: ResourceState): void;
@@ -1248,6 +1284,8 @@ interface SessionCreateOptions {
1248
1284
  fileId: string;
1249
1285
  mountPath: string;
1250
1286
  }[];
1287
+ /** Explicit resources override the resources declared on the agent. */
1288
+ resources?: SessionResourceDecl[];
1251
1289
  title?: string;
1252
1290
  provider?: string;
1253
1291
  metadata?: Record<string, string>;
@@ -1359,12 +1397,16 @@ declare function streamSessionEvents(ctx: ProjectRuntimeContext, sessionId: stri
1359
1397
  interface MountedFile {
1360
1398
  mount_path: string;
1361
1399
  }
1400
+ /** Resolve the provider path used for a mounted Git repository. */
1401
+ declare function resolveRepositoryMountPath(provider: string, resource: SessionGithubRepositoryResource): string;
1362
1402
  /** Prepend the file-mount hint to a prompt. Returns the prompt unchanged when there are no files. */
1363
1403
  declare function prependFileHint(prompt: string, files: MountedFile[] | undefined, provider: string): string;
1364
1404
  /** 将 prompt 内 ⟦file:mountPath⟧ 占位符替换为 provider 感知的真实 sandbox 路径 */
1365
1405
  declare function rewriteFileMentions(prompt: string, provider: string): string;
1366
1406
  /** 发送给 provider 前统一处理:先替换 mention 占位符,再 prepend 文件 hint */
1367
1407
  declare function preparePromptForProvider(prompt: string, files: MountedFile[] | undefined, provider: string): string;
1408
+ /** Prepare only the first user message for a newly created Session. */
1409
+ declare function prepareInitialSessionPrompt(prompt: string, bindings: SessionBindings, provider: string): string;
1368
1410
 
1369
1411
  /**
1370
1412
  * Resolve a provider's config block from environment variables (actual values, not
@@ -1432,4 +1474,4 @@ declare class LocalFileStateBackend implements StateBackend {
1432
1474
  /** Normalize a skill zip and extract its entries to SkillFile[]. */
1433
1475
  declare function extractSkillZipFiles(raw: Buffer): Promise<SkillFile[]>;
1434
1476
 
1435
- export { AGENTS_CONFIG_PROVIDERS, AGENTS_PROVIDER_FIELDS, type AgentBuildInput, AgentDefinition, type AgentMcpBuildInput, type AgentSkillBuildInput, AgentSyncRun, AgentWithReadiness, type BackendRuntimeInput, type BatchCreateMemoryInput, type BatchCreateMemoryResult, CloudAgent, CloudEnvironment, CloudVault, type CollectedSessionEvents, type CreateMemoryInput, type CreateMemoryStoreInput, type DeploymentListFilter, type DeploymentListResult, type DestroyResourceResult, type DestructivePolicy, Diagnostic, type IStateManager, type LoadedProjectConfig, LocalFileStateBackend, type MemoryInfo, type MemoryListItem, type MemoryListOptions, type MemoryPage, type MemoryPrefixInfo, type MemoryProviderCapabilities, type MemoryStoreInfo, type MemoryStoreListOptions, type MemoryVersionInfo, type MemoryVersionListOptions, type MigrateOptions, type MigrateResult, PlannedAction, type ProjectRuntimeContext, type ProviderConfig, type ProviderConfigProvider, ProviderFileInfo, ProviderSessionEvent, type ProviderSessionInfo, type ProviderSkillInfo, type ResolvedProjectConfig, type ResourceActionResult, ResourceAddress, type ResourceExecutionResult, type ResourcePlanResult, type ResourceRefreshResult, type ResourceRuntimeOptions, type ResourceState, type ResourceSyncRun, ResourceType, type RuntimeFeedbackEvent, type RuntimeFeedbackSink, type SecretPlaceholder, type SkillFile, StateManager, type StateScope, type SyncProjectOptions, type SyncProjectResult, type UpdateMemoryInput, type UpdateMemoryStoreInput, UserError, type ValidateProjectConfigOptions, applyProviderConfigToEnv, archiveCloudAgent, archiveMemoryStore, areRuntimeCredentialsReady, batchCreateMemories, bootstrapRuntimeCredentials, bootstrapRuntimeCredentialsSync, buildAgentDecl, collectConfigReferences, createCloudEnvironment, createCloudVault, createMemory, createMemoryStore, createProjectRuntime, createSessionForAgent, createSkillFromFileId, decideDestructive, deleteCloudEnvironment, deleteCloudVault, deleteFile, deleteMemory, deleteMemoryStore, deleteSession, deleteSkill, destroyPlannedProjectResources, executePlannedProject, extractSkillZipFiles, getAgent, getDeploymentDetailsForContext, getDeploymentRuntimeProviderForContext, getFileDownloadUrl, getFileInfo, getMemory, getMemoryProviderCapabilities, getMemoryStore, getMemoryVersion, getSession, getSkillInfo, importResource, isTerminalSessionStatus, listAgentsWithReadiness, listCloudAgents, listCloudEnvironments, listCloudVaults, listDeploymentsForContext, listFiles, listMemories, listMemoryStores, listMemoryVersions, listProviderModelsForContext, listProviderNames, listRemoteDeploymentsForContext, listSessionEvents, listSessionSummaries, listSkills, loadDotEnv, loadProviderConfigIntoEnv, loadProviderConfigIntoEnvSync, migrateConfig, parseStateAddress, pauseDeploymentForContext, planDestroyProjectContext, planProjectContext, preparePromptForProvider, prependFileHint, providerConfigPath, readProjectRuntime, redactMemoryVersion, resolveActiveProvider, resolveProjectConfig, resolveProjectConfigFromObject, resolveProviderConfigFromEnv, resolveSessionProvider, resolveSyncProvider, rewriteFileMentions, runDeploymentForContext, sendSessionMessagePolling, sendSessionMessageStreaming, startSessionRun, startSessionRunPolling, streamSessionEvents, syncAgentResourcesWithStateBackend, syncProjectResourcesWithStateBackend, syncProviderResourcesFromContext, syncProviderResourcesFromEnv, updateMemory, updateMemoryStore, uploadFile, validateProjectConfig, writeProjectRuntime };
1477
+ export { AGENTS_CONFIG_PROVIDERS, AGENTS_PROVIDER_FIELDS, type AgentBuildInput, AgentDefinition, type AgentMcpBuildInput, type AgentSkillBuildInput, AgentSyncRun, AgentWithReadiness, ApiError, type BackendRuntimeInput, type BatchCreateMemoryInput, type BatchCreateMemoryResult, CloudAgent, CloudEnvironment, CloudVault, type CollectedSessionEvents, ConflictError, type CreateMemoryInput, type CreateMemoryStoreInput, type DeploymentListFilter, type DeploymentListResult, type DestroyResourceResult, type DestructivePolicy, Diagnostic, type FetchLike, type IStateManager, type LoadedProjectConfig, LocalFileStateBackend, type MemoryInfo, type MemoryListItem, type MemoryListOptions, type MemoryPage, type MemoryPrefixInfo, type MemoryProviderCapabilities, type MemoryStoreInfo, type MemoryStoreListOptions, type MemoryVersionInfo, type MemoryVersionListOptions, type MigrateOptions, type MigrateResult, PlannedAction, type ProjectRuntimeContext, type ProviderConfig, type ProviderConfigProvider, ProviderFileInfo, ProviderSessionEvent, type ProviderSessionInfo, type ProviderSkillInfo, type ResolvedProjectConfig, type ResourceActionResult, ResourceAddress, type ResourceExecutionResult, type ResourcePlanResult, type ResourceRefreshResult, type ResourceRuntimeOptions, type ResourceState, type ResourceSyncRun, ResourceType, type RuntimeFeedbackEvent, type RuntimeFeedbackSink, type SecretPlaceholder, type SkillFile, StateManager, type StateScope, type SyncProjectOptions, type SyncProjectResult, type UpdateMemoryInput, type UpdateMemoryStoreInput, UserError, type ValidateProjectConfigOptions, applyProviderConfigToEnv, archiveCloudAgent, archiveMemoryStore, areRuntimeCredentialsReady, batchCreateMemories, bootstrapRuntimeCredentials, bootstrapRuntimeCredentialsSync, buildAgentDecl, collectConfigReferences, createCloudEnvironment, createCloudVault, createMemory, createMemoryStore, createProjectRuntime, createSessionForAgent, createSkillFromFileId, decideDestructive, deleteCloudEnvironment, deleteCloudVault, deleteFile, deleteMemory, deleteMemoryStore, deleteSession, deleteSkill, destroyPlannedProjectResources, executePlannedProject, extractSkillZipFiles, getAgent, getDeploymentDetailsForContext, getDeploymentRuntimeProviderForContext, getFileDownloadUrl, getFileInfo, getMemory, getMemoryProviderCapabilities, getMemoryStore, getMemoryVersion, getSession, getSkillInfo, importResource, isTerminalSessionStatus, listAgentsWithReadiness, listCloudAgents, listCloudEnvironments, listCloudVaults, listDeploymentsForContext, listFiles, listMemories, listMemoryStores, listMemoryVersions, listProviderModelsForContext, listProviderNames, listRemoteDeploymentsForContext, listSessionEvents, listSessionSummaries, listSkills, loadDotEnv, loadProviderConfigIntoEnv, loadProviderConfigIntoEnvSync, migrateConfig, parseStateAddress, pauseDeploymentForContext, planDestroyProjectContext, planProjectContext, prepareInitialSessionPrompt, preparePromptForProvider, prependFileHint, providerConfigPath, readProjectRuntime, redactMemoryVersion, resolveActiveProvider, resolveProjectConfig, resolveProjectConfigFromObject, resolveProviderConfigFromEnv, resolveRepositoryMountPath, resolveSessionProvider, resolveSyncProvider, rewriteFileMentions, runDeploymentForContext, sendSessionMessagePolling, sendSessionMessageStreaming, setDefaultFetch, startSessionRun, startSessionRunPolling, streamSessionEvents, syncAgentResourcesWithStateBackend, syncProjectResourcesWithStateBackend, syncProviderResourcesFromContext, syncProviderResourcesFromEnv, updateMemory, updateMemoryStore, uploadFile, validateProjectConfig, writeProjectRuntime };