← 返回
未分类 中文

File Transfer

Transfers files intelligently based on chat context with MIME validation and progress tracking, supporting Telegram and extensible channels.
根据聊天上下文智能传输文件,支持 MIME 验证和进度跟踪,兼容 Telegram 及可扩展渠道。
ghostwritten ghostwritten 来源
未分类 clawhub v0.2.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 574
下载
💾 2
安装
1
版本
#ai-agent#context-aware#file-transfer#latest#telegram

概述

File Transfer Skill

Overview

Context-aware file transfer skill for OpenClaw ecosystem. Intelligently transfers files based on conversation context with progress tracking.

Features

  • Context-Aware: Automatically detects group/private chat and infers transfer intent
  • File Validation: MIME type checking, size limits, chunked reading
  • Telegram Support: Full adapter with progress tracking (simulated)
  • Extensible: Adapter pattern for adding new channels

Installation

npm install file-transfer

Usage

Basic File Transfer

import { FileTransferSkill } from 'file-transfer';

const skill = new FileTransferSkill({
  channels: { telegram: { enabled: true } }
});

const result = await skill.sendFileWithContext({
  file: '/path/to/document.pdf',
  caption: 'Team weekly report',
  context: { chatId: '-1003655501651' }
});

Direct Adapter Usage

import { TelegramAdapter } from 'file-transfer/src/adapters/telegram-adapter.js';

const adapter = new TelegramAdapter();
const result = await adapter.sendFile({
  filePath: '/path/to/file.pdf',
  chatId: '-1003655501651',
  caption: 'Document sharing'
});

Tool Definitions

sendFileWithContext

Transfers a file with intelligent context detection.

Parameters:

  • file (string, required): Path to the file
  • caption (string, optional): File description
  • context (object, optional): Conversation context with chatId

Returns:

  • success (boolean): Transfer success status
  • messageId (string): Message ID
  • context (object): Context analysis result (scenario, urgency, confidence)
  • stats (object): Transfer statistics (size, duration, channel)

getTransferHistory

Retrieves file transfer history.

Parameters:

  • options (object, optional): Query options

Returns:

  • history (array): Transfer history records
  • stats (object): Transfer statistics

Configuration

const skill = new FileTransferSkill({
  contextEngine: {
    enableAI: false,
    maxHistoryLength: 10
  },
  file: {
    maxFileSize: 100 * 1024 * 1024,  // 100MB
    allowedMimeTypes: ['application/pdf', 'image/jpeg', ...]
  },
  channels: {
    telegram: {
      enabled: true,
      maxFileSize: 50 * 1024 * 1024  // 50MB
    }
  }
});

Context Analysis

The ContextEngine analyzes file transfers and returns:

FieldValuesDescription
----------------------------
scenarioshare, backup, collaborate, archiveTransfer intent
urgencylow, medium, high, criticalPriority level
confidence0.0 - 1.0Analysis confidence
fileCategorydocument, image, video, archive, codeFile classification

Current Limitations

  • Telegram adapter uses simulated transfer (no real API integration yet)
  • WhatsApp and Discord adapters are planned but not implemented
  • Transfer history is not persisted

Testing

npm test                  # All tests
npm run test:unit         # Unit tests
npm run test:integration  # Integration tests

License

MIT License - see LICENSE for details.

版本历史

共 1 个版本

  • v0.2.0 当前
    2026-05-03 09:43 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

it-ops-security

Kubernetes Triage Expert

ghostwritten
仅凭用户提供的证据分析Kubernetes故障:对故障进行分类,排列假设优先级,请求最具价值的检查,并保持事实完整。
★ 0 📥 531
ai-agent

self-improving agent

pskoett
记录自身发现以实现自我改进的技能
★ 4,131 📥 902,804
ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,423 📥 326,263