@agent-relay/sandbox 0.1.2 → 0.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.
Files changed (121) hide show
  1. package/README.md +226 -5
  2. package/dist/agent37/client.d.ts +115 -0
  3. package/dist/agent37/client.d.ts.map +1 -0
  4. package/dist/agent37/client.js +270 -0
  5. package/dist/agent37/client.js.map +1 -0
  6. package/dist/agent37/runtime.d.ts +415 -0
  7. package/dist/agent37/runtime.d.ts.map +1 -0
  8. package/dist/agent37/runtime.js +855 -0
  9. package/dist/agent37/runtime.js.map +1 -0
  10. package/dist/agentcore/bench.d.ts +93 -0
  11. package/dist/agentcore/bench.d.ts.map +1 -0
  12. package/dist/agentcore/bench.js +125 -0
  13. package/dist/agentcore/bench.js.map +1 -0
  14. package/dist/agentcore/capabilities.d.ts +169 -0
  15. package/dist/agentcore/capabilities.d.ts.map +1 -0
  16. package/dist/agentcore/capabilities.js +153 -0
  17. package/dist/agentcore/capabilities.js.map +1 -0
  18. package/dist/agentcore/config.d.ts +156 -0
  19. package/dist/agentcore/config.d.ts.map +1 -0
  20. package/dist/agentcore/config.js +12 -0
  21. package/dist/agentcore/config.js.map +1 -0
  22. package/dist/agentcore/internal/sdk.d.ts +181 -0
  23. package/dist/agentcore/internal/sdk.d.ts.map +1 -0
  24. package/dist/agentcore/internal/sdk.js +223 -0
  25. package/dist/agentcore/internal/sdk.js.map +1 -0
  26. package/dist/agentcore/runtime.d.ts +177 -0
  27. package/dist/agentcore/runtime.d.ts.map +1 -0
  28. package/dist/agentcore/runtime.js +706 -0
  29. package/dist/agentcore/runtime.js.map +1 -0
  30. package/dist/daytona/runtime.d.ts +23 -0
  31. package/dist/daytona/runtime.d.ts.map +1 -1
  32. package/dist/daytona/runtime.js +167 -5
  33. package/dist/daytona/runtime.js.map +1 -1
  34. package/dist/daytona/wire-supplement.d.ts +25 -0
  35. package/dist/daytona/wire-supplement.d.ts.map +1 -0
  36. package/dist/daytona/wire-supplement.js +16 -0
  37. package/dist/daytona/wire-supplement.js.map +1 -0
  38. package/dist/e2b/runtime.d.ts +107 -72
  39. package/dist/e2b/runtime.d.ts.map +1 -1
  40. package/dist/e2b/runtime.js +675 -190
  41. package/dist/e2b/runtime.js.map +1 -1
  42. package/dist/freestyle/capabilities.d.ts +28 -0
  43. package/dist/freestyle/capabilities.d.ts.map +1 -0
  44. package/dist/freestyle/capabilities.js +42 -0
  45. package/dist/freestyle/capabilities.js.map +1 -0
  46. package/dist/freestyle/config.d.ts +36 -0
  47. package/dist/freestyle/config.d.ts.map +1 -0
  48. package/dist/freestyle/config.js +2 -0
  49. package/dist/freestyle/config.js.map +1 -0
  50. package/dist/freestyle/internal/sdk.d.ts +69 -0
  51. package/dist/freestyle/internal/sdk.d.ts.map +1 -0
  52. package/dist/freestyle/internal/sdk.js +19 -0
  53. package/dist/freestyle/internal/sdk.js.map +1 -0
  54. package/dist/freestyle/runtime.d.ts +163 -0
  55. package/dist/freestyle/runtime.d.ts.map +1 -0
  56. package/dist/freestyle/runtime.js +798 -0
  57. package/dist/freestyle/runtime.js.map +1 -0
  58. package/dist/index.d.ts +35 -4
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +16 -2
  61. package/dist/index.js.map +1 -1
  62. package/dist/microsandbox/runtime.d.ts +793 -0
  63. package/dist/microsandbox/runtime.d.ts.map +1 -0
  64. package/dist/microsandbox/runtime.js +2303 -0
  65. package/dist/microsandbox/runtime.js.map +1 -0
  66. package/dist/modal/bench.d.ts +199 -0
  67. package/dist/modal/bench.d.ts.map +1 -0
  68. package/dist/modal/bench.js +450 -0
  69. package/dist/modal/bench.js.map +1 -0
  70. package/dist/modal/capabilities.d.ts +180 -0
  71. package/dist/modal/capabilities.d.ts.map +1 -0
  72. package/dist/modal/capabilities.js +159 -0
  73. package/dist/modal/capabilities.js.map +1 -0
  74. package/dist/modal/config.d.ts +192 -0
  75. package/dist/modal/config.d.ts.map +1 -0
  76. package/dist/modal/config.js +169 -0
  77. package/dist/modal/config.js.map +1 -0
  78. package/dist/modal/internal/sdk.d.ts +141 -0
  79. package/dist/modal/internal/sdk.d.ts.map +1 -0
  80. package/dist/modal/internal/sdk.js +51 -0
  81. package/dist/modal/internal/sdk.js.map +1 -0
  82. package/dist/modal/runtime.d.ts +271 -0
  83. package/dist/modal/runtime.d.ts.map +1 -0
  84. package/dist/modal/runtime.js +871 -0
  85. package/dist/modal/runtime.js.map +1 -0
  86. package/dist/mount-script.d.ts +16 -1
  87. package/dist/mount-script.d.ts.map +1 -1
  88. package/dist/mount-script.js +76 -15
  89. package/dist/mount-script.js.map +1 -1
  90. package/dist/orchestrator.d.ts +15 -0
  91. package/dist/orchestrator.d.ts.map +1 -1
  92. package/dist/orchestrator.js +13 -1
  93. package/dist/orchestrator.js.map +1 -1
  94. package/dist/port.d.ts +144 -6
  95. package/dist/port.d.ts.map +1 -1
  96. package/dist/port.js +27 -5
  97. package/dist/port.js.map +1 -1
  98. package/dist/types.d.ts +50 -1
  99. package/dist/types.d.ts.map +1 -1
  100. package/dist/vercel/bench.d.ts +169 -0
  101. package/dist/vercel/bench.d.ts.map +1 -0
  102. package/dist/vercel/bench.js +337 -0
  103. package/dist/vercel/bench.js.map +1 -0
  104. package/dist/vercel/capabilities.d.ts +106 -0
  105. package/dist/vercel/capabilities.d.ts.map +1 -0
  106. package/dist/vercel/capabilities.js +128 -0
  107. package/dist/vercel/capabilities.js.map +1 -0
  108. package/dist/vercel/config.d.ts +119 -0
  109. package/dist/vercel/config.d.ts.map +1 -0
  110. package/dist/vercel/config.js +8 -0
  111. package/dist/vercel/config.js.map +1 -0
  112. package/dist/vercel/internal/sdk.d.ts +173 -0
  113. package/dist/vercel/internal/sdk.d.ts.map +1 -0
  114. package/dist/vercel/internal/sdk.js +117 -0
  115. package/dist/vercel/internal/sdk.js.map +1 -0
  116. package/dist/vercel/runtime.d.ts +305 -0
  117. package/dist/vercel/runtime.d.ts.map +1 -0
  118. package/dist/vercel/runtime.js +1169 -0
  119. package/dist/vercel/runtime.js.map +1 -0
  120. package/docs/freestyle.md +110 -0
  121. package/package.json +35 -4
