@agentorg/cli 0.0.5 → 0.0.6

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.
Files changed (206) hide show
  1. package/README.md +18 -102
  2. package/dist/node_modules/@agentorg/hub/dist/src/hub-actor.d.ts +2 -7
  3. package/dist/node_modules/@agentorg/hub/dist/src/hub-actor.js +4 -144
  4. package/dist/node_modules/@agentorg/hub/dist/src/index.d.ts +1 -3
  5. package/dist/node_modules/@agentorg/hub/dist/src/index.js +1 -3
  6. package/dist/node_modules/@agentorg/hub/dist/src/router.d.ts +6 -57
  7. package/dist/node_modules/@agentorg/hub/dist/src/router.js +38 -413
  8. package/dist/node_modules/@agentorg/hub/dist/src/state.d.ts +17 -317
  9. package/dist/node_modules/@agentorg/hub/dist/src/state.js +42 -536
  10. package/dist/node_modules/@agentorg/hub/dist/src/validate.d.ts +1 -3
  11. package/dist/node_modules/@agentorg/hub/dist/src/validate.js +3 -15
  12. package/dist/node_modules/@agentorg/hub/package.json +0 -3
  13. package/dist/node_modules/@agentorg/interfaces/dist/src/agent-provider.d.ts +132 -0
  14. package/dist/node_modules/@agentorg/interfaces/dist/src/agent-provider.js +105 -0
  15. package/dist/node_modules/@agentorg/interfaces/dist/src/agent-settings.d.ts +42 -0
  16. package/dist/node_modules/@agentorg/interfaces/dist/src/agent-settings.js +53 -0
  17. package/dist/node_modules/@agentorg/interfaces/dist/src/chat.d.ts +15 -0
  18. package/dist/node_modules/@agentorg/interfaces/dist/src/chat.js +14 -0
  19. package/dist/node_modules/@agentorg/interfaces/dist/src/hub.d.ts +16 -286
  20. package/dist/node_modules/@agentorg/interfaces/dist/src/hub.js +17 -159
  21. package/dist/node_modules/@agentorg/interfaces/dist/src/index.d.ts +6 -8
  22. package/dist/node_modules/@agentorg/interfaces/dist/src/index.js +6 -8
  23. package/dist/node_modules/@agentorg/interfaces/dist/src/kv.d.ts +2 -2
  24. package/dist/node_modules/@agentorg/interfaces/dist/src/kv.js +2 -2
  25. package/dist/node_modules/@agentorg/interfaces/dist/src/manager.d.ts +272 -0
  26. package/dist/node_modules/@agentorg/interfaces/dist/src/manager.js +185 -0
  27. package/dist/node_modules/@agentorg/interfaces/dist/src/mcp-provider.d.ts +88 -0
  28. package/dist/node_modules/@agentorg/interfaces/dist/src/mcp-provider.js +78 -0
  29. package/dist/node_modules/@agentorg/interfaces/dist/src/tools.d.ts +39 -0
  30. package/dist/node_modules/@agentorg/interfaces/dist/src/tools.js +43 -0
  31. package/dist/node_modules/@agentorg/manager/dist/src/index.d.ts +1 -0
  32. package/dist/node_modules/@agentorg/manager/dist/src/index.js +1 -0
  33. package/dist/node_modules/@agentorg/manager/dist/src/manager.d.ts +21 -0
  34. package/dist/node_modules/@agentorg/manager/dist/src/manager.js +528 -0
  35. package/dist/node_modules/@agentorg/manager/dist/src/skills.d.ts +25 -0
  36. package/dist/node_modules/@agentorg/manager/dist/src/skills.js +145 -0
  37. package/dist/node_modules/@agentorg/manager/package.json +30 -0
  38. package/dist/node_modules/@agentorg/mcp/dist/src/connection.d.ts +33 -0
  39. package/dist/node_modules/@agentorg/mcp/dist/src/connection.js +290 -0
  40. package/dist/node_modules/@agentorg/mcp/dist/src/index.d.ts +1 -0
  41. package/dist/node_modules/@agentorg/mcp/dist/src/index.js +1 -0
  42. package/dist/node_modules/@agentorg/mcp/dist/src/kinds.d.ts +50 -0
  43. package/dist/node_modules/@agentorg/mcp/dist/src/kinds.js +69 -0
  44. package/dist/node_modules/@agentorg/mcp/dist/src/provider.d.ts +22 -0
  45. package/dist/node_modules/@agentorg/mcp/dist/src/provider.js +167 -0
  46. package/dist/node_modules/@agentorg/mcp/package.json +31 -0
  47. package/dist/node_modules/@agentorg/sdk/dist/src/cli.js +3 -23
  48. package/dist/node_modules/@agentorg/sdk/dist/src/client.d.ts +4 -25
  49. package/dist/node_modules/@agentorg/sdk/dist/src/client.js +5 -55
  50. package/dist/node_modules/@agentorg/sdk/dist/src/errors.d.ts +1 -1
  51. package/dist/node_modules/@agentorg/sdk/dist/src/errors.js +3 -3
  52. package/dist/node_modules/@agentorg/sdk/dist/src/index.d.ts +2 -2
  53. package/dist/node_modules/@agentorg/sdk/dist/src/index.js +1 -1
  54. package/dist/node_modules/@agentorg/sdk/dist/src/interface.d.ts +6 -34
  55. package/dist/node_modules/@agentorg/sdk/dist/src/interface.js +3 -24
  56. package/dist/node_modules/@agentorg/sdk/dist/src/module-host.d.ts +8 -17
  57. package/dist/node_modules/@agentorg/sdk/dist/src/module-host.js +15 -87
  58. package/dist/node_modules/@agentorg/sdk/dist/src/module.d.ts +10 -76
  59. package/dist/node_modules/@agentorg/sdk/dist/src/module.js +3 -23
  60. package/dist/node_modules/@agentorg/sdk/dist/src/person-commands.js +0 -5
  61. package/dist/node_modules/@agentorg/sdk/dist/src/runtime.d.ts +3 -27
  62. package/dist/node_modules/@agentorg/sdk/dist/src/runtime.js +5 -100
  63. package/dist/node_modules/@agentorg/sdk/dist/src/testing.d.ts +7 -8
  64. package/dist/node_modules/@agentorg/sdk/dist/src/testing.js +12 -24
  65. package/dist/node_modules/@agentorg/sdk/package.json +4 -37
  66. package/dist/node_modules/@agentorg/shell/dist/app.css +3435 -739
  67. package/dist/node_modules/@agentorg/shell/dist/app.js +204 -202
  68. package/dist/node_modules/@agentorg/shell/package.json +18 -10
  69. package/dist/node_modules/@agentorg/wire/dist/src/frames.d.ts +2 -3
  70. package/dist/node_modules/@agentorg/wire/dist/src/frames.js +2 -3
  71. package/dist/node_modules/@agentorg/wire/dist/src/ops.d.ts +5 -34
  72. package/dist/node_modules/@agentorg/wire/dist/src/ops.js +2 -17
  73. package/dist/node_modules/assistant/dist/src/agent.d.ts +62 -0
  74. package/dist/node_modules/assistant/dist/src/agent.js +226 -0
  75. package/dist/node_modules/assistant/dist/src/engine.d.ts +23 -0
  76. package/dist/node_modules/assistant/dist/src/engine.js +88 -0
  77. package/dist/node_modules/assistant/dist/src/history.d.ts +97 -0
  78. package/dist/node_modules/assistant/dist/src/history.js +235 -0
  79. package/dist/node_modules/assistant/dist/src/local-store.d.ts +3 -0
  80. package/dist/node_modules/assistant/dist/src/local-store.js +58 -0
  81. package/dist/node_modules/assistant/dist/src/provider.d.ts +21 -0
  82. package/dist/node_modules/assistant/dist/src/provider.js +231 -0
  83. package/dist/node_modules/assistant/dist/src/settings.d.ts +17 -0
  84. package/dist/node_modules/assistant/dist/src/settings.js +43 -0
  85. package/dist/node_modules/assistant/dist/src/tools.d.ts +74 -0
  86. package/dist/node_modules/assistant/dist/src/tools.js +123 -0
  87. package/dist/node_modules/assistant/package.json +29 -0
  88. package/dist/node_modules/chatgpt/dist/src/account.d.ts +52 -0
  89. package/dist/node_modules/chatgpt/dist/src/account.js +270 -0
  90. package/dist/node_modules/chatgpt/dist/src/encoding.d.ts +7 -0
  91. package/dist/node_modules/chatgpt/dist/src/encoding.js +20 -0
  92. package/dist/node_modules/chatgpt/dist/src/file-store.d.ts +9 -0
  93. package/dist/node_modules/chatgpt/dist/src/file-store.js +68 -0
  94. package/dist/node_modules/chatgpt/dist/src/index.d.ts +1 -0
  95. package/dist/node_modules/chatgpt/dist/src/index.js +1 -0
  96. package/dist/node_modules/chatgpt/dist/src/jwt.d.ts +15 -0
  97. package/dist/node_modules/chatgpt/dist/src/jwt.js +37 -0
  98. package/dist/node_modules/chatgpt/dist/src/oauth.d.ts +43 -0
  99. package/dist/node_modules/chatgpt/dist/src/oauth.js +104 -0
  100. package/dist/node_modules/chatgpt/dist/src/program.d.ts +23 -0
  101. package/dist/node_modules/chatgpt/dist/src/program.js +41 -0
  102. package/dist/node_modules/chatgpt/dist/src/responses.d.ts +54 -0
  103. package/dist/node_modules/chatgpt/dist/src/responses.js +300 -0
  104. package/dist/node_modules/chatgpt/dist/src/serve.d.ts +65 -0
  105. package/dist/node_modules/chatgpt/dist/src/serve.js +46 -0
  106. package/dist/node_modules/chatgpt/package.json +33 -0
  107. package/dist/src/api.d.ts +5 -34
  108. package/dist/src/api.js +6 -68
  109. package/dist/src/cli.js +3 -7
  110. package/dist/src/gateway.d.ts +6 -7
  111. package/dist/src/gateway.js +39 -285
  112. package/dist/src/index.d.ts +4 -5
  113. package/dist/src/index.js +3 -4
  114. package/dist/src/notes.d.ts +11 -0
  115. package/dist/src/notes.js +64 -0
  116. package/dist/src/oauth.d.ts +16 -0
  117. package/dist/src/oauth.js +46 -0
  118. package/dist/src/programs.d.ts +29 -0
  119. package/dist/src/programs.js +171 -0
  120. package/package.json +3 -11
  121. package/dist/bundled/index.json +0 -6
  122. package/dist/bundled/sha256-0e91cc3d0e9762b81abc2427b5496b20f383abcd6fb97d928a8d50e956b54d1f.agentorg +0 -0
  123. package/dist/bundled/sha256-1f64ca62a0209d767d6aa6c4feb50b0653d60f10bebbc301f79bd3a37e0153c1.agentorg +0 -0
  124. package/dist/bundled/sha256-4055f8fddf6b90f3d356543f554b2a9e9a2c4a8827a8774f8f87952dc1692331.agentorg +0 -0
  125. package/dist/bundled/sha256-e356ea3c1899138a8494baf521556831006f38534fa9e92ae873e7e6956c3a46.agentorg +0 -0
  126. package/dist/node_modules/@agentorg/hub/dist/src/build.d.ts +0 -17
  127. package/dist/node_modules/@agentorg/hub/dist/src/build.js +0 -120
  128. package/dist/node_modules/@agentorg/hub/dist/src/logs.d.ts +0 -33
  129. package/dist/node_modules/@agentorg/hub/dist/src/logs.js +0 -162
  130. package/dist/node_modules/@agentorg/hub/dist/src/net.d.ts +0 -41
  131. package/dist/node_modules/@agentorg/hub/dist/src/net.js +0 -265
  132. package/dist/node_modules/@agentorg/hub/dist/src/processes.d.ts +0 -78
  133. package/dist/node_modules/@agentorg/hub/dist/src/processes.js +0 -485
  134. package/dist/node_modules/@agentorg/hub/dist/src/storage.d.ts +0 -38
  135. package/dist/node_modules/@agentorg/hub/dist/src/storage.js +0 -194
  136. package/dist/node_modules/@agentorg/interfaces/dist/src/http-egress.d.ts +0 -6
  137. package/dist/node_modules/@agentorg/interfaces/dist/src/http-egress.js +0 -7
  138. package/dist/node_modules/@agentorg/interfaces/dist/src/installer.d.ts +0 -191
  139. package/dist/node_modules/@agentorg/interfaces/dist/src/installer.js +0 -136
  140. package/dist/node_modules/@agentorg/interfaces/dist/src/layout.d.ts +0 -47
  141. package/dist/node_modules/@agentorg/interfaces/dist/src/layout.js +0 -52
  142. package/dist/node_modules/@agentorg/interfaces/dist/src/rules.d.ts +0 -35
  143. package/dist/node_modules/@agentorg/interfaces/dist/src/rules.js +0 -37
  144. package/dist/node_modules/@agentorg/interfaces/dist/src/storage-admin.d.ts +0 -23
  145. package/dist/node_modules/@agentorg/interfaces/dist/src/storage-admin.js +0 -31
  146. package/dist/node_modules/@agentorg/interfaces/dist/src/ui-shell.d.ts +0 -14
  147. package/dist/node_modules/@agentorg/interfaces/dist/src/ui-shell.js +0 -26
  148. package/dist/node_modules/@agentorg/interfaces/dist/src/ui-view.d.ts +0 -27
  149. package/dist/node_modules/@agentorg/interfaces/dist/src/ui-view.js +0 -26
  150. package/dist/node_modules/@agentorg/kit/dist/src/chat.d.ts +0 -37
  151. package/dist/node_modules/@agentorg/kit/dist/src/chat.js +0 -131
  152. package/dist/node_modules/@agentorg/kit/dist/src/components.d.ts +0 -94
  153. package/dist/node_modules/@agentorg/kit/dist/src/components.js +0 -66
  154. package/dist/node_modules/@agentorg/kit/dist/src/icons.d.ts +0 -17
  155. package/dist/node_modules/@agentorg/kit/dist/src/icons.js +0 -30
  156. package/dist/node_modules/@agentorg/kit/dist/src/index.d.ts +0 -6
  157. package/dist/node_modules/@agentorg/kit/dist/src/index.js +0 -10
  158. package/dist/node_modules/@agentorg/kit/dist/src/markdown.d.ts +0 -9
  159. package/dist/node_modules/@agentorg/kit/dist/src/markdown.js +0 -14
  160. package/dist/node_modules/@agentorg/kit/dist/src/resizable.d.ts +0 -5
  161. package/dist/node_modules/@agentorg/kit/dist/src/resizable.js +0 -8
  162. package/dist/node_modules/@agentorg/kit/dist/src/styles.d.ts +0 -11
  163. package/dist/node_modules/@agentorg/kit/dist/src/styles.js +0 -166
  164. package/dist/node_modules/@agentorg/kit/package.json +0 -44
  165. package/dist/node_modules/@agentorg/sdk/dist/frame/runtime.js +0 -753
  166. package/dist/node_modules/@agentorg/sdk/dist/host/runner.js +0 -21963
  167. package/dist/node_modules/@agentorg/sdk/dist/src/build.d.ts +0 -2
  168. package/dist/node_modules/@agentorg/sdk/dist/src/build.js +0 -2
  169. package/dist/node_modules/@agentorg/sdk/dist/src/client-http.d.ts +0 -24
  170. package/dist/node_modules/@agentorg/sdk/dist/src/client-http.js +0 -247
  171. package/dist/node_modules/@agentorg/sdk/dist/src/describe.d.ts +0 -13
  172. package/dist/node_modules/@agentorg/sdk/dist/src/describe.js +0 -16
  173. package/dist/node_modules/@agentorg/sdk/dist/src/frame-base.d.ts +0 -8
  174. package/dist/node_modules/@agentorg/sdk/dist/src/frame-base.js +0 -64
  175. package/dist/node_modules/@agentorg/sdk/dist/src/frame-entry.d.ts +0 -1
  176. package/dist/node_modules/@agentorg/sdk/dist/src/frame-entry.js +0 -35
  177. package/dist/node_modules/@agentorg/sdk/dist/src/frame-host.d.ts +0 -57
  178. package/dist/node_modules/@agentorg/sdk/dist/src/frame-host.js +0 -293
  179. package/dist/node_modules/@agentorg/sdk/dist/src/frame-protocol.d.ts +0 -124
  180. package/dist/node_modules/@agentorg/sdk/dist/src/frame-protocol.js +0 -16
  181. package/dist/node_modules/@agentorg/sdk/dist/src/frame.d.ts +0 -25
  182. package/dist/node_modules/@agentorg/sdk/dist/src/frame.js +0 -248
  183. package/dist/node_modules/@agentorg/sdk/dist/src/host-main.d.ts +0 -1
  184. package/dist/node_modules/@agentorg/sdk/dist/src/host-main.js +0 -60
  185. package/dist/node_modules/@agentorg/sdk/dist/src/host.d.ts +0 -25
  186. package/dist/node_modules/@agentorg/sdk/dist/src/host.js +0 -92
  187. package/dist/node_modules/@agentorg/sdk/dist/src/manifest-api.d.ts +0 -2
  188. package/dist/node_modules/@agentorg/sdk/dist/src/manifest-api.js +0 -2
  189. package/dist/node_modules/@agentorg/sdk/dist/src/manifest.d.ts +0 -56
  190. package/dist/node_modules/@agentorg/sdk/dist/src/manifest.js +0 -165
  191. package/dist/node_modules/@agentorg/sdk/dist/src/package.d.ts +0 -60
  192. package/dist/node_modules/@agentorg/sdk/dist/src/package.js +0 -538
  193. package/dist/node_modules/@agentorg/sdk/dist/src/tar.d.ts +0 -7
  194. package/dist/node_modules/@agentorg/sdk/dist/src/tar.js +0 -71
  195. package/dist/node_modules/@agentorg/shell/dist/agent-bindings.js +0 -59
  196. package/dist/node_modules/@agentorg/shell/src/agent-bindings.ts +0 -107
  197. package/dist/src/frames.d.ts +0 -23
  198. package/dist/src/frames.js +0 -78
  199. package/dist/src/layout.d.ts +0 -44
  200. package/dist/src/layout.js +0 -90
  201. package/dist/src/model.d.ts +0 -54
  202. package/dist/src/model.js +0 -299
  203. package/dist/src/rules.d.ts +0 -71
  204. package/dist/src/rules.js +0 -157
  205. package/dist/src/transfer.d.ts +0 -30
  206. package/dist/src/transfer.js +0 -110
