experimental-ash 0.3.0-alpha.11 → 0.3.0-alpha.12
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/src/harness/attachment-staging.d.ts +9 -2
- package/dist/src/harness/attachment-staging.d.ts.map +1 -1
- package/dist/src/harness/attachment-staging.js +15 -3
- package/dist/src/harness/attachment-staging.js.map +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/package.json +1 -1
|
@@ -8,13 +8,20 @@ import type { SandboxSession } from "../public/definitions/sandbox.js";
|
|
|
8
8
|
export declare const ATTACHMENTS_ROOT = "/workspace/attachments";
|
|
9
9
|
/**
|
|
10
10
|
* Writes every `FilePart` carried on the inbound turn message into the
|
|
11
|
-
* agent's sandbox
|
|
12
|
-
* backend-native path
|
|
11
|
+
* agent's sandbox, rewrites each part's `filename` to the resolved
|
|
12
|
+
* backend-native path, and replaces `data` with the resolved bytes so
|
|
13
|
+
* the provider receives the file inline.
|
|
13
14
|
*
|
|
14
15
|
* The model receives the file inline (for multimodal providers) *and*
|
|
15
16
|
* sees a concrete sandbox path it can pass verbatim to `read_file`,
|
|
16
17
|
* `bash`, or custom file tools — one write, two consumption paths.
|
|
17
18
|
*
|
|
19
|
+
* Opaque `data` shapes (channel attachment refs like
|
|
20
|
+
* `ash-attachment:`, data URLs, bare base64 strings) are resolved to
|
|
21
|
+
* `Buffer` bytes before handoff so downstream providers never see a
|
|
22
|
+
* scheme they cannot fetch. Remote `http(s):` URLs are left intact —
|
|
23
|
+
* the provider fetches those directly.
|
|
24
|
+
*
|
|
18
25
|
* Addressing is SHA-prefixed to dedupe across turns and sessions. The
|
|
19
26
|
* human-supplied filename (when present) is preserved as the on-disk
|
|
20
27
|
* basename after sanitization so the model output references the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-staging.d.ts","sourceRoot":"","sources":["../../../src/harness/attachment-staging.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAY,WAAW,EAAE,MAAM,IAAI,CAAC;AAKhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,2BAA2B,CAAC;AAKzD
|
|
1
|
+
{"version":3,"file":"attachment-staging.d.ts","sourceRoot":"","sources":["../../../src/harness/attachment-staging.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAY,WAAW,EAAE,MAAM,IAAI,CAAC;AAKhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,2BAA2B,CAAC;AAKzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,MAAM,GAAG,WAAW,EAC7B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,MAAM,GAAG,WAAW,CAAC,CAa/B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,MAAM,GAAG,WAAW,GAC5B,OAAO,CAAC,MAAM,GAAG,WAAW,CAAC,CAsB/B"}
|
|
@@ -13,13 +13,20 @@ const UNSAFE_FILENAME_CHARS = /[^\w.-]+/g;
|
|
|
13
13
|
const SHA_PREFIX_LENGTH = 16;
|
|
14
14
|
/**
|
|
15
15
|
* Writes every `FilePart` carried on the inbound turn message into the
|
|
16
|
-
* agent's sandbox
|
|
17
|
-
* backend-native path
|
|
16
|
+
* agent's sandbox, rewrites each part's `filename` to the resolved
|
|
17
|
+
* backend-native path, and replaces `data` with the resolved bytes so
|
|
18
|
+
* the provider receives the file inline.
|
|
18
19
|
*
|
|
19
20
|
* The model receives the file inline (for multimodal providers) *and*
|
|
20
21
|
* sees a concrete sandbox path it can pass verbatim to `read_file`,
|
|
21
22
|
* `bash`, or custom file tools — one write, two consumption paths.
|
|
22
23
|
*
|
|
24
|
+
* Opaque `data` shapes (channel attachment refs like
|
|
25
|
+
* `ash-attachment:`, data URLs, bare base64 strings) are resolved to
|
|
26
|
+
* `Buffer` bytes before handoff so downstream providers never see a
|
|
27
|
+
* scheme they cannot fetch. Remote `http(s):` URLs are left intact —
|
|
28
|
+
* the provider fetches those directly.
|
|
29
|
+
*
|
|
23
30
|
* Addressing is SHA-prefixed to dedupe across turns and sessions. The
|
|
24
31
|
* human-supplied filename (when present) is preserved as the on-disk
|
|
25
32
|
* basename after sanitization so the model output references the
|
|
@@ -101,7 +108,12 @@ async function stageFilePart(part, sandbox) {
|
|
|
101
108
|
const authored = `${ATTACHMENTS_ROOT}/${sha}/${name}`;
|
|
102
109
|
await sandbox.writeFile(authored, bytes);
|
|
103
110
|
const resolvedPath = sandbox.resolvePath(authored);
|
|
104
|
-
|
|
111
|
+
// Replace `data` with the resolved bytes so downstream providers
|
|
112
|
+
// always see inline bytes rather than an opaque channel-scoped URL
|
|
113
|
+
// scheme (e.g. `ash-attachment:`). The AI SDK gateway rejects
|
|
114
|
+
// unfamiliar schemes, so handing it a `Buffer` is the only safe
|
|
115
|
+
// shape for staged attachments.
|
|
116
|
+
return { ...part, data: bytes, filename: resolvedPath };
|
|
105
117
|
}
|
|
106
118
|
function sha256Prefix(bytes) {
|
|
107
119
|
return createHash("sha256").update(bytes).digest("hex").slice(0, SHA_PREFIX_LENGTH);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-staging.js","sourceRoot":"","sources":["../../../src/harness/attachment-staging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAGrC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAGlE;;;;GAIG;AACH,MAAM,CAAC,MA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AAK,CAAC,CAAC;IACzC,MAAM,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACnD,iEAAiE;IACjE,mEAAmE;IACnE,8DAA8D;IAC9D,gEAAgE;IAChE,gCAAgC;IAChC,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AAC1D,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC;AACtF,CAAC;AAED,SAAS,YAAY,CAAC,QAA4B,EAAE,GAAW;IAC7D,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,QAAQ,GAAG,EAAE,CAAC;IACvB,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;IACpE,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,GAAG,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -7,7 +7,7 @@ let cachedPackageInfo;
|
|
|
7
7
|
let cachedWorkflowPackageRoot;
|
|
8
8
|
// The package build stamps the published version into `dist` so bundled
|
|
9
9
|
// deployments can still report package metadata without resolving package.json.
|
|
10
|
-
const BUNDLED_FALLBACK_PACKAGE_VERSION = "0.3.0-alpha.
|
|
10
|
+
const BUNDLED_FALLBACK_PACKAGE_VERSION = "0.3.0-alpha.12";
|
|
11
11
|
const BUNDLED_FALLBACK_PACKAGE_VERSION_PLACEHOLDER = "__ASH_PACKAGE_VERSION_PLACEHOLDER__";
|
|
12
12
|
const WORKFLOW_DEFAULT_EXPORT_PATHS = {
|
|
13
13
|
workflow: ["dist", "index.js"],
|