dooers-agents-client 0.6.0 → 0.8.0

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/main.cjs CHANGED
@@ -239,12 +239,31 @@ function toWireContentPart(p) {
239
239
  switch (p.type) {
240
240
  case "text":
241
241
  return { type: "text", text: p.text };
242
- case "audio":
243
- return { type: "audio", ref_id: p.refId, duration: p.duration };
244
- case "image":
245
- return { type: "image", ref_id: p.refId };
246
- case "document":
247
- return { type: "document", ref_id: p.refId };
242
+ case "audio": {
243
+ const w = {
244
+ type: "audio",
245
+ ref_id: p.refId
246
+ };
247
+ if (p.duration != null) w.duration = p.duration;
248
+ if (p.url) w.url = p.url;
249
+ return w;
250
+ }
251
+ case "image": {
252
+ const w = {
253
+ type: "image",
254
+ ref_id: p.refId
255
+ };
256
+ if (p.url) w.url = p.url;
257
+ return w;
258
+ }
259
+ case "document": {
260
+ const w = {
261
+ type: "document",
262
+ ref_id: p.refId
263
+ };
264
+ if (p.url) w.url = p.url;
265
+ return w;
266
+ }
248
267
  }
249
268
  }
250
269
 
@@ -383,6 +402,9 @@ var AgentClient = class {
383
402
  }
384
403
  const formData = new FormData();
385
404
  formData.append("file", file);
405
+ if (this.agentId) {
406
+ formData.append("agent_id", this.agentId);
407
+ }
386
408
  const headers = {};
387
409
  if (this.config.authToken) {
388
410
  headers.Authorization = `Bearer ${this.config.authToken}`;
@@ -400,7 +422,8 @@ var AgentClient = class {
400
422
  refId: result.ref_id,
401
423
  mimeType: result.mime_type,
402
424
  filename: result.filename,
403
- sizeBytes: result.size_bytes
425
+ sizeBytes: result.size_bytes ?? result.size ?? 0,
426
+ publicUrl: result.public_url ?? void 0
404
427
  };
405
428
  }
406
429
  connect(url, agentId, config) {