@@ -0,0 +1,156 @@
1
+ /**
2
+ * SDK-free configuration for the AWS Bedrock AgentCore Code Interpreter adapter.
3
+ *
4
+ * Nothing in this module imports `@aws-sdk/client-bedrock-agentcore` or
5
+ * `@aws-sdk/client-bedrock-agentcore-control`. Consumers can construct and
6
+ * type-check a configuration without either optional peer dependency
7
+ * installed.
8
+ */
9
+ /**
10
+ * Credentials for the AgentCore control- and data-plane APIs.
11
+ *
12
+ * AWS auth is not a single token, and this adapter never falls back to
13
+ * ambient process state implicitly. A caller gets exactly one of two
14
+ * explicit choices:
15
+ *
16
+ * - `static`: long-lived IAM user keys, or STS/SSO temporary credentials
17
+ * (add `sessionToken` for the latter).
18
+ * - `default-chain`: explicit opt-in to the AWS SDK's own credential
19
+ * resolution (env vars, shared config file, EC2/ECS/Lambda role, SSO
20
+ * cache, etc). This is the standard way to run under an assumed IAM role,
21
+ * and it is common enough in AWS-native deployments that refusing it
22
+ * outright would be dogmatic — but the adapter never *defaults* to it.
23
+ * The caller names it, exactly like every other field here.
24
+ */
25
+ export type AgentCoreCredentials = {
26
+ type: "static";
27
+ accessKeyId: string;
28
+ secretAccessKey: string;
29
+ /** Required for STS/SSO temporary credentials; omitted for IAM user keys. */
30
+ sessionToken?: string;
31
+ } | {
32
+ type: "default-chain";
33
+ };
34
+ /**
35
+ * Network mode for an owned code interpreter.
36
+ *
37
+ * `VPC` is the only mode reachable without an explicit, named opt-in to a
38
+ * riskier mode. This is deliberate: public research disclosed in March 2026
39
+ * (BeyondTrust Phantom Labs, corroborated by Unit 42 and the Cloud Security
40
+ * Alliance) showed that AgentCore's `SANDBOX` network mode still permits
41
+ * outbound DNS A/AAAA queries even though it blocks general internet
42
+ * traffic, and that this residual DNS path is enough to build a full
43
+ * covert command-and-control and data-exfiltration channel out of a
44
+ * "sandboxed" code interpreter. AWS's own guidance in response was not a
45
+ * platform-level fix but a documentation update recommending `VPC` mode
46
+ * plus Route 53 Resolver DNS Firewall for customers who need real
47
+ * isolation. This adapter encodes that recommendation as the type-level
48
+ * default: constructing a runtime with `network` omitted, or with `mode`
49
+ * omitted inside it, resolves to `VPC` and requires `vpc` details, because
50
+ * there is no safe subnet/security-group default to invent. Reaching
51
+ * `SANDBOX` (or `PUBLIC`) requires spelling out `mode` explicitly, and doing
52
+ * so logs a warning that names the hazard.
53
+ */
54
+ export type AgentCoreNetworkConfig = {
55
+ mode?: "VPC";
56
+ vpc: AgentCoreVpcConfig;
57
+ } | {
58
+ mode: "SANDBOX";
59
+ } | {
60
+ mode: "PUBLIC";
61
+ };
62
+ export interface AgentCoreVpcConfig {
63
+ /** At least one subnet the code interpreter's ENIs are placed in. */
64
+ subnetIds: readonly string[];
65
+ /** At least one security group applied to those ENIs. */
66
+ securityGroupIds: readonly string[];
67
+ /**
68
+ * Require traffic to Amazon S3 to stay on the service's VPC endpoint
69
+ * rather than transiting the public internet. Defaults to the provider's
70
+ * own default when omitted (not asserted here, since that default is not
71
+ * independently verified).
72
+ */
73
+ requireServiceS3Endpoint?: boolean;
74
+ }
75
+ /**
76
+ * Identifies which code interpreter *environment* a session runs against.
77
+ *
78
+ * - `system`: the AWS-managed default environment (`aws.codeinterpreter.v1`).
79
+ * It accepts no execution role and no network configuration of its own —
80
+ * those are exclusively properties of a *custom* code interpreter — so
81
+ * this adapter's VPC-default and sandbox-mode-warning logic does not
82
+ * apply to it. Use it only for workloads with no S3/network requirements.
83
+ * - `owned`: a custom code interpreter this runtime creates (once, lazily,
84
+ * cached for the life of the runtime instance) and every session it
85
+ * starts runs against. This is the path that carries `network` and
86
+ * `executionRoleArn`, and the one this adapter is built around.
87
+ */
88
+ export type AgentCoreInterpreterSource = {
89
+ type: "system";
90
+ } | {
91
+ type: "owned";
92
+ /**
93
+ * Deterministic name for the owned code interpreter. Fixed rather than
94
+ * randomly suffixed so a fresh process can rediscover and reuse the
95
+ * same environment (via `GetCodeInterpreter`) instead of creating a new
96
+ * one on every restart — AgentCore names must be unique per account and
97
+ * match `[a-zA-Z][a-zA-Z0-9_]{0,47}`.
98
+ */
99
+ name: string;
100
+ description?: string;
101
+ /**
102
+ * IAM role the code interpreter assumes to reach AWS services from
103
+ * inside a session — required for the S3 large-file path (uploads over
104
+ * the 100 MB inline limit, up to 5 GB) documented at
105
+ * https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/code-interpreter-s3-integration.html.
106
+ * The adapter does not create this role: provisioning it (trust policy
107
+ * for `bedrock-agentcore.amazonaws.com`, `s3:GetObject`/`s3:PutObject`
108
+ * scoped to the target bucket/prefix) is the caller's or operator's
109
+ * responsibility, same as `namePrefix` is for other providers' identity
110
+ * scoping.
111
+ */
112
+ executionRoleArn?: string;
113
+ network: AgentCoreNetworkConfig;
114
+ tags?: Readonly<Record<string, string>>;
115
+ };
116
+ export interface AgentCoreRuntimeOptions {
117
+ credentials: AgentCoreCredentials;
118
+ region: string;
119
+ interpreter: AgentCoreInterpreterSource;
120
+ /**
121
+ * Home directory sessions boot into. Required because no default is
122
+ * correct for every language runtime the code interpreter selects.
123
+ */
124
+ defaultHomeDir: string;
125
+ /**
126
+ * Wall-clock lifetime of a session in seconds. AgentCore defaults to 900
127
+ * (15 minutes) and caps at 28,800 (8 hours) when omitted. Set explicitly
128
+ * per `launch()` via `LaunchOptions.createTimeoutSeconds`, which takes
129
+ * precedence when supplied.
130
+ */
131
+ sessionTimeoutSeconds?: number;
132
+ /**
133
+ * Default environment variables inherited by every command. AgentCore has
134
+ * no native per-command env parameter (see `runtime.ts`), so these are
135
+ * applied by shell-prefixing each invocation.
136
+ */
137
+ env?: Readonly<Record<string, string>>;
138
+ /** Fallback per-request deadline for operations without a specific one. */
139
+ requestTimeoutMs?: number;
140
+ /** Total deadline for creating (or discovering) the owned code interpreter. */
141
+ createInterpreterTimeoutMs?: number;
142
+ /** Total deadline for starting a session. */
143
+ launchTimeoutMs?: number;
144
+ /** Total deadline for a lookup (`GetCodeInterpreterSession`). */
145
+ lookupTimeoutMs?: number;
146
+ /** Default total deadline for a command when the caller supplies none. */
147
+ execTimeoutMs?: number;
148
+ /** Total deadline for a single file upload or download. */
149
+ fileTimeoutMs?: number;
150
+ /** Total deadline for stopping a session (destroy). */
151
+ destroyTimeoutMs?: number;
152
+ }
153
+ export declare function isStaticCredentials(credentials: AgentCoreCredentials): credentials is Extract<AgentCoreCredentials, {
154
+ type: "static";
155
+ }>;
156
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/agentcore/config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,oBAAoB,GAC5B;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GACD;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,sBAAsB,GAC9B;IAAE,IAAI,CAAC,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,kBAAkB,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEvB,MAAM,WAAW,kBAAkB;IACjC,qEAAqE;IACrE,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,yDAAyD;IACzD,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC;;;;;OAKG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,0BAA0B,GAClC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IACE,IAAI,EAAE,OAA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bedrock-agentcore` or
5
+ * `@aws-sdk/client-bedrock-agentcore-control`. Consumers can construct and
6
+ * type-check a configuration without either optional peer dependency
7
+ * installed.
8
+ */
9
+ export function isStaticCredentials(credentials) {
10
+ return credentials.type === "static";
11
+ }
12
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/agentcore/config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA2JH,MAAM,UAAU,mBAAmB,CACjC,WAAiC;IAEjC,OAAO,WAAW,CAAC,IAAI,KAAK,QAAQ,CAAC;AACvC,CAAC"}
@@ -0,0 +1,181 @@
1
+ import type { AgentCoreCredentials } from "../config.js";
2
+ /**
3
+ * The vendor SDK boundary.
4
+ *
5
+ * This is the only module in the package that imports
6
+ * `@aws-sdk/client-bedrock-agentcore` or
7
+ * `@aws-sdk/client-bedrock-agentcore-control`, and both imports are dynamic
8
+ * so the dependency stays genuinely optional. Everything above this file
9
+ * talks to the structural `*Like` interfaces below, which is what makes the
10
+ * adapter testable without either SDK installed and pinnable to one version.
11
+ *
12
+ * AWS splits this surface across two services on purpose: the control plane
13
+ * (`bedrock-agentcore-control`) manages the code interpreter *resource*
14
+ * (create/get/delete/list), and the data plane (`bedrock-agentcore`) manages
15
+ * *sessions* against that resource (start/get/stop/list/invoke). This
16
+ * module keeps that split rather than flattening it, because the two planes
17
+ * have different quotas, different endpoints, and — relevant to the
18
+ * idle-billing question this adapter exists partly to answer — different
19
+ * billing meters.
20
+ */
21
+ export type AgentCoreInterpreterStatus = "CREATING" | "CREATE_FAILED" | "READY" | "DELETING" | "DELETE_FAILED" | "DELETED" | (string & {});
22
+ /** Per `GetCodeInterpreterSession`'s documented `Valid Values`. */
23
+ export type AgentCoreSessionStatus = "READY" | "TERMINATED" | (string & {});
24
+ export type AgentCoreNetworkMode = "VPC" | "SANDBOX" | "PUBLIC";
25
+ export interface AgentCoreVpcConfigParams {
26
+ subnets: string[];
27
+ securityGroups: string[];
28
+ requireServiceS3Endpoint?: boolean;
29
+ }
30
+ export interface AgentCoreNetworkConfigParams {
31
+ networkMode: AgentCoreNetworkMode;
32
+ vpcConfig?: AgentCoreVpcConfigParams;
33
+ }
34
+ export interface AgentCoreCreateInterpreterParams {
35
+ name: string;
36
+ description?: string;
37
+ executionRoleArn?: string;
38
+ networkConfiguration: AgentCoreNetworkConfigParams;
39
+ tags?: Record<string, string>;
40
+ clientToken?: string;
41
+ abortSignal?: AbortSignal;
42
+ }
43
+ export interface AgentCoreCreateInterpreterResult {
44
+ codeInterpreterArn: string;
45
+ codeInterpreterId: string;
46
+ createdAt?: Date;
47
+ status: AgentCoreInterpreterStatus;
48
+ }
49
+ export interface AgentCoreGetInterpreterResult {
50
+ codeInterpreterId: string;
51
+ codeInterpreterArn?: string;
52
+ status: AgentCoreInterpreterStatus;
53
+ executionRoleArn?: string;
54
+ networkConfiguration?: AgentCoreNetworkConfigParams;
55
+ createdAt?: Date;
56
+ lastUpdatedAt?: Date;
57
+ }
58
+ export interface AgentCoreControlApiLike {
59
+ createCodeInterpreter(params: AgentCoreCreateInterpreterParams): Promise<AgentCoreCreateInterpreterResult>;
60
+ getCodeInterpreter(params: {
61
+ codeInterpreterId: string;
62
+ abortSignal?: AbortSignal;
63
+ }): Promise<AgentCoreGetInterpreterResult>;
64
+ deleteCodeInterpreter(params: {
65
+ codeInterpreterId: string;
66
+ clientToken?: string;
67
+ abortSignal?: AbortSignal;
68
+ }): Promise<{
69
+ status: AgentCoreInterpreterStatus;
70
+ }>;
71
+ listCodeInterpreters(params: {
72
+ maxResults?: number;
73
+ nextToken?: string;
74
+ abortSignal?: AbortSignal;
75
+ }): Promise<{
76
+ items: Array<{
77
+ codeInterpreterId: string;
78
+ name?: string;
79
+ status?: AgentCoreInterpreterStatus;
80
+ }>;
81
+ nextToken?: string;
82
+ }>;
83
+ }
84
+ export interface AgentCoreStartSessionParams {
85
+ codeInterpreterIdentifier: string;
86
+ name?: string;
87
+ sessionTimeoutSeconds?: number;
88
+ clientToken?: string;
89
+ abortSignal?: AbortSignal;
90
+ }
91
+ export interface AgentCoreStartSessionResult {
92
+ codeInterpreterIdentifier: string;
93
+ sessionId: string;
94
+ createdAt?: Date;
95
+ }
96
+ export interface AgentCoreGetSessionResult {
97
+ codeInterpreterIdentifier: string;
98
+ sessionId: string;
99
+ name?: string;
100
+ status: AgentCoreSessionStatus;
101
+ sessionTimeoutSeconds?: number;
102
+ createdAt?: Date;
103
+ }
104
+ export interface AgentCoreInvokeContentItem {
105
+ type: string;
106
+ text?: string;
107
+ }
108
+ /**
109
+ * Result of one `InvokeCodeInterpreter` call.
110
+ *
111
+ * `structuredContent` is populated for `executeCode`/`executeCommand`
112
+ * (`stdout`/`stderr`/`exitCode`/`executionTime`, per the AWS Strands/
113
+ * LangChain integration examples); other actions (`writeFiles`,
114
+ * `listFiles`) report only `content`/`isError`.
115
+ */
116
+ export interface AgentCoreInvokeResult {
117
+ /**
118
+ * Optional in the vendor type (`CodeInterpreterResult.isError?: boolean`),
119
+ * not just here — an absent value means "not reported", and callers treat
120
+ * it as falsy rather than assuming success.
121
+ */
122
+ isError?: boolean;
123
+ content: AgentCoreInvokeContentItem[];
124
+ structuredContent?: {
125
+ stdout?: string;
126
+ stderr?: string;
127
+ exitCode?: number;
128
+ executionTime?: number;
129
+ };
130
+ }
131
+ export interface AgentCoreInvokeParams {
132
+ codeInterpreterIdentifier: string;
133
+ sessionId: string;
134
+ /** Tool/action name: `executeCommand`, `executeCode`, `writeFiles`, `listFiles`, ... */
135
+ name: string;
136
+ arguments: Record<string, unknown>;
137
+ abortSignal?: AbortSignal;
138
+ }
139
+ export interface AgentCoreDataApiLike {
140
+ startSession(params: AgentCoreStartSessionParams): Promise<AgentCoreStartSessionResult>;
141
+ getSession(params: {
142
+ codeInterpreterIdentifier: string;
143
+ sessionId: string;
144
+ abortSignal?: AbortSignal;
145
+ }): Promise<AgentCoreGetSessionResult>;
146
+ stopSession(params: {
147
+ codeInterpreterIdentifier: string;
148
+ sessionId: string;
149
+ abortSignal?: AbortSignal;
150
+ }): Promise<void>;
151
+ invoke(params: AgentCoreInvokeParams): Promise<AgentCoreInvokeResult>;
152
+ }
153
+ export interface AgentCoreApi {
154
+ control: AgentCoreControlApiLike;
155
+ data: AgentCoreDataApiLike;
156
+ }
157
+ export type AgentCoreApiFactory = () => Promise<AgentCoreApi> | AgentCoreApi;
158
+ /**
159
+ * True when the provider reports the named resource (interpreter or
160
+ * session) as absent.
161
+ *
162
+ * Delete verification needs to tell "gone" apart from "the lookup failed";
163
+ * treating a transport error as absence is how a leaked resource gets
164
+ * reported as cleaned up.
165
+ */
166
+ export declare function isAgentCoreNotFoundError(error: unknown): boolean;
167
+ /**
168
+ * The official clients, bound to injected credentials and region.
169
+ *
170
+ * Credentials are resolved exactly once here, from the explicit
171
+ * `AgentCoreCredentials` union — never from ambient environment variables —
172
+ * except when the caller has explicitly opted into `{ type: "default-chain" }`,
173
+ * in which case the AWS SDK's own resolution is exactly what was asked for.
174
+ *
175
+ * Each vendor result is assigned **through** the structural type above
176
+ * rather than cast, so a signature change in the vendor SDK breaks the build
177
+ * here, in the one file that owns the boundary, instead of surfacing later
178
+ * as a runtime failure against a live session.
179
+ */
180
+ export declare function createOfficialAgentCoreApi(credentials: AgentCoreCredentials, region: string): Promise<AgentCoreApi>;
181
+ //# sourceMappingURL=sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/agentcore/internal/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD;;;;;;;;;;;;;;;;;;GAkBG;AAIH,MAAM,MAAM,0BAA0B,GAClC,UAAU,GACV,eAAe,GACf,OAAO,GACP,UAAU,GACV,eAAe,GACf,SAAS,GACT,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,mEAAmE;AACnE,MAAM,MAAM,sBAAsB,GAAG,OA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AC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACvE;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,uBAAuB,CAAC;IACjC,IAAI,EAAE,oBAAoB,CAAC;CAC5B;AAED,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;AAE7E;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAWhE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,0BAA0B,CAC9C,WAAW,EAAE,oBAAoB,EACjC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,YAAY,CAAC,CAiLvB"}
@@ -0,0 +1,223 @@
1
+ /**
2
+ * True when the provider reports the named resource (interpreter or
3
+ * session) as absent.
4
+ *
5
+ * Delete verification needs to tell "gone" apart from "the lookup failed";
6
+ * treating a transport error as absence is how a leaked resource gets
7
+ * reported as cleaned up.
8
+ */
9
+ export function isAgentCoreNotFoundError(error) {
10
+ if (!error || typeof error !== "object") {
11
+ return false;
12
+ }
13
+ const name = error.name;
14
+ if (name === "ResourceNotFoundException") {
15
+ return true;
16
+ }
17
+ const status = error.$metadata
18
+ ?.httpStatusCode;
19
+ return status === 404;
20
+ }
21
+ /**
22
+ * The official clients, bound to injected credentials and region.
23
+ *
24
+ * Credentials are resolved exactly once here, from the explicit
25
+ * `AgentCoreCredentials` union — never from ambient environment variables —
26
+ * except when the caller has explicitly opted into `{ type: "default-chain" }`,
27
+ * in which case the AWS SDK's own resolution is exactly what was asked for.
28
+ *
29
+ * Each vendor result is assigned **through** the structural type above
30
+ * rather than cast, so a signature change in the vendor SDK breaks the build
31
+ * here, in the one file that owns the boundary, instead of surfacing later
32
+ * as a runtime failure against a live session.
33
+ */
34
+ export async function createOfficialAgentCoreApi(credentials, region) {
35
+ const [{ BedrockAgentCoreControlClient, CreateCodeInterpreterCommand, GetCodeInterpreterCommand, DeleteCodeInterpreterCommand, ListCodeInterpretersCommand }, { BedrockAgentCoreClient, StartCodeInterpreterSessionCommand, GetCodeInterpreterSessionCommand, StopCodeInterpreterSessionCommand, InvokeCodeInterpreterCommand }] = await Promise.all([
36
+ import("@aws-sdk/client-bedrock-agentcore-control"),
37
+ import("@aws-sdk/client-bedrock-agentcore"),
38
+ ]);
39
+ const clientConfig = {
40
+ region,
41
+ ...(credentials.type === "static"
42
+ ? {
43
+ credentials: {
44
+ accessKeyId: credentials.accessKeyId,
45
+ secretAccessKey: credentials.secretAccessKey,
46
+ ...(credentials.sessionToken
47
+ ? { sessionToken: credentials.sessionToken }
48
+ : {}),
49
+ },
50
+ }
51
+ : {}),
52
+ };
53
+ const controlClient = new BedrockAgentCoreControlClient(clientConfig);
54
+ const dataClient = new BedrockAgentCoreClient(clientConfig);
55
+ const control = {
56
+ createCodeInterpreter: async (params) => {
57
+ const res = await controlClient.send(new CreateCodeInterpreterCommand({
58
+ name: params.name,
59
+ ...(params.description ? { description: params.description } : {}),
60
+ ...(params.executionRoleArn
61
+ ? { executionRoleArn: params.executionRoleArn }
62
+ : {}),
63
+ networkConfiguration: params.networkConfiguration,
64
+ ...(params.tags ? { tags: params.tags } : {}),
65
+ ...(params.clientToken ? { clientToken: params.clientToken } : {}),
66
+ }), { abortSignal: params.abortSignal });
67
+ if (!res.codeInterpreterId || !res.status) {
68
+ throw new Error("AgentCore CreateCodeInterpreter response is missing required fields");
69
+ }
70
+ const checked = {
71
+ codeInterpreterArn: res.codeInterpreterArn ?? "",
72
+ codeInterpreterId: res.codeInterpreterId,
73
+ ...(res.createdAt ? { createdAt: new Date(res.createdAt) } : {}),
74
+ status: res.status,
75
+ };
76
+ return checked;
77
+ },
78
+ getCodeInterpreter: async (params) => {
79
+ const res = await controlClient.send(new GetCodeInterpreterCommand({ codeInterpreterId: params.codeInterpreterId }), { abortSignal: params.abortSignal });
80
+ if (!res.codeInterpreterId || !res.status) {
81
+ throw new Error("AgentCore GetCodeInterpreter response is missing required fields");
82
+ }
83
+ const checked = {
84
+ codeInterpreterId: res.codeInterpreterId,
85
+ ...(res.codeInterpreterArn ? { codeInterpreterArn: res.codeInterpreterArn } : {}),
86
+ status: res.status,
87
+ ...(res.executionRoleArn ? { executionRoleArn: res.executionRoleArn } : {}),
88
+ ...(res.networkConfiguration
89
+ ? { networkConfiguration: res.networkConfiguration }
90
+ : {}),
91
+ ...(res.createdAt ? { createdAt: new Date(res.createdAt) } : {}),
92
+ ...(res.lastUpdatedAt ? { lastUpdatedAt: new Date(res.lastUpdatedAt) } : {}),
93
+ };
94
+ return checked;
95
+ },
96
+ deleteCodeInterpreter: async (params) => {
97
+ const res = await controlClient.send(new DeleteCodeInterpreterCommand({
98
+ codeInterpreterId: params.codeInterpreterId,
99
+ ...(params.clientToken ? { clientToken: params.clientToken } : {}),
100
+ }), { abortSignal: params.abortSignal });
101
+ return { status: res.status ?? "DELETING" };
102
+ },
103
+ listCodeInterpreters: async (params) => {
104
+ const res = await controlClient.send(new ListCodeInterpretersCommand({
105
+ ...(params.maxResults ? { maxResults: params.maxResults } : {}),
106
+ ...(params.nextToken ? { nextToken: params.nextToken } : {}),
107
+ }), { abortSignal: params.abortSignal });
108
+ const summaries = res.codeInterpreterSummaries ?? [];
109
+ return {
110
+ items: summaries.map((item) => ({
111
+ codeInterpreterId: item.codeInterpreterId ?? "",
112
+ ...(item.name ? { name: item.name } : {}),
113
+ ...(item.status ? { status: item.status } : {}),
114
+ })),
115
+ ...(res.nextToken ? { nextToken: res.nextToken } : {}),
116
+ };
117
+ },
118
+ };
119
+ const data = {
120
+ startSession: async (params) => {
121
+ const res = await dataClient.send(new StartCodeInterpreterSessionCommand({
122
+ codeInterpreterIdentifier: params.codeInterpreterIdentifier,
123
+ ...(params.name ? { name: params.name } : {}),
124
+ ...(params.sessionTimeoutSeconds
125
+ ? { sessionTimeoutSeconds: params.sessionTimeoutSeconds }
126
+ : {}),
127
+ ...(params.clientToken ? { clientToken: params.clientToken } : {}),
128
+ }), { abortSignal: params.abortSignal });
129
+ if (!res.sessionId || !res.codeInterpreterIdentifier) {
130
+ throw new Error("AgentCore StartCodeInterpreterSession response is missing required fields");
131
+ }
132
+ const checked = {
133
+ codeInterpreterIdentifier: res.codeInterpreterIdentifier,
134
+ sessionId: res.sessionId,
135
+ ...(res.createdAt ? { createdAt: new Date(res.createdAt) } : {}),
136
+ };
137
+ return checked;
138
+ },
139
+ getSession: async (params) => {
140
+ const res = await dataClient.send(new GetCodeInterpreterSessionCommand({
141
+ codeInterpreterIdentifier: params.codeInterpreterIdentifier,
142
+ sessionId: params.sessionId,
143
+ }), { abortSignal: params.abortSignal });
144
+ if (!res.sessionId || !res.codeInterpreterIdentifier || !res.status) {
145
+ throw new Error("AgentCore GetCodeInterpreterSession response is missing required fields");
146
+ }
147
+ const checked = {
148
+ codeInterpreterIdentifier: res.codeInterpreterIdentifier,
149
+ sessionId: res.sessionId,
150
+ ...(res.name ? { name: res.name } : {}),
151
+ status: res.status,
152
+ ...(res.sessionTimeoutSeconds
153
+ ? { sessionTimeoutSeconds: res.sessionTimeoutSeconds }
154
+ : {}),
155
+ ...(res.createdAt ? { createdAt: new Date(res.createdAt) } : {}),
156
+ };
157
+ return checked;
158
+ },
159
+ stopSession: async (params) => {
160
+ await dataClient.send(new StopCodeInterpreterSessionCommand({
161
+ codeInterpreterIdentifier: params.codeInterpreterIdentifier,
162
+ sessionId: params.sessionId,
163
+ }), { abortSignal: params.abortSignal });
164
+ },
165
+ invoke: async (params) => {
166
+ const res = await dataClient.send(new InvokeCodeInterpreterCommand({
167
+ codeInterpreterIdentifier: params.codeInterpreterIdentifier,
168
+ sessionId: params.sessionId,
169
+ // `ToolName` is a closed enum in the vendor types (no `(string &
170
+ // {})` escape hatch), but `AgentCoreInvokeParams.name` stays a
171
+ // plain `string` on this side of the boundary so fakes in tests
172
+ // aren't forced to import the vendor enum. The cast lives here,
173
+ // at the one place that constructs the vendor command.
174
+ name: params.name,
175
+ arguments: params.arguments,
176
+ }), { abortSignal: params.abortSignal });
177
+ return collectInvokeStream(res.stream);
178
+ },
179
+ };
180
+ return { control, data };
181
+ }
182
+ /**
183
+ * `InvokeCodeInterpreter` returns an AWS SDK event stream whose events are a
184
+ * discriminated union: a success `result` member, or one of several
185
+ * exception members (`accessDeniedException`, `conflictException`,
186
+ * `internalServerException`, `resourceNotFoundException`,
187
+ * `serviceQuotaExceededException`, `throttlingException`,
188
+ * `validationException`). The AWS SDK is expected to throw these as
189
+ * rejected promises rather than deliver them as stream data, but the vendor
190
+ * type models them as reachable stream events regardless — this drains the
191
+ * whole stream (so the underlying HTTP/2 stream is not left half-read),
192
+ * surfaces any exception member it finds explicitly rather than silently
193
+ * skipping it, and keeps the last `result` event otherwise, which is where
194
+ * a multi-chunk response's final `structuredContent` lands.
195
+ */
196
+ async function collectInvokeStream(
197
+ // Typed loosely and inspected defensively on purpose: the vendor union
198
+ // (`CodeInterpreterStreamOutput`) has no index signature, and this
199
+ // function's job is precisely to duck-type across its members without
200
+ // depending on which one showed up.
201
+ stream) {
202
+ let last;
203
+ if (stream) {
204
+ for await (const raw of stream) {
205
+ const event = raw;
206
+ if (event.result) {
207
+ last = event.result;
208
+ continue;
209
+ }
210
+ const exceptionKey = Object.keys(event).find((key) => key !== "$unknown" && event[key] !== undefined);
211
+ if (exceptionKey) {
212
+ const detail = event[exceptionKey];
213
+ throw new Error(`AgentCore InvokeCodeInterpreter stream reported ${exceptionKey}: `
214
+ + `${detail?.message ?? "(no message)"}`);
215
+ }
216
+ }
217
+ }
218
+ if (!last) {
219
+ throw new Error("AgentCore InvokeCodeInterpreter returned no result event");
220
+ }
221
+ return last;
222
+ }
223
+ //# sourceMappingURL=sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../../src/agentcore/internal/sdk.ts"],"names":[],"mappings":"AA4LA;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACrD,IAAI,CAAC,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