@openagentpack/sdk 0.1.0 → 0.2.0-beta.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.
@@ -4,16 +4,6 @@ var SCAN_FILE_TIMEOUT_MS = 12e4;
4
4
  var SCAN_POLL_INTERVAL_MS = 8e3;
5
5
  var SKILL_SCAN_BACKOFF = { initial: 2e3, factor: 2, max: 8e3 };
6
6
  var FILE_SCAN_BACKOFF = { initial: 1e3, factor: 1.5, max: 4e3 };
7
- var SKILL_STATUS_CODE = { checking: 0, active: 1, rejected: 2, deleted: 100 };
8
- var CODE_TO_SKILL_STATUS = {
9
- 0: "checking",
10
- 1: "active",
11
- 2: "rejected",
12
- 100: "deleted"
13
- };
14
- function skillStatusFromCode(code) {
15
- return (code != null ? CODE_TO_SKILL_STATUS[code] : void 0) ?? "checking";
16
- }
17
7
  function skillStatusFromString(raw) {
18
8
  switch (String(raw ?? "").toLowerCase()) {
19
9
  case "active":
@@ -63,8 +53,6 @@ export {
63
53
  SCAN_POLL_INTERVAL_MS,
64
54
  SKILL_SCAN_BACKOFF,
65
55
  FILE_SCAN_BACKOFF,
66
- SKILL_STATUS_CODE,
67
- skillStatusFromCode,
68
56
  skillStatusFromString,
69
57
  classifyFileScan,
70
58
  classifySkillScan,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  classifyFileScan
3
- } from "./chunk-7ECSYAQA.js";
3
+ } from "./chunk-CHGDM6TX.js";
4
4
 
5
5
  // src/file-lifecycle.ts
6
6
  var BAILIAN_PROFILE = {
@@ -4,8 +4,8 @@ import {
4
4
  enrichProviderFileInfo,
5
5
  needsFileStatusPoll,
6
6
  normalizeWireFileStatus
7
- } from "./chunk-TUW6XLDT.js";
8
- import "./chunk-7ECSYAQA.js";
7
+ } from "./chunk-OUHQYIG4.js";
8
+ import "./chunk-CHGDM6TX.js";
9
9
  export {
10
10
  defaultFileUploadPurpose,
11
11
  enrichFileMetadata,
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as ResourceAddress, a as ResourceType, C as CloudAgent, b as CloudEnvironment, c as CloudVault, E as EventStreamOptions, P as ProviderSessionEvent, d as EventListOptions, e as ProviderSessionEventList, f as PlannedAction, D as Diagnostic, A as AgentDefinition, g as AgentWithReadiness, h as AgentSyncRun } from './session-event-C2ED1o1m.js';
2
- export { i as ActionType, j as ActionTypeSchema, k as AgentDefinitionSchema, l as AgentDriftSeverity, m as AgentDriftSeveritySchema, n as AgentModel, o as AgentModelSchema, p as AgentReadiness, q as AgentReadinessSchema, r as AgentReadinessStatus, s as AgentReadinessStatusSchema, t as AgentRecoveryAction, u as AgentRecoveryActionSchema, v as AgentSkillRef, w as AgentSkillRefSchema, x as AgentSyncResult, y as AgentSyncResultSchema, z as AgentSyncRunSchema, B as AgentSyncStatus, F as AgentSyncStatusSchema, G as AgentWithReadinessSchema, H as CloudAgentSchema, I as CloudEnvironmentSchema, J as CloudVaultSchema, K as CreateSessionRequest, L as CreateSessionRequestSchema, M as CreateSessionResponse, N as CreateSessionResponseSchema, O as DiagnosticSchema, Q as DiagnosticSeverity, S as DiagnosticSeveritySchema, T as DriftKind, U as DriftKindSchema, V as GetSessionRequest, W as GetSessionRequestSchema, X as KNOWN_SESSION_EVENT_TYPES, Y as KnownSessionEventType, Z as ListCloudAgentsResponse, _ as ListCloudAgentsResponseSchema, $ as ListCloudEnvironmentsResponse, a0 as ListCloudEnvironmentsResponseSchema, a1 as ListSessionEventsRequest, a2 as ListSessionEventsRequestSchema, a3 as ListSessionEventsResponse, a4 as ListSessionEventsResponseSchema, a5 as ListSessionsRequest, a6 as ListSessionsRequestSchema, a7 as ListSessionsResponse, a8 as ListSessionsResponseSchema, a9 as PlannedActionSchema, aa as ResourceAddressSchema, ab as ResourceTypeSchema, ac as SendEventRequest, ad as SendEventRequestSchema, ae as SendEventResponse, af as SendEventResponseSchema, ag as Session, ah as SessionAgent, ai as SessionAgentSchema, aj as SessionContentBlock, ak as SessionContentBlockSchema, al as SessionEvent, am as SessionEventSchema, an as SessionEventType, ao as SessionEventTypeName, ap as SessionEventTypeSchema, aq as SessionSchema } from './session-event-C2ED1o1m.js';
1
+ import { R as ResourceAddress, a as ResourceType, C as CloudAgent, b as CloudEnvironment, c as CloudVault, E as EventStreamOptions, P as ProviderSessionEvent, d as EventListOptions, e as ProviderSessionEventList, f as PlannedAction, D as Diagnostic, A as AgentDefinition, g as AgentWithReadiness, h as AgentSyncRun } from './session-event-CObCawiI.js';
2
+ export { i as ActionType, j as ActionTypeSchema, k as AgentDefinitionSchema, l as AgentDriftSeverity, m as AgentDriftSeveritySchema, n as AgentModel, o as AgentModelSchema, p as AgentReadiness, q as AgentReadinessSchema, r as AgentReadinessStatus, s as AgentReadinessStatusSchema, t as AgentRecoveryAction, u as AgentRecoveryActionSchema, v as AgentSkillRef, w as AgentSkillRefSchema, x as AgentSyncResult, y as AgentSyncResultSchema, z as AgentSyncRunSchema, B as AgentSyncStatus, F as AgentSyncStatusSchema, G as AgentWithReadinessSchema, H as CloudAgentSchema, I as CloudEnvironmentSchema, J as CloudVaultSchema, K as CreateSessionRequest, L as CreateSessionRequestSchema, M as CreateSessionResponse, N as CreateSessionResponseSchema, O as DiagnosticSchema, Q as DiagnosticSeverity, S as DiagnosticSeveritySchema, T as DriftKind, U as DriftKindSchema, V as GetSessionRequest, W as GetSessionRequestSchema, X as KNOWN_SESSION_EVENT_TYPES, Y as KnownSessionEventType, Z as ListCloudAgentsResponse, _ as ListCloudAgentsResponseSchema, $ as ListCloudEnvironmentsResponse, a0 as ListCloudEnvironmentsResponseSchema, a1 as ListSessionEventsRequest, a2 as ListSessionEventsRequestSchema, a3 as ListSessionEventsResponse, a4 as ListSessionEventsResponseSchema, a5 as ListSessionsRequest, a6 as ListSessionsRequestSchema, a7 as ListSessionsResponse, a8 as ListSessionsResponseSchema, a9 as PlanReadinessImpact, aa as PlanReadinessImpactSchema, ab as PlannedActionSchema, ac as ResourceAddressSchema, ad as ResourceTypeSchema, ae as SendEventRequest, af as SendEventRequestSchema, ag as SendEventResponse, ah as SendEventResponseSchema, ai as Session, aj as SessionAgent, ak as SessionAgentSchema, al as SessionContentBlock, am as SessionContentBlockSchema, an as SessionEvent, ao as SessionEventSchema, ap as SessionEventType, aq as SessionEventTypeName, ar as SessionEventTypeSchema, as as SessionSchema } from './session-event-CObCawiI.js';
3
3
  import { P as ProviderFileInfo } from './file-URqwlxLf.js';
4
4
  import 'zod';
5
5
 
@@ -13,6 +13,7 @@ interface ProjectConfig {
13
13
  providers: Record<string, unknown>;
14
14
  defaults?: DefaultsConfig;
15
15
  environments?: Record<string, EnvironmentDecl>;
16
+ tunnels?: Record<string, TunnelDecl>;
16
17
  vaults?: Record<string, VaultDecl>;
17
18
  memory_stores?: Record<string, MemoryStoreDecl>;
18
19
  skills?: Record<string, SkillDecl>;
@@ -22,19 +23,34 @@ interface ProjectConfig {
22
23
  }
23
24
  interface DefaultsConfig {
24
25
  provider?: string;
26
+ session?: {
27
+ qoder?: {
28
+ /** Existing Qoder Forward Identity used only as the CLI/session runtime default. */
29
+ identity_id?: string;
30
+ };
31
+ };
25
32
  }
26
33
  interface EnvironmentDecl {
27
34
  name?: string;
28
35
  description?: string;
29
36
  provider?: ProviderName;
37
+ /** Pre-existing provider environment id. When set, OpenCMA treats the environment as an external reference and will not create/update/delete it remotely. */
38
+ environment_id?: string;
30
39
  config: EnvironmentConfig;
31
40
  metadata?: Record<string, string>;
32
41
  }
33
42
  interface EnvironmentConfig {
34
- type: "cloud";
43
+ type: "cloud" | "self_hosted";
35
44
  networking?: NetworkingConfig;
36
45
  packages?: PackagesConfig;
37
46
  }
47
+ interface TunnelDecl {
48
+ name?: string;
49
+ description?: string;
50
+ /** Pre-existing Qoder tunnel id (e.g. tnl_00xxxx). Tunnels are allocated by Qoder BYOC admin and referenced, not created. */
51
+ tunnel_id: string;
52
+ metadata?: Record<string, string>;
53
+ }
38
54
  interface NetworkingConfig {
39
55
  type: "unrestricted" | "limited";
40
56
  allow_mcp_servers?: boolean;
@@ -102,6 +118,7 @@ interface AgentDecl {
102
118
  model: string | Record<ProviderName, ModelSpec>;
103
119
  instructions: string;
104
120
  environment?: string;
121
+ tunnel?: string;
105
122
  provider?: ProviderName;
106
123
  tools?: AgentToolsDecl;
107
124
  mcp_servers?: McpServerDecl[];
@@ -110,6 +127,11 @@ interface AgentDecl {
110
127
  memory_stores?: string[];
111
128
  multiagent?: MultiagentDecl;
112
129
  metadata?: Record<string, string>;
130
+ /** Provider-specific remote materialization. Omitted means the existing managed Agent resource. */
131
+ delivery?: Record<ProviderName, AgentDeliveryDecl>;
132
+ }
133
+ interface AgentDeliveryDecl {
134
+ type: "managed" | "forward";
113
135
  }
114
136
  type AgentSkillDecl = string | AgentSkillRefDecl;
115
137
  interface AgentSkillRefDecl {
@@ -146,6 +168,7 @@ interface DeploymentDecl {
146
168
  agent: string;
147
169
  agent_version?: number;
148
170
  environment?: string;
171
+ tunnel?: string;
149
172
  vaults?: string[];
150
173
  memory_stores?: string[];
151
174
  resources?: DeploymentResourceDecl[];
@@ -210,21 +233,37 @@ interface SessionFileResource {
210
233
  file_id: string;
211
234
  mount_path: string;
212
235
  }
213
- interface SessionBindings {
236
+ interface CommonSessionBindings {
237
+ /** Uploaded files to mount in the session sandbox. */
238
+ files?: SessionFileResource[];
239
+ title?: string;
240
+ metadata?: Record<string, string>;
241
+ }
242
+ interface ManagedSessionBindings extends CommonSessionBindings {
243
+ /** Omitted for backward compatibility; omitted always means managed. */
244
+ delivery?: "managed";
214
245
  agent_id: string;
215
246
  agent_version?: number;
216
247
  /** Cloud sandbox id. Every provider runs sessions inside an environment. */
217
248
  environment_id: string;
249
+ /** Qoder BYOC tunnel id. Required to reach internal MCP servers from the sandbox. */
250
+ tunnel_id?: string;
218
251
  vault_ids: string[];
219
252
  memory_store_ids: string[];
220
- files?: SessionFileResource[];
221
- title?: string;
222
- metadata?: Record<string, string>;
223
253
  }
254
+ interface ForwardSessionBindings extends CommonSessionBindings {
255
+ delivery: "forward";
256
+ /** Qoder Forward Template selected from the applied Agent materialization. */
257
+ template_id: string;
258
+ /** Existing business Identity supplied by the session caller; omitted uses the provider's default Identity. */
259
+ identity_id?: string;
260
+ }
261
+ type SessionBindings = ManagedSessionBindings | ForwardSessionBindings;
224
262
  interface ProviderSessionInfo {
225
263
  id: string;
226
264
  agent_id: string;
227
265
  environment_id: string;
266
+ tunnel_id?: string;
228
267
  status: string;
229
268
  title?: string;
230
269
  vault_ids: string[];
@@ -263,6 +302,11 @@ interface ProviderSkillInfo {
263
302
  interface ResourceState {
264
303
  address: ResourceAddress;
265
304
  remote_id: string | null;
305
+ /**
306
+ * This resource is owned by the provider or another system and is only
307
+ * referenced by this project. It must never be deleted remotely.
308
+ */
309
+ externally_managed?: boolean;
266
310
  version?: number;
267
311
  /**
268
312
  * Backward-compatible alias for desired_hash. Kept while older state files
@@ -271,10 +315,17 @@ interface ResourceState {
271
315
  content_hash: string;
272
316
  desired_hash?: string;
273
317
  desired_comparable_hash?: string;
318
+ desired_readiness_baseline?: ResourceReadinessBaseline;
274
319
  remote_hash?: string;
275
320
  remote_snapshot?: unknown;
321
+ drift_paths?: string[];
276
322
  drift_status?: "in_sync" | "drifted" | "missing" | "unchecked";
277
323
  }
324
+ interface ResourceReadinessBaseline {
325
+ operational_hash: string;
326
+ description_hash: string;
327
+ metadata_hash: string;
328
+ }
278
329
  interface StateFile {
279
330
  resources: ResourceState[];
280
331
  }
@@ -319,10 +370,18 @@ interface ResolvedAgentRefs {
319
370
  }>;
320
371
  multiagent_agent_ids?: string[];
321
372
  }
373
+ interface ResolvedTemplateRefs extends ResolvedAgentRefs {
374
+ environment_id: string;
375
+ /** Qoder BYOC private-network route used by Forward Templates. */
376
+ tunnel_id?: string;
377
+ vault_ids: string[];
378
+ }
322
379
  interface ResolvedDeploymentRefs {
323
380
  agent_id: string;
324
381
  agent_version?: number;
325
382
  environment_id: string;
383
+ /** Qoder BYOC tunnel id. Passed through only when the deployment targets Qoder BYOC. */
384
+ tunnel_id?: string;
326
385
  vault_ids: string[];
327
386
  memory_store_ids: Record<string, string>;
328
387
  }
@@ -401,6 +460,10 @@ interface ProviderAdapter {
401
460
  createAgent(name: string, decl: AgentDecl, refs: ResolvedAgentRefs): Promise<RemoteResource>;
402
461
  updateAgent(id: string, name: string, decl: AgentDecl, refs: ResolvedAgentRefs): Promise<RemoteResource>;
403
462
  deleteAgent(id: string): Promise<void>;
463
+ createTemplate?(name: string, decl: AgentDecl, refs: ResolvedTemplateRefs): Promise<RemoteResource>;
464
+ updateTemplate?(id: string, name: string, decl: AgentDecl, refs: ResolvedTemplateRefs): Promise<RemoteResource>;
465
+ /** Remove the template from desired state. Qoder implements this as a soft archive. */
466
+ archiveTemplate?(id: string): Promise<void>;
404
467
  createMemoryStore?(name: string, decl: MemoryStoreDecl): Promise<RemoteResource>;
405
468
  deleteMemoryStore?(id: string): Promise<void>;
406
469
  createDeployment(name: string, decl: DeploymentDecl, refs: ResolvedDeploymentRefs, basePath: string): Promise<RemoteResource>;
@@ -770,7 +833,7 @@ declare function runDeploymentForContext(ctx: ProjectRuntimeContext, name: strin
770
833
  declare function getDeploymentRuntimeProviderForContext(ctx: ProjectRuntimeContext, name: string, overrideProvider?: string): string;
771
834
 
772
835
  type DestroyResourceStatus = "success" | "failed" | "blocked" | "skipped";
773
- type DestroyResourceResultReason = "destroyed" | "already_gone" | "cascade_required" | "provider_missing" | "failed" | "skipped";
836
+ type DestroyResourceResultReason = "destroyed" | "reference_removed" | "already_gone" | "cascade_required" | "provider_missing" | "failed" | "skipped";
774
837
  interface DestroyResourceResult {
775
838
  resource: ResourceState;
776
839
  status: DestroyResourceStatus;
@@ -852,6 +915,7 @@ interface AgentBuildInput {
852
915
  model?: AgentDecl["model"];
853
916
  instructions?: string;
854
917
  environment?: string;
918
+ vault?: string;
855
919
  provider?: string;
856
920
  builtinTools?: string[];
857
921
  skills?: AgentSkillBuildInput[];
@@ -936,6 +1000,8 @@ declare function listAgentsWithReadiness(ctx: ProjectRuntimeContext, options?: {
936
1000
  declare function syncAgentResourcesWithStateBackend(input: BackendRuntimeInput, agentId: string, options?: AgentResourceSyncOptions): Promise<AgentSyncRun>;
937
1001
 
938
1002
  interface SessionCreateOptions {
1003
+ /** Explicit Qoder Forward Identity id. Overrides defaults.session.qoder.identity_id. */
1004
+ identityId?: string;
939
1005
  environment?: string;
940
1006
  /**
941
1007
  * Explicit remote environment id. When set, it is bound directly (bypassing the
@@ -944,6 +1010,10 @@ interface SessionCreateOptions {
944
1010
  * Takes precedence over `environment` / the agent's declared environment.
945
1011
  */
946
1012
  environmentId?: string;
1013
+ /** Tunnel name referencing `tunnels.<name>` in config. */
1014
+ tunnel?: string;
1015
+ /** Explicit remote tunnel id. Takes precedence over `tunnel` / the agent's declared tunnel. */
1016
+ tunnelId?: string;
947
1017
  vault?: string;
948
1018
  /**
949
1019
  * Explicit remote vault ids. When set, they are bound directly (bypassing the