@cabane/companion 0.5.0 → 0.6.0
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 +2 -2
- package/dist/cli.js +1667 -570
- package/dist/pairing-config.js +38 -33
- package/dist/runtime.js +1547 -477
- package/dist/static/app.js +22 -19
- package/dist/static/index.html +6 -6
- package/dist/static/styles.css +1 -1
- package/package.json +2 -3
package/dist/static/app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Cabane
|
|
1
|
+
// Cabane Companion dashboard frontend. Vanilla JS, no build step.
|
|
2
2
|
// Subscribes to /api/events (SSE) for live updates and falls back to REST
|
|
3
3
|
// fetches for the initial paint + the available-workspaces list.
|
|
4
4
|
|
|
@@ -13,7 +13,7 @@ const state = {
|
|
|
13
13
|
dispatches: [], // newest-first wire records
|
|
14
14
|
expanded: new Set(), // dispatch ids whose detail is open
|
|
15
15
|
logsOpen: false,
|
|
16
|
-
online: true, // is the
|
|
16
|
+
online: true, // is the companion process reachable (SSE up)?
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
// ---- tiny fetch helpers ----
|
|
@@ -69,10 +69,10 @@ function hostOf(url) {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
// Freshness for the status dots. a connected, idle
|
|
72
|
+
// Freshness for the status dots. a connected, idle companion is healthy,
|
|
73
73
|
// not a warning — so connected = green, full stop. red = offline / not
|
|
74
74
|
// connected to cabane. amber stays defined (in CSS) for a future genuinely-
|
|
75
|
-
// degraded signal, but we don't downgrade a quiet-but-connected
|
|
75
|
+
// degraded signal, but we don't downgrade a quiet-but-connected companion to it.
|
|
76
76
|
function freshness(connected) {
|
|
77
77
|
if (!state.online || !connected) return 'red';
|
|
78
78
|
return 'green';
|
|
@@ -172,39 +172,42 @@ function renderStatus() {
|
|
|
172
172
|
const title = $('status-title');
|
|
173
173
|
if (!state.online) {
|
|
174
174
|
dot.className = 'dot dot--red';
|
|
175
|
-
title.textContent = 'Cabane
|
|
176
|
-
$('conn-line').textContent =
|
|
175
|
+
title.textContent = 'Cabane Companion — Offline';
|
|
176
|
+
$('conn-line').textContent =
|
|
177
|
+
'Companion process not reachable. Re-run `cabane-companion start`.';
|
|
177
178
|
$('listen-line').textContent = '';
|
|
178
|
-
document.title = '⚠
|
|
179
|
+
document.title = '⚠ Companion — Offline';
|
|
179
180
|
return;
|
|
180
181
|
}
|
|
181
182
|
if (!s) return;
|
|
182
183
|
const overall = freshness(s.connected);
|
|
183
184
|
dot.className = `dot dot--${overall}`;
|
|
184
185
|
const listening = s.connected;
|
|
185
|
-
title.textContent = listening
|
|
186
|
-
|
|
186
|
+
title.textContent = listening
|
|
187
|
+
? 'Cabane Companion — Listening'
|
|
188
|
+
: 'Cabane Companion — Disconnected';
|
|
189
|
+
document.title = listening ? '● Companion — Listening' : '⚠ Companion — Disconnected';
|
|
187
190
|
|
|
188
191
|
const cabaneHost = hostOf(s.cabane_url) || 'cabane';
|
|
189
192
|
if (s.connected) {
|
|
190
193
|
$('conn-line').textContent = `Connected to ${cabaneHost}`;
|
|
191
194
|
} else {
|
|
192
|
-
// this branch means the
|
|
193
|
-
// it) but the
|
|
194
|
-
// the app is unreachable. Point at the
|
|
195
|
+
// this branch means the companion process is up (the dashboard reached
|
|
196
|
+
// it) but the companion's own event stream to cabane is down — NOT that cabane
|
|
197
|
+
// the app is unreachable. Point at the companion connection so the copy isn't
|
|
195
198
|
// misleading. The stream auto-retries; `cabane-companion start` is the remedy
|
|
196
199
|
// if the process was never (re)started.
|
|
197
200
|
const last = s.last_event_at_overall
|
|
198
201
|
? ` — last connected ${timeAgo(s.last_event_at_overall)}`
|
|
199
202
|
: '';
|
|
200
203
|
$('conn-line').textContent =
|
|
201
|
-
`⚠
|
|
204
|
+
`⚠ Companion isn't connected to ${cabaneHost}${last}. Make sure \`cabane-companion start\` is running.`;
|
|
202
205
|
}
|
|
203
206
|
$('listen-line').textContent = listening
|
|
204
207
|
? `Listening — last event ${timeAgo(s.last_event_at_overall)}`
|
|
205
208
|
: 'Not connected to any workspace stream.';
|
|
206
209
|
|
|
207
|
-
$('ver-
|
|
210
|
+
$('ver-companion').textContent = s.companion_version || '—';
|
|
208
211
|
}
|
|
209
212
|
|
|
210
213
|
function renderConnected() {
|
|
@@ -237,7 +240,7 @@ function renderConnected() {
|
|
|
237
240
|
}
|
|
238
241
|
const spacer = el('span', 'spacer');
|
|
239
242
|
|
|
240
|
-
// read-only — assignment lives in the cabane app. The
|
|
243
|
+
// read-only — assignment lives in the cabane app. The companion pulls which
|
|
241
244
|
// agents to run; this view just observes them.
|
|
242
245
|
li.append(dot, name, meta, spacer);
|
|
243
246
|
|
|
@@ -361,8 +364,8 @@ function toast(msg, isError) {
|
|
|
361
364
|
async function control(action) {
|
|
362
365
|
try {
|
|
363
366
|
await postJSON('/api/control', { action });
|
|
364
|
-
if (action === 'stop') toast('Stopping the
|
|
365
|
-
if (action === 'restart') toast('Restarting the
|
|
367
|
+
if (action === 'stop') toast('Stopping the companion…');
|
|
368
|
+
if (action === 'restart') toast('Restarting the companion…');
|
|
366
369
|
if (action === 'reload-config') toast('Reloaded config.');
|
|
367
370
|
} catch (err) {
|
|
368
371
|
toast(err.message || 'control failed', true);
|
|
@@ -492,7 +495,7 @@ function connectSSE() {
|
|
|
492
495
|
// status:changed re-renders, so no extra handling is needed here.
|
|
493
496
|
|
|
494
497
|
es.onerror = () => {
|
|
495
|
-
// EventSource auto-reconnects; if the
|
|
498
|
+
// EventSource auto-reconnects; if the companion is actually gone the retries
|
|
496
499
|
// keep failing and we show the offline state. readyState 2 = closed.
|
|
497
500
|
if (es.readyState === EventSource.CLOSED || es.readyState === EventSource.CONNECTING) {
|
|
498
501
|
state.online = false;
|
|
@@ -544,7 +547,7 @@ function wireControls() {
|
|
|
544
547
|
});
|
|
545
548
|
}
|
|
546
549
|
$('stop-btn').addEventListener('click', () => {
|
|
547
|
-
if (window.confirm('Stop the
|
|
550
|
+
if (window.confirm('Stop the companion? Replies will stop until you run it again.')) {
|
|
548
551
|
void control('stop');
|
|
549
552
|
}
|
|
550
553
|
});
|
package/dist/static/index.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<title>Cabane
|
|
6
|
+
<title>Cabane Companion</title>
|
|
7
7
|
<link rel="stylesheet" href="/static/styles.css" />
|
|
8
8
|
<!-- the Cabane app-icon — ink tile, ember A-frame mark. Reads on a
|
|
9
9
|
light or dark browser tab. -->
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<path d="M 12 1.26 L 22.74 16.74" stroke="currentColor" stroke-width="2.52" stroke-linecap="round" />
|
|
22
22
|
</svg>
|
|
23
23
|
<span id="status-dot" class="dot dot--unknown" aria-hidden="true"></span>
|
|
24
|
-
<h1 id="status-title">Cabane
|
|
24
|
+
<h1 id="status-title">Cabane Companion</h1>
|
|
25
25
|
</div>
|
|
26
26
|
<p id="conn-line" class="conn-line">Connecting…</p>
|
|
27
27
|
<p id="listen-line" class="listen-line"></p>
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
<h2>Connected workspaces <span id="connected-count" class="count"></span></h2>
|
|
53
53
|
<ul id="connected-list" class="ws-list"></ul>
|
|
54
54
|
<p id="connected-empty" class="empty" hidden>
|
|
55
|
-
No workspaces enrolled yet. Connect a
|
|
56
|
-
(Workspace Settings → Agents →
|
|
55
|
+
No workspaces enrolled yet. Connect a companion in the cabane app
|
|
56
|
+
(Workspace Settings → Agents → Companions), then run
|
|
57
57
|
<code>cabane-companion add</code> and paste the string when prompted.
|
|
58
58
|
</p>
|
|
59
59
|
</section>
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
</footer>
|
|
75
75
|
|
|
76
76
|
<section class="panel collapsible" id="logs-panel" hidden>
|
|
77
|
-
<h2>Logs <span class="hint">~/.cabane/
|
|
77
|
+
<h2>Logs <span class="hint">~/.cabane/companion.log</span></h2>
|
|
78
78
|
<pre id="logs-view" class="logs">Loading…</pre>
|
|
79
79
|
</section>
|
|
80
80
|
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
</section>
|
|
107
107
|
|
|
108
108
|
<p class="version">
|
|
109
|
-
|
|
109
|
+
companion <span id="ver-companion">—</span>
|
|
110
110
|
</p>
|
|
111
111
|
</main>
|
|
112
112
|
|
package/dist/static/styles.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cabane/companion",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The Cabane Companion (headless): connect a coding agent on your machine to your Cabane workspace as a responder — drive work against your own codebase, files, and MCP servers without putting any of it in Cabane.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
12
|
"bin": {
|
|
13
|
-
"cabane-companion": "./dist/cli.js"
|
|
14
|
-
"cabane-bridge": "./dist/cli.js"
|
|
13
|
+
"cabane-companion": "./dist/cli.js"
|
|
15
14
|
},
|
|
16
15
|
"main": "./dist/cli.js",
|
|
17
16
|
"files": [
|