@agentorg/cli 0.0.3 → 0.0.5
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 +15 -11
- package/dist/bundled/index.json +4 -4
- package/dist/bundled/{sha256-87e121cbe58279f3a633e61c9773b61fc17fd53eac3d7c6f037925cbfd5d5384.agentorg → sha256-0e91cc3d0e9762b81abc2427b5496b20f383abcd6fb97d928a8d50e956b54d1f.agentorg} +0 -0
- package/dist/bundled/sha256-1f64ca62a0209d767d6aa6c4feb50b0653d60f10bebbc301f79bd3a37e0153c1.agentorg +0 -0
- package/dist/bundled/{sha256-51ecf151e590f5e57f28229d4cb36e4932a2f1670e50ddf1a3ccf335a1ee146d.agentorg → sha256-4055f8fddf6b90f3d356543f554b2a9e9a2c4a8827a8774f8f87952dc1692331.agentorg} +0 -0
- package/dist/bundled/{sha256-b76ec31282e5b863ee9569dfd9d50b283a21101cbe1b3fac23d1cbcf16b9a408.agentorg → sha256-e356ea3c1899138a8494baf521556831006f38534fa9e92ae873e7e6956c3a46.agentorg} +0 -0
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/build.d.ts +2 -2
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/build.js +14 -4
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/hub-actor.js +41 -0
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/index.d.ts +1 -1
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/index.js +1 -1
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/router.js +40 -16
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/state.d.ts +87 -2
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/state.js +312 -60
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/storage.d.ts +2 -1
- package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/storage.js +3 -2
- package/{node_modules → dist/node_modules}/@agentorg/hub/package.json +3 -0
- package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/hub.d.ts +62 -3
- package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/hub.js +54 -3
- package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/index.d.ts +1 -0
- package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/index.js +1 -0
- package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/installer.d.ts +37 -0
- package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/installer.js +34 -3
- package/dist/node_modules/@agentorg/interfaces/dist/src/rules.d.ts +35 -0
- package/dist/node_modules/@agentorg/interfaces/dist/src/rules.js +37 -0
- package/dist/node_modules/@agentorg/kit/dist/src/chat.d.ts +37 -0
- package/dist/node_modules/@agentorg/kit/dist/src/chat.js +131 -0
- package/dist/node_modules/@agentorg/kit/dist/src/components.d.ts +94 -0
- package/dist/node_modules/@agentorg/kit/dist/src/components.js +66 -0
- package/dist/node_modules/@agentorg/kit/dist/src/icons.d.ts +17 -0
- package/dist/node_modules/@agentorg/kit/dist/src/icons.js +30 -0
- package/dist/node_modules/@agentorg/kit/dist/src/index.d.ts +6 -0
- package/dist/node_modules/@agentorg/kit/dist/src/index.js +10 -0
- package/dist/node_modules/@agentorg/kit/dist/src/markdown.d.ts +9 -0
- package/dist/node_modules/@agentorg/kit/dist/src/markdown.js +14 -0
- package/dist/node_modules/@agentorg/kit/dist/src/resizable.d.ts +5 -0
- package/dist/node_modules/@agentorg/kit/dist/src/resizable.js +8 -0
- package/dist/node_modules/@agentorg/kit/dist/src/styles.d.ts +11 -0
- package/dist/node_modules/@agentorg/kit/dist/src/styles.js +166 -0
- package/dist/node_modules/@agentorg/kit/package.json +44 -0
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/frame/runtime.js +172 -17
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/host/runner.js +168 -11
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/client.d.ts +18 -0
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/client.js +24 -3
- package/dist/node_modules/@agentorg/sdk/dist/src/frame-base.d.ts +8 -0
- package/dist/node_modules/@agentorg/sdk/dist/src/frame-base.js +64 -0
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/frame-entry.js +4 -4
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/frame-host.d.ts +1 -10
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/frame-host.js +0 -23
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/frame-protocol.d.ts +0 -8
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/frame.d.ts +0 -2
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/frame.js +0 -8
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/host.js +5 -0
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/index.d.ts +1 -1
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/module-host.d.ts +6 -1
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/module-host.js +24 -1
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/module.d.ts +30 -1
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/package.js +111 -6
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/runtime.d.ts +22 -1
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/runtime.js +114 -0
- package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/testing.d.ts +14 -2
- package/dist/node_modules/@agentorg/sdk/dist/src/testing.js +89 -0
- package/{node_modules → dist/node_modules}/@agentorg/shell/dist/app.css +27 -144
- package/dist/node_modules/@agentorg/shell/dist/app.js +219 -0
- package/{node_modules → dist/node_modules}/@agentorg/shell/package.json +1 -0
- package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/index.d.ts +1 -1
- package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/ops.d.ts +14 -1
- package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/ops.js +22 -2
- package/dist/src/cli.js +23 -0
- package/dist/src/gateway.js +42 -1
- package/dist/src/model.d.ts +7 -4
- package/dist/src/model.js +83 -14
- package/dist/src/rules.d.ts +71 -0
- package/dist/src/rules.js +157 -0
- package/package.json +13 -16
- package/dist/bundled/sha256-e4c0e857cea3a721998effe2ca859c4011978b9bc36e63c058bfc17c27a1772e.agentorg +0 -0
- package/node_modules/@agentorg/sdk/dist/src/testing.js +0 -51
- package/node_modules/@agentorg/shell/dist/app.js +0 -9
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/hub-actor.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/logs.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/logs.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/net.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/net.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/processes.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/processes.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/router.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/server.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/server.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/validate-worker.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/validate-worker.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/validate.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/hub/dist/src/validate.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/account-login.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/account-login.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/chat.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/chat.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/http-egress.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/http-egress.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/kv.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/kv.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/layout.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/layout.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/llm-session.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/llm-session.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/storage-admin.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/storage-admin.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/ui-shell.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/ui-shell.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/ui-view.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/dist/src/ui-view.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/interfaces/package.json +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/build.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/build.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/canonical.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/canonical.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/cli.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/cli.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/client-http.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/client-http.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/describe.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/describe.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/errors.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/errors.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/frame-entry.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/frame-protocol.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/host-main.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/host-main.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/host.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/index.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/interface.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/interface.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/manifest-api.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/manifest-api.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/manifest.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/manifest.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/module.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/package.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/person-commands.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/person-commands.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/tar.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/dist/src/tar.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/sdk/package.json +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/shell/dist/agent-bindings.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/shell/dist/index.html +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/shell/src/agent-bindings.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/bytes.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/bytes.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/frames.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/frames.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/index.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/transports.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/transports.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/yamux.d.ts +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/dist/src/yamux.js +0 -0
- /package/{node_modules → dist/node_modules}/@agentorg/wire/package.json +0 -0
|
@@ -139,7 +139,8 @@ export class Storage {
|
|
|
139
139
|
* Seed the store of (consumer, slot), all or none, if it holds nothing: `storage.admin@1`'s
|
|
140
140
|
* `seed`. Each entry has kv@1's limits, and together they count toward the consumer's quota.
|
|
141
141
|
*/
|
|
142
|
-
|
|
142
|
+
/** `named` is the consumer as a refusal names it: "Name (id)". */
|
|
143
|
+
seed(consumer, slot, entries, named = consumer) {
|
|
143
144
|
const keys = new Set();
|
|
144
145
|
const rows = entries.map(({ key, value }) => {
|
|
145
146
|
checkKey(key);
|
|
@@ -159,7 +160,7 @@ export class Storage {
|
|
|
159
160
|
if (this.#db
|
|
160
161
|
.prepare("SELECT 1 FROM store WHERE consumer = ? AND slot = ? LIMIT 1")
|
|
161
162
|
.get(consumer, slot))
|
|
162
|
-
throw new Refused("not_empty", `The store of ${
|
|
163
|
+
throw new Refused("not_empty", `The store of ${named}'s ${slot} isn't empty.`);
|
|
163
164
|
const used = this.#db.prepare("SELECT used FROM usage WHERE consumer = ?").get(consumer);
|
|
164
165
|
if (Number(used?.used ?? 0) + total > this.#limits.maxPerConsumer)
|
|
165
166
|
throw new Refused("quota", `An Actor's stores hold at most ${this.#limits.maxPerConsumer} bytes.`);
|
|
@@ -23,9 +23,12 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@agentorg/interfaces": "0.0.0",
|
|
26
|
+
"@agentorg/kit": "0.0.0",
|
|
26
27
|
"@agentorg/sdk": "0.0.0",
|
|
27
28
|
"@agentorg/wire": "0.0.0",
|
|
28
29
|
"ajv": "^8.20.0",
|
|
30
|
+
"react": "^19.3.1",
|
|
31
|
+
"react-dom": "^19.3.1",
|
|
29
32
|
"ws": "^8.22.1",
|
|
30
33
|
"zod": "^4.6.7"
|
|
31
34
|
},
|
|
@@ -36,8 +36,8 @@ export declare const hubPackages: import("@agentorg/sdk").RpcInterface<"hub.pack
|
|
|
36
36
|
/**
|
|
37
37
|
* Build a package from its source, given as data (`package.json` and files under `src/`, up to
|
|
38
38
|
* 768 KiB), and add it as `add` does. It's `agentorg build`'s build, reading no tsconfig; its
|
|
39
|
-
* files import only `@agentorg/sdk`, `@agentorg/interfaces`
|
|
40
|
-
* the package's folder, never by a pattern. A build that fails is
|
|
39
|
+
* files import only `@agentorg/sdk`, `@agentorg/interfaces`, `zod`, `react`, `react-dom` and
|
|
40
|
+
* `@agentorg/kit` by name, and nothing outside the package's folder, never by a pattern. A build that fails is
|
|
41
41
|
* `Refused("build")` with the build's message, so the source can be fixed and built again.
|
|
42
42
|
*/
|
|
43
43
|
build: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
|
|
@@ -75,6 +75,7 @@ export declare const Actor: z.ZodObject<{
|
|
|
75
75
|
reason: z.ZodOptional<z.ZodString>;
|
|
76
76
|
}, z.core.$strip>>;
|
|
77
77
|
views: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
78
|
+
installedFor: z.ZodOptional<z.ZodString>;
|
|
78
79
|
}, z.core.$strip>;
|
|
79
80
|
/** One line of an Actor's log, from its `ctx.log` or its process's own output. */
|
|
80
81
|
export declare const LogLine: z.ZodObject<{
|
|
@@ -93,11 +94,13 @@ export declare const hubActors: import("@agentorg/sdk").RpcInterface<"hub.actors
|
|
|
93
94
|
/**
|
|
94
95
|
* With a package, an Actor that runs it; without, an external one, whose credential is returned
|
|
95
96
|
* once. `bindings` wire the new Actor's slots at once, with the caller's export-side authority
|
|
96
|
-
* (the creation is the slot side's yes), for example to its own `hub.grants@1`.
|
|
97
|
+
* (the creation is the slot side's yes), for example to its own `hub.grants@1`. `for` names
|
|
98
|
+
* the Actor it is made for, recorded as `installedFor`; only a manager may give it.
|
|
97
99
|
*/
|
|
98
100
|
create: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
|
|
99
101
|
name: z.ZodString;
|
|
100
102
|
package: z.ZodOptional<z.ZodString>;
|
|
103
|
+
for: z.ZodOptional<z.ZodString>;
|
|
101
104
|
bindings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
102
105
|
slot: z.ZodString;
|
|
103
106
|
provider: z.ZodString;
|
|
@@ -130,6 +133,7 @@ export declare const hubActors: import("@agentorg/sdk").RpcInterface<"hub.actors
|
|
|
130
133
|
reason: z.ZodOptional<z.ZodString>;
|
|
131
134
|
}, z.core.$strip>>;
|
|
132
135
|
views: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
136
|
+
installedFor: z.ZodOptional<z.ZodString>;
|
|
133
137
|
}, z.core.$strip>>;
|
|
134
138
|
}, z.core.$strip>>;
|
|
135
139
|
get: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
|
|
@@ -156,6 +160,7 @@ export declare const hubActors: import("@agentorg/sdk").RpcInterface<"hub.actors
|
|
|
156
160
|
reason: z.ZodOptional<z.ZodString>;
|
|
157
161
|
}, z.core.$strip>>;
|
|
158
162
|
views: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
163
|
+
installedFor: z.ZodOptional<z.ZodString>;
|
|
159
164
|
}, z.core.$strip>>;
|
|
160
165
|
start: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
|
|
161
166
|
actorId: z.ZodString;
|
|
@@ -167,6 +172,25 @@ export declare const hubActors: import("@agentorg/sdk").RpcInterface<"hub.actors
|
|
|
167
172
|
close: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
|
|
168
173
|
actorId: z.ZodString;
|
|
169
174
|
}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
|
|
175
|
+
/**
|
|
176
|
+
* Run another package as the same package Actor: its id, its stores and every binding whose
|
|
177
|
+
* interfaces still match stay. A binding through a slot or export the new package drops, or
|
|
178
|
+
* declares as another interface, is dropped and listed in `dropped`; the new package's own
|
|
179
|
+
* wiring is made where its slot is unbound. A running Actor restarts on the new package.
|
|
180
|
+
* Only a manager may upgrade: the new package runs as the Actor and keeps what it was granted
|
|
181
|
+
* (its bindings and its store), which only a manager could grant anyway.
|
|
182
|
+
*/
|
|
183
|
+
upgrade: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
|
|
184
|
+
actorId: z.ZodString;
|
|
185
|
+
package: z.ZodString;
|
|
186
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
187
|
+
dropped: z.ZodArray<z.ZodObject<{
|
|
188
|
+
consumer: z.ZodString;
|
|
189
|
+
slot: z.ZodString;
|
|
190
|
+
provider: z.ZodString;
|
|
191
|
+
export: z.ZodString;
|
|
192
|
+
}, z.core.$strip>>;
|
|
193
|
+
}, z.core.$strip>>;
|
|
170
194
|
/** Its newest log lines, oldest first. */
|
|
171
195
|
logs: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
|
|
172
196
|
actorId: z.ZodString;
|
|
@@ -193,6 +217,8 @@ export declare const hubActors: import("@agentorg/sdk").RpcInterface<"hub.actors
|
|
|
193
217
|
actor: z.ZodString;
|
|
194
218
|
}, z.core.$strip>>;
|
|
195
219
|
}, 1>;
|
|
220
|
+
/** A slot made at run time: one segment, at most 48 characters, so tools named from it fit. */
|
|
221
|
+
export declare const SlotName: z.ZodString;
|
|
196
222
|
export declare const Binding: z.ZodObject<{
|
|
197
223
|
consumer: z.ZodString;
|
|
198
224
|
slot: z.ZodString;
|
|
@@ -201,6 +227,7 @@ export declare const Binding: z.ZodObject<{
|
|
|
201
227
|
interface: z.ZodString;
|
|
202
228
|
madeBy: z.ZodString;
|
|
203
229
|
at: z.ZodString;
|
|
230
|
+
exposed: z.ZodOptional<z.ZodLiteral<true>>;
|
|
204
231
|
}, z.core.$strip>;
|
|
205
232
|
export declare const BindingRequest: z.ZodObject<{
|
|
206
233
|
consumer: z.ZodString;
|
|
@@ -215,6 +242,7 @@ export declare const BindingRequest: z.ZodObject<{
|
|
|
215
242
|
reason: z.ZodString;
|
|
216
243
|
requestedBy: z.ZodString;
|
|
217
244
|
at: z.ZodString;
|
|
245
|
+
exposed: z.ZodOptional<z.ZodLiteral<true>>;
|
|
218
246
|
}, z.core.$strip>;
|
|
219
247
|
/**
|
|
220
248
|
* `hub.grants@1`: binding with the caller's own authority, so it is safe to give any Actor. A
|
|
@@ -241,6 +269,32 @@ export declare const hubGrants: import("@agentorg/sdk").RpcInterface<"hub.grants
|
|
|
241
269
|
consumer: z.ZodString;
|
|
242
270
|
slot: z.ZodString;
|
|
243
271
|
}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
|
|
272
|
+
/**
|
|
273
|
+
* Expose an `rpc` export to one Actor: a slot made on `to`, typed by the export's interface,
|
|
274
|
+
* named `as` (by default the provider's name camelCased, `_`, and the export's last part, made
|
|
275
|
+
* unique on `to`), and bound to the export, in one step. Its authority is a binding's: with
|
|
276
|
+
* both ends it is made; with one, it is a request to the other end's approvers, who approve it
|
|
277
|
+
* by calling `expose` with the request's fields. The same export already exposed to `to`
|
|
278
|
+
* gives that slot back.
|
|
279
|
+
*/
|
|
280
|
+
expose: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
|
|
281
|
+
provider: z.ZodString;
|
|
282
|
+
export: z.ZodString;
|
|
283
|
+
to: z.ZodString;
|
|
284
|
+
as: z.ZodOptional<z.ZodString>;
|
|
285
|
+
}, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
|
|
286
|
+
exposed: z.ZodLiteral<true>;
|
|
287
|
+
slot: z.ZodString;
|
|
288
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
289
|
+
exposed: z.ZodLiteral<false>;
|
|
290
|
+
slot: z.ZodString;
|
|
291
|
+
requestId: z.ZodString;
|
|
292
|
+
}, z.core.$strip>]>>;
|
|
293
|
+
/** Remove a slot made by `expose`, with its binding: as `unbind`, the consumer, the provider or a manager may. */
|
|
294
|
+
unexpose: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
|
|
295
|
+
to: z.ZodString;
|
|
296
|
+
slot: z.ZodString;
|
|
297
|
+
}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
|
|
244
298
|
request: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
|
|
245
299
|
consumer: z.ZodString;
|
|
246
300
|
slot: z.ZodString;
|
|
@@ -265,6 +319,7 @@ export declare const hubGrants: import("@agentorg/sdk").RpcInterface<"hub.grants
|
|
|
265
319
|
reason: z.ZodString;
|
|
266
320
|
requestedBy: z.ZodString;
|
|
267
321
|
at: z.ZodString;
|
|
322
|
+
exposed: z.ZodOptional<z.ZodLiteral<true>>;
|
|
268
323
|
}, z.core.$strip>>;
|
|
269
324
|
}, z.core.$strip>>;
|
|
270
325
|
decline: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
|
|
@@ -290,6 +345,7 @@ export declare const hubGrants: import("@agentorg/sdk").RpcInterface<"hub.grants
|
|
|
290
345
|
reason: z.ZodString;
|
|
291
346
|
requestedBy: z.ZodString;
|
|
292
347
|
at: z.ZodString;
|
|
348
|
+
exposed: z.ZodOptional<z.ZodLiteral<true>>;
|
|
293
349
|
status: z.ZodEnum<{
|
|
294
350
|
approved: "approved";
|
|
295
351
|
closed: "closed";
|
|
@@ -313,6 +369,7 @@ export declare const hubGrants: import("@agentorg/sdk").RpcInterface<"hub.grants
|
|
|
313
369
|
reason: z.ZodString;
|
|
314
370
|
requestedBy: z.ZodString;
|
|
315
371
|
at: z.ZodString;
|
|
372
|
+
exposed: z.ZodOptional<z.ZodLiteral<true>>;
|
|
316
373
|
}, z.core.$strip>>;
|
|
317
374
|
/**
|
|
318
375
|
* A request the subscriber could approve, or made, was approved (its binding made), declined,
|
|
@@ -332,6 +389,7 @@ export declare const hubGrants: import("@agentorg/sdk").RpcInterface<"hub.grants
|
|
|
332
389
|
reason: z.ZodString;
|
|
333
390
|
requestedBy: z.ZodString;
|
|
334
391
|
at: z.ZodString;
|
|
392
|
+
exposed: z.ZodOptional<z.ZodLiteral<true>>;
|
|
335
393
|
}, z.core.$strip>;
|
|
336
394
|
status: z.ZodEnum<{
|
|
337
395
|
approved: "approved";
|
|
@@ -357,6 +415,7 @@ export declare const hubBindings: import("@agentorg/sdk").RpcInterface<"hub.bind
|
|
|
357
415
|
interface: z.ZodString;
|
|
358
416
|
madeBy: z.ZodString;
|
|
359
417
|
at: z.ZodString;
|
|
418
|
+
exposed: z.ZodOptional<z.ZodLiteral<true>>;
|
|
360
419
|
}, z.core.$strip>>;
|
|
361
420
|
}, z.core.$strip>>;
|
|
362
421
|
}, {}, 1>;
|
|
@@ -34,8 +34,8 @@ export const hubPackages = defineInterface({
|
|
|
34
34
|
/**
|
|
35
35
|
* Build a package from its source, given as data (`package.json` and files under `src/`, up to
|
|
36
36
|
* 768 KiB), and add it as `add` does. It's `agentorg build`'s build, reading no tsconfig; its
|
|
37
|
-
* files import only `@agentorg/sdk`, `@agentorg/interfaces`
|
|
38
|
-
* the package's folder, never by a pattern. A build that fails is
|
|
37
|
+
* files import only `@agentorg/sdk`, `@agentorg/interfaces`, `zod`, `react`, `react-dom` and
|
|
38
|
+
* `@agentorg/kit` by name, and nothing outside the package's folder, never by a pattern. A build that fails is
|
|
39
39
|
* `Refused("build")` with the build's message, so the source can be fixed and built again.
|
|
40
40
|
*/
|
|
41
41
|
build: method({
|
|
@@ -75,6 +75,12 @@ export const Actor = z.object({
|
|
|
75
75
|
host: z.object({ available: z.boolean(), reason: z.string().optional() }).optional(),
|
|
76
76
|
/** For a package Actor: its view modules, which the person's shell can place. */
|
|
77
77
|
views: z.array(z.string()).optional(),
|
|
78
|
+
/**
|
|
79
|
+
* The Actor it was created for, when a manager created it on another's behalf (the installer
|
|
80
|
+
* names its caller). Provenance only: the Hub grants nothing from it; only a rule the person
|
|
81
|
+
* turned on may act on it.
|
|
82
|
+
*/
|
|
83
|
+
installedFor: Id.optional(),
|
|
78
84
|
});
|
|
79
85
|
/** One line of an Actor's log, from its `ctx.log` or its process's own output. */
|
|
80
86
|
export const LogLine = z.object({
|
|
@@ -93,12 +99,14 @@ export const hubActors = defineInterface({
|
|
|
93
99
|
/**
|
|
94
100
|
* With a package, an Actor that runs it; without, an external one, whose credential is returned
|
|
95
101
|
* once. `bindings` wire the new Actor's slots at once, with the caller's export-side authority
|
|
96
|
-
* (the creation is the slot side's yes), for example to its own `hub.grants@1`.
|
|
102
|
+
* (the creation is the slot side's yes), for example to its own `hub.grants@1`. `for` names
|
|
103
|
+
* the Actor it is made for, recorded as `installedFor`; only a manager may give it.
|
|
97
104
|
*/
|
|
98
105
|
create: method({
|
|
99
106
|
input: z.object({
|
|
100
107
|
name: z.string().min(1).max(128),
|
|
101
108
|
package: Hash.optional(),
|
|
109
|
+
for: Id.optional(),
|
|
102
110
|
bindings: z
|
|
103
111
|
.array(z.object({ slot: Name, provider: Id, export: Name }))
|
|
104
112
|
.max(64)
|
|
@@ -112,6 +120,20 @@ export const hubActors = defineInterface({
|
|
|
112
120
|
stop: method({ input: z.object({ actorId: Id }), output: Empty }),
|
|
113
121
|
/** Final: its bindings, both ways, are removed. */
|
|
114
122
|
close: method({ input: z.object({ actorId: Id }), output: Empty }),
|
|
123
|
+
/**
|
|
124
|
+
* Run another package as the same package Actor: its id, its stores and every binding whose
|
|
125
|
+
* interfaces still match stay. A binding through a slot or export the new package drops, or
|
|
126
|
+
* declares as another interface, is dropped and listed in `dropped`; the new package's own
|
|
127
|
+
* wiring is made where its slot is unbound. A running Actor restarts on the new package.
|
|
128
|
+
* Only a manager may upgrade: the new package runs as the Actor and keeps what it was granted
|
|
129
|
+
* (its bindings and its store), which only a manager could grant anyway.
|
|
130
|
+
*/
|
|
131
|
+
upgrade: method({
|
|
132
|
+
input: z.object({ actorId: Id, package: Hash }),
|
|
133
|
+
output: z.object({
|
|
134
|
+
dropped: z.array(z.object({ consumer: Id, slot: Name, provider: Id, export: Name })),
|
|
135
|
+
}),
|
|
136
|
+
}),
|
|
115
137
|
/** Its newest log lines, oldest first. */
|
|
116
138
|
logs: method({
|
|
117
139
|
input: z.object({ actorId: Id, limit: z.number().int().min(1).max(1000).optional() }),
|
|
@@ -127,11 +149,18 @@ export const hubActors = defineInterface({
|
|
|
127
149
|
},
|
|
128
150
|
});
|
|
129
151
|
const Wiring = { consumer: Id, slot: Name, provider: Id, export: Name };
|
|
152
|
+
/** A slot made at run time: one segment, at most 48 characters, so tools named from it fit. */
|
|
153
|
+
export const SlotName = z
|
|
154
|
+
.string()
|
|
155
|
+
.regex(/^[a-z][A-Za-z0-9_]*$/)
|
|
156
|
+
.max(48);
|
|
130
157
|
export const Binding = z.object({
|
|
131
158
|
...Wiring,
|
|
132
159
|
interface: z.string(),
|
|
133
160
|
madeBy: Id,
|
|
134
161
|
at: z.string(),
|
|
162
|
+
/** A slot made at run time by `hub.grants.expose`: it goes with this binding. */
|
|
163
|
+
exposed: z.literal(true).optional(),
|
|
135
164
|
});
|
|
136
165
|
export const BindingRequest = z.object({
|
|
137
166
|
requestId: Id,
|
|
@@ -141,6 +170,11 @@ export const BindingRequest = z.object({
|
|
|
141
170
|
reason: z.string(),
|
|
142
171
|
requestedBy: Id,
|
|
143
172
|
at: z.string(),
|
|
173
|
+
/**
|
|
174
|
+
* A request to expose: `slot` is the name the slot will have on `consumer`, made when it is
|
|
175
|
+
* approved. Approve it with `expose({provider, export, to: consumer, as: slot})`.
|
|
176
|
+
*/
|
|
177
|
+
exposed: z.literal(true).optional(),
|
|
144
178
|
});
|
|
145
179
|
/**
|
|
146
180
|
* `hub.grants@1`: binding with the caller's own authority, so it is safe to give any Actor. A
|
|
@@ -164,6 +198,23 @@ export const hubGrants = defineInterface({
|
|
|
164
198
|
}),
|
|
165
199
|
/** The consumer, the provider or a manager may unbind. */
|
|
166
200
|
unbind: method({ input: z.object({ consumer: Id, slot: Name }), output: Empty }),
|
|
201
|
+
/**
|
|
202
|
+
* Expose an `rpc` export to one Actor: a slot made on `to`, typed by the export's interface,
|
|
203
|
+
* named `as` (by default the provider's name camelCased, `_`, and the export's last part, made
|
|
204
|
+
* unique on `to`), and bound to the export, in one step. Its authority is a binding's: with
|
|
205
|
+
* both ends it is made; with one, it is a request to the other end's approvers, who approve it
|
|
206
|
+
* by calling `expose` with the request's fields. The same export already exposed to `to`
|
|
207
|
+
* gives that slot back.
|
|
208
|
+
*/
|
|
209
|
+
expose: method({
|
|
210
|
+
input: z.object({ provider: Id, export: Name, to: Id, as: SlotName.optional() }),
|
|
211
|
+
output: z.union([
|
|
212
|
+
z.object({ exposed: z.literal(true), slot: SlotName }),
|
|
213
|
+
z.object({ exposed: z.literal(false), slot: SlotName, requestId: Id }),
|
|
214
|
+
]),
|
|
215
|
+
}),
|
|
216
|
+
/** Remove a slot made by `expose`, with its binding: as `unbind`, the consumer, the provider or a manager may. */
|
|
217
|
+
unexpose: method({ input: z.object({ to: Id, slot: SlotName }), output: Empty }),
|
|
167
218
|
request: method({
|
|
168
219
|
input: z.object({ ...Wiring, reason: z.string().min(1).max(1000) }),
|
|
169
220
|
output: z.object({ requestId: Id }),
|
|
@@ -6,6 +6,7 @@ export { Composition, installer } from "./installer.js";
|
|
|
6
6
|
export { kv } from "./kv.js";
|
|
7
7
|
export { layout, Placement } from "./layout.js";
|
|
8
8
|
export { Item, llmSession, OutputItem, Tool } from "./llm-session.js";
|
|
9
|
+
export { appRules, Rule } from "./rules.js";
|
|
9
10
|
export { storageAdmin } from "./storage-admin.js";
|
|
10
11
|
export { uiShell } from "./ui-shell.js";
|
|
11
12
|
export { uiView } from "./ui-view.js";
|
|
@@ -6,6 +6,7 @@ export { Composition, installer } from "./installer.js";
|
|
|
6
6
|
export { kv } from "./kv.js";
|
|
7
7
|
export { layout, Placement } from "./layout.js";
|
|
8
8
|
export { Item, llmSession, OutputItem, Tool } from "./llm-session.js";
|
|
9
|
+
export { appRules, Rule } from "./rules.js";
|
|
9
10
|
export { storageAdmin } from "./storage-admin.js";
|
|
10
11
|
export { uiShell } from "./ui-shell.js";
|
|
11
12
|
export { uiView } from "./ui-view.js";
|
|
@@ -39,6 +39,10 @@ export declare const installer: import("@agentorg/sdk").RpcInterface<"installer"
|
|
|
39
39
|
*/
|
|
40
40
|
plan: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
|
|
41
41
|
package: z.ZodString;
|
|
42
|
+
expose: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
43
|
+
export: z.ZodString;
|
|
44
|
+
to: z.ZodString;
|
|
45
|
+
}, z.core.$strip>>>;
|
|
42
46
|
}, z.core.$strip>, z.ZodObject<{
|
|
43
47
|
slots: z.ZodArray<z.ZodObject<{
|
|
44
48
|
slot: z.ZodString;
|
|
@@ -49,6 +53,14 @@ export declare const installer: import("@agentorg/sdk").RpcInterface<"installer"
|
|
|
49
53
|
}, z.core.$strip>>;
|
|
50
54
|
}, z.core.$strip>>;
|
|
51
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>>;
|
|
52
64
|
}, z.core.$strip>>;
|
|
53
65
|
/**
|
|
54
66
|
* Create an Actor of the package named `name`, with exactly these connections, all or none.
|
|
@@ -58,6 +70,12 @@ export declare const installer: import("@agentorg/sdk").RpcInterface<"installer"
|
|
|
58
70
|
* slot bound to `storage`'s `kv` gets the package's seed for it (an object of key to value);
|
|
59
71
|
* a seed whose slot isn't is listed in `unseeded`. Then it is started if `start`. If a seed or
|
|
60
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.
|
|
61
79
|
*/
|
|
62
80
|
install: import("@agentorg/sdk").MethodSpec<z.ZodObject<{
|
|
63
81
|
package: z.ZodString;
|
|
@@ -67,10 +85,29 @@ export declare const installer: import("@agentorg/sdk").RpcInterface<"installer"
|
|
|
67
85
|
export: z.ZodString;
|
|
68
86
|
}, z.core.$strip>>;
|
|
69
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>>>;
|
|
70
92
|
}, z.core.$strip>, z.ZodObject<{
|
|
71
93
|
actorId: z.ZodString;
|
|
72
94
|
unbound: z.ZodArray<z.ZodString>;
|
|
73
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>]>>;
|
|
74
111
|
}, z.core.$strip>>;
|
|
75
112
|
/**
|
|
76
113
|
* The system as it is, as a composition: every package Actor that isn't closed, the
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { defineInterface, method } from "@agentorg/sdk";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { Id, Name } from "./hub.js";
|
|
3
|
+
import { Id, Name, SlotName } from "./hub.js";
|
|
4
4
|
const Hash = z.string().regex(/^sha256-[0-9a-f]{64}$/);
|
|
5
5
|
/** An export of a running Actor, by its id and the export's name. */
|
|
6
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"]);
|
|
7
15
|
/** An Actor of a composition, by the name it has there. */
|
|
8
16
|
const ActorName = z.string().min(1).max(128);
|
|
9
17
|
/**
|
|
@@ -46,10 +54,15 @@ export const installer = defineInterface({
|
|
|
46
54
|
* can place.
|
|
47
55
|
*/
|
|
48
56
|
plan: method({
|
|
49
|
-
input: z.object({ package: Hash }),
|
|
57
|
+
input: z.object({ package: Hash, expose: z.array(Exposure).max(64).optional() }),
|
|
50
58
|
output: z.object({
|
|
51
59
|
slots: z.array(z.object({ slot: Name, interface: z.string(), candidates: z.array(Target) })),
|
|
52
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 })),
|
|
53
66
|
}),
|
|
54
67
|
}),
|
|
55
68
|
/**
|
|
@@ -60,6 +73,12 @@ export const installer = defineInterface({
|
|
|
60
73
|
* slot bound to `storage`'s `kv` gets the package's seed for it (an object of key to value);
|
|
61
74
|
* a seed whose slot isn't is listed in `unseeded`. Then it is started if `start`. If a seed or
|
|
62
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.
|
|
63
82
|
*/
|
|
64
83
|
install: method({
|
|
65
84
|
input: z.object({
|
|
@@ -67,8 +86,20 @@ export const installer = defineInterface({
|
|
|
67
86
|
name: z.string().min(1).max(128),
|
|
68
87
|
connections: z.record(Name, Target),
|
|
69
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
|
+
])),
|
|
70
102
|
}),
|
|
71
|
-
output: z.object({ actorId: Id, unbound: z.array(Name), unseeded: z.array(Name) }),
|
|
72
103
|
}),
|
|
73
104
|
/**
|
|
74
105
|
* The system as it is, as a composition: every package Actor that isn't closed, the
|
|
@@ -0,0 +1,35 @@
|
|
|
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>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { defineInterface, event, method } from "@agentorg/sdk";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
/** A named rule's id: lowercase words joined by hyphens. */
|
|
4
|
+
const RuleId = z
|
|
5
|
+
.string()
|
|
6
|
+
.regex(/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/)
|
|
7
|
+
.max(64);
|
|
8
|
+
/**
|
|
9
|
+
* One named rule: a convenience the person turns on, off unless they do. `says` is what it does,
|
|
10
|
+
* in the person's words.
|
|
11
|
+
*/
|
|
12
|
+
export const Rule = z.object({
|
|
13
|
+
id: RuleId,
|
|
14
|
+
name: z.string().max(200),
|
|
15
|
+
says: z.string().max(1000),
|
|
16
|
+
on: z.boolean(),
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* `app.rules@1`: the person's named rules. Each is held by the person's Actor (the app's gateway),
|
|
20
|
+
* which acts on a rule that is on as the person, a manager, and only within what the person could
|
|
21
|
+
* grant. A rule is the only thing that may act on provenance such as an Actor's `installedFor`.
|
|
22
|
+
*/
|
|
23
|
+
export const appRules = defineInterface({
|
|
24
|
+
name: "app.rules",
|
|
25
|
+
major: 1,
|
|
26
|
+
kind: "rpc",
|
|
27
|
+
methods: {
|
|
28
|
+
/** Every rule the app knows, each with whether it is on. */
|
|
29
|
+
list: method({ input: z.object({}), output: z.object({ rules: z.array(Rule) }) }),
|
|
30
|
+
/** Turn a rule on or off. Turning one on settles what already waits for it. */
|
|
31
|
+
set: method({ input: z.object({ id: RuleId, on: z.boolean() }), output: z.object({}) }),
|
|
32
|
+
},
|
|
33
|
+
events: {
|
|
34
|
+
/** A rule was turned on or off; read them again with `list`. */
|
|
35
|
+
changed: event(z.object({})),
|
|
36
|
+
},
|
|
37
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/** One message of a chat, as `chat@1` carries it. A `tool` message may say which tool ran. */
|
|
3
|
+
export interface ChatEntry {
|
|
4
|
+
id: string;
|
|
5
|
+
role: "user" | "assistant" | "tool";
|
|
6
|
+
text: string;
|
|
7
|
+
tool?: {
|
|
8
|
+
name: string;
|
|
9
|
+
state: "running" | "done" | "refused";
|
|
10
|
+
input?: string;
|
|
11
|
+
output?: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface ChatProps {
|
|
15
|
+
/** In order; a reply still streaming is an `assistant` entry like any other. */
|
|
16
|
+
messages: readonly ChatEntry[];
|
|
17
|
+
/** A turn is running: Send becomes Stop. */
|
|
18
|
+
running: boolean;
|
|
19
|
+
/** Send the person's text; when it rejects, the text goes back in the composer. */
|
|
20
|
+
onSend(text: string): Promise<void>;
|
|
21
|
+
onCancel(): void;
|
|
22
|
+
/** Run the last turn again: offered under the last reply. */
|
|
23
|
+
onRetry?(): void;
|
|
24
|
+
/** Older messages remain: "Earlier messages" loads them. */
|
|
25
|
+
hasEarlier?: boolean;
|
|
26
|
+
onEarlier?(): Promise<void>;
|
|
27
|
+
/** Above the composer: a notice the caller draws (a refusal and its action). */
|
|
28
|
+
notice?: ReactNode;
|
|
29
|
+
/** Beside the send button: the plan line, say. */
|
|
30
|
+
footer?: ReactNode;
|
|
31
|
+
/** The agent's name and avatar, over its replies; its name names the composer. */
|
|
32
|
+
name?: string;
|
|
33
|
+
avatar?: ReactNode;
|
|
34
|
+
/** The composer's accessible name; by default "Message". */
|
|
35
|
+
label?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function Chat(props: ChatProps): import("react").JSX.Element;
|