aiden-runtime 3.19.7 → 3.19.8
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/api/server.js +64 -10
- package/dist/coordination/livePulse.js +0 -6
- package/dist/core/skillLoader.js +10 -7
- package/dist/core/version.js +1 -1
- package/dist-bundle/cli.js +9 -14
- package/dist-bundle/index.js +61 -18
- package/package.json +1 -1
package/dist/api/server.js
CHANGED
|
@@ -408,6 +408,40 @@ function initWorkspaceDefaults() {
|
|
|
408
408
|
fs.copyFileSync(soulTemplate, soulTarget);
|
|
409
409
|
console.log('[init] Created workspace/SOUL.md from template');
|
|
410
410
|
}
|
|
411
|
+
// C22: Copy bundled starter skills from workspace-templates/ on first boot.
|
|
412
|
+
// Mirrors the SOUL.md pattern above. Idempotent — skips if skills already exist.
|
|
413
|
+
const skillTemplateSrc = path.join(WORKSPACE_ROOT, 'workspace-templates', 'skills');
|
|
414
|
+
const skillDst = path.join(WORKSPACE_ROOT, 'workspace', 'skills', 'learned');
|
|
415
|
+
if (fs.existsSync(skillTemplateSrc)) {
|
|
416
|
+
const hasExisting = (() => {
|
|
417
|
+
try {
|
|
418
|
+
return fs.readdirSync(skillDst, { withFileTypes: true })
|
|
419
|
+
.some(e => e.isDirectory() && fs.existsSync(path.join(skillDst, e.name, 'SKILL.md')));
|
|
420
|
+
}
|
|
421
|
+
catch {
|
|
422
|
+
return false;
|
|
423
|
+
}
|
|
424
|
+
})();
|
|
425
|
+
if (!hasExisting) {
|
|
426
|
+
let copied = 0;
|
|
427
|
+
try {
|
|
428
|
+
const entries = fs.readdirSync(skillTemplateSrc, { withFileTypes: true }).filter(e => e.isDirectory());
|
|
429
|
+
for (const entry of entries) {
|
|
430
|
+
const from = path.join(skillTemplateSrc, entry.name);
|
|
431
|
+
const to = path.join(skillDst, entry.name);
|
|
432
|
+
if (!fs.existsSync(to)) {
|
|
433
|
+
fs.cpSync(from, to, { recursive: true });
|
|
434
|
+
copied++;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
catch (e) {
|
|
439
|
+
console.warn(`[init] Skill template copy error: ${e.message}`);
|
|
440
|
+
}
|
|
441
|
+
if (copied > 0)
|
|
442
|
+
console.log(`[init] Copied ${copied} starter skills from templates`);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
411
445
|
}
|
|
412
446
|
initWorkspaceDefaults();
|
|
413
447
|
// ── Knowledge upload — multer + progress tracking ─────────────
|
|
@@ -5700,16 +5734,36 @@ function startupCheck() {
|
|
|
5700
5734
|
function startApiServer(portArg) {
|
|
5701
5735
|
// ── Redirect all diagnostic output to stderr ─────────────────────────────
|
|
5702
5736
|
// The CLI writes the streaming response to process.stdout character-by-character.
|
|
5703
|
-
//
|
|
5704
|
-
//
|
|
5705
|
-
//
|
|
5706
|
-
//
|
|
5707
|
-
//
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5737
|
+
// ── C23: Level-aware log gate ──────────────────────────────────
|
|
5738
|
+
// Levels: debug=0, info=1, warn=2, error=3, silent=4
|
|
5739
|
+
// Default: 'warn' in CLI mode (AIDEN_CLI_MODE=1), 'info' otherwise.
|
|
5740
|
+
// Users opt in to verbose: AIDEN_LOG_LEVEL=debug npx aiden-os
|
|
5741
|
+
// Full logger rewrite is v3.20 Investigation C scope.
|
|
5742
|
+
const _LOG_LEVELS = {
|
|
5743
|
+
debug: 0, info: 1, warn: 2, error: 3, silent: 4,
|
|
5744
|
+
};
|
|
5745
|
+
const _cliMode = process.env.AIDEN_CLI_MODE === '1';
|
|
5746
|
+
const _defaultLvl = _cliMode ? 'warn' : 'info';
|
|
5747
|
+
const _envLvl = (process.env.AIDEN_LOG_LEVEL || _defaultLvl).toLowerCase();
|
|
5748
|
+
const _minLevel = _LOG_LEVELS[_envLvl] ?? _LOG_LEVELS.warn;
|
|
5749
|
+
const _bracketRe = /^\[[\w$:]+\]/;
|
|
5750
|
+
function _gatedLog(level, ...args) {
|
|
5751
|
+
if (level >= _minLevel) {
|
|
5752
|
+
process.stderr.write(args.map(String).join(' ') + '\n');
|
|
5753
|
+
return;
|
|
5754
|
+
}
|
|
5755
|
+
// Below threshold: suppress bracket-prefixed diagnostic lines.
|
|
5756
|
+
// Non-prefixed console.log (user-facing output) passes through.
|
|
5757
|
+
const first = typeof args[0] === 'string' ? args[0] : '';
|
|
5758
|
+
if (_bracketRe.test(first))
|
|
5759
|
+
return;
|
|
5760
|
+
process.stderr.write(args.map(String).join(' ') + '\n');
|
|
5761
|
+
}
|
|
5762
|
+
console.log = (...args) => _gatedLog(_LOG_LEVELS.info, ...args);
|
|
5763
|
+
console.info = (...args) => _gatedLog(_LOG_LEVELS.info, ...args);
|
|
5764
|
+
// console.warn always writes — warnings indicate real issues users should see.
|
|
5765
|
+
console.warn = (...args) => process.stderr.write(args.map(String).join(' ') + '\n');
|
|
5766
|
+
// console.error left untouched — already targets stderr
|
|
5713
5767
|
// Read port from config/api.json with sensible fallback.
|
|
5714
5768
|
// Host defaults to 127.0.0.1 (loopback only) for security.
|
|
5715
5769
|
// Set AIDEN_HOST=0.0.0.0 to expose on all interfaces (e.g. headless/WSL2).
|
|
@@ -43,7 +43,6 @@ class LivePulse extends events_1.EventEmitter {
|
|
|
43
43
|
// ── Public methods — all wrapped in try-catch so they NEVER throw ──
|
|
44
44
|
act(agent, message, missionId) {
|
|
45
45
|
try {
|
|
46
|
-
console.log(`[${agent}] ${message}`);
|
|
47
46
|
this.emit_event({ type: 'act', agent, message, timestamp: Date.now(), missionId });
|
|
48
47
|
}
|
|
49
48
|
catch {
|
|
@@ -52,7 +51,6 @@ class LivePulse extends events_1.EventEmitter {
|
|
|
52
51
|
}
|
|
53
52
|
done(agent, message, missionId) {
|
|
54
53
|
try {
|
|
55
|
-
console.log(`[${agent}] ✓ ${message}`);
|
|
56
54
|
this.emit_event({ type: 'done', agent, message, timestamp: Date.now(), missionId });
|
|
57
55
|
}
|
|
58
56
|
catch {
|
|
@@ -71,7 +69,6 @@ class LivePulse extends events_1.EventEmitter {
|
|
|
71
69
|
}
|
|
72
70
|
warn(agent, message, missionId) {
|
|
73
71
|
try {
|
|
74
|
-
console.warn(`[${agent}] ⚠ ${message}`);
|
|
75
72
|
this.emit_event({ type: 'warn', agent, message, timestamp: Date.now(), missionId });
|
|
76
73
|
}
|
|
77
74
|
catch {
|
|
@@ -80,7 +77,6 @@ class LivePulse extends events_1.EventEmitter {
|
|
|
80
77
|
}
|
|
81
78
|
info(agent, message, missionId) {
|
|
82
79
|
try {
|
|
83
|
-
console.log(`[${agent}] ℹ ${message}`);
|
|
84
80
|
this.emit_event({ type: 'info', agent, message, timestamp: Date.now(), missionId });
|
|
85
81
|
}
|
|
86
82
|
catch {
|
|
@@ -89,7 +85,6 @@ class LivePulse extends events_1.EventEmitter {
|
|
|
89
85
|
}
|
|
90
86
|
thinking(agent, message, missionId) {
|
|
91
87
|
try {
|
|
92
|
-
console.log(`[${agent}] 💭 ${message}`);
|
|
93
88
|
this.emit_event({ type: 'thinking', agent, message, timestamp: Date.now(), missionId });
|
|
94
89
|
}
|
|
95
90
|
catch {
|
|
@@ -101,7 +96,6 @@ class LivePulse extends events_1.EventEmitter {
|
|
|
101
96
|
const message = output
|
|
102
97
|
? `${toolName}: ${command} → ${output.slice(0, 120)}`
|
|
103
98
|
: `${toolName}: ${command}`;
|
|
104
|
-
console.log(`[${agent}] 🔧 ${message}`);
|
|
105
99
|
this.emit_event({
|
|
106
100
|
type: 'tool',
|
|
107
101
|
agent,
|
package/dist/core/skillLoader.js
CHANGED
|
@@ -192,17 +192,20 @@ class SkillLoader {
|
|
|
192
192
|
// Check built-in skills, workspace skills, and self-learned/promoted skills.
|
|
193
193
|
// NOTE: skills/learned/pending/ is intentionally excluded — pending skills
|
|
194
194
|
// are never auto-loaded; they require explicit /skills approve first.
|
|
195
|
+
// C22: Use AIDEN_USER_DATA (set by npx launcher) so SkillLoader reads
|
|
196
|
+
// from the same workspace root that initWorkspaceDefaults() writes to.
|
|
197
|
+
const root = process.env.AIDEN_USER_DATA || process.cwd();
|
|
195
198
|
this.skillsDirs = [
|
|
196
|
-
path_1.default.join(
|
|
197
|
-
path_1.default.join(
|
|
198
|
-
path_1.default.join(
|
|
199
|
-
path_1.default.join(
|
|
199
|
+
path_1.default.join(root, 'skills'),
|
|
200
|
+
path_1.default.join(root, 'workspace', 'skills'),
|
|
201
|
+
path_1.default.join(root, 'workspace', 'skills', 'learned'),
|
|
202
|
+
path_1.default.join(root, 'workspace', 'skills', 'approved'),
|
|
200
203
|
// Workspace-level installed skills (written by skillRegistry.ts)
|
|
201
|
-
path_1.default.join(
|
|
204
|
+
path_1.default.join(root, 'workspace', 'skills', 'installed'),
|
|
202
205
|
// A2/A3 approved drafts
|
|
203
|
-
path_1.default.join(
|
|
206
|
+
path_1.default.join(root, 'skills', 'learned', 'approved'),
|
|
204
207
|
// A4 library-installed skills
|
|
205
|
-
path_1.default.join(
|
|
208
|
+
path_1.default.join(root, 'skills', 'installed'),
|
|
206
209
|
].filter(d => {
|
|
207
210
|
try {
|
|
208
211
|
return fs_1.default.existsSync(d);
|
package/dist/core/version.js
CHANGED
package/dist-bundle/cli.js
CHANGED
|
@@ -208,7 +208,7 @@ var init_updateCheck = __esm({
|
|
|
208
208
|
var VERSION;
|
|
209
209
|
var init_version = __esm({
|
|
210
210
|
"core/version.ts"() {
|
|
211
|
-
VERSION = "3.19.
|
|
211
|
+
VERSION = "3.19.8";
|
|
212
212
|
}
|
|
213
213
|
});
|
|
214
214
|
|
|
@@ -23684,14 +23684,12 @@ var init_livePulse = __esm({
|
|
|
23684
23684
|
// ── Public methods — all wrapped in try-catch so they NEVER throw ──
|
|
23685
23685
|
act(agent, message, missionId) {
|
|
23686
23686
|
try {
|
|
23687
|
-
console.log(`[${agent}] ${message}`);
|
|
23688
23687
|
this.emit_event({ type: "act", agent, message, timestamp: Date.now(), missionId });
|
|
23689
23688
|
} catch {
|
|
23690
23689
|
}
|
|
23691
23690
|
}
|
|
23692
23691
|
done(agent, message, missionId) {
|
|
23693
23692
|
try {
|
|
23694
|
-
console.log(`[${agent}] \u2713 ${message}`);
|
|
23695
23693
|
this.emit_event({ type: "done", agent, message, timestamp: Date.now(), missionId });
|
|
23696
23694
|
} catch {
|
|
23697
23695
|
}
|
|
@@ -23706,21 +23704,18 @@ var init_livePulse = __esm({
|
|
|
23706
23704
|
}
|
|
23707
23705
|
warn(agent, message, missionId) {
|
|
23708
23706
|
try {
|
|
23709
|
-
console.warn(`[${agent}] \u26A0 ${message}`);
|
|
23710
23707
|
this.emit_event({ type: "warn", agent, message, timestamp: Date.now(), missionId });
|
|
23711
23708
|
} catch {
|
|
23712
23709
|
}
|
|
23713
23710
|
}
|
|
23714
23711
|
info(agent, message, missionId) {
|
|
23715
23712
|
try {
|
|
23716
|
-
console.log(`[${agent}] \u2139 ${message}`);
|
|
23717
23713
|
this.emit_event({ type: "info", agent, message, timestamp: Date.now(), missionId });
|
|
23718
23714
|
} catch {
|
|
23719
23715
|
}
|
|
23720
23716
|
}
|
|
23721
23717
|
thinking(agent, message, missionId) {
|
|
23722
23718
|
try {
|
|
23723
|
-
console.log(`[${agent}] \u{1F4AD} ${message}`);
|
|
23724
23719
|
this.emit_event({ type: "thinking", agent, message, timestamp: Date.now(), missionId });
|
|
23725
23720
|
} catch {
|
|
23726
23721
|
}
|
|
@@ -23728,7 +23723,6 @@ var init_livePulse = __esm({
|
|
|
23728
23723
|
tool(agent, toolName, command, output) {
|
|
23729
23724
|
try {
|
|
23730
23725
|
const message = output ? `${toolName}: ${command} \u2192 ${output.slice(0, 120)}` : `${toolName}: ${command}`;
|
|
23731
|
-
console.log(`[${agent}] \u{1F527} ${message}`);
|
|
23732
23726
|
this.emit_event({
|
|
23733
23727
|
type: "tool",
|
|
23734
23728
|
agent,
|
|
@@ -24903,17 +24897,18 @@ var init_skillLoader = __esm({
|
|
|
24903
24897
|
SkillLoader = class {
|
|
24904
24898
|
constructor() {
|
|
24905
24899
|
this.cache = null;
|
|
24900
|
+
const root = process.env.AIDEN_USER_DATA || process.cwd();
|
|
24906
24901
|
this.skillsDirs = [
|
|
24907
|
-
import_path12.default.join(
|
|
24908
|
-
import_path12.default.join(
|
|
24909
|
-
import_path12.default.join(
|
|
24910
|
-
import_path12.default.join(
|
|
24902
|
+
import_path12.default.join(root, "skills"),
|
|
24903
|
+
import_path12.default.join(root, "workspace", "skills"),
|
|
24904
|
+
import_path12.default.join(root, "workspace", "skills", "learned"),
|
|
24905
|
+
import_path12.default.join(root, "workspace", "skills", "approved"),
|
|
24911
24906
|
// Workspace-level installed skills (written by skillRegistry.ts)
|
|
24912
|
-
import_path12.default.join(
|
|
24907
|
+
import_path12.default.join(root, "workspace", "skills", "installed"),
|
|
24913
24908
|
// A2/A3 approved drafts
|
|
24914
|
-
import_path12.default.join(
|
|
24909
|
+
import_path12.default.join(root, "skills", "learned", "approved"),
|
|
24915
24910
|
// A4 library-installed skills
|
|
24916
|
-
import_path12.default.join(
|
|
24911
|
+
import_path12.default.join(root, "skills", "installed")
|
|
24917
24912
|
].filter((d) => {
|
|
24918
24913
|
try {
|
|
24919
24914
|
return import_fs11.default.existsSync(d);
|
package/dist-bundle/index.js
CHANGED
|
@@ -26650,7 +26650,7 @@ var require_websocket_server = __commonJS({
|
|
|
26650
26650
|
var VERSION;
|
|
26651
26651
|
var init_version = __esm({
|
|
26652
26652
|
"core/version.ts"() {
|
|
26653
|
-
VERSION = "3.19.
|
|
26653
|
+
VERSION = "3.19.8";
|
|
26654
26654
|
}
|
|
26655
26655
|
});
|
|
26656
26656
|
|
|
@@ -26781,14 +26781,12 @@ var init_livePulse = __esm({
|
|
|
26781
26781
|
// ── Public methods — all wrapped in try-catch so they NEVER throw ──
|
|
26782
26782
|
act(agent, message, missionId) {
|
|
26783
26783
|
try {
|
|
26784
|
-
console.log(`[${agent}] ${message}`);
|
|
26785
26784
|
this.emit_event({ type: "act", agent, message, timestamp: Date.now(), missionId });
|
|
26786
26785
|
} catch {
|
|
26787
26786
|
}
|
|
26788
26787
|
}
|
|
26789
26788
|
done(agent, message, missionId) {
|
|
26790
26789
|
try {
|
|
26791
|
-
console.log(`[${agent}] \u2713 ${message}`);
|
|
26792
26790
|
this.emit_event({ type: "done", agent, message, timestamp: Date.now(), missionId });
|
|
26793
26791
|
} catch {
|
|
26794
26792
|
}
|
|
@@ -26803,21 +26801,18 @@ var init_livePulse = __esm({
|
|
|
26803
26801
|
}
|
|
26804
26802
|
warn(agent, message, missionId) {
|
|
26805
26803
|
try {
|
|
26806
|
-
console.warn(`[${agent}] \u26A0 ${message}`);
|
|
26807
26804
|
this.emit_event({ type: "warn", agent, message, timestamp: Date.now(), missionId });
|
|
26808
26805
|
} catch {
|
|
26809
26806
|
}
|
|
26810
26807
|
}
|
|
26811
26808
|
info(agent, message, missionId) {
|
|
26812
26809
|
try {
|
|
26813
|
-
console.log(`[${agent}] \u2139 ${message}`);
|
|
26814
26810
|
this.emit_event({ type: "info", agent, message, timestamp: Date.now(), missionId });
|
|
26815
26811
|
} catch {
|
|
26816
26812
|
}
|
|
26817
26813
|
}
|
|
26818
26814
|
thinking(agent, message, missionId) {
|
|
26819
26815
|
try {
|
|
26820
|
-
console.log(`[${agent}] \u{1F4AD} ${message}`);
|
|
26821
26816
|
this.emit_event({ type: "thinking", agent, message, timestamp: Date.now(), missionId });
|
|
26822
26817
|
} catch {
|
|
26823
26818
|
}
|
|
@@ -26825,7 +26820,6 @@ var init_livePulse = __esm({
|
|
|
26825
26820
|
tool(agent, toolName, command2, output) {
|
|
26826
26821
|
try {
|
|
26827
26822
|
const message = output ? `${toolName}: ${command2} \u2192 ${output.slice(0, 120)}` : `${toolName}: ${command2}`;
|
|
26828
|
-
console.log(`[${agent}] \u{1F527} ${message}`);
|
|
26829
26823
|
this.emit_event({
|
|
26830
26824
|
type: "tool",
|
|
26831
26825
|
agent,
|
|
@@ -99137,17 +99131,18 @@ var init_skillLoader = __esm({
|
|
|
99137
99131
|
SkillLoader = class {
|
|
99138
99132
|
constructor() {
|
|
99139
99133
|
this.cache = null;
|
|
99134
|
+
const root = process.env.AIDEN_USER_DATA || process.cwd();
|
|
99140
99135
|
this.skillsDirs = [
|
|
99141
|
-
import_path15.default.join(
|
|
99142
|
-
import_path15.default.join(
|
|
99143
|
-
import_path15.default.join(
|
|
99144
|
-
import_path15.default.join(
|
|
99136
|
+
import_path15.default.join(root, "skills"),
|
|
99137
|
+
import_path15.default.join(root, "workspace", "skills"),
|
|
99138
|
+
import_path15.default.join(root, "workspace", "skills", "learned"),
|
|
99139
|
+
import_path15.default.join(root, "workspace", "skills", "approved"),
|
|
99145
99140
|
// Workspace-level installed skills (written by skillRegistry.ts)
|
|
99146
|
-
import_path15.default.join(
|
|
99141
|
+
import_path15.default.join(root, "workspace", "skills", "installed"),
|
|
99147
99142
|
// A2/A3 approved drafts
|
|
99148
|
-
import_path15.default.join(
|
|
99143
|
+
import_path15.default.join(root, "skills", "learned", "approved"),
|
|
99149
99144
|
// A4 library-installed skills
|
|
99150
|
-
import_path15.default.join(
|
|
99145
|
+
import_path15.default.join(root, "skills", "installed")
|
|
99151
99146
|
].filter((d) => {
|
|
99152
99147
|
try {
|
|
99153
99148
|
return import_fs14.default.existsSync(d);
|
|
@@ -1053452,6 +1053447,34 @@ function initWorkspaceDefaults() {
|
|
|
1053452
1053447
|
fs70.copyFileSync(soulTemplate, soulTarget);
|
|
1053453
1053448
|
console.log("[init] Created workspace/SOUL.md from template");
|
|
1053454
1053449
|
}
|
|
1053450
|
+
const skillTemplateSrc = path73.join(WORKSPACE_ROOT4, "workspace-templates", "skills");
|
|
1053451
|
+
const skillDst = path73.join(WORKSPACE_ROOT4, "workspace", "skills", "learned");
|
|
1053452
|
+
if (fs70.existsSync(skillTemplateSrc)) {
|
|
1053453
|
+
const hasExisting = (() => {
|
|
1053454
|
+
try {
|
|
1053455
|
+
return fs70.readdirSync(skillDst, { withFileTypes: true }).some((e) => e.isDirectory() && fs70.existsSync(path73.join(skillDst, e.name, "SKILL.md")));
|
|
1053456
|
+
} catch {
|
|
1053457
|
+
return false;
|
|
1053458
|
+
}
|
|
1053459
|
+
})();
|
|
1053460
|
+
if (!hasExisting) {
|
|
1053461
|
+
let copied = 0;
|
|
1053462
|
+
try {
|
|
1053463
|
+
const entries = fs70.readdirSync(skillTemplateSrc, { withFileTypes: true }).filter((e) => e.isDirectory());
|
|
1053464
|
+
for (const entry of entries) {
|
|
1053465
|
+
const from = path73.join(skillTemplateSrc, entry.name);
|
|
1053466
|
+
const to = path73.join(skillDst, entry.name);
|
|
1053467
|
+
if (!fs70.existsSync(to)) {
|
|
1053468
|
+
fs70.cpSync(from, to, { recursive: true });
|
|
1053469
|
+
copied++;
|
|
1053470
|
+
}
|
|
1053471
|
+
}
|
|
1053472
|
+
} catch (e) {
|
|
1053473
|
+
console.warn(`[init] Skill template copy error: ${e.message}`);
|
|
1053474
|
+
}
|
|
1053475
|
+
if (copied > 0) console.log(`[init] Copied ${copied} starter skills from templates`);
|
|
1053476
|
+
}
|
|
1053477
|
+
}
|
|
1053455
1053478
|
}
|
|
1053456
1053479
|
initWorkspaceDefaults();
|
|
1053457
1053480
|
var KB_UPLOAD_DIR = path73.join(WORKSPACE_ROOT4, "workspace", "knowledge", "uploads");
|
|
@@ -1058197,10 +1058220,30 @@ function startupCheck() {
|
|
|
1058197
1058220
|
}
|
|
1058198
1058221
|
}
|
|
1058199
1058222
|
function startApiServer(portArg) {
|
|
1058200
|
-
const
|
|
1058201
|
-
|
|
1058202
|
-
|
|
1058203
|
-
|
|
1058223
|
+
const _LOG_LEVELS = {
|
|
1058224
|
+
debug: 0,
|
|
1058225
|
+
info: 1,
|
|
1058226
|
+
warn: 2,
|
|
1058227
|
+
error: 3,
|
|
1058228
|
+
silent: 4
|
|
1058229
|
+
};
|
|
1058230
|
+
const _cliMode = process.env.AIDEN_CLI_MODE === "1";
|
|
1058231
|
+
const _defaultLvl = _cliMode ? "warn" : "info";
|
|
1058232
|
+
const _envLvl = (process.env.AIDEN_LOG_LEVEL || _defaultLvl).toLowerCase();
|
|
1058233
|
+
const _minLevel = _LOG_LEVELS[_envLvl] ?? _LOG_LEVELS.warn;
|
|
1058234
|
+
const _bracketRe = /^\[[\w$:]+\]/;
|
|
1058235
|
+
function _gatedLog(level, ...args) {
|
|
1058236
|
+
if (level >= _minLevel) {
|
|
1058237
|
+
process.stderr.write(args.map(String).join(" ") + "\n");
|
|
1058238
|
+
return;
|
|
1058239
|
+
}
|
|
1058240
|
+
const first = typeof args[0] === "string" ? args[0] : "";
|
|
1058241
|
+
if (_bracketRe.test(first)) return;
|
|
1058242
|
+
process.stderr.write(args.map(String).join(" ") + "\n");
|
|
1058243
|
+
}
|
|
1058244
|
+
console.log = (...args) => _gatedLog(_LOG_LEVELS.info, ...args);
|
|
1058245
|
+
console.info = (...args) => _gatedLog(_LOG_LEVELS.info, ...args);
|
|
1058246
|
+
console.warn = (...args) => process.stderr.write(args.map(String).join(" ") + "\n");
|
|
1058204
1058247
|
let port = portArg ?? 4200;
|
|
1058205
1058248
|
const isHeadless = process.env.AIDEN_HEADLESS === "true";
|
|
1058206
1058249
|
let host = process.env.AIDEN_HOST || (isHeadless ? "0.0.0.0" : "127.0.0.1");
|
package/package.json
CHANGED