@yeaft/webchat-agent 1.0.620 → 1.0.622
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/local-runtime/server/handlers/client-workbench.js +1 -0
- package/local-runtime/server/workbench-correlation.js +2 -0
- package/local-runtime/server/workbench-preview.js +7 -0
- package/local-runtime/version.json +1 -1
- package/local-runtime/web/app.bundle.js +133 -128
- package/local-runtime/web/app.bundle.js.gz +0 -0
- package/local-runtime/web/index.html +2 -2
- package/local-runtime/web/style.bundle.css +1 -1
- package/local-runtime/web/style.bundle.css.gz +0 -0
- package/package.json +1 -1
- package/workbench/file-ops.js +19 -11
|
Binary file
|
package/package.json
CHANGED
package/workbench/file-ops.js
CHANGED
|
@@ -37,14 +37,22 @@ async function validateResponseImagePath(filePath, workDir) {
|
|
|
37
37
|
return canonicalFile;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Explicit Files actions operate on Agent-local paths, not just the Session cwd.
|
|
42
|
+
* WorkItem routes remain confined to their Agent-resolved workspace; automatic
|
|
43
|
+
* response image reads use the separate canonicalWorkspaceReadPath check above.
|
|
44
|
+
*/
|
|
45
|
+
async function canonicalWorkbenchReadPath(msg, filePath, workDir) {
|
|
46
|
+
const resolved = await resolveWorkItemPath(msg, filePath, workDir);
|
|
47
|
+
// Old preview capabilities predate explicit external reads. Preserve their
|
|
48
|
+
// original workspace boundary on cache refills, without an image-only check.
|
|
49
|
+
return msg.workspaceBoundPreview === true
|
|
50
|
+
? canonicalWorkspaceReadPath(resolved, workDir)
|
|
51
|
+
: realpath(resolved);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function canonicalVideoFile(msg, filePath, workDir) {
|
|
55
|
+
const resolved = await canonicalWorkbenchReadPath(msg, filePath, workDir);
|
|
48
56
|
const mimeType = VIDEO_EXTENSIONS[extname(resolved).toLowerCase()];
|
|
49
57
|
if (!mimeType) throw new Error('Unsupported video format.');
|
|
50
58
|
return { resolved, mimeType };
|
|
@@ -53,7 +61,7 @@ async function canonicalVideoFile(filePath, workDir) {
|
|
|
53
61
|
export async function handleVideoMetadata(msg) {
|
|
54
62
|
const { conversationId, filePath, requestId, _requestUserId, _requestClientId } = msg;
|
|
55
63
|
try {
|
|
56
|
-
const { resolved, mimeType } = await canonicalVideoFile(filePath, msg.workDir || ctx.CONFIG.workDir);
|
|
64
|
+
const { resolved, mimeType } = await canonicalVideoFile(msg, filePath, msg.workDir || ctx.conversations.get(conversationId)?.workDir || ctx.CONFIG.workDir);
|
|
57
65
|
const handle = await open(resolved, 'r');
|
|
58
66
|
try {
|
|
59
67
|
const fileStat = await handle.stat();
|
|
@@ -79,7 +87,7 @@ export async function handleVideoChunk(msg) {
|
|
|
79
87
|
const { conversationId, filePath, requestId, _requestUserId, _requestClientId } = msg;
|
|
80
88
|
let handle;
|
|
81
89
|
try {
|
|
82
|
-
const { resolved, mimeType } = await canonicalVideoFile(filePath, msg.workDir || ctx.CONFIG.workDir);
|
|
90
|
+
const { resolved, mimeType } = await canonicalVideoFile(msg, filePath, msg.workDir || ctx.conversations.get(conversationId)?.workDir || ctx.CONFIG.workDir);
|
|
83
91
|
handle = await open(resolved, 'r');
|
|
84
92
|
const fileStat = await handle.stat();
|
|
85
93
|
if (!fileStat.isFile() || !Number.isSafeInteger(fileStat.size)) throw new Error('Video path is not a supported file.');
|
|
@@ -183,7 +191,7 @@ export async function handleReadFile(msg) {
|
|
|
183
191
|
try {
|
|
184
192
|
const resolved = msg.responseImagePreview
|
|
185
193
|
? await validateResponseImagePath(filePath, workDir)
|
|
186
|
-
: await
|
|
194
|
+
: await canonicalWorkbenchReadPath(msg, filePath, workDir);
|
|
187
195
|
const ext = extname(resolved).toLowerCase();
|
|
188
196
|
if (VIDEO_EXTENSIONS[ext]) {
|
|
189
197
|
const error = new Error('Video files require the Workbench streaming protocol.');
|