beast-agent 2.22.0 → 2.22.2

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "beast-agent",
3
3
  "productName": "Beast Agent",
4
- "version": "2.22.0",
4
+ "version": "2.22.2",
5
5
  "description": "Ultra-fast local agent shell for Windows.",
6
6
  "author": "algokodcom (AlgoKod)",
7
7
  "license": "MIT",
@@ -4726,13 +4726,15 @@ const skills = require('./skills');
4726
4726
  });
4727
4727
  }
4728
4728
  if (name === 'ocr_read') return JSON.stringify(await this._ocrRead(args || {}, signal));
4729
- /* opencode general-agent portu: alt-ajan da edit/grep/glob kullanır */
4729
+ /* opencode general-agent portu: alt-ajan da edit/grep/glob kullanır.
4730
+ MT5 (mt5_*) araçları da tools.exec'e geçer (finance işçileri/danışma). */
4730
4731
  if (!(name === 'run_command' || name === 'read_file' || name === 'write_file' || name === 'edit_file' ||
4731
4732
  name === 'list_dir' || name === 'grep' || name === 'glob' ||
4732
4733
  name === 'git_commit' || name === 'git_diff_review' || name === 'git_pr_create' ||
4733
4734
  name === 'repo_map' || name === 'repo_symbols' ||
4734
4735
  name === 'xlsx_read' || name === 'xlsx_write' || name === 'xlsx_edit' ||
4735
- name === 'web_search' || name === 'http_fetch' || name === 'webfetch' || name === 'python_run')) {
4736
+ name === 'web_search' || name === 'http_fetch' || name === 'webfetch' || name === 'python_run') &&
4737
+ !FINANCE_TOOL_SET.has(name)) {
4736
4738
  return JSON.stringify({ ok: false, error: `unknown tool ${name}` });
4737
4739
  }
4738
4740
  return await tools.exec(name, args, { cwd: this.workspace, signal });
@@ -5256,10 +5258,16 @@ const skills = require('./skills');
5256
5258
  return JSON.stringify(await apps.call(name, args || {}, signal));
5257
5259
  }
5258
5260
  /* opencode tool registry portu: edit_file/grep/glob ana ajanın da araçları —
5259
- bunlar olmadan model write_file + tam dosya okuma döngüsüne düşer */
5260
- if (!(name === 'run_command' || name === 'read_file' || name === 'write_file' || name === 'edit_file' ||
5261
- name === 'list_dir' || name === 'grep' || name === 'glob' ||
5262
- name === 'web_search' || name === 'http_fetch' || name === 'webfetch' || name === 'python_run')) {
5261
+ bunlar olmadan model write_file + tam dosya okuma döngüsüne düşer.
5262
+ MT5 (mt5_*) araçları tools.exec → financetools.handlers'a yönlendirilir —
5263
+ whitelist'te yoklarsa finance ajanı "unknown tool" yiyordu (işlem açamama
5264
+ hatasının kök nedeni). */
5265
+ if (
5266
+ !(name === 'run_command' || name === 'read_file' || name === 'write_file' || name === 'edit_file' ||
5267
+ name === 'list_dir' || name === 'grep' || name === 'glob' ||
5268
+ name === 'web_search' || name === 'http_fetch' || name === 'webfetch' || name === 'python_run') &&
5269
+ !FINANCE_TOOL_SET.has(name)
5270
+ ) {
5263
5271
  return JSON.stringify({ ok: false, error: `unknown tool ${name}` });
5264
5272
  }
5265
5273
  return await tools.exec(name, args, { cwd: this._sessionWorkspace(sessionId), signal, wantDiff: true });
@@ -6184,7 +6192,34 @@ Engine.prototype._agentDmSend = function (fromSid, args) {
6184
6192
  }
6185
6193
  }
6186
6194
  }
