@copilotz/team 1.0.0-rc.54 → 1.0.0-rc.56
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/WORDS.md +156 -0
- package/package.json +2 -2
- package/team/actions/agent.d.ts +10 -0
- package/team/actions/agent.js +226 -7
- package/team/actions/define.js +7 -3
- package/team/collections/agent.d.ts +52 -7
- package/team/collections/agent.js +56 -5
- package/team/mod.d.ts +7 -0
- package/team/mod.js +14 -1
- package/team/resources/propose.d.ts +1 -0
- package/team/resources/propose.js +97 -0
- package/team/shared/definition.d.ts +1 -1
- package/team/shared/definition.js +5 -4
- package/team/shared/everywhere.d.ts +11 -0
- package/team/shared/everywhere.js +29 -0
- package/team/views/web/agent-add.js +14 -4
- package/team/views/web/agent-describe.d.ts +38 -0
- package/team/views/web/agent-describe.js +44 -0
- package/team/views/web/agent-fields.d.ts +3 -1
- package/team/views/web/agent-fields.js +2 -2
- package/team/views/web/agent-known.js +2 -1
- package/team/views/web/agent-new.d.ts +4 -1
- package/team/views/web/agent-new.js +26 -5
- package/team/views/web/agent-org.d.ts +12 -0
- package/team/views/web/agent-org.js +89 -0
- package/team/views/web/agent.d.ts +7 -4
- package/team/views/web/agent.js +81 -28
- package/team/views/web/model-pick.d.ts +3 -1
- package/team/views/web/model-pick.js +4 -1
- package/team/views/web/style.d.ts +1 -1
- package/team/views/web/style.js +5 -0
- package/team/views/web/words.d.ts +1 -1
- package/team/views/web/words.js +28 -0
- package/team/web.js +2 -0
- package/tiers/actions/choose.d.ts +5 -1
- package/tiers/actions/choose.js +247 -66
- package/tiers/actions/model.js +31 -22
- package/tiers/collections/choice.d.ts +17 -10
- package/tiers/collections/choice.js +39 -27
- package/tiers/collections/template.d.ts +90 -0
- package/tiers/collections/template.js +41 -0
- package/tiers/contract.d.ts +10 -8
- package/tiers/mod.d.ts +30 -21
- package/tiers/mod.js +45 -36
- package/tiers/shared/shown.d.ts +131 -49
- package/tiers/shared/shown.js +192 -98
- package/tiers/shared/tiers.d.ts +105 -62
- package/tiers/shared/tiers.js +127 -86
- package/tiers/views/web/composer.d.ts +12 -0
- package/tiers/views/web/composer.js +79 -0
- package/tiers/views/web/org.d.ts +44 -21
- package/tiers/views/web/org.js +231 -84
- package/tiers/views/web/say.d.ts +138 -0
- package/tiers/views/web/say.js +142 -0
- package/tiers/views/web/setup.d.ts +23 -0
- package/tiers/views/web/setup.js +80 -0
- package/tiers/views/web/space.d.ts +8 -20
- package/tiers/views/web/space.js +30 -59
- package/tiers/views/web/style.d.ts +1 -1
- package/tiers/views/web/style.js +98 -4
- package/tiers/views/web/team.d.ts +38 -0
- package/tiers/views/web/team.js +118 -0
- package/tiers/views/web/words.d.ts +36 -16
- package/tiers/views/web/words.js +102 -35
- package/tiers/web.d.ts +18 -9
- package/tiers/web.js +36 -10
|
@@ -3,12 +3,23 @@
|
|
|
3
3
|
* resource): a name to call it by (`_id`, as `@maya`), what it's shown as,
|
|
4
4
|
* what it does, its instructions, model and tools. It belongs where it was
|
|
5
5
|
* made (`in`, a space with the access plugin): who manage that space change
|
|
6
|
-
* it; others meet it where it works.
|
|
6
|
+
* it; others meet it where it works.
|
|
7
|
+
*
|
|
8
|
+
* The org's team: one that belongs to the org itself (`in: "*"`) is the
|
|
9
|
+
* org's own, its owners and admins change it, and it works in every space;
|
|
10
|
+
* one with the name of one of the app's agents is the org's version of it
|
|
11
|
+
* (what the org changed of it), and `off` there, the org took it off its
|
|
12
|
+
* team. One the org made can work `like` one of the app's agents: it takes
|
|
13
|
+
* that one's model, where the app chooses models (tiers).
|
|
14
|
+
*
|
|
15
|
+
* Its queries:
|
|
7
16
|
*
|
|
8
17
|
* - `known`: every agent the asker has met, to add one where they work:
|
|
9
18
|
* the app's, and those people made that belong to or work in a space
|
|
10
19
|
* they reach (the rules say);
|
|
11
|
-
* - `options`: what an agent can be made with: the app's tools and models
|
|
20
|
+
* - `options`: what an agent can be made with: the app's tools and models;
|
|
21
|
+
* - `team`: the org's team, for its page: the app's agents (as the org has
|
|
22
|
+
* them: as they are, changed, or taken off), then the org's own.
|
|
12
23
|
*/
|
|
13
24
|
import { type Infer } from "copilotz";
|
|
14
25
|
declare const agentSchema: {
|
|
@@ -43,10 +54,18 @@ declare const agentSchema: {
|
|
|
43
54
|
readonly icon: {
|
|
44
55
|
readonly type: "string";
|
|
45
56
|
};
|
|
46
|
-
/** Where it was made: who manage that space change it. */
|
|
57
|
+
/** Where it was made: who manage that space change it; `*`, the org's own. */
|
|
47
58
|
readonly in: {
|
|
48
59
|
readonly type: "string";
|
|
49
60
|
};
|
|
61
|
+
/** One of the app's the org took off its team (on the org's version of it). */
|
|
62
|
+
readonly off: {
|
|
63
|
+
readonly type: "boolean";
|
|
64
|
+
};
|
|
65
|
+
/** One of the app's agents whose model it takes, where the app chooses models. */
|
|
66
|
+
readonly like: {
|
|
67
|
+
readonly type: "string";
|
|
68
|
+
};
|
|
50
69
|
/** Who made it: `person:ana`. */
|
|
51
70
|
readonly by: {
|
|
52
71
|
readonly type: "string";
|
|
@@ -55,7 +74,7 @@ declare const agentSchema: {
|
|
|
55
74
|
readonly type: "string";
|
|
56
75
|
};
|
|
57
76
|
};
|
|
58
|
-
readonly required: readonly ["name", "instructions", "
|
|
77
|
+
readonly required: readonly ["name", "instructions", "at"];
|
|
59
78
|
};
|
|
60
79
|
export declare const agent: {
|
|
61
80
|
schema: {
|
|
@@ -90,10 +109,18 @@ export declare const agent: {
|
|
|
90
109
|
readonly icon: {
|
|
91
110
|
readonly type: "string";
|
|
92
111
|
};
|
|
93
|
-
/** Where it was made: who manage that space change it. */
|
|
112
|
+
/** Where it was made: who manage that space change it; `*`, the org's own. */
|
|
94
113
|
readonly in: {
|
|
95
114
|
readonly type: "string";
|
|
96
115
|
};
|
|
116
|
+
/** One of the app's the org took off its team (on the org's version of it). */
|
|
117
|
+
readonly off: {
|
|
118
|
+
readonly type: "boolean";
|
|
119
|
+
};
|
|
120
|
+
/** One of the app's agents whose model it takes, where the app chooses models. */
|
|
121
|
+
readonly like: {
|
|
122
|
+
readonly type: "string";
|
|
123
|
+
};
|
|
97
124
|
/** Who made it: `person:ana`. */
|
|
98
125
|
readonly by: {
|
|
99
126
|
readonly type: "string";
|
|
@@ -102,7 +129,7 @@ export declare const agent: {
|
|
|
102
129
|
readonly type: "string";
|
|
103
130
|
};
|
|
104
131
|
};
|
|
105
|
-
readonly required: readonly ["name", "instructions", "
|
|
132
|
+
readonly required: readonly ["name", "instructions", "at"];
|
|
106
133
|
};
|
|
107
134
|
events?: boolean;
|
|
108
135
|
records?: boolean;
|
|
@@ -112,14 +139,16 @@ export declare const agent: {
|
|
|
112
139
|
queries?: Record<string, import("copilotz").QueryDef<{
|
|
113
140
|
[x: string]: unknown;
|
|
114
141
|
description?: string | undefined;
|
|
142
|
+
model?: string | undefined;
|
|
115
143
|
effort?: string | undefined;
|
|
116
144
|
tools?: string[] | undefined;
|
|
117
145
|
icon?: string | undefined;
|
|
118
146
|
in?: string | undefined;
|
|
147
|
+
off?: boolean | undefined;
|
|
148
|
+
like?: string | undefined;
|
|
119
149
|
by?: string | undefined;
|
|
120
150
|
name: string;
|
|
121
151
|
instructions: string;
|
|
122
|
-
model: string;
|
|
123
152
|
at: string;
|
|
124
153
|
} & {
|
|
125
154
|
_id: string;
|
|
@@ -129,4 +158,20 @@ export declare const agent: {
|
|
|
129
158
|
export type AgentDoc = Infer<typeof agentSchema> & {
|
|
130
159
|
_id: string;
|
|
131
160
|
};
|
|
161
|
+
/**
|
|
162
|
+
* An agent of the org's team, as its page shows it: one of the app's as it is
|
|
163
|
+
* (`app`) or as the org changed it (`changed`, `off` when it took it off its
|
|
164
|
+
* team), or one the org made (`org`), with the app's agent it works `like` or
|
|
165
|
+
* its own `model`.
|
|
166
|
+
*/
|
|
167
|
+
export type TeamAgent = {
|
|
168
|
+
id: string;
|
|
169
|
+
name: string;
|
|
170
|
+
icon?: string;
|
|
171
|
+
description?: string;
|
|
172
|
+
kind: "app" | "changed" | "org";
|
|
173
|
+
off?: true;
|
|
174
|
+
like?: string;
|
|
175
|
+
model?: string;
|
|
176
|
+
};
|
|
132
177
|
export {};
|
|
@@ -3,16 +3,28 @@
|
|
|
3
3
|
* resource): a name to call it by (`_id`, as `@maya`), what it's shown as,
|
|
4
4
|
* what it does, its instructions, model and tools. It belongs where it was
|
|
5
5
|
* made (`in`, a space with the access plugin): who manage that space change
|
|
6
|
-
* it; others meet it where it works.
|
|
6
|
+
* it; others meet it where it works.
|
|
7
|
+
*
|
|
8
|
+
* The org's team: one that belongs to the org itself (`in: "*"`) is the
|
|
9
|
+
* org's own, its owners and admins change it, and it works in every space;
|
|
10
|
+
* one with the name of one of the app's agents is the org's version of it
|
|
11
|
+
* (what the org changed of it), and `off` there, the org took it off its
|
|
12
|
+
* team. One the org made can work `like` one of the app's agents: it takes
|
|
13
|
+
* that one's model, where the app chooses models (tiers).
|
|
14
|
+
*
|
|
15
|
+
* Its queries:
|
|
7
16
|
*
|
|
8
17
|
* - `known`: every agent the asker has met, to add one where they work:
|
|
9
18
|
* the app's, and those people made that belong to or work in a space
|
|
10
19
|
* they reach (the rules say);
|
|
11
|
-
* - `options`: what an agent can be made with: the app's tools and models
|
|
20
|
+
* - `options`: what an agent can be made with: the app's tools and models;
|
|
21
|
+
* - `team`: the org's team, for its page: the app's agents (as the org has
|
|
22
|
+
* them: as they are, changed, or taken off), then the org's own.
|
|
12
23
|
*/
|
|
13
24
|
import { defineCollection, people } from "copilotz";
|
|
14
|
-
import { agentsOf, SEND } from "copilotz/plugins/agents/contract";
|
|
25
|
+
import { agentsOf, defaults, SEND } from "copilotz/plugins/agents/contract";
|
|
15
26
|
import { definitionOf } from "../shared/definition.js";
|
|
27
|
+
import { ORG } from "copilotz/plugins/access/contract";
|
|
16
28
|
const agentSchema = {
|
|
17
29
|
type: "object",
|
|
18
30
|
properties: {
|
|
@@ -28,13 +40,18 @@ const agentSchema = {
|
|
|
28
40
|
tools: { type: "array", items: { type: "string" } },
|
|
29
41
|
/** An emoji it's shown with. */
|
|
30
42
|
icon: { type: "string" },
|
|
31
|
-
/** Where it was made: who manage that space change it. */
|
|
43
|
+
/** Where it was made: who manage that space change it; `*`, the org's own. */
|
|
32
44
|
in: { type: "string" },
|
|
45
|
+
/** One of the app's the org took off its team (on the org's version of it). */
|
|
46
|
+
off: { type: "boolean" },
|
|
47
|
+
/** One of the app's agents whose model it takes, where the app chooses models. */
|
|
48
|
+
like: { type: "string" },
|
|
33
49
|
/** Who made it: `person:ana`. */
|
|
34
50
|
by: { type: "string" },
|
|
35
51
|
at: { type: "string" },
|
|
36
52
|
},
|
|
37
|
-
|
|
53
|
+
// The org's version of one of the app's has no model of its own: the app's (and its tiers) choose.
|
|
54
|
+
required: ["name", "instructions", "at"],
|
|
38
55
|
};
|
|
39
56
|
export const agent = defineCollection({
|
|
40
57
|
schema: agentSchema,
|
|
@@ -49,6 +66,40 @@ export const agent = defineCollection({
|
|
|
49
66
|
return known;
|
|
50
67
|
},
|
|
51
68
|
},
|
|
69
|
+
team: {
|
|
70
|
+
allow: people,
|
|
71
|
+
run: async (agents, _, ctx) => {
|
|
72
|
+
const declared = agentsOf(ctx);
|
|
73
|
+
const kept = await agents.find({ in: ORG });
|
|
74
|
+
const mine = new Map(kept.map((doc) => [doc._id, doc]));
|
|
75
|
+
const app = defaults(declared).map((name) => {
|
|
76
|
+
const doc = mine.get(name);
|
|
77
|
+
const shown = doc
|
|
78
|
+
? { ...declared[name], ...definitionOf(doc, declared[name]) }
|
|
79
|
+
: declared[name];
|
|
80
|
+
return {
|
|
81
|
+
id: name,
|
|
82
|
+
name: shown.name ?? name[0].toUpperCase() + name.slice(1),
|
|
83
|
+
...(shown.icon ? { icon: shown.icon } : {}),
|
|
84
|
+
...(shown.description ? { description: shown.description } : {}),
|
|
85
|
+
kind: doc ? "changed" : "app",
|
|
86
|
+
...(doc?.off ? { off: true } : {}),
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
const own = kept.filter((doc) => !declared[doc._id])
|
|
90
|
+
.sort((a, b) => a.at.localeCompare(b.at) || a._id.localeCompare(b._id))
|
|
91
|
+
.map((doc) => ({
|
|
92
|
+
id: doc._id,
|
|
93
|
+
name: doc.name,
|
|
94
|
+
...(doc.icon ? { icon: doc.icon } : {}),
|
|
95
|
+
...(doc.description ? { description: doc.description } : {}),
|
|
96
|
+
kind: "org",
|
|
97
|
+
...(doc.like ? { like: doc.like } : {}),
|
|
98
|
+
...(doc.model ? { model: doc.model } : {}),
|
|
99
|
+
}));
|
|
100
|
+
return { agents: [...app, ...own] };
|
|
101
|
+
},
|
|
102
|
+
},
|
|
52
103
|
options: {
|
|
53
104
|
allow: people,
|
|
54
105
|
run: async (_, __, ctx) => {
|
package/team/mod.d.ts
CHANGED
|
@@ -11,6 +11,13 @@
|
|
|
11
11
|
* it's a member; adding it to a space is the spaces plugin's (`member.set`,
|
|
12
12
|
* by a manager who has met it). Without it, every agent is everyone's.
|
|
13
13
|
*
|
|
14
|
+
* The org's team (with the access plugin): the app's default agents, then
|
|
15
|
+
* those the org made for itself (`in: "*"`), which work in every space. Its
|
|
16
|
+
* owners and admins change the app's ones (the org's version of each), take
|
|
17
|
+
* them off the team (`agent.delete`) and back (`agent.restore`), or back to
|
|
18
|
+
* the app's (`agent.reset`). An agent proposes one (`propose_agent`, the
|
|
19
|
+
* tool an app gives agents it lets): its person sees it and says yes or no.
|
|
20
|
+
*
|
|
14
21
|
* ```ts
|
|
15
22
|
* plugins: [models, chat, ...access, team, app]
|
|
16
23
|
* ```
|
package/team/mod.js
CHANGED
|
@@ -11,14 +11,22 @@
|
|
|
11
11
|
* it's a member; adding it to a space is the spaces plugin's (`member.set`,
|
|
12
12
|
* by a manager who has met it). Without it, every agent is everyone's.
|
|
13
13
|
*
|
|
14
|
+
* The org's team (with the access plugin): the app's default agents, then
|
|
15
|
+
* those the org made for itself (`in: "*"`), which work in every space. Its
|
|
16
|
+
* owners and admins change the app's ones (the org's version of each), take
|
|
17
|
+
* them off the team (`agent.delete`) and back (`agent.restore`), or back to
|
|
18
|
+
* the app's (`agent.reset`). An agent proposes one (`propose_agent`, the
|
|
19
|
+
* tool an app gives agents it lets): its person sees it and says yes or no.
|
|
20
|
+
*
|
|
14
21
|
* ```ts
|
|
15
22
|
* plugins: [models, chat, ...access, team, app]
|
|
16
23
|
* ```
|
|
17
24
|
*/
|
|
18
25
|
import { definePlugin, failure } from "copilotz";
|
|
19
|
-
import { createAgentAction, deleteAgentAction, draftAgentAction, updateAgentAction, } from "./actions/agent.js";
|
|
26
|
+
import { createAgentAction, deleteAgentAction, draftAgentAction, resetAgentAction, restoreAgentAction, sketchAgentAction, updateAgentAction, } from "./actions/agent.js";
|
|
20
27
|
import { defineAgentsAction } from "./actions/define.js";
|
|
21
28
|
import { agent } from "./collections/agent.js";
|
|
29
|
+
import { proposeAgent } from "./resources/propose.js";
|
|
22
30
|
export * from "./contract.js";
|
|
23
31
|
export const team = definePlugin({
|
|
24
32
|
name: "team",
|
|
@@ -29,9 +37,14 @@ export const team = definePlugin({
|
|
|
29
37
|
"agent.update": updateAgentAction,
|
|
30
38
|
"agent.delete": deleteAgentAction,
|
|
31
39
|
"agent.draft": draftAgentAction,
|
|
40
|
+
"agent.sketch": sketchAgentAction,
|
|
41
|
+
"agent.restore": restoreAgentAction,
|
|
42
|
+
"agent.reset": resetAgentAction,
|
|
32
43
|
"agent.define": defineAgentsAction,
|
|
33
44
|
},
|
|
34
45
|
resources: {
|
|
46
|
+
// Agents propose agents, for their person to approve (an app gives it to those it lets).
|
|
47
|
+
tools: { propose_agent: proposeAgent },
|
|
35
48
|
// Chat asks it what an agent not in the app's code is.
|
|
36
49
|
agentSources: { team: { action: "agent.define" } },
|
|
37
50
|
// With the access plugin: an agent belongs where it was made, its managers change it,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const proposeAgent: import("copilotz/plugins/agents/contract").Tool<Record<string, unknown>>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `propose_agent`: an agent proposes a new agent, for the person it works for
|
|
3
|
+
* to approve. It drafts the agent (a name, an emoji, what it does, its
|
|
4
|
+
* instructions, its kind of work) and where it would work: this space, or the
|
|
5
|
+
* whole org's team. The person is asked as chat asks for everything (its
|
|
6
|
+
* `ask`: a card in the conversation, Allow or No), and the turn waits. Only
|
|
7
|
+
* what the person could do themselves goes: a space they manage, the org's
|
|
8
|
+
* team if they run the org. Allowed, it's made (`agent.create`, as the app,
|
|
9
|
+
* on the person's yes) and works there at once; the agent can hand it the
|
|
10
|
+
* work. Never made without that yes.
|
|
11
|
+
*/
|
|
12
|
+
import { personOf } from "copilotz";
|
|
13
|
+
import { ask, tool } from "copilotz/plugins/agents/contract";
|
|
14
|
+
import { ORG } from "copilotz/plugins/access/contract";
|
|
15
|
+
/** Whether the person runs the org, or manages the space: what they could do themselves. */
|
|
16
|
+
async function mayMake(ctx, person, where) {
|
|
17
|
+
const system = ctx.as();
|
|
18
|
+
if (where === ORG) {
|
|
19
|
+
const role = (await system.db.collection("member")
|
|
20
|
+
.findOne({ _id: `${ORG}|person:${person}` }))?.role;
|
|
21
|
+
return role === "owner" || role === "admin";
|
|
22
|
+
}
|
|
23
|
+
const seat = await system.db.collection("member")
|
|
24
|
+
.findOne({ _id: `${where}|person:${person}` });
|
|
25
|
+
return seat?.role === "manager";
|
|
26
|
+
}
|
|
27
|
+
export const proposeAgent = tool({
|
|
28
|
+
title: "Propose an agent",
|
|
29
|
+
description: "Propose a new agent for a job that keeps coming back, for the person you work " +
|
|
30
|
+
"for to approve (they see it and answer Allow or No; the turn waits). Give it a short name, " +
|
|
31
|
+
'an emoji, what it does in a sentence or two, its instructions in the second person ("You ' +
|
|
32
|
+
'are…"), the kind of work it does (one your context lists), and where it works: this ' +
|
|
33
|
+
"space, or the whole org's team. Use it when the person asks for one, or when a specialist " +
|
|
34
|
+
"would clearly do a recurring job better; never for a one-off.",
|
|
35
|
+
input: {
|
|
36
|
+
type: "object",
|
|
37
|
+
properties: {
|
|
38
|
+
name: { type: "string", minLength: 1, maxLength: 60 },
|
|
39
|
+
icon: { type: "string", maxLength: 16 },
|
|
40
|
+
description: { type: "string", minLength: 1, maxLength: 500 },
|
|
41
|
+
instructions: { type: "string", minLength: 1, maxLength: 20_000 },
|
|
42
|
+
kind: { type: "string", maxLength: 40 },
|
|
43
|
+
where: { type: "string", enum: ["space", "org"] },
|
|
44
|
+
},
|
|
45
|
+
required: ["name", "description", "instructions"],
|
|
46
|
+
additionalProperties: false,
|
|
47
|
+
},
|
|
48
|
+
run: async (input, ctx) => {
|
|
49
|
+
const person = personOf(ctx.actor);
|
|
50
|
+
if (!person)
|
|
51
|
+
return "Only a person can approve a new agent: there's no one to ask here.";
|
|
52
|
+
const where = input.where === "org" ? ORG : ctx.in;
|
|
53
|
+
if (!where)
|
|
54
|
+
return "There's no space here to add it to: say where it should work.";
|
|
55
|
+
if (!await mayMake(ctx, person, where)) {
|
|
56
|
+
return where === ORG
|
|
57
|
+
? "Only the org's owners and admins add agents to its team: suggest it to them."
|
|
58
|
+
: "Only this space's managers add agents here: suggest it to one of them.";
|
|
59
|
+
}
|
|
60
|
+
const place = where === ORG ? "the org's team (every space)" : "this space";
|
|
61
|
+
const verdict = await ask(ctx, {
|
|
62
|
+
owner: person,
|
|
63
|
+
for: person,
|
|
64
|
+
agent: ctx.agent,
|
|
65
|
+
thread: ctx.thread,
|
|
66
|
+
...(ctx.in ? { in: ctx.in } : {}),
|
|
67
|
+
work: "agent",
|
|
68
|
+
on: `agent:${input.name.toLowerCase()}`,
|
|
69
|
+
detail: `${input.icon ? `${input.icon} ` : ""}${input.name}: ${input.description}`,
|
|
70
|
+
text: `add ${input.name} to ${place}`,
|
|
71
|
+
covers: `add agents to ${place}`,
|
|
72
|
+
answers: ["once", "deny"],
|
|
73
|
+
doing: `add a new agent, ${input.name}, to ${place}`,
|
|
74
|
+
question: `May I add a new agent, ${input.name}, to ${place}?\n${input.description}`,
|
|
75
|
+
});
|
|
76
|
+
if (verdict !== true)
|
|
77
|
+
return verdict;
|
|
78
|
+
// Their yes: made as the app, as they could have made it.
|
|
79
|
+
const system = ctx.as();
|
|
80
|
+
const { agent } = await system.call("agent.create", {
|
|
81
|
+
in: where,
|
|
82
|
+
name: input.name,
|
|
83
|
+
description: input.description,
|
|
84
|
+
instructions: input.instructions,
|
|
85
|
+
...(input.icon ? { icon: input.icon } : {}),
|
|
86
|
+
...(input.kind ? { like: input.kind } : {}),
|
|
87
|
+
});
|
|
88
|
+
if (where !== ORG) {
|
|
89
|
+
await system.call("member.set", {
|
|
90
|
+
space: where,
|
|
91
|
+
member: { kind: "agent", id: agent },
|
|
92
|
+
role: "editor",
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return `Made @${agent}: it works in ${place} now. Hand it the work with send_message.`;
|
|
96
|
+
},
|
|
97
|
+
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export const definitionOf = (doc) => ({
|
|
1
|
+
export const definitionOf = (doc, base) => ({
|
|
2
2
|
instructions: doc.instructions,
|
|
3
|
-
model: doc.model,
|
|
4
|
-
...(doc.effort ? { effort: doc.effort } : {}),
|
|
3
|
+
...(base ? {} : { model: doc.model ?? "" }),
|
|
4
|
+
...(doc.effort && !base ? { effort: doc.effort } : {}),
|
|
5
5
|
...(doc.tools ? { tools: doc.tools } : {}),
|
|
6
6
|
...(doc.description ? { description: doc.description } : {}),
|
|
7
|
-
...(doc.name !== doc._id ? { name: doc.name } : {}),
|
|
7
|
+
...(doc.name !== doc._id || base ? { name: doc.name } : {}),
|
|
8
8
|
...(doc.icon ? { icon: doc.icon } : {}),
|
|
9
9
|
...(doc.in ? { in: doc.in } : {}),
|
|
10
|
+
...(doc.like ? { like: doc.like } : {}),
|
|
10
11
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The org's team works in every space: one joins the org's spaces in use
|
|
3
|
+
* (Personal ones too), as an editor, and leaves every space it works in, through
|
|
4
|
+
* the spaces plugin's Actions (`member.set`, `member.remove`), as the person
|
|
5
|
+
* running the org, who manages them all. Nothing without the spaces plugin.
|
|
6
|
+
*/
|
|
7
|
+
import type { Context } from "copilotz";
|
|
8
|
+
/** The agent joins every space in use it isn't in. */
|
|
9
|
+
export declare function joinEverywhere(ctx: Context, agent: string): Promise<void>;
|
|
10
|
+
/** The agent leaves every space it works in. */
|
|
11
|
+
export declare function leaveEverywhere(ctx: Context, agent: string): Promise<void>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Where the agent works now: the spaces it's a member of. */
|
|
2
|
+
async function seatsOf(ctx, agent) {
|
|
3
|
+
const seats = await ctx.db.collection("member").find({ member: `agent:${agent}` });
|
|
4
|
+
return seats.filter((s) => !s.on).map((s) => s.space);
|
|
5
|
+
}
|
|
6
|
+
/** The agent joins every space in use it isn't in. */
|
|
7
|
+
export async function joinEverywhere(ctx, agent) {
|
|
8
|
+
if (!ctx.resources.roster)
|
|
9
|
+
return;
|
|
10
|
+
const seated = new Set(await seatsOf(ctx, agent));
|
|
11
|
+
const spaces = await ctx.db.collection("space").find({});
|
|
12
|
+
for (const space of spaces) {
|
|
13
|
+
if (space.archived || seated.has(space._id))
|
|
14
|
+
continue;
|
|
15
|
+
await ctx.call("member.set", {
|
|
16
|
+
space: space._id,
|
|
17
|
+
member: { kind: "agent", id: agent },
|
|
18
|
+
role: "editor",
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/** The agent leaves every space it works in. */
|
|
23
|
+
export async function leaveEverywhere(ctx, agent) {
|
|
24
|
+
if (!ctx.resources.roster)
|
|
25
|
+
return;
|
|
26
|
+
for (const space of await seatsOf(ctx, agent)) {
|
|
27
|
+
await ctx.call("member.remove", { space, member: { kind: "agent", id: agent } });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -14,6 +14,7 @@ import { KnownAgents } from "./agent-known.js";
|
|
|
14
14
|
import { NewAgent } from "./agent-new.js";
|
|
15
15
|
import { manages, placeName } from "./places.js";
|
|
16
16
|
import { STYLE } from "./style.js";
|
|
17
|
+
import { sayText } from "copilotz/web/words";
|
|
17
18
|
import { say } from "./words.js";
|
|
18
19
|
export const agentAddView = (item, ctx) => {
|
|
19
20
|
const id = item._id ?? (typeof ctx.hints.in === "string" ? ctx.hints.in : "");
|
|
@@ -21,8 +22,13 @@ export const agentAddView = (item, ctx) => {
|
|
|
21
22
|
const known = ctx.db.collection("agent").query("known", {}).value;
|
|
22
23
|
const here = ctx.db.collection("thread").query("agents", { in: id }).value;
|
|
23
24
|
const options = ctx.db.collection("agent").query("options", {}).value;
|
|
25
|
+
// Kinds of work, where tiers give agents their models (their front end says so: `agentKinds`).
|
|
26
|
+
const kindsAsked = !!ctx.resources.agentKinds?.query;
|
|
27
|
+
const tiers = kindsAsked
|
|
28
|
+
? ctx.db.collection("modelChoice").query("offered", {}).value
|
|
29
|
+
: undefined;
|
|
24
30
|
const style = _jsx("style", { href: "team-web", precedence: "copilotz", children: STYLE });
|
|
25
|
-
if (!places || !known || !here || !options) {
|
|
31
|
+
if (!places || !known || !here || !options || (kindsAsked && !tiers)) {
|
|
26
32
|
return (_jsxs("div", { className: "agent-add", "aria-busy": "true", children: [style, _jsx(Skeleton, { height: 56, radius: "lg" }), _jsx(Skeleton, { height: 56, radius: "lg" })] }));
|
|
27
33
|
}
|
|
28
34
|
const space = places.find((p) => p._id === id);
|
|
@@ -38,11 +44,15 @@ export const agentAddView = (item, ctx) => {
|
|
|
38
44
|
.sort(([a, x], [b, y]) => Number(!!x.in) - Number(!!y.in) ||
|
|
39
45
|
(x.name || a).localeCompare(y.name || b, undefined, { sensitivity: "base" }));
|
|
40
46
|
const from = typeof ctx.hints.from === "string" ? ctx.hints.from : undefined;
|
|
41
|
-
return (_jsxs(_Fragment, { children: [style, _jsx(AddAgent, { space: space, places: places, known: known, others: others, options: options, first: ctx.hints.mode === "new" || from || !others.length ? "new" : "known", from: from,
|
|
47
|
+
return (_jsxs(_Fragment, { children: [style, _jsx(AddAgent, { space: space, places: places, known: known, others: others, options: options, first: ctx.hints.mode === "new" || from || !others.length ? "new" : "known", from: from, kinds: tiers?.kinds.map((k) => ({
|
|
48
|
+
kind: k.kind,
|
|
49
|
+
title: sayText(k.title),
|
|
50
|
+
agents: k.agents.map((a) => a.name),
|
|
51
|
+
})), call: ctx.call })] }));
|
|
42
52
|
};
|
|
43
|
-
function AddAgent({ space, places, known, others, options, first, from, call }) {
|
|
53
|
+
function AddAgent({ space, places, known, others, options, first, from, kinds, call }) {
|
|
44
54
|
const [mode, setMode] = useState(first);
|
|
45
55
|
return (_jsx("div", { className: "agent-add", children: mode === "known"
|
|
46
56
|
? (_jsx(KnownAgents, { space: space, agents: others, places: places, call: call, onNew: () => setMode("new") }))
|
|
47
|
-
: (_jsx(NewAgent, { space: space, known: known, options: options, call: call, from: from, onBack: others.length ? () => setMode("known") : undefined })) }));
|
|
57
|
+
: (_jsx(NewAgent, { space: space, known: known, options: options, call: call, from: from, kinds: kinds, onBack: others.length ? () => setMode("known") : undefined })) }));
|
|
48
58
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The first step of making an agent: what it should do, in a sentence or two,
|
|
3
|
+
* and Draft it (`agent.sketch`: its name, emoji, what it does, instructions
|
|
4
|
+
* and kind of work, a moment on a real model, said so while it writes). Or
|
|
5
|
+
* fill it in by hand. And the kind-of-work field the form shows where tiers
|
|
6
|
+
* give agents their models.
|
|
7
|
+
*/
|
|
8
|
+
import { type ReactNode } from "react";
|
|
9
|
+
type Call = <R = unknown>(action: string, input?: unknown) => Promise<R>;
|
|
10
|
+
/** A kind of work, as tiers name it, with the app's agents that do it. */
|
|
11
|
+
export type KindOption = {
|
|
12
|
+
kind: string;
|
|
13
|
+
title: string;
|
|
14
|
+
agents?: string[];
|
|
15
|
+
};
|
|
16
|
+
/** What `agent.sketch` drafts. */
|
|
17
|
+
export type Sketch = {
|
|
18
|
+
name: string;
|
|
19
|
+
icon: string;
|
|
20
|
+
description: string;
|
|
21
|
+
instructions: string;
|
|
22
|
+
like?: string;
|
|
23
|
+
};
|
|
24
|
+
export declare function Describe({ kinds, call, onDraft, onSkip, placeholder }: {
|
|
25
|
+
kinds?: KindOption[];
|
|
26
|
+
call: Call;
|
|
27
|
+
onDraft(sketch: Sketch): void;
|
|
28
|
+
onSkip(): void;
|
|
29
|
+
placeholder?: string;
|
|
30
|
+
}): ReactNode;
|
|
31
|
+
/** The kind of work an agent does, where tiers give agents their models: in place of a model. */
|
|
32
|
+
export declare function KindField({ kinds, value, onChange, disabled }: {
|
|
33
|
+
kinds: KindOption[];
|
|
34
|
+
value: string;
|
|
35
|
+
onChange(kind: string): void;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
}): ReactNode;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The first step of making an agent: what it should do, in a sentence or two,
|
|
4
|
+
* and Draft it (`agent.sketch`: its name, emoji, what it does, instructions
|
|
5
|
+
* and kind of work, a moment on a real model, said so while it writes). Or
|
|
6
|
+
* fill it in by hand. And the kind-of-work field the form shows where tiers
|
|
7
|
+
* give agents their models.
|
|
8
|
+
*/
|
|
9
|
+
import { useState } from "react";
|
|
10
|
+
import { Button, Field, message, Notice, Select, Spinner, Textarea } from "copilotz/web";
|
|
11
|
+
import { say } from "./words.js";
|
|
12
|
+
export function Describe({ kinds, call, onDraft, onSkip, placeholder }) {
|
|
13
|
+
const [asked, setAsked] = useState("");
|
|
14
|
+
const [busy, setBusy] = useState(false);
|
|
15
|
+
const [error, setError] = useState();
|
|
16
|
+
const draft = async () => {
|
|
17
|
+
if (asked.trim().length < 3 || busy)
|
|
18
|
+
return;
|
|
19
|
+
setBusy(true);
|
|
20
|
+
setError(undefined);
|
|
21
|
+
try {
|
|
22
|
+
onDraft(await call("agent.sketch", {
|
|
23
|
+
asked: asked.trim(),
|
|
24
|
+
...(kinds?.length ? { kinds } : {}),
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
setError(message(e));
|
|
29
|
+
setBusy(false);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
return (_jsxs("div", { className: "agent-describe", children: [_jsx(Field, { label: say("fieldDoes"), hint: say("describeHint"), children: (control) => (_jsx(Textarea, { ...control, value: asked, rows: 3, autoGrow: true, autoFocus: true, disabled: busy, maxLength: 1000, placeholder: placeholder ?? say("describePlaceholder"), onChange: (e) => setAsked(e.target.value), onKeyDown: (e) => {
|
|
33
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey))
|
|
34
|
+
void draft();
|
|
35
|
+
} })) }), error ? _jsx(Notice, { tone: "destructive", role: "alert", children: error }) : null, _jsxs("div", { className: "agent-describe-end", children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: onSkip, disabled: busy, children: say("fillMyself") }), _jsx(Button, { variant: "primary", icon: busy ? undefined : "sparkles", disabled: asked.trim().length < 3, loading: busy, onClick: () => void draft(), children: busy ? say("drafting") : say("draftIt") })] }), busy
|
|
36
|
+
? (_jsxs("p", { className: "agent-describe-wait", "aria-live": "polite", children: [_jsx(Spinner, { size: 12 }), " ", say("draftingWait")] }))
|
|
37
|
+
: null] }));
|
|
38
|
+
}
|
|
39
|
+
/** The kind of work an agent does, where tiers give agents their models: in place of a model. */
|
|
40
|
+
export function KindField({ kinds, value, onChange, disabled }) {
|
|
41
|
+
return (_jsx(Field, { label: say("kindLabel"), hint: say("kindHint"), children: (control) => (_jsx(Select, { ...control, value: value, disabled: disabled, onChange: (e) => onChange(e.target.value), children: kinds.map((k) => (_jsx("option", { value: k.kind, children: k.agents?.length
|
|
42
|
+
? say("kindLike", { kind: k.title, agents: k.agents.join(", ") })
|
|
43
|
+
: k.title }, k.kind))) })) }));
|
|
44
|
+
}
|
|
@@ -19,7 +19,7 @@ export type Draft = {
|
|
|
19
19
|
model: string;
|
|
20
20
|
tools: string[];
|
|
21
21
|
};
|
|
22
|
-
export declare function AgentFields({ value, onChange, options, handle, call, autoFocus, disabled }: {
|
|
22
|
+
export declare function AgentFields({ value, onChange, options, handle, call, autoFocus, disabled, model }: {
|
|
23
23
|
value: Draft;
|
|
24
24
|
/** What changed: the form merges it into what's there. */
|
|
25
25
|
onChange(patch: Partial<Draft>): void;
|
|
@@ -29,5 +29,7 @@ export declare function AgentFields({ value, onChange, options, handle, call, au
|
|
|
29
29
|
call: Call;
|
|
30
30
|
autoFocus?: boolean;
|
|
31
31
|
disabled?: boolean;
|
|
32
|
+
/** What stands where the model is chosen: another field (an org's agent works like one), or none. */
|
|
33
|
+
model?: ReactNode;
|
|
32
34
|
}): ReactNode;
|
|
33
35
|
export {};
|
|
@@ -15,14 +15,14 @@ import { ModelPicker } from "./model-picker.js";
|
|
|
15
15
|
import { say } from "./words.js";
|
|
16
16
|
/** How many tools the line shows before it counts the rest. */
|
|
17
17
|
const LINE = 6;
|
|
18
|
-
export function AgentFields({ value, onChange, options, handle, call, autoFocus, disabled }) {
|
|
18
|
+
export function AgentFields({ value, onChange, options, handle, call, autoFocus, disabled, model }) {
|
|
19
19
|
const id = useId();
|
|
20
20
|
const own = !!value.icon && !ICONS.includes(value.icon);
|
|
21
21
|
return (_jsxs("div", { className: "agent-form", children: [_jsxs("div", { className: "agent-form-who", children: [value.name.trim() || value.icon
|
|
22
22
|
? _jsx(Avatar, { name: value.name.trim() || "?", kind: "agent", icon: value.icon, size: 56 })
|
|
23
23
|
: (_jsx("span", { className: "agent-face-empty", "aria-hidden": "true", children: _jsx(Icon, { name: "bot", size: 24 }) })), _jsx(Field, { label: say("fieldName"), className: "agent-form-name", hint: handle
|
|
24
24
|
? say.nodes("calledIn", { handle: _jsxs("b", { className: "agent-handle", children: ["@", handle] }) })
|
|
25
|
-
: say("nameHint"), children: (control) => (_jsx(Input, { ...control, value: value.name, maxLength: 60, placeholder: say("namePlaceholder"), autoComplete: "off", autoFocus: autoFocus, disabled: disabled, onChange: (event) => onChange({ name: event.target.value }) })) })] }), _jsxs("div", { className: "agent-form-field", role: "radiogroup", "aria-labelledby": `${id}-icon`, children: [_jsx("span", { id: `${id}-icon`, className: "agent-form-label", children: say("emoji") }), _jsxs("div", { className: "agent-icons", children: [_jsx("button", { type: "button", role: "radio", "aria-checked": !value.icon, "aria-label": say("noEmoji"), title: say("noEmoji"), className: "agent-icon agent-icon-none", disabled: disabled, onClick: () => onChange({ icon: "" }), children: (value.name.trim()[0] ?? "A").toUpperCase() }), ICONS.map((icon) => (_jsx("button", { type: "button", role: "radio", "aria-checked": value.icon === icon, className: "agent-icon", disabled: disabled, onClick: () => onChange({ icon }), children: icon }, icon))), _jsx(Input, { size: "sm", className: "agent-icon-own", "aria-label": say("anotherEmoji"), placeholder: say("otherEmoji"), value: own ? value.icon : "", maxLength: 16, autoComplete: "off", disabled: disabled, "data-chosen": own || undefined, onChange: (event) => onChange({ icon: event.target.value.trim() }) })] })] }), _jsx(Field, { label: say("fieldDoes"), hint: say("doesHint"), children: (control) => (_jsx(Textarea, { ...control, rows: 2, autoGrow: true, maxHeight: 160, maxLength: 500, value: value.description, placeholder: say("doesPlaceholder"), disabled: disabled, onChange: (event) => onChange({ description: event.target.value }) })) }), _jsx(Instructions, { value: value, onChange: onChange, call: call, disabled: disabled }), _jsx(Field, { label: say("model"), hint: say("modelHint"), children: (control) => (_jsx(ModelPicker, { id: control.id, value: value.model, call: call, disabled: disabled, onChange: (model) => onChange({ model }) })) }), _jsx(Tools, { value: value.tools, onChange: (tools) => onChange({ tools }), options: options })] }));
|
|
25
|
+
: say("nameHint"), children: (control) => (_jsx(Input, { ...control, value: value.name, maxLength: 60, placeholder: say("namePlaceholder"), autoComplete: "off", autoFocus: autoFocus, disabled: disabled, onChange: (event) => onChange({ name: event.target.value }) })) })] }), _jsxs("div", { className: "agent-form-field", role: "radiogroup", "aria-labelledby": `${id}-icon`, children: [_jsx("span", { id: `${id}-icon`, className: "agent-form-label", children: say("emoji") }), _jsxs("div", { className: "agent-icons", children: [_jsx("button", { type: "button", role: "radio", "aria-checked": !value.icon, "aria-label": say("noEmoji"), title: say("noEmoji"), className: "agent-icon agent-icon-none", disabled: disabled, onClick: () => onChange({ icon: "" }), children: (value.name.trim()[0] ?? "A").toUpperCase() }), ICONS.map((icon) => (_jsx("button", { type: "button", role: "radio", "aria-checked": value.icon === icon, className: "agent-icon", disabled: disabled, onClick: () => onChange({ icon }), children: icon }, icon))), _jsx(Input, { size: "sm", className: "agent-icon-own", "aria-label": say("anotherEmoji"), placeholder: say("otherEmoji"), value: own ? value.icon : "", maxLength: 16, autoComplete: "off", disabled: disabled, "data-chosen": own || undefined, onChange: (event) => onChange({ icon: event.target.value.trim() }) })] })] }), _jsx(Field, { label: say("fieldDoes"), hint: say("doesHint"), children: (control) => (_jsx(Textarea, { ...control, rows: 2, autoGrow: true, maxHeight: 160, maxLength: 500, value: value.description, placeholder: say("doesPlaceholder"), disabled: disabled, onChange: (event) => onChange({ description: event.target.value }) })) }), _jsx(Instructions, { value: value, onChange: onChange, call: call, disabled: disabled }), model !== undefined ? model : (_jsx(Field, { label: say("model"), hint: say("modelHint"), children: (control) => (_jsx(ModelPicker, { id: control.id, value: value.model, call: call, disabled: disabled, onChange: (model) => onChange({ model }) })) })), _jsx(Tools, { value: value.tools, onChange: (tools) => onChange({ tools }), options: options })] }));
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Its instructions: typed, or written for the person from its name and
|
|
@@ -11,6 +11,7 @@ import { Avatar, Button, Icon, Input, message, Select } from "copilotz/web";
|
|
|
11
11
|
import { AGENT_ROLES } from "copilotz/plugins/access/contract";
|
|
12
12
|
import { found, listed, shownAs } from "./agents.js";
|
|
13
13
|
import { placeName } from "./places.js";
|
|
14
|
+
import { sayText } from "copilotz/web/words";
|
|
14
15
|
import { say } from "./words.js";
|
|
15
16
|
/** Past this many, there's a field to find one. */
|
|
16
17
|
const FIND = 5;
|
|
@@ -48,7 +49,7 @@ export function KnownAgents({ space, agents, places, call, onNew }) {
|
|
|
48
49
|
return (_jsxs("div", { className: "agent-known", children: [_jsxs("div", { className: "agent-known-tools", children: [agents.length > FIND
|
|
49
50
|
? (_jsxs(_Fragment, { children: [_jsx("label", { className: "copilotz-sr", htmlFor: `${id}-find`, children: say("findAgent") }), _jsx(Input, { id: `${id}-find`, type: "search", icon: "search", size: "sm", className: "agent-known-find", placeholder: say("findAgentKnown"), autoComplete: "off", autoFocus: true, value: search, onChange: (event) => setSearch(event.target.value) })] }))
|
|
50
51
|
: _jsx("p", { className: "agent-known-intro", children: say("knownIntro") }), _jsxs("label", { className: "agent-known-role", children: [_jsx("span", { children: say("addsAs") }), _jsx(Select, { size: "sm", value: role, onChange: (event) => setRole(event.target.value), children: AGENT_ROLES.map((r) => _jsx("option", { value: r.value, children: r.label }, r.value)) })] })] }), _jsxs("ul", { className: "agent-known-list", children: [_jsx("li", { children: _jsxs("button", { type: "button", className: "agent-known-row agent-known-new", onClick: onNew, children: [_jsx("span", { className: "agent-known-plus", children: _jsx(Icon, { name: "plus", size: 18 }) }), _jsxs("span", { className: "agent-known-text", children: [_jsx("span", { className: "agent-known-name", children: say("createNewAgent") }), _jsx("span", { className: "agent-known-what", children: say("createNewAgentBody") })] }), _jsx(Icon, { name: "chevron", size: 16 })] }) }), shown.map((a) => (_jsxs("li", { className: "agent-known-row", children: [_jsx(Avatar, { name: a.name, kind: "agent", icon: a.icon, size: 34 }), _jsxs("span", { className: "agent-known-text", children: [_jsxs("span", { className: "agent-known-name", children: [a.name, " ", _jsxs("span", { className: "agent-handle", children: ["@", a.id] }), _jsx("span", { className: "agent-known-from", children: belongs(a.agent, places) })] }), a.agent.description
|
|
51
|
-
? _jsx("span", { className: "agent-known-what", children: a.agent.description })
|
|
52
|
+
? _jsx("span", { className: "agent-known-what", children: sayText(a.agent.description) })
|
|
52
53
|
: null] }), _jsx(Button, { size: "sm", icon: "plus", loading: busy === a.id, disabled: !!busy && busy !== a.id, "aria-label": say("addAgentTo", { name: a.name, place: where }), onClick: () => void add(a.id, a.name), children: say("add") })] }, a.id)))] }), !shown.length
|
|
53
54
|
? (_jsx("p", { className: "agent-known-none", children: agents.length
|
|
54
55
|
? say("noneCalled", { search: search.trim() })
|
|
@@ -7,11 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { type ReactNode } from "react";
|
|
9
9
|
import type { Agent } from "copilotz/plugins/agents/contract";
|
|
10
|
+
import { type KindOption } from "./agent-describe.js";
|
|
10
11
|
import { type Options } from "./agents.js";
|
|
11
12
|
import { type Place } from "./places.js";
|
|
12
13
|
type Call = <R = unknown>(action: string, input?: unknown) => Promise<R>;
|
|
13
|
-
export declare function NewAgent({ space, known, options, call, from: first, onBack }: {
|
|
14
|
+
export declare function NewAgent({ space, known, options, call, from: first, onBack, kinds }: {
|
|
14
15
|
space: Place;
|
|
16
|
+
/** Kinds of work, where tiers give agents their models: one in place of a model. */
|
|
17
|
+
kinds?: KindOption[];
|
|
15
18
|
/** Every agent the person has met: the app's, to start from; and names taken. */
|
|
16
19
|
known: Record<string, Agent>;
|
|
17
20
|
options: Options;
|