@canonmsg/agent-sdk 10.2.0 → 10.2.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.
Files changed (2) hide show
  1. package/dist/media.js +2 -6
  2. package/package.json +2 -2
package/dist/media.js CHANGED
@@ -4,7 +4,7 @@ import { mkdir, open, rename, stat, unlink } from 'node:fs/promises';
4
4
  import { basename, dirname, extname, join } from 'node:path';
5
5
  import { Readable, Transform } from 'node:stream';
6
6
  import { pipeline } from 'node:stream/promises';
7
- import { CANON_DIR, renderCanonHostInboundContent, } from '@canonmsg/core';
7
+ import { CANON_DIR, renderCanonHostInboundContent, sanitizeDownloadFileName, } from '@canonmsg/core';
8
8
  import { BoundedFileReadError, readBoundedRegularFileHandle, } from './bounded-file-read.js';
9
9
  const ANTHROPIC_IMAGE_MIME_TYPES = new Set([
10
10
  'image/jpeg',
@@ -65,10 +65,6 @@ function sanitizeSegment(value, fallback) {
65
65
  const sanitized = value.replace(/[^a-zA-Z0-9._-]+/g, '-').replace(/^-+|-+$/g, '');
66
66
  return sanitized || fallback;
67
67
  }
68
- function sanitizeFileName(fileName, fallback) {
69
- const sanitized = basename(fileName).replace(/[^a-zA-Z0-9._-]+/g, '_');
70
- return sanitized || fallback;
71
- }
72
68
  function inferExtension(input) {
73
69
  const explicitExtension = extname(input.attachment.fileName ?? '').toLowerCase();
74
70
  if (explicitExtension) {
@@ -94,7 +90,7 @@ function buildCachePath(input) {
94
90
  });
95
91
  const fallbackName = `${input.attachment.kind}-${input.index}${extension}`;
96
92
  const preferredName = input.attachment.fileName
97
- ? sanitizeFileName(input.attachment.fileName, fallbackName)
93
+ ? sanitizeDownloadFileName(input.attachment.fileName, fallbackName)
98
94
  : fallbackName;
99
95
  const fileName = extname(preferredName) ? preferredName : `${preferredName}${extension}`;
100
96
  return join(rootDir, sanitizeSegment(input.agentId, 'agent'), sanitizeSegment(input.conversationId, 'conversation'), sanitizeSegment(input.messageId, 'message'), `${String(input.index).padStart(2, '0')}-${fileName}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonmsg/agent-sdk",
3
- "version": "10.2.0",
3
+ "version": "10.2.1",
4
4
  "description": "Canon Agent SDK — build AI agents that participate in Canon conversations",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -28,7 +28,7 @@
28
28
  "node": ">=18.0.0"
29
29
  },
30
30
  "dependencies": {
31
- "@canonmsg/core": "^12.2.0"
31
+ "@canonmsg/core": "^12.3.0"
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public"