plugin-agent-orchestrator 1.0.19 → 1.0.20

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.
@@ -170,21 +170,21 @@ class SkillHubSubFeature {
170
170
  return;
171
171
  }
172
172
  const rawStorageId = attachment.get("storageId") || attachment.storageId;
173
+ let matchedKey = null;
173
174
  if (rawStorageId) {
174
175
  const strId = String(rawStorageId);
175
- let matchedKey = null;
176
176
  for (const key of fileManager.storagesCache.keys()) {
177
177
  if (String(key) === strId) {
178
178
  matchedKey = key;
179
179
  break;
180
180
  }
181
181
  }
182
- if (matchedKey !== null) {
183
- attachment.set("storageId", matchedKey);
184
- attachment.storageId = matchedKey;
185
- }
186
182
  }
187
- const streamData = await fileManager.getFileStream(attachment);
183
+ const attachmentObj = typeof attachment.toJSON === "function" ? attachment.toJSON() : { ...attachment };
184
+ if (matchedKey !== null) {
185
+ attachmentObj.storageId = matchedKey;
186
+ }
187
+ const streamData = await fileManager.getFileStream(attachmentObj);
188
188
  if (!streamData || !streamData.stream) {
189
189
  this.app.logger.warn(
190
190
  `[skill-hub] Could not get file stream for attachment ${attachment.get("id")}`
@@ -164,22 +164,22 @@ class SkillExecutionTask {
164
164
  const attachment = await this.app.db.getRepository("attachments").findOne({ filter: { id: fileId } });
165
165
  if (fmPlugin && attachment) {
166
166
  const rawStorageId = attachment.get("storageId") || attachment.storageId;
167
+ let matchedKey = null;
167
168
  if (rawStorageId) {
168
169
  const strId = String(rawStorageId);
169
- let matchedKey = null;
170
170
  for (const key of fmPlugin.storagesCache.keys()) {
171
171
  if (String(key) === strId) {
172
172
  matchedKey = key;
173
173
  break;
174
174
  }
175
175
  }
176
- if (matchedKey !== null) {
177
- attachment.set("storageId", matchedKey);
178
- attachment.storageId = matchedKey;
179
- }
176
+ }
177
+ const attachmentObj = typeof attachment.toJSON === "function" ? attachment.toJSON() : { ...attachment };
178
+ if (matchedKey !== null) {
179
+ attachmentObj.storageId = matchedKey;
180
180
  }
181
181
  try {
182
- const streamData = await fmPlugin.getFileStream(attachment);
182
+ const streamData = await fmPlugin.getFileStream(attachmentObj);
183
183
  if (streamData == null ? void 0 : streamData.stream) {
184
184
  const tempZipPath = require("path").resolve(require("os").tmpdir(), `skill_${Date.now()}_exec.zip`);
185
185
  await new Promise((resolve2, reject) => {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "代理协调器",
5
5
  "displayName.vi-VN": "Điều phối Agent",
6
6
  "description": "Hierarchical Multi-Agent orchestration for NocoBase AI Employees. Enables Leader agents to delegate tasks to Sub-Agent employees without modifying core plugin-ai.",
7
- "version": "1.0.19",
7
+ "version": "1.0.20",
8
8
  "license": "Apache-2.0",
9
9
  "main": "dist/server/index.js",
10
10
  "keywords": [
@@ -154,22 +154,23 @@ export class SkillHubSubFeature {
154
154
  }
155
155
 
156
156
  const rawStorageId = attachment.get('storageId') || attachment.storageId;
157
+ let matchedKey = null;
157
158
  if (rawStorageId) {
158
159
  const strId = String(rawStorageId);
159
- let matchedKey = null;
160
160
  for (const key of fileManager.storagesCache.keys()) {
161
161
  if (String(key) === strId) {
162
162
  matchedKey = key;
163
163
  break;
164
164
  }
165
165
  }
166
- if (matchedKey !== null) {
167
- attachment.set('storageId', matchedKey);
168
- attachment.storageId = matchedKey;
169
- }
170
166
  }
171
167
 
172
- const streamData = await fileManager.getFileStream(attachment);
168
+ const attachmentObj = typeof attachment.toJSON === 'function' ? attachment.toJSON() : { ...attachment };
169
+ if (matchedKey !== null) {
170
+ attachmentObj.storageId = matchedKey;
171
+ }
172
+
173
+ const streamData = await fileManager.getFileStream(attachmentObj);
173
174
  if (!streamData || !streamData.stream) {
174
175
  (this as any).app.logger.warn(
175
176
  `[skill-hub] Could not get file stream for attachment ${attachment.get('id')}`,
@@ -173,22 +173,24 @@ export class SkillExecutionTask {
173
173
  const attachment = await (this as any).app.db.getRepository('attachments').findOne({ filter: { id: fileId } });
174
174
  if (fmPlugin && attachment) {
175
175
  const rawStorageId = attachment.get('storageId') || attachment.storageId;
176
+ let matchedKey = null;
176
177
  if (rawStorageId) {
177
178
  const strId = String(rawStorageId);
178
- let matchedKey = null;
179
179
  for (const key of fmPlugin.storagesCache.keys()) {
180
180
  if (String(key) === strId) {
181
181
  matchedKey = key;
182
182
  break;
183
183
  }
184
184
  }
185
- if (matchedKey !== null) {
186
- attachment.set('storageId', matchedKey);
187
- attachment.storageId = matchedKey;
188
- }
189
185
  }
186
+
187
+ const attachmentObj = typeof attachment.toJSON === 'function' ? attachment.toJSON() : { ...attachment };
188
+ if (matchedKey !== null) {
189
+ attachmentObj.storageId = matchedKey;
190
+ }
191
+
190
192
  try {
191
- const streamData = await fmPlugin.getFileStream(attachment);
193
+ const streamData = await fmPlugin.getFileStream(attachmentObj);
192
194
  if (streamData?.stream) {
193
195
  const tempZipPath = require('path').resolve(require('os').tmpdir(), `skill_${Date.now()}_exec.zip`);
194
196
  await new Promise((resolve, reject) => {