@openai/agents-extensions 0.8.4 → 0.9.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/dist/ai-sdk-ui/uiMessageStream.d.ts +5 -0
- package/dist/ai-sdk-ui/uiMessageStream.js +10 -3
- package/dist/ai-sdk-ui/uiMessageStream.js.map +1 -1
- package/dist/ai-sdk-ui/uiMessageStream.mjs +9 -3
- package/dist/ai-sdk-ui/uiMessageStream.mjs.map +1 -1
- package/dist/metadata.js +2 -2
- package/dist/metadata.mjs +2 -2
- package/dist/sandbox/blaxel/index.d.ts +2 -0
- package/dist/sandbox/blaxel/index.js +19 -0
- package/dist/sandbox/blaxel/index.js.map +1 -0
- package/dist/sandbox/blaxel/index.mjs +3 -0
- package/dist/sandbox/blaxel/index.mjs.map +1 -0
- package/dist/sandbox/blaxel/mounts.d.ts +101 -0
- package/dist/sandbox/blaxel/mounts.js +542 -0
- package/dist/sandbox/blaxel/mounts.js.map +1 -0
- package/dist/sandbox/blaxel/mounts.mjs +529 -0
- package/dist/sandbox/blaxel/mounts.mjs.map +1 -0
- package/dist/sandbox/blaxel/sandbox.d.ts +155 -0
- package/dist/sandbox/blaxel/sandbox.js +1110 -0
- package/dist/sandbox/blaxel/sandbox.js.map +1 -0
- package/dist/sandbox/blaxel/sandbox.mjs +1072 -0
- package/dist/sandbox/blaxel/sandbox.mjs.map +1 -0
- package/dist/sandbox/cloudflare/index.d.ts +2 -0
- package/dist/sandbox/cloudflare/index.js +19 -0
- package/dist/sandbox/cloudflare/index.js.map +1 -0
- package/dist/sandbox/cloudflare/index.mjs +3 -0
- package/dist/sandbox/cloudflare/index.mjs.map +1 -0
- package/dist/sandbox/cloudflare/mounts.d.ts +28 -0
- package/dist/sandbox/cloudflare/mounts.js +150 -0
- package/dist/sandbox/cloudflare/mounts.js.map +1 -0
- package/dist/sandbox/cloudflare/mounts.mjs +143 -0
- package/dist/sandbox/cloudflare/mounts.mjs.map +1 -0
- package/dist/sandbox/cloudflare/sandbox.d.ts +91 -0
- package/dist/sandbox/cloudflare/sandbox.js +1163 -0
- package/dist/sandbox/cloudflare/sandbox.js.map +1 -0
- package/dist/sandbox/cloudflare/sandbox.mjs +1125 -0
- package/dist/sandbox/cloudflare/sandbox.mjs.map +1 -0
- package/dist/sandbox/daytona/index.d.ts +2 -0
- package/dist/sandbox/daytona/index.js +19 -0
- package/dist/sandbox/daytona/index.js.map +1 -0
- package/dist/sandbox/daytona/index.mjs +3 -0
- package/dist/sandbox/daytona/index.mjs.map +1 -0
- package/dist/sandbox/daytona/mounts.d.ts +11 -0
- package/dist/sandbox/daytona/mounts.js +17 -0
- package/dist/sandbox/daytona/mounts.js.map +1 -0
- package/dist/sandbox/daytona/mounts.mjs +12 -0
- package/dist/sandbox/daytona/mounts.mjs.map +1 -0
- package/dist/sandbox/daytona/sandbox.d.ts +160 -0
- package/dist/sandbox/daytona/sandbox.js +938 -0
- package/dist/sandbox/daytona/sandbox.js.map +1 -0
- package/dist/sandbox/daytona/sandbox.mjs +900 -0
- package/dist/sandbox/daytona/sandbox.mjs.map +1 -0
- package/dist/sandbox/e2b/index.d.ts +2 -0
- package/dist/sandbox/e2b/index.js +19 -0
- package/dist/sandbox/e2b/index.js.map +1 -0
- package/dist/sandbox/e2b/index.mjs +3 -0
- package/dist/sandbox/e2b/index.mjs.map +1 -0
- package/dist/sandbox/e2b/mounts.d.ts +11 -0
- package/dist/sandbox/e2b/mounts.js +17 -0
- package/dist/sandbox/e2b/mounts.js.map +1 -0
- package/dist/sandbox/e2b/mounts.mjs +12 -0
- package/dist/sandbox/e2b/mounts.mjs.map +1 -0
- package/dist/sandbox/e2b/sandbox.d.ts +169 -0
- package/dist/sandbox/e2b/sandbox.js +829 -0
- package/dist/sandbox/e2b/sandbox.js.map +1 -0
- package/dist/sandbox/e2b/sandbox.mjs +791 -0
- package/dist/sandbox/e2b/sandbox.mjs.map +1 -0
- package/dist/sandbox/modal/index.d.ts +2 -0
- package/dist/sandbox/modal/index.js +19 -0
- package/dist/sandbox/modal/index.js.map +1 -0
- package/dist/sandbox/modal/index.mjs +3 -0
- package/dist/sandbox/modal/index.mjs.map +1 -0
- package/dist/sandbox/modal/mounts.d.ts +24 -0
- package/dist/sandbox/modal/mounts.js +194 -0
- package/dist/sandbox/modal/mounts.js.map +1 -0
- package/dist/sandbox/modal/mounts.mjs +188 -0
- package/dist/sandbox/modal/mounts.mjs.map +1 -0
- package/dist/sandbox/modal/sandbox.d.ts +220 -0
- package/dist/sandbox/modal/sandbox.js +1621 -0
- package/dist/sandbox/modal/sandbox.js.map +1 -0
- package/dist/sandbox/modal/sandbox.mjs +1581 -0
- package/dist/sandbox/modal/sandbox.mjs.map +1 -0
- package/dist/sandbox/runloop/index.d.ts +2 -0
- package/dist/sandbox/runloop/index.js +19 -0
- package/dist/sandbox/runloop/index.js.map +1 -0
- package/dist/sandbox/runloop/index.mjs +3 -0
- package/dist/sandbox/runloop/index.mjs.map +1 -0
- package/dist/sandbox/runloop/mounts.d.ts +11 -0
- package/dist/sandbox/runloop/mounts.js +17 -0
- package/dist/sandbox/runloop/mounts.js.map +1 -0
- package/dist/sandbox/runloop/mounts.mjs +12 -0
- package/dist/sandbox/runloop/mounts.mjs.map +1 -0
- package/dist/sandbox/runloop/sandbox.d.ts +266 -0
- package/dist/sandbox/runloop/sandbox.js +1390 -0
- package/dist/sandbox/runloop/sandbox.js.map +1 -0
- package/dist/sandbox/runloop/sandbox.mjs +1346 -0
- package/dist/sandbox/runloop/sandbox.mjs.map +1 -0
- package/dist/sandbox/shared/archive.d.ts +34 -0
- package/dist/sandbox/shared/archive.js +397 -0
- package/dist/sandbox/shared/archive.js.map +1 -0
- package/dist/sandbox/shared/archive.mjs +389 -0
- package/dist/sandbox/shared/archive.mjs.map +1 -0
- package/dist/sandbox/shared/editor.d.ts +17 -0
- package/dist/sandbox/shared/editor.js +65 -0
- package/dist/sandbox/shared/editor.js.map +1 -0
- package/dist/sandbox/shared/editor.mjs +61 -0
- package/dist/sandbox/shared/editor.mjs.map +1 -0
- package/dist/sandbox/shared/environment.d.ts +1 -0
- package/dist/sandbox/shared/environment.js +13 -0
- package/dist/sandbox/shared/environment.js.map +1 -0
- package/dist/sandbox/shared/environment.mjs +2 -0
- package/dist/sandbox/shared/environment.mjs.map +1 -0
- package/dist/sandbox/shared/git.d.ts +4 -0
- package/dist/sandbox/shared/git.js +20 -0
- package/dist/sandbox/shared/git.js.map +1 -0
- package/dist/sandbox/shared/git.mjs +17 -0
- package/dist/sandbox/shared/git.mjs.map +1 -0
- package/dist/sandbox/shared/inContainerMounts.d.ts +40 -0
- package/dist/sandbox/shared/inContainerMounts.js +670 -0
- package/dist/sandbox/shared/inContainerMounts.js.map +1 -0
- package/dist/sandbox/shared/inContainerMounts.mjs +662 -0
- package/dist/sandbox/shared/inContainerMounts.mjs.map +1 -0
- package/dist/sandbox/shared/index.d.ts +23 -0
- package/dist/sandbox/shared/index.js +112 -0
- package/dist/sandbox/shared/index.js.map +1 -0
- package/dist/sandbox/shared/index.mjs +18 -0
- package/dist/sandbox/shared/index.mjs.map +1 -0
- package/dist/sandbox/shared/localSources.d.ts +8 -0
- package/dist/sandbox/shared/localSources.js +378 -0
- package/dist/sandbox/shared/localSources.js.map +1 -0
- package/dist/sandbox/shared/localSources.mjs +372 -0
- package/dist/sandbox/shared/localSources.mjs.map +1 -0
- package/dist/sandbox/shared/manifest.d.ts +38 -0
- package/dist/sandbox/shared/manifest.js +254 -0
- package/dist/sandbox/shared/manifest.js.map +1 -0
- package/dist/sandbox/shared/manifest.mjs +233 -0
- package/dist/sandbox/shared/manifest.mjs.map +1 -0
- package/dist/sandbox/shared/media.d.ts +1 -0
- package/dist/sandbox/shared/media.js +10 -0
- package/dist/sandbox/shared/media.js.map +1 -0
- package/dist/sandbox/shared/media.mjs +2 -0
- package/dist/sandbox/shared/media.mjs.map +1 -0
- package/dist/sandbox/shared/metadata.d.ts +7 -0
- package/dist/sandbox/shared/metadata.js +87 -0
- package/dist/sandbox/shared/metadata.js.map +1 -0
- package/dist/sandbox/shared/metadata.mjs +81 -0
- package/dist/sandbox/shared/metadata.mjs.map +1 -0
- package/dist/sandbox/shared/output.d.ts +1 -0
- package/dist/sandbox/shared/output.js +8 -0
- package/dist/sandbox/shared/output.js.map +1 -0
- package/dist/sandbox/shared/output.mjs +2 -0
- package/dist/sandbox/shared/output.mjs.map +1 -0
- package/dist/sandbox/shared/paths.d.ts +27 -0
- package/dist/sandbox/shared/paths.js +245 -0
- package/dist/sandbox/shared/paths.js.map +1 -0
- package/dist/sandbox/shared/paths.mjs +236 -0
- package/dist/sandbox/shared/paths.mjs.map +1 -0
- package/dist/sandbox/shared/ports.d.ts +14 -0
- package/dist/sandbox/shared/ports.js +75 -0
- package/dist/sandbox/shared/ports.js.map +1 -0
- package/dist/sandbox/shared/ports.mjs +69 -0
- package/dist/sandbox/shared/ports.mjs.map +1 -0
- package/dist/sandbox/shared/process.d.ts +16 -0
- package/dist/sandbox/shared/process.js +90 -0
- package/dist/sandbox/shared/process.js.map +1 -0
- package/dist/sandbox/shared/process.mjs +86 -0
- package/dist/sandbox/shared/process.mjs.map +1 -0
- package/dist/sandbox/shared/pty.d.ts +81 -0
- package/dist/sandbox/shared/pty.js +382 -0
- package/dist/sandbox/shared/pty.js.map +1 -0
- package/dist/sandbox/shared/pty.mjs +335 -0
- package/dist/sandbox/shared/pty.mjs.map +1 -0
- package/dist/sandbox/shared/runAs.d.ts +46 -0
- package/dist/sandbox/shared/runAs.js +149 -0
- package/dist/sandbox/shared/runAs.js.map +1 -0
- package/dist/sandbox/shared/runAs.mjs +141 -0
- package/dist/sandbox/shared/runAs.mjs.map +1 -0
- package/dist/sandbox/shared/session.d.ts +16 -0
- package/dist/sandbox/shared/session.js +138 -0
- package/dist/sandbox/shared/session.js.map +1 -0
- package/dist/sandbox/shared/session.mjs +128 -0
- package/dist/sandbox/shared/session.mjs.map +1 -0
- package/dist/sandbox/shared/sessionBase.d.ts +90 -0
- package/dist/sandbox/shared/sessionBase.js +446 -0
- package/dist/sandbox/shared/sessionBase.js.map +1 -0
- package/dist/sandbox/shared/sessionBase.mjs +442 -0
- package/dist/sandbox/shared/sessionBase.mjs.map +1 -0
- package/dist/sandbox/shared/sessionState.d.ts +7 -0
- package/dist/sandbox/shared/sessionState.js +35 -0
- package/dist/sandbox/shared/sessionState.js.map +1 -0
- package/dist/sandbox/shared/sessionState.mjs +31 -0
- package/dist/sandbox/shared/sessionState.mjs.map +1 -0
- package/dist/sandbox/shared/snapshots.d.ts +9 -0
- package/dist/sandbox/shared/snapshots.js +62 -0
- package/dist/sandbox/shared/snapshots.js.map +1 -0
- package/dist/sandbox/shared/snapshots.mjs +57 -0
- package/dist/sandbox/shared/snapshots.mjs.map +1 -0
- package/dist/sandbox/shared/typeGuards.d.ts +10 -0
- package/dist/sandbox/shared/typeGuards.js +50 -0
- package/dist/sandbox/shared/typeGuards.js.map +1 -0
- package/dist/sandbox/shared/typeGuards.mjs +38 -0
- package/dist/sandbox/shared/typeGuards.mjs.map +1 -0
- package/dist/sandbox/shared/types.d.ts +24 -0
- package/dist/sandbox/shared/types.js +3 -0
- package/dist/sandbox/shared/types.js.map +1 -0
- package/dist/sandbox/shared/types.mjs +2 -0
- package/dist/sandbox/shared/types.mjs.map +1 -0
- package/dist/sandbox/vercel/index.d.ts +1 -0
- package/dist/sandbox/vercel/index.js +18 -0
- package/dist/sandbox/vercel/index.js.map +1 -0
- package/dist/sandbox/vercel/index.mjs +2 -0
- package/dist/sandbox/vercel/index.mjs.map +1 -0
- package/dist/sandbox/vercel/sandbox.d.ts +135 -0
- package/dist/sandbox/vercel/sandbox.js +1001 -0
- package/dist/sandbox/vercel/sandbox.js.map +1 -0
- package/dist/sandbox/vercel/sandbox.mjs +963 -0
- package/dist/sandbox/vercel/sandbox.mjs.map +1 -0
- package/package.json +108 -4
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { isDir, isMount, normalizeRelativePath, FileMode, Permissions, SandboxUnsupportedFeatureError, } from '@openai/agents-core/sandbox';
|
|
2
|
+
export const MOUNT_MANIFEST_METADATA_SUPPORT = {
|
|
3
|
+
mounts: true,
|
|
4
|
+
};
|
|
5
|
+
export const SANDBOX_MANIFEST_METADATA_SUPPORT = {
|
|
6
|
+
users: true,
|
|
7
|
+
groups: true,
|
|
8
|
+
entryPermissions: true,
|
|
9
|
+
entryGroups: true,
|
|
10
|
+
mounts: true,
|
|
11
|
+
};
|
|
12
|
+
export function sandboxEntryPermissionsMode(entry) {
|
|
13
|
+
const permissions = new Permissions(entry.permissions ?? {
|
|
14
|
+
owner: FileMode.ALL,
|
|
15
|
+
group: FileMode.READ | FileMode.EXEC,
|
|
16
|
+
other: FileMode.READ | FileMode.EXEC,
|
|
17
|
+
});
|
|
18
|
+
return (permissions.toMode() & 0o777).toString(8).padStart(4, '0');
|
|
19
|
+
}
|
|
20
|
+
export function assertSandboxManifestMetadataSupported(providerName, manifest, support = {}) {
|
|
21
|
+
if (!support.users && manifest.users.length > 0) {
|
|
22
|
+
throw new SandboxUnsupportedFeatureError(`${providerName} does not support manifest users yet.`, {
|
|
23
|
+
provider: providerName,
|
|
24
|
+
feature: 'manifest.users',
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (!support.groups && manifest.groups.length > 0) {
|
|
28
|
+
throw new SandboxUnsupportedFeatureError(`${providerName} does not support manifest groups yet.`, {
|
|
29
|
+
provider: providerName,
|
|
30
|
+
feature: 'manifest.groups',
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
if (!support.extraPathGrants && manifest.extraPathGrants.length > 0) {
|
|
34
|
+
throw new SandboxUnsupportedFeatureError(`${providerName} does not support extra path grants yet.`, {
|
|
35
|
+
provider: providerName,
|
|
36
|
+
feature: 'manifest.extraPathGrants',
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
for (const [logicalPath, entry] of Object.entries(manifest.entries)) {
|
|
40
|
+
assertSandboxEntryMetadataSupported(providerName, logicalPath, entry, support);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export function assertSandboxEntryMetadataSupported(providerName, logicalPath, entry, support = {}) {
|
|
44
|
+
const displayPath = logicalPath || '.';
|
|
45
|
+
if (!support.entryPermissions && entry.permissions !== undefined) {
|
|
46
|
+
throw new SandboxUnsupportedFeatureError(`${providerName} does not support sandbox entry permissions yet: ${displayPath}`, {
|
|
47
|
+
provider: providerName,
|
|
48
|
+
feature: 'entry.permissions',
|
|
49
|
+
path: displayPath,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
if (!support.entryGroups && entry.group !== undefined) {
|
|
53
|
+
throw new SandboxUnsupportedFeatureError(`${providerName} does not support sandbox entry group ownership yet: ${displayPath}`, {
|
|
54
|
+
provider: providerName,
|
|
55
|
+
feature: 'entry.group',
|
|
56
|
+
path: displayPath,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
if (!support.mounts && isMount(entry)) {
|
|
60
|
+
throw new SandboxUnsupportedFeatureError(`${providerName} does not support mount entries yet: ${displayPath}`, {
|
|
61
|
+
provider: providerName,
|
|
62
|
+
feature: 'entry.mount',
|
|
63
|
+
path: displayPath,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if (!isDir(entry) || !entry.children) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
for (const [childPath, childEntry] of Object.entries(entry.children)) {
|
|
70
|
+
const childLogicalPath = joinSandboxPath(logicalPath, childPath);
|
|
71
|
+
assertSandboxEntryMetadataSupported(providerName, childLogicalPath, childEntry, support);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function joinSandboxPath(parent, child) {
|
|
75
|
+
const normalizedChild = normalizeRelativePath(child);
|
|
76
|
+
if (!parent || parent === '.') {
|
|
77
|
+
return normalizedChild;
|
|
78
|
+
}
|
|
79
|
+
return `${parent.replace(/\/+$/u, '')}/${normalizedChild}`;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=metadata.mjs.map
|
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O,EAAE,aAAa;YACtB,IAAI,EAAE,WAAW;SAClB,CACF,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,8BAA8B,CACtC,GAAG,YAAY,wCAAwC,WAAW,EAAE,EACpE;YACE,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,aAAa;YACtB,IAAI,EAAE,WAAW;SAClB,CACF,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACrC,OAAO;IACT,CAAC;IAED,KAAK,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrE,MAAM,gBAAgB,GAAG,eAAe,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACjE,mCAAmC,CACjC,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,OAAO,CACR,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,MAAc,EAAE,KAAa;IACpD,MAAM,eAAe,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACrD,IAAI,CAAC,MAAM,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QAC9B,OAAO,eAAe,CAAC;IACzB,CAAC;IACD,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,eAAe,EAAE,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { elapsedSeconds, formatExecResponse, truncateOutput, } from '@openai/agents-core/sandbox/internal';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.truncateOutput = exports.formatExecResponse = exports.elapsedSeconds = void 0;
|
|
4
|
+
var internal_1 = require("@openai/agents-core/sandbox/internal");
|
|
5
|
+
Object.defineProperty(exports, "elapsedSeconds", { enumerable: true, get: function () { return internal_1.elapsedSeconds; } });
|
|
6
|
+
Object.defineProperty(exports, "formatExecResponse", { enumerable: true, get: function () { return internal_1.formatExecResponse; } });
|
|
7
|
+
Object.defineProperty(exports, "truncateOutput", { enumerable: true, get: function () { return internal_1.truncateOutput; } });
|
|
8
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../../src/sandbox/shared/output.ts"],"names":[],"mappings":";;;AAAA,iEAI8C;AAH5C,0GAAA,cAAc,OAAA;AACd,8GAAA,kBAAkB,OAAA;AAClB,0GAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.mjs","sourceRoot":"","sources":["../../../src/sandbox/shared/output.ts"],"names":[],"mappings":"OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,cAAc,GACf,MAAM,sCAAsC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Manifest, type SandboxPathGrant } from '@openai/agents-core/sandbox';
|
|
2
|
+
import { posixDirname, shellQuote } from '@openai/agents-core/sandbox/internal';
|
|
3
|
+
import type { RemoteSandboxPathOptions } from './types';
|
|
4
|
+
export { posixDirname, shellQuote };
|
|
5
|
+
export type RemotePathCommandResult = {
|
|
6
|
+
status: number;
|
|
7
|
+
stdout?: string;
|
|
8
|
+
stderr?: string;
|
|
9
|
+
};
|
|
10
|
+
export type ValidateRemoteSandboxPathArgs = {
|
|
11
|
+
root: string;
|
|
12
|
+
path?: string;
|
|
13
|
+
options?: ValidateRemoteSandboxPathOptions;
|
|
14
|
+
runCommand(command: string): Promise<RemotePathCommandResult>;
|
|
15
|
+
};
|
|
16
|
+
export type ValidateRemoteSandboxPathOptions = RemoteSandboxPathOptions & {
|
|
17
|
+
extraPathGrants?: SandboxPathGrant[];
|
|
18
|
+
};
|
|
19
|
+
export type ValidateRemoteSandboxPathForManifestArgs = Omit<ValidateRemoteSandboxPathArgs, 'root' | 'options'> & {
|
|
20
|
+
manifest: Manifest;
|
|
21
|
+
options?: RemoteSandboxPathOptions;
|
|
22
|
+
};
|
|
23
|
+
export declare function resolveSandboxAbsolutePath(root: string, path?: string, options?: ValidateRemoteSandboxPathOptions): string;
|
|
24
|
+
export declare function validateRemoteSandboxPath({ root, path, options, runCommand, }: ValidateRemoteSandboxPathArgs): Promise<string>;
|
|
25
|
+
export declare function validateRemoteSandboxPathForManifest({ manifest, path, options, runCommand, }: ValidateRemoteSandboxPathForManifestArgs): Promise<string>;
|
|
26
|
+
export declare function resolveSandboxRelativePath(root: string, path?: string): string;
|
|
27
|
+
export declare function resolveSandboxWorkdir(root: string, path?: string): string;
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shellQuote = exports.posixDirname = void 0;
|
|
4
|
+
exports.resolveSandboxAbsolutePath = resolveSandboxAbsolutePath;
|
|
5
|
+
exports.validateRemoteSandboxPath = validateRemoteSandboxPath;
|
|
6
|
+
exports.validateRemoteSandboxPathForManifest = validateRemoteSandboxPathForManifest;
|
|
7
|
+
exports.resolveSandboxRelativePath = resolveSandboxRelativePath;
|
|
8
|
+
exports.resolveSandboxWorkdir = resolveSandboxWorkdir;
|
|
9
|
+
const agents_core_1 = require("@openai/agents-core");
|
|
10
|
+
const sandbox_1 = require("@openai/agents-core/sandbox");
|
|
11
|
+
const internal_1 = require("@openai/agents-core/sandbox/internal");
|
|
12
|
+
Object.defineProperty(exports, "posixDirname", { enumerable: true, get: function () { return internal_1.posixDirname; } });
|
|
13
|
+
Object.defineProperty(exports, "shellQuote", { enumerable: true, get: function () { return internal_1.shellQuote; } });
|
|
14
|
+
const RESOLVE_WORKSPACE_PATH_HELPER = String.raw `#!/bin/sh
|
|
15
|
+
set -eu
|
|
16
|
+
|
|
17
|
+
root="$1"
|
|
18
|
+
candidate="$2"
|
|
19
|
+
for_write="$3"
|
|
20
|
+
shift 3
|
|
21
|
+
max_symlink_depth=64
|
|
22
|
+
|
|
23
|
+
case "$for_write" in
|
|
24
|
+
0|1) ;;
|
|
25
|
+
*) printf 'for_write must be 0 or 1: %s\n' "$for_write" >&2; exit 64 ;;
|
|
26
|
+
esac
|
|
27
|
+
|
|
28
|
+
if [ $(( $# % 2 )) -ne 0 ]; then
|
|
29
|
+
printf 'extra path grants must be root/read_only pairs\n' >&2
|
|
30
|
+
exit 64
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
resolve_path() {
|
|
34
|
+
path="$1"
|
|
35
|
+
depth="$2"
|
|
36
|
+
seen=""
|
|
37
|
+
if [ "$#" -ge 3 ]; then
|
|
38
|
+
seen="$3"
|
|
39
|
+
fi
|
|
40
|
+
if [ "$path" = "/" ]; then
|
|
41
|
+
printf '/\n'
|
|
42
|
+
return 0
|
|
43
|
+
fi
|
|
44
|
+
if [ "$depth" -ge "$max_symlink_depth" ]; then
|
|
45
|
+
printf 'symlink resolution depth exceeded: %s\n' "$path" >&2
|
|
46
|
+
exit 112
|
|
47
|
+
fi
|
|
48
|
+
if [ -d "$path" ]; then
|
|
49
|
+
(cd "$path" && pwd -P)
|
|
50
|
+
return 0
|
|
51
|
+
fi
|
|
52
|
+
parent=$(dirname "$path")
|
|
53
|
+
base=$(basename "$path")
|
|
54
|
+
if [ -z "$parent" ] || [ "$parent" = "$path" ]; then
|
|
55
|
+
parent="/"
|
|
56
|
+
fi
|
|
57
|
+
resolved_parent=$(resolve_path "$parent" "$depth" "$seen")
|
|
58
|
+
candidate_path=$(join_child_path "$resolved_parent" "$base")
|
|
59
|
+
if [ -L "$candidate_path" ]; then
|
|
60
|
+
case ":$seen:" in
|
|
61
|
+
*":$candidate_path:"*)
|
|
62
|
+
printf 'symlink resolution depth exceeded: %s\n' "$candidate_path" >&2
|
|
63
|
+
exit 112
|
|
64
|
+
;;
|
|
65
|
+
esac
|
|
66
|
+
target=$(readlink "$candidate_path")
|
|
67
|
+
next_depth=$((depth + 1))
|
|
68
|
+
next_seen="$seen:$candidate_path"
|
|
69
|
+
case "$target" in
|
|
70
|
+
/*) resolve_path "$target" "$next_depth" "$next_seen" ;;
|
|
71
|
+
*)
|
|
72
|
+
relative_target=$(join_child_path "$resolved_parent" "$target")
|
|
73
|
+
resolve_path "$relative_target" "$next_depth" "$next_seen"
|
|
74
|
+
;;
|
|
75
|
+
esac
|
|
76
|
+
return 0
|
|
77
|
+
fi
|
|
78
|
+
printf '%s\n' "$candidate_path"
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
join_child_path() {
|
|
82
|
+
parent="$1"
|
|
83
|
+
child="$2"
|
|
84
|
+
if [ "$parent" = "/" ]; then
|
|
85
|
+
printf '/%s\n' "$child"
|
|
86
|
+
else
|
|
87
|
+
printf '%s/%s\n' "$parent" "$child"
|
|
88
|
+
fi
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
resolved_candidate=$(resolve_path "$candidate" 0)
|
|
92
|
+
best_grant_root=""
|
|
93
|
+
best_grant_original=""
|
|
94
|
+
best_grant_read_only="0"
|
|
95
|
+
best_grant_len=0
|
|
96
|
+
|
|
97
|
+
check_workspace_root() {
|
|
98
|
+
resolved_root=$(resolve_path "$root" 0)
|
|
99
|
+
if [ "$resolved_root" = "/" ]; then
|
|
100
|
+
case "$resolved_candidate" in
|
|
101
|
+
/*)
|
|
102
|
+
printf '%s\n' "$resolved_candidate"
|
|
103
|
+
exit 0
|
|
104
|
+
;;
|
|
105
|
+
esac
|
|
106
|
+
fi
|
|
107
|
+
case "$resolved_candidate" in
|
|
108
|
+
"$resolved_root"|"$resolved_root"/*)
|
|
109
|
+
printf '%s\n' "$resolved_candidate"
|
|
110
|
+
exit 0
|
|
111
|
+
;;
|
|
112
|
+
esac
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
consider_extra_grant() {
|
|
116
|
+
allowed_root="$1"
|
|
117
|
+
read_only="$2"
|
|
118
|
+
case "$read_only" in
|
|
119
|
+
0|1) ;;
|
|
120
|
+
*) printf 'extra path grant read_only must be 0 or 1: %s\n' "$read_only" >&2; exit 64 ;;
|
|
121
|
+
esac
|
|
122
|
+
resolved_root=$(resolve_path "$allowed_root" 0)
|
|
123
|
+
if [ "$resolved_root" = "/" ]; then
|
|
124
|
+
printf 'extra path grant must not resolve to filesystem root: %s\n' "$allowed_root" >&2
|
|
125
|
+
exit 113
|
|
126
|
+
fi
|
|
127
|
+
case "$resolved_candidate" in
|
|
128
|
+
"$resolved_root"|"$resolved_root"/*)
|
|
129
|
+
root_len=$(printf '%s' "$resolved_root" | wc -c | tr -d ' ')
|
|
130
|
+
if [ "$root_len" -gt "$best_grant_len" ]; then
|
|
131
|
+
best_grant_root="$resolved_root"
|
|
132
|
+
best_grant_original="$allowed_root"
|
|
133
|
+
best_grant_read_only="$read_only"
|
|
134
|
+
best_grant_len="$root_len"
|
|
135
|
+
fi
|
|
136
|
+
;;
|
|
137
|
+
esac
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
while [ "$#" -gt 0 ]; do
|
|
141
|
+
consider_extra_grant "$1" "$2"
|
|
142
|
+
shift 2
|
|
143
|
+
done
|
|
144
|
+
|
|
145
|
+
check_workspace_root
|
|
146
|
+
if [ -n "$best_grant_root" ]; then
|
|
147
|
+
if [ "$for_write" = "1" ] && [ "$best_grant_read_only" = "1" ]; then
|
|
148
|
+
printf 'read-only extra path grant: %s\nresolved path: %s\n' "$best_grant_original" "$resolved_candidate" >&2
|
|
149
|
+
exit 114
|
|
150
|
+
fi
|
|
151
|
+
printf '%s\n' "$resolved_candidate"
|
|
152
|
+
exit 0
|
|
153
|
+
fi
|
|
154
|
+
|
|
155
|
+
printf 'workspace escape: %s\n' "$resolved_candidate" >&2
|
|
156
|
+
exit 111`;
|
|
157
|
+
function createRemotePathHelperId() {
|
|
158
|
+
const crypto = globalThis
|
|
159
|
+
.crypto;
|
|
160
|
+
if (typeof crypto?.randomUUID === 'function') {
|
|
161
|
+
return crypto.randomUUID();
|
|
162
|
+
}
|
|
163
|
+
if (typeof crypto?.getRandomValues === 'function') {
|
|
164
|
+
return Array.from(crypto.getRandomValues(new Uint32Array(4)), (value) => value.toString(36)).join('-');
|
|
165
|
+
}
|
|
166
|
+
return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
167
|
+
}
|
|
168
|
+
function resolveSandboxAbsolutePath(root, path, options = {}) {
|
|
169
|
+
return new sandbox_1.WorkspacePathPolicy({
|
|
170
|
+
root,
|
|
171
|
+
extraPathGrants: options.extraPathGrants,
|
|
172
|
+
}).resolve(path, { forWrite: options.forWrite }).path;
|
|
173
|
+
}
|
|
174
|
+
async function validateRemoteSandboxPath({ root, path, options = {}, runCommand, }) {
|
|
175
|
+
const candidate = resolveSandboxAbsolutePath(root, path, options);
|
|
176
|
+
const helperDir = `/tmp/openai-agents-resolve-path-${createRemotePathHelperId()}`;
|
|
177
|
+
const helperArgs = [
|
|
178
|
+
root,
|
|
179
|
+
candidate,
|
|
180
|
+
options.forWrite ? '1' : '0',
|
|
181
|
+
...(options.extraPathGrants ?? []).flatMap((grant) => [
|
|
182
|
+
grant.path,
|
|
183
|
+
grant.readOnly ? '1' : '0',
|
|
184
|
+
]),
|
|
185
|
+
];
|
|
186
|
+
const command = [
|
|
187
|
+
`helper_dir=${(0, internal_1.shellQuote)(helperDir)}`,
|
|
188
|
+
'helper_path="$helper_dir/resolve-workspace-path.sh"',
|
|
189
|
+
'cleanup() { rm -rf "$helper_dir"; }',
|
|
190
|
+
'trap cleanup EXIT HUP INT TERM',
|
|
191
|
+
'umask 077',
|
|
192
|
+
'mkdir "$helper_dir" || exit 125',
|
|
193
|
+
'cat > "$helper_path" <<\'OPENAI_AGENTS_RESOLVE_PATH\'',
|
|
194
|
+
RESOLVE_WORKSPACE_PATH_HELPER,
|
|
195
|
+
'OPENAI_AGENTS_RESOLVE_PATH',
|
|
196
|
+
`sh "$helper_path" ${helperArgs.map(internal_1.shellQuote).join(' ')}`,
|
|
197
|
+
].join('\n');
|
|
198
|
+
const result = await runCommand(command);
|
|
199
|
+
if (result.status !== 0) {
|
|
200
|
+
const message = (result.stderr ||
|
|
201
|
+
result.stdout ||
|
|
202
|
+
'remote validation failed')
|
|
203
|
+
.trim()
|
|
204
|
+
.split(/\r?\n/u)
|
|
205
|
+
.join('; ');
|
|
206
|
+
throw new sandbox_1.SandboxPathResolutionError(`Sandbox path "${path ?? ''}" failed remote validation: ${message}`, {
|
|
207
|
+
root,
|
|
208
|
+
path: path ?? '',
|
|
209
|
+
forWrite: options.forWrite ?? false,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
const resolvedPath = result.stdout?.trim().split(/\r?\n/u).pop();
|
|
213
|
+
if (!resolvedPath?.startsWith('/')) {
|
|
214
|
+
throw new sandbox_1.SandboxPathResolutionError(`Sandbox path "${path ?? ''}" failed remote validation: validator did not return an absolute resolved path.`, {
|
|
215
|
+
root,
|
|
216
|
+
path: path ?? '',
|
|
217
|
+
forWrite: options.forWrite ?? false,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
return resolvedPath;
|
|
221
|
+
}
|
|
222
|
+
async function validateRemoteSandboxPathForManifest({ manifest, path, options = {}, runCommand, }) {
|
|
223
|
+
return await validateRemoteSandboxPath({
|
|
224
|
+
root: manifest.root,
|
|
225
|
+
path,
|
|
226
|
+
options: {
|
|
227
|
+
...options,
|
|
228
|
+
extraPathGrants: manifest.extraPathGrants,
|
|
229
|
+
},
|
|
230
|
+
runCommand,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
function resolveSandboxRelativePath(root, path) {
|
|
234
|
+
const resolved = new sandbox_1.WorkspacePathPolicy({
|
|
235
|
+
root,
|
|
236
|
+
}).resolve(path, { forWrite: true });
|
|
237
|
+
if (typeof resolved.workspaceRelativePath !== 'string') {
|
|
238
|
+
throw new agents_core_1.UserError(`Sandbox path "${path ?? ''}" escapes the workspace root.`);
|
|
239
|
+
}
|
|
240
|
+
return (0, sandbox_1.normalizeRelativePath)(resolved.workspaceRelativePath);
|
|
241
|
+
}
|
|
242
|
+
function resolveSandboxWorkdir(root, path) {
|
|
243
|
+
return resolveSandboxAbsolutePath(root, path);
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../src/sandbox/shared/paths.ts"],"names":[],"mappings":";;;AAyMA,gEASC;AAED,8DA6DC;AAED,oFAeC;AAED,gEAaC;AAED,sDAEC;AArTD,qDAAgD;AAChD,yDAMqC;AACrC,mEAAgF;AAGvE,6FAHA,uBAAY,OAGA;AAAE,2FAHA,qBAAU,OAGA;AAgCjC,MAAM,6BAA6B,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SA8IvC,CAAC;AAEV,SAAS,wBAAwB;IAC/B,MAAM,MAAM,GAAI,UAA6D;SAC1E,MAAM,CAAC;IACV,IAAI,OAAO,MAAM,EAAE,UAAU,KAAK,UAAU,EAAE,CAAC;QAC7C,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC;IAC7B,CAAC;IACD,IAAI,OAAO,MAAM,EAAE,eAAe,KAAK,UAAU,EAAE,CAAC;QAClD,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CACtE,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CACnB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACd,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OAAO,EAAE;YACP,GAAG,OAAO;YACV,eAAe,EAAE,QAAQ,CAAC,eAAe;SAC1C;QACD,UAAU;KACX,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,0BAA0B,CACxC,IAAY,EACZ,IAAa;IAEb,MAAM,QAAQ,GAAG,IAAI,6BAAmB,CAAC;QACvC,IAAI;KACL,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACrC,IAAI,OAAO,QAAQ,CAAC,qBAAqB,KAAK,QAAQ,EAAE,CAAC;QACvD,MAAM,IAAI,uBAAS,CACjB,iBAAiB,IAAI,IAAI,EAAE,+BAA+B,CAC3D,CAAC;IACJ,CAAC;IACD,OAAO,IAAA,+BAAqB,EAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;AAC/D,CAAC;AAED,SAAgB,qBAAqB,CAAC,IAAY,EAAE,IAAa;IAC/D,OAAO,0BAA0B,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { UserError } from '@openai/agents-core';
|
|
2
|
+
import { normalizeRelativePath, SandboxPathResolutionError, WorkspacePathPolicy, } from '@openai/agents-core/sandbox';
|
|
3
|
+
import { posixDirname, shellQuote } from '@openai/agents-core/sandbox/internal';
|
|
4
|
+
export { posixDirname, shellQuote };
|
|
5
|
+
const RESOLVE_WORKSPACE_PATH_HELPER = String.raw `#!/bin/sh
|
|
6
|
+
set -eu
|
|
7
|
+
|
|
8
|
+
root="$1"
|
|
9
|
+
candidate="$2"
|
|
10
|
+
for_write="$3"
|
|
11
|
+
shift 3
|
|
12
|
+
max_symlink_depth=64
|
|
13
|
+
|
|
14
|
+
case "$for_write" in
|
|
15
|
+
0|1) ;;
|
|
16
|
+
*) printf 'for_write must be 0 or 1: %s\n' "$for_write" >&2; exit 64 ;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
if [ $(( $# % 2 )) -ne 0 ]; then
|
|
20
|
+
printf 'extra path grants must be root/read_only pairs\n' >&2
|
|
21
|
+
exit 64
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
resolve_path() {
|
|
25
|
+
path="$1"
|
|
26
|
+
depth="$2"
|
|
27
|
+
seen=""
|
|
28
|
+
if [ "$#" -ge 3 ]; then
|
|
29
|
+
seen="$3"
|
|
30
|
+
fi
|
|
31
|
+
if [ "$path" = "/" ]; then
|
|
32
|
+
printf '/\n'
|
|
33
|
+
return 0
|
|
34
|
+
fi
|
|
35
|
+
if [ "$depth" -ge "$max_symlink_depth" ]; then
|
|
36
|
+
printf 'symlink resolution depth exceeded: %s\n' "$path" >&2
|
|
37
|
+
exit 112
|
|
38
|
+
fi
|
|
39
|
+
if [ -d "$path" ]; then
|
|
40
|
+
(cd "$path" && pwd -P)
|
|
41
|
+
return 0
|
|
42
|
+
fi
|
|
43
|
+
parent=$(dirname "$path")
|
|
44
|
+
base=$(basename "$path")
|
|
45
|
+
if [ -z "$parent" ] || [ "$parent" = "$path" ]; then
|
|
46
|
+
parent="/"
|
|
47
|
+
fi
|
|
48
|
+
resolved_parent=$(resolve_path "$parent" "$depth" "$seen")
|
|
49
|
+
candidate_path=$(join_child_path "$resolved_parent" "$base")
|
|
50
|
+
if [ -L "$candidate_path" ]; then
|
|
51
|
+
case ":$seen:" in
|
|
52
|
+
*":$candidate_path:"*)
|
|
53
|
+
printf 'symlink resolution depth exceeded: %s\n' "$candidate_path" >&2
|
|
54
|
+
exit 112
|
|
55
|
+
;;
|
|
56
|
+
esac
|
|
57
|
+
target=$(readlink "$candidate_path")
|
|
58
|
+
next_depth=$((depth + 1))
|
|
59
|
+
next_seen="$seen:$candidate_path"
|
|
60
|
+
case "$target" in
|
|
61
|
+
/*) resolve_path "$target" "$next_depth" "$next_seen" ;;
|
|
62
|
+
*)
|
|
63
|
+
relative_target=$(join_child_path "$resolved_parent" "$target")
|
|
64
|
+
resolve_path "$relative_target" "$next_depth" "$next_seen"
|
|
65
|
+
;;
|
|
66
|
+
esac
|
|
67
|
+
return 0
|
|
68
|
+
fi
|
|
69
|
+
printf '%s\n' "$candidate_path"
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
join_child_path() {
|
|
73
|
+
parent="$1"
|
|
74
|
+
child="$2"
|
|
75
|
+
if [ "$parent" = "/" ]; then
|
|
76
|
+
printf '/%s\n' "$child"
|
|
77
|
+
else
|
|
78
|
+
printf '%s/%s\n' "$parent" "$child"
|
|
79
|
+
fi
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
resolved_candidate=$(resolve_path "$candidate" 0)
|
|
83
|
+
best_grant_root=""
|
|
84
|
+
best_grant_original=""
|
|
85
|
+
best_grant_read_only="0"
|
|
86
|
+
best_grant_len=0
|
|
87
|
+
|
|
88
|
+
check_workspace_root() {
|
|
89
|
+
resolved_root=$(resolve_path "$root" 0)
|
|
90
|
+
if [ "$resolved_root" = "/" ]; then
|
|
91
|
+
case "$resolved_candidate" in
|
|
92
|
+
/*)
|
|
93
|
+
printf '%s\n' "$resolved_candidate"
|
|
94
|
+
exit 0
|
|
95
|
+
;;
|
|
96
|
+
esac
|
|
97
|
+
fi
|
|
98
|
+
case "$resolved_candidate" in
|
|
99
|
+
"$resolved_root"|"$resolved_root"/*)
|
|
100
|
+
printf '%s\n' "$resolved_candidate"
|
|
101
|
+
exit 0
|
|
102
|
+
;;
|
|
103
|
+
esac
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
consider_extra_grant() {
|
|
107
|
+
allowed_root="$1"
|
|
108
|
+
read_only="$2"
|
|
109
|
+
case "$read_only" in
|
|
110
|
+
0|1) ;;
|
|
111
|
+
*) printf 'extra path grant read_only must be 0 or 1: %s\n' "$read_only" >&2; exit 64 ;;
|
|
112
|
+
esac
|
|
113
|
+
resolved_root=$(resolve_path "$allowed_root" 0)
|
|
114
|
+
if [ "$resolved_root" = "/" ]; then
|
|
115
|
+
printf 'extra path grant must not resolve to filesystem root: %s\n' "$allowed_root" >&2
|
|
116
|
+
exit 113
|
|
117
|
+
fi
|
|
118
|
+
case "$resolved_candidate" in
|
|
119
|
+
"$resolved_root"|"$resolved_root"/*)
|
|
120
|
+
root_len=$(printf '%s' "$resolved_root" | wc -c | tr -d ' ')
|
|
121
|
+
if [ "$root_len" -gt "$best_grant_len" ]; then
|
|
122
|
+
best_grant_root="$resolved_root"
|
|
123
|
+
best_grant_original="$allowed_root"
|
|
124
|
+
best_grant_read_only="$read_only"
|
|
125
|
+
best_grant_len="$root_len"
|
|
126
|
+
fi
|
|
127
|
+
;;
|
|
128
|
+
esac
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
while [ "$#" -gt 0 ]; do
|
|
132
|
+
consider_extra_grant "$1" "$2"
|
|
133
|
+
shift 2
|
|
134
|
+
done
|
|
135
|
+
|
|
136
|
+
check_workspace_root
|
|
137
|
+
if [ -n "$best_grant_root" ]; then
|
|
138
|
+
if [ "$for_write" = "1" ] && [ "$best_grant_read_only" = "1" ]; then
|
|
139
|
+
printf 'read-only extra path grant: %s\nresolved path: %s\n' "$best_grant_original" "$resolved_candidate" >&2
|
|
140
|
+
exit 114
|
|
141
|
+
fi
|
|
142
|
+
printf '%s\n' "$resolved_candidate"
|
|
143
|
+
exit 0
|
|
144
|
+
fi
|
|
145
|
+
|
|
146
|
+
printf 'workspace escape: %s\n' "$resolved_candidate" >&2
|
|
147
|
+
exit 111`;
|
|
148
|
+
function createRemotePathHelperId() {
|
|
149
|
+
const crypto = globalThis
|
|
150
|
+
.crypto;
|
|
151
|
+
if (typeof crypto?.randomUUID === 'function') {
|
|
152
|
+
return crypto.randomUUID();
|
|
153
|
+
}
|
|
154
|
+
if (typeof crypto?.getRandomValues === 'function') {
|
|
155
|
+
return Array.from(crypto.getRandomValues(new Uint32Array(4)), (value) => value.toString(36)).join('-');
|
|
156
|
+
}
|
|
157
|
+
return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
158
|
+
}
|
|
159
|
+
export function resolveSandboxAbsolutePath(root, path, options = {}) {
|
|
160
|
+
return new WorkspacePathPolicy({
|
|
161
|
+
root,
|
|
162
|
+
extraPathGrants: options.extraPathGrants,
|
|
163
|
+
}).resolve(path, { forWrite: options.forWrite }).path;
|
|
164
|
+
}
|
|
165
|
+
export async function validateRemoteSandboxPath({ root, path, options = {}, runCommand, }) {
|
|
166
|
+
const candidate = resolveSandboxAbsolutePath(root, path, options);
|
|
167
|
+
const helperDir = `/tmp/openai-agents-resolve-path-${createRemotePathHelperId()}`;
|
|
168
|
+
const helperArgs = [
|
|
169
|
+
root,
|
|
170
|
+
candidate,
|
|
171
|
+
options.forWrite ? '1' : '0',
|
|
172
|
+
...(options.extraPathGrants ?? []).flatMap((grant) => [
|
|
173
|
+
grant.path,
|
|
174
|
+
grant.readOnly ? '1' : '0',
|
|
175
|
+
]),
|
|
176
|
+
];
|
|
177
|
+
const command = [
|
|
178
|
+
`helper_dir=${shellQuote(helperDir)}`,
|
|
179
|
+
'helper_path="$helper_dir/resolve-workspace-path.sh"',
|
|
180
|
+
'cleanup() { rm -rf "$helper_dir"; }',
|
|
181
|
+
'trap cleanup EXIT HUP INT TERM',
|
|
182
|
+
'umask 077',
|
|
183
|
+
'mkdir "$helper_dir" || exit 125',
|
|
184
|
+
'cat > "$helper_path" <<\'OPENAI_AGENTS_RESOLVE_PATH\'',
|
|
185
|
+
RESOLVE_WORKSPACE_PATH_HELPER,
|
|
186
|
+
'OPENAI_AGENTS_RESOLVE_PATH',
|
|
187
|
+
`sh "$helper_path" ${helperArgs.map(shellQuote).join(' ')}`,
|
|
188
|
+
].join('\n');
|
|
189
|
+
const result = await runCommand(command);
|
|
190
|
+
if (result.status !== 0) {
|
|
191
|
+
const message = (result.stderr ||
|
|
192
|
+
result.stdout ||
|
|
193
|
+
'remote validation failed')
|
|
194
|
+
.trim()
|
|
195
|
+
.split(/\r?\n/u)
|
|
196
|
+
.join('; ');
|
|
197
|
+
throw new SandboxPathResolutionError(`Sandbox path "${path ?? ''}" failed remote validation: ${message}`, {
|
|
198
|
+
root,
|
|
199
|
+
path: path ?? '',
|
|
200
|
+
forWrite: options.forWrite ?? false,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
const resolvedPath = result.stdout?.trim().split(/\r?\n/u).pop();
|
|
204
|
+
if (!resolvedPath?.startsWith('/')) {
|
|
205
|
+
throw new SandboxPathResolutionError(`Sandbox path "${path ?? ''}" failed remote validation: validator did not return an absolute resolved path.`, {
|
|
206
|
+
root,
|
|
207
|
+
path: path ?? '',
|
|
208
|
+
forWrite: options.forWrite ?? false,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
return resolvedPath;
|
|
212
|
+
}
|
|
213
|
+
export async function validateRemoteSandboxPathForManifest({ manifest, path, options = {}, runCommand, }) {
|
|
214
|
+
return await validateRemoteSandboxPath({
|
|
215
|
+
root: manifest.root,
|
|
216
|
+
path,
|
|
217
|
+
options: {
|
|
218
|
+
...options,
|
|
219
|
+
extraPathGrants: manifest.extraPathGrants,
|
|
220
|
+
},
|
|
221
|
+
runCommand,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
export function resolveSandboxRelativePath(root, path) {
|
|
225
|
+
const resolved = new WorkspacePathPolicy({
|
|
226
|
+
root,
|
|
227
|
+
}).resolve(path, { forWrite: true });
|
|
228
|
+
if (typeof resolved.workspaceRelativePath !== 'string') {
|
|
229
|
+
throw new UserError(`Sandbox path "${path ?? ''}" escapes the workspace root.`);
|
|
230
|
+
}
|
|
231
|
+
return normalizeRelativePath(resolved.workspaceRelativePath);
|
|
232
|
+
}
|
|
233
|
+
export function resolveSandboxWorkdir(root, path) {
|
|
234
|
+
return resolveSandboxAbsolutePath(root, path);
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=paths.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.mjs","sourceRoot":"","sources":["../../../src/sandbox/shared/paths.ts"],"names":[],"mappings":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IACrC,IAAI,OAAO,QAAQ,CAAC,qBAAqB,KAAK,QAAQ,EAAE,CAAC;QACvD,MAAM,IAAI,SAAS,CACjB,iBAAiB,IAAI,IAAI,EAAE,+BAA+B,CAC3D,CAAC;IACJ,CAAC;IACD,OAAO,qBAAqB,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAY,EAAE,IAAa;IAC/D,OAAO,0BAA0B,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ExposedPortEndpoint, type SandboxSessionState } from '@openai/agents-core/sandbox';
|
|
2
|
+
export declare function assertConfiguredExposedPort(args: {
|
|
3
|
+
providerName: string;
|
|
4
|
+
port: number;
|
|
5
|
+
configuredPorts?: number[];
|
|
6
|
+
allowOnDemand?: boolean;
|
|
7
|
+
}): number;
|
|
8
|
+
export declare function getCachedExposedPortEndpoint(state: SandboxSessionState, port: number): ExposedPortEndpoint | undefined;
|
|
9
|
+
export declare function recordResolvedExposedPortEndpoint(state: SandboxSessionState, requestedPort: number, endpoint: ExposedPortEndpoint): ExposedPortEndpoint;
|
|
10
|
+
export declare function parseExposedPortEndpoint(value: string, args: {
|
|
11
|
+
providerName: string;
|
|
12
|
+
source: string;
|
|
13
|
+
query?: string;
|
|
14
|
+
}): ExposedPortEndpoint;
|