@ours.network/fleet 0.13.1 → 0.13.2
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.
|
@@ -88,6 +88,16 @@ function parseTranscription(value, wireId) {
|
|
|
88
88
|
fileWireId: wireId,
|
|
89
89
|
} };
|
|
90
90
|
}
|
|
91
|
+
// Voice notes ride "<base>; x-ours-kind=voice-message" verbatim end to end
|
|
92
|
+
// (the recorder's real container varies: audio/webm Chrome/Android, audio/mp4
|
|
93
|
+
// iOS Safari, audio/ogg fallback), so policy for voice messages applies to the
|
|
94
|
+
// base container type. Ordinary files keep exact allowlist matching.
|
|
95
|
+
function baseMime(mime) {
|
|
96
|
+
return mime.split(';')[0].trim();
|
|
97
|
+
}
|
|
98
|
+
function policyMime(file) {
|
|
99
|
+
return file.kind === 'voice_message' ? baseMime(file.mime) : file.mime;
|
|
100
|
+
}
|
|
91
101
|
export function validateAttachmentSelection(files, config) {
|
|
92
102
|
if (!config.enabled)
|
|
93
103
|
return 'attachments are disabled for this owner channel';
|
|
@@ -95,7 +105,10 @@ export function validateAttachmentSelection(files, config) {
|
|
|
95
105
|
return `the request exceeds the ${config.max_files_per_request}-file limit`;
|
|
96
106
|
let total = 0;
|
|
97
107
|
for (const file of files) {
|
|
98
|
-
|
|
108
|
+
const mime = policyMime(file);
|
|
109
|
+
if (file.kind === 'voice_message' && !mime.startsWith('audio/'))
|
|
110
|
+
return `voice-message MIME type ${file.mime || '(missing)'} is not an audio container`;
|
|
111
|
+
if (!config.allowed_mime.includes(mime))
|
|
99
112
|
return `MIME type ${file.mime || '(missing)'} is not allowed`;
|
|
100
113
|
if (file.size > config.max_file_bytes)
|
|
101
114
|
return `a file exceeds the ${config.max_file_bytes}-byte limit`;
|
|
@@ -148,9 +161,10 @@ export async function admitAttachments(files, dir, config) {
|
|
|
148
161
|
total += bytes.length;
|
|
149
162
|
if (total > config.max_request_bytes)
|
|
150
163
|
throw new Error('retrieved attachments exceed the request size limit');
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
164
|
+
const declaredMime = policyMime(file);
|
|
165
|
+
const detectedMime = detectMime(bytes, declaredMime);
|
|
166
|
+
if (!mimeCompatible(declaredMime, detectedMime))
|
|
167
|
+
throw new Error(`retrieved attachment content does not match declared MIME ${declaredMime}`);
|
|
154
168
|
const filename = sanitizeFilename(file.filename);
|
|
155
169
|
const finalPath = join(dir, `${index + 1}-${file.wireId.slice(0, 12)}-${filename}`);
|
|
156
170
|
const tmp = join(dir, `.${basename(finalPath)}.${randomUUID()}.tmp`);
|
|
@@ -175,7 +189,7 @@ export async function admitAttachments(files, dir, config) {
|
|
|
175
189
|
await rm(tmp, { force: true });
|
|
176
190
|
await chmod(finalPath, 0o600);
|
|
177
191
|
admitted.push({
|
|
178
|
-
wireId: file.wireId, filename, path: finalPath, declaredMime
|
|
192
|
+
wireId: file.wireId, filename, path: finalPath, declaredMime,
|
|
179
193
|
detectedMime, size: bytes.length, sha256: digest, kind: file.kind,
|
|
180
194
|
...(file.transcription ? { transcription: {
|
|
181
195
|
configured: file.transcription.configured, attempted: file.transcription.attempted,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ours.network/fleet",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"description": "Harness-agnostic fleet of persistent, identity-bound AI agents. Declarative fleet.yaml, tmux or ACP sessions, supervision, and ours.network messaging.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "FSL-1.1-Apache-2.0",
|