@holon-run/agentinbox 0.1.0 → 0.1.1
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 +31 -16
- package/dist/src/adapters.js +38 -31
- package/dist/src/cli.js +274 -66
- package/dist/src/current_agent.js +126 -0
- package/dist/src/http.js +962 -354
- package/dist/src/service.js +94 -10
- package/dist/src/source_schema.js +2 -10
- package/dist/src/sources/feishu.js +16 -15
- package/dist/src/sources/github.js +11 -10
- package/dist/src/sources/github_ci.js +13 -12
- package/dist/src/sources/remote.js +362 -0
- package/dist/src/sources/remote_profiles.js +254 -0
- package/dist/src/store.js +119 -248
- package/dist/src/util.js +19 -3
- package/drizzle/migrations/0000_initial.sql +206 -0
- package/drizzle/migrations/0001_inbox_items_source_occurred_at_idx.sql +3 -0
- package/drizzle/migrations/meta/0001_snapshot.json +1181 -0
- package/drizzle/migrations/meta/_journal.json +20 -0
- package/drizzle/schema.ts +196 -0
- package/package.json +8 -2
- package/dist/src/matcher.js +0 -47
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ In practice, that means `AgentInbox` can:
|
|
|
32
32
|
Requires:
|
|
33
33
|
|
|
34
34
|
- Node.js 20 or newer
|
|
35
|
-
- `uxc` 0.
|
|
35
|
+
- `uxc` 0.14.0 or newer if you want to use GitHub or Feishu adapters
|
|
36
36
|
|
|
37
37
|
Install globally:
|
|
38
38
|
|
|
@@ -82,15 +82,34 @@ Register the current terminal session:
|
|
|
82
82
|
```bash
|
|
83
83
|
agentinbox agent register
|
|
84
84
|
agentinbox agent register --agent-id agent-alpha
|
|
85
|
+
agentinbox agent current
|
|
85
86
|
```
|
|
86
87
|
|
|
87
88
|
Create a local source and publish an event:
|
|
88
89
|
|
|
89
90
|
```bash
|
|
90
91
|
agentinbox source add local_event local-demo
|
|
91
|
-
agentinbox subscription add <
|
|
92
|
+
agentinbox subscription add <source_id>
|
|
93
|
+
agentinbox subscription add <source_id> --agent-id <agent_id>
|
|
94
|
+
agentinbox subscription add <source_id> --filter-file ./filter.json
|
|
95
|
+
cat filter.json | agentinbox subscription add <source_id> --filter-stdin
|
|
92
96
|
agentinbox source event <source_id> --native-id demo-1 --event local.demo
|
|
93
|
-
agentinbox inbox read
|
|
97
|
+
agentinbox inbox read
|
|
98
|
+
agentinbox inbox read --agent-id <agent_id>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Update an existing source in place:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
agentinbox source update <source_id> --config-json '{"channel":"infra"}'
|
|
105
|
+
agentinbox source update <source_id> --clear-config-ref
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Pause and resume a managed remote source:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
agentinbox source pause <remote_source_id>
|
|
112
|
+
agentinbox source resume <remote_source_id>
|
|
94
113
|
```
|
|
95
114
|
|
|
96
115
|
Remove a task-specific subscription without deleting the whole agent:
|
|
@@ -108,7 +127,7 @@ Public docs live in the mdorigin site under [`docs/site`](./docs/site).
|
|
|
108
127
|
- onboarding with the agent skill: [`docs/site/guides/onboarding-with-agent-skill.md`](./docs/site/guides/onboarding-with-agent-skill.md)
|
|
109
128
|
- getting started: [`docs/site/guides/getting-started.md`](./docs/site/guides/getting-started.md)
|
|
110
129
|
- review workflows: [`docs/site/guides/review-workflows.md`](./docs/site/guides/review-workflows.md)
|
|
111
|
-
- skill docs: [`
|
|
130
|
+
- skill docs: [`skills/README.md`](./skills/README.md)
|
|
112
131
|
- CLI reference: [`docs/site/reference/cli.md`](./docs/site/reference/cli.md)
|
|
113
132
|
- source types: [`docs/site/reference/source-types.md`](./docs/site/reference/source-types.md)
|
|
114
133
|
- architecture: [`docs/site/concepts/architecture.md`](./docs/site/concepts/architecture.md)
|
|
@@ -148,20 +167,16 @@ Build docs directory indexes:
|
|
|
148
167
|
npm run docs:index
|
|
149
168
|
```
|
|
150
169
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
`AgentInbox` releases are tag-driven.
|
|
170
|
+
Generate new SQLite migrations after schema changes:
|
|
154
171
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
- push a tag in the form `v<package.json version>`
|
|
159
|
-
|
|
160
|
-
Public beta tags such as `v0.1.0-beta.1` publish to npm with the `beta`
|
|
161
|
-
dist-tag. Stable tags such as `v0.1.0` publish with the `latest` dist-tag.
|
|
172
|
+
```bash
|
|
173
|
+
npm run db:migrations:generate
|
|
174
|
+
```
|
|
162
175
|
|
|
163
|
-
|
|
164
|
-
|
|
176
|
+
`AgentInbox` now upgrades SQLite state with versioned SQL migrations in
|
|
177
|
+
`drizzle/migrations`. On upgrade with pending migrations, the daemon creates a
|
|
178
|
+
local backup next to the DB file (for example,
|
|
179
|
+
`~/.agentinbox/agentinbox.sqlite.backup-<timestamp>`).
|
|
165
180
|
|
|
166
181
|
## License
|
|
167
182
|
|
package/dist/src/adapters.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AdapterRegistry = void 0;
|
|
4
4
|
const feishu_1 = require("./sources/feishu");
|
|
5
5
|
const github_1 = require("./sources/github");
|
|
6
|
-
const
|
|
6
|
+
const remote_1 = require("./sources/remote");
|
|
7
7
|
class NoopSourceAdapter {
|
|
8
8
|
sourceType;
|
|
9
9
|
constructor(sourceType) {
|
|
@@ -12,6 +12,9 @@ class NoopSourceAdapter {
|
|
|
12
12
|
async ensureSource(_source) {
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
|
+
async validateSource(_source) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
15
18
|
async pollSource(sourceId) {
|
|
16
19
|
return {
|
|
17
20
|
sourceId,
|
|
@@ -29,24 +32,19 @@ class NoopDeliveryAdapter {
|
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
34
|
class AdapterRegistry {
|
|
32
|
-
fixtureSource = new NoopSourceAdapter("fixture");
|
|
33
35
|
localEventSource = new NoopSourceAdapter("local_event");
|
|
34
|
-
remoteSource
|
|
35
|
-
|
|
36
|
-
githubSource;
|
|
37
|
-
githubCiSource;
|
|
38
|
-
fixtureDelivery = new NoopDeliveryAdapter();
|
|
36
|
+
remoteSource;
|
|
37
|
+
defaultDelivery = new NoopDeliveryAdapter();
|
|
39
38
|
feishuDelivery = new feishu_1.FeishuDeliveryAdapter();
|
|
40
39
|
githubDelivery = new github_1.GithubDeliveryAdapter();
|
|
41
|
-
constructor(store, appendSourceEvent) {
|
|
42
|
-
this.
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
constructor(store, appendSourceEvent, options) {
|
|
41
|
+
this.remoteSource = new remote_1.RemoteSourceRuntime(store, appendSourceEvent, {
|
|
42
|
+
homeDir: options?.homeDir,
|
|
43
|
+
client: options?.remoteSourceClient,
|
|
44
|
+
profileRegistry: options?.remoteProfileRegistry,
|
|
45
|
+
});
|
|
45
46
|
}
|
|
46
47
|
sourceAdapterFor(type) {
|
|
47
|
-
if (type === "fixture") {
|
|
48
|
-
return this.fixtureSource;
|
|
49
|
-
}
|
|
50
48
|
if (type === "local_event") {
|
|
51
49
|
return this.localEventSource;
|
|
52
50
|
}
|
|
@@ -54,37 +52,30 @@ class AdapterRegistry {
|
|
|
54
52
|
return this.remoteSource;
|
|
55
53
|
}
|
|
56
54
|
if (type === "github_repo") {
|
|
57
|
-
return this.
|
|
55
|
+
return this.remoteSource;
|
|
58
56
|
}
|
|
59
57
|
if (type === "github_repo_ci") {
|
|
60
|
-
return this.
|
|
58
|
+
return this.remoteSource;
|
|
61
59
|
}
|
|
62
60
|
if (type === "feishu_bot") {
|
|
63
|
-
return this.
|
|
61
|
+
return this.remoteSource;
|
|
64
62
|
}
|
|
65
|
-
return this.
|
|
63
|
+
return this.localEventSource;
|
|
66
64
|
}
|
|
67
65
|
deliveryAdapterFor(provider) {
|
|
68
|
-
if (provider === "fixture") {
|
|
69
|
-
return this.fixtureDelivery;
|
|
70
|
-
}
|
|
71
66
|
if (provider === "feishu") {
|
|
72
67
|
return this.feishuDelivery;
|
|
73
68
|
}
|
|
74
69
|
if (provider === "github") {
|
|
75
70
|
return this.githubDelivery;
|
|
76
71
|
}
|
|
77
|
-
return this.
|
|
72
|
+
return this.defaultDelivery;
|
|
78
73
|
}
|
|
79
74
|
async start() {
|
|
80
|
-
await this.
|
|
81
|
-
await this.githubSource.start?.();
|
|
82
|
-
await this.githubCiSource.start?.();
|
|
75
|
+
await this.remoteSource.start?.();
|
|
83
76
|
}
|
|
84
77
|
async stop() {
|
|
85
|
-
await this.
|
|
86
|
-
await this.githubSource.stop?.();
|
|
87
|
-
await this.githubCiSource.stop?.();
|
|
78
|
+
await this.remoteSource.stop?.();
|
|
88
79
|
}
|
|
89
80
|
async pollSource(source) {
|
|
90
81
|
const adapter = this.sourceAdapterFor(source.sourceType);
|
|
@@ -100,11 +91,27 @@ class AdapterRegistry {
|
|
|
100
91
|
}
|
|
101
92
|
return adapter.pollSource(source.sourceId);
|
|
102
93
|
}
|
|
94
|
+
async pauseSource(source) {
|
|
95
|
+
const adapter = this.sourceAdapterFor(source.sourceType);
|
|
96
|
+
if (!adapter.pauseSource) {
|
|
97
|
+
throw new Error(`source type ${source.sourceType} does not support pause`);
|
|
98
|
+
}
|
|
99
|
+
await adapter.pauseSource?.(source.sourceId);
|
|
100
|
+
}
|
|
101
|
+
async resumeSource(source) {
|
|
102
|
+
const adapter = this.sourceAdapterFor(source.sourceType);
|
|
103
|
+
if (!adapter.resumeSource) {
|
|
104
|
+
throw new Error(`source type ${source.sourceType} does not support resume`);
|
|
105
|
+
}
|
|
106
|
+
await adapter.resumeSource?.(source.sourceId);
|
|
107
|
+
}
|
|
108
|
+
async removeSource(source) {
|
|
109
|
+
const adapter = this.sourceAdapterFor(source.sourceType);
|
|
110
|
+
await adapter.removeSource?.(source.sourceId);
|
|
111
|
+
}
|
|
103
112
|
status() {
|
|
104
113
|
return {
|
|
105
|
-
|
|
106
|
-
github: this.githubSource.status?.() ?? {},
|
|
107
|
-
githubCi: this.githubCiSource.status?.() ?? {},
|
|
114
|
+
remote: this.remoteSource.status?.() ?? {},
|
|
108
115
|
};
|
|
109
116
|
}
|
|
110
117
|
}
|