@agentorg/cli 0.0.6 → 0.0.8
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 +10 -7
- 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/router.d.ts +4 -2
- package/dist/node_modules/@agentorg/hub/dist/src/router.js +3 -1
- package/dist/node_modules/@agentorg/hub/dist/src/validate.js +16 -2
- package/dist/node_modules/@agentorg/interfaces/dist/src/agent-provider.d.ts +34 -47
- package/dist/node_modules/@agentorg/interfaces/dist/src/agent-provider.js +25 -34
- package/dist/node_modules/@agentorg/interfaces/dist/src/chat.d.ts +90 -50
- package/dist/node_modules/@agentorg/interfaces/dist/src/chat.js +69 -34
- 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/index.d.ts +6 -4
- package/dist/node_modules/@agentorg/interfaces/dist/src/index.js +6 -4
- 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 +381 -27
- package/dist/node_modules/@agentorg/interfaces/dist/src/manager.js +179 -15
- 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 +89 -0
- package/dist/node_modules/@agentorg/looper/dist/src/loop.js +366 -0
- package/dist/node_modules/@agentorg/looper/dist/src/looper.d.ts +81 -0
- package/dist/node_modules/@agentorg/looper/dist/src/looper.js +574 -0
- package/dist/node_modules/@agentorg/looper/dist/src/main.d.ts +34 -0
- package/dist/node_modules/@agentorg/looper/dist/src/main.js +116 -0
- package/dist/node_modules/@agentorg/looper/dist/src/record.d.ts +181 -0
- package/dist/node_modules/@agentorg/looper/dist/src/record.js +433 -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/manager.d.ts +4 -0
- package/dist/node_modules/@agentorg/manager/dist/src/manager.js +341 -189
- package/dist/node_modules/@agentorg/manager/dist/src/skills.d.ts +2 -0
- package/dist/node_modules/@agentorg/manager/dist/src/skills.js +7 -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/mcp/dist/src/connection.d.ts +2 -1
- package/dist/node_modules/@agentorg/mcp/dist/src/connection.js +8 -2
- package/dist/node_modules/@agentorg/mcp/dist/src/index.d.ts +3 -0
- package/dist/node_modules/@agentorg/mcp/dist/src/index.js +3 -0
- package/dist/node_modules/@agentorg/mcp/dist/src/kinds.d.ts +108 -0
- package/dist/node_modules/@agentorg/mcp/dist/src/kinds.js +95 -0
- package/dist/node_modules/@agentorg/mcp/dist/src/provider.d.ts +2 -2
- package/dist/node_modules/@agentorg/mcp/dist/src/provider.js +48 -18
- 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/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 +1 -0
- package/dist/node_modules/@agentorg/sdk/dist/src/index.js +1 -0
- package/dist/node_modules/@agentorg/shell/dist/app.css +1306 -181
- package/dist/node_modules/@agentorg/shell/dist/app.js +207 -166
- package/dist/node_modules/@agentorg/shell/package.json +6 -1
- package/dist/node_modules/assistant/dist/src/chats.d.ts +94 -0
- package/dist/node_modules/assistant/dist/src/chats.js +355 -0
- package/dist/node_modules/assistant/dist/src/engine.d.ts +26 -7
- package/dist/node_modules/assistant/dist/src/engine.js +107 -35
- package/dist/node_modules/assistant/dist/src/local-store.js +1 -1
- package/dist/node_modules/assistant/dist/src/provider.d.ts +1 -1
- package/dist/node_modules/assistant/dist/src/provider.js +47 -19
- package/dist/node_modules/assistant/dist/src/tools.d.ts +11 -28
- package/dist/node_modules/assistant/dist/src/tools.js +19 -40
- package/dist/node_modules/assistant/package.json +1 -0
- package/dist/src/api.js +4 -0
- package/dist/src/folders.d.ts +2 -0
- package/dist/src/folders.js +45 -0
- package/dist/src/gateway.d.ts +7 -1
- package/dist/src/gateway.js +81 -12
- package/dist/src/live.d.ts +17 -0
- package/dist/src/live.js +109 -0
- package/dist/src/programs.d.ts +7 -0
- package/dist/src/programs.js +29 -2
- package/dist/src/signin.d.ts +12 -3
- package/dist/src/signin.js +30 -6
- package/package.json +2 -1
- package/dist/node_modules/@agentorg/interfaces/dist/src/mcp-provider.d.ts +0 -88
- package/dist/node_modules/@agentorg/interfaces/dist/src/mcp-provider.js +0 -78
- package/dist/node_modules/assistant/dist/src/agent.d.ts +0 -62
- package/dist/node_modules/assistant/dist/src/agent.js +0 -226
- package/dist/node_modules/assistant/dist/src/history.d.ts +0 -97
- package/dist/node_modules/assistant/dist/src/history.js +0 -235
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentorg/looper",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "An agent's loops: a model and its tools run on a record, taking messages by thread. It knows nothing of what hosts it.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/src/index.d.ts",
|
|
11
|
+
"default": "./dist/src/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist/src"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.json",
|
|
19
|
+
"test": "node --test \"dist/test/**/*.test.js\""
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"zod": "^4.6.7"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Activity } from "./control.js";
|
|
2
|
+
interface Entry extends Activity {
|
|
3
|
+
seq: number;
|
|
4
|
+
at: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function createActivity(path: string, maxBytes?: number): {
|
|
7
|
+
add(entry: Activity): void;
|
|
8
|
+
/** Newest first; with `agent`, those it made or that were about it. */
|
|
9
|
+
read({ agent, before, limit }: {
|
|
10
|
+
agent?: string;
|
|
11
|
+
before?: number;
|
|
12
|
+
limit?: number;
|
|
13
|
+
}): {
|
|
14
|
+
entries: Entry[];
|
|
15
|
+
more: boolean;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The control log: one line for each control call that changed something, and for each refusal.
|
|
3
|
+
* Append-only, and kept to a size: past it, the older half goes. It holds no message an agent
|
|
4
|
+
* sent, and no secret.
|
|
5
|
+
*/
|
|
6
|
+
import { appendFileSync, readFileSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
7
|
+
/** Past this, the older half of the log goes. */
|
|
8
|
+
const MAX_BYTES = 4 * 1024 * 1024;
|
|
9
|
+
export function createActivity(path, maxBytes = MAX_BYTES) {
|
|
10
|
+
const read = () => {
|
|
11
|
+
let text;
|
|
12
|
+
try {
|
|
13
|
+
text = readFileSync(path, "utf8");
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
return text.split("\n").flatMap((line) => {
|
|
19
|
+
try {
|
|
20
|
+
const entry = line ? JSON.parse(line) : undefined;
|
|
21
|
+
return entry && Number.isInteger(entry.seq) ? [entry] : [];
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const sizeOf = () => {
|
|
29
|
+
try {
|
|
30
|
+
return statSync(path).size;
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const kept = read();
|
|
37
|
+
let next = Math.max(-1, ...kept.map((one) => one.seq)) + 1;
|
|
38
|
+
let bytes = sizeOf();
|
|
39
|
+
// A line cut off by a crash ends here, so the next doesn't join it.
|
|
40
|
+
let torn = bytes > 0 && !readFileSync(path, "utf8").endsWith("\n");
|
|
41
|
+
return {
|
|
42
|
+
add(entry) {
|
|
43
|
+
const line = `${JSON.stringify({ seq: next++, at: new Date().toISOString(), ...entry })}\n`;
|
|
44
|
+
appendFileSync(path, torn ? `\n${line}` : line, { mode: 0o600 });
|
|
45
|
+
torn = false;
|
|
46
|
+
bytes += Buffer.byteLength(line);
|
|
47
|
+
if (bytes <= maxBytes)
|
|
48
|
+
return;
|
|
49
|
+
const all = read();
|
|
50
|
+
const newer = all.slice(Math.floor(all.length / 2));
|
|
51
|
+
const text = newer.map((one) => `${JSON.stringify(one)}\n`).join("");
|
|
52
|
+
writeFileSync(`${path}.tmp`, text, { mode: 0o600 });
|
|
53
|
+
renameSync(`${path}.tmp`, path);
|
|
54
|
+
bytes = Buffer.byteLength(text);
|
|
55
|
+
},
|
|
56
|
+
/** Newest first; with `agent`, those it made or that were about it. */
|
|
57
|
+
read({ agent, before, limit = 50 }) {
|
|
58
|
+
const matching = read()
|
|
59
|
+
.filter((one) => before === undefined || one.seq < before)
|
|
60
|
+
.filter((one) => agent === undefined || one.caller === agent || one.target === agent)
|
|
61
|
+
.reverse();
|
|
62
|
+
return { entries: matching.slice(0, limit), more: matching.length > limit };
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentOrg control: what lets an agent reach what the person's own surface reaches, within the
|
|
3
|
+
* scopes the person set on its unit. The agent holds no authority of the Hub's. It calls
|
|
4
|
+
* management's tools, and management, which holds that authority, works out who is calling, what
|
|
5
|
+
* that caller's unit allows, and whether the target is within its reach.
|
|
6
|
+
*/
|
|
7
|
+
import { type chat, type FieldValues, type Problem, type Template, type Unit } from "@agentorg/interfaces";
|
|
8
|
+
import { type Slot } from "@agentorg/sdk";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import type { AgentRecord, Offer, StackInput } from "./stack.js";
|
|
11
|
+
export declare const AGENTS_UNIT = "control";
|
|
12
|
+
export declare const AGENTS_SLOT = "control";
|
|
13
|
+
/** How many agents one agent may have alive at once, at most and unless the person says. */
|
|
14
|
+
export declare const LIMIT_MAX = 8;
|
|
15
|
+
/** How many levels below an agent may exist, at most. */
|
|
16
|
+
export declare const DEPTH_MAX = 3;
|
|
17
|
+
/** Above this many agents in the home, none is made by an agent. They share one plan. */
|
|
18
|
+
export declare const HOME_CAP = 24;
|
|
19
|
+
export declare const skillFile: (path: string) => "---\nname: delegating\ndescription: How to hand work to agents of your own and see it through, and what else your control tools reach. Use it before creating an agent, and whenever you have work that can run apart from yours.\n---\nYour `control` connection's tools reach what the person allowed you: agents, and perhaps connections, skills and templates. A tool you don't have is one you weren't given.\n\n## Before you create an agent\n\nDo the work yourself when it is short. An agent costs model usage from the plan everyone here shares, and you have a limit on how many you can have. Use one when work can run apart from yours, or needs a shape you were not given.\n\nThere is one create tool per template you may use. Read its description and fields. Give the agent a plain name and a purpose: one sentence on what it is for, which it will be told. Fields you leave out keep the template's value.\n\n## Working with it\n\n- `agent_send` gives it a message and returns at once. It works on its own after that. Your name is on the message's first line.\n- A message with no chat named starts a new chat with it, and tells you which. Name that chat to go on in it. Start another only for work that is apart from the first.\n- `agent_chats` lists its chats and says whether it is working. A chat with a `problem` has a message that got no answer: send it another once the problem is dealt with. `agent_read` shows what was said in one. Check back when you need the result, rather than after every step.\n- Say what you want back and in what form. It knows only what you send it and its purpose.\n\n## When it is done\n\n`agent_remove` it when its work is finished, so your limit is free for the next one. `agent_stop` it to keep it for later. You can remove only agents you made, and theirs. The person sees every agent you create: it is listed with the person's own agents, and has a page of its own. The person also sees every change you make through these tools, and can undo any of it.\n" | undefined;
|
|
20
|
+
type Values = z.infer<typeof FieldValues>;
|
|
21
|
+
type TheUnit = z.infer<typeof Unit>;
|
|
22
|
+
type TheAgent = z.infer<typeof AgentRecord>;
|
|
23
|
+
type TheTemplate = z.infer<typeof Template>;
|
|
24
|
+
type TheProblem = z.infer<typeof Problem>;
|
|
25
|
+
/** The agents unit's form, with what can be chosen today. */
|
|
26
|
+
export declare function agentsUnit(templates: {
|
|
27
|
+
value: string;
|
|
28
|
+
title: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
}[], places: {
|
|
31
|
+
value: string;
|
|
32
|
+
title: string;
|
|
33
|
+
}[]): TheUnit;
|
|
34
|
+
/** A computer's reach: how far it can act, and what an agent sharing it is given. */
|
|
35
|
+
export interface Reach {
|
|
36
|
+
access: string;
|
|
37
|
+
browser: boolean;
|
|
38
|
+
connections: {
|
|
39
|
+
slot: string;
|
|
40
|
+
connection: string;
|
|
41
|
+
}[];
|
|
42
|
+
skills: string[];
|
|
43
|
+
/** Which service it is on, when it says. */
|
|
44
|
+
service?: string;
|
|
45
|
+
}
|
|
46
|
+
/** How far an agent's own computer reaches now. */
|
|
47
|
+
export declare function reachOf(record: TheAgent): Reach;
|
|
48
|
+
/** What an agents unit may not ask for, given the computer of the agent that holds it. */
|
|
49
|
+
export declare function reachProblems(values: Values, reach: {
|
|
50
|
+
access: string;
|
|
51
|
+
browser: boolean;
|
|
52
|
+
}): TheProblem[];
|
|
53
|
+
/** What the control tools use of an agent's chats. */
|
|
54
|
+
type ChatCalls = Pick<Slot<typeof chat>["call"], "send" | "history" | "list" | "state" | "rename">;
|
|
55
|
+
/** What management's own interfaces answer, called as the person would. */
|
|
56
|
+
type Person = (iface: "agents" | "connections" | "skills", method: string, input: object,
|
|
57
|
+
/** Who it's made as: the agent, so what it makes is recorded as its own. */
|
|
58
|
+
caller?: string) => Promise<any>;
|
|
59
|
+
/** One control call that changed something, or was refused: never a message or a secret. */
|
|
60
|
+
export interface Activity {
|
|
61
|
+
caller: string;
|
|
62
|
+
tool: string;
|
|
63
|
+
target?: string;
|
|
64
|
+
outcome: "done" | "refused";
|
|
65
|
+
reason?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface ControlParts {
|
|
68
|
+
self: string;
|
|
69
|
+
records: {
|
|
70
|
+
agents: Record<string, TheAgent>;
|
|
71
|
+
};
|
|
72
|
+
creatingCount(): number;
|
|
73
|
+
catalog(): Promise<Offer[]>;
|
|
74
|
+
/** What is bound to an agent now, each as its slot and provider. */
|
|
75
|
+
boundTo(agent: string): Promise<Set<string>>;
|
|
76
|
+
templates(): TheTemplate[];
|
|
77
|
+
baseProviderNamed(name: string): Promise<string>;
|
|
78
|
+
serial<T>(key: string, work: () => T | Promise<T>): Promise<T>;
|
|
79
|
+
create(input: {
|
|
80
|
+
stack: StackInput;
|
|
81
|
+
name: string;
|
|
82
|
+
purpose: string;
|
|
83
|
+
}, caller: string, child: {
|
|
84
|
+
parent: {
|
|
85
|
+
agent: string;
|
|
86
|
+
name: string;
|
|
87
|
+
};
|
|
88
|
+
reach: Reach;
|
|
89
|
+
shares: {
|
|
90
|
+
slot: string;
|
|
91
|
+
connection: string;
|
|
92
|
+
}[];
|
|
93
|
+
skills: string[];
|
|
94
|
+
computer?: Reach;
|
|
95
|
+
}): Promise<{
|
|
96
|
+
agent: string;
|
|
97
|
+
}>;
|
|
98
|
+
nameOf(actor: string): Promise<string>;
|
|
99
|
+
/** A child's chat, once the Hub has told management of it. */
|
|
100
|
+
chatOf(agent: string): Promise<ChatCalls>;
|
|
101
|
+
statusOf(agent: string, provider: string): Promise<{
|
|
102
|
+
state: string;
|
|
103
|
+
detail?: string;
|
|
104
|
+
}>;
|
|
105
|
+
start(agent: string): Promise<unknown>;
|
|
106
|
+
stop(agent: string): Promise<unknown>;
|
|
107
|
+
remove(agent: string): Promise<unknown>;
|
|
108
|
+
/** Management's interfaces, as the person reaches them. */
|
|
109
|
+
person: Person;
|
|
110
|
+
/** Where each connection came from, to know which an agent made. */
|
|
111
|
+
madeBy(connection: string): string | undefined;
|
|
112
|
+
/** Whether the library has a skill of this name that this agent may see. */
|
|
113
|
+
hasSkill(name: string, caller: string): boolean;
|
|
114
|
+
/** The agent that saved a template, if one did. */
|
|
115
|
+
templateAuthor(id: string): string | undefined;
|
|
116
|
+
/** Keep a line of the control log. */
|
|
117
|
+
log(entry: Activity): void;
|
|
118
|
+
}
|
|
119
|
+
export declare function createControl(parts: ControlParts): {
|
|
120
|
+
list(caller: string): Promise<{
|
|
121
|
+
name: string;
|
|
122
|
+
description?: string | undefined;
|
|
123
|
+
inputSchema: Record<string, z.JSONType>;
|
|
124
|
+
}[]>;
|
|
125
|
+
/** A tool that ran and failed answers `failed`, for the caller's model to read. */
|
|
126
|
+
call(caller: string, name: string, input: unknown): Promise<{
|
|
127
|
+
output: string;
|
|
128
|
+
failed?: undefined;
|
|
129
|
+
} | {
|
|
130
|
+
output: string;
|
|
131
|
+
failed: true;
|
|
132
|
+
}>;
|
|
133
|
+
};
|
|
134
|
+
export {};
|