@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
package/README.md
CHANGED
|
@@ -64,6 +64,22 @@ manually or relying on the agent runtime to expose its own notification API.
|
|
|
64
64
|
- filtering and source model are still evolving
|
|
65
65
|
- first-run onboarding is currently skill-first rather than wizard-first
|
|
66
66
|
|
|
67
|
+
## v1.0.0 Beta Upgrade Notes
|
|
68
|
+
|
|
69
|
+
`v1.0.0-beta.0` is the first release on the final v1 storage and API boundary.
|
|
70
|
+
|
|
71
|
+
- pre-v1 local databases are archived and replaced with a fresh v1 database
|
|
72
|
+
- old local state is not imported into the new v1 database
|
|
73
|
+
- canonical public surfaces are now host + stream registration, entry/thread
|
|
74
|
+
inbox reads, and handle-scoped delivery operations
|
|
75
|
+
- pre-v1 compatibility shims such as legacy source-kind registration aliases,
|
|
76
|
+
raw inbox-item read paths, and deprecated remote-module aliases are no longer
|
|
77
|
+
part of the supported surface
|
|
78
|
+
|
|
79
|
+
If you are upgrading from any pre-v1 build, expect `AgentInbox` to archive the
|
|
80
|
+
existing local database under `~/.agentinbox/` and start with a fresh v1
|
|
81
|
+
database.
|
|
82
|
+
|
|
67
83
|
## Install
|
|
68
84
|
|
|
69
85
|
Requires:
|
|
@@ -127,13 +143,21 @@ Register the current terminal session:
|
|
|
127
143
|
```bash
|
|
128
144
|
agentinbox agent register
|
|
129
145
|
agentinbox agent register --agent-id agent-alpha
|
|
146
|
+
agentinbox agent register --notify-lease-ms 600000 --min-unacked-items 5
|
|
130
147
|
agentinbox agent current
|
|
131
148
|
```
|
|
132
149
|
|
|
150
|
+
`notifyLeaseMs` and `minUnackedItems` are target-facing notification policy:
|
|
151
|
+
they control how often a target may be reminded and how many unacked items must
|
|
152
|
+
accumulate before AgentInbox notifies it. Service-wide activation batching
|
|
153
|
+
(`windowMs`, `maxItems`) and terminal gating heuristics remain daemon-level
|
|
154
|
+
policy, not per-agent knobs.
|
|
155
|
+
|
|
133
156
|
Create a local source and publish an event:
|
|
134
157
|
|
|
135
158
|
```bash
|
|
136
|
-
agentinbox
|
|
159
|
+
agentinbox host add local_event local-demo
|
|
160
|
+
agentinbox source add <host_id> events local-demo
|
|
137
161
|
agentinbox subscription add <source_id>
|
|
138
162
|
agentinbox subscription add <source_id> --agent-id <agent_id>
|
|
139
163
|
agentinbox source schema <source_id>
|
|
@@ -144,10 +168,10 @@ cat filter.json | agentinbox subscription add <source_id> --filter-stdin
|
|
|
144
168
|
agentinbox source event <source_id> --native-id demo-1 --event local.demo
|
|
145
169
|
agentinbox inbox read
|
|
146
170
|
agentinbox inbox read --agent-id <agent_id>
|
|
147
|
-
agentinbox inbox ack --agent-id <agent_id> --through <
|
|
171
|
+
agentinbox inbox ack --agent-id <agent_id> --through <last_entry_id>
|
|
148
172
|
```
|
|
149
173
|
|
|
150
|
-
When acking a reviewed batch, prefer `--through <
|
|
174
|
+
When acking a reviewed batch, prefer `--through <last_entry_id>` over `--all`.
|
|
151
175
|
That preserves the boundary of the items you actually inspected. Use
|
|
152
176
|
`ack --all` only when you have intentionally verified that every current
|
|
153
177
|
unacked item should be cleared.
|
|
@@ -257,10 +281,11 @@ Generate new SQLite migrations after schema changes:
|
|
|
257
281
|
npm run db:migrations:generate
|
|
258
282
|
```
|
|
259
283
|
|
|
260
|
-
`AgentInbox` now
|
|
261
|
-
`drizzle/migrations`.
|
|
262
|
-
|
|
263
|
-
`~/.agentinbox/agentinbox.sqlite.
|
|
284
|
+
`AgentInbox` now initializes SQLite state from a single v1 baseline migration in
|
|
285
|
+
`drizzle/migrations`. If startup detects a pre-v1 local database, it archives
|
|
286
|
+
that database next to the DB path (for example,
|
|
287
|
+
`~/.agentinbox/agentinbox.sqlite.pre-v1.<timestamp>.bak`) and starts with a
|
|
288
|
+
fresh v1 database; pre-v1 local data is not imported.
|
|
264
289
|
|
|
265
290
|
## License
|
|
266
291
|
|
package/dist/src/adapters.js
CHANGED
|
@@ -5,7 +5,7 @@ const paths_1 = require("./paths");
|
|
|
5
5
|
const feishu_1 = require("./sources/feishu");
|
|
6
6
|
const github_1 = require("./sources/github");
|
|
7
7
|
const remote_1 = require("./sources/remote");
|
|
8
|
-
const
|
|
8
|
+
const remote_modules_1 = require("./sources/remote_modules");
|
|
9
9
|
const source_resolution_1 = require("./source_resolution");
|
|
10
10
|
class NoopSourceAdapter {
|
|
11
11
|
sourceType;
|
|
@@ -41,14 +41,14 @@ class AdapterRegistry {
|
|
|
41
41
|
feishuDelivery = new feishu_1.FeishuDeliveryAdapter();
|
|
42
42
|
githubDelivery = new github_1.GithubDeliveryAdapter();
|
|
43
43
|
homeDir;
|
|
44
|
-
|
|
44
|
+
remoteModuleRegistry;
|
|
45
45
|
constructor(store, appendSourceEvent, options) {
|
|
46
46
|
this.homeDir = options?.homeDir ?? (0, paths_1.resolveAgentInboxHome)(process.env);
|
|
47
|
-
this.
|
|
47
|
+
this.remoteModuleRegistry = options?.remoteModuleRegistry ?? new remote_modules_1.RemoteSourceModuleRegistry();
|
|
48
48
|
this.remoteSource = new remote_1.RemoteSourceRuntime(store, appendSourceEvent, {
|
|
49
49
|
homeDir: this.homeDir,
|
|
50
50
|
client: options?.remoteSourceClient,
|
|
51
|
-
|
|
51
|
+
moduleRegistry: this.remoteModuleRegistry,
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
sourceAdapterFor(type) {
|
|
@@ -119,13 +119,13 @@ class AdapterRegistry {
|
|
|
119
119
|
async resolveSourceIdentity(source) {
|
|
120
120
|
return (0, source_resolution_1.resolveSourceIdentity)(source, {
|
|
121
121
|
homeDir: this.homeDir,
|
|
122
|
-
|
|
122
|
+
moduleRegistry: this.remoteModuleRegistry,
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
async resolveSourceSchema(source) {
|
|
126
126
|
return (0, source_resolution_1.resolveSourceSchema)(source, {
|
|
127
127
|
homeDir: this.homeDir,
|
|
128
|
-
|
|
128
|
+
moduleRegistry: this.remoteModuleRegistry,
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
async projectLifecycleSignal(source, rawPayload) {
|
|
@@ -146,10 +146,65 @@ class AdapterRegistry {
|
|
|
146
146
|
}
|
|
147
147
|
return this.remoteSource.deriveInlinePreview(source, item);
|
|
148
148
|
}
|
|
149
|
+
async deriveNotificationGrouping(source, item) {
|
|
150
|
+
if (source.sourceType === "local_event") {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
return this.remoteSource.deriveNotificationGrouping(source, item);
|
|
154
|
+
}
|
|
155
|
+
async summarizeDigestThread(source, items, grouping) {
|
|
156
|
+
if (source.sourceType === "local_event") {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
return this.remoteSource.summarizeDigestThread(source, items, grouping);
|
|
160
|
+
}
|
|
161
|
+
async listDeliveryOperations(source, handle) {
|
|
162
|
+
const module = await this.resolveDeliveryModule(source, handle);
|
|
163
|
+
if (!module?.listDeliveryOperations) {
|
|
164
|
+
return [];
|
|
165
|
+
}
|
|
166
|
+
return module.listDeliveryOperations({ handle, source });
|
|
167
|
+
}
|
|
168
|
+
async invokeDeliveryOperation(source, handle, operation, input, attempt) {
|
|
169
|
+
const module = await this.resolveDeliveryModule(source, handle);
|
|
170
|
+
if (!module?.invokeDeliveryOperation) {
|
|
171
|
+
throw new Error(`delivery operations are not supported for provider ${handle.provider}`);
|
|
172
|
+
}
|
|
173
|
+
return module.invokeDeliveryOperation({ handle, operation, input, attempt, source });
|
|
174
|
+
}
|
|
149
175
|
status() {
|
|
150
176
|
return {
|
|
151
177
|
remote: this.remoteSource.status?.() ?? {},
|
|
152
178
|
};
|
|
153
179
|
}
|
|
180
|
+
async resolveDeliveryModule(source, handle) {
|
|
181
|
+
if (source) {
|
|
182
|
+
if (source.sourceType === "local_event") {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
return this.remoteModuleRegistry.resolve(source, this.homeDir);
|
|
186
|
+
}
|
|
187
|
+
if (handle.provider === "github") {
|
|
188
|
+
return this.remoteModuleRegistry.resolve(syntheticBuiltinSource("github_repo"), this.homeDir);
|
|
189
|
+
}
|
|
190
|
+
if (handle.provider === "feishu") {
|
|
191
|
+
return this.remoteModuleRegistry.resolve(syntheticBuiltinSource("feishu_bot"), this.homeDir);
|
|
192
|
+
}
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
154
195
|
}
|
|
155
196
|
exports.AdapterRegistry = AdapterRegistry;
|
|
197
|
+
function syntheticBuiltinSource(sourceType) {
|
|
198
|
+
return {
|
|
199
|
+
sourceId: `builtin:${sourceType}`,
|
|
200
|
+
hostId: `builtin-host:${sourceType}`,
|
|
201
|
+
streamKind: sourceType === "github_repo" ? "repo_events" : "message_events",
|
|
202
|
+
streamKey: sourceType,
|
|
203
|
+
sourceType,
|
|
204
|
+
sourceKey: sourceType,
|
|
205
|
+
status: "active",
|
|
206
|
+
createdAt: "",
|
|
207
|
+
updatedAt: "",
|
|
208
|
+
config: {},
|
|
209
|
+
};
|
|
210
|
+
}
|
package/dist/src/backend.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SqliteEventBusBackend = void 0;
|
|
4
|
-
exports.streamIdForSource = streamIdForSource;
|
|
5
|
-
exports.consumerIdForSubscription = consumerIdForSubscription;
|
|
6
|
-
exports.defaultInboxIdForAgent = defaultInboxIdForAgent;
|
|
7
4
|
exports.streamKeyForSource = streamKeyForSource;
|
|
8
5
|
exports.toAppendResult = toAppendResult;
|
|
9
6
|
const util_1 = require("./util");
|
|
@@ -18,7 +15,7 @@ class SqliteEventBusBackend {
|
|
|
18
15
|
return existing;
|
|
19
16
|
}
|
|
20
17
|
const stream = {
|
|
21
|
-
streamId:
|
|
18
|
+
streamId: (0, util_1.generateCanonicalId)("str"),
|
|
22
19
|
sourceId: input.sourceId,
|
|
23
20
|
streamKey: input.streamKey,
|
|
24
21
|
backend: input.backend,
|
|
@@ -46,7 +43,7 @@ class SqliteEventBusBackend {
|
|
|
46
43
|
}
|
|
47
44
|
const nextOffset = this.resolveInitialOffset(input.streamId, input.startPolicy, input.startOffset ?? null, input.startTime ?? null);
|
|
48
45
|
const consumer = {
|
|
49
|
-
consumerId:
|
|
46
|
+
consumerId: (0, util_1.generateCanonicalId)("con"),
|
|
50
47
|
streamId: input.streamId,
|
|
51
48
|
subscriptionId: input.subscriptionId,
|
|
52
49
|
consumerKey: input.consumerKey,
|
|
@@ -154,17 +151,8 @@ class SqliteEventBusBackend {
|
|
|
154
151
|
}
|
|
155
152
|
}
|
|
156
153
|
exports.SqliteEventBusBackend = SqliteEventBusBackend;
|
|
157
|
-
function
|
|
158
|
-
return `
|
|
159
|
-
}
|
|
160
|
-
function consumerIdForSubscription(subscriptionId) {
|
|
161
|
-
return `consumer_${subscriptionId}`;
|
|
162
|
-
}
|
|
163
|
-
function defaultInboxIdForAgent(agentId) {
|
|
164
|
-
return `inbox_${agentId}`;
|
|
165
|
-
}
|
|
166
|
-
function streamKeyForSource(sourceType, sourceKey) {
|
|
167
|
-
return `${sourceType}:${sourceKey}`;
|
|
154
|
+
function streamKeyForSource(sourceId) {
|
|
155
|
+
return `source:${sourceId}`;
|
|
168
156
|
}
|
|
169
157
|
function toAppendResult(result) {
|
|
170
158
|
return {
|