polyergon 0.1.0 → 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 -1
- package/.next/app-build-manifest.json +4 -4
- package/.next/app-path-routes-manifest.json +1 -1
- package/.next/build-manifest.json +4 -4
- package/.next/next-minimal-server.js.nft.json +1 -1
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/api/automations/existing/route.js +1 -1
- package/.next/server/app/api/backends/route.js +1 -1
- 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 -1
- package/.next/server/app/api/models/route.js +1 -1
- package/.next/server/app/api/orgs/[id]/route.js +1 -1
- package/.next/server/app/api/orgs/route.js +1 -1
- package/.next/server/app/api/prs/inbox/route.js +1 -1
- package/.next/server/app/api/prs/inbox/route.js.nft.json +1 -1
- package/.next/server/app/api/prs/refresh/route.js +1 -1
- package/.next/server/app/api/prs/refresh/route.js.nft.json +1 -1
- package/.next/server/app/api/prs/route.js +1 -1
- package/.next/server/app/api/prs/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/.next/server/app/api/sessions/route.js +1 -1
- package/.next/server/app/api/settings/auth/route.js +1 -1
- package/.next/server/app/api/skills/[name]/route.js +1 -1
- package/.next/server/app/api/skills/marketplace/route.js +1 -1
- package/.next/server/app/api/skills/route.js +1 -1
- package/.next/server/app/api/skills/view/route.js +1 -1
- package/.next/server/app/api/slack/channels/route.js +1 -1
- package/.next/server/app/api/slack/configured/route.js +1 -1
- package/.next/server/app/api/slack/inbox/route.js +1 -1
- 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 -1
- package/.next/server/app/demo/page_client-reference-manifest.js +1 -1
- package/.next/server/app/demo.html +1 -1
- package/.next/server/app/demo.rsc +2 -2
- package/.next/server/app/favicon.ico/route.js +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +2 -2
- package/.next/server/app/page.js +10 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +18 -16
- package/.next/server/chunks/36.js +1 -0
- package/.next/server/chunks/590.js +1 -1
- package/.next/server/chunks/621.js +1 -1
- package/.next/server/chunks/904.js +1 -1
- package/.next/server/chunks/972.js +2 -2
- package/.next/server/functions-config-manifest.json +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/171-d325f9625379d70a.js +1 -0
- package/.next/static/chunks/app/page-fedaef1e63f186c2.js +1 -0
- package/.next/static/chunks/{main-960df1c7509a5a8b.js → main-e88dbd51c3bdafca.js} +1 -1
- package/.next/static/css/6e83ef44d507c857.css +3 -0
- package/.next/trace +23 -22
- package/.next/types/app/api/diff/route.ts +343 -0
- package/.next/types/app/api/tasks/route.ts +343 -0
- package/.server-dist/server.js +73 -27
- package/.server-dist/src/lib/backends.js +99 -1
- package/.server-dist/src/lib/diffReview.js +116 -0
- package/.server-dist/src/lib/liveSessionStore.js +1 -1
- package/.server-dist/src/lib/modelCatalog.js +10 -3
- package/.server-dist/src/lib/pipelines.js +34 -8
- package/.server-dist/src/lib/ptyManager.js +15 -6
- package/.server-dist/src/lib/statusDetector.js +4 -0
- package/.server-dist/src/lib/taskStore.js +42 -0
- package/.server-dist/src/lib/worktrees.js +42 -0
- package/.server-dist/tsconfig.server.tsbuildinfo +1 -1
- package/README.md +16 -4
- package/package.json +1 -1
- package/.next/server/chunks/348.js +0 -1
- package/.next/static/chunks/171-f72ed164561ba218.js +0 -1
- package/.next/static/chunks/app/page-cebeba7d6d08548a.js +0 -1
- package/.next/static/css/a537d3e86c0f36d2.css +0 -3
- /package/.next/static/{q-HMeHYZY36qljBJhsyS6 → 2gHioRND6aAzT4OB5OHDV}/_buildManifest.js +0 -0
- /package/.next/static/{q-HMeHYZY36qljBJhsyS6 → 2gHioRND6aAzT4OB5OHDV}/_ssgManifest.js +0 -0
|
@@ -102,8 +102,11 @@ function findSessionIdSince(cwd, sinceTime, configDir) {
|
|
|
102
102
|
}
|
|
103
103
|
async function detectAndStoreSessionId(id, cwd, spawnTime, configDir, backend) {
|
|
104
104
|
var _a, _b;
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
// Claude writes its transcript at once; other CLIs (OpenCode) only create the session on the
|
|
106
|
+
// first message, which may come minutes later
|
|
107
|
+
const [tries, every] = backend.id === 'claude' ? [60, 500] : [300, 2000];
|
|
108
|
+
for (let i = 0; i < tries; i++) {
|
|
109
|
+
await new Promise(r => setTimeout(r, every));
|
|
107
110
|
if (!ptyProcesses.has(id))
|
|
108
111
|
return;
|
|
109
112
|
// Claude's finder needs the configDir (which project dir to scan); other
|
|
@@ -282,8 +285,8 @@ function spawnSession(id, cwd, resumeId, configDir, model, rcName, backendId, rc
|
|
|
282
285
|
return;
|
|
283
286
|
// Copilot's status lives in the footer below the cursor, so read the
|
|
284
287
|
// screen bottom for it; Claude's lives in the lines around the cursor.
|
|
285
|
-
const status = backend.id
|
|
286
|
-
? (0, statusDetector_1.detectStatus)(bottomRows(headlessTerm, 3),
|
|
288
|
+
const status = backend.id !== 'claude'
|
|
289
|
+
? (0, statusDetector_1.detectStatus)(bottomRows(headlessTerm, 3), backend.id)
|
|
287
290
|
// Claude's footer (below the prompt) says "esc to interrupt" while busy
|
|
288
291
|
: (0, statusDetector_1.detectStatus)(bufferTail(headlessTerm) + '\n' + bottomRows(headlessTerm, 3));
|
|
289
292
|
const session = liveSessionStore_1.liveSessionStore.get(id);
|
|
@@ -354,14 +357,20 @@ function onScreenDialog(id) {
|
|
|
354
357
|
// prompt; while a startup dialog is showing it waits for you to answer it.
|
|
355
358
|
function sendWhenReady(id, text, timeoutMs = 10 * 60000) {
|
|
356
359
|
const started = Date.now();
|
|
360
|
+
let readySince = 0; // prompt must stay ready ~2s: TUIs report "waiting" before they finish drawing
|
|
357
361
|
const tick = () => {
|
|
358
362
|
var _a;
|
|
359
363
|
if (!ptyProcesses.has(id) || Date.now() - started > timeoutMs)
|
|
360
364
|
return;
|
|
361
365
|
if (((_a = liveSessionStore_1.liveSessionStore.get(id)) === null || _a === void 0 ? void 0 : _a.status) === 'waiting' && !onScreenDialog(id)) {
|
|
362
|
-
|
|
363
|
-
|
|
366
|
+
readySince || (readySince = Date.now());
|
|
367
|
+
if (Date.now() - readySince >= 2000) {
|
|
368
|
+
submitLine(id, text);
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
364
371
|
}
|
|
372
|
+
else
|
|
373
|
+
readySince = 0;
|
|
365
374
|
setTimeout(tick, 1000);
|
|
366
375
|
};
|
|
367
376
|
setTimeout(tick, 1500);
|
|
@@ -25,6 +25,10 @@ function detectStatus(chunk, backend) {
|
|
|
25
25
|
const stripped = chunk.replace(ANSI_RE, '').replace(CURSOR_FWD_RE, '');
|
|
26
26
|
if (backend === 'copilot')
|
|
27
27
|
return COPILOT_WORKING_RE.test(stripped) ? 'thinking' : 'waiting';
|
|
28
|
+
// OpenCode ("esc interrupt"), Codex ("esc to interrupt"), Gemini ("esc to cancel"):
|
|
29
|
+
// the footer shows this only while a turn runs. Callers pass the screen bottom.
|
|
30
|
+
if (backend && backend !== 'claude')
|
|
31
|
+
return /\besc (?:to )?(?:interrupt|cancel)\b/i.test(stripped) ? 'thinking' : 'waiting';
|
|
28
32
|
// The ❯ prompt is rendered as permanent UI chrome below the status line
|
|
29
33
|
// regardless of state, so it can't distinguish thinking from waiting on its
|
|
30
34
|
// own — the spinner is the actual "busy" signal and must be checked first.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listTasks = listTasks;
|
|
4
|
+
exports.addTask = addTask;
|
|
5
|
+
exports.updateTask = updateTask;
|
|
6
|
+
exports.removeTask = removeTask;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const crypto_1 = require("crypto");
|
|
10
|
+
const dataDir_1 = require("./dataDir");
|
|
11
|
+
const FILE = (0, path_1.join)(dataDir_1.DATA_DIR, 'tasks.json');
|
|
12
|
+
function listTasks(file = FILE) {
|
|
13
|
+
try {
|
|
14
|
+
const t = JSON.parse((0, fs_1.readFileSync)(file, 'utf-8'));
|
|
15
|
+
return Array.isArray(t) ? t : [];
|
|
16
|
+
}
|
|
17
|
+
catch (_a) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function save(tasks, file) {
|
|
22
|
+
(0, fs_1.mkdirSync)((0, path_1.dirname)(file), { recursive: true });
|
|
23
|
+
(0, fs_1.writeFileSync)(file, JSON.stringify(tasks, null, 2));
|
|
24
|
+
}
|
|
25
|
+
function addTask(input, file = FILE) {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
const t = { id: (0, crypto_1.randomUUID)(), title: input.title.trim().slice(0, 200), details: input.details.trim().slice(0, 20000), cwd: input.cwd || 'general', worktree: !!input.worktree, ship: (_a = input.ship) !== null && _a !== void 0 ? _a : input.cwd !== 'general', slackChannel: (_b = input.slackChannel) !== null && _b !== void 0 ? _b : null, orgId: input.orgId || 'default', liveId: null, done: false, createdAt: Date.now() };
|
|
28
|
+
save([...listTasks(file), t], file);
|
|
29
|
+
return t;
|
|
30
|
+
}
|
|
31
|
+
function updateTask(id, patch, file = FILE) {
|
|
32
|
+
const tasks = listTasks(file);
|
|
33
|
+
const t = tasks.find(x => x.id === id);
|
|
34
|
+
if (!t)
|
|
35
|
+
return null;
|
|
36
|
+
Object.assign(t, patch, patch.done === true && !t.doneAt ? { doneAt: Date.now() } : {}, patch.done === false ? { doneAt: undefined } : {});
|
|
37
|
+
save(tasks, file);
|
|
38
|
+
return t;
|
|
39
|
+
}
|
|
40
|
+
function removeTask(id, file = FILE) {
|
|
41
|
+
save(listTasks(file).filter(t => t.id !== id), file);
|
|
42
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createWorktree = createWorktree;
|
|
4
|
+
exports.removeWorktree = removeWorktree;
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
const fs_1 = require("fs");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const dataDir_1 = require("./dataDir");
|
|
9
|
+
const git = (cwd, args) => (0, child_process_1.execFileSync)('git', ['-C', cwd, ...args], { stdio: ['ignore', 'pipe', 'pipe'], timeout: 30000 }).toString().trim();
|
|
10
|
+
const slugify = (s) => s.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '').slice(0, 40) || Math.random().toString(36).slice(2, 8);
|
|
11
|
+
function createWorktree(dir, name, base = (0, path_1.join)(dataDir_1.DATA_DIR, 'worktrees')) {
|
|
12
|
+
const repo = git(dir, ['rev-parse', '--show-toplevel']);
|
|
13
|
+
const slug = slugify(name);
|
|
14
|
+
let branch = `polyergon/${slug}`, path = (0, path_1.join)(base, (0, path_1.basename)(repo), slug);
|
|
15
|
+
for (let n = 2; (0, fs_1.existsSync)(path) || branchExists(repo, branch); n++) {
|
|
16
|
+
branch = `polyergon/${slug}-${n}`;
|
|
17
|
+
path = (0, path_1.join)(base, (0, path_1.basename)(repo), `${slug}-${n}`);
|
|
18
|
+
}
|
|
19
|
+
(0, fs_1.mkdirSync)((0, path_1.join)(base, (0, path_1.basename)(repo)), { recursive: true });
|
|
20
|
+
git(repo, ['worktree', 'add', '-b', branch, path]); // branches from the repo's current HEAD
|
|
21
|
+
return { repo, path, branch };
|
|
22
|
+
}
|
|
23
|
+
function branchExists(repo, branch) {
|
|
24
|
+
try {
|
|
25
|
+
git(repo, ['rev-parse', '--verify', '--quiet', `refs/heads/${branch}`]);
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
catch (_a) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// Removes the folder, keeps the branch. Refuses (throws) when there are uncommitted changes.
|
|
33
|
+
function removeWorktree(wt) {
|
|
34
|
+
var _a;
|
|
35
|
+
try {
|
|
36
|
+
git(wt.repo, ['worktree', 'remove', wt.path]);
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
const msg = String((_a = e.stderr) !== null && _a !== void 0 ? _a : e);
|
|
40
|
+
throw new Error(/modified|untracked|dirty/i.test(msg) ? 'The worktree has uncommitted changes. Commit or discard them first.' : msg.trim().split('\n').at(-1) || 'Could not remove the worktree');
|
|
41
|
+
}
|
|
42
|
+
}
|