@jellyos/agent 0.1.8 → 0.1.9
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/cli.js +11 -1
- package/dist/loader.js +21 -1
- package/dist/util/safeLog.d.ts +3 -0
- package/dist/util/safeLog.js +21 -0
- package/package.json +4 -1
package/dist/cli.js
CHANGED
|
@@ -12,6 +12,7 @@ import { Registry } from "./api/Registry.js";
|
|
|
12
12
|
import { loadExtension } from "./loader.js";
|
|
13
13
|
import { App } from "./tui/App.js";
|
|
14
14
|
import { T } from "./tui/theme.js";
|
|
15
|
+
import { wireNotify, safeLog } from "./util/safeLog.js";
|
|
15
16
|
import { modelRegistry } from "./models/ModelRegistry.js";
|
|
16
17
|
import { CostTracker } from "./models/CostTracker.js";
|
|
17
18
|
import { AgentRunner } from "./runner/AgentRunner.js";
|
|
@@ -212,10 +213,19 @@ else {
|
|
|
212
213
|
chain,
|
|
213
214
|
modelReg: modelRegistry,
|
|
214
215
|
costTracker,
|
|
215
|
-
onNotifyReady: (fn) => { _notifyFn = fn; },
|
|
216
|
+
onNotifyReady: (fn) => { _notifyFn = fn; wireNotify(fn); },
|
|
216
217
|
onStatusReady: (fn) => { _setStatusFn = fn; },
|
|
217
218
|
onModelSelectorReady: (fn) => { _showModelSelectorFn = fn; },
|
|
218
219
|
}), { exitOnCtrlC: false });
|
|
220
|
+
// Ink owns the terminal from this point on. Any console.log/error/warn
|
|
221
|
+
// writes raw bytes to stdout, bypassing Ink's rendering buffer. Ink's
|
|
222
|
+
// cursor-up calculation becomes wrong → stacked border lines.
|
|
223
|
+
// NOTE: process.stdout.write is intentionally NOT patched — Ink uses it
|
|
224
|
+
// for every render frame; intercepting it globally would break Ink output.
|
|
225
|
+
process.prependListener("SIGWINCH", () => { process.stdout.write("\x1B[2J\x1B[H"); });
|
|
226
|
+
console.log = safeLog;
|
|
227
|
+
console.error = safeLog;
|
|
228
|
+
console.warn = safeLog;
|
|
219
229
|
})();
|
|
220
230
|
} // end headless else
|
|
221
231
|
//# sourceMappingURL=cli.js.map
|
package/dist/loader.js
CHANGED
|
@@ -80,6 +80,26 @@ export async function loadExtension(extensionPath, registry, opts = {}) {
|
|
|
80
80
|
if (typeof fn !== "function") {
|
|
81
81
|
throw new Error(`Extension must export a default function. Got: ${typeof fn} from ${abs}`);
|
|
82
82
|
}
|
|
83
|
-
|
|
83
|
+
// Intercept console.log/error/warn during extension load so that any
|
|
84
|
+
// stray prints in the extension (e.g. loadSkills logging) are routed
|
|
85
|
+
// through ui.notify instead of raw stdout writes that corrupt the TUI.
|
|
86
|
+
const _origLog = console.log;
|
|
87
|
+
const _origError = console.error;
|
|
88
|
+
const _origWarn = console.warn;
|
|
89
|
+
const _extLog = (...args) => {
|
|
90
|
+
const msg = args.map(a => (typeof a === "string" ? a : String(a))).join(" ");
|
|
91
|
+
ui.notify(msg);
|
|
92
|
+
};
|
|
93
|
+
console.log = _extLog;
|
|
94
|
+
console.error = _extLog;
|
|
95
|
+
console.warn = _extLog;
|
|
96
|
+
try {
|
|
97
|
+
await fn(api);
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
console.log = _origLog;
|
|
101
|
+
console.error = _origError;
|
|
102
|
+
console.warn = _origWarn;
|
|
103
|
+
}
|
|
84
104
|
}
|
|
85
105
|
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { appendFileSync, mkdirSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
const JELLY_HOME = process.env.JELLYOS_HOME ?? join(homedir(), ".jelly");
|
|
5
|
+
const DEBUG_LOG = join(JELLY_HOME, "debug.log");
|
|
6
|
+
let _notifyFn = null;
|
|
7
|
+
export function wireNotify(fn) { _notifyFn = fn; }
|
|
8
|
+
export function safeLog(...args) {
|
|
9
|
+
const msg = args.map(a => (typeof a === "string" ? a : String(a))).join(" ");
|
|
10
|
+
if (_notifyFn) {
|
|
11
|
+
_notifyFn(msg);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
try {
|
|
15
|
+
mkdirSync(JELLY_HOME, { recursive: true });
|
|
16
|
+
appendFileSync(DEBUG_LOG, `[${new Date().toISOString()}] ${msg}\n`);
|
|
17
|
+
}
|
|
18
|
+
catch { /* non-fatal */ }
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=safeLog.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jellyos/agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "JellyOS — standalone AI trading agent. Runs locally, no server required.",
|
|
5
5
|
"author": "JellyChain",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
"jellyagent": "./bin/jellyagent",
|
|
19
19
|
"jellyos-mcp": "./bin/jellyos-mcp"
|
|
20
20
|
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
21
24
|
"scripts": {
|
|
22
25
|
"build": "npx tsc",
|
|
23
26
|
"build:watch": "tsc --watch",
|