@divaltor/academy 0.3.1 → 0.3.3
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 +12 -6
- package/package.json +1 -1
- package/src/index.ts +15 -7
- package/src/session-communication.ts +10 -3
package/README.md
CHANGED
|
@@ -23,10 +23,12 @@ Add Academy to `opencode.jsonc`. All options are optional:
|
|
|
23
23
|
{
|
|
24
24
|
"package": "@divaltor/academy",
|
|
25
25
|
"options": {
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
"agents": {
|
|
27
|
+
"rudolf": {
|
|
28
|
+
"name": "Emperor",
|
|
29
|
+
"color": "#8994B8",
|
|
30
|
+
"model": "anthropic/claude-opus-4-1#max",
|
|
31
|
+
},
|
|
30
32
|
},
|
|
31
33
|
"communication": {
|
|
32
34
|
"thread_summary": "opencode-go/glm-5.3-flash",
|
|
@@ -38,9 +40,9 @@ Add Academy to `opencode.jsonc`. All options are optional:
|
|
|
38
40
|
}
|
|
39
41
|
```
|
|
40
42
|
|
|
41
|
-
Each agent accepts `name`, `color`, and `model`. Colors may be six-digit hex values or OpenCode theme colors. Model references use `provider/model` or `provider/model#variant`.
|
|
43
|
+
Each agent under `agents` accepts `name`, `color`, and `model`. Colors may be six-digit hex values or OpenCode theme colors. Model references use `provider/model` or `provider/model#variant`.
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
`use_fff` replaces OpenCode's built-in `glob` and `grep` tools globally with [FFF](https://github.com/d-kimuson/fff.nvim) for every agent. Enabled by default; set to `false` to keep the built-in tools. This requires a platform supported by `@ff-labs/fff-bun`.
|
|
44
46
|
|
|
45
47
|
| Agent | Default model |
|
|
46
48
|
| ------ | ----------------------------- |
|
|
@@ -56,6 +58,10 @@ Set `use_fff` to `true` to replace OpenCode's built-in `glob` and `grep` tools g
|
|
|
56
58
|
|
|
57
59
|
Session tools are available under Code Mode's `academy` namespace. Only the root primary session can create threads; omit `agent` for a general coding session.
|
|
58
60
|
|
|
61
|
+
> [!NOTE]
|
|
62
|
+
>
|
|
63
|
+
> `read_thread` with a question summarizes via the `communication.thread_summary` model, or the calling session's model when unset. Models on `opencode-go` cannot use stateless generation (the provider requires session routing headers that only a session request carries), so Academy answers through a dedicated `Academy summary <model>` session via transient `session.generate` — no transcript writes, but the session stays visible in the session list because the plugin API exposes neither archive nor delete for it.
|
|
64
|
+
|
|
59
65
|
> [!NOTE]
|
|
60
66
|
>
|
|
61
67
|
> `find_thread` currently searches Academy-created sessions only. OpenCode's HTTP client can list persisted sessions, but the plugin context does not yet expose `ctx.session.list`, so Academy cannot safely discover sessions created before the plugin was installed. We are waiting for upstream support rather than reading OpenCode's private SQLite database or connecting back to the server through a separate client.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@divaltor/academy",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
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
|
@@ -18,13 +18,17 @@ const AgentOptions = Schema.Struct({
|
|
|
18
18
|
name: Schema.optionalKey(Schema.NonEmptyString),
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const AgentsOptions = Schema.Struct({
|
|
22
22
|
agnes: Schema.optionalKey(AgentOptions),
|
|
23
23
|
bellno: Schema.optionalKey(AgentOptions),
|
|
24
24
|
cafe: Schema.optionalKey(AgentOptions),
|
|
25
|
-
communication: Schema.optionalKey(SessionCommunication.Options),
|
|
26
25
|
dantsu: Schema.optionalKey(AgentOptions),
|
|
27
26
|
rudolf: Schema.optionalKey(AgentOptions),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const AcademyOptions = Schema.Struct({
|
|
30
|
+
agents: Schema.optionalKey(AgentsOptions),
|
|
31
|
+
communication: Schema.optionalKey(SessionCommunication.Options),
|
|
28
32
|
use_fff: Schema.optionalKey(Schema.Boolean),
|
|
29
33
|
});
|
|
30
34
|
|
|
@@ -35,11 +39,15 @@ const setup = Effect.fn("Academy.setup")(function* setup(ctx: Plugin.Context) {
|
|
|
35
39
|
const options = yield* Schema.decodeUnknownEffect(AcademyOptions, {
|
|
36
40
|
onExcessProperty: "error",
|
|
37
41
|
})(ctx.options).pipe(Effect.orDie);
|
|
42
|
+
const agentOptions = options.agents ?? {};
|
|
38
43
|
const agentNames = new Map(
|
|
39
|
-
agents.map((agent) => [
|
|
44
|
+
agents.map((agent) => [
|
|
45
|
+
agent.name,
|
|
46
|
+
agentOptions[agent.id]?.name ?? agent.name,
|
|
47
|
+
])
|
|
40
48
|
);
|
|
41
49
|
const agentID = (id: (typeof agents)[number]["id"]) =>
|
|
42
|
-
Agent.ID.make(
|
|
50
|
+
Agent.ID.make(agentOptions[id]?.name ?? id);
|
|
43
51
|
const configuredAgentIDs = agents.map((agent) => agentID(agent.id));
|
|
44
52
|
|
|
45
53
|
if (new Set(configuredAgentIDs).size !== configuredAgentIDs.length) {
|
|
@@ -64,7 +72,7 @@ const setup = Effect.fn("Academy.setup")(function* setup(ctx: Plugin.Context) {
|
|
|
64
72
|
});
|
|
65
73
|
});
|
|
66
74
|
|
|
67
|
-
if (options.use_fff) {
|
|
75
|
+
if (options.use_fff ?? true) {
|
|
68
76
|
yield* FffTools.register(ctx);
|
|
69
77
|
}
|
|
70
78
|
|
|
@@ -87,7 +95,7 @@ const setup = Effect.fn("Academy.setup")(function* setup(ctx: Plugin.Context) {
|
|
|
87
95
|
agent.description = definition.description;
|
|
88
96
|
agent.mode = definition.mode;
|
|
89
97
|
agent.color =
|
|
90
|
-
|
|
98
|
+
agentOptions[definition.id]?.color ?? agent.color ?? definition.color;
|
|
91
99
|
agent.system = definition.system.replaceAll(
|
|
92
100
|
/\b(?:Rudolf|Agnes|Cafe|Dantsu|Bellno)\b/gu,
|
|
93
101
|
(name) => agentNames.get(name) ?? name
|
|
@@ -105,7 +113,7 @@ const setup = Effect.fn("Academy.setup")(function* setup(ctx: Plugin.Context) {
|
|
|
105
113
|
};
|
|
106
114
|
});
|
|
107
115
|
agent.model = parseModel(
|
|
108
|
-
|
|
116
|
+
agentOptions[definition.id]?.model ?? definition.model
|
|
109
117
|
);
|
|
110
118
|
});
|
|
111
119
|
}
|
|
@@ -468,8 +468,8 @@ export namespace SessionCommunication {
|
|
|
468
468
|
|
|
469
469
|
editor.add({
|
|
470
470
|
description:
|
|
471
|
-
"Use when a known session's conversation or result is needed. Without question, returns its active context directly. With question, summarizes via the thread_summary model
|
|
472
|
-
execute: (input) =>
|
|
471
|
+
"Use when a known session's conversation or result is needed. Without question, returns its active context directly. With question, summarizes via the thread_summary model, or the calling session's model when unset; opencode-go models route through a dedicated session, since plugin calls carry no session for provider routing. Use this instead of loading a long transcript when only specific information is needed.",
|
|
472
|
+
execute: (input, context) =>
|
|
473
473
|
safe(
|
|
474
474
|
Effect.gen(function* readThread() {
|
|
475
475
|
const messages = yield* ctx.session.context({
|
|
@@ -493,7 +493,14 @@ export namespace SessionCommunication {
|
|
|
493
493
|
"Transcript:",
|
|
494
494
|
transcript.slice(-80_000),
|
|
495
495
|
].join("\n\n");
|
|
496
|
-
const
|
|
496
|
+
const current = yield* ctx.session.get({
|
|
497
|
+
sessionID: context.sessionID,
|
|
498
|
+
});
|
|
499
|
+
const reference =
|
|
500
|
+
options.thread_summary ??
|
|
501
|
+
(current.model
|
|
502
|
+
? `${current.model.providerID}/${current.model.id}${current.model.variant ? `#${current.model.variant}` : ""}`
|
|
503
|
+
: defaultReaderModel);
|
|
497
504
|
const ref = Model.Ref.parse(reference);
|
|
498
505
|
if (ref.providerID !== "opencode-go") {
|
|
499
506
|
const result = yield* ctx.generate.text({
|