@divaltor/academy 0.1.6 → 0.1.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 +5 -1
- package/package.json +1 -1
- package/src/index.ts +29 -5
package/README.md
CHANGED
|
@@ -36,7 +36,11 @@ Add Academy to `opencode.jsonc`. Each agent can override its display name and co
|
|
|
36
36
|
}
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
Colors accept six-digit hex values or OpenCode theme colors: `primary`, `secondary`, `accent`, `success`, `warning`, `error`, and `info`. You can alternatively set a color with OpenCode's native `agents.<id>.color` configuration. Custom names also update persona references.
|
|
39
|
+
Colors accept six-digit hex values or OpenCode theme colors: `primary`, `secondary`, `accent`, `success`, `warning`, `error`, and `info`. You can alternatively set a color with OpenCode's native `agents.<id>.color` configuration. Custom names also become the agents' IDs and update persona and permission references. Without custom names, agent IDs are `rudolf`, `bourbon`, `agnes`, `cafe`, `dantsu`, and `bellno`.
|
|
40
|
+
|
|
41
|
+
> [!WARNING] Choose custom names when first setting up Academy and avoid changing them later. OpenCode stores the selected agent ID in each session, so renaming an agent removes the ID referenced by existing sessions and can prevent those sessions from continuing.
|
|
42
|
+
|
|
43
|
+
See the [plugin docs](https://opencode.ai/v2/docs/build/plugins) to learn more.
|
|
40
44
|
|
|
41
45
|
### Private GitHub repositories
|
|
42
46
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@divaltor/academy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "An OpenCode plugin that trains a Tracen Academy roster of specialist coding agents to research, build, and review.",
|
|
5
5
|
"homepage": "https://github.com/divaltor/academy#readme",
|
|
6
6
|
"bugs": {
|
package/src/index.ts
CHANGED
|
@@ -27,6 +27,15 @@ const setup = Effect.fn("Academy.setup")(function* setup(ctx: Plugin.Context) {
|
|
|
27
27
|
const agentNames = new Map(
|
|
28
28
|
agents.map((agent) => [agent.name, options[agent.id]?.name ?? agent.name])
|
|
29
29
|
);
|
|
30
|
+
const agentID = (id: (typeof agents)[number]["id"]) =>
|
|
31
|
+
Agent.ID.make(options[id]?.name ?? id);
|
|
32
|
+
const configuredAgentIDs = agents.map((agent) => agentID(agent.id));
|
|
33
|
+
|
|
34
|
+
if (new Set(configuredAgentIDs).size !== configuredAgentIDs.length) {
|
|
35
|
+
return yield* Effect.die(
|
|
36
|
+
new Error("Academy agent names must produce unique agent IDs")
|
|
37
|
+
);
|
|
38
|
+
}
|
|
30
39
|
|
|
31
40
|
yield* ctx.mcp.transform((editor) => {
|
|
32
41
|
if (Option.isNone(githubToken)) {
|
|
@@ -50,7 +59,13 @@ const setup = Effect.fn("Academy.setup")(function* setup(ctx: Plugin.Context) {
|
|
|
50
59
|
}
|
|
51
60
|
|
|
52
61
|
for (const definition of agents) {
|
|
53
|
-
|
|
62
|
+
if (agentID(definition.id) !== definition.id) {
|
|
63
|
+
editor.remove(definition.id);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
for (const definition of agents) {
|
|
68
|
+
editor.update(agentID(definition.id), (agent) => {
|
|
54
69
|
agent.name = Agent.Name.make(
|
|
55
70
|
agentNames.get(definition.name) ?? definition.name
|
|
56
71
|
);
|
|
@@ -62,9 +77,18 @@ const setup = Effect.fn("Academy.setup")(function* setup(ctx: Plugin.Context) {
|
|
|
62
77
|
/\b(?:Rudolf|Agnes|Bourbon|Cafe|Dantsu|Bellno)\b/gu,
|
|
63
78
|
(name) => agentNames.get(name) ?? name
|
|
64
79
|
);
|
|
65
|
-
agent.permissions = definition.permissions.map((permission) =>
|
|
66
|
-
|
|
67
|
-
|
|
80
|
+
agent.permissions = definition.permissions.map((permission) => {
|
|
81
|
+
const referencedAgent = agents.find(
|
|
82
|
+
(candidate) => candidate.id === permission.resource
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
...permission,
|
|
87
|
+
resource: referencedAgent
|
|
88
|
+
? agentID(referencedAgent.id)
|
|
89
|
+
: permission.resource,
|
|
90
|
+
};
|
|
91
|
+
});
|
|
68
92
|
agent.model = definition.model
|
|
69
93
|
? {
|
|
70
94
|
id: Model.ID.make(definition.model.id),
|
|
@@ -75,7 +99,7 @@ const setup = Effect.fn("Academy.setup")(function* setup(ctx: Plugin.Context) {
|
|
|
75
99
|
});
|
|
76
100
|
}
|
|
77
101
|
|
|
78
|
-
editor.default("rudolf");
|
|
102
|
+
editor.default(agentID("rudolf"));
|
|
79
103
|
});
|
|
80
104
|
});
|
|
81
105
|
|