eversince 0.2.6 → 0.2.8
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/dist/auth/oauth.js +3 -3
- package/dist/client.js +16 -3
- package/dist/commands/auth.js +2 -1
- package/dist/commands/download.js +3 -1
- package/dist/commands/init.js +1 -1
- package/dist/commands/jobs.js +1 -1
- package/dist/host-agent.js +14 -0
- package/dist/index.js +4 -2
- package/dist/local.js +5 -2
- package/package.json +1 -1
package/dist/auth/oauth.js
CHANGED
|
@@ -83,11 +83,11 @@ function openBrowser(url) {
|
|
|
83
83
|
catch {
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
const DONE_PAGE = `<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>
|
|
86
|
+
const DONE_PAGE = `<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Signed in to Eversince</title>
|
|
87
87
|
<style>body{font-family:Inter,-apple-system,system-ui,sans-serif;display:grid;place-items:center;height:100vh;margin:0;padding:0 16px;background:#fff;color:#18181b;text-align:center;-webkit-font-smoothing:antialiased}
|
|
88
|
-
h1{font-size:14px;font-weight:
|
|
88
|
+
h1{font-size:14px;font-weight:440;margin:0}p{font-size:14px;color:#71717a;margin:6px 0 0}
|
|
89
89
|
@media(prefers-color-scheme:dark){body{background:#161616;color:#f4f4f5}p{color:#a1a1aa}}</style>
|
|
90
|
-
<body><div><h1>
|
|
90
|
+
<body><div><h1>Signed in to Eversince</h1><p>You can close this tab.</p></div>`;
|
|
91
91
|
const PREFERRED_PORTS = [51703, 51704, 51705, 0];
|
|
92
92
|
async function awaitCallback(timeoutMs) {
|
|
93
93
|
let settle = null;
|
package/dist/client.js
CHANGED
|
@@ -29,6 +29,7 @@ const RETRYABLE_STATUS = new Set([429, 502, 503, 504]);
|
|
|
29
29
|
const MAX_ATTEMPTS = 4;
|
|
30
30
|
const MAX_WRITE_ATTEMPTS = 2;
|
|
31
31
|
const WRITE_RETRY_PAUSE_MS = 500;
|
|
32
|
+
const RETRY_PAUSE_MAX_MS = 30_000;
|
|
32
33
|
class RenewalUnreachable extends Error {
|
|
33
34
|
}
|
|
34
35
|
function sleep(ms) {
|
|
@@ -166,6 +167,7 @@ export class Client {
|
|
|
166
167
|
const idempotencyKey = options.idempotencyKey ?? (isWrite ? randomUUID() : undefined);
|
|
167
168
|
const maxAttempts = isWrite ? MAX_WRITE_ATTEMPTS : MAX_ATTEMPTS;
|
|
168
169
|
let lastError = null;
|
|
170
|
+
let giveUp = null;
|
|
169
171
|
let refreshedOnce = false;
|
|
170
172
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
171
173
|
if (this.local)
|
|
@@ -202,7 +204,14 @@ export class Client {
|
|
|
202
204
|
}
|
|
203
205
|
if (res.status === 401 && this.local && !refreshedOnce) {
|
|
204
206
|
refreshedOnce = true;
|
|
205
|
-
|
|
207
|
+
let token;
|
|
208
|
+
try {
|
|
209
|
+
token = await this.local.reconnect();
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
throw new ApiError(401, { code: 'unauthorized', message: error instanceof Error ? error.message : 'Run eversince init to connect again.', retryable: false }, requestId);
|
|
213
|
+
}
|
|
214
|
+
this.credentials = { ...this.credentials, token };
|
|
206
215
|
continue;
|
|
207
216
|
}
|
|
208
217
|
if (res.status === 401 && this.credentials.kind === 'oauth' && !refreshedOnce) {
|
|
@@ -218,8 +227,12 @@ export class Client {
|
|
|
218
227
|
};
|
|
219
228
|
const error = new ApiError(res.status, body, requestId);
|
|
220
229
|
const canRetry = attempt < maxAttempts - 1 && (isWrite ? res.status === 429 : RETRYABLE_STATUS.has(res.status));
|
|
230
|
+
const retryAfter = Number(res.headers.get('retry-after'));
|
|
231
|
+
if (canRetry && retryAfter * 1000 > RETRY_PAUSE_MAX_MS) {
|
|
232
|
+
giveUp = error;
|
|
233
|
+
throw error;
|
|
234
|
+
}
|
|
221
235
|
if (canRetry) {
|
|
222
|
-
const retryAfter = Number(res.headers.get('retry-after'));
|
|
223
236
|
const pause = Number.isFinite(retryAfter) && retryAfter > 0
|
|
224
237
|
? retryAfter * 1000
|
|
225
238
|
: isWrite ? WRITE_RETRY_PAUSE_MS : backoffMs(attempt);
|
|
@@ -236,7 +249,7 @@ export class Client {
|
|
|
236
249
|
}
|
|
237
250
|
catch (error) {
|
|
238
251
|
if (error instanceof ApiError) {
|
|
239
|
-
if (isWrite || attempt === maxAttempts - 1 || !RETRYABLE_STATUS.has(error.status))
|
|
252
|
+
if (error === giveUp || isWrite || attempt === maxAttempts - 1 || !RETRYABLE_STATUS.has(error.status))
|
|
240
253
|
throw error;
|
|
241
254
|
lastError = error;
|
|
242
255
|
continue;
|
package/dist/commands/auth.js
CHANGED
|
@@ -5,6 +5,7 @@ import { resolveBaseUrl, resolveWorkspace, writeSettings, hostOf } from '../conf
|
|
|
5
5
|
import { Client, ApiError, loadCredentials } from '../client.js';
|
|
6
6
|
import { line, note, printResult } from '../output.js';
|
|
7
7
|
import { desktopInstalled } from '../local.js';
|
|
8
|
+
import { detectHostAgent } from '../host-agent.js';
|
|
8
9
|
const KEY_PREFIX = 'es_live_';
|
|
9
10
|
async function readKeyFromInput(fromStdin) {
|
|
10
11
|
if (fromStdin) {
|
|
@@ -81,7 +82,7 @@ export async function login(argv, connection, mode) {
|
|
|
81
82
|
const where = await withRenewalLock(host, () => writeCredentials(stored));
|
|
82
83
|
if (connection.baseUrl)
|
|
83
84
|
await writeSettings({ baseUrl });
|
|
84
|
-
const name = argv.name?.trim();
|
|
85
|
+
const name = argv.name?.trim() || detectHostAgent()?.name;
|
|
85
86
|
let unnamed = false;
|
|
86
87
|
let badName = false;
|
|
87
88
|
if (name && stored.kind === 'oauth') {
|
|
@@ -49,8 +49,10 @@ export async function download(argv, connection, mode) {
|
|
|
49
49
|
let pending = items.filter(onItsWayUp);
|
|
50
50
|
if (pending.length && !mode.json)
|
|
51
51
|
note(`Waiting for ${pending.length === 1 ? 'it' : `${pending.length} files`} to finish uploading from the desktop app …`);
|
|
52
|
+
let pauseMs = 3000;
|
|
52
53
|
while (pending.length && Date.now() < deadline) {
|
|
53
|
-
await new Promise((resolve) => setTimeout(resolve,
|
|
54
|
+
await new Promise((resolve) => setTimeout(resolve, pauseMs));
|
|
55
|
+
pauseMs = Math.min(pauseMs * 2, 24_000);
|
|
54
56
|
const page = (await client.tool('get_items', { refs: pending.map((it) => it.item_id || it.ref).filter(Boolean) }).catch(() => ({ items: [] })));
|
|
55
57
|
for (const fresh of page.items) {
|
|
56
58
|
const at = items.findIndex((it) => (it.item_id && it.item_id === fresh.item_id) || (it.ref && it.ref === fresh.ref));
|
package/dist/commands/init.js
CHANGED
|
@@ -278,7 +278,7 @@ export async function init(argv, connection, mode) {
|
|
|
278
278
|
throw new Error('--scope is either project or user.');
|
|
279
279
|
}
|
|
280
280
|
const agent = checkAgent(argv.agent);
|
|
281
|
-
const scope = argv.scope === '
|
|
281
|
+
const scope = argv.scope === 'project' ? 'project' : 'user';
|
|
282
282
|
const doMcp = argv.mcp !== false;
|
|
283
283
|
const doSkills = argv.skills !== false;
|
|
284
284
|
const dryRun = argv.dryRun === true;
|
package/dist/commands/jobs.js
CHANGED
|
@@ -66,7 +66,7 @@ export async function jobs(argv, connection, mode) {
|
|
|
66
66
|
if (argv.ids.length === 0)
|
|
67
67
|
throw new Error('Which jobs? `eversince jobs <id…>` or `eversince jobs cancel <id…>`');
|
|
68
68
|
if (!argv.wait) {
|
|
69
|
-
const data = (await client.tool('get_jobs', { ids: argv.ids }));
|
|
69
|
+
const data = (await client.tool('get_jobs', { ids: argv.ids, wait_seconds: 0 }));
|
|
70
70
|
printResult(mode, data, () => {
|
|
71
71
|
if (data.jobs.length === 0)
|
|
72
72
|
line('None of those ids is a job of this workspace.');
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function detectHostAgent(env = process.env) {
|
|
2
|
+
const named = env.ES_AGENT_NAME?.trim();
|
|
3
|
+
if (named)
|
|
4
|
+
return { kind: 'other', name: named };
|
|
5
|
+
if (env.CLAUDECODE)
|
|
6
|
+
return { kind: 'claude-code', name: 'Claude Code' };
|
|
7
|
+
if (env.CURSOR_TRACE_ID)
|
|
8
|
+
return { kind: 'cursor', name: 'Cursor' };
|
|
9
|
+
if (env.CODEX_SANDBOX || env.CODEX_THREAD_ID)
|
|
10
|
+
return { kind: 'codex', name: 'Codex' };
|
|
11
|
+
if (env.TERM_PROGRAM === 'vscode')
|
|
12
|
+
return { kind: 'vscode', name: 'VS Code' };
|
|
13
|
+
return null;
|
|
14
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -48,8 +48,10 @@ Options
|
|
|
48
48
|
--schemas with tools: include each tool's input schema
|
|
49
49
|
--annotation <kind> with tools: only read, write or destructive tools
|
|
50
50
|
--name <agent> with login or init: the agent's name, shown in Settings
|
|
51
|
-
and on the feed (otherwise
|
|
52
|
-
|
|
51
|
+
and on the feed (otherwise the agent whose shell this
|
|
52
|
+
is: Claude Code, Cursor, Codex or VS Code; else "CLI agent")
|
|
53
|
+
--scope <where> with init: user (default, once per machine) or project
|
|
54
|
+
(written into this folder, to commit with a repo)
|
|
53
55
|
--dry-run / --force with init: preview what would be written, or overwrite what is there
|
|
54
56
|
--cloud talk to eversince.ai instead of the desktop app; to have
|
|
55
57
|
the app's work done in the cloud, pass "run_on":"cloud"
|
package/dist/local.js
CHANGED
|
@@ -2,6 +2,7 @@ import { existsSync, realpathSync } from 'node:fs';
|
|
|
2
2
|
import { delimiter, join } from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import { DoorBlocked, probe, reachApp, readState } from './door.js';
|
|
5
|
+
import { detectHostAgent } from './host-agent.js';
|
|
5
6
|
export function desktopInstalled() {
|
|
6
7
|
const state = readState();
|
|
7
8
|
return !!state && existsSync(state.app) && typeof state.connectKey === 'string';
|
|
@@ -46,7 +47,8 @@ export async function connectThroughApp(agent, extra = {}) {
|
|
|
46
47
|
return payload.data;
|
|
47
48
|
}
|
|
48
49
|
async function connect() {
|
|
49
|
-
const
|
|
50
|
+
const host = detectHostAgent();
|
|
51
|
+
const { token } = await connectThroughApp('cli', { auto: true, ...(host ? { name: host.name } : {}) });
|
|
50
52
|
if (typeof token !== 'string')
|
|
51
53
|
throw new Error('The Eversince app did not return a token for the CLI.');
|
|
52
54
|
return token;
|
|
@@ -67,7 +69,8 @@ export async function localDoor(onStart) {
|
|
|
67
69
|
const state = await reachApp(undefined, onStart);
|
|
68
70
|
if (!state)
|
|
69
71
|
throw new Error('The Eversince app on this computer did not open. Open it and try again, or run with --cloud.');
|
|
70
|
-
const
|
|
72
|
+
const label = detectHostAgent()?.name ?? 'CLI agent';
|
|
73
|
+
const existing = state.connections?.find((c) => c?.agent === 'cli' && c.label === label && typeof c.token === 'string');
|
|
71
74
|
const token = typeof existing?.token === 'string' ? existing.token : await connect();
|
|
72
75
|
return {
|
|
73
76
|
baseUrl: `http://127.0.0.1:${state.port}`,
|
package/package.json
CHANGED