@hmharness/agent 0.6.4 → 0.6.6
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/i18n.d.ts +2 -0
- package/dist/i18n.js +2 -0
- package/dist/tools.js +14 -4
- package/package.json +5 -5
package/dist/i18n.d.ts
CHANGED
|
@@ -48,6 +48,8 @@ export interface Strings {
|
|
|
48
48
|
tuiDeny: string;
|
|
49
49
|
tuiApprovalHint: string;
|
|
50
50
|
tuiHints: string;
|
|
51
|
+
/** idle-box hints while a task runs (TUI): stop affordance + queue depth */
|
|
52
|
+
tuiBusyHints: (queued: number) => string;
|
|
51
53
|
/** live label while the model thinks (TUI) */
|
|
52
54
|
thinking: string;
|
|
53
55
|
/** final label after thinking folds away (TUI) */
|
package/dist/i18n.js
CHANGED
|
@@ -41,6 +41,7 @@ const zh = {
|
|
|
41
41
|
tuiDeny: '拒绝',
|
|
42
42
|
tuiApprovalHint: 'enter/y 批准 · esc/n 拒绝',
|
|
43
43
|
tuiHints: 'enter 发送 · 滚轮/↑↓ 翻页 · ^P/^N 历史 · esc 清空 · 拖选复制 · ^C 退出 · /help',
|
|
44
|
+
tuiBusyHints: (queued) => `运行中 · 空行回车=停止 · 新输入=排队(${queued}) · esc 清空 · /help`,
|
|
44
45
|
thinking: '思考中',
|
|
45
46
|
thought: '已完成思考',
|
|
46
47
|
tuiRunning: '运行中…',
|
|
@@ -135,6 +136,7 @@ const en = {
|
|
|
135
136
|
tuiDeny: 'Deny',
|
|
136
137
|
tuiApprovalHint: 'enter/y approve · esc/n deny',
|
|
137
138
|
tuiHints: 'enter send · wheel/arrows scroll · ^P/^N history · esc clear · drag to copy · ^C quit · /help',
|
|
139
|
+
tuiBusyHints: (queued) => `running · Enter on empty line = stop · typing queues (${queued}) · esc clear · /help`,
|
|
138
140
|
thinking: 'thinking',
|
|
139
141
|
thought: 'thought (done)',
|
|
140
142
|
tuiRunning: 'running…',
|
package/dist/tools.js
CHANGED
|
@@ -8,7 +8,7 @@ import { exec } from 'node:child_process';
|
|
|
8
8
|
import { copyFile, readFile, readdir, writeFile } from 'node:fs/promises';
|
|
9
9
|
import { isAbsolute, join, resolve } from 'node:path';
|
|
10
10
|
import { promisify } from 'node:util';
|
|
11
|
-
import { chatVision, homeDir, loadConfig,
|
|
11
|
+
import { chatVision, homeDir, isVisionRefusal, loadConfig, visionProviderChain } from '@hmharness/kernel';
|
|
12
12
|
const execCb = promisify(exec);
|
|
13
13
|
const DENY_PATTERNS = [
|
|
14
14
|
// recursive deletes aimed at ROOT/HOME/SYSTEM targets only - relative
|
|
@@ -617,18 +617,28 @@ export const seeImageTool = {
|
|
|
617
617
|
const mime = /\.(jpg|jpeg)$/i.test(p) ? 'image/jpeg' : /\.webp$/i.test(p) ? 'image/webp' : 'image/png';
|
|
618
618
|
const url = `data:${mime};base64,${data.toString('base64')}`;
|
|
619
619
|
const question = String(args.question ?? 'Describe this image precisely and concisely.');
|
|
620
|
-
|
|
620
|
+
// chain: routing.vision provider -> `vision` block -> visionFallbacks,
|
|
621
|
+
// with text-only providers (supportsVision: false) filtered out
|
|
622
|
+
const chain = visionProviderChain(cfg);
|
|
621
623
|
const errors = [];
|
|
622
624
|
for (const provider of chain) {
|
|
623
625
|
try {
|
|
624
626
|
const answer = await chatVision(provider, question, url);
|
|
627
|
+
// a blind provider answers HTTP 200 with a refusal - not an answer
|
|
628
|
+
if (isVisionRefusal(answer)) {
|
|
629
|
+
errors.push(`${provider.model}: cannot see images (replied "${answer.trim().slice(0, 60)}")`);
|
|
630
|
+
continue;
|
|
631
|
+
}
|
|
625
632
|
return { output: `[${p}]\n${answer}` };
|
|
626
633
|
}
|
|
627
634
|
catch (err) {
|
|
628
|
-
errors.push(`${provider.model
|
|
635
|
+
errors.push(`${provider.model}: ${String(err).slice(0, 120)}`);
|
|
629
636
|
}
|
|
630
637
|
}
|
|
631
|
-
return {
|
|
638
|
+
return {
|
|
639
|
+
output: `no vision provider could see the image (${chain.length} tried):\n${errors.join('\n')}`,
|
|
640
|
+
isError: true,
|
|
641
|
+
};
|
|
632
642
|
},
|
|
633
643
|
};
|
|
634
644
|
export const baseTools = [readFileTool, editFileTool, writeFileTool, listDirTool, runCommandTool, rememberTool, seeImageTool];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hmharness/agent",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
4
4
|
"description": "hmharness agent execution layer: base tools, system prompt, sub-agent spawn, and the shared task runner that frontends (cli, web) drive.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"build": "tsc -p tsconfig.build.json"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@hmharness/kernel": "0.6.
|
|
19
|
-
"@hmharness/evolution": "0.6.
|
|
20
|
-
"@hmharness/domain-harmony": "0.6.
|
|
21
|
-
"@hmharness/domain-ops": "0.6.
|
|
18
|
+
"@hmharness/kernel": "0.6.6",
|
|
19
|
+
"@hmharness/evolution": "0.6.6",
|
|
20
|
+
"@hmharness/domain-harmony": "0.6.6",
|
|
21
|
+
"@hmharness/domain-ops": "0.6.6"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"dist"
|