發佈 0.1.8:支援傳圖/傳檔給使用者,新增連網開關

摘要:
1. 交件匣機制:每輪 prompt 附系統規則,Codex 把要給使用者的檔案放進
   工作目錄的 .tgcodex-outbox/,回覆後 bot 自動傳到 Telegram(圖片走
   sendPhoto、其餘或超過 10MB 走 sendDocument)並清空,一輪上限 10 個檔案。
2. bot 設定新增「允許 Codex 連網」開關(-c sandbox_workspace_write.network_access),
   開啟後可用 codex 的 imagegen 技能生圖,已實測產出 PNG 進交件匣。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-14 17:13:12 +08:00
co-authored by Claude Fable 5
parent d5c4464fe1
commit b80d6f0a1b
7 changed files with 83 additions and 6 deletions
+4 -1
View File
@@ -79,6 +79,7 @@ async function listBots() {
model: cfg?.model || '',
reasoningEffort: cfg?.reasoningEffort || '',
sharedSession: !!cfg?.sharedSession,
networkAccess: !!cfg?.networkAccess,
serviceTier: cfg?.serviceTier || '',
timeoutMinutes: cfg?.timeoutMinutes || null,
tokenMasked: maskToken(cfg?.telegramToken),
@@ -113,7 +114,7 @@ function validateBotInput({ name, token, workDir, sandbox }, { isCreate }) {
}
}
async function createBot({ name, token, workDir, sandbox, model, reasoningEffort, sharedSession, timeoutMinutes }) {
async function createBot({ name, token, workDir, sandbox, model, reasoningEffort, sharedSession, networkAccess, timeoutMinutes }) {
validateBotInput({ name, token, workDir, sandbox }, { isCreate: true });
const reg = loadRegistry();
if (reg.bots[name]) throw new Error(`已有同名 bot${name}`);
@@ -130,6 +131,7 @@ async function createBot({ name, token, workDir, sandbox, model, reasoningEffort
model: model || '',
reasoningEffort: reasoningEffort || '',
sharedSession: !!sharedSession,
networkAccess: !!networkAccess,
serviceTier: 'priority', // 速度固定 Fast 1.5x
timeoutMinutes: Number(timeoutMinutes) || 30,
pm2Name: name,
@@ -161,6 +163,7 @@ async function updateBot(name, patch) {
if (patch.model !== undefined) raw.model = patch.model;
if (patch.reasoningEffort !== undefined) raw.reasoningEffort = patch.reasoningEffort;
if (patch.sharedSession !== undefined) raw.sharedSession = !!patch.sharedSession;
if (patch.networkAccess !== undefined) raw.networkAccess = !!patch.networkAccess;
if (patch.timeoutMinutes !== undefined && Number(patch.timeoutMinutes) > 0) {
raw.timeoutMinutes = Number(patch.timeoutMinutes);
}