6187
- if (!target || !jobs.has(target)) {
6195
+ /* ANA OTURUM FALLBACK: chat oturumları this.cache'te yaşar (_bgJobs dışında).
6196
+ Finance trader → ana Beast DM zinciri böyle kapanır: ajan sahibine
6197
+ (ana sohbete) DM ile rapor verebilir. Eşleşme: bgTitle / title / kod. */
6198
+ if (!target) {
6199
+ const q = to.toLowerCase();
6200
+ for (const [sid, s] of this.cache) {
6201
+ if (sid === String(fromSid)) continue;
6202
+ if (!s || s.bgJob || s.isBotDm) continue;
6203
+ if (s.botId && s.botId !== 'beast') continue;
6204
+ const hay = [s.bgTitle, s.title, s.code].map((x) => String(x || '').toLowerCase());
6205
+ if (hay.some((x) => x && x.includes(q))) {
6206
+ target = sid;
6207
+ break;
6208
+ }
6209
+ }
6210
+ }
6211
+ if (String(target) === String(fromSid)) return { ok: false, error: 'kendine DM atılamaz' };
6212
+ const fromJob = jobs.get(String(fromSid));
6213
+ const toJob = jobs.get(target);
6214
+ const targetIsAgent = jobs.has(target);
6215
+ const mainChatSess = targetIsAgent ? null : this.cache.get(String(target)) || null;
6216
+ const targetIsMainChat = !!(
6217
+ mainChatSess &&
6218
+ !mainChatSess.bgJob &&
6219
+ !mainChatSess.isBotDm &&
6220
+ (!mainChatSess.botId || mainChatSess.botId === 'beast')
6221
+ );
6222
+ if (!targetIsAgent && !targetIsMainChat) {
6188
6223
  const titles = [...jobs.values()]
6189
6224
  .filter((j) => j && j.status === 'running' && j.title)
6190
6225
  .map((j) => j.title)
@@ -6194,32 +6229,25 @@ Engine.prototype._agentDmSend = function (fromSid, args) {
6194
6229
  error: 'hedef ajan bulunamadı: "' + to + '"' + (titles.length ? ' — koşan ajanlar: ' + titles.join(', ') : ''),
6195
6230
  };
6196
6231
  }
6197
- if (String(target) === String(fromSid)) return { ok: false, error: 'kendine DM atılamaz' };
6198
- const fromJob = jobs.get(String(fromSid));
6199
- const toJob = jobs.get(target);
6200
- /* FİNANS SINIRI: Beast Finance oturumu agent_dm kullansa bile finance
6201
- dünyasının DIŞINA ÇIKMAZ — yalnız finance ajanlarına DM atabilir
6202
- (trader ↔ GOLD işçisi ↔ finance işçileri). Finance dışı hedef reddedilir. */
6203
- const fromSess = this.cache.get(String(fromSid)) || null;
6204
- if (fromSess && fromSess.finance) {
6205
- const targetSess = this.cache.get(String(target)) || null;
6206
- if (!targetSess || !targetSess.finance) {
6207
- return {
6208
- ok: false,
6209
- error:
6210
- 'Beast Finance ajanı yalnız finance dünyasındaki ajanlara DM atabilir — hedef finance dışı: ' +
6211
- String((toJob && toJob.title) || to),
6212
- };
6213
- }
6214
- }
6232
+ /* TÜM ajanlar birbiriyle iletişim kurabilir — sınırsız DM (yalnız kendine
6233
+ DM atanamaz). Finance ajanları da dahil herkes herkesle konuşur. */
6215
6234
  /* konu etiketi: aynı konudaki DM'ler panelde AYNI oturumda toplanır */
6216
6235
  const topic = String((args && args.topic) || '').replace(/\s+/g, ' ').trim().slice(0, 60) || '(genel)';
6236
+ const fromTitle =
6237
+ fromJob && fromJob.title
6238
+ ? String(fromJob.title)
6239
+ : fromSess
6240
+ ? 'Beast · ' + String(fromSess.code || '')
6241
+ : 'Ajan';
6242
+ const toTitle = targetIsAgent
6243
+ ? String((toJob && toJob.title) || 'Ajan')
6244
+ : String((mainChatSess && (mainChatSess.bgTitle || mainChatSess.title)) || 'Beast');
6217
6245
  const dm = {
6218
6246
  at: new Date().toISOString(),
6219
6247
  from: String(fromSid),
6220
- fromTitle: (fromJob && fromJob.title) || 'Ajan',
6248
+ fromTitle,
6221
6249
  to: String(target),
6222
- toTitle: (toJob && toJob.title) || 'Ajan',
6250
+ toTitle,
6223
6251
  topic,
6224
6252
  text,
6225
6253
  };
@@ -6230,15 +6258,19 @@ Engine.prototype._agentDmSend = function (fromSid, args) {
6230
6258
  fs.writeFileSync(this._agentDmsFile, JSON.stringify({ dms: this._agentDms }, null, 2));
6231
6259
  } catch {}
6232
6260
  emitSafe(this, target, { type: 'agent-dm', ...dm });
6233
- /* teslim: hedef meşgulse pending kuyruğunda bekler, done olunca düşer.
6234
- Cevap zinciri AYNI thread'den sürsün diye topic geri bildirilir. */
6235
- (this._pendingReports = this._pendingReports || []).push({
6236
- parentId: target,
6237
- text:
6238
- `[AJAN DM — ${dm.fromTitle} · konu: "${topic}"]\n${text}\n` +
6239
- `(Cevabını agent_dm aracıyla ver — to: "${dm.fromTitle}", topic: "${topic}")`,
6240
- });
6241
- this.flushPendingReports(target);
6261
+ /* teslim: hedef AJANSA (arka plan işi / finance ajanı) mesaj olarak düşer —
6262
+ meşgulse pending kuyruğunda bekler, done olunca görünür.
6263
+ DÜZ CHAT OTURUMUNA (sahibin sohbet geçmişi) ENJEKTE ETMEYİZ — DM trafik
6264
+ yalnız AJAN DM konsolunda görünür, senin sohbetlerin karışmaz. */
6265
+ if (targetIsAgent) {
6266
+ (this._pendingReports = this._pendingReports || []).push({
6267
+ parentId: target,
6268
+ text:
6269
+ `[AJAN DM — ${dm.fromTitle} · konu: "${topic}"]\n${text}\n` +
6270
+ `(Cevabını agent_dm aracıyla ver — to: "${dm.fromTitle}", topic: "${topic}")`,
6271
+ });
6272
+ this.flushPendingReports(target);
6273
+ }
6242
6274
  return { ok: true, to: target, toTitle: dm.toTitle, topic };
6243
6275
  } catch (e) {
6244
6276
  return { ok: false, error: String((e && e.message) || e) };
@@ -5186,7 +5186,12 @@ async function dmClearAll() {
5186
5186
  toast('Ajan DM geçmişi silindi');
5187
5187
  }
5188
5188
 
5189
- if (els.dmBtn) els.dmBtn.addEventListener('click', () => toggleDmRail($('#dmRail').classList.contains('dm-hidden')));
5189
+ if (els.dmBtn) {
5190
+ els.dmBtn.addEventListener('click', () => {
5191
+ /* kapalıyken (dm-hidden VAR) aç: toggle 'hide' SEMANTIĞI tersine çevrilir */
5192
+ toggleDmRail(!$('#dmRail').classList.contains('dm-hidden'));
5193
+ });
5194
+ }
5190
5195
  if (els.dmModalClose) els.dmModalClose.addEventListener('click', closeDmModal);
5191
5196
  if (els.dmModalClear) els.dmModalClear.addEventListener('click', dmClearAll);
5192
5197
  if (els.dmBackBtn) {