@hasna/terminal 4.3.0 → 4.3.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/dist/Onboarding.js +1 -1
- package/dist/ai.js +9 -8
- package/dist/cache.js +2 -2
- package/dist/cli.js +0 -0
- package/dist/economy.js +3 -3
- package/dist/history.js +2 -2
- package/dist/mcp/server.js +26 -1345
- package/dist/mcp/tools/batch.js +111 -0
- package/dist/mcp/tools/execute.js +194 -0
- package/dist/mcp/tools/files.js +290 -0
- package/dist/mcp/tools/git.js +233 -0
- package/dist/mcp/tools/helpers.js +63 -0
- package/dist/mcp/tools/memory.js +151 -0
- package/dist/mcp/tools/meta.js +138 -0
- package/dist/mcp/tools/process.js +50 -0
- package/dist/mcp/tools/project.js +251 -0
- package/dist/mcp/tools/search.js +86 -0
- package/dist/output-store.js +2 -1
- package/dist/paths.js +28 -0
- package/dist/recipes/storage.js +3 -3
- package/dist/session-context.js +2 -2
- package/dist/sessions-db.js +15 -6
- package/dist/snapshots.js +2 -2
- package/dist/tool-profiles.js +4 -3
- package/dist/usage-cache.js +2 -2
- package/package.json +5 -3
- package/src/Onboarding.tsx +1 -1
- package/src/ai.ts +9 -8
- package/src/cache.ts +2 -2
- package/src/economy.ts +3 -3
- package/src/history.ts +2 -2
- package/src/mcp/server.ts +28 -1704
- package/src/mcp/tools/batch.ts +106 -0
- package/src/mcp/tools/execute.ts +248 -0
- package/src/mcp/tools/files.ts +369 -0
- package/src/mcp/tools/git.ts +306 -0
- package/src/mcp/tools/helpers.ts +92 -0
- package/src/mcp/tools/memory.ts +172 -0
- package/src/mcp/tools/meta.ts +202 -0
- package/src/mcp/tools/process.ts +94 -0
- package/src/mcp/tools/project.ts +297 -0
- package/src/mcp/tools/search.ts +118 -0
- package/src/output-store.ts +2 -1
- package/src/paths.ts +32 -0
- package/src/recipes/storage.ts +3 -3
- package/src/session-context.ts +2 -2
- package/src/sessions-db.ts +15 -4
- package/src/snapshots.ts +2 -2
- package/src/tool-profiles.ts +4 -3
- package/src/usage-cache.ts +2 -2
- package/dist/output-router.js +0 -41
- package/dist/parsers/base.js +0 -2
- package/dist/parsers/build.js +0 -64
- package/dist/parsers/errors.js +0 -101
- package/dist/parsers/files.js +0 -78
- package/dist/parsers/git.js +0 -99
- package/dist/parsers/index.js +0 -48
- package/dist/parsers/tests.js +0 -89
package/dist/Onboarding.js
CHANGED
|
@@ -47,5 +47,5 @@ export default function Onboarding({ onDone }) {
|
|
|
47
47
|
const active = cursor === i;
|
|
48
48
|
const on = perms[p.key];
|
|
49
49
|
return (_jsxs(Box, { gap: 2, children: [_jsx(Text, { dimColor: true, children: active ? "›" : " " }), _jsx(Text, { color: on ? undefined : "red", children: on ? "✓" : "✗" }), _jsx(Text, { bold: active, children: p.label }), _jsx(Text, { dimColor: true, children: p.hint })] }, p.key));
|
|
50
|
-
}) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "space toggle \u00B7 enter confirm" }) }), _jsx(Text, { dimColor: true, children: "edit later: ~/.terminal/config.json" })] }));
|
|
50
|
+
}) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "space toggle \u00B7 enter confirm" }) }), _jsx(Text, { dimColor: true, children: "edit later: ~/.hasna/terminal/config.json" })] }));
|
|
51
51
|
}
|
package/dist/ai.js
CHANGED
|
@@ -2,9 +2,10 @@ import { cacheGet, cacheSet } from "./cache.js";
|
|
|
2
2
|
import { getProvider } from "./providers/index.js";
|
|
3
3
|
import { existsSync, readFileSync } from "fs";
|
|
4
4
|
import { join } from "path";
|
|
5
|
+
import { getTerminalDir } from "./paths.js";
|
|
5
6
|
import { discoverProjectHints, discoverSafetyHints, formatHints } from "./context-hints.js";
|
|
6
7
|
// ── model routing ─────────────────────────────────────────────────────────────
|
|
7
|
-
// Config-driven model selection. Defaults per provider, user can override in ~/.terminal/config.json
|
|
8
|
+
// Config-driven model selection. Defaults per provider, user can override in ~/.hasna/terminal/config.json
|
|
8
9
|
const COMPLEX_SIGNALS = [
|
|
9
10
|
/\b(undo|revert|rollback|previous|last)\b/i,
|
|
10
11
|
/\b(all files?|recursively|bulk|batch)\b/i,
|
|
@@ -14,14 +15,14 @@ const COMPLEX_SIGNALS = [
|
|
|
14
15
|
/\b(inside|within|under)\b/i,
|
|
15
16
|
/[|&;]{2}/,
|
|
16
17
|
];
|
|
17
|
-
/** Default models per provider — user can override in ~/.terminal/config.json under "models" */
|
|
18
|
+
/** Default models per provider — user can override in ~/.hasna/terminal/config.json under "models" */
|
|
18
19
|
const MODEL_DEFAULTS = {
|
|
19
20
|
cerebras: { fast: "qwen-3-235b-a22b-instruct-2507", smart: "qwen-3-235b-a22b-instruct-2507" },
|
|
20
21
|
groq: { fast: "openai/gpt-oss-120b", smart: "moonshotai/kimi-k2-instruct" },
|
|
21
22
|
xai: { fast: "grok-code-fast-1", smart: "grok-4-fast-non-reasoning" },
|
|
22
23
|
anthropic: { fast: "claude-haiku-4-5-20251001", smart: "claude-sonnet-4-6" },
|
|
23
24
|
};
|
|
24
|
-
/** Load user model overrides from ~/.terminal/config.json (cached 30s) */
|
|
25
|
+
/** Load user model overrides from ~/.hasna/terminal/config.json (cached 30s) */
|
|
25
26
|
let _modelOverrides = null;
|
|
26
27
|
let _modelOverridesAt = 0;
|
|
27
28
|
function loadModelOverrides() {
|
|
@@ -29,7 +30,7 @@ function loadModelOverrides() {
|
|
|
29
30
|
if (_modelOverrides && now - _modelOverridesAt < 30_000)
|
|
30
31
|
return _modelOverrides;
|
|
31
32
|
try {
|
|
32
|
-
const configPath = join(
|
|
33
|
+
const configPath = join(getTerminalDir(), "config.json");
|
|
33
34
|
if (existsSync(configPath)) {
|
|
34
35
|
const config = JSON.parse(readFileSync(configPath, "utf8"));
|
|
35
36
|
_modelOverrides = config.models ?? {};
|
|
@@ -182,9 +183,9 @@ function buildSystemPrompt(perms, sessionEntries, currentPrompt) {
|
|
|
182
183
|
list files in current directory → ls
|
|
183
184
|
list all files including hidden → ls -a
|
|
184
185
|
show open files → lsof
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
show file size → du -sh file
|
|
187
|
+
show file type → file filename
|
|
188
|
+
show file permissions → ls -la file
|
|
188
189
|
display routing table → route
|
|
189
190
|
show last logged in users → last
|
|
190
191
|
show file stats → stat file
|
|
@@ -202,7 +203,7 @@ system utilization stats → vmstat
|
|
|
202
203
|
DNS servers → cat /etc/resolv.conf | grep nameserver
|
|
203
204
|
long integer size → getconf LONG_BIT
|
|
204
205
|
base64 decode string → echo 'str' | base64 -d
|
|
205
|
-
|
|
206
|
+
show file owner → ls -la file
|
|
206
207
|
unique lines in file → uniq file
|
|
207
208
|
max cpu time → ulimit -t
|
|
208
209
|
memory info → lsmem
|
package/dist/cache.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// In-memory LRU cache + disk persistence for command translations
|
|
2
2
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
3
|
-
import { homedir } from "os";
|
|
4
3
|
import { join } from "path";
|
|
5
|
-
|
|
4
|
+
import { getTerminalDir } from "./paths.js";
|
|
5
|
+
const CACHE_FILE = join(getTerminalDir(), "cache.json");
|
|
6
6
|
const MAX_ENTRIES = 500;
|
|
7
7
|
let mem = {};
|
|
8
8
|
export function loadCache() {
|
package/dist/cli.js
CHANGED
|
File without changes
|
package/dist/economy.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Token economy tracker — tracks token savings across all interactions
|
|
2
2
|
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
|
|
3
|
-
import { homedir } from "os";
|
|
4
3
|
import { join } from "path";
|
|
5
|
-
|
|
4
|
+
import { getTerminalDir } from "./paths.js";
|
|
5
|
+
const DIR = getTerminalDir();
|
|
6
6
|
const ECONOMY_FILE = join(DIR, "economy.json");
|
|
7
7
|
let stats = null;
|
|
8
8
|
function ensureDir() {
|
|
@@ -106,7 +106,7 @@ const PROVIDER_PRICING = {
|
|
|
106
106
|
"anthropic-sonnet": { input: 3.00, output: 15.00 },
|
|
107
107
|
"anthropic-opus": { input: 5.00, output: 25.00 },
|
|
108
108
|
};
|
|
109
|
-
/** Load configurable turns-before-compaction from ~/.terminal/config.json */
|
|
109
|
+
/** Load configurable turns-before-compaction from ~/.hasna/terminal/config.json */
|
|
110
110
|
function loadTurnsMultiplier() {
|
|
111
111
|
try {
|
|
112
112
|
const configPath = join(DIR, "config.json");
|
package/dist/history.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
2
|
-
import { homedir } from "os";
|
|
3
2
|
import { join } from "path";
|
|
4
|
-
|
|
3
|
+
import { getTerminalDir } from "./paths.js";
|
|
4
|
+
const DIR = getTerminalDir();
|
|
5
5
|
const HISTORY_FILE = join(DIR, "history.json");
|
|
6
6
|
const CONFIG_FILE = join(DIR, "config.json");
|
|
7
7
|
export const DEFAULT_PERMISSIONS = {
|