agentfootprint 11.4.0 → 12.0.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.
- package/CAPABILITIES.md +3 -1
- package/dist/adapters/code/agentcore.js +295 -214
- package/dist/adapters/code/agentcore.js.map +1 -1
- package/dist/adapters/code/agentcoreClient.js +178 -0
- package/dist/adapters/code/agentcoreClient.js.map +1 -0
- package/dist/adapters/code/agentcoreWire.js +348 -0
- package/dist/adapters/code/agentcoreWire.js.map +1 -0
- package/dist/adapters/code/fileName.js +100 -0
- package/dist/adapters/code/fileName.js.map +1 -0
- package/dist/adapters/code/local.js +529 -183
- package/dist/adapters/code/local.js.map +1 -1
- package/dist/adapters/code/output.js +140 -0
- package/dist/adapters/code/output.js.map +1 -0
- package/dist/adapters/mcp/agentcoreRuntime/invoke.js +7 -6
- package/dist/adapters/mcp/agentcoreRuntime/invoke.js.map +1 -1
- package/dist/adapters/mcp/agentcoreRuntime/sessionBusy.js +36 -2
- package/dist/adapters/mcp/agentcoreRuntime/sessionBusy.js.map +1 -1
- package/dist/adapters/mcp/agentcoreRuntime/transport.js +3 -1
- package/dist/adapters/mcp/agentcoreRuntime/transport.js.map +1 -1
- package/dist/core/codeRunnerTool.js +52 -7
- package/dist/core/codeRunnerTool.js.map +1 -1
- package/dist/doors/providers.js.map +1 -1
- package/dist/esm/adapters/code/agentcore.d.ts +65 -68
- package/dist/esm/adapters/code/agentcore.js +293 -212
- package/dist/esm/adapters/code/agentcore.js.map +1 -1
- package/dist/esm/adapters/code/agentcoreClient.d.ts +193 -0
- package/dist/esm/adapters/code/agentcoreClient.js +173 -0
- package/dist/esm/adapters/code/agentcoreClient.js.map +1 -0
- package/dist/esm/adapters/code/agentcoreWire.d.ts +119 -0
- package/dist/esm/adapters/code/agentcoreWire.js +334 -0
- package/dist/esm/adapters/code/agentcoreWire.js.map +1 -0
- package/dist/esm/adapters/code/fileName.d.ts +43 -0
- package/dist/esm/adapters/code/fileName.js +96 -0
- package/dist/esm/adapters/code/fileName.js.map +1 -0
- package/dist/esm/adapters/code/local.d.ts +91 -12
- package/dist/esm/adapters/code/local.js +528 -182
- package/dist/esm/adapters/code/local.js.map +1 -1
- package/dist/esm/adapters/code/output.d.ts +70 -0
- package/dist/esm/adapters/code/output.js +129 -0
- package/dist/esm/adapters/code/output.js.map +1 -0
- package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.d.ts +7 -6
- package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.js +7 -6
- package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.js.map +1 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts +32 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.js +35 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.js.map +1 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/transport.js +4 -2
- package/dist/esm/adapters/mcp/agentcoreRuntime/transport.js.map +1 -1
- package/dist/esm/core/codeRunnerTool.d.ts +15 -3
- package/dist/esm/core/codeRunnerTool.js +52 -7
- package/dist/esm/core/codeRunnerTool.js.map +1 -1
- package/dist/esm/doors/providers.d.ts +1 -1
- package/dist/esm/doors/providers.js.map +1 -1
- package/dist/esm/events/payloads.d.ts +144 -29
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/mcp/callLifetime.d.ts +57 -14
- package/dist/esm/mcp/callLifetime.js +67 -19
- package/dist/esm/mcp/callLifetime.js.map +1 -1
- package/dist/esm/mcp/callMarker.d.ts +43 -0
- package/dist/esm/mcp/callMarker.js +69 -0
- package/dist/esm/mcp/callMarker.js.map +1 -0
- package/dist/esm/mcp/connectionRefusals.js +7 -0
- package/dist/esm/mcp/connectionRefusals.js.map +1 -1
- package/dist/esm/mcp/index.d.ts +2 -0
- package/dist/esm/mcp/index.js +3 -0
- package/dist/esm/mcp/index.js.map +1 -1
- package/dist/esm/mcp/mcpClient.js +93 -26
- package/dist/esm/mcp/mcpClient.js.map +1 -1
- package/dist/esm/mcp/replay.d.ts +291 -0
- package/dist/esm/mcp/replay.js +405 -0
- package/dist/esm/mcp/replay.js.map +1 -0
- package/dist/esm/mcp/replayUnavailable.d.ts +68 -0
- package/dist/esm/mcp/replayUnavailable.js +87 -0
- package/dist/esm/mcp/replayUnavailable.js.map +1 -0
- package/dist/esm/mcp/requestLedger.d.ts +115 -32
- package/dist/esm/mcp/requestLedger.js +193 -52
- package/dist/esm/mcp/requestLedger.js.map +1 -1
- package/dist/esm/mcp/seriesEvidence.d.ts +73 -15
- package/dist/esm/mcp/seriesEvidence.js +114 -21
- package/dist/esm/mcp/seriesEvidence.js.map +1 -1
- package/dist/esm/mcp/throttleRetry.d.ts +86 -42
- package/dist/esm/mcp/throttleRetry.js +158 -50
- package/dist/esm/mcp/throttleRetry.js.map +1 -1
- package/dist/esm/mcp/toolResult.d.ts +6 -0
- package/dist/esm/mcp/toolResult.js +15 -0
- package/dist/esm/mcp/toolResult.js.map +1 -1
- package/dist/esm/mcp/types.d.ts +73 -8
- package/dist/esm/provider-contract/codeSandbox.d.ts +89 -0
- package/dist/esm/provider-contract/codeSandbox.js +119 -0
- package/dist/esm/provider-contract/codeSandbox.js.map +1 -0
- package/dist/esm/provider-contract/sessionExpired.d.ts +31 -0
- package/dist/esm/provider-contract/sessionExpired.js +40 -0
- package/dist/esm/provider-contract/sessionExpired.js.map +1 -0
- package/dist/esm/provider-contract/types.d.ts +166 -17
- package/dist/esm/provider-contract/types.js +9 -0
- package/dist/esm/provider-contract/types.js.map +1 -1
- package/dist/esm/redaction/knownStrings.js +16 -0
- package/dist/esm/redaction/knownStrings.js.map +1 -1
- package/dist/esm/tool-providers/index.d.ts +2 -2
- package/dist/esm/tool-providers/index.js +4 -0
- package/dist/esm/tool-providers/index.js.map +1 -1
- package/dist/esm/tools/requestEvidence.js +60 -0
- package/dist/esm/tools/requestEvidence.js.map +1 -1
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/mcp/callLifetime.js +66 -18
- package/dist/mcp/callLifetime.js.map +1 -1
- package/dist/mcp/callMarker.js +74 -0
- package/dist/mcp/callMarker.js.map +1 -0
- package/dist/mcp/connectionRefusals.js +7 -0
- package/dist/mcp/connectionRefusals.js.map +1 -1
- package/dist/mcp/index.js +5 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/mcpClient.js +91 -24
- package/dist/mcp/mcpClient.js.map +1 -1
- package/dist/mcp/replay.js +415 -0
- package/dist/mcp/replay.js.map +1 -0
- package/dist/mcp/replayUnavailable.js +92 -0
- package/dist/mcp/replayUnavailable.js.map +1 -0
- package/dist/mcp/requestLedger.js +193 -52
- package/dist/mcp/requestLedger.js.map +1 -1
- package/dist/mcp/seriesEvidence.js +116 -22
- package/dist/mcp/seriesEvidence.js.map +1 -1
- package/dist/mcp/throttleRetry.js +160 -51
- package/dist/mcp/throttleRetry.js.map +1 -1
- package/dist/mcp/toolResult.js +17 -1
- package/dist/mcp/toolResult.js.map +1 -1
- package/dist/provider-contract/codeSandbox.js +125 -0
- package/dist/provider-contract/codeSandbox.js.map +1 -0
- package/dist/provider-contract/sessionExpired.js +44 -0
- package/dist/provider-contract/sessionExpired.js.map +1 -0
- package/dist/provider-contract/types.js +12 -1
- package/dist/provider-contract/types.js.map +1 -1
- package/dist/redaction/knownStrings.js +16 -0
- package/dist/redaction/knownStrings.js.map +1 -1
- package/dist/tool-providers/index.js +5 -1
- package/dist/tool-providers/index.js.map +1 -1
- package/dist/tools/requestEvidence.js +60 -0
- package/dist/tools/requestEvidence.js.map +1 -1
- package/dist/types/adapters/code/agentcore.d.ts +65 -68
- package/dist/types/adapters/code/agentcore.d.ts.map +1 -1
- package/dist/types/adapters/code/agentcoreClient.d.ts +194 -0
- package/dist/types/adapters/code/agentcoreClient.d.ts.map +1 -0
- package/dist/types/adapters/code/agentcoreWire.d.ts +120 -0
- package/dist/types/adapters/code/agentcoreWire.d.ts.map +1 -0
- package/dist/types/adapters/code/fileName.d.ts +44 -0
- package/dist/types/adapters/code/fileName.d.ts.map +1 -0
- package/dist/types/adapters/code/local.d.ts +91 -12
- package/dist/types/adapters/code/local.d.ts.map +1 -1
- package/dist/types/adapters/code/output.d.ts +71 -0
- package/dist/types/adapters/code/output.d.ts.map +1 -0
- package/dist/types/adapters/mcp/agentcoreRuntime/invoke.d.ts +7 -6
- package/dist/types/adapters/mcp/agentcoreRuntime/invoke.d.ts.map +1 -1
- package/dist/types/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts +32 -1
- package/dist/types/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts.map +1 -1
- package/dist/types/adapters/mcp/agentcoreRuntime/transport.d.ts.map +1 -1
- package/dist/types/core/codeRunnerTool.d.ts +15 -3
- package/dist/types/core/codeRunnerTool.d.ts.map +1 -1
- package/dist/types/doors/providers.d.ts +1 -1
- package/dist/types/doors/providers.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +144 -29
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/mcp/callLifetime.d.ts +57 -14
- package/dist/types/mcp/callLifetime.d.ts.map +1 -1
- package/dist/types/mcp/callMarker.d.ts +44 -0
- package/dist/types/mcp/callMarker.d.ts.map +1 -0
- package/dist/types/mcp/index.d.ts +2 -0
- package/dist/types/mcp/index.d.ts.map +1 -1
- package/dist/types/mcp/mcpClient.d.ts.map +1 -1
- package/dist/types/mcp/replay.d.ts +292 -0
- package/dist/types/mcp/replay.d.ts.map +1 -0
- package/dist/types/mcp/replayUnavailable.d.ts +69 -0
- package/dist/types/mcp/replayUnavailable.d.ts.map +1 -0
- package/dist/types/mcp/requestLedger.d.ts +115 -32
- package/dist/types/mcp/requestLedger.d.ts.map +1 -1
- package/dist/types/mcp/seriesEvidence.d.ts +73 -15
- package/dist/types/mcp/seriesEvidence.d.ts.map +1 -1
- package/dist/types/mcp/throttleRetry.d.ts +86 -42
- package/dist/types/mcp/throttleRetry.d.ts.map +1 -1
- package/dist/types/mcp/toolResult.d.ts +6 -0
- package/dist/types/mcp/toolResult.d.ts.map +1 -1
- package/dist/types/mcp/types.d.ts +73 -8
- package/dist/types/mcp/types.d.ts.map +1 -1
- package/dist/types/provider-contract/codeSandbox.d.ts +90 -0
- package/dist/types/provider-contract/codeSandbox.d.ts.map +1 -0
- package/dist/types/provider-contract/sessionExpired.d.ts +32 -0
- package/dist/types/provider-contract/sessionExpired.d.ts.map +1 -0
- package/dist/types/provider-contract/types.d.ts +166 -17
- package/dist/types/provider-contract/types.d.ts.map +1 -1
- package/dist/types/redaction/knownStrings.d.ts.map +1 -1
- package/dist/types/tool-providers/index.d.ts +2 -2
- package/dist/types/tool-providers/index.d.ts.map +1 -1
- package/dist/types/tools/requestEvidence.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -10,43 +10,70 @@
|
|
|
10
10
|
* network-and-filesystem-isolated environment, and the tool code is identical
|
|
11
11
|
* across the swap.
|
|
12
12
|
*
|
|
13
|
-
* ── The
|
|
14
|
-
* Pinned in `test/adapters/aws/awsCommandPin.ts
|
|
15
|
-
* install of `@aws-sdk/client-bedrock-agentcore`
|
|
13
|
+
* ── The operations, verified against the SDK ────────────────────────────────
|
|
14
|
+
* Pinned in `test/adapters/aws/awsCommandPin.ts`. The three commands were
|
|
15
|
+
* verified against a real install of `@aws-sdk/client-bedrock-agentcore`
|
|
16
|
+
* 3.1108.0, and the four `InvokeCodeInterpreter` tool shapes below against
|
|
17
|
+
* 3.1159.0:
|
|
16
18
|
*
|
|
17
19
|
* • `StartCodeInterpreterSessionCommand`
|
|
18
20
|
* in `{ codeInterpreterIdentifier, name?, sessionTimeoutSeconds? }`
|
|
19
21
|
* out `{ codeInterpreterIdentifier, sessionId, createdAt }`
|
|
20
|
-
* • `InvokeCodeInterpreterCommand`
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* • `InvokeCodeInterpreterCommand` — `{ codeInterpreterIdentifier, sessionId,
|
|
23
|
+
* name, arguments }`, one service tool per call:
|
|
24
|
+
* `executeCode` `{ code, language? }` → `execute`
|
|
25
|
+
* `writeFiles` `{ content: [{ path, text } | { path, blob }] }` → `stageInputs`
|
|
26
|
+
* `readFiles` `{ paths: [path] }` → `readFile`
|
|
27
|
+
* `executeCommand` `{ command }` → `runCommand`
|
|
28
|
+
* out `{ sessionId, stream }` — an **event stream**, not a body
|
|
24
29
|
* • `StopCodeInterpreterSessionCommand`
|
|
25
30
|
* in `{ codeInterpreterIdentifier, sessionId }` ← the session ID, not a URI
|
|
26
|
-
* out `{ codeInterpreterIdentifier, sessionId, lastUpdatedAt }`
|
|
27
31
|
*
|
|
28
|
-
* **`Invoke` answers with an `AsyncIterable
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* four more. An adapter that read a `body` field would find `undefined` and
|
|
33
|
-
* report an empty success on every call, and one that iterated only for
|
|
34
|
-
* `result` would treat an AccessDenied as "the code printed nothing." So this
|
|
35
|
-
* drains the stream, raises the exception members BY NAME, and folds the
|
|
36
|
-
* result members into one `CodeResult`.
|
|
32
|
+
* **`Invoke` answers with an `AsyncIterable`** whose members are `{ result }`
|
|
33
|
+
* or a modelled EXCEPTION, and `./agentcoreClient.ts` drains it: exception
|
|
34
|
+
* members raise BY NAME, result members fold into one answer — and nothing
|
|
35
|
+
* the stream did not carry is filled in.
|
|
37
36
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
37
|
+
* ── Results say only what the service reported ──────────────────────────────
|
|
38
|
+
* `CodeResult.ok` is `true` or `false` only when the service said which: an
|
|
39
|
+
* exit status, or its own `isError` verdict. When it reported neither, `ok`
|
|
40
|
+
* is ABSENT — unknown. (It used to be `true`: success from silence.) A
|
|
41
|
+
* command's `exitCode` is the reported one or absent, never read off `isError`.
|
|
42
|
+
*
|
|
43
|
+
* ── Files in and out, exactly and bounded ───────────────────────────────────
|
|
44
|
+
* `stageInputs` writes TEXT as text and BYTES as a blob — never base64 inside
|
|
45
|
+
* text with a decode step — in ONE `writeFiles` call, refused before it is
|
|
46
|
+
* sent when its body would pass AgentCore's 100 MB per-call limit. AgentCore
|
|
47
|
+
* takes no environment, so `AF_STAGED_INPUTS` reaches code by a setup
|
|
48
|
+
* execution before EVERY run (confirmed by the line it prints; the runtime is
|
|
49
|
+
* mutable by the code it runs, so an earlier setup proves nothing now) and
|
|
50
|
+
* reaches a command as an `export` line ahead of it. `readFile` reads ONE path
|
|
51
|
+
* and pairs the file to it by the URI the service returned — one `file:///`
|
|
52
|
+
* form, read one way, a raw query or fragment refused — failing closed on a
|
|
53
|
+
* missing or different one; text or bytes is whichever field the service
|
|
54
|
+
* filled, and a file over `maxBytes` is refused, never cut.
|
|
55
|
+
*
|
|
56
|
+
* ── Commands are opt-in ─────────────────────────────────────────────────────
|
|
57
|
+
* `runCommand` runs arbitrary shell, so a session has it only when the runner
|
|
58
|
+
* is built with `commands: true`. The sandbox's network is whatever the code
|
|
59
|
+
* interpreter resource was created with — the built-in `aws.codeinterpreter.v1`
|
|
60
|
+
* runs with AWS's most restrictive defaults (Sandbox mode: limited network
|
|
61
|
+
* access, Amazon S3 included); a custom interpreter may be Public (internet)
|
|
62
|
+
* or VPC. This adapter can neither see nor change that.
|
|
63
|
+
*
|
|
64
|
+
* ── A session that is gone says so, once ────────────────────────────────────
|
|
65
|
+
* A service error naming the session as "not active" becomes
|
|
66
|
+
* {@link SessionExpiredError} on every verb, and so does a
|
|
67
|
+
* `ResourceNotFoundException` on a verb that addresses nothing but the session
|
|
68
|
+
* (code, a command, a write). On a READ, "not found" may mean the file, so it
|
|
69
|
+
* is `CodeSandboxError` (`'file-not-returned'`), naming both possibilities —
|
|
70
|
+
* never offered as proof the session is gone.
|
|
42
71
|
*
|
|
43
72
|
* ── How this talks to the SDK (the 9.4.0 law) ───────────────────────────────
|
|
44
73
|
* Through `client.send(new SomeCommand(input))`, never a method on the client.
|
|
45
74
|
* A bare `@aws-sdk/client-*` **Client is command-based**: its prototype carries
|
|
46
|
-
* `send` and `destroy` and nothing else
|
|
47
|
-
*
|
|
48
|
-
* `undefined`; the shortcut exists only on the aggregated `BedrockAgentCore`).
|
|
49
|
-
* Three adapters have shipped that bug in this package.
|
|
75
|
+
* `send` and `destroy` and nothing else. Three adapters have shipped that bug
|
|
76
|
+
* in this package.
|
|
50
77
|
*
|
|
51
78
|
* ── Credentials ─────────────────────────────────────────────────────────────
|
|
52
79
|
* Standard AWS credential resolution (the SDK's own chain). A tool holding a
|
|
@@ -57,11 +84,17 @@
|
|
|
57
84
|
* Pattern: Adapter (GoF) + lazy peer-dep load — the SDK is required only when
|
|
58
85
|
* `start()` first runs (or never, if you inject `_client` / `_sdk`).
|
|
59
86
|
*/
|
|
87
|
+
import { CodeSandboxError, readBound, sandboxPath } from '../../provider-contract/codeSandbox.js';
|
|
88
|
+
import { SessionExpiredError } from '../../provider-contract/sessionExpired.js';
|
|
60
89
|
import { hashSessionKey } from '../../tools/toolSessions.js';
|
|
61
|
-
import {
|
|
90
|
+
import { abortErrorOf, armDeadline, linkedController, throwIfAborted, untilAborted, } from '../../lib/abort.js';
|
|
91
|
+
import { createCodeClient, } from './agentcoreClient.js';
|
|
92
|
+
import { AGENTCORE_MAX_REQUEST_BYTES, errorNameOf, MANIFEST_SET_MARKER, STAGED_INPUTS_DIR, fileContent, manifestRuntime, manifestSetupCode, pairReadFile, serviceRefusal, sessionExpiryEvidence, withManifestExport, writeFilesRequestBytes, } from './agentcoreWire.js';
|
|
93
|
+
import { safeFileName } from './fileName.js';
|
|
94
|
+
import { boundOutput, commandBounds, commandResult, payloadBytes, printedLine } from './output.js';
|
|
62
95
|
const DEFAULT_MAX_OUTPUT_CHARS = 8_000;
|
|
63
|
-
/** The
|
|
64
|
-
const
|
|
96
|
+
/** The adapter's own name, on every refusal it raises. */
|
|
97
|
+
const BACKEND = 'agentCoreCodeRunner';
|
|
65
98
|
export function agentCoreCodeRunner(options) {
|
|
66
99
|
const id = options.id ?? 'agentcore-code-runner';
|
|
67
100
|
const maxOutputChars = options.maxOutputChars ?? DEFAULT_MAX_OUTPUT_CHARS;
|
|
@@ -91,64 +124,240 @@ export function agentCoreCodeRunner(options) {
|
|
|
91
124
|
'Nothing can be invoked or stopped without one, so this is raised rather than ' +
|
|
92
125
|
'carried forward as an unusable session.');
|
|
93
126
|
}
|
|
94
|
-
|
|
127
|
+
return openSession({
|
|
128
|
+
api,
|
|
129
|
+
identifier: options.identifier,
|
|
130
|
+
sessionId,
|
|
131
|
+
language: req.language ?? options.language,
|
|
132
|
+
maxOutputChars,
|
|
133
|
+
commands: options.commands === true,
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/** The session behind {@link agentCoreCodeRunner}: the verbs, in the order a caller uses them. */
|
|
139
|
+
function openSession(plan) {
|
|
140
|
+
const { api, identifier, sessionId, maxOutputChars } = plan;
|
|
141
|
+
const target = { codeInterpreterIdentifier: identifier, sessionId };
|
|
142
|
+
let stopped = false;
|
|
143
|
+
/** name → path, exactly as the manifest carries it. */
|
|
144
|
+
const staged = new Map();
|
|
145
|
+
const refuseIfStopped = (toDo) => {
|
|
146
|
+
if (stopped) {
|
|
147
|
+
throw new Error(`agentCoreCodeRunner: session ${sessionId} was stopped; open a new one to ${toDo}.`);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const manifestJson = () => staged.size > 0 ? JSON.stringify(Object.fromEntries(staged)) : undefined;
|
|
151
|
+
/**
|
|
152
|
+
* One deadline and one cancellation for a whole verb. A verb that makes two
|
|
153
|
+
* calls — the manifest setup, then the code — spends ONE `timeoutMs`, not
|
|
154
|
+
* one each. A deadline or the caller's own signal stops the WAIT at once
|
|
155
|
+
* (`lib/abort.ts`); what the service does with a request it already
|
|
156
|
+
* received is its own business, and the timeout error says so.
|
|
157
|
+
*/
|
|
158
|
+
const withinBounds = async (verb, bounds, work) => {
|
|
159
|
+
throwIfAborted(bounds.signal);
|
|
160
|
+
const { controller, unlink } = linkedController(bounds.signal);
|
|
161
|
+
const disarm = bounds.timeoutMs === undefined
|
|
162
|
+
? undefined
|
|
163
|
+
: armDeadline(controller, bounds.timeoutMs, () => new CodeSandboxError('timed-out', `agentCoreCodeRunner: ${verb} did not answer within ${bounds.timeoutMs}ms ` +
|
|
164
|
+
'and was abandoned. The session was not stopped, so what was sent may still ' +
|
|
165
|
+
'be running in it — whether it finished is not known.'));
|
|
166
|
+
try {
|
|
167
|
+
return await work(controller.signal);
|
|
168
|
+
}
|
|
169
|
+
finally {
|
|
170
|
+
disarm?.();
|
|
171
|
+
unlink();
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* One invoke under `signal`. A gone session becomes `SessionExpiredError`;
|
|
176
|
+
* a modelled service error on a file or command call is rewritten without
|
|
177
|
+
* the service's words (they can quote what was sent).
|
|
178
|
+
*/
|
|
179
|
+
const invoke = async (input, signal) => {
|
|
180
|
+
throwIfAborted(signal);
|
|
181
|
+
try {
|
|
182
|
+
return await untilAborted(api.invoke(input, { abortSignal: signal }), signal);
|
|
183
|
+
}
|
|
184
|
+
catch (err) {
|
|
185
|
+
if (signal.aborted)
|
|
186
|
+
throw abortErrorOf(signal);
|
|
187
|
+
const evidence = sessionExpiryEvidence(err, input.name);
|
|
188
|
+
if (evidence === 'session') {
|
|
189
|
+
throw new SessionExpiredError(BACKEND, sessionId, errorNameOf(err));
|
|
190
|
+
}
|
|
191
|
+
if (evidence === 'file-or-session' && input.name === 'readFiles') {
|
|
192
|
+
// A read names a FILE as well as the session, so "not found" can mean
|
|
193
|
+
// either. It is not taken as proof the session is gone.
|
|
194
|
+
throw new CodeSandboxError('file-not-returned', `agentCoreCodeRunner: reading '${input.arguments.paths.join(', ')}' — the service ` +
|
|
195
|
+
'answered ResourceNotFoundException, which can mean the file is missing or the ' +
|
|
196
|
+
'session is gone; which one is not known here.', { path: input.arguments.paths[0] ?? '' });
|
|
197
|
+
}
|
|
198
|
+
if (input.name === 'executeCode')
|
|
199
|
+
throw err;
|
|
200
|
+
throw serviceRefusal(err, input.name) ?? err;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Set {@link STAGED_INPUTS_ENV} in the runtime `language` runs in — before
|
|
205
|
+
* EVERY execution once anything is staged, and confirmed each time.
|
|
206
|
+
*
|
|
207
|
+
* Never skipped because this process set it before: the runtime is mutable
|
|
208
|
+
* by the very code it runs, so a previous execution may have changed or
|
|
209
|
+
* deleted the variable, and a record of what was once sent is not an
|
|
210
|
+
* observation of what the runtime holds. Re-applying it costs one call per
|
|
211
|
+
* execution, inside the same deadline. Nothing when nothing was staged — a
|
|
212
|
+
* session that never stages sends exactly what it always sent.
|
|
213
|
+
*/
|
|
214
|
+
const exposeManifest = async (language, signal) => {
|
|
215
|
+
const json = manifestJson();
|
|
216
|
+
if (json === undefined)
|
|
217
|
+
return;
|
|
218
|
+
const runtime = manifestRuntime(language);
|
|
219
|
+
if (runtime === undefined) {
|
|
220
|
+
throw new CodeSandboxError('staged-inputs-unset', `agentCoreCodeRunner: inputs were staged, and this adapter does not know how to set ` +
|
|
221
|
+
`AF_STAGED_INPUTS for language '${String(language)}', so the code is not run against ` +
|
|
222
|
+
'a manifest it could not read. AgentCore runs python, javascript and typescript.');
|
|
223
|
+
}
|
|
224
|
+
const answer = await invoke({
|
|
225
|
+
...target,
|
|
226
|
+
name: 'executeCode',
|
|
227
|
+
arguments: { code: manifestSetupCode(runtime, json), ...(language ? { language } : {}) },
|
|
228
|
+
}, signal);
|
|
229
|
+
// The setup prints one line once the variable is set — it proves that
|
|
230
|
+
// checkpoint and nothing else, which is all that is asked of it.
|
|
231
|
+
if (!printedLine(answer.stdout, MANIFEST_SET_MARKER)) {
|
|
232
|
+
throw new CodeSandboxError('staged-inputs-unset', `agentCoreCodeRunner: the staged inputs are in the session, but setting AF_STAGED_INPUTS ` +
|
|
233
|
+
`in its ${runtime} runtime was not confirmed, so the code is not run against a ` +
|
|
234
|
+
'manifest it may not be able to read.');
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
const session = {
|
|
238
|
+
id: sessionId,
|
|
239
|
+
async execute(exec) {
|
|
240
|
+
refuseIfStopped('run more code');
|
|
241
|
+
const language = exec.language ?? plan.language;
|
|
242
|
+
const bounds = {
|
|
243
|
+
...(exec.timeoutMs !== undefined && { timeoutMs: exec.timeoutMs }),
|
|
244
|
+
...(exec.signal && { signal: exec.signal }),
|
|
245
|
+
};
|
|
246
|
+
const answer = await withinBounds('executeCode', bounds, async (signal) => {
|
|
247
|
+
await exposeManifest(language, signal);
|
|
248
|
+
return invoke({
|
|
249
|
+
...target,
|
|
250
|
+
name: 'executeCode',
|
|
251
|
+
arguments: { code: exec.code, ...(language ? { language } : {}) },
|
|
252
|
+
}, signal);
|
|
253
|
+
});
|
|
254
|
+
const bounded = boundOutput(answer.stdout, answer.stderr, maxOutputChars);
|
|
255
|
+
const ok = reportedOutcome(answer);
|
|
256
|
+
// An error flag with no exit status is the SERVICE's verdict, not the
|
|
257
|
+
// program's: whether the code ran is unconfirmed, and the result says
|
|
258
|
+
// which kind of `false` it is.
|
|
259
|
+
const serviceError = answer.isError === true && answer.exitCode === undefined;
|
|
95
260
|
return {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
codeInterpreterIdentifier: options.identifier,
|
|
103
|
-
sessionId,
|
|
104
|
-
name: EXECUTE_CODE,
|
|
105
|
-
arguments: {
|
|
106
|
-
code: exec.code,
|
|
107
|
-
...(exec.language ?? req.language ?? options.language
|
|
108
|
-
? { language: exec.language ?? req.language ?? options.language ?? 'python' }
|
|
109
|
-
: {}),
|
|
110
|
-
},
|
|
111
|
-
});
|
|
112
|
-
const stdout = cut(answer.stdout, maxOutputChars);
|
|
113
|
-
const stderr = cut(answer.stderr, maxOutputChars);
|
|
114
|
-
const truncated = {
|
|
115
|
-
...(stdout.cut && { stdout: true }),
|
|
116
|
-
...(stderr.cut && { stderr: true }),
|
|
117
|
-
...((stdout.cut || stderr.cut) && {
|
|
118
|
-
ofChars: Math.max(answer.stdout.length, answer.stderr.length),
|
|
119
|
-
}),
|
|
120
|
-
};
|
|
121
|
-
return {
|
|
122
|
-
// `isError` is the service's own verdict; a non-zero exit is ours.
|
|
123
|
-
ok: answer.isError !== true && (answer.exitCode ?? 0) === 0,
|
|
124
|
-
stdout: stdout.text,
|
|
125
|
-
stderr: stderr.text,
|
|
126
|
-
...(answer.exitCode !== undefined && { exitCode: answer.exitCode }),
|
|
127
|
-
...(Object.keys(truncated).length > 0 && { truncated }),
|
|
128
|
-
};
|
|
129
|
-
},
|
|
130
|
-
async stop() {
|
|
131
|
-
if (stopped)
|
|
132
|
-
return;
|
|
133
|
-
stopped = true;
|
|
134
|
-
try {
|
|
135
|
-
await api.stopSession({
|
|
136
|
-
codeInterpreterIdentifier: options.identifier,
|
|
137
|
-
sessionId,
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
catch (err) {
|
|
141
|
-
// "Already gone" is the EXPECTED shape here, not an incident: the
|
|
142
|
-
// session TTL is enforced by AWS, so a run that idled past it finds
|
|
143
|
-
// the session collected. Anything else is re-raised, and the tier
|
|
144
|
-
// reports it on `tools.session_close_failed`.
|
|
145
|
-
if (!isAlreadyGone(err))
|
|
146
|
-
throw err;
|
|
147
|
-
}
|
|
148
|
-
},
|
|
261
|
+
...(ok !== undefined && { ok }),
|
|
262
|
+
stdout: bounded.stdout,
|
|
263
|
+
stderr: bounded.stderr,
|
|
264
|
+
...(answer.exitCode !== undefined && { exitCode: answer.exitCode }),
|
|
265
|
+
...(serviceError && { serviceError: true }),
|
|
266
|
+
...(bounded.truncated !== undefined && { truncated: bounded.truncated }),
|
|
149
267
|
};
|
|
150
268
|
},
|
|
269
|
+
async stageInputs(inputs) {
|
|
270
|
+
refuseIfStopped('stage inputs');
|
|
271
|
+
if (inputs.length === 0)
|
|
272
|
+
return [];
|
|
273
|
+
// The name is CALLER data landing in a filesystem, so it is ENCODED
|
|
274
|
+
// into one inert segment — the same encoder `localCodeRunner` uses, so
|
|
275
|
+
// a name lands under the same file name on either backend.
|
|
276
|
+
const landing = inputs.map((input) => ({
|
|
277
|
+
input,
|
|
278
|
+
path: `${STAGED_INPUTS_DIR}/${safeFileName(input.fileName ?? input.name)}`,
|
|
279
|
+
}));
|
|
280
|
+
const content = landing.map(({ input, path }) => fileContent(path, input.data));
|
|
281
|
+
const bytes = writeFilesRequestBytes(content);
|
|
282
|
+
if (bytes > AGENTCORE_MAX_REQUEST_BYTES) {
|
|
283
|
+
throw new CodeSandboxError('request-too-large', `agentCoreCodeRunner: staging these ${inputs.length} input(s) would send a ` +
|
|
284
|
+
`${bytes}-byte request, and AgentCore takes at most ${AGENTCORE_MAX_REQUEST_BYTES} ` +
|
|
285
|
+
'bytes in one call. Nothing was sent. Stage fewer or smaller inputs per call, or ' +
|
|
286
|
+
'have the code fetch large data itself (from Amazon S3, for example).', { bytes, limit: AGENTCORE_MAX_REQUEST_BYTES });
|
|
287
|
+
}
|
|
288
|
+
const answer = await withinBounds('writeFiles', {}, (signal) => invoke({ ...target, name: 'writeFiles', arguments: { content } }, signal));
|
|
289
|
+
if (answer.isError === true) {
|
|
290
|
+
throw new CodeSandboxError('write-failed', 'agentCoreCodeRunner: the service flagged the write of the staged inputs as an error, ' +
|
|
291
|
+
'so which of them landed is not known. Its words are not repeated here.');
|
|
292
|
+
}
|
|
293
|
+
for (const { input, path } of landing)
|
|
294
|
+
staged.set(input.name, path);
|
|
295
|
+
return landing.map(({ input, path }) => ({
|
|
296
|
+
name: input.name,
|
|
297
|
+
path,
|
|
298
|
+
bytes: payloadBytes(input.data),
|
|
299
|
+
}));
|
|
300
|
+
},
|
|
301
|
+
async readFile(path, readOptions) {
|
|
302
|
+
refuseIfStopped('read files');
|
|
303
|
+
const maxBytes = readBound(readOptions);
|
|
304
|
+
const relative = sandboxPath(path);
|
|
305
|
+
const answer = await withinBounds('readFiles', { ...(readOptions.signal && { signal: readOptions.signal }) }, (signal) => invoke({ ...target, name: 'readFiles', arguments: { paths: [relative] } }, signal));
|
|
306
|
+
return pairReadFile(relative, answer, maxBytes);
|
|
307
|
+
},
|
|
308
|
+
...(plan.commands && {
|
|
309
|
+
async runCommand(command, commandOptions) {
|
|
310
|
+
refuseIfStopped('run commands');
|
|
311
|
+
const bounds = commandBounds(command, commandOptions, maxOutputChars);
|
|
312
|
+
const json = manifestJson();
|
|
313
|
+
const answer = await withinBounds('executeCommand', {
|
|
314
|
+
...(bounds.timeoutMs !== undefined && { timeoutMs: bounds.timeoutMs }),
|
|
315
|
+
...(bounds.signal && { signal: bounds.signal }),
|
|
316
|
+
}, (signal) => invoke({
|
|
317
|
+
...target,
|
|
318
|
+
name: 'executeCommand',
|
|
319
|
+
arguments: {
|
|
320
|
+
command: json === undefined ? command : withManifestExport(command, json),
|
|
321
|
+
},
|
|
322
|
+
}, signal));
|
|
323
|
+
return commandResult(answer, bounds);
|
|
324
|
+
},
|
|
325
|
+
}),
|
|
326
|
+
async stop() {
|
|
327
|
+
if (stopped)
|
|
328
|
+
return;
|
|
329
|
+
stopped = true;
|
|
330
|
+
staged.clear();
|
|
331
|
+
try {
|
|
332
|
+
await api.stopSession({ codeInterpreterIdentifier: identifier, sessionId });
|
|
333
|
+
}
|
|
334
|
+
catch (err) {
|
|
335
|
+
// "Already gone" is the EXPECTED shape here, not an incident: the
|
|
336
|
+
// session TTL is enforced by AWS, so a run that idled past it finds
|
|
337
|
+
// the session collected. Anything else is re-raised, and the tier
|
|
338
|
+
// reports it on `tools.session_close_failed`.
|
|
339
|
+
if (!isAlreadyGone(err))
|
|
340
|
+
throw err;
|
|
341
|
+
}
|
|
342
|
+
},
|
|
151
343
|
};
|
|
344
|
+
return session;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Did the code complete — as far as the service SAID?
|
|
348
|
+
*
|
|
349
|
+
* Its own error verdict first, then an exit status, then its explicit
|
|
350
|
+
* "not an error". When it said none of those, the answer is `undefined`:
|
|
351
|
+
* unknown, never success from silence.
|
|
352
|
+
*/
|
|
353
|
+
function reportedOutcome(answer) {
|
|
354
|
+
if (answer.isError === true)
|
|
355
|
+
return false;
|
|
356
|
+
if (answer.exitCode !== undefined)
|
|
357
|
+
return answer.exitCode === 0;
|
|
358
|
+
if (answer.isError === false)
|
|
359
|
+
return true;
|
|
360
|
+
return undefined;
|
|
152
361
|
}
|
|
153
362
|
/**
|
|
154
363
|
* A label for the remote session — derived FROM the isolation key, carrying
|
|
@@ -177,7 +386,8 @@ export function agentCoreCodeRunner(options) {
|
|
|
177
386
|
* nothing — here or in the SDK — ever looks a session up by it. The address is
|
|
178
387
|
* the service-assigned `sessionId`, which `start()` reads back and passes to
|
|
179
388
|
* every `Invoke` and `Stop` verbatim. So no stored state is keyed on this
|
|
180
|
-
* string and relabelling migrates nothing
|
|
389
|
+
* string and relabelling migrates nothing — and no session is ever reattached
|
|
390
|
+
* by it.
|
|
181
391
|
*/
|
|
182
392
|
function sessionName(key) {
|
|
183
393
|
return `af-${hashSessionKey(key)}`;
|
|
@@ -186,133 +396,4 @@ function isAlreadyGone(err) {
|
|
|
186
396
|
const name = err instanceof Error ? err.name : '';
|
|
187
397
|
return name === 'ResourceNotFoundException' || name === 'ValidationException';
|
|
188
398
|
}
|
|
189
|
-
/**
|
|
190
|
-
* Map {@link AgentCoreCodeClientLike} onto the real SDK commands.
|
|
191
|
-
*
|
|
192
|
-
* Two things this function owns and nothing else does: the COMMAND FORM (see
|
|
193
|
-
* the module header), and the DRAIN of `InvokeCodeInterpreterResponse.stream`.
|
|
194
|
-
*/
|
|
195
|
-
function createCodeClient(options) {
|
|
196
|
-
let mod;
|
|
197
|
-
if (options._sdk) {
|
|
198
|
-
mod = options._sdk;
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
try {
|
|
202
|
-
// Lazy peer-dep: only loaded when no _client/_sdk is injected and start() runs.
|
|
203
|
-
mod = lazyRequire('@aws-sdk/client-bedrock-agentcore');
|
|
204
|
-
}
|
|
205
|
-
catch {
|
|
206
|
-
throw new Error('agentCoreCodeRunner requires the `@aws-sdk/client-bedrock-agentcore` peer dependency.\n' +
|
|
207
|
-
' Install: npm install @aws-sdk/client-bedrock-agentcore\n' +
|
|
208
|
-
' Or pass `_client` for a pre-built or mock client.\n' +
|
|
209
|
-
' For a local dev loop with no AWS at all, use `localCodeRunner()`.');
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
if (!mod.BedrockAgentCoreClient) {
|
|
213
|
-
throw new Error('agentCoreCodeRunner: `@aws-sdk/client-bedrock-agentcore` is installed but ' +
|
|
214
|
-
'`BedrockAgentCoreClient` was not found. Update the SDK.');
|
|
215
|
-
}
|
|
216
|
-
const sdk = new mod.BedrockAgentCoreClient({ ...(options.region && { region: options.region }) });
|
|
217
|
-
const send = async (Ctor, name, input) => {
|
|
218
|
-
if (!Ctor) {
|
|
219
|
-
throw new Error(`agentCoreCodeRunner: \`@aws-sdk/client-bedrock-agentcore\` is missing ${name}. ` +
|
|
220
|
-
'Upgrade the SDK, or pass `_client` with your own mapping.');
|
|
221
|
-
}
|
|
222
|
-
return sdk.send(new Ctor(input));
|
|
223
|
-
};
|
|
224
|
-
return {
|
|
225
|
-
async startSession(input) {
|
|
226
|
-
const r = (await send(mod.StartCodeInterpreterSessionCommand, 'StartCodeInterpreterSessionCommand', input));
|
|
227
|
-
return { ...(r?.sessionId !== undefined && { sessionId: r.sessionId }) };
|
|
228
|
-
},
|
|
229
|
-
async invoke(input) {
|
|
230
|
-
const r = (await send(mod.InvokeCodeInterpreterCommand, 'InvokeCodeInterpreterCommand', input));
|
|
231
|
-
return drainStream(r?.stream);
|
|
232
|
-
},
|
|
233
|
-
async stopSession(input) {
|
|
234
|
-
await send(mod.StopCodeInterpreterSessionCommand, 'StopCodeInterpreterSessionCommand', input);
|
|
235
|
-
},
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
/** Every modelled error member of the stream union, in SDK spelling. */
|
|
239
|
-
const STREAM_ERROR_MEMBERS = [
|
|
240
|
-
'accessDeniedException',
|
|
241
|
-
'conflictException',
|
|
242
|
-
'internalServerException',
|
|
243
|
-
'resourceNotFoundException',
|
|
244
|
-
'serviceQuotaExceededException',
|
|
245
|
-
'throttlingException',
|
|
246
|
-
'validationException',
|
|
247
|
-
];
|
|
248
|
-
/**
|
|
249
|
-
* Drain the event stream into one answer.
|
|
250
|
-
*
|
|
251
|
-
* An ERROR MEMBER RAISES. This is the honesty line for this adapter: the SDK
|
|
252
|
-
* models seven failure shapes as ordinary members of the stream union, so an
|
|
253
|
-
* `AccessDeniedException` arrives as a value, not a rejection. Folding it in
|
|
254
|
-
* as empty output would report a clean run in which the code "printed
|
|
255
|
-
* nothing" — a silent success, at the exact moment an operator most needs the
|
|
256
|
-
* word "AccessDenied".
|
|
257
|
-
*/
|
|
258
|
-
async function drainStream(stream) {
|
|
259
|
-
if (!stream) {
|
|
260
|
-
throw new Error('agentCoreCodeRunner: InvokeCodeInterpreter returned no stream. The response carries ' +
|
|
261
|
-
'its payload as an event stream (`response.stream`), so an absent one is a broken ' +
|
|
262
|
-
'call, not an empty result.');
|
|
263
|
-
}
|
|
264
|
-
let stdout = '';
|
|
265
|
-
let stderr = '';
|
|
266
|
-
let exitCode;
|
|
267
|
-
let isError = false;
|
|
268
|
-
for await (const event of stream) {
|
|
269
|
-
for (const member of STREAM_ERROR_MEMBERS) {
|
|
270
|
-
const raised = event[member];
|
|
271
|
-
if (raised) {
|
|
272
|
-
const error = new Error(`agentCoreCodeRunner: ${member} from InvokeCodeInterpreter — ` +
|
|
273
|
-
`${raised.message ?? 'no message supplied'}`);
|
|
274
|
-
error.name = member.charAt(0).toUpperCase() + member.slice(1);
|
|
275
|
-
throw error;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
const result = event.result;
|
|
279
|
-
if (!result)
|
|
280
|
-
continue;
|
|
281
|
-
if (result.isError === true)
|
|
282
|
-
isError = true;
|
|
283
|
-
const structured = result.structuredContent;
|
|
284
|
-
if (structured) {
|
|
285
|
-
if (structured.stdout !== undefined)
|
|
286
|
-
stdout += structured.stdout;
|
|
287
|
-
if (structured.stderr !== undefined)
|
|
288
|
-
stderr += structured.stderr;
|
|
289
|
-
if (structured.exitCode !== undefined)
|
|
290
|
-
exitCode = structured.exitCode;
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
// Fallback: a response that filled only the typed content blocks. Text
|
|
294
|
-
// blocks are the readable half; a binary/resource block is described by
|
|
295
|
-
// name rather than inlined, because inlining it is the bug this port exists
|
|
296
|
-
// to prevent.
|
|
297
|
-
for (const block of result.content ?? []) {
|
|
298
|
-
if (block.text !== undefined)
|
|
299
|
-
stdout += block.text;
|
|
300
|
-
else if (block.name !== undefined)
|
|
301
|
-
stdout += `[${block.type ?? 'resource'}: ${block.name}]`;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
return {
|
|
306
|
-
stdout,
|
|
307
|
-
stderr,
|
|
308
|
-
...(exitCode !== undefined && { exitCode }),
|
|
309
|
-
...(isError && { isError }),
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
/** Cut to `max` characters, saying whether it cut. */
|
|
313
|
-
function cut(text, max) {
|
|
314
|
-
if (text.length <= max)
|
|
315
|
-
return { text, cut: false };
|
|
316
|
-
return { text: text.slice(0, max), cut: true };
|
|
317
|
-
}
|
|
318
399
|
//# sourceMappingURL=agentcore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentcore.js","sourceRoot":"","sources":["../../../../src/adapters/code/agentcore.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agentcore.js","sourceRoot":"","sources":["../../../../src/adapters/code/agentcore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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