@justsilver/opencode-team 0.2.2-beta.1 → 0.2.2-beta.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/CHANGELOG.md CHANGED
@@ -7,6 +7,24 @@
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.2-beta.3] - 2026-11-18
11
+
12
+ ### Changed
13
+
14
+ - 角色提示词改以 `plugin/opencode-team/prompts/*.md` 为唯一来源:Frontmatter 的 `description`
15
+ 作为 Agent 描述、正文作为 System Prompt,构建阶段生成 `prompts.generated.ts`;
16
+ `npm run check:prompts`(CI 与 `prepack`)阻止生成物与 Markdown 漂移。提示词内容、
17
+ Agent 职责、权限与模型策略未变。
18
+
19
+ ## [0.2.2-beta.2] - 2026-11-18
20
+
21
+ ### Fixed
22
+
23
+ - TUI 入口改为发布预编译的 `dist/tui.js`:npm 插件位于 `node_modules`,宿主不会转换该路径下的
24
+ `.tsx`(anomalyco/opencode#39986),此前会出现面板首帧后不再重绘,或直接报找不到
25
+ `@opentui/solid`。
26
+ - `@opentui/*` 与 `solid-js` 恢复为 optional peerDependencies,避免 npm 安装与宿主并存的第二套运行时。
27
+
10
28
  ## [0.2.2-beta.1] - 2026-11-18
11
29
 
12
30
  ### Changed
@@ -0,0 +1,27 @@
1
+ // 模型 ID 本身可能包含 /,因此只在第一个 / 分隔供应商。
2
+ export function parseModelRef(input) {
3
+ const providerEnd = input.indexOf("/");
4
+ if (providerEnd <= 0) return undefined;
5
+ const variantStart = input.indexOf("#", providerEnd + 1);
6
+ const providerID = input.slice(0, providerEnd);
7
+ const id = input.slice(providerEnd + 1, variantStart === -1 ? undefined : variantStart);
8
+ const variant = variantStart === -1 ? undefined : input.slice(variantStart + 1);
9
+ if (!id || providerID.includes("#") || variant !== undefined && (!variant || variant.includes("#"))) {
10
+ return undefined;
11
+ }
12
+ return {
13
+ providerID,
14
+ id,
15
+ ...(variant === undefined ? {} : {
16
+ variant
17
+ })
18
+ };
19
+ }
20
+ export function formatModelRef(ref) {
21
+ return `${ref.providerID}/${ref.id}${ref.variant === undefined ? "" : `#${ref.variant}`}`;
22
+ }
23
+
24
+ /** 与宿主一致:未声明 type 的模型按 chat 处理。 */
25
+ export function isChatModel(model) {
26
+ return model.type === undefined || model.type === "chat";
27
+ }
package/dist/rpc.js ADDED
@@ -0,0 +1,104 @@
1
+ const emptyInput = {
2
+ type: "object",
3
+ properties: {},
4
+ additionalProperties: false
5
+ };
6
+ const agentModels = {
7
+ type: "object",
8
+ additionalProperties: {
9
+ type: "string"
10
+ }
11
+ };
12
+ const conflict = {
13
+ type: "object",
14
+ properties: {
15
+ pluginID: {
16
+ type: "string"
17
+ },
18
+ source: {
19
+ type: "string"
20
+ }
21
+ },
22
+ required: ["pluginID"],
23
+ additionalProperties: false
24
+ };
25
+ const migration = {
26
+ type: "object",
27
+ properties: {
28
+ from: {
29
+ type: "string"
30
+ },
31
+ status: {
32
+ type: "string"
33
+ },
34
+ agents: {
35
+ type: "array",
36
+ items: {
37
+ type: "string"
38
+ }
39
+ },
40
+ errors: {
41
+ type: "array",
42
+ items: {
43
+ type: "string"
44
+ }
45
+ }
46
+ },
47
+ required: ["from", "status"],
48
+ additionalProperties: false
49
+ };
50
+ const stateOutput = {
51
+ type: "object",
52
+ properties: {
53
+ ok: {
54
+ type: "boolean"
55
+ },
56
+ supported: {
57
+ type: "boolean"
58
+ },
59
+ agentsSupported: {
60
+ type: "boolean"
61
+ },
62
+ agentsError: {
63
+ type: "string"
64
+ },
65
+ models: agentModels,
66
+ errors: {
67
+ type: "array",
68
+ items: {
69
+ type: "string"
70
+ }
71
+ },
72
+ conflict,
73
+ migration
74
+ },
75
+ required: ["ok", "supported"],
76
+ additionalProperties: false
77
+ };
78
+ export const teamRpc = {
79
+ id: "opencode-team",
80
+ methods: {
81
+ getTeamPolicy: {
82
+ input: emptyInput,
83
+ output: stateOutput
84
+ },
85
+ setAgentModel: {
86
+ input: {
87
+ type: "object",
88
+ properties: {
89
+ agentID: {
90
+ type: "string",
91
+ minLength: 1
92
+ },
93
+ model: {
94
+ type: ["string", "null"]
95
+ }
96
+ },
97
+ required: ["agentID", "model"],
98
+ additionalProperties: false
99
+ },
100
+ output: stateOutput
101
+ }
102
+ },
103
+ events: {}
104
+ };
@@ -0,0 +1,2 @@
1
+ /** 团队成员与内置子代理的固定顺序;server 与 TUI 共用。 */
2
+ export const TEAM_SUBAGENT_IDS = ["general", "explore", "qa", "reviewer"];
package/dist/tui.js ADDED
@@ -0,0 +1,21 @@
1
+ import { Plugin } from "@opencode/plugin/tui";
2
+ import { teamRpc } from "./rpc.js";
3
+ import { configureTeam } from "./view/configure.js";
4
+ export default Plugin.define({
5
+ id: teamRpc.id,
6
+ setup(context) {
7
+ context.keymap.layer(() => ({
8
+ mode: "global",
9
+ commands: [{
10
+ id: `${teamRpc.id}.configure`,
11
+ title: "Agent 团队与模型",
12
+ group: "Model",
13
+ slash: {
14
+ name: "team"
15
+ },
16
+ palette: true,
17
+ run: () => configureTeam(context)
18
+ }]
19
+ }));
20
+ }
21
+ });
@@ -0,0 +1,77 @@
1
+ import { createComponent as _$createComponent } from "@opentui/solid";
2
+ import { mergeProps as _$mergeProps } from "@opentui/solid";
3
+ /** @jsxImportSource @opentui/solid */
4
+
5
+ import { TeamDashboard } from "./dashboard.js";
6
+ import { currentLocation, loadTeamDashboard, refreshModels, restoreAgentModel, saveAgentModel } from "./team.js";
7
+
8
+ // A second /team while a model picker is open replaces the first flow; the old continuation
9
+ // must not reopen its dashboard on top of the newer one.
10
+ let latest = 0;
11
+ export async function configureTeam(ctx) {
12
+ const token = ++latest;
13
+ const location = currentLocation(ctx);
14
+ const result = await loadTeamDashboard(ctx, location);
15
+ if (token !== latest) return;
16
+ if (result.kind === "blocked") {
17
+ ctx.ui.toast.show({
18
+ variant: "error",
19
+ message: result.message
20
+ });
21
+ return;
22
+ }
23
+ const data = result.data;
24
+ let overrides = data.overrides;
25
+ let closed = false;
26
+ const open = () => {
27
+ if (token !== latest || closed) return;
28
+ ctx.ui.dialog.show(() => _$createComponent(TeamDashboard, _$mergeProps({
29
+ get agents() {
30
+ return data.agents;
31
+ },
32
+ overrides: overrides,
33
+ get models() {
34
+ return data.models;
35
+ },
36
+ get providers() {
37
+ return data.providers;
38
+ }
39
+ }, () => data.modelError === undefined ? {} : {
40
+ modelError: data.modelError
41
+ }, () => data.warning === undefined ? {} : {
42
+ warning: data.warning
43
+ }, {
44
+ get agentsSupported() {
45
+ return data.agentsSupported;
46
+ }
47
+ }, () => data.agentsError === undefined ? {} : {
48
+ agentsError: data.agentsError
49
+ }, {
50
+ refreshModels: () => refreshModels(ctx, location),
51
+ get theme() {
52
+ return ctx.theme;
53
+ },
54
+ layer: factory => ctx.keymap.layer(factory),
55
+ clearDialog: () => ctx.ui.dialog.clear(),
56
+ saveModel: async (agent, model) => {
57
+ const saved = await saveAgentModel(ctx, location, agent, model);
58
+ if (saved.saved && saved.models !== undefined) overrides = saved.models;
59
+ return saved;
60
+ },
61
+ restoreModel: async agent => {
62
+ const restored = await restoreAgentModel(ctx, location, agent);
63
+ if (restored.saved && restored.models !== undefined) overrides = restored.models;
64
+ return restored;
65
+ },
66
+ close: () => {
67
+ closed = true;
68
+ }
69
+ })), () => {});
70
+ // show() resets the dialog to medium; set the dashboard presentation after it is mounted.
71
+ ctx.ui.dialog.set({
72
+ size: "xlarge",
73
+ centered: true
74
+ });
75
+ };
76
+ open();
77
+ }