@rrr2010/opencode-roundtable 0.3.0 → 0.3.2

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/package.json CHANGED
@@ -1,61 +1,60 @@
1
- {
2
- "name": "@rrr2010/opencode-roundtable",
3
- "version": "0.3.0",
4
- "description": "Multi-agent round-robin debate plugin for OpenCode",
5
- "type": "module",
6
- "main": "./dist/index.js",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "import": "./dist/index.js",
12
- "require": "./dist/index.js",
13
- "types": "./dist/index.d.ts"
14
- },
15
- "./tui": {
16
- "import": "./src/tui/tui.tsx",
17
- "types": "./src/tui/tui.tsx"
18
- }
19
- },
20
- "files": [
21
- "dist",
22
- "src/tui/",
23
- "README.md",
24
- "docs/SPEC.md",
25
- "docs/roundtable.schema.json",
26
- "LICENSE"
27
- ],
28
- "scripts": {
29
- "build": "bun build index.ts --outdir dist --target node --format esm --sourcemap --external @opencode-ai/plugin --external @opencode-ai/sdk",
30
- "typecheck": "tsc --noEmit",
31
- "prepublishOnly": "bun run build",
32
- "dev:install": "bun run build && npm link"
33
- },
34
- "keywords": [
35
- "opencode",
36
- "plugin",
37
- "multi-agent",
38
- "debate",
39
- "roundtable"
40
- ],
41
- "license": "MIT",
42
- "repository": {
43
- "type": "git",
44
- "url": "git+https://github.com/opencode-ai/roundtable.git"
45
- },
46
- "homepage": "https://github.com/opencode-ai/roundtable#readme",
47
- "bugs": {
48
- "url": "https://github.com/opencode-ai/roundtable/issues"
49
- },
50
- "peerDependencies": {
51
- "@opencode-ai/plugin": "latest",
52
- "@opentui/core": "^0.4.2",
53
- "@opentui/solid": "^0.4.2",
54
- "solid-js": "^1.9.12"
55
- },
56
- "devDependencies": {
57
- "@opencode-ai/plugin": "latest",
58
- "@types/bun": "^1.3.0",
59
- "typescript": "^5.7.0"
60
- }
61
- }
1
+ {
2
+ "name": "@rrr2010/opencode-roundtable",
3
+ "version": "0.3.2",
4
+ "description": "Multi-agent round-robin debate plugin for OpenCode",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.js",
13
+ "types": "./dist/index.d.ts"
14
+ },
15
+ "./tui": {
16
+ "import": "./src/tui/tui.tsx",
17
+ "types": "./src/tui/tui.tsx"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "src/tui/",
23
+ "README.md",
24
+ "docs/SPEC.md",
25
+ "docs/roundtable.schema.json",
26
+ "LICENSE"
27
+ ],
28
+ "scripts": {
29
+ "build": "bun build index.ts --outdir dist --target node --format esm --sourcemap --external @opencode-ai/plugin --external @opencode-ai/sdk",
30
+ "typecheck": "tsc --noEmit",
31
+ "prepublishOnly": "bun run build",
32
+ "dev:install": "bun run build && npm link"
33
+ },
34
+ "keywords": [
35
+ "opencode",
36
+ "plugin",
37
+ "multi-agent",
38
+ "debate",
39
+ "roundtable"
40
+ ],
41
+ "license": "MIT",
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+https://github.com/opencode-ai/roundtable.git"
45
+ },
46
+ "homepage": "https://github.com/opencode-ai/roundtable#readme",
47
+ "bugs": {
48
+ "url": "https://github.com/opencode-ai/roundtable/issues"
49
+ },
50
+ "peerDependencies": {
51
+ "@opencode-ai/plugin": "latest",
52
+ "@opentui/core": "^0.4.2",
53
+ "@opentui/solid": "^0.4.2",
54
+ "solid-js": "^1.9.12"
55
+ },
56
+ "devDependencies": {
57
+ "@opencode-ai/plugin": "latest",
58
+ "typescript": "^5.7.0"
59
+ }
60
+ }
package/src/tui/tui.tsx CHANGED
@@ -1,99 +1,89 @@
1
- /** @jsxImportSource @opentui/solid */
2
-
3
- import type { TuiPluginModule, TuiPluginApi } from "@opencode-ai/plugin/tui"
4
- import { createResource } from "solid-js"
5
-
6
- let api: TuiPluginApi
7
-
8
- function Badge(props: { title: string }) {
9
- const match = () => props.title.match(/^\(Roundtable\) - (.+?)(?: · CONCLUDED)?$/)
10
- if (!match()) return null
11
- const label = match()![1]
12
- const isConcluded = props.title.includes("· CONCLUDED")
13
- return (
14
- <span>
15
- {" "}
16
- <span
17
- style={{
18
- color: isConcluded ? "var(--text-muted)" : "var(--accent)",
19
- fontWeight: "bold",
20
- }}
21
- >
22
- RT
23
- </span>
24
- <span style={{ color: "var(--text-muted)", fontSize: "0.9em" }}>
25
- {" "}{label.length > 30 ? label.slice(0, 27) + "..." : label}
26
- </span>
27
- </span>
28
- )
29
- }
30
-
31
- function LinkPanel(props: { sessionId: string }) {
32
- const [session] = createResource(
33
- () => props.sessionId,
34
- async (id: string) => {
35
- try {
36
- return await api.client.session.get({ path: { id } })
37
- } catch {
38
- return null
39
- }
40
- },
41
- )
42
-
43
- const isRoundtable = () => {
44
- const s = session()
45
- return s?.data?.title?.startsWith("(Roundtable)")
46
- }
47
-
48
- const parentId = () => {
49
- const s = session()
50
- return s?.data?.parent_session_id
51
- }
52
-
53
- return (
54
- <div style={{ padding: "0 8px" }}>
55
- {isRoundtable() && parentId() && (
56
- <div
57
- style={{
58
- cursor: "pointer",
59
- color: "var(--accent)",
60
- textDecoration: "underline",
61
- fontSize: "0.9em",
62
- }}
63
- onClick={() => api.route.navigate("session", { sessionID: parentId()! })}
64
- >
65
- Parent session
66
- </div>
67
- )}
68
- {!isRoundtable() && (
69
- <div
70
- style={{
71
- cursor: "pointer",
72
- color: "var(--accent)",
73
- textDecoration: "underline",
74
- fontSize: "0.9em",
75
- }}
76
- onClick={() => api.route.navigate("sessions")}
77
- >
78
- View sessions →
79
- </div>
80
- )}
81
- </div>
82
- )
83
- }
84
-
85
- const tui: TuiPluginModule["tui"] = async (a) => {
86
- api = a
87
-
88
- api.slots.register({
89
- sidebar_title: (props) => <Badge title={props.title} />,
90
- sidebar_content: (props) => <LinkPanel sessionId={props.session_id} />,
91
- })
92
-
93
- api.lifecycle.onDispose(() => {})
94
- }
95
-
96
- export default {
97
- id: "opencode-roundtable",
98
- tui,
99
- } satisfies TuiPluginModule
1
+ /** @jsxImportSource @opentui/solid */
2
+
3
+ import type { TuiPluginModule, TuiPluginApi } from "@opencode-ai/plugin/tui"
4
+
5
+ let api: TuiPluginApi
6
+
7
+ function Badge(props: { title: string }) {
8
+ if (!props.title?.startsWith("⚡")) return null
9
+ return <text>[RT]</text>
10
+ }
11
+
12
+ function LinkPanel(props: { sessionId: string }) {
13
+ const session = api.state.session.get(props.sessionId)
14
+ if (session?.parentID) {
15
+ return (
16
+ <a on:click={() => api.route.navigate("session", { sessionID: session.parentID! })}>
17
+ ← Back
18
+ </a>
19
+ )
20
+ }
21
+ return null
22
+ }
23
+
24
+ async function showRoundtables() {
25
+ try {
26
+ const res = await api.client.session.list()
27
+ const sessions = res.data ?? []
28
+ const rts = sessions.filter((s: { title?: string }) => s.title?.startsWith("⚡"))
29
+ if (rts.length === 0) {
30
+ api.ui.toast({ message: "No active roundtables", variant: "info" })
31
+ return
32
+ }
33
+
34
+ api.ui.dialog.replace(() => (
35
+ <box padding={1} flexDirection="column">
36
+ <text bold>Roundtables</text>
37
+ {rts.map((s: { id: string; title: string }) => (
38
+ <box
39
+ flexDirection="row"
40
+ paddingTop={1}
41
+ onMouseUp={() => {
42
+ api.ui.dialog.clear()
43
+ api.route.navigate("session", { sessionID: s.id })
44
+ }}
45
+ >
46
+ <box
47
+ paddingLeft={1}
48
+ paddingRight={1}
49
+ backgroundColor={api.theme.current.backgroundElement}
50
+ >
51
+ <text>→</text>
52
+ </box>
53
+ <box paddingLeft={1}>
54
+ <text>{s.title.replace(/^⚡ /, "")}</text>
55
+ </box>
56
+ </box>
57
+ ))}
58
+ </box>
59
+ ))
60
+ } catch {
61
+ api.ui.toast({ message: "Could not list sessions", variant: "error" })
62
+ }
63
+ }
64
+
65
+ const tui: TuiPluginModule["tui"] = async (a) => {
66
+ api = a
67
+
68
+ api.command?.register(() => [
69
+ {
70
+ title: "Roundtables",
71
+ value: "roundtables.list",
72
+ description: "List active roundtable sessions",
73
+ slash: { name: "roundtables" },
74
+ onSelect: () => showRoundtables(),
75
+ },
76
+ ])
77
+
78
+ api.slots.register({
79
+ slots: {
80
+ sidebar_title: (_ctx, props) => <Badge title={props.title} />,
81
+ sidebar_content: (_ctx, props) => <LinkPanel sessionId={props.session_id} />,
82
+ },
83
+ })
84
+ }
85
+
86
+ export default {
87
+ id: "opencode-roundtable",
88
+ tui,
89
+ } satisfies TuiPluginModule