@5ss/ai-tools 2.11.1
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/CHANGELOG.md +112 -0
- package/LICENSE +21 -0
- package/README.md +221 -0
- package/dist/ai-sdk/index.d.ts +15 -0
- package/dist/ai-sdk/index.d.ts.map +1 -0
- package/dist/ai-sdk/index.js +24 -0
- package/dist/ai-sdk/index.js.map +1 -0
- package/dist/artifact-D064mHfK.js +44 -0
- package/dist/artifact-D064mHfK.js.map +1 -0
- package/dist/artifacts-O8g-40Pw.js +404 -0
- package/dist/artifacts-O8g-40Pw.js.map +1 -0
- package/dist/aws-json-CecFqzqX.js +23 -0
- package/dist/aws-json-CecFqzqX.js.map +1 -0
- package/dist/aws-service-msttbPrz.js +58 -0
- package/dist/aws-service-msttbPrz.js.map +1 -0
- package/dist/batch-BMM5dXqL.d.ts +22 -0
- package/dist/batch-BMM5dXqL.d.ts.map +1 -0
- package/dist/batch-Co1ujeAW.js +67 -0
- package/dist/batch-Co1ujeAW.js.map +1 -0
- package/dist/bedrock-agentcore-browser-a_qOs-NR.js +182 -0
- package/dist/bedrock-agentcore-browser-a_qOs-NR.js.map +1 -0
- package/dist/bedrock-agentcore-code-interpreter-MWK-8RhA.js +357 -0
- package/dist/bedrock-agentcore-code-interpreter-MWK-8RhA.js.map +1 -0
- package/dist/bytes-BxpimpQx.js +45 -0
- package/dist/bytes-BxpimpQx.js.map +1 -0
- package/dist/client-CCKGsTeI.js +743 -0
- package/dist/client-CCKGsTeI.js.map +1 -0
- package/dist/cloudflare/index.d.ts +37 -0
- package/dist/cloudflare/index.d.ts.map +1 -0
- package/dist/cloudflare/index.js +41 -0
- package/dist/cloudflare/index.js.map +1 -0
- package/dist/cloudflare-browser-B6Yolpin.js +428 -0
- package/dist/cloudflare-browser-B6Yolpin.js.map +1 -0
- package/dist/cloudflare-email-Dy0KHeDf.js +197 -0
- package/dist/cloudflare-email-Dy0KHeDf.js.map +1 -0
- package/dist/cloudflare-sandbox-Dp_uNaqW.js +982 -0
- package/dist/cloudflare-sandbox-Dp_uNaqW.js.map +1 -0
- package/dist/content-type-CORxaxcv.js +49 -0
- package/dist/content-type-CORxaxcv.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.js +204 -0
- package/dist/core/index.js.map +1 -0
- package/dist/define-CvpJ_pNP.js +115 -0
- package/dist/define-CvpJ_pNP.js.map +1 -0
- package/dist/errors-DoSpNHvs.js +20 -0
- package/dist/errors-DoSpNHvs.js.map +1 -0
- package/dist/errors-aKhko9T1.d.ts +18 -0
- package/dist/errors-aKhko9T1.d.ts.map +1 -0
- package/dist/eventbridge-scheduler-Bh6GqZY2.js +349 -0
- package/dist/eventbridge-scheduler-Bh6GqZY2.js.map +1 -0
- package/dist/framework-context-DVIIY8ZO.js +24 -0
- package/dist/framework-context-DVIIY8ZO.js.map +1 -0
- package/dist/gotenberg-NuJjxyln.js +291 -0
- package/dist/gotenberg-NuJjxyln.js.map +1 -0
- package/dist/http/index.d.ts +47 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +3 -0
- package/dist/http-service-DDNCO1s4.js +254 -0
- package/dist/http-service-DDNCO1s4.js.map +1 -0
- package/dist/http-service-T7E5UjP8.d.ts +80 -0
- package/dist/http-service-T7E5UjP8.d.ts.map +1 -0
- package/dist/imessage-BSAFOI8Z.js +154 -0
- package/dist/imessage-BSAFOI8Z.js.map +1 -0
- package/dist/index-BU4gmYO8.d.ts +254 -0
- package/dist/index-BU4gmYO8.d.ts.map +1 -0
- package/dist/index-CCivzmxO.d.ts +188 -0
- package/dist/index-CCivzmxO.d.ts.map +1 -0
- package/dist/index-CLmTrcu5.d.ts +22 -0
- package/dist/index-CLmTrcu5.d.ts.map +1 -0
- package/dist/index-CZX5OeOF.d.ts +235 -0
- package/dist/index-CZX5OeOF.d.ts.map +1 -0
- package/dist/index-CdFmEfZO.d.ts +359 -0
- package/dist/index-CdFmEfZO.d.ts.map +1 -0
- package/dist/index-Cuh6eMWc.d.ts +285 -0
- package/dist/index-Cuh6eMWc.d.ts.map +1 -0
- package/dist/index-DuOGj7vc.d.ts +107 -0
- package/dist/index-DuOGj7vc.d.ts.map +1 -0
- package/dist/index-ccZ1XOHw.d.ts +69 -0
- package/dist/index-ccZ1XOHw.d.ts.map +1 -0
- package/dist/index-n8JTpNf1.d.ts +247 -0
- package/dist/index-n8JTpNf1.d.ts.map +1 -0
- package/dist/index-pwW1OsOx.d.ts +134 -0
- package/dist/index-pwW1OsOx.d.ts.map +1 -0
- package/dist/index-zK1ZwS4m.d.ts +347 -0
- package/dist/index-zK1ZwS4m.d.ts.map +1 -0
- package/dist/limits-hjrO8zUG.js +80 -0
- package/dist/limits-hjrO8zUG.js.map +1 -0
- package/dist/mastra/index.d.ts +14 -0
- package/dist/mastra/index.d.ts.map +1 -0
- package/dist/mastra/index.js +26 -0
- package/dist/mastra/index.js.map +1 -0
- package/dist/mastra-vector-Dhc6XZ8l.js +234 -0
- package/dist/mastra-vector-Dhc6XZ8l.js.map +1 -0
- package/dist/mcp/index.d.ts +80 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +97 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/modules/artifacts/index.d.ts +337 -0
- package/dist/modules/artifacts/index.d.ts.map +1 -0
- package/dist/modules/artifacts/index.js +348 -0
- package/dist/modules/artifacts/index.js.map +1 -0
- package/dist/modules/browser/index.d.ts +516 -0
- package/dist/modules/browser/index.d.ts.map +1 -0
- package/dist/modules/browser/index.js +475 -0
- package/dist/modules/browser/index.js.map +1 -0
- package/dist/modules/calendar/index.d.ts +93 -0
- package/dist/modules/calendar/index.d.ts.map +1 -0
- package/dist/modules/calendar/index.js +131 -0
- package/dist/modules/calendar/index.js.map +1 -0
- package/dist/modules/code-sandbox/index.d.ts +317 -0
- package/dist/modules/code-sandbox/index.d.ts.map +1 -0
- package/dist/modules/code-sandbox/index.js +537 -0
- package/dist/modules/code-sandbox/index.js.map +1 -0
- package/dist/modules/content-type/index.d.ts +22 -0
- package/dist/modules/content-type/index.d.ts.map +1 -0
- package/dist/modules/content-type/index.js +66 -0
- package/dist/modules/content-type/index.js.map +1 -0
- package/dist/modules/crypto/index.d.ts +115 -0
- package/dist/modules/crypto/index.d.ts.map +1 -0
- package/dist/modules/crypto/index.js +139 -0
- package/dist/modules/crypto/index.js.map +1 -0
- package/dist/modules/document/index.d.ts +575 -0
- package/dist/modules/document/index.d.ts.map +1 -0
- package/dist/modules/document/index.js +444 -0
- package/dist/modules/document/index.js.map +1 -0
- package/dist/modules/document-extract/index.d.ts +438 -0
- package/dist/modules/document-extract/index.d.ts.map +1 -0
- package/dist/modules/document-extract/index.js +127 -0
- package/dist/modules/document-extract/index.js.map +1 -0
- package/dist/modules/document-render/index.d.ts +336 -0
- package/dist/modules/document-render/index.d.ts.map +1 -0
- package/dist/modules/document-render/index.js +155 -0
- package/dist/modules/document-render/index.js.map +1 -0
- package/dist/modules/email/index.d.ts +311 -0
- package/dist/modules/email/index.d.ts.map +1 -0
- package/dist/modules/email/index.js +167 -0
- package/dist/modules/email/index.js.map +1 -0
- package/dist/modules/email-message/index.d.ts +95 -0
- package/dist/modules/email-message/index.d.ts.map +1 -0
- package/dist/modules/email-message/index.js +264 -0
- package/dist/modules/email-message/index.js.map +1 -0
- package/dist/modules/file-convert/index.d.ts +273 -0
- package/dist/modules/file-convert/index.d.ts.map +1 -0
- package/dist/modules/file-convert/index.js +103 -0
- package/dist/modules/file-convert/index.js.map +1 -0
- package/dist/modules/files/index.d.ts +452 -0
- package/dist/modules/files/index.d.ts.map +1 -0
- package/dist/modules/files/index.js +733 -0
- package/dist/modules/files/index.js.map +1 -0
- package/dist/modules/image/index.d.ts +342 -0
- package/dist/modules/image/index.d.ts.map +1 -0
- package/dist/modules/image/index.js +281 -0
- package/dist/modules/image/index.js.map +1 -0
- package/dist/modules/messaging/index.d.ts +608 -0
- package/dist/modules/messaging/index.d.ts.map +1 -0
- package/dist/modules/messaging/index.js +1067 -0
- package/dist/modules/messaging/index.js.map +1 -0
- package/dist/modules/pdf/index.d.ts +287 -0
- package/dist/modules/pdf/index.d.ts.map +1 -0
- package/dist/modules/pdf/index.js +259 -0
- package/dist/modules/pdf/index.js.map +1 -0
- package/dist/modules/presentation/index.d.ts +247 -0
- package/dist/modules/presentation/index.d.ts.map +1 -0
- package/dist/modules/presentation/index.js +12657 -0
- package/dist/modules/presentation/index.js.map +1 -0
- package/dist/modules/queue/index.d.ts +129 -0
- package/dist/modules/queue/index.d.ts.map +1 -0
- package/dist/modules/queue/index.js +131 -0
- package/dist/modules/queue/index.js.map +1 -0
- package/dist/modules/rag/index.d.ts +250 -0
- package/dist/modules/rag/index.d.ts.map +1 -0
- package/dist/modules/rag/index.js +366 -0
- package/dist/modules/rag/index.js.map +1 -0
- package/dist/modules/scheduler/index.d.ts +216 -0
- package/dist/modules/scheduler/index.d.ts.map +1 -0
- package/dist/modules/scheduler/index.js +153 -0
- package/dist/modules/scheduler/index.js.map +1 -0
- package/dist/modules/skills/index.d.ts +205 -0
- package/dist/modules/skills/index.d.ts.map +1 -0
- package/dist/modules/skills/index.js +203 -0
- package/dist/modules/skills/index.js.map +1 -0
- package/dist/modules/tasks/index.d.ts +287 -0
- package/dist/modules/tasks/index.d.ts.map +1 -0
- package/dist/modules/tasks/index.js +207 -0
- package/dist/modules/tasks/index.js.map +1 -0
- package/dist/modules/vector-store/index.d.ts +3 -0
- package/dist/modules/vector-store/index.js +3 -0
- package/dist/modules/web-fetch/index.d.ts +99 -0
- package/dist/modules/web-fetch/index.d.ts.map +1 -0
- package/dist/modules/web-fetch/index.js +242 -0
- package/dist/modules/web-fetch/index.js.map +1 -0
- package/dist/object-artifact-store-CMTzCm_G.d.ts +7 -0
- package/dist/object-artifact-store-CMTzCm_G.d.ts.map +1 -0
- package/dist/object-artifact-store-wZ2j9cto.js +28 -0
- package/dist/object-artifact-store-wZ2j9cto.js.map +1 -0
- package/dist/pinecone-umY4t6OF.js +190 -0
- package/dist/pinecone-umY4t6OF.js.map +1 -0
- package/dist/provider-CgDAlg6K.js +34 -0
- package/dist/provider-CgDAlg6K.js.map +1 -0
- package/dist/qdrant-DMp4NhKR.js +253 -0
- package/dist/qdrant-DMp4NhKR.js.map +1 -0
- package/dist/resend-BAC38_dA.js +155 -0
- package/dist/resend-BAC38_dA.js.map +1 -0
- package/dist/s3-CsOaPWMP.js +955 -0
- package/dist/s3-CsOaPWMP.js.map +1 -0
- package/dist/schemas-ChOAhdo9.js +192 -0
- package/dist/schemas-ChOAhdo9.js.map +1 -0
- package/dist/slack-Di5BBNpt.js +1455 -0
- package/dist/slack-Di5BBNpt.js.map +1 -0
- package/dist/sqs-DCwS1i2N.js +225 -0
- package/dist/sqs-DCwS1i2N.js.map +1 -0
- package/dist/supabase-vector-Dpp9mmJR.js +218 -0
- package/dist/supabase-vector-Dpp9mmJR.js.map +1 -0
- package/dist/tanstack/index.d.ts +15 -0
- package/dist/tanstack/index.d.ts.map +1 -0
- package/dist/tanstack/index.js +28 -0
- package/dist/tanstack/index.js.map +1 -0
- package/dist/teams-DYAHNb39.js +835 -0
- package/dist/teams-DYAHNb39.js.map +1 -0
- package/dist/telegram-DDXWzkfL.js +734 -0
- package/dist/telegram-DDXWzkfL.js.map +1 -0
- package/dist/textract-CPLiB22H.js +554 -0
- package/dist/textract-CPLiB22H.js.map +1 -0
- package/dist/transport-B4vn-XiQ.js +157 -0
- package/dist/transport-B4vn-XiQ.js.map +1 -0
- package/dist/transport-i96ACAI_.d.ts +46 -0
- package/dist/transport-i96ACAI_.d.ts.map +1 -0
- package/dist/types-Ccb0DXY9.d.ts +150 -0
- package/dist/types-Ccb0DXY9.d.ts.map +1 -0
- package/dist/unique-EwBH1JPB.js +19 -0
- package/dist/unique-EwBH1JPB.js.map +1 -0
- package/dist/vector-store-C3nEO80e.js +193 -0
- package/dist/vector-store-C3nEO80e.js.map +1 -0
- package/dist/vendors/amazon-sp-api/index.d.ts +526 -0
- package/dist/vendors/amazon-sp-api/index.d.ts.map +1 -0
- package/dist/vendors/amazon-sp-api/index.js +975 -0
- package/dist/vendors/amazon-sp-api/index.js.map +1 -0
- package/dist/vendors/bedrock-agentcore-browser/index.d.ts +2 -0
- package/dist/vendors/bedrock-agentcore-browser/index.js +2 -0
- package/dist/vendors/bedrock-agentcore-code-interpreter/index.d.ts +228 -0
- package/dist/vendors/bedrock-agentcore-code-interpreter/index.d.ts.map +1 -0
- package/dist/vendors/bedrock-agentcore-code-interpreter/index.js +2 -0
- package/dist/vendors/cloudflare-browser/index.d.ts +2 -0
- package/dist/vendors/cloudflare-browser/index.js +2 -0
- package/dist/vendors/cloudflare-email/index.d.ts +260 -0
- package/dist/vendors/cloudflare-email/index.d.ts.map +1 -0
- package/dist/vendors/cloudflare-email/index.js +3 -0
- package/dist/vendors/cloudflare-sandbox/index.d.ts +565 -0
- package/dist/vendors/cloudflare-sandbox/index.d.ts.map +1 -0
- package/dist/vendors/cloudflare-sandbox/index.js +2 -0
- package/dist/vendors/eventbridge-scheduler/index.d.ts +2 -0
- package/dist/vendors/eventbridge-scheduler/index.js +2 -0
- package/dist/vendors/gotenberg/index.d.ts +306 -0
- package/dist/vendors/gotenberg/index.d.ts.map +1 -0
- package/dist/vendors/gotenberg/index.js +2 -0
- package/dist/vendors/imessage/index.d.ts +420 -0
- package/dist/vendors/imessage/index.d.ts.map +1 -0
- package/dist/vendors/imessage/index.js +4 -0
- package/dist/vendors/katana/index.d.ts +1570 -0
- package/dist/vendors/katana/index.d.ts.map +1 -0
- package/dist/vendors/katana/index.js +1639 -0
- package/dist/vendors/katana/index.js.map +1 -0
- package/dist/vendors/mastra-vector/index.d.ts +120 -0
- package/dist/vendors/mastra-vector/index.d.ts.map +1 -0
- package/dist/vendors/mastra-vector/index.js +3 -0
- package/dist/vendors/pinecone/index.d.ts +75 -0
- package/dist/vendors/pinecone/index.d.ts.map +1 -0
- package/dist/vendors/pinecone/index.js +3 -0
- package/dist/vendors/qdrant/index.d.ts +75 -0
- package/dist/vendors/qdrant/index.d.ts.map +1 -0
- package/dist/vendors/qdrant/index.js +3 -0
- package/dist/vendors/resend/index.d.ts +3 -0
- package/dist/vendors/resend/index.js +3 -0
- package/dist/vendors/s3/index.d.ts +2 -0
- package/dist/vendors/s3/index.js +2 -0
- package/dist/vendors/slack/index.d.ts +576 -0
- package/dist/vendors/slack/index.d.ts.map +1 -0
- package/dist/vendors/slack/index.js +3 -0
- package/dist/vendors/sqs/index.d.ts +2 -0
- package/dist/vendors/sqs/index.js +2 -0
- package/dist/vendors/supabase-vector/index.d.ts +89 -0
- package/dist/vendors/supabase-vector/index.d.ts.map +1 -0
- package/dist/vendors/supabase-vector/index.js +3 -0
- package/dist/vendors/teams/index.d.ts +303 -0
- package/dist/vendors/teams/index.d.ts.map +1 -0
- package/dist/vendors/teams/index.js +3 -0
- package/dist/vendors/telegram/index.d.ts +319 -0
- package/dist/vendors/telegram/index.d.ts.map +1 -0
- package/dist/vendors/telegram/index.js +3 -0
- package/dist/vendors/textract/index.d.ts +2 -0
- package/dist/vendors/textract/index.js +2 -0
- package/dist/vendors/woocommerce/index.d.ts +1700 -0
- package/dist/vendors/woocommerce/index.d.ts.map +1 -0
- package/dist/vendors/woocommerce/index.js +1427 -0
- package/dist/vendors/woocommerce/index.js.map +1 -0
- package/dist/with-auth-CpKqTrGK.js +240 -0
- package/dist/with-auth-CpKqTrGK.js.map +1 -0
- package/logos/LUCIDE-ATTRIBUTION.txt +4 -0
- package/logos/README.md +89 -0
- package/logos/amazon.svg +6 -0
- package/logos/artifacts.svg +9 -0
- package/logos/browser.svg +9 -0
- package/logos/calendar.svg +15 -0
- package/logos/cloudflare-browser.svg +5 -0
- package/logos/cloudflare-email.svg +5 -0
- package/logos/cloudflare.svg +4 -0
- package/logos/code-sandbox.svg +8 -0
- package/logos/content-type.svg +10 -0
- package/logos/crypto.svg +7 -0
- package/logos/document-extract.svg +12 -0
- package/logos/document-render.svg +8 -0
- package/logos/document.svg +10 -0
- package/logos/email-message.svg +8 -0
- package/logos/email.svg +7 -0
- package/logos/file-convert.svg +9 -0
- package/logos/files.svg +6 -0
- package/logos/gotenberg.svg +340 -0
- package/logos/image.svg +8 -0
- package/logos/imessage.svg +7 -0
- package/logos/katana.svg +13 -0
- package/logos/mastra.svg +7 -0
- package/logos/messaging.svg +7 -0
- package/logos/pack-logos.json +48 -0
- package/logos/pdf.svg +10 -0
- package/logos/pinecone.svg +25 -0
- package/logos/presentation.svg +8 -0
- package/logos/qdrant.svg +4 -0
- package/logos/queue.svg +11 -0
- package/logos/rag.svg +18 -0
- package/logos/resend.svg +5 -0
- package/logos/scheduler.svg +7 -0
- package/logos/skills.svg +10 -0
- package/logos/slack.svg +14 -0
- package/logos/supabase.svg +4 -0
- package/logos/tasks.svg +10 -0
- package/logos/teams.svg +6 -0
- package/logos/telegram.svg +10 -0
- package/logos/textract.svg +5 -0
- package/logos/vector-store.svg +8 -0
- package/logos/web-fetch.svg +8 -0
- package/logos/woocommerce.svg +4 -0
- package/package.json +373 -0
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
import { n as defineModule, r as defineTool } from "../../define-CvpJ_pNP.js";
|
|
2
|
+
import { n as requireAuth } from "../../provider-CgDAlg6K.js";
|
|
3
|
+
import { _ as MAX_COMMAND_CHARS, g as MAX_CODE_CHARS, m as BedrockAgentCoreCodeInterpreterClient, x as bedrockAgentCoreCodeInterpreterAuthSchema, y as MAX_FILE_TEXT } from "../../bedrock-agentcore-code-interpreter-MWK-8RhA.js";
|
|
4
|
+
import { F as cloudflareSandboxAuthSchema, v as CloudflareSandboxClient } from "../../cloudflare-sandbox-Dp_uNaqW.js";
|
|
5
|
+
import { isPlainObject, isString } from "es-toolkit";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
//#region src/modules/code-sandbox/contracts.ts
|
|
8
|
+
/**
|
|
9
|
+
* Code sandbox capability seam — execute code and commands in an isolated sandbox.
|
|
10
|
+
* Providers: cloudflare-sandbox (bridge), bedrock-agentcore.
|
|
11
|
+
*/
|
|
12
|
+
const MAX_SEAM_CODE_CHARS = MAX_CODE_CHARS;
|
|
13
|
+
const MAX_SEAM_COMMAND_CHARS = MAX_COMMAND_CHARS;
|
|
14
|
+
/** Bridge host credentials; provider id matches email/browser gold (`cloudflare`). */
|
|
15
|
+
const cloudflareCodeSandboxAuthSchema = cloudflareSandboxAuthSchema.extend({ provider: z.literal("cloudflare") });
|
|
16
|
+
const agentCoreCodeSandboxAuthSchema = bedrockAgentCoreCodeInterpreterAuthSchema.extend({ provider: z.literal("bedrock-agentcore") });
|
|
17
|
+
const codeSandboxAuthSchema = z.discriminatedUnion("provider", [cloudflareCodeSandboxAuthSchema, agentCoreCodeSandboxAuthSchema]);
|
|
18
|
+
const sessionId = z.string().min(1).max(200).describe("Sandbox session id from start-session");
|
|
19
|
+
const codeSandboxStartSessionInputSchema = z.object({
|
|
20
|
+
name: z.string().min(1).max(100).optional().describe("Optional session name when the bound provider supports it"),
|
|
21
|
+
session_timeout_seconds: z.int().min(1).max(28800).optional().describe("Session TTL in seconds when the bound provider supports it")
|
|
22
|
+
});
|
|
23
|
+
const codeSandboxSessionIdInputSchema = z.object({ session_id: sessionId });
|
|
24
|
+
const codeSandboxSessionOutputSchema = z.object({
|
|
25
|
+
session_id: z.string().describe("Sandbox session id"),
|
|
26
|
+
status: z.string().optional().describe("Provider session status when available"),
|
|
27
|
+
running: z.boolean().optional().describe("Whether the sandbox is running when reported")
|
|
28
|
+
});
|
|
29
|
+
const codeSandboxExecuteCodeInputSchema = z.object({
|
|
30
|
+
session_id: sessionId,
|
|
31
|
+
code: z.string().min(1).max(MAX_SEAM_CODE_CHARS).describe("Source code to execute"),
|
|
32
|
+
language: z.string().min(1).max(40).optional().describe("Language when supported (default python)")
|
|
33
|
+
});
|
|
34
|
+
const codeSandboxExecuteCommandInputSchema = z.object({
|
|
35
|
+
session_id: sessionId,
|
|
36
|
+
command: z.string().min(1).max(MAX_SEAM_COMMAND_CHARS).describe("Shell command to run")
|
|
37
|
+
});
|
|
38
|
+
const codeSandboxExecResultSchema = z.object({
|
|
39
|
+
session_id: z.string(),
|
|
40
|
+
stdout: z.string().optional().describe("Standard output when available"),
|
|
41
|
+
stderr: z.string().optional().describe("Standard error when available"),
|
|
42
|
+
exit_code: z.number().int().optional().describe("Process exit code when available"),
|
|
43
|
+
success: z.boolean().optional().describe("True when the run completed successfully"),
|
|
44
|
+
result: z.unknown().optional().describe("Provider-specific result payload when structured")
|
|
45
|
+
});
|
|
46
|
+
const codeSandboxWriteFilesInputSchema = z.object({
|
|
47
|
+
session_id: sessionId,
|
|
48
|
+
files: z.array(z.object({
|
|
49
|
+
path: z.string().min(1).max(1024).describe("Path to write"),
|
|
50
|
+
text: z.string().max(MAX_FILE_TEXT).describe("Utf8 file contents")
|
|
51
|
+
})).min(1).max(20).describe("Files to write in the sandbox")
|
|
52
|
+
});
|
|
53
|
+
const codeSandboxWriteFilesOutputSchema = z.object({
|
|
54
|
+
session_id: z.string(),
|
|
55
|
+
paths: z.array(z.string()),
|
|
56
|
+
ok: z.literal(true)
|
|
57
|
+
});
|
|
58
|
+
const codeSandboxReadFilesInputSchema = z.object({
|
|
59
|
+
session_id: sessionId,
|
|
60
|
+
paths: z.array(z.string().min(1).max(1024)).min(1).max(50).describe("Paths to read")
|
|
61
|
+
});
|
|
62
|
+
const codeSandboxReadFilesOutputSchema = z.object({
|
|
63
|
+
session_id: z.string(),
|
|
64
|
+
files: z.array(z.object({
|
|
65
|
+
path: z.string(),
|
|
66
|
+
text: z.string()
|
|
67
|
+
}))
|
|
68
|
+
});
|
|
69
|
+
const codeSandboxListFilesInputSchema = z.object({
|
|
70
|
+
session_id: sessionId,
|
|
71
|
+
directory_path: z.string().max(1024).optional().describe("Directory to list (default sandbox root)")
|
|
72
|
+
});
|
|
73
|
+
const codeSandboxListFilesOutputSchema = z.object({
|
|
74
|
+
session_id: z.string(),
|
|
75
|
+
paths: z.array(z.string()).describe("Relative paths found"),
|
|
76
|
+
raw: z.unknown().optional().describe("Provider listing payload when available")
|
|
77
|
+
});
|
|
78
|
+
const codeSandboxRemoveFilesInputSchema = z.object({
|
|
79
|
+
session_id: sessionId,
|
|
80
|
+
paths: z.array(z.string().min(1).max(1024)).min(1).max(50).describe("Paths to remove")
|
|
81
|
+
});
|
|
82
|
+
const codeSandboxRemoveFilesOutputSchema = z.object({
|
|
83
|
+
session_id: z.string(),
|
|
84
|
+
paths: z.array(z.string()),
|
|
85
|
+
ok: z.literal(true)
|
|
86
|
+
});
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/modules/code-sandbox/providers/bedrock-agentcore.ts
|
|
89
|
+
var AgentCoreCodeSandboxProvider = class {
|
|
90
|
+
#client;
|
|
91
|
+
constructor(auth, options = {}) {
|
|
92
|
+
const { provider: _provider, ...vendorAuth } = auth;
|
|
93
|
+
this.#client = new BedrockAgentCoreCodeInterpreterClient(vendorAuth, options);
|
|
94
|
+
}
|
|
95
|
+
async startSession(input = {}) {
|
|
96
|
+
const out = await this.#client.startSession({
|
|
97
|
+
...input.name && { name: input.name },
|
|
98
|
+
...input.session_timeout_seconds !== void 0 && { session_timeout_seconds: input.session_timeout_seconds }
|
|
99
|
+
});
|
|
100
|
+
return {
|
|
101
|
+
session_id: out.session_id,
|
|
102
|
+
...out.status && { status: out.status },
|
|
103
|
+
running: true
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
async getSession(input) {
|
|
107
|
+
const out = await this.#client.getSession({ session_id: input.session_id });
|
|
108
|
+
return {
|
|
109
|
+
session_id: out.session_id,
|
|
110
|
+
...out.status && { status: out.status },
|
|
111
|
+
running: out.status ? out.status.toUpperCase() !== "TERMINATED" : true
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
async stopSession(input) {
|
|
115
|
+
const out = await this.#client.stopSession({ session_id: input.session_id });
|
|
116
|
+
return {
|
|
117
|
+
session_id: out.session_id,
|
|
118
|
+
...out.status && { status: out.status },
|
|
119
|
+
running: false
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
async executeCode(input) {
|
|
123
|
+
const out = await this.#client.executeCode({
|
|
124
|
+
session_id: input.session_id,
|
|
125
|
+
code: input.code,
|
|
126
|
+
...input.language && { language: input.language }
|
|
127
|
+
});
|
|
128
|
+
return mapInvoke(input.session_id, out.result, out.raw);
|
|
129
|
+
}
|
|
130
|
+
async executeCommand(input) {
|
|
131
|
+
const out = await this.#client.executeCommand({
|
|
132
|
+
session_id: input.session_id,
|
|
133
|
+
command: input.command
|
|
134
|
+
});
|
|
135
|
+
return mapInvoke(input.session_id, out.result, out.raw);
|
|
136
|
+
}
|
|
137
|
+
async writeFiles(input) {
|
|
138
|
+
await this.#client.writeFiles({
|
|
139
|
+
session_id: input.session_id,
|
|
140
|
+
files: input.files
|
|
141
|
+
});
|
|
142
|
+
return {
|
|
143
|
+
session_id: input.session_id,
|
|
144
|
+
paths: input.files.map((f) => f.path),
|
|
145
|
+
ok: true
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
async readFiles(input) {
|
|
149
|
+
const out = await this.#client.readFiles({
|
|
150
|
+
session_id: input.session_id,
|
|
151
|
+
paths: input.paths
|
|
152
|
+
});
|
|
153
|
+
const files = extractFiles(out.result ?? out.raw, input.paths);
|
|
154
|
+
return {
|
|
155
|
+
session_id: input.session_id,
|
|
156
|
+
files
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
async listFiles(input) {
|
|
160
|
+
const out = await this.#client.listFiles({
|
|
161
|
+
session_id: input.session_id,
|
|
162
|
+
...input.directory_path !== void 0 && { directory_path: input.directory_path }
|
|
163
|
+
});
|
|
164
|
+
const paths = extractPaths(out.result ?? out.raw);
|
|
165
|
+
return {
|
|
166
|
+
session_id: input.session_id,
|
|
167
|
+
paths,
|
|
168
|
+
raw: out.result ?? out.raw
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
async removeFiles(input) {
|
|
172
|
+
await this.#client.removeFiles({
|
|
173
|
+
session_id: input.session_id,
|
|
174
|
+
paths: input.paths
|
|
175
|
+
});
|
|
176
|
+
return {
|
|
177
|
+
session_id: input.session_id,
|
|
178
|
+
paths: input.paths,
|
|
179
|
+
ok: true
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
function mapInvoke(session_id, result, raw) {
|
|
184
|
+
const out = {
|
|
185
|
+
session_id,
|
|
186
|
+
result: result ?? raw,
|
|
187
|
+
success: true
|
|
188
|
+
};
|
|
189
|
+
if (isPlainObject(result)) {
|
|
190
|
+
if (isString(result["stdout"])) out.stdout = result["stdout"];
|
|
191
|
+
if (isString(result["stderr"])) out.stderr = result["stderr"];
|
|
192
|
+
if (typeof result["exitCode"] === "number") out.exit_code = result["exitCode"];
|
|
193
|
+
if (typeof result["exit_code"] === "number") out.exit_code = result["exit_code"];
|
|
194
|
+
if (typeof result["success"] === "boolean") out.success = result["success"];
|
|
195
|
+
}
|
|
196
|
+
return out;
|
|
197
|
+
}
|
|
198
|
+
function extractFiles(payload, fallbackPaths) {
|
|
199
|
+
if (isPlainObject(payload)) {
|
|
200
|
+
const content = payload["content"] ?? payload["files"];
|
|
201
|
+
if (Array.isArray(content)) {
|
|
202
|
+
const files = [];
|
|
203
|
+
for (const row of content) {
|
|
204
|
+
if (!isPlainObject(row)) continue;
|
|
205
|
+
const path = row["path"];
|
|
206
|
+
const text = row["text"] ?? row["content"] ?? "";
|
|
207
|
+
if (isString(path) && isString(text)) files.push({
|
|
208
|
+
path,
|
|
209
|
+
text
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
if (files.length > 0) return files;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (isString(payload) && fallbackPaths[0]) return [{
|
|
216
|
+
path: fallbackPaths[0],
|
|
217
|
+
text: payload
|
|
218
|
+
}];
|
|
219
|
+
return fallbackPaths.map((path) => ({
|
|
220
|
+
path,
|
|
221
|
+
text: ""
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
224
|
+
function extractPaths(payload) {
|
|
225
|
+
if (!isPlainObject(payload)) return [];
|
|
226
|
+
const list = payload["files"] ?? payload["paths"] ?? payload["entries"];
|
|
227
|
+
if (!Array.isArray(list)) return [];
|
|
228
|
+
const paths = [];
|
|
229
|
+
for (const row of list) {
|
|
230
|
+
if (isString(row)) {
|
|
231
|
+
paths.push(row);
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
if (isPlainObject(row)) {
|
|
235
|
+
const path = row["path"] ?? row["name"];
|
|
236
|
+
if (isString(path)) paths.push(path);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return paths;
|
|
240
|
+
}
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region src/modules/code-sandbox/providers/cloudflare-sandbox.ts
|
|
243
|
+
var CloudflareCodeSandboxProvider = class {
|
|
244
|
+
#client;
|
|
245
|
+
constructor(auth, options = {}) {
|
|
246
|
+
const { provider: _provider, ...vendorAuth } = auth;
|
|
247
|
+
this.#client = new CloudflareSandboxClient(vendorAuth, options);
|
|
248
|
+
}
|
|
249
|
+
async startSession(_input = {}) {
|
|
250
|
+
return {
|
|
251
|
+
session_id: (await this.#client.create()).sandbox_id,
|
|
252
|
+
status: "running",
|
|
253
|
+
running: true
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
async getSession(input) {
|
|
257
|
+
const row = await this.#client.running({ sandbox_id: input.session_id });
|
|
258
|
+
return {
|
|
259
|
+
session_id: input.session_id,
|
|
260
|
+
running: row.running,
|
|
261
|
+
status: row.running ? "running" : "stopped"
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
async stopSession(input) {
|
|
265
|
+
await this.#client.destroy({ sandbox_id: input.session_id });
|
|
266
|
+
return {
|
|
267
|
+
session_id: input.session_id,
|
|
268
|
+
status: "stopped",
|
|
269
|
+
running: false
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
async executeCode(input) {
|
|
273
|
+
const language = normalizeLanguage(input.language);
|
|
274
|
+
const out = await this.#client.executeCode({
|
|
275
|
+
sandbox_id: input.session_id,
|
|
276
|
+
code: input.code,
|
|
277
|
+
language
|
|
278
|
+
});
|
|
279
|
+
return mapExec(input.session_id, out);
|
|
280
|
+
}
|
|
281
|
+
async executeCommand(input) {
|
|
282
|
+
const out = await this.#client.exec({
|
|
283
|
+
sandbox_id: input.session_id,
|
|
284
|
+
argv: [
|
|
285
|
+
"sh",
|
|
286
|
+
"-lc",
|
|
287
|
+
input.command
|
|
288
|
+
]
|
|
289
|
+
});
|
|
290
|
+
return mapExec(input.session_id, out);
|
|
291
|
+
}
|
|
292
|
+
async writeFiles(input) {
|
|
293
|
+
const out = await this.#client.writeFiles({
|
|
294
|
+
sandbox_id: input.session_id,
|
|
295
|
+
files: input.files
|
|
296
|
+
});
|
|
297
|
+
return {
|
|
298
|
+
session_id: input.session_id,
|
|
299
|
+
paths: out.paths,
|
|
300
|
+
ok: true
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
async readFiles(input) {
|
|
304
|
+
const out = await this.#client.readFiles({
|
|
305
|
+
sandbox_id: input.session_id,
|
|
306
|
+
paths: input.paths
|
|
307
|
+
});
|
|
308
|
+
return {
|
|
309
|
+
session_id: input.session_id,
|
|
310
|
+
files: out.files.map((file) => ({
|
|
311
|
+
path: file.path,
|
|
312
|
+
text: file.text ?? ""
|
|
313
|
+
}))
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
async listFiles(input) {
|
|
317
|
+
const out = await this.#client.listFiles({
|
|
318
|
+
sandbox_id: input.session_id,
|
|
319
|
+
...input.directory_path !== void 0 && { directory_path: input.directory_path }
|
|
320
|
+
});
|
|
321
|
+
return {
|
|
322
|
+
session_id: input.session_id,
|
|
323
|
+
paths: out.paths,
|
|
324
|
+
...out.raw !== void 0 && { raw: out.raw }
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
async removeFiles(input) {
|
|
328
|
+
const out = await this.#client.removeFiles({
|
|
329
|
+
sandbox_id: input.session_id,
|
|
330
|
+
paths: input.paths
|
|
331
|
+
});
|
|
332
|
+
return {
|
|
333
|
+
session_id: input.session_id,
|
|
334
|
+
paths: out.paths,
|
|
335
|
+
ok: true
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
function mapExec(session_id, out) {
|
|
340
|
+
const result = {
|
|
341
|
+
session_id,
|
|
342
|
+
stdout: out.stdout,
|
|
343
|
+
stderr: out.stderr,
|
|
344
|
+
success: out.success
|
|
345
|
+
};
|
|
346
|
+
if (out.exit_code !== void 0) result.exit_code = out.exit_code;
|
|
347
|
+
return result;
|
|
348
|
+
}
|
|
349
|
+
function normalizeLanguage(language) {
|
|
350
|
+
const raw = (language ?? "python").toLowerCase();
|
|
351
|
+
if (raw === "js" || raw === "javascript" || raw === "node") return "javascript";
|
|
352
|
+
if (raw === "ts" || raw === "typescript") return "typescript";
|
|
353
|
+
if (raw === "sh" || raw === "bash" || raw === "shell") return "shell";
|
|
354
|
+
return "python";
|
|
355
|
+
}
|
|
356
|
+
//#endregion
|
|
357
|
+
//#region src/modules/code-sandbox/client.ts
|
|
358
|
+
function providerFor(auth, ctx) {
|
|
359
|
+
switch (auth.provider) {
|
|
360
|
+
case "cloudflare": return new CloudflareCodeSandboxProvider(auth, {
|
|
361
|
+
...ctx.fetch && { fetch: ctx.fetch },
|
|
362
|
+
...ctx.signal && { signal: ctx.signal }
|
|
363
|
+
});
|
|
364
|
+
case "bedrock-agentcore": return new AgentCoreCodeSandboxProvider(auth, {
|
|
365
|
+
...ctx.fetch && { fetch: ctx.fetch },
|
|
366
|
+
...ctx.signal && { signal: ctx.signal }
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
var CodeSandboxClient = class CodeSandboxClient {
|
|
371
|
+
#ops;
|
|
372
|
+
constructor(ops) {
|
|
373
|
+
this.#ops = ops;
|
|
374
|
+
}
|
|
375
|
+
static fromContext(ctx) {
|
|
376
|
+
return new CodeSandboxClient(providerFor(requireAuth(ctx, codeSandboxAuthSchema), ctx));
|
|
377
|
+
}
|
|
378
|
+
static fromAuth(auth, ctx = {}) {
|
|
379
|
+
return new CodeSandboxClient(providerFor(auth, ctx));
|
|
380
|
+
}
|
|
381
|
+
startSession(input = {}) {
|
|
382
|
+
return this.#ops.startSession(input);
|
|
383
|
+
}
|
|
384
|
+
getSession(input) {
|
|
385
|
+
return this.#ops.getSession(input);
|
|
386
|
+
}
|
|
387
|
+
stopSession(input) {
|
|
388
|
+
return this.#ops.stopSession(input);
|
|
389
|
+
}
|
|
390
|
+
executeCode(input) {
|
|
391
|
+
return this.#ops.executeCode(input);
|
|
392
|
+
}
|
|
393
|
+
executeCommand(input) {
|
|
394
|
+
return this.#ops.executeCommand(input);
|
|
395
|
+
}
|
|
396
|
+
writeFiles(input) {
|
|
397
|
+
return this.#ops.writeFiles(input);
|
|
398
|
+
}
|
|
399
|
+
readFiles(input) {
|
|
400
|
+
return this.#ops.readFiles(input);
|
|
401
|
+
}
|
|
402
|
+
listFiles(input) {
|
|
403
|
+
return this.#ops.listFiles(input);
|
|
404
|
+
}
|
|
405
|
+
removeFiles(input) {
|
|
406
|
+
return this.#ops.removeFiles(input);
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
//#endregion
|
|
410
|
+
//#region src/modules/code-sandbox/module.ts
|
|
411
|
+
const codeSandboxStartSessionTool = defineTool({
|
|
412
|
+
id: "code-sandbox-start-session",
|
|
413
|
+
name: "startCodeSandboxSession",
|
|
414
|
+
description: "Start an isolated sandbox session and return session_id. Use only when the task requires arbitrary code, shell commands, or temporary files that no purpose-built tool covers. Do not start a sandbox to build or edit supported documents, spreadsheets, presentations, PDFs, or images.",
|
|
415
|
+
inputSchema: codeSandboxStartSessionInputSchema,
|
|
416
|
+
outputSchema: codeSandboxSessionOutputSchema,
|
|
417
|
+
sideEffect: "write",
|
|
418
|
+
runtime: "both",
|
|
419
|
+
network: true,
|
|
420
|
+
execute: async (input, ctx) => CodeSandboxClient.fromContext(ctx).startSession(input)
|
|
421
|
+
});
|
|
422
|
+
const codeSandboxGetSessionTool = defineTool({
|
|
423
|
+
id: "code-sandbox-get-session",
|
|
424
|
+
name: "getCodeSandboxSession",
|
|
425
|
+
description: "Get status for a sandbox session created by code-sandbox-start-session. Use when execution may still be running or session availability must be checked; this does not execute work.",
|
|
426
|
+
inputSchema: codeSandboxSessionIdInputSchema,
|
|
427
|
+
outputSchema: codeSandboxSessionOutputSchema,
|
|
428
|
+
sideEffect: "read",
|
|
429
|
+
runtime: "both",
|
|
430
|
+
network: true,
|
|
431
|
+
execute: async (input, ctx) => CodeSandboxClient.fromContext(ctx).getSession(input)
|
|
432
|
+
});
|
|
433
|
+
const codeSandboxStopSessionTool = defineTool({
|
|
434
|
+
id: "code-sandbox-stop-session",
|
|
435
|
+
name: "stopCodeSandboxSession",
|
|
436
|
+
description: "Stop a sandbox session created by code-sandbox-start-session and release its temporary resources. Call after sandbox work is complete when the session is no longer needed.",
|
|
437
|
+
inputSchema: codeSandboxSessionIdInputSchema,
|
|
438
|
+
outputSchema: codeSandboxSessionOutputSchema,
|
|
439
|
+
sideEffect: "write",
|
|
440
|
+
runtime: "both",
|
|
441
|
+
network: true,
|
|
442
|
+
execute: async (input, ctx) => CodeSandboxClient.fromContext(ctx).stopSession(input)
|
|
443
|
+
});
|
|
444
|
+
const codeSandboxExecuteCodeTool = defineTool({
|
|
445
|
+
id: "code-sandbox-execute-code",
|
|
446
|
+
name: "executeCodeInSandbox",
|
|
447
|
+
description: "Execute source code in an active sandbox session. Use as a fallback for computation or automation that no purpose-built tool covers. Do not use to build or edit supported documents, spreadsheets, presentations, PDFs, or images.",
|
|
448
|
+
inputSchema: codeSandboxExecuteCodeInputSchema,
|
|
449
|
+
outputSchema: codeSandboxExecResultSchema,
|
|
450
|
+
sideEffect: "write",
|
|
451
|
+
runtime: "both",
|
|
452
|
+
network: true,
|
|
453
|
+
execute: async (input, ctx) => CodeSandboxClient.fromContext(ctx).executeCode(input)
|
|
454
|
+
});
|
|
455
|
+
const codeSandboxExecuteCommandTool = defineTool({
|
|
456
|
+
id: "code-sandbox-execute-command",
|
|
457
|
+
name: "executeCommandInSandbox",
|
|
458
|
+
description: "Run a shell command in an active sandbox session. Use as a fallback for command-line work that no purpose-built tool covers. Do not use command-line libraries to replace dedicated document, spreadsheet, presentation, PDF, or image tools.",
|
|
459
|
+
inputSchema: codeSandboxExecuteCommandInputSchema,
|
|
460
|
+
outputSchema: codeSandboxExecResultSchema,
|
|
461
|
+
sideEffect: "write",
|
|
462
|
+
runtime: "both",
|
|
463
|
+
network: true,
|
|
464
|
+
execute: async (input, ctx) => CodeSandboxClient.fromContext(ctx).executeCommand(input)
|
|
465
|
+
});
|
|
466
|
+
const codeSandboxWriteFilesTool = defineTool({
|
|
467
|
+
id: "code-sandbox-write-files",
|
|
468
|
+
name: "writeSandboxFiles",
|
|
469
|
+
description: "Write one or more UTF-8 files into an active sandbox session for intermediate computation. Sandbox files are temporary and this tool does not return ArtifactRefs. Use a purpose-built builder for final deliverables.",
|
|
470
|
+
inputSchema: codeSandboxWriteFilesInputSchema,
|
|
471
|
+
outputSchema: codeSandboxWriteFilesOutputSchema,
|
|
472
|
+
sideEffect: "write",
|
|
473
|
+
runtime: "both",
|
|
474
|
+
network: true,
|
|
475
|
+
execute: async (input, ctx) => CodeSandboxClient.fromContext(ctx).writeFiles(input)
|
|
476
|
+
});
|
|
477
|
+
const codeSandboxReadFilesTool = defineTool({
|
|
478
|
+
id: "code-sandbox-read-files",
|
|
479
|
+
name: "readSandboxFiles",
|
|
480
|
+
description: "Read one or more UTF-8 files from an active sandbox session. Use only for files produced or imported during the same sandbox workflow; use a format-aware reader for supported user artifacts.",
|
|
481
|
+
inputSchema: codeSandboxReadFilesInputSchema,
|
|
482
|
+
outputSchema: codeSandboxReadFilesOutputSchema,
|
|
483
|
+
sideEffect: "read",
|
|
484
|
+
runtime: "both",
|
|
485
|
+
network: true,
|
|
486
|
+
execute: async (input, ctx) => CodeSandboxClient.fromContext(ctx).readFiles(input)
|
|
487
|
+
});
|
|
488
|
+
const codeSandboxListFilesTool = defineTool({
|
|
489
|
+
id: "code-sandbox-list-files",
|
|
490
|
+
name: "listSandboxFiles",
|
|
491
|
+
description: "List temporary files in an active sandbox directory when supported. Use to locate sandbox intermediates, not to discover files in the durable workspace or artifact store.",
|
|
492
|
+
inputSchema: codeSandboxListFilesInputSchema,
|
|
493
|
+
outputSchema: codeSandboxListFilesOutputSchema,
|
|
494
|
+
sideEffect: "read",
|
|
495
|
+
runtime: "both",
|
|
496
|
+
network: true,
|
|
497
|
+
execute: async (input, ctx) => CodeSandboxClient.fromContext(ctx).listFiles(input)
|
|
498
|
+
});
|
|
499
|
+
const codeSandboxRemoveFilesTool = defineTool({
|
|
500
|
+
id: "code-sandbox-remove-files",
|
|
501
|
+
name: "removeSandboxFiles",
|
|
502
|
+
description: "Remove temporary files from an active sandbox session. Use only for sandbox cleanup; this does not delete durable workspace files or ArtifactRefs.",
|
|
503
|
+
inputSchema: codeSandboxRemoveFilesInputSchema,
|
|
504
|
+
outputSchema: codeSandboxRemoveFilesOutputSchema,
|
|
505
|
+
sideEffect: "write",
|
|
506
|
+
runtime: "both",
|
|
507
|
+
network: true,
|
|
508
|
+
execute: async (input, ctx) => CodeSandboxClient.fromContext(ctx).removeFiles(input)
|
|
509
|
+
});
|
|
510
|
+
const codeSandboxModule = defineModule({
|
|
511
|
+
id: "code-sandbox",
|
|
512
|
+
title: "Code Sandbox",
|
|
513
|
+
description: "General-purpose fallback for arbitrary code, commands, and temporary files when no dedicated tool covers the task. Do not use it instead of purpose-built document, spreadsheet, presentation, PDF, image, or render tools.",
|
|
514
|
+
runtime: "both",
|
|
515
|
+
auth: {
|
|
516
|
+
type: "custom",
|
|
517
|
+
schema: codeSandboxAuthSchema
|
|
518
|
+
},
|
|
519
|
+
categories: ["compute", "sandbox"],
|
|
520
|
+
classification: "standard",
|
|
521
|
+
tags: ["exec", "workspace"],
|
|
522
|
+
tools: [
|
|
523
|
+
codeSandboxStartSessionTool,
|
|
524
|
+
codeSandboxGetSessionTool,
|
|
525
|
+
codeSandboxStopSessionTool,
|
|
526
|
+
codeSandboxExecuteCodeTool,
|
|
527
|
+
codeSandboxExecuteCommandTool,
|
|
528
|
+
codeSandboxWriteFilesTool,
|
|
529
|
+
codeSandboxReadFilesTool,
|
|
530
|
+
codeSandboxListFilesTool,
|
|
531
|
+
codeSandboxRemoveFilesTool
|
|
532
|
+
]
|
|
533
|
+
});
|
|
534
|
+
//#endregion
|
|
535
|
+
export { CodeSandboxClient, MAX_SEAM_CODE_CHARS, MAX_SEAM_COMMAND_CHARS, agentCoreCodeSandboxAuthSchema, cloudflareCodeSandboxAuthSchema, codeSandboxAuthSchema, codeSandboxExecResultSchema, codeSandboxExecuteCodeInputSchema, codeSandboxExecuteCodeTool, codeSandboxExecuteCommandInputSchema, codeSandboxExecuteCommandTool, codeSandboxGetSessionTool, codeSandboxListFilesInputSchema, codeSandboxListFilesOutputSchema, codeSandboxListFilesTool, codeSandboxModule, codeSandboxReadFilesInputSchema, codeSandboxReadFilesOutputSchema, codeSandboxReadFilesTool, codeSandboxRemoveFilesInputSchema, codeSandboxRemoveFilesOutputSchema, codeSandboxRemoveFilesTool, codeSandboxSessionIdInputSchema, codeSandboxSessionOutputSchema, codeSandboxStartSessionInputSchema, codeSandboxStartSessionTool, codeSandboxStopSessionTool, codeSandboxWriteFilesInputSchema, codeSandboxWriteFilesOutputSchema, codeSandboxWriteFilesTool };
|
|
536
|
+
|
|
537
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["#client","#client","#ops"],"sources":["../../../src/modules/code-sandbox/contracts.ts","../../../src/modules/code-sandbox/providers/bedrock-agentcore.ts","../../../src/modules/code-sandbox/providers/cloudflare-sandbox.ts","../../../src/modules/code-sandbox/client.ts","../../../src/modules/code-sandbox/module.ts"],"sourcesContent":["/**\n * Code sandbox capability seam — execute code and commands in an isolated sandbox.\n * Providers: cloudflare-sandbox (bridge), bedrock-agentcore.\n */\n\nimport { z } from 'zod'\n\nimport {\n\tbedrockAgentCoreCodeInterpreterAuthSchema,\n\tMAX_CODE_CHARS,\n\tMAX_COMMAND_CHARS,\n\tMAX_FILE_PATHS,\n\tMAX_FILE_TEXT,\n\tMAX_WRITE_FILES\n} from '../../vendors/bedrock-agentcore-code-interpreter'\nimport { cloudflareSandboxAuthSchema } from '../../vendors/cloudflare-sandbox'\n\nexport const MAX_SEAM_CODE_CHARS = MAX_CODE_CHARS\nexport const MAX_SEAM_COMMAND_CHARS = MAX_COMMAND_CHARS\n\n/** Bridge host credentials; provider id matches email/browser gold (`cloudflare`). */\nexport const cloudflareCodeSandboxAuthSchema = cloudflareSandboxAuthSchema.extend({\n\tprovider: z.literal('cloudflare')\n})\n\nexport const agentCoreCodeSandboxAuthSchema = bedrockAgentCoreCodeInterpreterAuthSchema.extend({\n\tprovider: z.literal('bedrock-agentcore')\n})\n\nexport const codeSandboxAuthSchema = z.discriminatedUnion('provider', [\n\tcloudflareCodeSandboxAuthSchema,\n\tagentCoreCodeSandboxAuthSchema\n])\n\nexport type CloudflareCodeSandboxAuth = z.infer<typeof cloudflareCodeSandboxAuthSchema>\nexport type AgentCoreCodeSandboxAuth = z.infer<typeof agentCoreCodeSandboxAuthSchema>\nexport type CodeSandboxAuth = z.infer<typeof codeSandboxAuthSchema>\n\nconst sessionId = z.string().min(1).max(200).describe('Sandbox session id from start-session')\n\nexport const codeSandboxStartSessionInputSchema = z.object({\n\tname: z.string().min(1).max(100).optional().describe('Optional session name when the bound provider supports it'),\n\tsession_timeout_seconds: z\n\t\t.int()\n\t\t.min(1)\n\t\t.max(28_800)\n\t\t.optional()\n\t\t.describe('Session TTL in seconds when the bound provider supports it')\n})\n\nexport const codeSandboxSessionIdInputSchema = z.object({\n\tsession_id: sessionId\n})\n\nexport const codeSandboxSessionOutputSchema = z.object({\n\tsession_id: z.string().describe('Sandbox session id'),\n\tstatus: z.string().optional().describe('Provider session status when available'),\n\trunning: z.boolean().optional().describe('Whether the sandbox is running when reported')\n})\n\nexport const codeSandboxExecuteCodeInputSchema = z.object({\n\tsession_id: sessionId,\n\tcode: z.string().min(1).max(MAX_SEAM_CODE_CHARS).describe('Source code to execute'),\n\tlanguage: z.string().min(1).max(40).optional().describe('Language when supported (default python)')\n})\n\nexport const codeSandboxExecuteCommandInputSchema = z.object({\n\tsession_id: sessionId,\n\tcommand: z.string().min(1).max(MAX_SEAM_COMMAND_CHARS).describe('Shell command to run')\n})\n\nexport const codeSandboxExecResultSchema = z.object({\n\tsession_id: z.string(),\n\tstdout: z.string().optional().describe('Standard output when available'),\n\tstderr: z.string().optional().describe('Standard error when available'),\n\texit_code: z.number().int().optional().describe('Process exit code when available'),\n\tsuccess: z.boolean().optional().describe('True when the run completed successfully'),\n\tresult: z.unknown().optional().describe('Provider-specific result payload when structured')\n})\n\nexport const codeSandboxWriteFilesInputSchema = z.object({\n\tsession_id: sessionId,\n\tfiles: z\n\t\t.array(\n\t\t\tz.object({\n\t\t\t\tpath: z.string().min(1).max(1024).describe('Path to write'),\n\t\t\t\ttext: z.string().max(MAX_FILE_TEXT).describe('Utf8 file contents')\n\t\t\t})\n\t\t)\n\t\t.min(1)\n\t\t.max(MAX_WRITE_FILES)\n\t\t.describe('Files to write in the sandbox')\n})\n\nexport const codeSandboxWriteFilesOutputSchema = z.object({\n\tsession_id: z.string(),\n\tpaths: z.array(z.string()),\n\tok: z.literal(true)\n})\n\nexport const codeSandboxReadFilesInputSchema = z.object({\n\tsession_id: sessionId,\n\tpaths: z.array(z.string().min(1).max(1024)).min(1).max(MAX_FILE_PATHS).describe('Paths to read')\n})\n\nexport const codeSandboxReadFilesOutputSchema = z.object({\n\tsession_id: z.string(),\n\tfiles: z.array(\n\t\tz.object({\n\t\t\tpath: z.string(),\n\t\t\ttext: z.string()\n\t\t})\n\t)\n})\n\nexport const codeSandboxListFilesInputSchema = z.object({\n\tsession_id: sessionId,\n\tdirectory_path: z.string().max(1024).optional().describe('Directory to list (default sandbox root)')\n})\n\nexport const codeSandboxListFilesOutputSchema = z.object({\n\tsession_id: z.string(),\n\tpaths: z.array(z.string()).describe('Relative paths found'),\n\traw: z.unknown().optional().describe('Provider listing payload when available')\n})\n\nexport const codeSandboxRemoveFilesInputSchema = z.object({\n\tsession_id: sessionId,\n\tpaths: z.array(z.string().min(1).max(1024)).min(1).max(MAX_FILE_PATHS).describe('Paths to remove')\n})\n\nexport const codeSandboxRemoveFilesOutputSchema = z.object({\n\tsession_id: z.string(),\n\tpaths: z.array(z.string()),\n\tok: z.literal(true)\n})\n\nexport type CodeSandboxStartSessionInput = z.infer<typeof codeSandboxStartSessionInputSchema>\nexport type CodeSandboxSessionIdInput = z.infer<typeof codeSandboxSessionIdInputSchema>\nexport type CodeSandboxSessionOutput = z.infer<typeof codeSandboxSessionOutputSchema>\nexport type CodeSandboxExecuteCodeInput = z.infer<typeof codeSandboxExecuteCodeInputSchema>\nexport type CodeSandboxExecuteCommandInput = z.infer<typeof codeSandboxExecuteCommandInputSchema>\nexport type CodeSandboxExecResult = z.infer<typeof codeSandboxExecResultSchema>\nexport type CodeSandboxWriteFilesInput = z.infer<typeof codeSandboxWriteFilesInputSchema>\nexport type CodeSandboxWriteFilesOutput = z.infer<typeof codeSandboxWriteFilesOutputSchema>\nexport type CodeSandboxReadFilesInput = z.infer<typeof codeSandboxReadFilesInputSchema>\nexport type CodeSandboxReadFilesOutput = z.infer<typeof codeSandboxReadFilesOutputSchema>\nexport type CodeSandboxListFilesInput = z.infer<typeof codeSandboxListFilesInputSchema>\nexport type CodeSandboxListFilesOutput = z.infer<typeof codeSandboxListFilesOutputSchema>\nexport type CodeSandboxRemoveFilesInput = z.infer<typeof codeSandboxRemoveFilesInputSchema>\nexport type CodeSandboxRemoveFilesOutput = z.infer<typeof codeSandboxRemoveFilesOutputSchema>\n\nexport type CodeSandboxOps = {\n\tstartSession(input?: CodeSandboxStartSessionInput): Promise<CodeSandboxSessionOutput>\n\tgetSession(input: CodeSandboxSessionIdInput): Promise<CodeSandboxSessionOutput>\n\tstopSession(input: CodeSandboxSessionIdInput): Promise<CodeSandboxSessionOutput>\n\texecuteCode(input: CodeSandboxExecuteCodeInput): Promise<CodeSandboxExecResult>\n\texecuteCommand(input: CodeSandboxExecuteCommandInput): Promise<CodeSandboxExecResult>\n\twriteFiles(input: CodeSandboxWriteFilesInput): Promise<CodeSandboxWriteFilesOutput>\n\treadFiles(input: CodeSandboxReadFilesInput): Promise<CodeSandboxReadFilesOutput>\n\tlistFiles(input: CodeSandboxListFilesInput): Promise<CodeSandboxListFilesOutput>\n\tremoveFiles(input: CodeSandboxRemoveFilesInput): Promise<CodeSandboxRemoveFilesOutput>\n}\n","import { isPlainObject, isString } from 'es-toolkit'\n\nimport type { HttpServiceOptions } from '../../../transport/http-service'\nimport { BedrockAgentCoreCodeInterpreterClient } from '../../../vendors/bedrock-agentcore-code-interpreter'\nimport type {\n\tAgentCoreCodeSandboxAuth,\n\tCodeSandboxExecResult,\n\tCodeSandboxExecuteCodeInput,\n\tCodeSandboxExecuteCommandInput,\n\tCodeSandboxListFilesInput,\n\tCodeSandboxListFilesOutput,\n\tCodeSandboxOps,\n\tCodeSandboxReadFilesInput,\n\tCodeSandboxReadFilesOutput,\n\tCodeSandboxRemoveFilesInput,\n\tCodeSandboxSessionIdInput,\n\tCodeSandboxSessionOutput,\n\tCodeSandboxStartSessionInput,\n\tCodeSandboxWriteFilesInput\n} from '../contracts'\n\nexport type AgentCoreCodeSandboxProviderOptions = Pick<HttpServiceOptions, 'fetch' | 'signal'>\n\nexport class AgentCoreCodeSandboxProvider implements CodeSandboxOps {\n\treadonly #client: BedrockAgentCoreCodeInterpreterClient\n\n\tconstructor(auth: AgentCoreCodeSandboxAuth, options: AgentCoreCodeSandboxProviderOptions = {}) {\n\t\tconst { provider: _provider, ...vendorAuth } = auth\n\t\tthis.#client = new BedrockAgentCoreCodeInterpreterClient(vendorAuth, options)\n\t}\n\n\tasync startSession(input: CodeSandboxStartSessionInput = {}): Promise<CodeSandboxSessionOutput> {\n\t\tconst out = await this.#client.startSession({\n\t\t\t...(input.name && { name: input.name }),\n\t\t\t...(input.session_timeout_seconds !== undefined && {\n\t\t\t\tsession_timeout_seconds: input.session_timeout_seconds\n\t\t\t})\n\t\t})\n\t\treturn {\n\t\t\tsession_id: out.session_id,\n\t\t\t...(out.status && { status: out.status }),\n\t\t\trunning: true\n\t\t}\n\t}\n\n\tasync getSession(input: CodeSandboxSessionIdInput): Promise<CodeSandboxSessionOutput> {\n\t\tconst out = await this.#client.getSession({ session_id: input.session_id })\n\t\treturn {\n\t\t\tsession_id: out.session_id,\n\t\t\t...(out.status && { status: out.status }),\n\t\t\trunning: out.status ? out.status.toUpperCase() !== 'TERMINATED' : true\n\t\t}\n\t}\n\n\tasync stopSession(input: CodeSandboxSessionIdInput): Promise<CodeSandboxSessionOutput> {\n\t\tconst out = await this.#client.stopSession({ session_id: input.session_id })\n\t\treturn {\n\t\t\tsession_id: out.session_id,\n\t\t\t...(out.status && { status: out.status }),\n\t\t\trunning: false\n\t\t}\n\t}\n\n\tasync executeCode(input: CodeSandboxExecuteCodeInput): Promise<CodeSandboxExecResult> {\n\t\tconst out = await this.#client.executeCode({\n\t\t\tsession_id: input.session_id,\n\t\t\tcode: input.code,\n\t\t\t...(input.language && { language: input.language })\n\t\t})\n\t\treturn mapInvoke(input.session_id, out.result, out.raw)\n\t}\n\n\tasync executeCommand(input: CodeSandboxExecuteCommandInput): Promise<CodeSandboxExecResult> {\n\t\tconst out = await this.#client.executeCommand({\n\t\t\tsession_id: input.session_id,\n\t\t\tcommand: input.command\n\t\t})\n\t\treturn mapInvoke(input.session_id, out.result, out.raw)\n\t}\n\n\tasync writeFiles(input: CodeSandboxWriteFilesInput) {\n\t\tawait this.#client.writeFiles({\n\t\t\tsession_id: input.session_id,\n\t\t\tfiles: input.files\n\t\t})\n\t\treturn {\n\t\t\tsession_id: input.session_id,\n\t\t\tpaths: input.files.map((f) => f.path),\n\t\t\tok: true as const\n\t\t}\n\t}\n\n\tasync readFiles(input: CodeSandboxReadFilesInput): Promise<CodeSandboxReadFilesOutput> {\n\t\tconst out = await this.#client.readFiles({\n\t\t\tsession_id: input.session_id,\n\t\t\tpaths: input.paths\n\t\t})\n\t\tconst files = extractFiles(out.result ?? out.raw, input.paths)\n\t\treturn { session_id: input.session_id, files }\n\t}\n\n\tasync listFiles(input: CodeSandboxListFilesInput): Promise<CodeSandboxListFilesOutput> {\n\t\tconst out = await this.#client.listFiles({\n\t\t\tsession_id: input.session_id,\n\t\t\t...(input.directory_path !== undefined && { directory_path: input.directory_path })\n\t\t})\n\t\tconst paths = extractPaths(out.result ?? out.raw)\n\t\treturn { session_id: input.session_id, paths, raw: out.result ?? out.raw }\n\t}\n\n\tasync removeFiles(input: CodeSandboxRemoveFilesInput) {\n\t\tawait this.#client.removeFiles({\n\t\t\tsession_id: input.session_id,\n\t\t\tpaths: input.paths\n\t\t})\n\t\treturn { session_id: input.session_id, paths: input.paths, ok: true as const }\n\t}\n}\n\nfunction mapInvoke(session_id: string, result: unknown, raw: unknown): CodeSandboxExecResult {\n\tconst out: CodeSandboxExecResult = { session_id, result: result ?? raw, success: true }\n\tif (isPlainObject(result)) {\n\t\tif (isString(result['stdout'])) out.stdout = result['stdout']\n\t\tif (isString(result['stderr'])) out.stderr = result['stderr']\n\t\tif (typeof result['exitCode'] === 'number') out.exit_code = result['exitCode']\n\t\tif (typeof result['exit_code'] === 'number') out.exit_code = result['exit_code']\n\t\tif (typeof result['success'] === 'boolean') out.success = result['success']\n\t}\n\treturn out\n}\n\nfunction extractFiles(payload: unknown, fallbackPaths: string[]): { path: string; text: string }[] {\n\tif (isPlainObject(payload)) {\n\t\tconst content = payload['content'] ?? payload['files']\n\t\tif (Array.isArray(content)) {\n\t\t\tconst files: { path: string; text: string }[] = []\n\t\t\tfor (const row of content) {\n\t\t\t\tif (!isPlainObject(row)) continue\n\t\t\t\tconst path = row['path']\n\t\t\t\tconst text = row['text'] ?? row['content'] ?? ''\n\t\t\t\tif (isString(path) && isString(text)) files.push({ path, text })\n\t\t\t}\n\t\t\tif (files.length > 0) return files\n\t\t}\n\t}\n\t// Best-effort: single string body for first path\n\tif (isString(payload) && fallbackPaths[0]) {\n\t\treturn [{ path: fallbackPaths[0], text: payload }]\n\t}\n\treturn fallbackPaths.map((path) => ({ path, text: '' }))\n}\n\nfunction extractPaths(payload: unknown): string[] {\n\tif (!isPlainObject(payload)) return []\n\tconst list = payload['files'] ?? payload['paths'] ?? payload['entries']\n\tif (!Array.isArray(list)) return []\n\tconst paths: string[] = []\n\tfor (const row of list) {\n\t\tif (isString(row)) {\n\t\t\tpaths.push(row)\n\t\t\tcontinue\n\t\t}\n\t\tif (isPlainObject(row)) {\n\t\t\tconst path = row['path'] ?? row['name']\n\t\t\tif (isString(path)) paths.push(path)\n\t\t}\n\t}\n\treturn paths\n}\n","import type { HttpServiceOptions } from '../../../transport/http-service'\nimport { CloudflareSandboxClient } from '../../../vendors/cloudflare-sandbox'\nimport type {\n\tCodeSandboxExecResult,\n\tCodeSandboxExecuteCodeInput,\n\tCodeSandboxExecuteCommandInput,\n\tCodeSandboxListFilesInput,\n\tCodeSandboxListFilesOutput,\n\tCodeSandboxOps,\n\tCodeSandboxReadFilesInput,\n\tCodeSandboxRemoveFilesInput,\n\tCodeSandboxSessionIdInput,\n\tCodeSandboxSessionOutput,\n\tCodeSandboxStartSessionInput,\n\tCodeSandboxWriteFilesInput,\n\tCloudflareCodeSandboxAuth\n} from '../contracts'\n\nexport type CloudflareCodeSandboxProviderOptions = Pick<HttpServiceOptions, 'fetch' | 'signal'>\n\nexport class CloudflareCodeSandboxProvider implements CodeSandboxOps {\n\treadonly #client: CloudflareSandboxClient\n\n\tconstructor(auth: CloudflareCodeSandboxAuth, options: CloudflareCodeSandboxProviderOptions = {}) {\n\t\tconst { provider: _provider, ...vendorAuth } = auth\n\t\tthis.#client = new CloudflareSandboxClient(vendorAuth, options)\n\t}\n\n\tasync startSession(_input: CodeSandboxStartSessionInput = {}): Promise<CodeSandboxSessionOutput> {\n\t\t// Bridge create has no name/timeout fields; ignore optional start metadata.\n\t\tconst created = await this.#client.create()\n\t\treturn { session_id: created.sandbox_id, status: 'running', running: true }\n\t}\n\n\tasync getSession(input: CodeSandboxSessionIdInput): Promise<CodeSandboxSessionOutput> {\n\t\tconst row = await this.#client.running({ sandbox_id: input.session_id })\n\t\treturn {\n\t\t\tsession_id: input.session_id,\n\t\t\trunning: row.running,\n\t\t\tstatus: row.running ? 'running' : 'stopped'\n\t\t}\n\t}\n\n\tasync stopSession(input: CodeSandboxSessionIdInput): Promise<CodeSandboxSessionOutput> {\n\t\tawait this.#client.destroy({ sandbox_id: input.session_id })\n\t\treturn { session_id: input.session_id, status: 'stopped', running: false }\n\t}\n\n\tasync executeCode(input: CodeSandboxExecuteCodeInput): Promise<CodeSandboxExecResult> {\n\t\tconst language = normalizeLanguage(input.language)\n\t\tconst out = await this.#client.executeCode({\n\t\t\tsandbox_id: input.session_id,\n\t\t\tcode: input.code,\n\t\t\tlanguage\n\t\t})\n\t\treturn mapExec(input.session_id, out)\n\t}\n\n\tasync executeCommand(input: CodeSandboxExecuteCommandInput): Promise<CodeSandboxExecResult> {\n\t\tconst out = await this.#client.exec({\n\t\t\tsandbox_id: input.session_id,\n\t\t\targv: ['sh', '-lc', input.command]\n\t\t})\n\t\treturn mapExec(input.session_id, out)\n\t}\n\n\tasync writeFiles(input: CodeSandboxWriteFilesInput) {\n\t\tconst out = await this.#client.writeFiles({\n\t\t\tsandbox_id: input.session_id,\n\t\t\tfiles: input.files\n\t\t})\n\t\treturn { session_id: input.session_id, paths: out.paths, ok: true as const }\n\t}\n\n\tasync readFiles(input: CodeSandboxReadFilesInput) {\n\t\tconst out = await this.#client.readFiles({\n\t\t\tsandbox_id: input.session_id,\n\t\t\tpaths: input.paths\n\t\t})\n\t\t// Seam contract is utf-8 text only; vendor defaults encoding to utf8.\n\t\treturn {\n\t\t\tsession_id: input.session_id,\n\t\t\tfiles: out.files.map((file) => ({\n\t\t\t\tpath: file.path,\n\t\t\t\ttext: file.text ?? ''\n\t\t\t}))\n\t\t}\n\t}\n\n\tasync listFiles(input: CodeSandboxListFilesInput): Promise<CodeSandboxListFilesOutput> {\n\t\tconst out = await this.#client.listFiles({\n\t\t\tsandbox_id: input.session_id,\n\t\t\t...(input.directory_path !== undefined && { directory_path: input.directory_path })\n\t\t})\n\t\treturn {\n\t\t\tsession_id: input.session_id,\n\t\t\tpaths: out.paths,\n\t\t\t...(out.raw !== undefined && { raw: out.raw })\n\t\t}\n\t}\n\n\tasync removeFiles(input: CodeSandboxRemoveFilesInput) {\n\t\tconst out = await this.#client.removeFiles({\n\t\t\tsandbox_id: input.session_id,\n\t\t\tpaths: input.paths\n\t\t})\n\t\treturn { session_id: input.session_id, paths: out.paths, ok: true as const }\n\t}\n}\n\nfunction mapExec(\n\tsession_id: string,\n\tout: { stdout: string; stderr: string; exit_code?: number | undefined; success: boolean }\n): CodeSandboxExecResult {\n\tconst result: CodeSandboxExecResult = {\n\t\tsession_id,\n\t\tstdout: out.stdout,\n\t\tstderr: out.stderr,\n\t\tsuccess: out.success\n\t}\n\tif (out.exit_code !== undefined) result.exit_code = out.exit_code\n\treturn result\n}\n\nfunction normalizeLanguage(language: string | undefined): 'python' | 'javascript' | 'typescript' | 'shell' {\n\tconst raw = (language ?? 'python').toLowerCase()\n\tif (raw === 'js' || raw === 'javascript' || raw === 'node') return 'javascript'\n\tif (raw === 'ts' || raw === 'typescript') return 'typescript'\n\tif (raw === 'sh' || raw === 'bash' || raw === 'shell') return 'shell'\n\treturn 'python'\n}\n","import { requireAuth } from '../../core/provider'\nimport type { ToolContext } from '../../core/types'\nimport type {\n\tCodeSandboxAuth,\n\tCodeSandboxExecuteCodeInput,\n\tCodeSandboxExecuteCommandInput,\n\tCodeSandboxListFilesInput,\n\tCodeSandboxOps,\n\tCodeSandboxReadFilesInput,\n\tCodeSandboxRemoveFilesInput,\n\tCodeSandboxSessionIdInput,\n\tCodeSandboxStartSessionInput,\n\tCodeSandboxWriteFilesInput\n} from './contracts'\nimport { codeSandboxAuthSchema } from './contracts'\nimport { AgentCoreCodeSandboxProvider } from './providers/bedrock-agentcore'\nimport { CloudflareCodeSandboxProvider } from './providers/cloudflare-sandbox'\n\nfunction providerFor(auth: CodeSandboxAuth, ctx: ToolContext): CodeSandboxOps {\n\tswitch (auth.provider) {\n\t\tcase 'cloudflare':\n\t\t\treturn new CloudflareCodeSandboxProvider(auth, {\n\t\t\t\t...(ctx.fetch && { fetch: ctx.fetch }),\n\t\t\t\t...(ctx.signal && { signal: ctx.signal })\n\t\t\t})\n\t\tcase 'bedrock-agentcore':\n\t\t\treturn new AgentCoreCodeSandboxProvider(auth, {\n\t\t\t\t...(ctx.fetch && { fetch: ctx.fetch }),\n\t\t\t\t...(ctx.signal && { signal: ctx.signal })\n\t\t\t})\n\t}\n}\n\nexport class CodeSandboxClient implements CodeSandboxOps {\n\treadonly #ops: CodeSandboxOps\n\n\tconstructor(ops: CodeSandboxOps) {\n\t\tthis.#ops = ops\n\t}\n\n\tstatic fromContext(ctx: ToolContext): CodeSandboxClient {\n\t\treturn new CodeSandboxClient(providerFor(requireAuth(ctx, codeSandboxAuthSchema), ctx))\n\t}\n\n\tstatic fromAuth(auth: CodeSandboxAuth, ctx: ToolContext = {}): CodeSandboxClient {\n\t\treturn new CodeSandboxClient(providerFor(auth, ctx))\n\t}\n\n\tstartSession(input: CodeSandboxStartSessionInput = {}) {\n\t\treturn this.#ops.startSession(input)\n\t}\n\n\tgetSession(input: CodeSandboxSessionIdInput) {\n\t\treturn this.#ops.getSession(input)\n\t}\n\n\tstopSession(input: CodeSandboxSessionIdInput) {\n\t\treturn this.#ops.stopSession(input)\n\t}\n\n\texecuteCode(input: CodeSandboxExecuteCodeInput) {\n\t\treturn this.#ops.executeCode(input)\n\t}\n\n\texecuteCommand(input: CodeSandboxExecuteCommandInput) {\n\t\treturn this.#ops.executeCommand(input)\n\t}\n\n\twriteFiles(input: CodeSandboxWriteFilesInput) {\n\t\treturn this.#ops.writeFiles(input)\n\t}\n\n\treadFiles(input: CodeSandboxReadFilesInput) {\n\t\treturn this.#ops.readFiles(input)\n\t}\n\n\tlistFiles(input: CodeSandboxListFilesInput) {\n\t\treturn this.#ops.listFiles(input)\n\t}\n\n\tremoveFiles(input: CodeSandboxRemoveFilesInput) {\n\t\treturn this.#ops.removeFiles(input)\n\t}\n}\n","import { defineModule, defineTool } from '../../core/define'\nimport { CodeSandboxClient } from './client'\nimport {\n\tcodeSandboxAuthSchema,\n\tcodeSandboxExecResultSchema,\n\tcodeSandboxExecuteCodeInputSchema,\n\tcodeSandboxExecuteCommandInputSchema,\n\tcodeSandboxListFilesInputSchema,\n\tcodeSandboxListFilesOutputSchema,\n\tcodeSandboxReadFilesInputSchema,\n\tcodeSandboxReadFilesOutputSchema,\n\tcodeSandboxRemoveFilesInputSchema,\n\tcodeSandboxRemoveFilesOutputSchema,\n\tcodeSandboxSessionIdInputSchema,\n\tcodeSandboxSessionOutputSchema,\n\tcodeSandboxStartSessionInputSchema,\n\tcodeSandboxWriteFilesInputSchema,\n\tcodeSandboxWriteFilesOutputSchema\n} from './contracts'\n\nexport const codeSandboxStartSessionTool = defineTool({\n\tid: 'code-sandbox-start-session',\n\tname: 'startCodeSandboxSession',\n\tdescription:\n\t\t'Start an isolated sandbox session and return session_id. Use only when the task requires arbitrary code, shell commands, or temporary files that no purpose-built tool covers. Do not start a sandbox to build or edit supported documents, spreadsheets, presentations, PDFs, or images.',\n\tinputSchema: codeSandboxStartSessionInputSchema,\n\toutputSchema: codeSandboxSessionOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\tnetwork: true,\n\texecute: async (input, ctx) => CodeSandboxClient.fromContext(ctx).startSession(input)\n})\n\nexport const codeSandboxGetSessionTool = defineTool({\n\tid: 'code-sandbox-get-session',\n\tname: 'getCodeSandboxSession',\n\tdescription:\n\t\t'Get status for a sandbox session created by code-sandbox-start-session. Use when execution may still be running or session availability must be checked; this does not execute work.',\n\tinputSchema: codeSandboxSessionIdInputSchema,\n\toutputSchema: codeSandboxSessionOutputSchema,\n\tsideEffect: 'read',\n\truntime: 'both',\n\tnetwork: true,\n\texecute: async (input, ctx) => CodeSandboxClient.fromContext(ctx).getSession(input)\n})\n\nexport const codeSandboxStopSessionTool = defineTool({\n\tid: 'code-sandbox-stop-session',\n\tname: 'stopCodeSandboxSession',\n\tdescription:\n\t\t'Stop a sandbox session created by code-sandbox-start-session and release its temporary resources. Call after sandbox work is complete when the session is no longer needed.',\n\tinputSchema: codeSandboxSessionIdInputSchema,\n\toutputSchema: codeSandboxSessionOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\tnetwork: true,\n\texecute: async (input, ctx) => CodeSandboxClient.fromContext(ctx).stopSession(input)\n})\n\nexport const codeSandboxExecuteCodeTool = defineTool({\n\tid: 'code-sandbox-execute-code',\n\tname: 'executeCodeInSandbox',\n\tdescription:\n\t\t'Execute source code in an active sandbox session. Use as a fallback for computation or automation that no purpose-built tool covers. Do not use to build or edit supported documents, spreadsheets, presentations, PDFs, or images.',\n\tinputSchema: codeSandboxExecuteCodeInputSchema,\n\toutputSchema: codeSandboxExecResultSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\tnetwork: true,\n\texecute: async (input, ctx) => CodeSandboxClient.fromContext(ctx).executeCode(input)\n})\n\nexport const codeSandboxExecuteCommandTool = defineTool({\n\tid: 'code-sandbox-execute-command',\n\tname: 'executeCommandInSandbox',\n\tdescription:\n\t\t'Run a shell command in an active sandbox session. Use as a fallback for command-line work that no purpose-built tool covers. Do not use command-line libraries to replace dedicated document, spreadsheet, presentation, PDF, or image tools.',\n\tinputSchema: codeSandboxExecuteCommandInputSchema,\n\toutputSchema: codeSandboxExecResultSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\tnetwork: true,\n\texecute: async (input, ctx) => CodeSandboxClient.fromContext(ctx).executeCommand(input)\n})\n\nexport const codeSandboxWriteFilesTool = defineTool({\n\tid: 'code-sandbox-write-files',\n\tname: 'writeSandboxFiles',\n\tdescription:\n\t\t'Write one or more UTF-8 files into an active sandbox session for intermediate computation. Sandbox files are temporary and this tool does not return ArtifactRefs. Use a purpose-built builder for final deliverables.',\n\tinputSchema: codeSandboxWriteFilesInputSchema,\n\toutputSchema: codeSandboxWriteFilesOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\tnetwork: true,\n\texecute: async (input, ctx) => CodeSandboxClient.fromContext(ctx).writeFiles(input)\n})\n\nexport const codeSandboxReadFilesTool = defineTool({\n\tid: 'code-sandbox-read-files',\n\tname: 'readSandboxFiles',\n\tdescription:\n\t\t'Read one or more UTF-8 files from an active sandbox session. Use only for files produced or imported during the same sandbox workflow; use a format-aware reader for supported user artifacts.',\n\tinputSchema: codeSandboxReadFilesInputSchema,\n\toutputSchema: codeSandboxReadFilesOutputSchema,\n\tsideEffect: 'read',\n\truntime: 'both',\n\tnetwork: true,\n\texecute: async (input, ctx) => CodeSandboxClient.fromContext(ctx).readFiles(input)\n})\n\nexport const codeSandboxListFilesTool = defineTool({\n\tid: 'code-sandbox-list-files',\n\tname: 'listSandboxFiles',\n\tdescription:\n\t\t'List temporary files in an active sandbox directory when supported. Use to locate sandbox intermediates, not to discover files in the durable workspace or artifact store.',\n\tinputSchema: codeSandboxListFilesInputSchema,\n\toutputSchema: codeSandboxListFilesOutputSchema,\n\tsideEffect: 'read',\n\truntime: 'both',\n\tnetwork: true,\n\texecute: async (input, ctx) => CodeSandboxClient.fromContext(ctx).listFiles(input)\n})\n\nexport const codeSandboxRemoveFilesTool = defineTool({\n\tid: 'code-sandbox-remove-files',\n\tname: 'removeSandboxFiles',\n\tdescription:\n\t\t'Remove temporary files from an active sandbox session. Use only for sandbox cleanup; this does not delete durable workspace files or ArtifactRefs.',\n\tinputSchema: codeSandboxRemoveFilesInputSchema,\n\toutputSchema: codeSandboxRemoveFilesOutputSchema,\n\tsideEffect: 'write',\n\truntime: 'both',\n\tnetwork: true,\n\texecute: async (input, ctx) => CodeSandboxClient.fromContext(ctx).removeFiles(input)\n})\n\nexport const codeSandboxModule = defineModule({\n\tid: 'code-sandbox',\n\ttitle: 'Code Sandbox',\n\tdescription:\n\t\t'General-purpose fallback for arbitrary code, commands, and temporary files when no dedicated tool covers the task. Do not use it instead of purpose-built document, spreadsheet, presentation, PDF, image, or render tools.',\n\truntime: 'both',\n\tauth: { type: 'custom', schema: codeSandboxAuthSchema },\n\tcategories: ['compute', 'sandbox'],\n\tclassification: 'standard',\n\ttags: ['exec', 'workspace'],\n\ttools: [\n\t\tcodeSandboxStartSessionTool,\n\t\tcodeSandboxGetSessionTool,\n\t\tcodeSandboxStopSessionTool,\n\t\tcodeSandboxExecuteCodeTool,\n\t\tcodeSandboxExecuteCommandTool,\n\t\tcodeSandboxWriteFilesTool,\n\t\tcodeSandboxReadFilesTool,\n\t\tcodeSandboxListFilesTool,\n\t\tcodeSandboxRemoveFilesTool\n\t]\n})\n"],"mappings":";;;;;;;;;;;AAiBA,MAAa,sBAAsB;AACnC,MAAa,yBAAyB;;AAGtC,MAAa,kCAAkC,4BAA4B,OAAO,EACjF,UAAU,EAAE,QAAQ,YAAY,EACjC,CAAC;AAED,MAAa,iCAAiC,0CAA0C,OAAO,EAC9F,UAAU,EAAE,QAAQ,mBAAmB,EACxC,CAAC;AAED,MAAa,wBAAwB,EAAE,mBAAmB,YAAY,CACrE,iCACA,8BACD,CAAC;AAMD,MAAM,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,SAAS,uCAAuC;AAE7F,MAAa,qCAAqC,EAAE,OAAO;CAC1D,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,2DAA2D;CAChH,yBAAyB,EACvB,IAAI,CAAC,CACL,IAAI,CAAC,CAA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uleDefinition, s as ToolDefinition } from "../../types-Ccb0DXY9.js";
|
|
2
|
+
import "../../index-CZX5OeOF.js";
|
|
3
|
+
//#region src/modules/content-type/module.d.ts
|
|
4
|
+
declare const contentTypeGetTool: ToolDefinition<{
|
|
5
|
+
path: string;
|
|
6
|
+
}, {
|
|
7
|
+
media_type: string | null;
|
|
8
|
+
}>;
|
|
9
|
+
declare const contentTypeExtensionTool: ToolDefinition<{
|
|
10
|
+
media_type: string;
|
|
11
|
+
}, {
|
|
12
|
+
extension: string | null;
|
|
13
|
+
}>;
|
|
14
|
+
declare const contentTypeExtensionsTool: ToolDefinition<{
|
|
15
|
+
media_type: string;
|
|
16
|
+
}, {
|
|
17
|
+
extensions: string[];
|
|
18
|
+
}>;
|
|
19
|
+
declare const contentTypeModule: ModuleDefinition<unknown>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { contentTypeExtensionTool, contentTypeExtensionsTool, contentTypeGetTool, contentTypeModule };
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/modules/content-type/module.ts"],"mappings":";;;cA+Ba,oBAAA;;;;;cAeA,0BAAA;;;;;cAeA,2BAAA;;;;;cAgBA,mBAAA"}
|