polyergon 0.0.0-stage → 0.1.1
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/.next/BUILD_ID +1 -0
- package/.next/app-build-manifest.json +35 -0
- package/.next/app-path-routes-manifest.json +1 -0
- package/.next/build-manifest.json +32 -0
- package/.next/export-marker.json +1 -0
- package/.next/images-manifest.json +1 -0
- package/.next/next-minimal-server.js.nft.json +1 -0
- package/.next/next-server.js.nft.json +1 -0
- package/.next/package.json +1 -0
- package/.next/prerender-manifest.json +1 -0
- package/.next/react-loadable-manifest.json +10 -0
- package/.next/required-server-files.json +1 -0
- package/.next/routes-manifest.json +1 -0
- package/.next/server/app/_not-found/page.js +1 -0
- package/.next/server/app/_not-found/page.js.nft.json +1 -0
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -0
- package/.next/server/app/_not-found.html +1 -0
- package/.next/server/app/_not-found.meta +6 -0
- package/.next/server/app/_not-found.rsc +9 -0
- package/.next/server/app/api/automations/existing/route.js +1 -0
- package/.next/server/app/api/automations/existing/route.js.nft.json +1 -0
- package/.next/server/app/api/backends/route.js +1 -0
- package/.next/server/app/api/backends/route.js.nft.json +1 -0
- package/.next/server/app/api/diff/route.js +1 -0
- package/.next/server/app/api/diff/route.js.nft.json +1 -0
- package/.next/server/app/api/limits/route.js +1 -0
- package/.next/server/app/api/limits/route.js.nft.json +1 -0
- package/.next/server/app/api/meetings/[id]/route.js +1 -0
- package/.next/server/app/api/meetings/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/meetings/[id]/slack/route.js +3 -0
- package/.next/server/app/api/meetings/[id]/slack/route.js.nft.json +1 -0
- package/.next/server/app/api/meetings/library/route.js +1 -0
- package/.next/server/app/api/meetings/library/route.js.nft.json +1 -0
- package/.next/server/app/api/meetings/route.js +1 -0
- package/.next/server/app/api/meetings/route.js.nft.json +1 -0
- package/.next/server/app/api/models/route.js +1 -0
- package/.next/server/app/api/models/route.js.nft.json +1 -0
- package/.next/server/app/api/notes/route.js +1 -0
- package/.next/server/app/api/notes/route.js.nft.json +1 -0
- package/.next/server/app/api/orgs/[id]/route.js +1 -0
- package/.next/server/app/api/orgs/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/orgs/route.js +1 -0
- package/.next/server/app/api/orgs/route.js.nft.json +1 -0
- package/.next/server/app/api/prs/inbox/route.js +1 -0
- package/.next/server/app/api/prs/inbox/route.js.nft.json +1 -0
- package/.next/server/app/api/prs/refresh/route.js +1 -0
- package/.next/server/app/api/prs/refresh/route.js.nft.json +1 -0
- package/.next/server/app/api/prs/route.js +1 -0
- package/.next/server/app/api/prs/route.js.nft.json +1 -0
- package/.next/server/app/api/session-names/route.js +1 -0
- package/.next/server/app/api/session-names/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/[id]/route.js +1 -0
- package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/route.js +1 -0
- package/.next/server/app/api/sessions/route.js.nft.json +1 -0
- package/.next/server/app/api/settings/auth/route.js +1 -0
- package/.next/server/app/api/settings/auth/route.js.nft.json +1 -0
- package/.next/server/app/api/settings/route.js +1 -0
- package/.next/server/app/api/settings/route.js.nft.json +1 -0
- package/.next/server/app/api/settings/transcription/route.js +1 -0
- package/.next/server/app/api/settings/transcription/route.js.nft.json +1 -0
- package/.next/server/app/api/skills/[name]/route.js +8 -0
- package/.next/server/app/api/skills/[name]/route.js.nft.json +1 -0
- package/.next/server/app/api/skills/marketplace/route.js +2 -0
- package/.next/server/app/api/skills/marketplace/route.js.nft.json +1 -0
- package/.next/server/app/api/skills/route.js +8 -0
- package/.next/server/app/api/skills/route.js.nft.json +1 -0
- package/.next/server/app/api/skills/view/route.js +8 -0
- package/.next/server/app/api/skills/view/route.js.nft.json +1 -0
- package/.next/server/app/api/slack/channels/route.js +1 -0
- package/.next/server/app/api/slack/channels/route.js.nft.json +1 -0
- package/.next/server/app/api/slack/configured/route.js +1 -0
- package/.next/server/app/api/slack/configured/route.js.nft.json +1 -0
- package/.next/server/app/api/slack/inbox/route.js +1 -0
- package/.next/server/app/api/slack/inbox/route.js.nft.json +1 -0
- package/.next/server/app/api/tasks/route.js +1 -0
- package/.next/server/app/api/tasks/route.js.nft.json +1 -0
- package/.next/server/app/api/usage/route.js +1 -0
- package/.next/server/app/api/usage/route.js.nft.json +1 -0
- package/.next/server/app/demo/page.js +1 -0
- package/.next/server/app/demo/page.js.nft.json +1 -0
- package/.next/server/app/demo/page_client-reference-manifest.js +1 -0
- package/.next/server/app/demo.html +1 -0
- package/.next/server/app/demo.meta +6 -0
- package/.next/server/app/demo.rsc +7 -0
- package/.next/server/app/favicon.ico/route.js +12 -0
- package/.next/server/app/favicon.ico/route.js.nft.json +1 -0
- package/.next/server/app/favicon.ico.body +0 -0
- package/.next/server/app/favicon.ico.meta +1 -0
- package/.next/server/app/index.html +1 -0
- package/.next/server/app/index.meta +5 -0
- package/.next/server/app/index.rsc +7 -0
- package/.next/server/app/page.js +10 -0
- package/.next/server/app/page.js.nft.json +1 -0
- package/.next/server/app/page_client-reference-manifest.js +1 -0
- package/.next/server/app-paths-manifest.json +36 -0
- package/.next/server/chunks/36.js +1 -0
- package/.next/server/chunks/471.js +2 -0
- package/.next/server/chunks/590.js +7 -0
- package/.next/server/chunks/621.js +1 -0
- package/.next/server/chunks/682.js +6 -0
- package/.next/server/chunks/904.js +1 -0
- package/.next/server/chunks/948.js +2 -0
- package/.next/server/chunks/972.js +12 -0
- package/.next/server/chunks/font-manifest.json +1 -0
- package/.next/server/font-manifest.json +1 -0
- package/.next/server/functions-config-manifest.json +1 -0
- package/.next/server/interception-route-rewrite-manifest.js +1 -0
- package/.next/server/middleware-build-manifest.js +1 -0
- package/.next/server/middleware-manifest.json +6 -0
- package/.next/server/middleware-react-loadable-manifest.js +1 -0
- package/.next/server/next-font-manifest.js +1 -0
- package/.next/server/next-font-manifest.json +1 -0
- package/.next/server/pages/404.html +1 -0
- package/.next/server/pages/500.html +1 -0
- package/.next/server/pages/_app.js +1 -0
- package/.next/server/pages/_app.js.nft.json +1 -0
- package/.next/server/pages/_document.js +1 -0
- package/.next/server/pages/_document.js.nft.json +1 -0
- package/.next/server/pages/_error.js +1 -0
- package/.next/server/pages/_error.js.nft.json +1 -0
- package/.next/server/pages-manifest.json +1 -0
- package/.next/server/server-reference-manifest.js +1 -0
- package/.next/server/server-reference-manifest.json +1 -0
- package/.next/server/webpack-runtime.js +1 -0
- package/.next/static/2gHioRND6aAzT4OB5OHDV/_buildManifest.js +1 -0
- package/.next/static/2gHioRND6aAzT4OB5OHDV/_ssgManifest.js +1 -0
- package/.next/static/chunks/117-0f4ac3c2c1871d4c.js +2 -0
- package/.next/static/chunks/171-d325f9625379d70a.js +1 -0
- package/.next/static/chunks/235.aef4cdc783360b73.js +1 -0
- package/.next/static/chunks/30d07d85.9045c666bb43d9e1.js +3 -0
- package/.next/static/chunks/app/_not-found/page-8ff6572bc7c9bc61.js +1 -0
- package/.next/static/chunks/app/demo/page-6711b34cd2af0e4a.js +1 -0
- package/.next/static/chunks/app/layout-d058836232e72324.js +1 -0
- package/.next/static/chunks/app/page-fedaef1e63f186c2.js +1 -0
- package/.next/static/chunks/fd9d1056-26bd8d656b496dba.js +1 -0
- package/.next/static/chunks/framework-f66176bb897dc684.js +1 -0
- package/.next/static/chunks/main-app-4b855ea14675b961.js +1 -0
- package/.next/static/chunks/main-e88dbd51c3bdafca.js +1 -0
- package/.next/static/chunks/pages/_app-72b849fbd24ac258.js +1 -0
- package/.next/static/chunks/pages/_error-7ba65e1336b92748.js +1 -0
- package/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/.next/static/chunks/webpack-1f89b7cb1fca69c4.js +1 -0
- package/.next/static/css/6e83ef44d507c857.css +3 -0
- package/.next/static/css/ab3e4b0f5035257a.css +1 -0
- package/.next/trace +23 -0
- package/.next/types/app/api/automations/existing/route.ts +343 -0
- package/.next/types/app/api/backends/route.ts +343 -0
- package/.next/types/app/api/diff/route.ts +343 -0
- package/.next/types/app/api/limits/route.ts +343 -0
- package/.next/types/app/api/meetings/[id]/route.ts +343 -0
- package/.next/types/app/api/meetings/[id]/slack/route.ts +343 -0
- package/.next/types/app/api/meetings/library/route.ts +343 -0
- package/.next/types/app/api/meetings/route.ts +343 -0
- package/.next/types/app/api/models/route.ts +343 -0
- package/.next/types/app/api/notes/route.ts +343 -0
- package/.next/types/app/api/orgs/[id]/route.ts +343 -0
- package/.next/types/app/api/orgs/route.ts +343 -0
- package/.next/types/app/api/prs/inbox/route.ts +343 -0
- package/.next/types/app/api/prs/refresh/route.ts +343 -0
- package/.next/types/app/api/prs/route.ts +343 -0
- package/.next/types/app/api/session-names/route.ts +343 -0
- package/.next/types/app/api/sessions/[id]/route.ts +343 -0
- package/.next/types/app/api/sessions/route.ts +343 -0
- package/.next/types/app/api/settings/auth/route.ts +343 -0
- package/.next/types/app/api/settings/route.ts +343 -0
- package/.next/types/app/api/settings/transcription/route.ts +343 -0
- package/.next/types/app/api/skills/[name]/route.ts +343 -0
- package/.next/types/app/api/skills/marketplace/route.ts +343 -0
- package/.next/types/app/api/skills/route.ts +343 -0
- package/.next/types/app/api/skills/view/route.ts +343 -0
- package/.next/types/app/api/slack/channels/route.ts +343 -0
- package/.next/types/app/api/slack/configured/route.ts +343 -0
- package/.next/types/app/api/slack/inbox/route.ts +343 -0
- package/.next/types/app/api/tasks/route.ts +343 -0
- package/.next/types/app/api/usage/route.ts +343 -0
- package/.next/types/app/demo/page.ts +79 -0
- package/.next/types/app/layout.ts +79 -0
- package/.next/types/app/page.ts +79 -0
- package/.next/types/package.json +1 -0
- package/.server-dist/server.js +600 -0
- package/.server-dist/src/lib/activeOrg.js +11 -0
- package/.server-dist/src/lib/audioCapture.js +157 -0
- package/.server-dist/src/lib/backends.js +209 -0
- package/.server-dist/src/lib/claudeAuth.js +57 -0
- package/.server-dist/src/lib/configFile.js +23 -0
- package/.server-dist/src/lib/dataDir.js +7 -0
- package/.server-dist/src/lib/diffReview.js +116 -0
- package/.server-dist/src/lib/existingAutomations.js +132 -0
- package/.server-dist/src/lib/ghInbox.js +151 -0
- package/.server-dist/src/lib/ghPrStatus.js +86 -0
- package/.server-dist/src/lib/gitUtils.js +27 -0
- package/.server-dist/src/lib/keepAwake.js +32 -0
- package/.server-dist/src/lib/liveSessionStore.js +89 -0
- package/.server-dist/src/lib/marketplace.js +63 -0
- package/.server-dist/src/lib/meetingAssistant.js +138 -0
- package/.server-dist/src/lib/meetingConfig.js +81 -0
- package/.server-dist/src/lib/meetingContext.js +82 -0
- package/.server-dist/src/lib/meetingManager.js +246 -0
- package/.server-dist/src/lib/meetingStore.js +198 -0
- package/.server-dist/src/lib/modelCatalog.js +114 -0
- package/.server-dist/src/lib/notesStore.js +67 -0
- package/.server-dist/src/lib/orgFilter.js +19 -0
- package/.server-dist/src/lib/orgParam.js +15 -0
- package/.server-dist/src/lib/orgRegistry.js +93 -0
- package/.server-dist/src/lib/pipelineView.js +62 -0
- package/.server-dist/src/lib/pipelines.js +427 -0
- package/.server-dist/src/lib/planLimits.js +101 -0
- package/.server-dist/src/lib/prDetector.js +16 -0
- package/.server-dist/src/lib/prScanCache.js +144 -0
- package/.server-dist/src/lib/prSessionEntries.js +96 -0
- package/.server-dist/src/lib/prTypes.js +2 -0
- package/.server-dist/src/lib/ptyManager.js +437 -0
- package/.server-dist/src/lib/reminders.js +10 -0
- package/.server-dist/src/lib/requestGuard.js +29 -0
- package/.server-dist/src/lib/sessionNameStore.js +69 -0
- package/.server-dist/src/lib/sessionStore.js +215 -0
- package/.server-dist/src/lib/settingsStore.js +51 -0
- package/.server-dist/src/lib/skillsReader.js +200 -0
- package/.server-dist/src/lib/slackBridge.js +270 -0
- package/.server-dist/src/lib/slackInbox.js +96 -0
- package/.server-dist/src/lib/slackWatchers.js +210 -0
- package/.server-dist/src/lib/statusDetector.js +50 -0
- package/.server-dist/src/lib/taskStore.js +42 -0
- package/.server-dist/src/lib/transcriber.js +61 -0
- package/.server-dist/src/lib/usageStore.js +254 -0
- package/.server-dist/src/lib/worktrees.js +42 -0
- package/.server-dist/tsconfig.server.tsbuildinfo +1 -0
- package/LICENSE +21 -0
- package/README.md +111 -2
- package/bin/polyergon.js +34 -0
- package/next.config.mjs +4 -0
- package/package.json +81 -4
- package/public/.gitkeep +0 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/icon-192.png +0 -0
- package/public/icon-512.png +0 -0
- package/public/icon.svg +1 -0
- package/public/manifest.webmanifest +15 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.meetingStore = exports.MeetingStore = void 0;
|
|
5
|
+
exports.summarySnippet = summarySnippet;
|
|
6
|
+
const dataDir_1 = require("./dataDir");
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const crypto_1 = require("crypto");
|
|
10
|
+
// First line of the summary that is prose, with markdown markers stripped.
|
|
11
|
+
function summarySnippet(md) {
|
|
12
|
+
if (!md)
|
|
13
|
+
return null;
|
|
14
|
+
for (const raw of md.split('\n')) {
|
|
15
|
+
const line = raw.replace(/^[\s>*#\-\d.]+/, '').replace(/\*\*|__|`/g, '').trim();
|
|
16
|
+
if (line.length >= 30)
|
|
17
|
+
return line; // shorter lines are headings like "Meeting Recap"
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
// Excerpt of `text` around the first occurrence of `word` (lowercase).
|
|
22
|
+
function excerpt(raw, word) {
|
|
23
|
+
const text = raw.replace(/\*\*|__|`|^#+\s*/gm, '');
|
|
24
|
+
const i = text.toLowerCase().indexOf(word);
|
|
25
|
+
const start = Math.max(0, i - 60);
|
|
26
|
+
return (start > 0 ? '…' : '') + text.slice(start, i + word.length + 80).replace(/\s+/g, ' ').trim() + '…';
|
|
27
|
+
}
|
|
28
|
+
const DEFAULT_BASE_DIR = (0, path_1.join)(dataDir_1.DATA_DIR, 'meetings');
|
|
29
|
+
class MeetingStore {
|
|
30
|
+
// baseDir defaults to the real on-disk location; tests must pass an
|
|
31
|
+
// isolated path so they never touch the user's actual meetings.
|
|
32
|
+
constructor(baseDir = DEFAULT_BASE_DIR) {
|
|
33
|
+
this.baseDir = baseDir;
|
|
34
|
+
}
|
|
35
|
+
dir(id) {
|
|
36
|
+
return (0, path_1.join)(this.baseDir, id);
|
|
37
|
+
}
|
|
38
|
+
metaPath(id) {
|
|
39
|
+
return (0, path_1.join)(this.dir(id), 'meta.json');
|
|
40
|
+
}
|
|
41
|
+
create(title, orgId) {
|
|
42
|
+
const meeting = {
|
|
43
|
+
id: (0, crypto_1.randomUUID)(),
|
|
44
|
+
title: title || `Meeting ${new Date().toLocaleString()}`,
|
|
45
|
+
orgId,
|
|
46
|
+
startedAt: Date.now(),
|
|
47
|
+
endedAt: null,
|
|
48
|
+
status: 'recording',
|
|
49
|
+
claudeSessionId: null,
|
|
50
|
+
};
|
|
51
|
+
(0, fs_1.mkdirSync)((0, path_1.join)(this.dir(meeting.id), 'audio'), { recursive: true });
|
|
52
|
+
this.writeMeta(meeting);
|
|
53
|
+
return meeting;
|
|
54
|
+
}
|
|
55
|
+
get(id) {
|
|
56
|
+
try {
|
|
57
|
+
return JSON.parse((0, fs_1.readFileSync)(this.metaPath(id), 'utf-8'));
|
|
58
|
+
}
|
|
59
|
+
catch (_a) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
update(id, patch) {
|
|
64
|
+
const meeting = this.get(id);
|
|
65
|
+
if (!meeting)
|
|
66
|
+
return null;
|
|
67
|
+
const updated = Object.assign(Object.assign({}, meeting), patch);
|
|
68
|
+
this.writeMeta(updated);
|
|
69
|
+
return updated;
|
|
70
|
+
}
|
|
71
|
+
list() {
|
|
72
|
+
let ids;
|
|
73
|
+
try {
|
|
74
|
+
ids = (0, fs_1.readdirSync)(this.baseDir);
|
|
75
|
+
}
|
|
76
|
+
catch (_a) {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
const meetings = [];
|
|
80
|
+
for (const id of ids) {
|
|
81
|
+
const m = this.get(id);
|
|
82
|
+
if (m)
|
|
83
|
+
meetings.push(m);
|
|
84
|
+
}
|
|
85
|
+
return meetings.sort((a, b) => b.startedAt - a.startedAt);
|
|
86
|
+
}
|
|
87
|
+
// A server restart can't resume audio capture, so anything still marked
|
|
88
|
+
// 'recording' from a previous run becomes 'interrupted' (transcript/notes
|
|
89
|
+
// are preserved and a summary can still be generated).
|
|
90
|
+
markInterrupted() {
|
|
91
|
+
var _a;
|
|
92
|
+
for (const m of this.list()) {
|
|
93
|
+
if (m.status === 'recording')
|
|
94
|
+
this.update(m.id, { status: 'interrupted', endedAt: (_a = m.endedAt) !== null && _a !== void 0 ? _a : Date.now() });
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
appendTranscript(id, seg) {
|
|
98
|
+
(0, fs_1.appendFileSync)((0, path_1.join)(this.dir(id), 'transcript.jsonl'), JSON.stringify(seg) + '\n');
|
|
99
|
+
}
|
|
100
|
+
readTranscript(id) {
|
|
101
|
+
try {
|
|
102
|
+
return (0, fs_1.readFileSync)((0, path_1.join)(this.dir(id), 'transcript.jsonl'), 'utf-8')
|
|
103
|
+
.split('\n')
|
|
104
|
+
.filter(Boolean)
|
|
105
|
+
.map(line => JSON.parse(line));
|
|
106
|
+
}
|
|
107
|
+
catch (_a) {
|
|
108
|
+
return [];
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
saveNotes(id, notes) {
|
|
112
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(this.dir(id), 'notes.json'), JSON.stringify(notes, null, 2));
|
|
113
|
+
}
|
|
114
|
+
readNotes(id) {
|
|
115
|
+
try {
|
|
116
|
+
return JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(this.dir(id), 'notes.json'), 'utf-8'));
|
|
117
|
+
}
|
|
118
|
+
catch (_a) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
saveSummary(id, markdown) {
|
|
123
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(this.dir(id), 'summary.md'), markdown);
|
|
124
|
+
}
|
|
125
|
+
readSummary(id) {
|
|
126
|
+
try {
|
|
127
|
+
return (0, fs_1.readFileSync)((0, path_1.join)(this.dir(id), 'summary.md'), 'utf-8');
|
|
128
|
+
}
|
|
129
|
+
catch (_a) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// Recordings library. Every query word must appear somewhere in the title,
|
|
134
|
+
// summary, notes or transcript (case-insensitive).
|
|
135
|
+
// ponytail: reads every transcript per search; fine for hundreds of meetings, add an index past that.
|
|
136
|
+
library(query = '') {
|
|
137
|
+
var _a, _b, _c;
|
|
138
|
+
const words = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
139
|
+
const out = [];
|
|
140
|
+
for (const m of this.list()) {
|
|
141
|
+
const summary = this.readSummary(m.id);
|
|
142
|
+
const notes = this.readNotes(m.id);
|
|
143
|
+
let match = null;
|
|
144
|
+
if (words.length) {
|
|
145
|
+
const transcript = this.readTranscript(m.id).map(s => s.text).join(' ');
|
|
146
|
+
const notesText = notes ? [...notes.topics, ...notes.decisions, ...notes.actionItems].join(' ') : '';
|
|
147
|
+
const hay = [m.title, summary !== null && summary !== void 0 ? summary : '', notesText, transcript].join('\n').toLowerCase();
|
|
148
|
+
if (!words.every(w => hay.includes(w)))
|
|
149
|
+
continue;
|
|
150
|
+
const w = words[0];
|
|
151
|
+
for (const field of [summary !== null && summary !== void 0 ? summary : '', notesText, transcript]) {
|
|
152
|
+
if (field.toLowerCase().includes(w)) {
|
|
153
|
+
match = excerpt(field, w);
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
let chunks = 0, bytes = 0;
|
|
159
|
+
try {
|
|
160
|
+
for (const f of (0, fs_1.readdirSync)((0, path_1.join)(this.dir(m.id), 'audio'))) {
|
|
161
|
+
chunks++;
|
|
162
|
+
bytes += (0, fs_1.statSync)((0, path_1.join)(this.dir(m.id), 'audio', f)).size;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
catch ( /* no audio dir */_d) { /* no audio dir */ }
|
|
166
|
+
out.push(Object.assign(Object.assign({}, m), { snippet: summarySnippet(summary), counts: { topics: (_a = notes === null || notes === void 0 ? void 0 : notes.topics.length) !== null && _a !== void 0 ? _a : 0, decisions: (_b = notes === null || notes === void 0 ? void 0 : notes.decisions.length) !== null && _b !== void 0 ? _b : 0, actionItems: (_c = notes === null || notes === void 0 ? void 0 : notes.actionItems.length) !== null && _c !== void 0 ? _c : 0 }, audio: { chunks, bytes }, match }));
|
|
167
|
+
}
|
|
168
|
+
return out;
|
|
169
|
+
}
|
|
170
|
+
readContext(id) {
|
|
171
|
+
try {
|
|
172
|
+
return JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(this.dir(id), 'context.json'), 'utf-8'));
|
|
173
|
+
}
|
|
174
|
+
catch (_a) {
|
|
175
|
+
return [];
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
saveContext(id, items) {
|
|
179
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(this.dir(id), 'context.json'), JSON.stringify(items, null, 2));
|
|
180
|
+
}
|
|
181
|
+
// Moves the meeting folder to <data>/trash/meetings instead of deleting it.
|
|
182
|
+
trash(id) {
|
|
183
|
+
const m = this.get(id);
|
|
184
|
+
if (!m || m.status === 'recording')
|
|
185
|
+
return false;
|
|
186
|
+
const dest = (0, path_1.join)(this.baseDir, '..', 'trash', 'meetings');
|
|
187
|
+
(0, fs_1.mkdirSync)(dest, { recursive: true });
|
|
188
|
+
(0, fs_1.renameSync)(this.dir(id), (0, path_1.join)(dest, `${id}-${Date.now()}`));
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
writeMeta(meeting) {
|
|
192
|
+
if (!(0, fs_1.existsSync)(this.dir(meeting.id)))
|
|
193
|
+
(0, fs_1.mkdirSync)(this.dir(meeting.id), { recursive: true });
|
|
194
|
+
(0, fs_1.writeFileSync)(this.metaPath(meeting.id), JSON.stringify(meeting, null, 2));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
exports.MeetingStore = MeetingStore;
|
|
198
|
+
exports.meetingStore = (_a = global.__meetingStore) !== null && _a !== void 0 ? _a : (global.__meetingStore = new MeetingStore());
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getModels = getModels;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const util_1 = require("util");
|
|
6
|
+
const crypto_1 = require("crypto");
|
|
7
|
+
const orgRegistry_1 = require("./orgRegistry");
|
|
8
|
+
const execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
|
|
9
|
+
const MODELS_URL = 'https://api.anthropic.com/v1/models?limit=1000';
|
|
10
|
+
const CACHE_TTL_MS = 10 * 60000;
|
|
11
|
+
// Same keychain scheme planLimits.ts uses: each config dir's OAuth token lives
|
|
12
|
+
// under "Claude Code-credentials[-<first 8 hex of sha256(configDir)>]".
|
|
13
|
+
function keychainService(configDir) {
|
|
14
|
+
if (!configDir)
|
|
15
|
+
return 'Claude Code-credentials';
|
|
16
|
+
return `Claude Code-credentials-${(0, crypto_1.createHash)('sha256').update(configDir).digest('hex').slice(0, 8)}`;
|
|
17
|
+
}
|
|
18
|
+
async function readToken(configDir) {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
try {
|
|
21
|
+
const { stdout } = await execFileAsync('security', [
|
|
22
|
+
'find-generic-password', '-s', keychainService(configDir), '-w',
|
|
23
|
+
], { timeout: 5000 });
|
|
24
|
+
return (_b = (_a = JSON.parse(stdout.trim()).claudeAiOauth) === null || _a === void 0 ? void 0 : _a.accessToken) !== null && _b !== void 0 ? _b : null;
|
|
25
|
+
}
|
|
26
|
+
catch (_c) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// GitHub Copilot exposes its model list at api.githubcopilot.com/models,
|
|
31
|
+
// authenticated with the user's gh OAuth token (Bearer). It returns chat models
|
|
32
|
+
// plus embedding models — we keep only the ones usable for a coding session.
|
|
33
|
+
async function fetchCopilotModels() {
|
|
34
|
+
var _a;
|
|
35
|
+
let token;
|
|
36
|
+
try {
|
|
37
|
+
const { stdout } = await execFileAsync('gh', ['auth', 'token'], { timeout: 5000 });
|
|
38
|
+
token = stdout.trim();
|
|
39
|
+
}
|
|
40
|
+
catch (_b) {
|
|
41
|
+
throw new Error('Not logged into gh — run `gh auth login`');
|
|
42
|
+
}
|
|
43
|
+
if (!token)
|
|
44
|
+
throw new Error('No gh token found');
|
|
45
|
+
const res = await fetch('https://api.githubcopilot.com/models', {
|
|
46
|
+
headers: {
|
|
47
|
+
Authorization: `Bearer ${token}`,
|
|
48
|
+
'Editor-Version': 'copilot-cli/1.0.83',
|
|
49
|
+
'Copilot-Integration-Id': 'copilot-cli',
|
|
50
|
+
},
|
|
51
|
+
signal: AbortSignal.timeout(15000),
|
|
52
|
+
});
|
|
53
|
+
if (res.status === 401 || res.status === 403)
|
|
54
|
+
throw new Error('gh token lacks Copilot access');
|
|
55
|
+
if (!res.ok)
|
|
56
|
+
throw new Error(`Copilot models endpoint returned ${res.status}`);
|
|
57
|
+
const d = await res.json();
|
|
58
|
+
const seen = new Set();
|
|
59
|
+
return ((_a = d.data) !== null && _a !== void 0 ? _a : [])
|
|
60
|
+
// Drop embeddings and anything not a chat model.
|
|
61
|
+
.filter(m => { var _a, _b; return !/embedding/i.test(m.id) && ((_b = (_a = m.capabilities) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : 'chat') === 'chat'; })
|
|
62
|
+
.filter(m => (seen.has(m.id) ? false : (seen.add(m.id), true)))
|
|
63
|
+
.map(m => { var _a; return ({ id: m.id, displayName: (_a = m.name) !== null && _a !== void 0 ? _a : m.id }); });
|
|
64
|
+
}
|
|
65
|
+
// `opencode models` prints provider/model ids, one per line
|
|
66
|
+
async function fetchOpencodeModels() {
|
|
67
|
+
const { stdout } = await execFileAsync('opencode', ['models'], { timeout: 20000 });
|
|
68
|
+
const ids = stdout.split('\n').map(l => l.trim()).filter(l => /^[\w.-]+\/\S+$/.test(l));
|
|
69
|
+
return [{ id: 'default', displayName: 'Default (from its config)' }, ...ids.map(id => ({ id, displayName: id }))];
|
|
70
|
+
}
|
|
71
|
+
async function fetchClaudeModels(configDir) {
|
|
72
|
+
var _a;
|
|
73
|
+
const token = await readToken(configDir);
|
|
74
|
+
if (!token)
|
|
75
|
+
throw new Error('No login found for this org');
|
|
76
|
+
const res = await fetch(MODELS_URL, {
|
|
77
|
+
headers: {
|
|
78
|
+
Authorization: `Bearer ${token}`,
|
|
79
|
+
'anthropic-version': '2023-06-01',
|
|
80
|
+
'anthropic-beta': 'oauth-2025-04-20',
|
|
81
|
+
},
|
|
82
|
+
signal: AbortSignal.timeout(15000),
|
|
83
|
+
});
|
|
84
|
+
if (res.status === 401)
|
|
85
|
+
throw new Error('Token expired — open a Claude session in this org to refresh it');
|
|
86
|
+
if (!res.ok)
|
|
87
|
+
throw new Error(`Models endpoint returned ${res.status}`);
|
|
88
|
+
const d = await res.json();
|
|
89
|
+
return ((_a = d.data) !== null && _a !== void 0 ? _a : []).map(m => { var _a; return ({ id: m.id, displayName: (_a = m.display_name) !== null && _a !== void 0 ? _a : m.id }); });
|
|
90
|
+
}
|
|
91
|
+
const cache = new Map();
|
|
92
|
+
// Keyed by backend + org so each org's own entitlements are reflected.
|
|
93
|
+
async function getModels(backend, orgId, force = false) {
|
|
94
|
+
var _a;
|
|
95
|
+
const key = `${backend}:${orgId}`;
|
|
96
|
+
const hit = cache.get(key);
|
|
97
|
+
if (!force && hit && Date.now() - hit.at < CACHE_TTL_MS)
|
|
98
|
+
return hit.models;
|
|
99
|
+
try {
|
|
100
|
+
const org = orgRegistry_1.orgRegistry.get(orgId);
|
|
101
|
+
const models = backend === 'copilot' ? await fetchCopilotModels()
|
|
102
|
+
: backend === 'opencode' ? await fetchOpencodeModels()
|
|
103
|
+
: backend === 'claude' ? await fetchClaudeModels((_a = org === null || org === void 0 ? void 0 : org.configDir) !== null && _a !== void 0 ? _a : null)
|
|
104
|
+
: [{ id: 'default', displayName: 'Default (from its config)' }]; // codex, gemini: their own default
|
|
105
|
+
cache.set(key, { at: Date.now(), models });
|
|
106
|
+
return models;
|
|
107
|
+
}
|
|
108
|
+
catch (e) {
|
|
109
|
+
// Serve stale on failure rather than an empty dropdown.
|
|
110
|
+
if (hit)
|
|
111
|
+
return hit.models;
|
|
112
|
+
throw e;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.notesStore = exports.NotesStore = void 0;
|
|
5
|
+
const dataDir_1 = require("./dataDir");
|
|
6
|
+
const fs_1 = require("fs");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
// Server-side persistence for notes — origin/browser/machine-independent, so
|
|
9
|
+
// they don't vanish when the app's hostname changes (localhost vs polyergon).
|
|
10
|
+
const DEFAULT_FILE = (0, path_1.join)(dataDir_1.DATA_DIR, 'notes.json');
|
|
11
|
+
class NotesStore {
|
|
12
|
+
constructor(file = DEFAULT_FILE) {
|
|
13
|
+
this.notes = [];
|
|
14
|
+
this.file = file;
|
|
15
|
+
this.dir = (0, path_1.join)(file, '..');
|
|
16
|
+
this.load();
|
|
17
|
+
}
|
|
18
|
+
load() {
|
|
19
|
+
try {
|
|
20
|
+
const parsed = JSON.parse((0, fs_1.readFileSync)(this.file, 'utf-8'));
|
|
21
|
+
if (Array.isArray(parsed))
|
|
22
|
+
this.notes = parsed;
|
|
23
|
+
}
|
|
24
|
+
catch (_a) {
|
|
25
|
+
this.notes = [];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
all() {
|
|
29
|
+
return [...this.notes];
|
|
30
|
+
}
|
|
31
|
+
// Replace the whole list (the client owns ordering — newest first).
|
|
32
|
+
replace(notes) {
|
|
33
|
+
if (!Array.isArray(notes))
|
|
34
|
+
return;
|
|
35
|
+
this.notes = notes.filter(n => n && typeof n.id === 'string' && typeof n.text === 'string');
|
|
36
|
+
this.persist();
|
|
37
|
+
}
|
|
38
|
+
// Import notes from the client's localStorage the first time — only adds ids
|
|
39
|
+
// we don't already have, so it can't clobber server-side edits.
|
|
40
|
+
merge(incoming) {
|
|
41
|
+
if (!Array.isArray(incoming))
|
|
42
|
+
return;
|
|
43
|
+
const have = new Set(this.notes.map(n => n.id));
|
|
44
|
+
let changed = false;
|
|
45
|
+
for (const n of incoming) {
|
|
46
|
+
if (n && typeof n.id === 'string' && !have.has(n.id)) {
|
|
47
|
+
this.notes.push(n);
|
|
48
|
+
have.add(n.id);
|
|
49
|
+
changed = true;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (changed) {
|
|
53
|
+
this.notes.sort((a, b) => b.createdAt - a.createdAt); // newest first
|
|
54
|
+
this.persist();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
persist() {
|
|
58
|
+
try {
|
|
59
|
+
if (!(0, fs_1.existsSync)(this.dir))
|
|
60
|
+
(0, fs_1.mkdirSync)(this.dir, { recursive: true });
|
|
61
|
+
(0, fs_1.writeFileSync)(this.file, JSON.stringify(this.notes));
|
|
62
|
+
}
|
|
63
|
+
catch (_a) { }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.NotesStore = NotesStore;
|
|
67
|
+
exports.notesStore = (_a = global.__notesStore) !== null && _a !== void 0 ? _a : (global.__notesStore = new NotesStore());
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.repoInOrg = repoInOrg;
|
|
4
|
+
// Which Claude org does a GitHub repo (owner/name) belong to?
|
|
5
|
+
// - 'all' matches everything.
|
|
6
|
+
// - An org with githubOrgs matches owners on its list.
|
|
7
|
+
// - An org with no githubOrgs owns every owner no other org has claimed.
|
|
8
|
+
function repoInOrg(repo, activeOrgId, orgs) {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
if (activeOrgId === 'all')
|
|
11
|
+
return true;
|
|
12
|
+
const owner = ((_a = repo.split('/')[0]) !== null && _a !== void 0 ? _a : '').toLowerCase();
|
|
13
|
+
const active = orgs.find(o => o.id === activeOrgId);
|
|
14
|
+
const activeOwners = ((_b = active === null || active === void 0 ? void 0 : active.githubOrgs) !== null && _b !== void 0 ? _b : []).map(s => s.toLowerCase());
|
|
15
|
+
if (activeOwners.length > 0)
|
|
16
|
+
return activeOwners.includes(owner);
|
|
17
|
+
const claimed = new Set(orgs.filter(o => o.id !== activeOrgId).flatMap(o => { var _a; return (_a = o.githubOrgs) !== null && _a !== void 0 ? _a : []; }).map(s => s.toLowerCase()));
|
|
18
|
+
return !claimed.has(owner);
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.orgParam = orgParam;
|
|
4
|
+
exports.orgConfigDir = orgConfigDir;
|
|
5
|
+
const orgRegistry_1 = require("./orgRegistry");
|
|
6
|
+
// ?org=<id> on API calls; 'all', missing or unknown → Default.
|
|
7
|
+
function orgParam(req) {
|
|
8
|
+
const id = req.nextUrl.searchParams.get('org');
|
|
9
|
+
return id && id !== 'all' && orgRegistry_1.orgRegistry.get(id) ? id : orgRegistry_1.DEFAULT_ORG_ID;
|
|
10
|
+
}
|
|
11
|
+
// The org's Claude config folder (null = ~/.claude), for skills/plugins
|
|
12
|
+
function orgConfigDir(req) {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
return (_b = (_a = orgRegistry_1.orgRegistry.get(orgParam(req))) === null || _a === void 0 ? void 0 : _a.configDir) !== null && _b !== void 0 ? _b : null;
|
|
15
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.orgRegistry = exports.OrgRegistry = exports.DEFAULT_ORG_ID = void 0;
|
|
5
|
+
const dataDir_1 = require("./dataDir");
|
|
6
|
+
const fs_1 = require("fs");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const crypto_1 = require("crypto");
|
|
9
|
+
exports.DEFAULT_ORG_ID = 'default';
|
|
10
|
+
const DEFAULT_PERSIST_DIR = dataDir_1.DATA_DIR;
|
|
11
|
+
const DEFAULT_PERSIST_FILE = (0, path_1.join)(DEFAULT_PERSIST_DIR, 'orgs.json');
|
|
12
|
+
class OrgRegistry {
|
|
13
|
+
// persistFile defaults to the real on-disk location; tests must pass an
|
|
14
|
+
// isolated path so they never touch the user's actual session state.
|
|
15
|
+
constructor(persistFile = DEFAULT_PERSIST_FILE) {
|
|
16
|
+
this.orgs = new Map();
|
|
17
|
+
this.persistFile = persistFile;
|
|
18
|
+
this.persistDir = (0, path_1.join)(persistFile, '..');
|
|
19
|
+
this.load();
|
|
20
|
+
}
|
|
21
|
+
// Re-read on every access: the custom server and Next's API routes hold
|
|
22
|
+
// separate module copies, so an edit made through the API must reach both.
|
|
23
|
+
load() {
|
|
24
|
+
try {
|
|
25
|
+
const saved = JSON.parse((0, fs_1.readFileSync)(this.persistFile, 'utf-8'));
|
|
26
|
+
this.orgs = new Map(saved.map(org => [org.id, org]));
|
|
27
|
+
}
|
|
28
|
+
catch (_a) { }
|
|
29
|
+
if (!this.orgs.has(exports.DEFAULT_ORG_ID)) {
|
|
30
|
+
this.orgs.set(exports.DEFAULT_ORG_ID, { id: exports.DEFAULT_ORG_ID, name: 'Default', configDir: null });
|
|
31
|
+
this.persist();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
list() {
|
|
35
|
+
this.load();
|
|
36
|
+
return Array.from(this.orgs.values());
|
|
37
|
+
}
|
|
38
|
+
// Every org's `<configDir>/projects` root, deduped (two orgs pointing at the
|
|
39
|
+
// same dir — e.g. a misconfigured entry — must not double-list sessions).
|
|
40
|
+
projectRoots() {
|
|
41
|
+
var _a;
|
|
42
|
+
const seen = new Set();
|
|
43
|
+
const roots = [];
|
|
44
|
+
for (const org of this.list()) {
|
|
45
|
+
const root = (0, path_1.join)((_a = org.configDir) !== null && _a !== void 0 ? _a : (0, path_1.join)(process.env.HOME, '.claude'), 'projects');
|
|
46
|
+
if (seen.has(root))
|
|
47
|
+
continue;
|
|
48
|
+
seen.add(root);
|
|
49
|
+
roots.push({ orgId: org.id, root });
|
|
50
|
+
}
|
|
51
|
+
return roots;
|
|
52
|
+
}
|
|
53
|
+
get(id) {
|
|
54
|
+
this.load();
|
|
55
|
+
return this.orgs.get(id);
|
|
56
|
+
}
|
|
57
|
+
add(name, configDir, model) {
|
|
58
|
+
this.load();
|
|
59
|
+
const org = { id: (0, crypto_1.randomUUID)(), name, configDir, model: model !== null && model !== void 0 ? model : null };
|
|
60
|
+
this.orgs.set(org.id, org);
|
|
61
|
+
this.persist();
|
|
62
|
+
return org;
|
|
63
|
+
}
|
|
64
|
+
update(id, patch) {
|
|
65
|
+
const org = this.get(id);
|
|
66
|
+
if (!org)
|
|
67
|
+
return undefined;
|
|
68
|
+
const next = Object.assign(Object.assign(Object.assign({}, org), patch), { id });
|
|
69
|
+
if (id === exports.DEFAULT_ORG_ID)
|
|
70
|
+
next.configDir = org.configDir; // Default keeps the CLI's own folder
|
|
71
|
+
this.orgs.set(id, next);
|
|
72
|
+
this.persist();
|
|
73
|
+
return next;
|
|
74
|
+
}
|
|
75
|
+
// Sessions and meetings of a removed org keep their orgId; the UI shows them under All.
|
|
76
|
+
remove(id) {
|
|
77
|
+
if (id === exports.DEFAULT_ORG_ID || !this.get(id))
|
|
78
|
+
return false;
|
|
79
|
+
this.orgs.delete(id);
|
|
80
|
+
this.persist();
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
persist() {
|
|
84
|
+
try {
|
|
85
|
+
if (!(0, fs_1.existsSync)(this.persistDir))
|
|
86
|
+
(0, fs_1.mkdirSync)(this.persistDir, { recursive: true });
|
|
87
|
+
(0, fs_1.writeFileSync)(this.persistFile, JSON.stringify(Array.from(this.orgs.values())));
|
|
88
|
+
}
|
|
89
|
+
catch (_a) { }
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.OrgRegistry = OrgRegistry;
|
|
93
|
+
exports.orgRegistry = (_a = global.__orgRegistry) !== null && _a !== void 0 ? _a : (global.__orgRegistry = new OrgRegistry());
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shortPr = exports.isRunning = exports.ACTIVE_PHASES = exports.DEFAULT_AUTO = void 0;
|
|
4
|
+
exports.pipelineSummary = pipelineSummary;
|
|
5
|
+
exports.prSteps = prSteps;
|
|
6
|
+
exports.preprSteps = preprSteps;
|
|
7
|
+
exports.DEFAULT_AUTO = { openPr: true, review: true, ci: true, merge: false };
|
|
8
|
+
exports.ACTIVE_PHASES = ['waiting-for-session', 'opening-pr', 'tracking'];
|
|
9
|
+
const isRunning = (p) => !!p && exports.ACTIVE_PHASES.includes(p.phase);
|
|
10
|
+
exports.isRunning = isRunning;
|
|
11
|
+
const shortPr = (url) => url.replace(/^https:\/\/github\.com\//, '').replace('/pull/', '#');
|
|
12
|
+
exports.shortPr = shortPr;
|
|
13
|
+
// Short card label, e.g. "2 PRs · 1 ready · 1 in review"
|
|
14
|
+
function pipelineSummary(p) {
|
|
15
|
+
const waiting = (p.suggestion ? 1 : 0) + p.prs.filter(t => t.suggestion).length;
|
|
16
|
+
const prefix = waiting ? `${waiting} suggestion${waiting > 1 ? 's' : ''} for you · ` : '';
|
|
17
|
+
return prefix + summaryBody(p);
|
|
18
|
+
}
|
|
19
|
+
function summaryBody(p) {
|
|
20
|
+
if (p.phase === 'waiting-for-session')
|
|
21
|
+
return 'watching for a PR';
|
|
22
|
+
if (p.phase === 'opening-pr')
|
|
23
|
+
return 'session is opening a PR';
|
|
24
|
+
if (p.phase === 'stopped')
|
|
25
|
+
return 'stopped';
|
|
26
|
+
if (p.phase === 'needs-you' && !p.prs.length)
|
|
27
|
+
return 'needs you';
|
|
28
|
+
if (p.phase === 'done')
|
|
29
|
+
return p.prs.length > 1 ? `${p.prs.length} PRs done` : 'done';
|
|
30
|
+
const open = p.prs.filter(t => t.state !== 'done');
|
|
31
|
+
const count = (s) => open.filter(t => t.state === s).length;
|
|
32
|
+
const parts = [
|
|
33
|
+
count('needs-you') && `${count('needs-you')} needs you`,
|
|
34
|
+
count('working') && 'fixing',
|
|
35
|
+
count('ready') && `${count('ready')} ready`,
|
|
36
|
+
count('in-review') && `${count('in-review')} in review`,
|
|
37
|
+
].filter(Boolean);
|
|
38
|
+
return `${p.prs.length > 1 ? `${p.prs.length} PRs · ` : ''}${parts.join(' · ') || 'in review'}`;
|
|
39
|
+
}
|
|
40
|
+
// PR → Slack → Review → Approved → Merged, as done/current flags for one PR
|
|
41
|
+
function prSteps(t, slack) {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
const merged = ((_a = t.view) === null || _a === void 0 ? void 0 : _a.state) === 'MERGED';
|
|
44
|
+
const approved = merged || ((_b = t.view) === null || _b === void 0 ? void 0 : _b.reviewDecision) === 'APPROVED' || t.state === 'ready';
|
|
45
|
+
return [
|
|
46
|
+
{ label: 'PR opened', done: true, current: false },
|
|
47
|
+
...(slack ? [{ label: 'Posted to Slack', done: !!t.slack, current: !t.slack }] : []),
|
|
48
|
+
{ label: 'In review', done: approved, current: !approved },
|
|
49
|
+
{ label: 'Approved', done: approved, current: false },
|
|
50
|
+
{ label: 'Merged', done: merged, current: approved && !merged },
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
// Before any PR exists: Watching → PR → Review → Approved → Merged
|
|
54
|
+
function preprSteps(p) {
|
|
55
|
+
return [
|
|
56
|
+
{ label: p.phase === 'opening-pr' ? 'Session is opening a PR' : p.suggestion ? 'Waiting for you to open a PR' : 'Watching for code to ship', done: false, current: true },
|
|
57
|
+
{ label: 'PR opened', done: false, current: false },
|
|
58
|
+
{ label: 'In review', done: false, current: false },
|
|
59
|
+
{ label: 'Approved', done: false, current: false },
|
|
60
|
+
{ label: 'Merged', done: false, current: false },
|
|
61
|
+
];
|
|
62
|
+
}
|