@agentorg/cli 0.0.5 → 0.0.7
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 +23 -104
- package/dist/node_modules/@agentorg/computer/LICENSE +201 -0
- package/dist/node_modules/@agentorg/computer/NOTICE +2 -0
- package/dist/node_modules/@agentorg/computer/dist/THIRD_PARTY_LICENSES.txt +1321 -0
- package/dist/node_modules/@agentorg/computer/dist/sdk.js +24909 -0
- package/dist/node_modules/@agentorg/computer/dist/types/generated/schema.d.ts +860 -0
- package/dist/node_modules/@agentorg/computer/dist/types/sdk.d.ts +242 -0
- package/dist/node_modules/@agentorg/computer/package.json +12 -0
- package/dist/node_modules/@agentorg/computer-connector/dist/src/index.d.ts +1 -0
- package/dist/node_modules/@agentorg/computer-connector/dist/src/index.js +1 -0
- package/dist/node_modules/@agentorg/computer-connector/dist/src/provider.d.ts +24 -0
- package/dist/node_modules/@agentorg/computer-connector/dist/src/provider.js +482 -0
- package/dist/node_modules/@agentorg/computer-connector/dist/src/unit.d.ts +19 -0
- package/dist/node_modules/@agentorg/computer-connector/dist/src/unit.js +149 -0
- package/dist/node_modules/@agentorg/computer-connector/package.json +33 -0
- package/dist/node_modules/@agentorg/computer-connector/skills/browser/SKILL.md +31 -0
- package/dist/node_modules/@agentorg/computer-connector/skills/computer/SKILL.md +30 -0
- package/dist/node_modules/@agentorg/computer-connector/skills/files/SKILL.md +28 -0
- package/dist/node_modules/@agentorg/computer-connector/skills/terminal/SKILL.md +39 -0
- package/dist/node_modules/@agentorg/computer-connector/skills/web-research/SKILL.md +29 -0
- package/dist/node_modules/@agentorg/hub/dist/src/hub-actor.d.ts +2 -7
- package/dist/node_modules/@agentorg/hub/dist/src/hub-actor.js +4 -144
- package/dist/node_modules/@agentorg/hub/dist/src/index.d.ts +1 -3
- package/dist/node_modules/@agentorg/hub/dist/src/index.js +1 -3
- package/dist/node_modules/@agentorg/hub/dist/src/router.d.ts +9 -58
- package/dist/node_modules/@agentorg/hub/dist/src/router.js +41 -414
- package/dist/node_modules/@agentorg/hub/dist/src/state.d.ts +17 -317
- package/dist/node_modules/@agentorg/hub/dist/src/state.js +42 -536
- package/dist/node_modules/@agentorg/hub/dist/src/validate.d.ts +1 -3
- package/dist/node_modules/@agentorg/hub/dist/src/validate.js +19 -17
- package/dist/node_modules/@agentorg/hub/package.json +0 -3
- package/dist/node_modules/@agentorg/interfaces/dist/src/agent-provider.d.ts +119 -0
- package/dist/node_modules/@agentorg/interfaces/dist/src/agent-provider.js +96 -0
- package/dist/node_modules/@agentorg/interfaces/dist/src/agent-settings.d.ts +42 -0
- package/dist/node_modules/@agentorg/interfaces/dist/src/agent-settings.js +53 -0
- package/dist/node_modules/@agentorg/interfaces/dist/src/chat.d.ts +93 -38
- package/dist/node_modules/@agentorg/interfaces/dist/src/chat.js +71 -22
- package/dist/node_modules/@agentorg/interfaces/dist/src/connection.d.ts +36 -0
- package/dist/node_modules/@agentorg/interfaces/dist/src/connection.js +31 -0
- package/dist/node_modules/@agentorg/interfaces/dist/src/folders.d.ts +19 -0
- package/dist/node_modules/@agentorg/interfaces/dist/src/folders.js +25 -0
- package/dist/node_modules/@agentorg/interfaces/dist/src/hub.d.ts +16 -286
- package/dist/node_modules/@agentorg/interfaces/dist/src/hub.js +17 -159
- package/dist/node_modules/@agentorg/interfaces/dist/src/index.d.ts +9 -9
- package/dist/node_modules/@agentorg/interfaces/dist/src/index.js +9 -9
- package/dist/node_modules/@agentorg/interfaces/dist/src/kv.d.ts +2 -2
- package/dist/node_modules/@agentorg/interfaces/dist/src/kv.js +2 -2
- package/dist/node_modules/@agentorg/interfaces/dist/src/llm-session.d.ts +2 -0
- package/dist/node_modules/@agentorg/interfaces/dist/src/llm-session.js +2 -1
- package/dist/node_modules/@agentorg/interfaces/dist/src/manager.d.ts +626 -0
- package/dist/node_modules/@agentorg/interfaces/dist/src/manager.js +349 -0
- package/dist/node_modules/@agentorg/interfaces/dist/src/tools.d.ts +39 -0
- package/dist/node_modules/@agentorg/interfaces/dist/src/tools.js +43 -0
- package/dist/node_modules/@agentorg/interfaces/dist/src/units.d.ts +460 -0
- package/dist/node_modules/@agentorg/interfaces/dist/src/units.js +204 -0
- package/dist/node_modules/@agentorg/looper/dist/src/index.d.ts +5 -0
- package/dist/node_modules/@agentorg/looper/dist/src/index.js +5 -0
- package/dist/node_modules/@agentorg/looper/dist/src/loop.d.ts +75 -0
- package/dist/node_modules/@agentorg/looper/dist/src/loop.js +332 -0
- package/dist/node_modules/@agentorg/looper/dist/src/looper.d.ts +71 -0
- package/dist/node_modules/@agentorg/looper/dist/src/looper.js +282 -0
- package/dist/node_modules/@agentorg/looper/dist/src/record.d.ts +99 -0
- package/dist/node_modules/@agentorg/looper/dist/src/record.js +278 -0
- package/dist/node_modules/@agentorg/looper/dist/src/tools.d.ts +11 -0
- package/dist/node_modules/@agentorg/looper/dist/src/tools.js +42 -0
- package/dist/node_modules/@agentorg/looper/dist/src/types.d.ts +147 -0
- package/dist/node_modules/@agentorg/looper/dist/src/types.js +32 -0
- package/dist/node_modules/@agentorg/looper/package.json +24 -0
- package/dist/node_modules/@agentorg/manager/dist/src/activity.d.ts +18 -0
- package/dist/node_modules/@agentorg/manager/dist/src/activity.js +65 -0
- package/dist/node_modules/@agentorg/manager/dist/src/control.d.ts +134 -0
- package/dist/node_modules/@agentorg/manager/dist/src/control.js +1115 -0
- package/dist/node_modules/@agentorg/manager/dist/src/form.d.ts +40 -0
- package/dist/node_modules/@agentorg/manager/dist/src/form.js +191 -0
- package/dist/node_modules/@agentorg/manager/dist/src/index.d.ts +1 -0
- package/dist/node_modules/@agentorg/manager/dist/src/index.js +1 -0
- package/dist/node_modules/@agentorg/manager/dist/src/manager.d.ts +25 -0
- package/dist/node_modules/@agentorg/manager/dist/src/manager.js +680 -0
- package/dist/node_modules/@agentorg/manager/dist/src/skills.d.ts +27 -0
- package/dist/node_modules/@agentorg/manager/dist/src/skills.js +152 -0
- package/dist/node_modules/@agentorg/manager/dist/src/stack.d.ts +454 -0
- package/dist/node_modules/@agentorg/manager/dist/src/stack.js +917 -0
- package/dist/node_modules/@agentorg/manager/package.json +30 -0
- package/dist/node_modules/@agentorg/mcp/dist/src/connection.d.ts +34 -0
- package/dist/node_modules/@agentorg/mcp/dist/src/connection.js +296 -0
- package/dist/node_modules/@agentorg/mcp/dist/src/index.d.ts +4 -0
- package/dist/node_modules/@agentorg/mcp/dist/src/index.js +4 -0
- package/dist/node_modules/@agentorg/mcp/dist/src/kinds.d.ts +158 -0
- package/dist/node_modules/@agentorg/mcp/dist/src/kinds.js +164 -0
- package/dist/node_modules/@agentorg/mcp/dist/src/provider.d.ts +22 -0
- package/dist/node_modules/@agentorg/mcp/dist/src/provider.js +197 -0
- package/dist/node_modules/@agentorg/mcp/dist/src/public.d.ts +6 -0
- package/dist/node_modules/@agentorg/mcp/dist/src/public.js +72 -0
- package/dist/node_modules/@agentorg/mcp/package.json +31 -0
- package/dist/node_modules/@agentorg/sdk/dist/src/cli.js +3 -23
- package/dist/node_modules/@agentorg/sdk/dist/src/client.d.ts +4 -25
- package/dist/node_modules/@agentorg/sdk/dist/src/client.js +5 -55
- package/dist/node_modules/@agentorg/sdk/dist/src/errors.d.ts +1 -1
- package/dist/node_modules/@agentorg/sdk/dist/src/errors.js +3 -3
- package/dist/node_modules/@agentorg/sdk/dist/src/filled.d.ts +21 -0
- package/dist/node_modules/@agentorg/sdk/dist/src/filled.js +24 -0
- package/dist/node_modules/@agentorg/sdk/dist/src/index.d.ts +3 -2
- package/dist/node_modules/@agentorg/sdk/dist/src/index.js +2 -1
- package/dist/node_modules/@agentorg/sdk/dist/src/interface.d.ts +6 -34
- package/dist/node_modules/@agentorg/sdk/dist/src/interface.js +3 -24
- package/dist/node_modules/@agentorg/sdk/dist/src/module-host.d.ts +8 -17
- package/dist/node_modules/@agentorg/sdk/dist/src/module-host.js +15 -87
- package/dist/node_modules/@agentorg/sdk/dist/src/module.d.ts +10 -76
- package/dist/node_modules/@agentorg/sdk/dist/src/module.js +3 -23
- package/dist/node_modules/@agentorg/sdk/dist/src/person-commands.js +0 -5
- package/dist/node_modules/@agentorg/sdk/dist/src/runtime.d.ts +3 -27
- package/dist/node_modules/@agentorg/sdk/dist/src/runtime.js +5 -100
- package/dist/node_modules/@agentorg/sdk/dist/src/testing.d.ts +7 -8
- package/dist/node_modules/@agentorg/sdk/dist/src/testing.js +12 -24
- package/dist/node_modules/@agentorg/sdk/package.json +4 -37
- package/dist/node_modules/@agentorg/shell/dist/app.css +4624 -739
- package/dist/node_modules/@agentorg/shell/dist/app.js +245 -202
- package/dist/node_modules/@agentorg/shell/package.json +23 -10
- package/dist/node_modules/@agentorg/wire/dist/src/frames.d.ts +2 -3
- package/dist/node_modules/@agentorg/wire/dist/src/frames.js +2 -3
- package/dist/node_modules/@agentorg/wire/dist/src/ops.d.ts +5 -34
- package/dist/node_modules/@agentorg/wire/dist/src/ops.js +2 -17
- package/dist/node_modules/assistant/dist/src/chats.d.ts +92 -0
- package/dist/node_modules/assistant/dist/src/chats.js +357 -0
- package/dist/node_modules/assistant/dist/src/engine.d.ts +42 -0
- package/dist/node_modules/assistant/dist/src/engine.js +160 -0
- package/dist/node_modules/assistant/dist/src/local-store.d.ts +3 -0
- package/dist/node_modules/assistant/dist/src/local-store.js +58 -0
- package/dist/node_modules/assistant/dist/src/provider.d.ts +21 -0
- package/dist/node_modules/assistant/dist/src/provider.js +259 -0
- package/dist/node_modules/assistant/dist/src/settings.d.ts +17 -0
- package/dist/node_modules/assistant/dist/src/settings.js +43 -0
- package/dist/node_modules/assistant/dist/src/tools.d.ts +57 -0
- package/dist/node_modules/assistant/dist/src/tools.js +102 -0
- package/dist/node_modules/assistant/package.json +30 -0
- package/dist/node_modules/chatgpt/dist/src/account.d.ts +52 -0
- package/dist/node_modules/chatgpt/dist/src/account.js +270 -0
- package/dist/node_modules/chatgpt/dist/src/encoding.d.ts +7 -0
- package/dist/node_modules/chatgpt/dist/src/encoding.js +20 -0
- package/dist/node_modules/chatgpt/dist/src/file-store.d.ts +9 -0
- package/dist/node_modules/chatgpt/dist/src/file-store.js +68 -0
- package/dist/node_modules/chatgpt/dist/src/index.d.ts +1 -0
- package/dist/node_modules/chatgpt/dist/src/index.js +1 -0
- package/dist/node_modules/chatgpt/dist/src/jwt.d.ts +15 -0
- package/dist/node_modules/chatgpt/dist/src/jwt.js +37 -0
- package/dist/node_modules/chatgpt/dist/src/oauth.d.ts +43 -0
- package/dist/node_modules/chatgpt/dist/src/oauth.js +104 -0
- package/dist/node_modules/chatgpt/dist/src/program.d.ts +23 -0
- package/dist/node_modules/chatgpt/dist/src/program.js +41 -0
- package/dist/node_modules/chatgpt/dist/src/responses.d.ts +54 -0
- package/dist/node_modules/chatgpt/dist/src/responses.js +300 -0
- package/dist/node_modules/chatgpt/dist/src/serve.d.ts +65 -0
- package/dist/node_modules/chatgpt/dist/src/serve.js +46 -0
- package/dist/node_modules/chatgpt/package.json +33 -0
- package/dist/src/api.d.ts +5 -34
- package/dist/src/api.js +10 -68
- package/dist/src/cli.js +3 -7
- package/dist/src/folders.d.ts +2 -0
- package/dist/src/folders.js +45 -0
- package/dist/src/gateway.d.ts +13 -8
- package/dist/src/gateway.js +119 -296
- package/dist/src/index.d.ts +4 -5
- package/dist/src/index.js +3 -4
- package/dist/src/live.d.ts +17 -0
- package/dist/src/live.js +109 -0
- package/dist/src/notes.d.ts +11 -0
- package/dist/src/notes.js +64 -0
- package/dist/src/oauth.d.ts +16 -0
- package/dist/src/oauth.js +46 -0
- package/dist/src/programs.d.ts +36 -0
- package/dist/src/programs.js +198 -0
- package/dist/src/signin.d.ts +12 -3
- package/dist/src/signin.js +30 -6
- package/package.json +4 -11
- package/dist/bundled/index.json +0 -6
- package/dist/bundled/sha256-0e91cc3d0e9762b81abc2427b5496b20f383abcd6fb97d928a8d50e956b54d1f.agentorg +0 -0
- package/dist/bundled/sha256-1f64ca62a0209d767d6aa6c4feb50b0653d60f10bebbc301f79bd3a37e0153c1.agentorg +0 -0
- package/dist/bundled/sha256-4055f8fddf6b90f3d356543f554b2a9e9a2c4a8827a8774f8f87952dc1692331.agentorg +0 -0
- package/dist/bundled/sha256-e356ea3c1899138a8494baf521556831006f38534fa9e92ae873e7e6956c3a46.agentorg +0 -0
- package/dist/node_modules/@agentorg/hub/dist/src/build.d.ts +0 -17
- package/dist/node_modules/@agentorg/hub/dist/src/build.js +0 -120
- package/dist/node_modules/@agentorg/hub/dist/src/logs.d.ts +0 -33
- package/dist/node_modules/@agentorg/hub/dist/src/logs.js +0 -162
- package/dist/node_modules/@agentorg/hub/dist/src/net.d.ts +0 -41
- package/dist/node_modules/@agentorg/hub/dist/src/net.js +0 -265
- package/dist/node_modules/@agentorg/hub/dist/src/processes.d.ts +0 -78
- package/dist/node_modules/@agentorg/hub/dist/src/processes.js +0 -485
- package/dist/node_modules/@agentorg/hub/dist/src/storage.d.ts +0 -38
- package/dist/node_modules/@agentorg/hub/dist/src/storage.js +0 -194
- package/dist/node_modules/@agentorg/interfaces/dist/src/http-egress.d.ts +0 -6
- package/dist/node_modules/@agentorg/interfaces/dist/src/http-egress.js +0 -7
- package/dist/node_modules/@agentorg/interfaces/dist/src/installer.d.ts +0 -191
- package/dist/node_modules/@agentorg/interfaces/dist/src/installer.js +0 -136
- package/dist/node_modules/@agentorg/interfaces/dist/src/layout.d.ts +0 -47
- package/dist/node_modules/@agentorg/interfaces/dist/src/layout.js +0 -52
- package/dist/node_modules/@agentorg/interfaces/dist/src/rules.d.ts +0 -35
- package/dist/node_modules/@agentorg/interfaces/dist/src/rules.js +0 -37
- package/dist/node_modules/@agentorg/interfaces/dist/src/storage-admin.d.ts +0 -23
- package/dist/node_modules/@agentorg/interfaces/dist/src/storage-admin.js +0 -31
- package/dist/node_modules/@agentorg/interfaces/dist/src/ui-shell.d.ts +0 -14
- package/dist/node_modules/@agentorg/interfaces/dist/src/ui-shell.js +0 -26
- package/dist/node_modules/@agentorg/interfaces/dist/src/ui-view.d.ts +0 -27
- package/dist/node_modules/@agentorg/interfaces/dist/src/ui-view.js +0 -26
- package/dist/node_modules/@agentorg/kit/dist/src/chat.d.ts +0 -37
- package/dist/node_modules/@agentorg/kit/dist/src/chat.js +0 -131
- package/dist/node_modules/@agentorg/kit/dist/src/components.d.ts +0 -94
- package/dist/node_modules/@agentorg/kit/dist/src/components.js +0 -66
- package/dist/node_modules/@agentorg/kit/dist/src/icons.d.ts +0 -17
- package/dist/node_modules/@agentorg/kit/dist/src/icons.js +0 -30
- package/dist/node_modules/@agentorg/kit/dist/src/index.d.ts +0 -6
- package/dist/node_modules/@agentorg/kit/dist/src/index.js +0 -10
- package/dist/node_modules/@agentorg/kit/dist/src/markdown.d.ts +0 -9
- package/dist/node_modules/@agentorg/kit/dist/src/markdown.js +0 -14
- package/dist/node_modules/@agentorg/kit/dist/src/resizable.d.ts +0 -5
- package/dist/node_modules/@agentorg/kit/dist/src/resizable.js +0 -8
- package/dist/node_modules/@agentorg/kit/dist/src/styles.d.ts +0 -11
- package/dist/node_modules/@agentorg/kit/dist/src/styles.js +0 -166
- package/dist/node_modules/@agentorg/kit/package.json +0 -44
- package/dist/node_modules/@agentorg/sdk/dist/frame/runtime.js +0 -753
- package/dist/node_modules/@agentorg/sdk/dist/host/runner.js +0 -21963
- package/dist/node_modules/@agentorg/sdk/dist/src/build.d.ts +0 -2
- package/dist/node_modules/@agentorg/sdk/dist/src/build.js +0 -2
- package/dist/node_modules/@agentorg/sdk/dist/src/client-http.d.ts +0 -24
- package/dist/node_modules/@agentorg/sdk/dist/src/client-http.js +0 -247
- package/dist/node_modules/@agentorg/sdk/dist/src/describe.d.ts +0 -13
- package/dist/node_modules/@agentorg/sdk/dist/src/describe.js +0 -16
- package/dist/node_modules/@agentorg/sdk/dist/src/frame-base.d.ts +0 -8
- package/dist/node_modules/@agentorg/sdk/dist/src/frame-base.js +0 -64
- package/dist/node_modules/@agentorg/sdk/dist/src/frame-entry.d.ts +0 -1
- package/dist/node_modules/@agentorg/sdk/dist/src/frame-entry.js +0 -35
- package/dist/node_modules/@agentorg/sdk/dist/src/frame-host.d.ts +0 -57
- package/dist/node_modules/@agentorg/sdk/dist/src/frame-host.js +0 -293
- package/dist/node_modules/@agentorg/sdk/dist/src/frame-protocol.d.ts +0 -124
- package/dist/node_modules/@agentorg/sdk/dist/src/frame-protocol.js +0 -16
- package/dist/node_modules/@agentorg/sdk/dist/src/frame.d.ts +0 -25
- package/dist/node_modules/@agentorg/sdk/dist/src/frame.js +0 -248
- package/dist/node_modules/@agentorg/sdk/dist/src/host-main.d.ts +0 -1
- package/dist/node_modules/@agentorg/sdk/dist/src/host-main.js +0 -60
- package/dist/node_modules/@agentorg/sdk/dist/src/host.d.ts +0 -25
- package/dist/node_modules/@agentorg/sdk/dist/src/host.js +0 -92
- package/dist/node_modules/@agentorg/sdk/dist/src/manifest-api.d.ts +0 -2
- package/dist/node_modules/@agentorg/sdk/dist/src/manifest-api.js +0 -2
- package/dist/node_modules/@agentorg/sdk/dist/src/manifest.d.ts +0 -56
- package/dist/node_modules/@agentorg/sdk/dist/src/manifest.js +0 -165
- package/dist/node_modules/@agentorg/sdk/dist/src/package.d.ts +0 -60
- package/dist/node_modules/@agentorg/sdk/dist/src/package.js +0 -538
- package/dist/node_modules/@agentorg/sdk/dist/src/tar.d.ts +0 -7
- package/dist/node_modules/@agentorg/sdk/dist/src/tar.js +0 -71
- package/dist/node_modules/@agentorg/shell/dist/agent-bindings.js +0 -59
- package/dist/node_modules/@agentorg/shell/src/agent-bindings.ts +0 -107
- package/dist/src/frames.d.ts +0 -23
- package/dist/src/frames.js +0 -78
- package/dist/src/layout.d.ts +0 -44
- package/dist/src/layout.js +0 -90
- package/dist/src/model.d.ts +0 -54
- package/dist/src/model.js +0 -299
- package/dist/src/rules.d.ts +0 -71
- package/dist/src/rules.js +0 -157
- package/dist/src/transfer.d.ts +0 -30
- package/dist/src/transfer.js +0 -110
package/dist/src/api.d.ts
CHANGED
|
@@ -1,31 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
export interface View {
|
|
3
|
-
actor: string;
|
|
4
|
-
module: string;
|
|
5
|
-
}
|
|
6
|
-
/** The person's own side: its slots, and `layout`, its own export, which the gateway serves. */
|
|
1
|
+
/** The person's own side: the slots the gateway serves `/api` from. */
|
|
7
2
|
export interface PersonSide {
|
|
8
3
|
call(slot: string, method: string, input: unknown): Promise<unknown>;
|
|
9
4
|
/** Events until the returned stop; `end` when the subscription can't go on. */
|
|
10
5
|
subscribe(slot: string, event: string, send: (payload: unknown) => void, end: () => void): () => void;
|
|
11
6
|
}
|
|
12
|
-
/**
|
|
13
|
-
* Calls run as a view's Actor through its `module.slot` bindings: the Hub's in-process view path
|
|
14
|
-
* (`hub.viewCall` and `hub.viewSubscribe`), validated and audited like any call. The Hub refuses a
|
|
15
|
-
* module that isn't one of the Actor's views, so any view of the Actor's package is open to the
|
|
16
|
-
* person, and nothing else is.
|
|
17
|
-
*/
|
|
18
|
-
export interface ViewCalls {
|
|
19
|
-
call(view: View, slot: string, method: string, input: unknown): Promise<unknown>;
|
|
20
|
-
subscribe(view: View, slot: string, event: string, send: (payload: unknown) => void, end: () => void): () => void;
|
|
21
|
-
/**
|
|
22
|
-
* The view's slots: `onSlot` hears each bound one at once, then every change (bound again when
|
|
23
|
-
* it's usable again). Returns how to stop. Refused for a module that isn't a view.
|
|
24
|
-
*/
|
|
25
|
-
slots(view: View, onSlot: (slot: string, bound: boolean) => void): () => void;
|
|
26
|
-
/** A line for the view's Actor's log, which the Hub bounds as it does a frame's. */
|
|
27
|
-
log(view: View, level: "info" | "warn" | "error", message: string, fields?: Record<string, unknown>): void;
|
|
28
|
-
}
|
|
29
7
|
/** The socket a tab or the CLI holds: text messages in, text messages out. */
|
|
30
8
|
export interface Socket {
|
|
31
9
|
send(text: string): void;
|
|
@@ -34,21 +12,14 @@ export interface Socket {
|
|
|
34
12
|
/**
|
|
35
13
|
* One `/api` socket: the same calls a channel carries, as JSON.
|
|
36
14
|
*
|
|
37
|
-
* - `{id, op: "call", slot, method, input}
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* `{sub, end: true}` once it can't go on. `{sub, op: "unsubscribe"}` stops it.
|
|
41
|
-
* - `{sub, op: "slots", view}`: the view's slots. First `{sub, payload: {bound: [slot]}}`, every
|
|
42
|
-
* one bound now, then `{sub, payload: {slot, bound}}` per change, `bound` again for a slot that's
|
|
43
|
-
* usable again. `{sub, op: "unsubscribe"}` stops it, as a subscription.
|
|
44
|
-
* - `{op: "log", view, level, message, fields?}`: a line for the view's Actor's log, unanswered.
|
|
15
|
+
* - `{id, op: "call", slot, method, input}`: answered `{id, result}` or `{id, error}`.
|
|
16
|
+
* - `{sub, op: "subscribe", slot, event}`: then `{sub, payload}` per event, and `{sub, end: true}`
|
|
17
|
+
* once it can't go on. `{sub, op: "unsubscribe"}` stops it.
|
|
45
18
|
*
|
|
46
|
-
*
|
|
47
|
-
* runs as the person: through its own slots, and `layout`, its own export.
|
|
19
|
+
* Everything runs as the person, through their slots.
|
|
48
20
|
*/
|
|
49
21
|
export declare function serveSocket(socket: Socket, deps: {
|
|
50
22
|
person: PersonSide;
|
|
51
|
-
views: ViewCalls;
|
|
52
23
|
}): {
|
|
53
24
|
receive(text: string): void;
|
|
54
25
|
closed(): void;
|
package/dist/src/api.js
CHANGED
|
@@ -18,17 +18,11 @@ function errorBody(error) {
|
|
|
18
18
|
/**
|
|
19
19
|
* One `/api` socket: the same calls a channel carries, as JSON.
|
|
20
20
|
*
|
|
21
|
-
* - `{id, op: "call", slot, method, input}
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* `{sub, end: true}` once it can't go on. `{sub, op: "unsubscribe"}` stops it.
|
|
25
|
-
* - `{sub, op: "slots", view}`: the view's slots. First `{sub, payload: {bound: [slot]}}`, every
|
|
26
|
-
* one bound now, then `{sub, payload: {slot, bound}}` per change, `bound` again for a slot that's
|
|
27
|
-
* usable again. `{sub, op: "unsubscribe"}` stops it, as a subscription.
|
|
28
|
-
* - `{op: "log", view, level, message, fields?}`: a line for the view's Actor's log, unanswered.
|
|
21
|
+
* - `{id, op: "call", slot, method, input}`: answered `{id, result}` or `{id, error}`.
|
|
22
|
+
* - `{sub, op: "subscribe", slot, event}`: then `{sub, payload}` per event, and `{sub, end: true}`
|
|
23
|
+
* once it can't go on. `{sub, op: "unsubscribe"}` stops it.
|
|
29
24
|
*
|
|
30
|
-
*
|
|
31
|
-
* runs as the person: through its own slots, and `layout`, its own export.
|
|
25
|
+
* Everything runs as the person, through their slots.
|
|
32
26
|
*/
|
|
33
27
|
export function serveSocket(socket, deps) {
|
|
34
28
|
const subscriptions = new Map();
|
|
@@ -41,13 +35,6 @@ export function serveSocket(socket, deps) {
|
|
|
41
35
|
// The socket is gone; its close stops the rest.
|
|
42
36
|
}
|
|
43
37
|
};
|
|
44
|
-
const viewOf = (value) => {
|
|
45
|
-
if (value === undefined)
|
|
46
|
-
return undefined;
|
|
47
|
-
if (!isRecord(value) || !isName(value.actor) || !isName(value.module))
|
|
48
|
-
throw new Refused("invalid", "A view is {actor, module}.");
|
|
49
|
-
return { actor: value.actor, module: value.module };
|
|
50
|
-
};
|
|
51
38
|
const receive = (text) => {
|
|
52
39
|
let message;
|
|
53
40
|
try {
|
|
@@ -72,10 +59,11 @@ export function serveSocket(socket, deps) {
|
|
|
72
59
|
void (async () => {
|
|
73
60
|
if (!isName(slot) || !isName(method))
|
|
74
61
|
throw new Refused("invalid", "A call names its slot and method.");
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
62
|
+
// A live ticket is for the gateway's own pipe at `/live`, never for a page to hold, under
|
|
63
|
+
// whatever slot a page might expose it at.
|
|
64
|
+
if (method === "live")
|
|
65
|
+
throw new Refused("forbidden", "Open a live surface at /live.");
|
|
66
|
+
return deps.person.call(slot, method, input);
|
|
79
67
|
})()
|
|
80
68
|
.then((result) => send({ id, result }), (error) => send({ id, error: errorBody(error) }))
|
|
81
69
|
.finally(() => calls--);
|
|
@@ -99,14 +87,11 @@ export function serveSocket(socket, deps) {
|
|
|
99
87
|
throw new Refused("invalid", "A subscription names its slot and event.");
|
|
100
88
|
if (subscriptions.size >= MAX_SUBSCRIPTIONS)
|
|
101
89
|
throw new Refused("quota", `A socket holds ${MAX_SUBSCRIPTIONS} subscriptions at most.`);
|
|
102
|
-
const view = viewOf(message.view);
|
|
103
90
|
const forward = (payload) => {
|
|
104
91
|
if (!ended)
|
|
105
92
|
send({ sub, payload });
|
|
106
93
|
};
|
|
107
|
-
const stop =
|
|
108
|
-
? deps.views.subscribe(view, slot, event, forward, end)
|
|
109
|
-
: deps.person.subscribe(slot, event, forward, end);
|
|
94
|
+
const stop = deps.person.subscribe(slot, event, forward, end);
|
|
110
95
|
if (ended)
|
|
111
96
|
stop();
|
|
112
97
|
else
|
|
@@ -118,49 +103,6 @@ export function serveSocket(socket, deps) {
|
|
|
118
103
|
}
|
|
119
104
|
return;
|
|
120
105
|
}
|
|
121
|
-
case "slots": {
|
|
122
|
-
const { sub } = message;
|
|
123
|
-
if (!isId(sub) || subscriptions.has(sub))
|
|
124
|
-
return;
|
|
125
|
-
try {
|
|
126
|
-
if (subscriptions.size >= MAX_SUBSCRIPTIONS)
|
|
127
|
-
throw new Refused("quota", `A socket holds ${MAX_SUBSCRIPTIONS} subscriptions at most.`);
|
|
128
|
-
const view = viewOf(message.view);
|
|
129
|
-
if (!view)
|
|
130
|
-
throw new Refused("invalid", "A slots watch names its view.");
|
|
131
|
-
// The Hub tells the bound slots at once, within the call: gathered, they're one snapshot.
|
|
132
|
-
let snapshot = [];
|
|
133
|
-
const stop = deps.views.slots(view, (slot, bound) => {
|
|
134
|
-
if (snapshot && bound)
|
|
135
|
-
snapshot.push(slot);
|
|
136
|
-
else if (!snapshot)
|
|
137
|
-
send({ sub, payload: { slot, bound } });
|
|
138
|
-
});
|
|
139
|
-
send({ sub, payload: { bound: snapshot } });
|
|
140
|
-
snapshot = undefined;
|
|
141
|
-
subscriptions.set(sub, stop);
|
|
142
|
-
}
|
|
143
|
-
catch (error) {
|
|
144
|
-
send({ sub, end: true, error: errorBody(error) });
|
|
145
|
-
}
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
case "log": {
|
|
149
|
-
const { level, message: text, fields } = message;
|
|
150
|
-
if (level !== "info" && level !== "warn" && level !== "error")
|
|
151
|
-
return;
|
|
152
|
-
if (typeof text !== "string")
|
|
153
|
-
return;
|
|
154
|
-
try {
|
|
155
|
-
const view = viewOf(message.view);
|
|
156
|
-
if (view)
|
|
157
|
-
deps.views.log(view, level, text, isRecord(fields) ? fields : undefined);
|
|
158
|
-
}
|
|
159
|
-
catch {
|
|
160
|
-
// Not one of an Actor's views: nothing is logged, and nothing answers.
|
|
161
|
-
}
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
106
|
case "unsubscribe": {
|
|
165
107
|
const stop = isId(message.sub) ? subscriptions.get(message.sub) : undefined;
|
|
166
108
|
if (!stop)
|
package/dist/src/cli.js
CHANGED
|
@@ -10,11 +10,7 @@ const USAGE = `Usage: agentorg [command] [--home DIR]
|
|
|
10
10
|
|
|
11
11
|
(no command) [--port N] [--no-open] run AgentOrg: the Hub, your gateway and the shell
|
|
12
12
|
open sign a browser in to the running app
|
|
13
|
-
build [package-dir] build a package into a .agentorg archive, in a
|
|
14
|
-
checkout of this repository; installed, use
|
|
15
|
-
call packages build '{"files": {...}}'
|
|
16
13
|
hub [--port N] run a bare Hub, without the shell
|
|
17
|
-
add <file.agentorg> hub.packages.add
|
|
18
14
|
actors | bindings | exports | audit each one's list
|
|
19
15
|
bind <consumer.slot> <provider.export> hub.grants.bind
|
|
20
16
|
call <slot> <method> [json] call one of the person's slots
|
|
@@ -44,9 +40,9 @@ const { values, positionals } = parseArgs({
|
|
|
44
40
|
strict: false,
|
|
45
41
|
});
|
|
46
42
|
const [command, ...rest] = positionals;
|
|
47
|
-
// `
|
|
43
|
+
// `hub` is the SDK's, which reads its options itself, strictly. Everything else is
|
|
48
44
|
// this command's: an option it doesn't know is a mistake, never a reason to start the app.
|
|
49
|
-
if (command !== "
|
|
45
|
+
if (command !== "hub") {
|
|
50
46
|
const unknown = Object.keys(values).find((name) => !["home", "port", "no-open", "help", "version"].includes(name));
|
|
51
47
|
if (unknown !== undefined)
|
|
52
48
|
usage(`Unknown option ${unknown.length === 1 ? "-" : "--"}${unknown}. An argument that starts with - goes after --.`);
|
|
@@ -202,7 +198,7 @@ else if (command === "open") {
|
|
|
202
198
|
process.exit(1);
|
|
203
199
|
}
|
|
204
200
|
}
|
|
205
|
-
else if (command === "
|
|
201
|
+
else if (command === "hub")
|
|
206
202
|
await import("@agentorg/sdk/cli");
|
|
207
203
|
else {
|
|
208
204
|
let call;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { readdir, stat } from "node:fs/promises";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { dirname, isAbsolute, join, normalize } from "node:path";
|
|
4
|
+
import { FOLDERS_MAX, folders } from "@agentorg/interfaces";
|
|
5
|
+
import { Refused } from "@agentorg/sdk";
|
|
6
|
+
async function isFolder(at, entry) {
|
|
7
|
+
if (entry.isDirectory())
|
|
8
|
+
return true;
|
|
9
|
+
if (!entry.isSymbolicLink())
|
|
10
|
+
return false;
|
|
11
|
+
return stat(join(at, entry.name)).then((found) => found.isDirectory(), () => false);
|
|
12
|
+
}
|
|
13
|
+
async function list(path) {
|
|
14
|
+
if (path !== undefined && !isAbsolute(path))
|
|
15
|
+
throw new Refused("invalid", "A folder's path starts at the top of the disk.");
|
|
16
|
+
const at = path === undefined ? homedir() : normalize(path);
|
|
17
|
+
const entries = await readdir(at, { withFileTypes: true }).catch((error) => {
|
|
18
|
+
if (error.code === "ENOENT" || error.code === "ENOTDIR")
|
|
19
|
+
throw new Refused("unknown", "There's no such folder.");
|
|
20
|
+
throw new Refused("invalid", "That folder can't be read.");
|
|
21
|
+
});
|
|
22
|
+
// Dot folders stay out of the list, as in a file picker; a path can still be typed.
|
|
23
|
+
const shown = entries.filter((entry) => !entry.name.startsWith("."));
|
|
24
|
+
const kept = await Promise.all(shown.map((entry) => isFolder(at, entry)));
|
|
25
|
+
const names = shown
|
|
26
|
+
.filter((_, i) => kept[i])
|
|
27
|
+
.map((entry) => entry.name)
|
|
28
|
+
.sort((a, b) => a.localeCompare(b))
|
|
29
|
+
.slice(0, FOLDERS_MAX);
|
|
30
|
+
const parent = dirname(at);
|
|
31
|
+
return {
|
|
32
|
+
path: at,
|
|
33
|
+
...(parent === at ? {} : { parent }),
|
|
34
|
+
folders: names.map((name) => ({ name })),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** One `folders@1` call, checked as a call through the Hub would be. */
|
|
38
|
+
export function callFolders(method, input) {
|
|
39
|
+
if (method !== "list")
|
|
40
|
+
throw new Refused("invalid", `folders has no method ${method}.`);
|
|
41
|
+
const parsed = folders.methods.list.input.safeParse(input);
|
|
42
|
+
if (!parsed.success)
|
|
43
|
+
throw new Refused("invalid", `folders.list: ${parsed.error.message}`);
|
|
44
|
+
return list(parsed.data.path);
|
|
45
|
+
}
|
package/dist/src/gateway.d.ts
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import { type IncomingMessage, type ServerResponse } from "node:http";
|
|
2
2
|
import { Hub } from "@agentorg/hub";
|
|
3
|
-
import { type
|
|
3
|
+
import { type Programs, type ProgramsOptions } from "./programs.js";
|
|
4
|
+
/** A model's reply can take minutes; every other interface keeps the Hub's own limit. */
|
|
5
|
+
export declare const HUB_OPTIONS: {
|
|
6
|
+
answerTimeoutsMs: {
|
|
7
|
+
[x: string]: number;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
4
10
|
/** A route another part of the app adds, such as the model Actor's sign-in callback (step 5). */
|
|
5
11
|
export type Route = (request: IncomingMessage, response: ServerResponse, url: URL) => void;
|
|
6
12
|
export interface AppOptions {
|
|
7
13
|
/** The Hub home. */
|
|
8
14
|
home: string;
|
|
9
|
-
/** The gateway's port on 127.0.0.1; any free one
|
|
15
|
+
/** The gateway's port on 127.0.0.1; by default the kept sessions' if it can, else any free one. */
|
|
10
16
|
port?: number;
|
|
11
17
|
/** Where the shell's static files are; `@agentorg/shell`'s build by default. */
|
|
12
18
|
shell?: string;
|
|
13
19
|
/**
|
|
14
|
-
*
|
|
15
|
-
* the home as it is.
|
|
20
|
+
* How the first run, at each start, logs and reaches ChatGPT: the app's own by default.
|
|
16
21
|
*/
|
|
17
|
-
firstRun?:
|
|
22
|
+
firstRun?: Pick<ProgramsOptions, "fetch" | "log">;
|
|
18
23
|
}
|
|
19
24
|
export interface App {
|
|
20
25
|
/** The gateway's origin, `http://127.0.0.1:<port>`. */
|
|
@@ -22,8 +27,8 @@ export interface App {
|
|
|
22
27
|
/** Where external Actors reach the Hub. */
|
|
23
28
|
readonly hubUrl: string;
|
|
24
29
|
readonly hub: Hub;
|
|
25
|
-
/** This start's first run:
|
|
26
|
-
readonly firstRun
|
|
30
|
+
/** This start's first run: the programs it started, once it's done. */
|
|
31
|
+
readonly firstRun: Promise<Programs | undefined>;
|
|
27
32
|
/** A fresh one-time sign-in address, `<url>/signin#<code>`. */
|
|
28
33
|
signInUrl(): string;
|
|
29
34
|
/** Serve `path` with `route`, for another part of the app. */
|
|
@@ -41,6 +46,6 @@ export interface App {
|
|
|
41
46
|
* The app: a Hub in this process, and the person's gateway, its single running instance. The
|
|
42
47
|
* gateway holds the person's one channel to the Hub. Browser tabs and the CLI are the person's UIs,
|
|
43
48
|
* not channels: they reach the gateway at `/api`, and their calls run through the person's slots,
|
|
44
|
-
*
|
|
49
|
+
* and the person's notes are the app's own file.
|
|
45
50
|
*/
|
|
46
51
|
export declare function startApp(options: AppOptions): Promise<App>;
|