@zooid/core 0.7.0 → 0.7.2
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/index.d.ts +84 -8
- package/dist/index.js +193 -21
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/acp-registry.ts +38 -2
- package/src/config.test.ts +88 -9
- package/src/config.ts +215 -21
- package/src/container-mounts.test.ts +292 -0
- package/src/index.ts +3 -0
- package/src/types.ts +57 -6
- package/src/zooid-yaml-sweep.test.ts +1 -1
package/src/types.ts
CHANGED
|
@@ -29,9 +29,26 @@ export interface Transport {
|
|
|
29
29
|
reply(thread: ThreadRef, message: string): Promise<void> | void
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* One bind mount. `id` is the handle used by `disable_mounts` to subtract
|
|
34
|
+
* a zooid- or preset-declared entry; user-declared entries that omit `id`
|
|
35
|
+
* are auto-assigned `user-N`. The reserved id `workspace` is rejected on
|
|
36
|
+
* user entries.
|
|
37
|
+
*/
|
|
38
|
+
export interface MountConfig {
|
|
39
|
+
id?: string
|
|
40
|
+
host: string
|
|
41
|
+
target: string
|
|
42
|
+
mode: 'ro' | 'rw'
|
|
43
|
+
/** mkdir -p the host path before bind-mounting. Default false. */
|
|
44
|
+
create?: boolean
|
|
45
|
+
}
|
|
46
|
+
|
|
32
47
|
/**
|
|
33
48
|
* Per-agent container configuration. Holds runtime-neutral container
|
|
34
|
-
* concerns — image, env.
|
|
49
|
+
* concerns — image, env, mounts. `image` / `env` are rejected at parse time
|
|
50
|
+
* when `runtime: local`; `mounts` / `disable_mounts` are accepted under
|
|
51
|
+
* `runtime: local` but ignored at compose time.
|
|
35
52
|
*/
|
|
36
53
|
export interface ContainerConfig {
|
|
37
54
|
image?: string
|
|
@@ -42,6 +59,13 @@ export interface ContainerConfig {
|
|
|
42
59
|
* `ZOOID_*` references and `ZOOID_*` keys are rejected.
|
|
43
60
|
*/
|
|
44
61
|
env?: Record<string, string>
|
|
62
|
+
/** User-declared mounts, layered on top of workspace + preset. */
|
|
63
|
+
mounts?: MountConfig[]
|
|
64
|
+
/**
|
|
65
|
+
* Subtractive override by mount id. Built-in ids: `workspace` plus
|
|
66
|
+
* whatever each preset declares (canonical: `memory`, `history`, `config`).
|
|
67
|
+
*/
|
|
68
|
+
disable_mounts?: string[]
|
|
45
69
|
}
|
|
46
70
|
|
|
47
71
|
/**
|
|
@@ -52,6 +76,28 @@ export interface ZooidContainerConfig {
|
|
|
52
76
|
image?: string
|
|
53
77
|
}
|
|
54
78
|
|
|
79
|
+
/**
|
|
80
|
+
* A room binding for an agent. Either a bare alias (default PL) or
|
|
81
|
+
* an alias with a declared power level applied at room creation.
|
|
82
|
+
*
|
|
83
|
+
* `alias` may be an alias (`#room:server`) or a room ID (`!id:server`).
|
|
84
|
+
* Resolved to a canonical room ID by `bot-pool` at bootstrap. The
|
|
85
|
+
* declared `powerLevel` (when set) seeds the agent's entry in
|
|
86
|
+
* `m.room.power_levels.users` at room creation; the daemon never reads
|
|
87
|
+
* or modifies power levels after that — promote/demote in the UI is
|
|
88
|
+
* canonical.
|
|
89
|
+
*/
|
|
90
|
+
export interface RoomBinding {
|
|
91
|
+
/** Room alias (typical) or room ID. */
|
|
92
|
+
alias: string
|
|
93
|
+
/**
|
|
94
|
+
* Power level the agent should hold in this room at the moment it is
|
|
95
|
+
* created. Omitted = `users_default` (effectively 0). Not reconciled
|
|
96
|
+
* after creation.
|
|
97
|
+
*/
|
|
98
|
+
powerLevel?: number
|
|
99
|
+
}
|
|
100
|
+
|
|
55
101
|
/**
|
|
56
102
|
* Matrix transport binding. Lives under `agents.<name>.matrix:` in
|
|
57
103
|
* zooid.yaml. The block name (`matrix`) is the transport-kind
|
|
@@ -74,8 +120,8 @@ export interface MatrixBinding {
|
|
|
74
120
|
* profile on bootstrap. Falls back to the user_id localpart when absent.
|
|
75
121
|
*/
|
|
76
122
|
display_name?: string
|
|
77
|
-
/**
|
|
78
|
-
rooms:
|
|
123
|
+
/** Rooms this agent watches. Each entry carries the alias/ID and an optional declared PL. */
|
|
124
|
+
rooms: RoomBinding[]
|
|
79
125
|
/**
|
|
80
126
|
* Routing rule. `mention` requires the bot to be tagged; `any` triggers
|
|
81
127
|
* on every message.
|
|
@@ -135,7 +181,9 @@ export interface AgentConfig {
|
|
|
135
181
|
|
|
136
182
|
/**
|
|
137
183
|
* Matrix application-service transport. The CLI binds the AS HTTP listener
|
|
138
|
-
* to `port` (defaults to
|
|
184
|
+
* to `port` (defaults to 9000 — the most common Matrix AS convention; see
|
|
185
|
+
* Synapse / mautrix / matrix-appservice-* projects). Must match the port in
|
|
186
|
+
* the registration YAML's `url` (read by the homeserver, not by Zooid).
|
|
139
187
|
*/
|
|
140
188
|
export interface MatrixTransportConfig {
|
|
141
189
|
type: 'matrix'
|
|
@@ -161,8 +209,11 @@ export interface MatrixTransportConfig {
|
|
|
161
209
|
*/
|
|
162
210
|
user_namespace: string
|
|
163
211
|
/**
|
|
164
|
-
* AS HTTP listener port.
|
|
165
|
-
*
|
|
212
|
+
* AS HTTP listener port. Must match the registration YAML's `url` port —
|
|
213
|
+
* Zooid never reads the registration, so a mismatch silently sinks every
|
|
214
|
+
* transaction (the homeserver gets connection refused; you see no error
|
|
215
|
+
* in Zooid's logs).
|
|
216
|
+
* @default 9000
|
|
166
217
|
*/
|
|
167
218
|
port?: number
|
|
168
219
|
/**
|
|
@@ -215,7 +215,7 @@ agents:
|
|
|
215
215
|
expect(cfg.agents.alice!.matrix).toEqual({
|
|
216
216
|
transport: 'm1',
|
|
217
217
|
user_id: '@alice:localhost',
|
|
218
|
-
rooms: ['!r:localhost'],
|
|
218
|
+
rooms: [{ alias: '!r:localhost' }],
|
|
219
219
|
trigger: 'any',
|
|
220
220
|
})
|
|
221
221
|
expect(cfg.agents.alice!.http).toBeUndefined()
|