@holon-run/agentinbox 0.6.0 → 1.0.0-beta.0
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/README.md +32 -7
- package/dist/src/adapters.js +61 -6
- package/dist/src/backend.js +4 -16
- package/dist/src/cli.js +307 -53
- package/dist/src/client.js +2 -2
- package/dist/src/daemon.js +36 -2
- package/dist/src/http.js +467 -45
- package/dist/src/logging.js +112 -0
- package/dist/src/paths.js +1 -0
- package/dist/src/runtime_gate.js +394 -63
- package/dist/src/service.js +856 -154
- package/dist/src/source_hosts.js +75 -0
- package/dist/src/source_resolution.js +20 -20
- package/dist/src/source_schema.js +2 -2
- package/dist/src/sources/feishu.js +66 -28
- package/dist/src/sources/github.js +188 -24
- package/dist/src/sources/remote.js +44 -24
- package/dist/src/sources/{remote_profiles.js → remote_modules.js} +143 -58
- package/dist/src/store.js +861 -106
- package/dist/src/terminal.js +33 -7
- package/dist/src/util.js +46 -1
- package/drizzle/migrations/{0000_initial.sql → 0000_v1_initial.sql} +182 -6
- package/drizzle/schema.ts +93 -1
- package/package.json +2 -1
- package/scripts/iterm2_cursor_probe.py +8 -3
- package/scripts/release_smoke.sh +123 -0
- package/drizzle/migrations/0001_inbox_items_source_occurred_at_idx.sql +0 -3
- package/drizzle/migrations/0002_subscription_cleanup_policy.sql +0 -45
- package/drizzle/migrations/0003_subscription_lifecycle_retirements.sql +0 -14
- package/drizzle/migrations/0004_source_idle_states.sql +0 -10
- package/drizzle/migrations/0005_timers.sql +0 -22
- package/drizzle/migrations/0006_terminal_runtime_pid.sql +0 -1
- package/drizzle/migrations/0007_activation_dispatch_last_notified_fingerprint.sql +0 -2
- package/drizzle/migrations/0008_inbox_item_sequence.sql +0 -21
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JsonLogger = exports.NoopLogger = void 0;
|
|
4
|
+
exports.parseLogLevel = parseLogLevel;
|
|
5
|
+
exports.isLogLevel = isLogLevel;
|
|
6
|
+
exports.defaultLogLevel = defaultLogLevel;
|
|
7
|
+
const LOG_LEVEL_RANK = {
|
|
8
|
+
error: 0,
|
|
9
|
+
warn: 1,
|
|
10
|
+
info: 2,
|
|
11
|
+
debug: 3,
|
|
12
|
+
trace: 4,
|
|
13
|
+
};
|
|
14
|
+
const LOG_LEVELS = new Set(["error", "warn", "info", "debug", "trace"]);
|
|
15
|
+
const DEFAULT_LOG_LEVEL = "info";
|
|
16
|
+
class NoopLogger {
|
|
17
|
+
level;
|
|
18
|
+
constructor(level = DEFAULT_LOG_LEVEL) {
|
|
19
|
+
this.level = level;
|
|
20
|
+
}
|
|
21
|
+
enabled(_level) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
child(_component) {
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
error(_event, _fields) { }
|
|
28
|
+
warn(_event, _fields) { }
|
|
29
|
+
info(_event, _fields) { }
|
|
30
|
+
debug(_event, _fields) { }
|
|
31
|
+
trace(_event, _fields) { }
|
|
32
|
+
}
|
|
33
|
+
exports.NoopLogger = NoopLogger;
|
|
34
|
+
class JsonLogger {
|
|
35
|
+
level;
|
|
36
|
+
component;
|
|
37
|
+
writeLine;
|
|
38
|
+
constructor(level, component, writeLine = (line) => process.stdout.write(`${line}\n`)) {
|
|
39
|
+
this.level = level;
|
|
40
|
+
this.component = component;
|
|
41
|
+
this.writeLine = writeLine;
|
|
42
|
+
}
|
|
43
|
+
enabled(level) {
|
|
44
|
+
return LOG_LEVEL_RANK[level] <= LOG_LEVEL_RANK[this.level];
|
|
45
|
+
}
|
|
46
|
+
child(component) {
|
|
47
|
+
return new JsonLogger(this.level, `${this.component}.${component}`, this.writeLine);
|
|
48
|
+
}
|
|
49
|
+
error(event, fields) {
|
|
50
|
+
this.log("error", event, fields);
|
|
51
|
+
}
|
|
52
|
+
warn(event, fields) {
|
|
53
|
+
this.log("warn", event, fields);
|
|
54
|
+
}
|
|
55
|
+
info(event, fields) {
|
|
56
|
+
this.log("info", event, fields);
|
|
57
|
+
}
|
|
58
|
+
debug(event, fields) {
|
|
59
|
+
this.log("debug", event, fields);
|
|
60
|
+
}
|
|
61
|
+
trace(event, fields) {
|
|
62
|
+
this.log("trace", event, fields);
|
|
63
|
+
}
|
|
64
|
+
log(level, event, fields) {
|
|
65
|
+
if (!this.enabled(level)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
this.writeLine(JSON.stringify({
|
|
69
|
+
ts: new Date().toISOString(),
|
|
70
|
+
level,
|
|
71
|
+
component: this.component,
|
|
72
|
+
event,
|
|
73
|
+
...(fields ? serializeFields(fields) : {}),
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.JsonLogger = JsonLogger;
|
|
78
|
+
function parseLogLevel(value, fallback = DEFAULT_LOG_LEVEL) {
|
|
79
|
+
if (typeof value !== "string") {
|
|
80
|
+
return fallback;
|
|
81
|
+
}
|
|
82
|
+
const normalized = value.trim().toLowerCase();
|
|
83
|
+
if (LOG_LEVELS.has(normalized)) {
|
|
84
|
+
return normalized;
|
|
85
|
+
}
|
|
86
|
+
return fallback;
|
|
87
|
+
}
|
|
88
|
+
function isLogLevel(value) {
|
|
89
|
+
return typeof value === "string" && LOG_LEVELS.has(value);
|
|
90
|
+
}
|
|
91
|
+
function defaultLogLevel() {
|
|
92
|
+
return DEFAULT_LOG_LEVEL;
|
|
93
|
+
}
|
|
94
|
+
function serializeFields(fields) {
|
|
95
|
+
return Object.fromEntries(Object.entries(fields).map(([key, value]) => [key, serializeValue(value)]));
|
|
96
|
+
}
|
|
97
|
+
function serializeValue(value) {
|
|
98
|
+
if (value instanceof Error) {
|
|
99
|
+
return {
|
|
100
|
+
name: value.name,
|
|
101
|
+
message: value.message,
|
|
102
|
+
stack: value.stack,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
if (Array.isArray(value)) {
|
|
106
|
+
return value.map((entry) => serializeValue(entry));
|
|
107
|
+
}
|
|
108
|
+
if (value && typeof value === "object") {
|
|
109
|
+
return Object.fromEntries(Object.entries(value).map(([key, nested]) => [key, serializeValue(nested)]));
|
|
110
|
+
}
|
|
111
|
+
return value;
|
|
112
|
+
}
|
package/dist/src/paths.js
CHANGED
|
@@ -71,6 +71,7 @@ function resolveDaemonPaths(env = process.env, homeDirOverride) {
|
|
|
71
71
|
return {
|
|
72
72
|
pidPath: node_path_1.default.join(homeDir, "agentinbox.pid"),
|
|
73
73
|
logPath: node_path_1.default.join(homeDir, "agentinbox.log"),
|
|
74
|
+
metadataPath: node_path_1.default.join(homeDir, "agentinbox.daemon.json"),
|
|
74
75
|
};
|
|
75
76
|
}
|
|
76
77
|
function resolveClientTransport(input = {}) {
|