great-cto 3.31.0 → 3.32.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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "great-cto",
|
|
3
3
|
"description": "You already have the agent. This is everything around it. great_cto runs Claude Code as a pipeline of 70 specialist agents \u2014 an independent model checks each stage before the next builds on it, spending caps refuse rather than warn, and three decisions stay yours: what gets built, how, and whether it ships.",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.32.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Alexander Velikiy",
|
|
7
7
|
"url": "https://hashnode.com/@Greatcto"
|
|
@@ -251,6 +251,11 @@
|
|
|
251
251
|
"command": "PLUGIN_DIR=${CLAUDE_PLUGIN_ROOT:-$(ls -d ~/.claude/plugins/cache/*/great_cto/*/ 2>/dev/null | sort -V | tail -1 | sed 's|/$||')}; node \"${PLUGIN_DIR}/scripts/hooks/session-end.mjs\" 2>/dev/null; true",
|
|
252
252
|
"timeout": 8,
|
|
253
253
|
"statusMessage": "Saving session summary..."
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"type": "command",
|
|
257
|
+
"command": "PLUGIN_DIR=${CLAUDE_PLUGIN_ROOT:-$(ls -d ~/.claude/plugins/cache/*/great_cto/*/ 2>/dev/null | sort -V | tail -1 | sed 's|/$||')}; node \"${PLUGIN_DIR}/scripts/hooks/session-status.mjs\" 2>/dev/null; true",
|
|
258
|
+
"timeout": 5
|
|
254
259
|
}
|
|
255
260
|
]
|
|
256
261
|
}
|
|
@@ -273,6 +278,11 @@
|
|
|
273
278
|
"type": "command",
|
|
274
279
|
"command": "[ -n \"$GREAT_CTO_CLASS_TELEMETRY\" ] && { PLUGIN_DIR=${CLAUDE_PLUGIN_ROOT:-$(ls -d ~/.claude/plugins/cache/*/great_cto/*/ 2>/dev/null | sort -V | tail -1 | sed 's|/$||')}; node \"${PLUGIN_DIR}/scripts/hooks/classify-telemetry.mjs\" 2>/dev/null; }; true",
|
|
275
280
|
"timeout": 3
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"type": "command",
|
|
284
|
+
"command": "PLUGIN_DIR=${CLAUDE_PLUGIN_ROOT:-$(ls -d ~/.claude/plugins/cache/*/great_cto/*/ 2>/dev/null | sort -V | tail -1 | sed 's|/$||')}; node \"${PLUGIN_DIR}/scripts/hooks/session-status.mjs\" 2>/dev/null; true",
|
|
285
|
+
"timeout": 5
|
|
276
286
|
}
|
|
277
287
|
]
|
|
278
288
|
}
|
|
@@ -309,6 +319,23 @@
|
|
|
309
319
|
"type": "command",
|
|
310
320
|
"async": true,
|
|
311
321
|
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/register-project.mjs\" 2>/dev/null || true"
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"type": "command",
|
|
325
|
+
"command": "PLUGIN_DIR=${CLAUDE_PLUGIN_ROOT:-$(ls -d ~/.claude/plugins/cache/*/great_cto/*/ 2>/dev/null | sort -V | tail -1 | sed 's|/$||')}; node \"${PLUGIN_DIR}/scripts/hooks/session-status.mjs\" 2>/dev/null; true",
|
|
326
|
+
"timeout": 5
|
|
327
|
+
}
|
|
328
|
+
]
|
|
329
|
+
}
|
|
330
|
+
],
|
|
331
|
+
"Notification": [
|
|
332
|
+
{
|
|
333
|
+
"matcher": "",
|
|
334
|
+
"hooks": [
|
|
335
|
+
{
|
|
336
|
+
"type": "command",
|
|
337
|
+
"command": "PLUGIN_DIR=${CLAUDE_PLUGIN_ROOT:-$(ls -d ~/.claude/plugins/cache/*/great_cto/*/ 2>/dev/null | sort -V | tail -1 | sed 's|/$||')}; node \"${PLUGIN_DIR}/scripts/hooks/session-status.mjs\" 2>/dev/null; true",
|
|
338
|
+
"timeout": 5
|
|
312
339
|
}
|
|
313
340
|
]
|
|
314
341
|
}
|
|
@@ -14,6 +14,7 @@ import { autoRegisterProject, listProjects, resolveProjectCwd, resolveProjectInf
|
|
|
14
14
|
import { readVerdictsWithHealth } from './verdicts.mjs';
|
|
15
15
|
import { agentUsage, usageSnapshot } from '../../../scripts/lib/agent-usage.mjs';
|
|
16
16
|
import { reviewerStatus } from '../../../scripts/lib/required-reviewers.mjs';
|
|
17
|
+
import { readSessionStatus } from '../../../scripts/lib/session-status.mjs';
|
|
17
18
|
import { readScores, summarizeScores } from '../../../scripts/lib/scores.mjs';
|
|
18
19
|
import { status as routerKeyStatus, writeKey as writeRouterKey, verifyKey as verifyRouterKey } from '../../../scripts/lib/router-key.mjs';
|
|
19
20
|
|
|
@@ -1470,6 +1471,15 @@ async function dispatch(req, res, url, cwd) {
|
|
|
1470
1471
|
|
|
1471
1472
|
// Domain reviewers this project's PROJECT.md requires (archetype, packs,
|
|
1472
1473
|
// compliance), each with whether a verdict exists — the list gate:ship refuses on.
|
|
1474
|
+
// Sessions in this project that wait for a person — written by the
|
|
1475
|
+
// Notification / Stop / UserPromptSubmit hooks (scripts/lib/session-status.mjs).
|
|
1476
|
+
if (pathname === '/api/session-status') {
|
|
1477
|
+
const c = url.searchParams.get('project') ? resolveProjectCwd(url.searchParams.get('project')) : cwd;
|
|
1478
|
+
res.writeHead(200, { 'Content-Type': 'application/json', 'Cache-Control': 'no-store' });
|
|
1479
|
+
res.end(JSON.stringify({ sessions: c ? readSessionStatus(c) : [] }));
|
|
1480
|
+
return true;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1473
1483
|
if (pathname === '/api/required-reviewers') {
|
|
1474
1484
|
const c = url.searchParams.get('project') ? resolveProjectCwd(url.searchParams.get('project')) : cwd;
|
|
1475
1485
|
res.writeHead(200, { 'Content-Type': 'application/json', 'Cache-Control': 'no-store' });
|
|
@@ -1696,6 +1696,15 @@ h1, h2, h3, h4 { font-weight: 600; font-family: var(--sans); }
|
|
|
1696
1696
|
.pl-stage.pl-compact .pl-name { color: var(--text2); }
|
|
1697
1697
|
.pl-stage.active { flex: 2; }
|
|
1698
1698
|
/* Idle-focus all-clear card (shown when nothing needs a decision). */
|
|
1699
|
+
/* A session stopped on a permission prompt or an unanswered wait — the one piece
|
|
1700
|
+
of session status the operator can act on, so it is styled like a decision. */
|
|
1701
|
+
.session-blocked {
|
|
1702
|
+
padding: 6px 10px;
|
|
1703
|
+
margin-bottom: 4px;
|
|
1704
|
+
border-left: 3px solid var(--status-blocked);
|
|
1705
|
+
background: var(--bg-elevated);
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1699
1708
|
.inbox-allclear {
|
|
1700
1709
|
display: flex; align-items: center; gap: 14px;
|
|
1701
1710
|
padding: 22px 22px; margin-top: 4px;
|
|
@@ -3399,6 +3408,10 @@ h1, h2, h3, h4 { font-weight: 600; font-family: var(--sans); }
|
|
|
3399
3408
|
two speaking states render into #inbox-receipt-foot at the bottom of
|
|
3400
3409
|
this page (see refreshReceipt). -->
|
|
3401
3410
|
<div id="inbox-receipt" style="display:none;margin:6px 0 2px;font-size:var(--fs-small)"></div>
|
|
3411
|
+
<!-- Sessions stopped on the operator: a permission prompt, or idle waiting for
|
|
3412
|
+
an answer (Notification hook → .great_cto/status/). The one piece of
|
|
3413
|
+
status that IS a decision, so it sits above the status disclosure. -->
|
|
3414
|
+
<div id="inbox-sessions" style="display:none;margin:6px 0 10px;font-size:var(--fs-small)"></div>
|
|
3402
3415
|
<!-- Everything below is STATUS, and status is not a decision.
|
|
3403
3416
|
|
|
3404
3417
|
Six of the seven blocks on this screen were read-only: a pipeline rail,
|
|
@@ -4673,7 +4686,28 @@ function renderInboxList(rootId, items, countId, opts = {}) {
|
|
|
4673
4686
|
}).join('');
|
|
4674
4687
|
}
|
|
4675
4688
|
|
|
4689
|
+
// Sessions waiting on a person (scripts/lib/session-status.mjs). `blocked` is a
|
|
4690
|
+
// prompt or an unanswered wait and gets a row; `waiting` (turn ended) is what every
|
|
4691
|
+
// open session is between turns, so it is one muted count, not a row each.
|
|
4692
|
+
async function refreshSessionStatus() {
|
|
4693
|
+
const el = document.getElementById('inbox-sessions');
|
|
4694
|
+
if (!el) return;
|
|
4695
|
+
const r = await api(`/api/session-status${pqs()}`);
|
|
4696
|
+
const rows = (r && Array.isArray(r.sessions)) ? r.sessions : [];
|
|
4697
|
+
const blocked = rows.filter((x) => x.state === 'blocked');
|
|
4698
|
+
const waiting = rows.filter((x) => x.state === 'waiting').length;
|
|
4699
|
+
if (!blocked.length && !waiting) { el.style.display = 'none'; el.innerHTML = ''; return; }
|
|
4700
|
+
el.style.display = '';
|
|
4701
|
+
el.innerHTML = blocked.map((x) => `<div class="session-blocked">
|
|
4702
|
+
<strong>⏸ session ${esc(String(x.session).slice(0, 8))} waits for you</strong>
|
|
4703
|
+
<span class="muted">· ${esc(agoStr(x.since))}${x.kind ? ` · ${esc(x.kind)}` : ''}</span><br>
|
|
4704
|
+
<span>${esc(x.reason || 'waiting for input')}</span>
|
|
4705
|
+
</div>`).join('')
|
|
4706
|
+
+ (waiting ? `<div class="muted" title="these sessions finished their turn; the next message is yours">${waiting} session${waiting === 1 ? '' : 's'} finished a turn and wait for your next message</div>` : '');
|
|
4707
|
+
}
|
|
4708
|
+
|
|
4676
4709
|
async function refreshInbox() {
|
|
4710
|
+
refreshSessionStatus();
|
|
4677
4711
|
// Tiers first: the gate rows are rendered from this same call, and a row drawn
|
|
4678
4712
|
// before the tiers arrive would silently claim every gate is waiting.
|
|
4679
4713
|
await refreshGateTiers();
|
|
@@ -134,6 +134,9 @@ const TOOL_POSTURES = Object.freeze({
|
|
|
134
134
|
WebSearch: ['network.fetch', 'communication.external.send'],
|
|
135
135
|
Agent: ['process.spawn'],
|
|
136
136
|
Task: ['process.spawn'],
|
|
137
|
+
// Loads a skill's text into the agent's context. It grants no tool the agent does
|
|
138
|
+
// not already hold: the skill runs with the agent's own grants.
|
|
139
|
+
Skill: ['code.read'],
|
|
137
140
|
});
|
|
138
141
|
|
|
139
142
|
/** MCP and beta tools, matched by prefix — the list of these grows monthly. */
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* session-status — which sessions in this project are waiting for a person.
|
|
3
|
+
*
|
|
4
|
+
* Nothing showed it. On the projects measured on 2026-09-21 the operator was the
|
|
5
|
+
* approval loop (1,181 "делай" in 5,126 messages), and the board could not say
|
|
6
|
+
* which session was sitting on a permission prompt or had finished its turn and
|
|
7
|
+
* was waiting for an answer. Idea from fynnfluegge/agtx (Apache-2.0), which drives
|
|
8
|
+
* its board from the same hook events; the code here is written for this project.
|
|
9
|
+
*
|
|
10
|
+
* Three hook events write one small file per session, `.great_cto/status/<id>.json`:
|
|
11
|
+
*
|
|
12
|
+
* Notification → blocked (a permission prompt, or idle waiting for input;
|
|
13
|
+
* the notification's own message is the reason)
|
|
14
|
+
* Stop → waiting (the turn ended; the next move is the operator's)
|
|
15
|
+
* UserPromptSubmit → working
|
|
16
|
+
* SessionEnd → the file is removed
|
|
17
|
+
*
|
|
18
|
+
* A hook only fires on the transitions it is told about, so a state can go stale:
|
|
19
|
+
* a permission granted fires no event. The reader therefore checks the session's
|
|
20
|
+
* transcript — if it was written after the blocked/waiting moment, the session has
|
|
21
|
+
* moved on and is reported as working. A `working` with a silent transcript for
|
|
22
|
+
* five minutes is `unknown`, not working (agtx uses the same bound).
|
|
23
|
+
*/
|
|
24
|
+
import { mkdirSync, writeFileSync, readFileSync, readdirSync, statSync, rmSync, renameSync } from 'node:fs';
|
|
25
|
+
import { join } from 'node:path';
|
|
26
|
+
|
|
27
|
+
export const STALE_WORKING_MS = 5 * 60 * 1000;
|
|
28
|
+
export const MOVED_ON_SLACK_MS = 2000;
|
|
29
|
+
export const DROP_AFTER_MS = 24 * 60 * 60 * 1000;
|
|
30
|
+
|
|
31
|
+
const EVENT_STATE = { Notification: 'blocked', Stop: 'waiting', UserPromptSubmit: 'working' };
|
|
32
|
+
|
|
33
|
+
const safeId = (id) => String(id || '').replace(/[^A-Za-z0-9_-]/g, '').slice(0, 64);
|
|
34
|
+
|
|
35
|
+
/** Apply one hook payload. Returns what was written, or null when nothing applies. */
|
|
36
|
+
export function recordHookEvent(payload, { now = Date.now() } = {}) {
|
|
37
|
+
const cwd = payload?.cwd || process.cwd();
|
|
38
|
+
const id = safeId(payload?.session_id);
|
|
39
|
+
if (!id) return null;
|
|
40
|
+
const dir = join(cwd, '.great_cto', 'status');
|
|
41
|
+
const file = join(dir, `${id}.json`);
|
|
42
|
+
const event = payload?.hook_event_name;
|
|
43
|
+
if (event === 'SessionEnd') { rmSync(file, { force: true }); return { removed: true }; }
|
|
44
|
+
const state = EVENT_STATE[event];
|
|
45
|
+
if (!state) return null;
|
|
46
|
+
try { statSync(join(cwd, '.great_cto')); } catch { return null; } // not a great_cto project
|
|
47
|
+
const rec = {
|
|
48
|
+
session: id,
|
|
49
|
+
state,
|
|
50
|
+
since: new Date(now).toISOString(),
|
|
51
|
+
transcript: payload.transcript_path || null,
|
|
52
|
+
};
|
|
53
|
+
if (state === 'blocked') {
|
|
54
|
+
rec.reason = String(payload.message || 'waiting for you').slice(0, 300);
|
|
55
|
+
if (payload.notification_type) rec.kind = String(payload.notification_type).slice(0, 40);
|
|
56
|
+
}
|
|
57
|
+
mkdirSync(dir, { recursive: true });
|
|
58
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
59
|
+
writeFileSync(tmp, JSON.stringify(rec));
|
|
60
|
+
renameSync(tmp, file);
|
|
61
|
+
return rec;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The effective state of every session with a status file.
|
|
66
|
+
* @returns {{session:string, state:'blocked'|'waiting'|'working'|'unknown', reason?:string, kind?:string, since:string}[]}
|
|
67
|
+
*/
|
|
68
|
+
export function readSessionStatus(projectDir, { now = Date.now() } = {}) {
|
|
69
|
+
const dir = join(projectDir, '.great_cto', 'status');
|
|
70
|
+
let files = [];
|
|
71
|
+
try { files = readdirSync(dir).filter((f) => f.endsWith('.json')); } catch { return []; }
|
|
72
|
+
const out = [];
|
|
73
|
+
for (const f of files) {
|
|
74
|
+
let rec;
|
|
75
|
+
try { rec = JSON.parse(readFileSync(join(dir, f), 'utf8')); } catch { continue; }
|
|
76
|
+
const since = Date.parse(rec.since);
|
|
77
|
+
if (!Number.isFinite(since) || now - since > DROP_AFTER_MS) continue;
|
|
78
|
+
let moved = null;
|
|
79
|
+
if (rec.transcript) {
|
|
80
|
+
try { moved = statSync(rec.transcript).mtimeMs; } catch { moved = null; }
|
|
81
|
+
}
|
|
82
|
+
let state = rec.state;
|
|
83
|
+
if ((state === 'blocked' || state === 'waiting') && moved !== null && moved > since + MOVED_ON_SLACK_MS) state = 'working';
|
|
84
|
+
if (state === 'working' && now - Math.max(since, moved || 0) > STALE_WORKING_MS) state = 'unknown';
|
|
85
|
+
const row = { session: rec.session, state, since: rec.since };
|
|
86
|
+
if (state === 'blocked') { row.reason = rec.reason; if (rec.kind) row.kind = rec.kind; }
|
|
87
|
+
out.push(row);
|
|
88
|
+
}
|
|
89
|
+
const rank = { blocked: 0, waiting: 1, working: 2, unknown: 3 };
|
|
90
|
+
return out.sort((a, b) => rank[a.state] - rank[b.state] || (a.since < b.since ? -1 : 1));
|
|
91
|
+
}
|
package/package.json
CHANGED