pantheon-opencode 1.6.0-beta.8 → 1.6.0-beta.9

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.
@@ -0,0 +1,151 @@
1
+ import { createComponent, createElement, createTextNode, effect, insert, insertNode, setProp } from "@opentui/solid";
2
+ import { For, Show, createMemo, createSignal, onCleanup, onMount } from "solid-js";
3
+ import { Plugin } from "@opencode/plugin/tui";
4
+ //#region src/index-v2.tsx
5
+ /** @jsxImportSource @opentui/solid */
6
+ const SINGLETON = Symbol.for("pantheon.tui.v2.loaded");
7
+ function Sidebar(props) {
8
+ const { context } = props;
9
+ const [revision, setRevision] = createSignal(0);
10
+ const location = context.location ?? context.data.location.default();
11
+ const session = createMemo(() => {
12
+ revision();
13
+ return props.sessionID ? context.data.session.get(props.sessionID) : void 0;
14
+ });
15
+ const branch = createMemo(() => {
16
+ revision();
17
+ return context.data.location.vcs.info(location)?.branch?.current ?? null;
18
+ });
19
+ const delegations = createMemo(() => {
20
+ revision();
21
+ const id = props.sessionID;
22
+ if (!id) return [];
23
+ return (context.data.session.family(id) ?? []).filter((childID) => childID !== id).map((childID) => context.data.session.get(childID)).filter((child) => child?.parentID === id).slice(0, 6);
24
+ });
25
+ onMount(() => {
26
+ const stop = [];
27
+ for (const type of [
28
+ "session.created",
29
+ "session.updated",
30
+ "session.status",
31
+ "session.deleted"
32
+ ]) try {
33
+ stop.push(context.data.on(type, () => setRevision((value) => value + 1)));
34
+ } catch {}
35
+ if (props.sessionID) context.data.session.sync(props.sessionID).then(() => setRevision((value) => value + 1));
36
+ context.data.location.vcs.sync(location).then(() => setRevision((value) => value + 1));
37
+ onCleanup(() => {
38
+ for (const unsubscribe of stop) unsubscribe();
39
+ });
40
+ });
41
+ const text = () => context.theme.text?.base;
42
+ const muted = () => context.theme.text?.muted ?? text();
43
+ return (() => {
44
+ var _el$ = createElement("box"), _el$2 = createElement("text"), _el$3 = createElement("text");
45
+ insertNode(_el$, _el$2);
46
+ insertNode(_el$, _el$3);
47
+ setProp(_el$, "flexDirection", "column");
48
+ setProp(_el$, "width", "100%");
49
+ setProp(_el$, "padding", 1);
50
+ setProp(_el$2, "attributes", 1);
51
+ insert(_el$2, `Pantheon v1.6.0-beta.9`);
52
+ insertNode(_el$3, createTextNode(`OpenCode V2 · plugin TUI ativo`));
53
+ insert(_el$, createComponent(Show, {
54
+ get when() {
55
+ return branch();
56
+ },
57
+ children: (value) => (() => {
58
+ var _el$7 = createElement("text");
59
+ insert(_el$7, () => `Branch: ${value()}`);
60
+ effect((_$p) => setProp(_el$7, "fg", muted(), _$p));
61
+ return _el$7;
62
+ })()
63
+ }), null);
64
+ insert(_el$, createComponent(Show, {
65
+ get when() {
66
+ return session();
67
+ },
68
+ get fallback() {
69
+ return (() => {
70
+ var _el$8 = createElement("text");
71
+ insertNode(_el$8, createTextNode(`Nenhuma sessão selecionada`));
72
+ effect((_$p) => setProp(_el$8, "fg", muted(), _$p));
73
+ return _el$8;
74
+ })();
75
+ },
76
+ children: (current) => [(() => {
77
+ var _el$0 = createElement("text");
78
+ insert(_el$0, () => `Sessão: ${current().title || current().id}`);
79
+ effect((_$p) => setProp(_el$0, "fg", text(), _$p));
80
+ return _el$0;
81
+ })(), createComponent(Show, {
82
+ get when() {
83
+ return current().agent;
84
+ },
85
+ get children() {
86
+ var _el$1 = createElement("text");
87
+ insert(_el$1, () => `Agente: ${current().agent}`);
88
+ effect((_$p) => setProp(_el$1, "fg", muted(), _$p));
89
+ return _el$1;
90
+ }
91
+ })]
92
+ }), null);
93
+ insert(_el$, createComponent(Show, {
94
+ get when() {
95
+ return delegations().length > 0;
96
+ },
97
+ get children() {
98
+ return [(() => {
99
+ var _el$5 = createElement("text");
100
+ insertNode(_el$5, createTextNode(`Delegações`));
101
+ setProp(_el$5, "attributes", 1);
102
+ effect((_$p) => setProp(_el$5, "fg", text(), _$p));
103
+ return _el$5;
104
+ })(), createComponent(For, {
105
+ get each() {
106
+ return delegations();
107
+ },
108
+ children: (child) => (() => {
109
+ var _el$10 = createElement("text");
110
+ insert(_el$10, () => `· ${child.title || child.id}`);
111
+ effect((_$p) => setProp(_el$10, "fg", muted(), _$p));
112
+ return _el$10;
113
+ })()
114
+ })];
115
+ }
116
+ }), null);
117
+ effect((_p$) => {
118
+ var _v$ = text(), _v$2 = muted();
119
+ _v$ !== _p$.e && (_p$.e = setProp(_el$2, "fg", _v$, _p$.e));
120
+ _v$2 !== _p$.t && (_p$.t = setProp(_el$3, "fg", _v$2, _p$.t));
121
+ return _p$;
122
+ }, {
123
+ e: void 0,
124
+ t: void 0
125
+ });
126
+ return _el$;
127
+ })();
128
+ }
129
+ const plugin = Plugin.define({
130
+ id: "pantheon.tui",
131
+ setup(context) {
132
+ const globalState = globalThis;
133
+ if (globalState[SINGLETON]) return;
134
+ globalState[SINGLETON] = true;
135
+ const unregister = context.ui.slot({
136
+ append: "sidebar.content",
137
+ render: ({ sessionID }) => createComponent(Sidebar, {
138
+ context,
139
+ sessionID
140
+ })
141
+ });
142
+ return () => {
143
+ if (typeof unregister === "function") unregister();
144
+ delete globalState[SINGLETON];
145
+ };
146
+ }
147
+ });
148
+ //#endregion
149
+ export { plugin as default };
150
+
151
+ //# sourceMappingURL=tui-v2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tui-v2.js","names":[],"sources":[],"mappings":""}
@@ -10,9 +10,9 @@ import { For, Show, createMemo, createResource, createSignal, onCleanup, onMount
10
10
  /**
11
11
  * pantheon-tui — Pantheon TUI plugin for opencode.
12
12
  *
13
- * Bundled entry: `tsdown` emits `dist/tui.js`, and the package `exports`
14
- * (`./tui` → ./dist/tui.js, `./server` → ./dist/server.js) is the ONLY load
15
- * path — no raw TSX copy is shipped. Because the bundle inlines relative
13
+ * V1 bundle: `tsdown` emits `dist/tui.js`, re-exported by root `tui.ts`.
14
+ * OpenCode V2 uses the separate `src/index-v2.tsx` entry and native CLI plugin
15
+ * API. No raw TSX implementation is shipped. Because the bundle inlines relative
16
16
  * imports, this entry may be split into modules without breaking the loader.
17
17
  *
18
18
  * Slots:
@@ -167,7 +167,7 @@ async function detectVersion(api) {
167
167
  if (ver) return ver;
168
168
  }
169
169
  } catch {}
170
- return "1.6.0-beta.8";
170
+ return "1.6.0-beta.9";
171
171
  }
172
172
  /**
173
173
  * usage-bar — AI subscription usage gauge for the opencode TUI.
@@ -0,0 +1,6 @@
1
+ import { Plugin } from '@opencode/plugin'
2
+
3
+ export default Plugin.define({
4
+ id: 'pantheon.tui.server',
5
+ setup() {},
6
+ })