@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,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one place a unit's form is read: what its fields come to once filled in, what the unit will
|
|
3
|
+
* then give, and the JSON Schema an agent fills. A form is data; nothing here calls the unit.
|
|
4
|
+
*/
|
|
5
|
+
import type { FieldValues, Form, Problem, Unit } from "@agentorg/interfaces";
|
|
6
|
+
import type { z } from "zod";
|
|
7
|
+
type TheForm = z.infer<typeof Form>;
|
|
8
|
+
type Values = z.infer<typeof FieldValues>;
|
|
9
|
+
type TheProblem = z.infer<typeof Problem>;
|
|
10
|
+
type TheUnit = z.infer<typeof Unit>;
|
|
11
|
+
/** What is wrong with a form as written: a unit that has one is refused, whatever is filled in. */
|
|
12
|
+
export declare function formProblems(form: TheForm): string[];
|
|
13
|
+
/**
|
|
14
|
+
* What the unit's logic will read: `values` checked against the form, defaults applied, and a
|
|
15
|
+
* field that isn't shown dropped. Problems name the field. A value for a secret field is one.
|
|
16
|
+
*/
|
|
17
|
+
export declare function settle(form: TheForm, values: Values, secrets: string[]): {
|
|
18
|
+
values: Values;
|
|
19
|
+
secrets: string[];
|
|
20
|
+
problems: TheProblem[];
|
|
21
|
+
};
|
|
22
|
+
export interface Worked {
|
|
23
|
+
slots: string[];
|
|
24
|
+
/** Each with its files, or none for a skill the unit names by a field. */
|
|
25
|
+
skills: {
|
|
26
|
+
name: string;
|
|
27
|
+
files?: string[];
|
|
28
|
+
}[];
|
|
29
|
+
}
|
|
30
|
+
/** What a unit gives for these settled values: what it always gives, and what its answers add. */
|
|
31
|
+
export declare function workedOut(unit: TheUnit, values: Values): Worked;
|
|
32
|
+
/**
|
|
33
|
+
* The JSON Schema of a form, for an agent to fill: flat strings, numbers, booleans and enums, as
|
|
34
|
+
* MCP's elicitation allows. A secret is left out: an agent can never supply one. A field that shows
|
|
35
|
+
* only after a choice is optional and says so.
|
|
36
|
+
*/
|
|
37
|
+
export declare function schemaOf(form: TheForm): Record<string, unknown>;
|
|
38
|
+
/** The JSON Schema of a form's secrets. A field of type `environment` takes secrets by any name. */
|
|
39
|
+
export declare function secretsSchemaOf(form: TheForm): Record<string, unknown>;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
const fits = (field, value) => field.value === "strings"
|
|
2
|
+
? Array.isArray(value)
|
|
3
|
+
: typeof value === (field.value === "secret" ? "string" : field.value);
|
|
4
|
+
/** What is wrong with a form as written: a unit that has one is refused, whatever is filled in. */
|
|
5
|
+
export function formProblems(form) {
|
|
6
|
+
const problems = [];
|
|
7
|
+
const ids = new Set();
|
|
8
|
+
for (const field of form) {
|
|
9
|
+
if (ids.has(field.id))
|
|
10
|
+
problems.push(`${field.id} is in the form twice.`);
|
|
11
|
+
ids.add(field.id);
|
|
12
|
+
if (field.value === "secret" && field.default !== undefined)
|
|
13
|
+
problems.push(`${field.id} is a secret, which has no default.`);
|
|
14
|
+
else if (field.default !== undefined && !fits(field, field.default))
|
|
15
|
+
problems.push(`${field.id}'s default isn't a ${field.value}.`);
|
|
16
|
+
if (field.min !== undefined && field.max !== undefined && field.min > field.max)
|
|
17
|
+
problems.push(`${field.id}'s min is above its max.`);
|
|
18
|
+
}
|
|
19
|
+
for (const field of form)
|
|
20
|
+
if (field.visible && !ids.has(field.visible.field))
|
|
21
|
+
problems.push(`${field.id} depends on ${field.visible.field}, which isn't in the form.`);
|
|
22
|
+
return problems;
|
|
23
|
+
}
|
|
24
|
+
/** Which fields are shown, given what was filled in and the defaults. */
|
|
25
|
+
function shownFields(form, values) {
|
|
26
|
+
const byId = new Map(form.map((field) => [field.id, field]));
|
|
27
|
+
const seen = new Map();
|
|
28
|
+
const shown = (id) => {
|
|
29
|
+
const known = seen.get(id);
|
|
30
|
+
if (known !== undefined)
|
|
31
|
+
return known;
|
|
32
|
+
seen.set(id, false); // A field that depends on itself, however far round, isn't shown.
|
|
33
|
+
const field = byId.get(id);
|
|
34
|
+
const { visible } = field;
|
|
35
|
+
let answer = true;
|
|
36
|
+
if (visible) {
|
|
37
|
+
const other = byId.get(visible.field);
|
|
38
|
+
const value = other && shown(other.id) ? (values[other.id] ?? other.default) : undefined;
|
|
39
|
+
answer =
|
|
40
|
+
value !== undefined &&
|
|
41
|
+
(Array.isArray(value)
|
|
42
|
+
? value.some((one) => visible.in.includes(one))
|
|
43
|
+
: visible.in.some((one) => one === value));
|
|
44
|
+
}
|
|
45
|
+
seen.set(id, answer);
|
|
46
|
+
return answer;
|
|
47
|
+
};
|
|
48
|
+
return new Set(form.filter((field) => shown(field.id)).map((field) => field.id));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* What the unit's logic will read: `values` checked against the form, defaults applied, and a
|
|
52
|
+
* field that isn't shown dropped. Problems name the field. A value for a secret field is one.
|
|
53
|
+
*/
|
|
54
|
+
export function settle(form, values, secrets) {
|
|
55
|
+
const problems = [];
|
|
56
|
+
// An empty answer is no answer: a default applies, and a required field isn't filled in.
|
|
57
|
+
values = Object.fromEntries(Object.entries(values).filter(([, value]) => value !== ""));
|
|
58
|
+
const shown = shownFields(form, values);
|
|
59
|
+
const settled = {};
|
|
60
|
+
const kept = [];
|
|
61
|
+
for (const id of Object.keys(values))
|
|
62
|
+
if (!form.some((field) => field.id === id))
|
|
63
|
+
problems.push({ field: id, message: `This unit has no field ${id}.` });
|
|
64
|
+
for (const name of secrets)
|
|
65
|
+
if (!form.some((field) => field.id === name && field.value === "secret"))
|
|
66
|
+
problems.push({ message: `${name} isn't a secret of this unit.` });
|
|
67
|
+
for (const field of form) {
|
|
68
|
+
if (field.value === "secret") {
|
|
69
|
+
if (values[field.id] !== undefined)
|
|
70
|
+
problems.push({
|
|
71
|
+
field: field.id,
|
|
72
|
+
message: `${field.title} is a secret: it isn't a value.`,
|
|
73
|
+
});
|
|
74
|
+
if (!shown.has(field.id))
|
|
75
|
+
continue;
|
|
76
|
+
if (secrets.includes(field.id))
|
|
77
|
+
kept.push(field.id);
|
|
78
|
+
else if (field.required)
|
|
79
|
+
problems.push({ field: field.id, message: `${field.title} must be given.` });
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (!shown.has(field.id))
|
|
83
|
+
continue;
|
|
84
|
+
const value = values[field.id] ?? field.default;
|
|
85
|
+
if (value === undefined) {
|
|
86
|
+
if (field.required)
|
|
87
|
+
problems.push({ field: field.id, message: `${field.title} must be filled in.` });
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (!fits(field, value)) {
|
|
91
|
+
problems.push({ field: field.id, message: `${field.title} must be a ${field.value}.` });
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (field.options) {
|
|
95
|
+
const offered = new Set(field.options.map((option) => option.value));
|
|
96
|
+
if (![value].flat().every((one) => offered.has(String(one))))
|
|
97
|
+
problems.push({ field: field.id, message: `${field.title} isn't one of its options.` });
|
|
98
|
+
}
|
|
99
|
+
if (typeof value === "number" &&
|
|
100
|
+
((field.min !== undefined && value < field.min) ||
|
|
101
|
+
(field.max !== undefined && value > field.max)))
|
|
102
|
+
problems.push({ field: field.id, message: `${field.title} is out of range.` });
|
|
103
|
+
settled[field.id] = value;
|
|
104
|
+
}
|
|
105
|
+
return { values: settled, secrets: kept, problems };
|
|
106
|
+
}
|
|
107
|
+
/** What a unit gives for these settled values: what it always gives, and what its answers add. */
|
|
108
|
+
export function workedOut(unit, values) {
|
|
109
|
+
const adds = [unit.gives];
|
|
110
|
+
for (const field of unit.form) {
|
|
111
|
+
const value = values[field.id];
|
|
112
|
+
if (value === undefined)
|
|
113
|
+
continue;
|
|
114
|
+
if (value === true && field.adds)
|
|
115
|
+
adds.push(field.adds);
|
|
116
|
+
for (const option of field.options ?? [])
|
|
117
|
+
if (option.adds && [value].flat().map(String).includes(option.value))
|
|
118
|
+
adds.push(option.adds);
|
|
119
|
+
}
|
|
120
|
+
const nameOf = (from) => {
|
|
121
|
+
const value = values[from.field];
|
|
122
|
+
return typeof value === "string" ? value : undefined;
|
|
123
|
+
};
|
|
124
|
+
const slots = new Set();
|
|
125
|
+
const skills = new Map();
|
|
126
|
+
for (const add of adds) {
|
|
127
|
+
for (const slot of add.slots) {
|
|
128
|
+
const name = "name" in slot ? slot.name : nameOf(slot);
|
|
129
|
+
if (name)
|
|
130
|
+
slots.add(name);
|
|
131
|
+
}
|
|
132
|
+
for (const skill of add.skills) {
|
|
133
|
+
if ("name" in skill)
|
|
134
|
+
skills.set(skill.name, skill);
|
|
135
|
+
else {
|
|
136
|
+
const name = nameOf(skill);
|
|
137
|
+
if (name)
|
|
138
|
+
skills.set(name, { name });
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return { slots: [...slots], skills: [...skills.values()] };
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The JSON Schema of a form, for an agent to fill: flat strings, numbers, booleans and enums, as
|
|
146
|
+
* MCP's elicitation allows. A secret is left out: an agent can never supply one. A field that shows
|
|
147
|
+
* only after a choice is optional and says so.
|
|
148
|
+
*/
|
|
149
|
+
export function schemaOf(form) {
|
|
150
|
+
const properties = {};
|
|
151
|
+
const required = [];
|
|
152
|
+
for (const field of form) {
|
|
153
|
+
if (field.value === "secret")
|
|
154
|
+
continue;
|
|
155
|
+
const type = { string: "string", number: "number", boolean: "boolean", strings: "array" }[field.value];
|
|
156
|
+
const notes = [
|
|
157
|
+
field.description,
|
|
158
|
+
...(field.options ?? []).map((option) => option.description ? `${option.value}: ${option.description}` : undefined),
|
|
159
|
+
field.visible
|
|
160
|
+
? `Only when ${field.visible.field} is ${field.visible.in.join(" or ")}.`
|
|
161
|
+
: undefined,
|
|
162
|
+
].filter(Boolean);
|
|
163
|
+
const allowed = field.options?.map((option) => option.value);
|
|
164
|
+
properties[field.id] = {
|
|
165
|
+
type,
|
|
166
|
+
title: field.title,
|
|
167
|
+
...(notes.length ? { description: notes.join(" ") } : {}),
|
|
168
|
+
...(field.value === "strings"
|
|
169
|
+
? { items: { type: "string", ...(allowed ? { enum: allowed } : {}) } }
|
|
170
|
+
: allowed
|
|
171
|
+
? { enum: allowed }
|
|
172
|
+
: {}),
|
|
173
|
+
...(field.min === undefined ? {} : { minimum: field.min }),
|
|
174
|
+
...(field.max === undefined ? {} : { maximum: field.max }),
|
|
175
|
+
...(field.default === undefined ? {} : { default: field.default }),
|
|
176
|
+
};
|
|
177
|
+
if (field.required && !field.visible && field.default === undefined)
|
|
178
|
+
required.push(field.id);
|
|
179
|
+
}
|
|
180
|
+
return { type: "object", properties, required };
|
|
181
|
+
}
|
|
182
|
+
/** The JSON Schema of a form's secrets. A field of type `environment` takes secrets by any name. */
|
|
183
|
+
export function secretsSchemaOf(form) {
|
|
184
|
+
const secrets = form.filter((field) => field.value === "secret");
|
|
185
|
+
if (secrets.some((field) => field.type === "environment"))
|
|
186
|
+
return { type: "object", additionalProperties: { type: "string" } };
|
|
187
|
+
return {
|
|
188
|
+
type: "object",
|
|
189
|
+
properties: Object.fromEntries(secrets.map((field) => [field.id, { type: "string", title: field.title }])),
|
|
190
|
+
};
|
|
191
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { type Template } from "@agentorg/interfaces";
|
|
1
2
|
import { type Log } from "@agentorg/sdk";
|
|
3
|
+
import type { z } from "zod";
|
|
2
4
|
export interface ManagerOptions {
|
|
3
5
|
hubUrl: string;
|
|
4
6
|
/** Its own Actor, bound to `hub.actors@1`, `hub.grants@1` and `hub.bindings@1`, which make it a manager. */
|
|
@@ -6,6 +8,8 @@ export interface ManagerOptions {
|
|
|
6
8
|
credential: string;
|
|
7
9
|
/** A private folder of its own, which holds its records and the skills. */
|
|
8
10
|
dir: string;
|
|
11
|
+
/** Templates the app ships. */
|
|
12
|
+
templates?: z.infer<typeof Template>[];
|
|
9
13
|
log?: Log;
|
|
10
14
|
}
|
|
11
15
|
export interface Manager {
|