@@ -1,194 +0,0 @@
1
- import { chmodSync } from "node:fs";
2
- import { join } from "node:path";
3
- import { DatabaseSync } from "node:sqlite";
4
- import { Refused } from "@agentorg/sdk";
5
- export const STORAGE_LIMITS = {
6
- maxValue: 256 * 1024,
7
- maxPerConsumer: 64 * 1024 * 1024,
8
- };
9
- /** Bytes of a key, as UTF-8. */
10
- const MAX_KEY = 1024;
11
- const LONE_SURROGATE = /[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;
12
- /** A key is well-formed text: half a surrogate pair would be stored as U+FFFD, merging keys. */
13
- function checkKey(key) {
14
- if (LONE_SURROGATE.test(key))
15
- throw new Refused("invalid", "A key is well-formed text.");
16
- }
17
- /**
18
- * The built-in `storage` Actor's `kv@1`: one store per consumer slot, kept in `<home>/storage.db`
19
- * (0600), apart from the Hub's own database. The store is chosen by the consumer and slot the
20
- * router names, never by the caller. Stores outlive unbinding; a closed Actor's go with it.
21
- */
22
- export class Storage {
23
- #db;
24
- #limits;
25
- constructor(home, limits = STORAGE_LIMITS) {
26
- this.#limits = limits;
27
- const file = join(home, "storage.db");
28
- // A lock held elsewhere is waited for a while rather than failing at once.
29
- this.#db = new DatabaseSync(file, { timeout: 5000 });
30
- chmodSync(file, 0o600);
31
- this.#db.exec(`PRAGMA journal_mode = WAL;
32
- CREATE TABLE IF NOT EXISTS store (
33
- consumer TEXT NOT NULL, slot TEXT NOT NULL, key TEXT NOT NULL,
34
- value TEXT NOT NULL, size INTEGER NOT NULL,
35
- PRIMARY KEY (consumer, slot, key));
36
- CREATE TABLE IF NOT EXISTS usage (consumer TEXT PRIMARY KEY, used INTEGER NOT NULL);`);
37
- for (const suffix of ["-wal", "-shm"])
38
- try {
39
- chmodSync(file + suffix, 0o600);
40
- }
41
- catch {
42
- // Not created yet.
43
- }
44
- }
45
- /** One `kv@1` call on the store of (consumer, slot). Inputs were already checked. */
46
- call(consumer, slot, method, input) {
47
- const key = String(input.key ?? "");
48
- switch (method) {
49
- case "get": {
50
- const row = this.#db
51
- .prepare("SELECT value FROM store WHERE consumer = ? AND slot = ? AND key = ?")
52
- .get(consumer, slot, key);
53
- return row ? { value: JSON.parse(row.value) } : {};
54
- }
55
- case "set":
56
- return this.#set(consumer, slot, key, input.value);
57
- case "delete":
58
- return this.#delete(consumer, slot, key);
59
- case "list":
60
- return this.#list(consumer, slot, input);
61
- default:
62
- throw new Refused("unimplemented", `kv@1 has no method ${method}.`);
63
- }
64
- }
65
- /** Run work in one write transaction. */
66
- #transaction(work) {
67
- this.#db.exec("BEGIN IMMEDIATE");
68
- try {
69
- const out = work();
70
- this.#db.exec("COMMIT");
71
- return out;
72
- }
73
- catch (error) {
74
- this.#db.exec("ROLLBACK");
75
- throw error;
76
- }
77
- }
78
- /** Add `delta` bytes to what a consumer's stores hold; the total is kept, never summed. */
79
- #use(consumer, delta) {
80
- this.#db
81
- .prepare("INSERT INTO usage (consumer, used) VALUES (?, ?) ON CONFLICT (consumer) DO UPDATE SET used = used + excluded.used")
82
- .run(consumer, delta);
83
- }
84
- #sizeOf(consumer, slot, key) {
85
- const row = this.#db
86
- .prepare("SELECT size FROM store WHERE consumer = ? AND slot = ? AND key = ?")
87
- .get(consumer, slot, key);
88
- return row && Number(row.size);
89
- }
90
- #set(consumer, slot, key, value) {
91
- checkKey(key);
92
- if (Buffer.byteLength(key) > MAX_KEY)
93
- throw new Refused("quota", `A key is at most ${MAX_KEY} bytes.`);
94
- const json = JSON.stringify(value);
95
- const valueBytes = Buffer.byteLength(json);
96
- if (valueBytes > this.#limits.maxValue)
97
- throw new Refused("quota", `A value is at most ${this.#limits.maxValue} bytes.`);
98
- const size = valueBytes + Buffer.byteLength(key);
99
- this.#transaction(() => {
100
- const used = this.#db.prepare("SELECT used FROM usage WHERE consumer = ?").get(consumer);
101
- const replaced = this.#sizeOf(consumer, slot, key) ?? 0;
102
- if (Number(used?.used ?? 0) - replaced + size > this.#limits.maxPerConsumer)
103
- throw new Refused("quota", `An Actor's stores hold at most ${this.#limits.maxPerConsumer} bytes.`);
104
- this.#db
105
- .prepare("INSERT INTO store (consumer, slot, key, value, size) VALUES (?, ?, ?, ?, ?) ON CONFLICT (consumer, slot, key) DO UPDATE SET value = excluded.value, size = excluded.size")
106
- .run(consumer, slot, key, json, size);
107
- this.#use(consumer, size - replaced);
108
- });
109
- return {};
110
- }
111
- #delete(consumer, slot, key) {
112
- return this.#transaction(() => {
113
- const size = this.#sizeOf(consumer, slot, key);
114
- if (size === undefined)
115
- return { deleted: false };
116
- this.#db
117
- .prepare("DELETE FROM store WHERE consumer = ? AND slot = ? AND key = ?")
118
- .run(consumer, slot, key);
119
- this.#use(consumer, -size);
120
- return { deleted: true };
121
- });
122
- }
123
- /** Keys with the prefix, in order, after `after`, a page at a time. */
124
- #list(consumer, slot, input) {
125
- const prefix = typeof input.prefix === "string" ? input.prefix : "";
126
- const after = typeof input.after === "string" ? input.after : "";
127
- const limit = typeof input.limit === "number" ? input.limit : 100;
128
- const rows = this.#db
129
- .prepare(
130
- // The scan starts at the prefix (or after `after`) and stops past the prefix's range; instr
131
- // keeps exactly the keys that start with it.
132
- `SELECT key FROM store WHERE consumer = ? AND slot = ? AND key > ? AND key >= ? AND key < ?
133
- AND instr(key, ?) = 1 ORDER BY key LIMIT ?`)
134
- .all(consumer, slot, after, prefix, `${prefix}\u{10FFFF}`, prefix, limit + 1);
135
- const keys = rows.slice(0, limit).map((row) => row.key);
136
- return { keys, next: rows.length > limit ? (keys.at(-1) ?? null) : null };
137
- }
138
- /**
139
- * Seed the store of (consumer, slot), all or none, if it holds nothing: `storage.admin@1`'s
140
- * `seed`. Each entry has kv@1's limits, and together they count toward the consumer's quota.
141
- */
142
- /** `named` is the consumer as a refusal names it: "Name (id)". */
143
- seed(consumer, slot, entries, named = consumer) {
144
- const keys = new Set();
145
- const rows = entries.map(({ key, value }) => {
146
- checkKey(key);
147
- if (keys.has(key))
148
- throw new Refused("invalid", `The key ${JSON.stringify(key)} is given twice.`);
149
- keys.add(key);
150
- if (Buffer.byteLength(key) > MAX_KEY)
151
- throw new Refused("quota", `A key is at most ${MAX_KEY} bytes.`);
152
- const json = JSON.stringify(value);
153
- const valueBytes = Buffer.byteLength(json);
154
- if (valueBytes > this.#limits.maxValue)
155
- throw new Refused("quota", `A value is at most ${this.#limits.maxValue} bytes.`);
156
- return { key, json, size: valueBytes + Buffer.byteLength(key) };
157
- });
158
- const total = rows.reduce((sum, row) => sum + row.size, 0);
159
- this.#transaction(() => {
160
- if (this.#db
161
- .prepare("SELECT 1 FROM store WHERE consumer = ? AND slot = ? LIMIT 1")
162
- .get(consumer, slot))
163
- throw new Refused("not_empty", `The store of ${named}'s ${slot} isn't empty.`);
164
- const used = this.#db.prepare("SELECT used FROM usage WHERE consumer = ?").get(consumer);
165
- if (Number(used?.used ?? 0) + total > this.#limits.maxPerConsumer)
166
- throw new Refused("quota", `An Actor's stores hold at most ${this.#limits.maxPerConsumer} bytes.`);
167
- const insert = this.#db.prepare("INSERT INTO store (consumer, slot, key, value, size) VALUES (?, ?, ?, ?, ?)");
168
- for (const row of rows)
169
- insert.run(consumer, slot, row.key, row.json, row.size);
170
- this.#use(consumer, total);
171
- });
172
- }
173
- /** Every store of an Actor, gone: it was closed for good. */
174
- deleteConsumer(consumer) {
175
- this.#transaction(() => {
176
- this.#db.prepare("DELETE FROM store WHERE consumer = ?").run(consumer);
177
- this.#db.prepare("DELETE FROM usage WHERE consumer = ?").run(consumer);
178
- });
179
- }
180
- /**
181
- * Keep only the stores of these Actors. Run when the Hub opens, it catches up on deletes a crash
182
- * or a lock kept from happening when an Actor was closed.
183
- */
184
- keepOnly(live) {
185
- const consumers = this.#db.prepare("SELECT consumer FROM usage").all();
186
- for (const { consumer } of consumers)
187
- if (!live.has(consumer))
188
- this.deleteConsumer(consumer);
189
- }
190
- close() {
191
- if (this.#db.isOpen)
192
- this.#db.close();
193
- }
194
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * `http.egress@1`: HTTPS requests to the public internet, made for the caller by the provider.
3
- * A request names its destination by its absolute `https:` URL. A slot of it is a host module's
4
- * whole network.
5
- */
6
- export declare const httpEgress: import("@agentorg/sdk").HttpInterface<"http.egress">;
@@ -1,7 +0,0 @@
1
- import { defineInterface } from "@agentorg/sdk";
2
- /**
3
- * `http.egress@1`: HTTPS requests to the public internet, made for the caller by the provider.
4
- * A request names its destination by its absolute `https:` URL. A slot of it is a host module's
5
- * whole network.
6
- */
7
- export const httpEgress = defineInterface({ name: "http.egress", major: 1, kind: "http" });
@@ -1,191 +0,0 @@
1
- import { z } from "zod";
2
- /**
3
- * `agentorg.system/1`: a system as data, by names, never by ids. Its Actors and the packages
4
- * they run (`name@version#hash`), its connections, and the person's layout. Built-in Actors
5
- * (`hub`, `storage`, `net`) are named by their ids. No credentials, tokens, stores or logs.
6
- */
7
- export declare const Composition: z.ZodObject<{
8
- format: z.ZodLiteral<"agentorg.system/1">;
9
- actors: z.ZodRecord<z.ZodString, z.ZodObject<{
10
- package: z.ZodString;
11
- running: z.ZodOptional<z.ZodBoolean>;
12
- }, z.core.$strip>>;
13
- connections: z.ZodArray<z.ZodObject<{
14
- consumer: z.ZodString;
15
- slot: z.ZodString;
16
- provider: z.ZodString;
17
- export: z.ZodString;
18
- }, z.core.$strip>>;
19
- layout: z.ZodObject<{
20
- home: z.ZodArray<z.ZodObject<{
21
- actor: z.ZodString;
22
- module: z.ZodString;
23
- title: z.ZodOptional<z.ZodString>;
24
- }, z.core.$strip>>;
25
- }, z.core.$strip>;
26
- }, z.core.$strip>;
27
- /**
28
- * `installer@1`: how a package becomes a working Actor. The installer is a package Actor the
29
- * person binds to the Hub's management (packages, Actors, grants, exports) and to
30
- * `storage.admin@1`; it proposes what each slot could connect to, and installs with the
31
- * connections it is given. It never picks a connection itself.
32
- */
33
- export declare const installer: import("@agentorg/sdk").RpcInterface<"installer", {
34
- /**
35
- * For each of the package's slots that it doesn't wire itself (`module.slot`): its interface
36
- * (`name@major`) and the exports that could serve it now, those of exactly that interface and
37
- * schema hash on Actors that aren't stopped or closed. And its view modules, which a shell
38
- * can place.
39
- */
40
- plan: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
41
- package: z.ZodString;
42
- expose: z.ZodOptional<z.ZodArray<z.ZodObject<{
43
- export: z.ZodString;
44
- to: z.ZodString;
45
- }, z.core.$strip>>>;
46
- }, z.core.$strip>, z.ZodObject<{
47
- slots: z.ZodArray<z.ZodObject<{
48
- slot: z.ZodString;
49
- interface: z.ZodString;
50
- candidates: z.ZodArray<z.ZodObject<{
51
- actor: z.ZodString;
52
- export: z.ZodString;
53
- }, z.core.$strip>>;
54
- }, z.core.$strip>>;
55
- views: z.ZodArray<z.ZodString>;
56
- exposes: z.ZodArray<z.ZodObject<{
57
- export: z.ZodString;
58
- to: z.ZodString;
59
- settles: z.ZodEnum<{
60
- granted: "granted";
61
- request: "request";
62
- }>;
63
- }, z.core.$strip>>;
64
- }, z.core.$strip>>;
65
- /**
66
- * Create an Actor of the package named `name`, with exactly these connections, all or none.
67
- * The installer grants nothing its caller couldn't: each connection's export side must be the
68
- * caller's (it is the provider, is bound to that export, or is a manager), else the whole
69
- * install is refused (`forbidden`, listing every such connection) and nothing is created. A
70
- * slot bound to `storage`'s `kv` gets the package's seed for it (an object of key to value);
71
- * a seed whose slot isn't is listed in `unseeded`. Then it is started if `start`. If a seed or
72
- * the start fails, the new Actor is closed. Slots left out stay unbound, listed in `unbound`.
73
- * The Actor is recorded as made for the caller (`installedFor`), which grants nothing.
74
- *
75
- * `expose` lists the new Actor's exports to expose (`rpc` exports of its host modules), each to one Actor, all or none like the
76
- * connections: a manager's are made now (`granted`, with the slot); one to the caller itself
77
- * is left for the caller to file (`request`, with the exact `hub.grants.expose` call); any
78
- * other is refused, and nothing is created. Nothing is exposed that isn't listed.
79
- */
80
- install: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
81
- package: z.ZodString;
82
- name: z.ZodString;
83
- connections: z.ZodRecord<z.ZodString, z.ZodObject<{
84
- actor: z.ZodString;
85
- export: z.ZodString;
86
- }, z.core.$strip>>;
87
- start: z.ZodOptional<z.ZodBoolean>;
88
- expose: z.ZodOptional<z.ZodArray<z.ZodObject<{
89
- export: z.ZodString;
90
- to: z.ZodString;
91
- }, z.core.$strip>>>;
92
- }, z.core.$strip>, z.ZodObject<{
93
- actorId: z.ZodString;
94
- unbound: z.ZodArray<z.ZodString>;
95
- unseeded: z.ZodArray<z.ZodString>;
96
- exposures: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
97
- export: z.ZodString;
98
- to: z.ZodString;
99
- settles: z.ZodLiteral<"granted">;
100
- slot: z.ZodString;
101
- }, z.core.$strip>, z.ZodObject<{
102
- export: z.ZodString;
103
- to: z.ZodString;
104
- settles: z.ZodLiteral<"request">;
105
- call: z.ZodObject<{
106
- provider: z.ZodString;
107
- export: z.ZodString;
108
- to: z.ZodString;
109
- }, z.core.$strip>;
110
- }, z.core.$strip>]>>;
111
- }, z.core.$strip>>;
112
- /**
113
- * The system as it is, as a composition: every package Actor that isn't closed, the
114
- * connections among them and to the built-in Actors, and the layout. External Actors (a
115
- * program that connects itself, the person) and connections to them are listed in
116
- * `unresolved`, not exported. Only a manager (an Actor bound to `hub.bindings`, as the person
117
- * is) may export: a caller that isn't is refused `forbidden`.
118
- */
119
- exportSystem: import("@agentorg/sdk").MethodSpec<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
120
- composition: z.ZodObject<{
121
- format: z.ZodLiteral<"agentorg.system/1">;
122
- actors: z.ZodRecord<z.ZodString, z.ZodObject<{
123
- package: z.ZodString;
124
- running: z.ZodOptional<z.ZodBoolean>;
125
- }, z.core.$strip>>;
126
- connections: z.ZodArray<z.ZodObject<{
127
- consumer: z.ZodString;
128
- slot: z.ZodString;
129
- provider: z.ZodString;
130
- export: z.ZodString;
131
- }, z.core.$strip>>;
132
- layout: z.ZodObject<{
133
- home: z.ZodArray<z.ZodObject<{
134
- actor: z.ZodString;
135
- module: z.ZodString;
136
- title: z.ZodOptional<z.ZodString>;
137
- }, z.core.$strip>>;
138
- }, z.core.$strip>;
139
- }, z.core.$strip>;
140
- unresolved: z.ZodArray<z.ZodObject<{
141
- what: z.ZodString;
142
- why: z.ZodString;
143
- }, z.core.$strip>>;
144
- }, z.core.$strip>>;
145
- /**
146
- * Make a composition's system here, with the caller's authority: every connection's export
147
- * side must be the caller's, as in `install`, or nothing is made (`forbidden`, listing them).
148
- * Its packages must already be added (a composition travels with them; whoever holds the
149
- * files adds them). An Actor whose package isn't here (or is another version) isn't made, and
150
- * is listed in `unresolved` with what depends on it; so is an Actor that needs a sign-in, a
151
- * seed that can't land, and the placements, unless the caller holds the person's layout.
152
- * A connection to the Hub's management (`hub`) or to `storage.admin` is never made by an
153
- * import, even a manager's: a composition may come from anyone, so those are listed in
154
- * `ungranted`, for the person to grant one by one. A name already taken gets a suffix. Seeds land as in `install`; what was running is
155
- * started; the layout is placed. If anything else fails, what this import made is closed.
156
- */
157
- importSystem: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
158
- composition: z.ZodObject<{
159
- format: z.ZodLiteral<"agentorg.system/1">;
160
- actors: z.ZodRecord<z.ZodString, z.ZodObject<{
161
- package: z.ZodString;
162
- running: z.ZodOptional<z.ZodBoolean>;
163
- }, z.core.$strip>>;
164
- connections: z.ZodArray<z.ZodObject<{
165
- consumer: z.ZodString;
166
- slot: z.ZodString;
167
- provider: z.ZodString;
168
- export: z.ZodString;
169
- }, z.core.$strip>>;
170
- layout: z.ZodObject<{
171
- home: z.ZodArray<z.ZodObject<{
172
- actor: z.ZodString;
173
- module: z.ZodString;
174
- title: z.ZodOptional<z.ZodString>;
175
- }, z.core.$strip>>;
176
- }, z.core.$strip>;
177
- }, z.core.$strip>;
178
- }, z.core.$strip>, z.ZodObject<{
179
- created: z.ZodRecord<z.ZodString, z.ZodString>;
180
- unresolved: z.ZodArray<z.ZodObject<{
181
- what: z.ZodString;
182
- why: z.ZodString;
183
- }, z.core.$strip>>;
184
- ungranted: z.ZodArray<z.ZodObject<{
185
- consumer: z.ZodString;
186
- slot: z.ZodString;
187
- provider: z.ZodString;
188
- export: z.ZodString;
189
- }, z.core.$strip>>;
190
- }, z.core.$strip>>;
191
- }, {}, 1>;
@@ -1,136 +0,0 @@
1
- import { defineInterface, method } from "@agentorg/sdk";
2
- import { z } from "zod";
3
- import { Id, Name, SlotName } from "./hub.js";
4
- const Hash = z.string().regex(/^sha256-[0-9a-f]{64}$/);
5
- /** An export of a running Actor, by its id and the export's name. */
6
- const Target = z.object({ actor: Id, export: Name });
7
- /** One of the new Actor's `rpc` exports (`module.export`), to expose to the Actor `to`. */
8
- const Exposure = z.object({ export: Name, to: Id });
9
- /**
10
- * How an exposure settles, by the caller's own authority: `granted`, made now (the caller holds
11
- * both sides: it is a manager), or `request`, which the caller files itself with
12
- * `hub.grants.expose` (it holds `to`'s side: it is `to`). Nothing else is exposed.
13
- */
14
- const Settles = z.enum(["granted", "request"]);
15
- /** An Actor of a composition, by the name it has there. */
16
- const ActorName = z.string().min(1).max(128);
17
- /**
18
- * `agentorg.system/1`: a system as data, by names, never by ids. Its Actors and the packages
19
- * they run (`name@version#hash`), its connections, and the person's layout. Built-in Actors
20
- * (`hub`, `storage`, `net`) are named by their ids. No credentials, tokens, stores or logs.
21
- */
22
- export const Composition = z.object({
23
- format: z.literal("agentorg.system/1"),
24
- actors: z.record(ActorName, z.object({ package: z.string(), running: z.boolean().optional() })),
25
- connections: z.array(z.object({ consumer: ActorName, slot: Name, provider: ActorName, export: Name })),
26
- layout: z.object({
27
- home: z.array(z.object({
28
- actor: ActorName,
29
- module: z
30
- .string()
31
- .regex(/^[a-z][A-Za-z0-9_]*$/)
32
- .max(64),
33
- title: z.string().max(200).optional(),
34
- })),
35
- }),
36
- });
37
- /** What a system's export or import couldn't carry over, and why: listed, never guessed. */
38
- const Unresolved = z.array(z.object({ what: z.string(), why: z.string() }));
39
- /**
40
- * `installer@1`: how a package becomes a working Actor. The installer is a package Actor the
41
- * person binds to the Hub's management (packages, Actors, grants, exports) and to
42
- * `storage.admin@1`; it proposes what each slot could connect to, and installs with the
43
- * connections it is given. It never picks a connection itself.
44
- */
45
- export const installer = defineInterface({
46
- name: "installer",
47
- major: 1,
48
- kind: "rpc",
49
- methods: {
50
- /**
51
- * For each of the package's slots that it doesn't wire itself (`module.slot`): its interface
52
- * (`name@major`) and the exports that could serve it now, those of exactly that interface and
53
- * schema hash on Actors that aren't stopped or closed. And its view modules, which a shell
54
- * can place.
55
- */
56
- plan: method({
57
- input: z.object({ package: Hash, expose: z.array(Exposure).max(64).optional() }),
58
- output: z.object({
59
- slots: z.array(z.object({ slot: Name, interface: z.string(), candidates: z.array(Target) })),
60
- views: z.array(z.string()),
61
- /**
62
- * Each `expose` entry given, with how `install` would settle it for this caller; an entry
63
- * `install` would refuse is refused here the same way.
64
- */
65
- exposes: z.array(Exposure.extend({ settles: Settles })),
66
- }),
67
- }),
68
- /**
69
- * Create an Actor of the package named `name`, with exactly these connections, all or none.
70
- * The installer grants nothing its caller couldn't: each connection's export side must be the
71
- * caller's (it is the provider, is bound to that export, or is a manager), else the whole
72
- * install is refused (`forbidden`, listing every such connection) and nothing is created. A
73
- * slot bound to `storage`'s `kv` gets the package's seed for it (an object of key to value);
74
- * a seed whose slot isn't is listed in `unseeded`. Then it is started if `start`. If a seed or
75
- * the start fails, the new Actor is closed. Slots left out stay unbound, listed in `unbound`.
76
- * The Actor is recorded as made for the caller (`installedFor`), which grants nothing.
77
- *
78
- * `expose` lists the new Actor's exports to expose (`rpc` exports of its host modules), each to one Actor, all or none like the
79
- * connections: a manager's are made now (`granted`, with the slot); one to the caller itself
80
- * is left for the caller to file (`request`, with the exact `hub.grants.expose` call); any
81
- * other is refused, and nothing is created. Nothing is exposed that isn't listed.
82
- */
83
- install: method({
84
- input: z.object({
85
- package: Hash,
86
- name: z.string().min(1).max(128),
87
- connections: z.record(Name, Target),
88
- start: z.boolean().optional(),
89
- expose: z.array(Exposure).max(64).optional(),
90
- }),
91
- output: z.object({
92
- actorId: Id,
93
- unbound: z.array(Name),
94
- unseeded: z.array(Name),
95
- exposures: z.array(z.union([
96
- Exposure.extend({ settles: z.literal("granted"), slot: SlotName }),
97
- Exposure.extend({
98
- settles: z.literal("request"),
99
- call: z.object({ provider: Id, export: Name, to: Id }),
100
- }),
101
- ])),
102
- }),
103
- }),
104
- /**
105
- * The system as it is, as a composition: every package Actor that isn't closed, the
106
- * connections among them and to the built-in Actors, and the layout. External Actors (a
107
- * program that connects itself, the person) and connections to them are listed in
108
- * `unresolved`, not exported. Only a manager (an Actor bound to `hub.bindings`, as the person
109
- * is) may export: a caller that isn't is refused `forbidden`.
110
- */
111
- exportSystem: method({
112
- input: z.object({}),
113
- output: z.object({ composition: Composition, unresolved: Unresolved }),
114
- }),
115
- /**
116
- * Make a composition's system here, with the caller's authority: every connection's export
117
- * side must be the caller's, as in `install`, or nothing is made (`forbidden`, listing them).
118
- * Its packages must already be added (a composition travels with them; whoever holds the
119
- * files adds them). An Actor whose package isn't here (or is another version) isn't made, and
120
- * is listed in `unresolved` with what depends on it; so is an Actor that needs a sign-in, a
121
- * seed that can't land, and the placements, unless the caller holds the person's layout.
122
- * A connection to the Hub's management (`hub`) or to `storage.admin` is never made by an
123
- * import, even a manager's: a composition may come from anyone, so those are listed in
124
- * `ungranted`, for the person to grant one by one. A name already taken gets a suffix. Seeds land as in `install`; what was running is
125
- * started; the layout is placed. If anything else fails, what this import made is closed.
126
- */
127
- importSystem: method({
128
- input: z.object({ composition: Composition }),
129
- output: z.object({
130
- created: z.record(ActorName, Id),
131
- unresolved: Unresolved,
132
- ungranted: z.array(z.object({ consumer: ActorName, slot: Name, provider: ActorName, export: Name })),
133
- }),
134
- }),
135
- },
136
- });
@@ -1,47 +0,0 @@
1
- import { z } from "zod";
2
- /** One view on the dashboard: a `view` module of a running package Actor. */
3
- export declare const Placement: z.ZodObject<{
4
- id: z.ZodString;
5
- actor: z.ZodString;
6
- module: z.ZodString;
7
- title: z.ZodOptional<z.ZodString>;
8
- by: z.ZodOptional<z.ZodString>;
9
- }, z.core.$strip>;
10
- /**
11
- * `layout@1`: the person's dashboard, the views placed on it and their order. The person's Actor
12
- * exports it, so a program bound to it places a widget as the person does.
13
- */
14
- export declare const layout: import("@agentorg/sdk").RpcInterface<"layout", {
15
- get: import("@agentorg/sdk").MethodSpec<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
16
- home: z.ZodArray<z.ZodObject<{
17
- id: z.ZodString;
18
- actor: z.ZodString;
19
- module: z.ZodString;
20
- title: z.ZodOptional<z.ZodString>;
21
- by: z.ZodOptional<z.ZodString>;
22
- }, z.core.$strip>>;
23
- }, z.core.$strip>>;
24
- /**
25
- * Place a view, after the placement `after`, or last. Refused unless `module` is a `view`
26
- * module of that Actor's package.
27
- */
28
- place: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
29
- actor: z.ZodString;
30
- module: z.ZodString;
31
- title: z.ZodOptional<z.ZodString>;
32
- after: z.ZodOptional<z.ZodString>;
33
- }, z.core.$strip>, z.ZodObject<{
34
- id: z.ZodString;
35
- }, z.core.$strip>>;
36
- remove: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
37
- id: z.ZodString;
38
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
39
- /** Move a placement after `after`, or first. */
40
- move: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
41
- id: z.ZodString;
42
- after: z.ZodOptional<z.ZodString>;
43
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
44
- }, {
45
- /** The layout changed; read it again with `get`. */
46
- changed: import("@agentorg/sdk").EventSpec<z.ZodObject<{}, z.core.$strip>>;
47
- }, 1>;
@@ -1,52 +0,0 @@
1
- import { defineInterface, event, method } from "@agentorg/sdk";
2
- import { z } from "zod";
3
- const Id = z.string().min(1).max(128);
4
- /** A module of a package, by its name in the manifest. */
5
- const ModuleName = z
6
- .string()
7
- .regex(/^[a-z][A-Za-z0-9_]*$/)
8
- .max(64);
9
- /** One view on the dashboard: a `view` module of a running package Actor. */
10
- export const Placement = z.object({
11
- id: Id,
12
- actor: Id,
13
- module: ModuleName,
14
- title: z.string().max(200).optional(),
15
- /**
16
- * The Actor that placed it, as the layout's provider saw the call: the person, or an agent bound
17
- * to `layout@1`. The provider records it; `place` takes no such input.
18
- */
19
- by: Id.optional(),
20
- });
21
- /**
22
- * `layout@1`: the person's dashboard, the views placed on it and their order. The person's Actor
23
- * exports it, so a program bound to it places a widget as the person does.
24
- */
25
- export const layout = defineInterface({
26
- name: "layout",
27
- major: 1,
28
- kind: "rpc",
29
- methods: {
30
- get: method({ input: z.object({}), output: z.object({ home: z.array(Placement) }) }),
31
- /**
32
- * Place a view, after the placement `after`, or last. Refused unless `module` is a `view`
33
- * module of that Actor's package.
34
- */
35
- place: method({
36
- input: z.object({
37
- actor: Id,
38
- module: ModuleName,
39
- title: z.string().max(200).optional(),
40
- after: Id.optional(),
41
- }),
42
- output: z.object({ id: Id }),
43
- }),
44
- remove: method({ input: z.object({ id: Id }), output: z.object({}) }),
45
- /** Move a placement after `after`, or first. */
46
- move: method({ input: z.object({ id: Id, after: Id.optional() }), output: z.object({}) }),
47
- },
48
- events: {
49
- /** The layout changed; read it again with `get`. */
50
- changed: event(z.object({})),
51
- },
52
- });
@@ -1,35 +0,0 @@
1
- import { z } from "zod";
2
- /**
3
- * One named rule: a convenience the person turns on, off unless they do. `says` is what it does,
4
- * in the person's words.
5
- */
6
- export declare const Rule: z.ZodObject<{
7
- id: z.ZodString;
8
- name: z.ZodString;
9
- says: z.ZodString;
10
- on: z.ZodBoolean;
11
- }, z.core.$strip>;
12
- /**
13
- * `app.rules@1`: the person's named rules. Each is held by the person's Actor (the app's gateway),
14
- * which acts on a rule that is on as the person, a manager, and only within what the person could
15
- * grant. A rule is the only thing that may act on provenance such as an Actor's `installedFor`.
16
- */
17
- export declare const appRules: import("@agentorg/sdk").RpcInterface<"app.rules", {
18
- /** Every rule the app knows, each with whether it is on. */
19
- list: import("@agentorg/sdk").MethodSpec<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
20
- rules: z.ZodArray<z.ZodObject<{
21
- id: z.ZodString;
22
- name: z.ZodString;
23
- says: z.ZodString;
24
- on: z.ZodBoolean;
25
- }, z.core.$strip>>;
26
- }, z.core.$strip>>;
27
- /** Turn a rule on or off. Turning one on settles what already waits for it. */
28
- set: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
29
- id: z.ZodString;
30
- on: z.ZodBoolean;
31
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
32
- }, {
33
- /** A rule was turned on or off; read them again with `list`. */
34
- changed: import("@agentorg/sdk").EventSpec<z.ZodObject<{}, z.core.$strip>>;
35
- }, 1>;