@agentdocumentformat/cli 0.7.6 → 0.7.7

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.
@@ -70295,9 +70295,9 @@ var DiscordAdapter = class {
70295
70295
  );
70296
70296
  continue;
70297
70297
  }
70298
- let buffer = Buffer.from(await response.arrayBuffer()), filename = att.name ?? `attachment_${att.id}`, importPath = `imported/discord/${filename}`, mimeType = att.contentType ?? "application/octet-stream";
70299
- this.ctx.writeAttachment(importPath, buffer, mimeType), attachments.push({
70300
- path: importPath,
70298
+ let buffer = Buffer.from(await response.arrayBuffer()), filename = att.name ?? `attachment_${att.id}`, importPath = `imported/discord/${filename}`, mimeType = att.contentType ?? "application/octet-stream", savedPath = this.ctx.writeAttachment(importPath, buffer, mimeType) || importPath;
70299
+ attachments.push({
70300
+ path: savedPath,
70301
70301
  filename,
70302
70302
  mimeType,
70303
70303
  size: buffer.length
@@ -58519,8 +58519,9 @@ var EmailAdapter = class {
58519
58519
  }
58520
58520
  let filename = att.filename || `attachment_${Date.now()}`, importPath = `imported/email_${safeSender}/${filename}`;
58521
58521
  try {
58522
- this.ctx.writeAttachment(importPath, att.content, att.contentType), attachments.push({
58523
- path: importPath,
58522
+ let savedPath = this.ctx.writeAttachment(importPath, att.content, att.contentType) || importPath;
58523
+ attachments.push({
58524
+ path: savedPath,
58524
58525
  filename,
58525
58526
  mimeType: att.contentType,
58526
58527
  size: att.size
@@ -7774,9 +7774,9 @@ var SlackAdapter = class {
7774
7774
  throw new Error(
7775
7775
  `got an HTML login page instead of file content \u2014 the bot token may lack the "files:read" OAuth scope ${SCOPE_FIX_HINT}`
7776
7776
  );
7777
- let buffer = Buffer.from(await response.arrayBuffer()), filename = file.name ?? `file_${file.id}`, importPath = `imported/slack/${filename}`;
7778
- this.ctx.writeAttachment(importPath, buffer, file.mimetype), attachments.push({
7779
- path: importPath,
7777
+ let buffer = Buffer.from(await response.arrayBuffer()), filename = file.name ?? `file_${file.id}`, importPath = `imported/slack/${filename}`, savedPath = this.ctx.writeAttachment(importPath, buffer, file.mimetype) || importPath;
7778
+ attachments.push({
7779
+ path: savedPath,
7780
7780
  filename,
7781
7781
  mimeType: file.mimetype ?? "application/octet-stream",
7782
7782
  size: buffer.length
@@ -14130,9 +14130,9 @@ var TelegramAdapter = class _TelegramAdapter {
14130
14130
  try {
14131
14131
  let file = await grammyCtx.api.getFile(photo.file_id);
14132
14132
  if (file.file_path) {
14133
- let url = `https://api.telegram.org/file/bot${token}/${file.file_path}`, response = await fetch(url), buffer = Buffer.from(await response.arrayBuffer()), filename = `photo_${photo.file_id}.jpg`, importPath = `imported/telegram/${filename}`;
14134
- this.ctx.writeAttachment(importPath, buffer, "image/jpeg"), attachments.push({
14135
- path: importPath,
14133
+ let url = `https://api.telegram.org/file/bot${token}/${file.file_path}`, response = await fetch(url), buffer = Buffer.from(await response.arrayBuffer()), filename = `photo_${photo.file_id}.jpg`, importPath = `imported/telegram/${filename}`, savedPath = this.ctx.writeAttachment(importPath, buffer, "image/jpeg") || importPath;
14134
+ attachments.push({
14135
+ path: savedPath,
14136
14136
  filename,
14137
14137
  mimeType: "image/jpeg",
14138
14138
  size: buffer.length
@@ -14148,9 +14148,9 @@ var TelegramAdapter = class _TelegramAdapter {
14148
14148
  try {
14149
14149
  let file = await grammyCtx.api.getFile(doc.file_id);
14150
14150
  if (file.file_path) {
14151
- let url = `https://api.telegram.org/file/bot${token}/${file.file_path}`, response = await fetch(url), buffer = Buffer.from(await response.arrayBuffer()), filename = doc.file_name ?? `doc_${doc.file_id}`, importPath = `imported/telegram/${filename}`;
14152
- this.ctx.writeAttachment(importPath, buffer, doc.mime_type), attachments.push({
14153
- path: importPath,
14151
+ let url = `https://api.telegram.org/file/bot${token}/${file.file_path}`, response = await fetch(url), buffer = Buffer.from(await response.arrayBuffer()), filename = doc.file_name ?? `doc_${doc.file_id}`, importPath = `imported/telegram/${filename}`, savedPath = this.ctx.writeAttachment(importPath, buffer, doc.mime_type) || importPath;
14152
+ attachments.push({
14153
+ path: savedPath,
14154
14154
  filename,
14155
14155
  mimeType: doc.mime_type ?? "application/octet-stream",
14156
14156
  size: buffer.length
@@ -14166,9 +14166,9 @@ var TelegramAdapter = class _TelegramAdapter {
14166
14166
  try {
14167
14167
  let file = await grammyCtx.api.getFile(voice.file_id);
14168
14168
  if (file.file_path) {
14169
- let url = `https://api.telegram.org/file/bot${token}/${file.file_path}`, response = await fetch(url), buffer = Buffer.from(await response.arrayBuffer()), filename = `voice_${voice.file_id}.ogg`, importPath = `imported/telegram/${filename}`;
14170
- this.ctx.writeAttachment(importPath, buffer, voice.mime_type ?? "audio/ogg"), attachments.push({
14171
- path: importPath,
14169
+ let url = `https://api.telegram.org/file/bot${token}/${file.file_path}`, response = await fetch(url), buffer = Buffer.from(await response.arrayBuffer()), filename = `voice_${voice.file_id}.ogg`, importPath = `imported/telegram/${filename}`, savedPath = this.ctx.writeAttachment(importPath, buffer, voice.mime_type ?? "audio/ogg") || importPath;
14170
+ attachments.push({
14171
+ path: savedPath,
14172
14172
  filename,
14173
14173
  mimeType: voice.mime_type ?? "audio/ogg",
14174
14174
  size: buffer.length
@@ -14185,9 +14185,9 @@ var TelegramAdapter = class _TelegramAdapter {
14185
14185
  try {
14186
14186
  let file = await grammyCtx.api.getFile(video.file_id);
14187
14187
  if (file.file_path) {
14188
- let url = `https://api.telegram.org/file/bot${token}/${file.file_path}`, response = await fetch(url), buffer = Buffer.from(await response.arrayBuffer()), ext = video.mime_type?.split("/")[1] ?? "mp4", filename = video.file_name ?? `video_${video.file_id}.${ext}`, importPath = `imported/telegram/${filename}`;
14189
- this.ctx.writeAttachment(importPath, buffer, video.mime_type ?? "video/mp4"), attachments.push({
14190
- path: importPath,
14188
+ let url = `https://api.telegram.org/file/bot${token}/${file.file_path}`, response = await fetch(url), buffer = Buffer.from(await response.arrayBuffer()), ext = video.mime_type?.split("/")[1] ?? "mp4", filename = video.file_name ?? `video_${video.file_id}.${ext}`, importPath = `imported/telegram/${filename}`, savedPath = this.ctx.writeAttachment(importPath, buffer, video.mime_type ?? "video/mp4") || importPath;
14189
+ attachments.push({
14190
+ path: savedPath,
14191
14191
  filename,
14192
14192
  mimeType: video.mime_type ?? "video/mp4",
14193
14193
  size: buffer.length
@@ -14204,9 +14204,9 @@ var TelegramAdapter = class _TelegramAdapter {
14204
14204
  try {
14205
14205
  let file = await grammyCtx.api.getFile(vn.file_id);
14206
14206
  if (file.file_path) {
14207
- let url = `https://api.telegram.org/file/bot${token}/${file.file_path}`, response = await fetch(url), buffer = Buffer.from(await response.arrayBuffer()), filename = `videonote_${vn.file_id}.mp4`, importPath = `imported/telegram/${filename}`;
14208
- this.ctx.writeAttachment(importPath, buffer, "video/mp4"), attachments.push({
14209
- path: importPath,
14207
+ let url = `https://api.telegram.org/file/bot${token}/${file.file_path}`, response = await fetch(url), buffer = Buffer.from(await response.arrayBuffer()), filename = `videonote_${vn.file_id}.mp4`, importPath = `imported/telegram/${filename}`, savedPath = this.ctx.writeAttachment(importPath, buffer, "video/mp4") || importPath;
14208
+ attachments.push({
14209
+ path: savedPath,
14210
14210
  filename,
14211
14211
  mimeType: "video/mp4",
14212
14212
  size: buffer.length
@@ -14223,9 +14223,9 @@ var TelegramAdapter = class _TelegramAdapter {
14223
14223
  try {
14224
14224
  let file = await grammyCtx.api.getFile(audio.file_id);
14225
14225
  if (file.file_path) {
14226
- let url = `https://api.telegram.org/file/bot${token}/${file.file_path}`, response = await fetch(url), buffer = Buffer.from(await response.arrayBuffer()), filename = audio.file_name ?? `audio_${audio.file_id}.${audio.mime_type?.split("/")[1] ?? "mp3"}`, importPath = `imported/telegram/${filename}`;
14227
- this.ctx.writeAttachment(importPath, buffer, audio.mime_type ?? "audio/mpeg"), attachments.push({
14228
- path: importPath,
14226
+ let url = `https://api.telegram.org/file/bot${token}/${file.file_path}`, response = await fetch(url), buffer = Buffer.from(await response.arrayBuffer()), filename = audio.file_name ?? `audio_${audio.file_id}.${audio.mime_type?.split("/")[1] ?? "mp3"}`, importPath = `imported/telegram/${filename}`, savedPath = this.ctx.writeAttachment(importPath, buffer, audio.mime_type ?? "audio/mpeg") || importPath;
14227
+ attachments.push({
14228
+ path: savedPath,
14229
14229
  filename,
14230
14230
  mimeType: audio.mime_type ?? "audio/mpeg",
14231
14231
  size: buffer.length
@@ -14242,9 +14242,9 @@ var TelegramAdapter = class _TelegramAdapter {
14242
14242
  try {
14243
14243
  let file = await grammyCtx.api.getFile(anim.file_id);
14244
14244
  if (file.file_path) {
14245
- let url = `https://api.telegram.org/file/bot${token}/${file.file_path}`, response = await fetch(url), buffer = Buffer.from(await response.arrayBuffer()), filename = anim.file_name ?? `animation_${anim.file_id}.mp4`, importPath = `imported/telegram/${filename}`;
14246
- this.ctx.writeAttachment(importPath, buffer, anim.mime_type ?? "video/mp4"), attachments.push({
14247
- path: importPath,
14245
+ let url = `https://api.telegram.org/file/bot${token}/${file.file_path}`, response = await fetch(url), buffer = Buffer.from(await response.arrayBuffer()), filename = anim.file_name ?? `animation_${anim.file_id}.mp4`, importPath = `imported/telegram/${filename}`, savedPath = this.ctx.writeAttachment(importPath, buffer, anim.mime_type ?? "video/mp4") || importPath;
14246
+ attachments.push({
14247
+ path: savedPath,
14248
14248
  filename,
14249
14249
  mimeType: anim.mime_type ?? "video/mp4",
14250
14250
  size: buffer.length
@@ -6,7 +6,7 @@ const __filename = __adfFileURLToPath(import.meta.url);
6
6
  const __dirname = __adfDirname(__filename);
7
7
  import {
8
8
  DaemonClient
9
- } from "./chunk-3UCKYP7P.mjs";
9
+ } from "./chunk-VN7UH7I5.mjs";
10
10
  import "./chunk-XNPZBLYL.mjs";
11
11
  import {
12
12
  cjs
@@ -119,7 +119,7 @@ ${tuiUsage()}
119
119
  ] = await Promise.all([
120
120
  import("./react-IUIDQ5LX.mjs"),
121
121
  import("./build-QF5W473T.mjs"),
122
- import("./App-U2XSNHUV.mjs"),
122
+ import("./App-5KXVPMBV.mjs"),
123
123
  import("./themes-YLXLOIJF.mjs"),
124
124
  import("./store-HUVDJPYN.mjs"),
125
125
  import("./theme-SFE3JMA2.mjs"),
@@ -85208,9 +85208,9 @@ var WhatsAppAdapter = class {
85208
85208
  let size = Number(media.size ?? 0);
85209
85209
  if (!size || size <= maxAttachmentSize)
85210
85210
  try {
85211
- let buffer = await downloadMediaMessage(msg, "buffer", {}), ext = (media.mime ?? "").split("/")[1]?.split(";")[0] ?? "bin", baseName = content.documentMessage?.fileName ?? `${media.kind}_${msg.key.id}.${ext}`, importPath = `imported/whatsapp/${baseName}`;
85212
- this.ctx.writeAttachment(importPath, buffer, media.mime ?? void 0), attachments.push({
85213
- path: importPath,
85211
+ let buffer = await downloadMediaMessage(msg, "buffer", {}), ext = (media.mime ?? "").split("/")[1]?.split(";")[0] ?? "bin", baseName = content.documentMessage?.fileName ?? `${media.kind}_${msg.key.id}.${ext}`, importPath = `imported/whatsapp/${baseName}`, savedPath = this.ctx.writeAttachment(importPath, buffer, media.mime ?? void 0) || importPath;
85212
+ attachments.push({
85213
+ path: savedPath,
85214
85214
  filename: baseName,
85215
85215
  mimeType: media.mime ?? "application/octet-stream",
85216
85216
  size: buffer.length
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentdocumentformat/cli",
3
- "version": "0.7.6",
3
+ "version": "0.7.7",
4
4
  "description": "ADF CLI: the ADF (Agent Document Format) daemon, command line and terminal app. Run your agents headless: `adf daemon`, then `adf`.",
5
5
  "type": "module",
6
6
  "bin": {