eversince 0.2.4 → 0.2.6
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/bridge.js +4 -2
- package/dist/commands/auth.js +16 -1
- package/dist/commands/download.js +19 -0
- package/dist/commands/init.js +17 -15
- package/dist/commands/jobs.js +17 -4
- package/dist/index.js +5 -1
- package/dist/local.js +7 -2
- package/package.json +1 -1
package/dist/bridge.js
CHANGED
|
@@ -115,8 +115,10 @@ export function runBridge(options) {
|
|
|
115
115
|
}
|
|
116
116
|
const envelope = body;
|
|
117
117
|
const said = typeof envelope?.error?.message === 'string' ? envelope.error.message : null;
|
|
118
|
-
if (res.status === 503 || res.status === 504)
|
|
119
|
-
|
|
118
|
+
if (res.status === 503 || res.status === 504) {
|
|
119
|
+
const wait = Number(res.headers.get('retry-after'));
|
|
120
|
+
return rpcError(id, said ?? `Eversince is busy right now. Retry the call in ${Number.isFinite(wait) && wait > 0 ? `${wait} seconds` : 'a few seconds'}.`);
|
|
121
|
+
}
|
|
120
122
|
return rpcError(id, said ?? `Eversince could not answer (status ${res.status}). Retry the call.`);
|
|
121
123
|
}
|
|
122
124
|
async function relay(line) {
|
package/dist/commands/auth.js
CHANGED
|
@@ -81,12 +81,27 @@ export async function login(argv, connection, mode) {
|
|
|
81
81
|
const where = await withRenewalLock(host, () => writeCredentials(stored));
|
|
82
82
|
if (connection.baseUrl)
|
|
83
83
|
await writeSettings({ baseUrl });
|
|
84
|
-
|
|
84
|
+
const name = argv.name?.trim();
|
|
85
|
+
let unnamed = false;
|
|
86
|
+
let badName = false;
|
|
87
|
+
if (name && stored.kind === 'oauth') {
|
|
88
|
+
try {
|
|
89
|
+
const client = await Client.create({ baseUrl, credentials: stored });
|
|
90
|
+
await client.post('/api/v1/connections/agent', { name });
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
unnamed = true;
|
|
94
|
+
badName = error instanceof ApiError && error.status === 400;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
printResult(mode, { host, kind: stored.kind, storage: where, ...(unnamed ? { named: false } : {}) }, () => {
|
|
85
98
|
line(`Signed in to ${host}${stored.kind === 'api_key' ? ' with an API key' : ''}.`);
|
|
86
99
|
line(`Credential stored in the ${where === 'keychain' ? 'system keychain' : 'config file'}.`);
|
|
87
100
|
if (process.env.ES_API_KEY) {
|
|
88
101
|
note('ES_API_KEY is set in this shell and takes precedence over what was just stored.');
|
|
89
102
|
}
|
|
103
|
+
if (unnamed)
|
|
104
|
+
note(badName ? 'The name was not saved. Use letters, digits, spaces, dots and dashes.' : 'The name was not saved.');
|
|
90
105
|
});
|
|
91
106
|
}
|
|
92
107
|
export async function logout(connection, mode) {
|
|
@@ -7,6 +7,9 @@ import { Client } from '../client.js';
|
|
|
7
7
|
import { line, note, printResult } from '../output.js';
|
|
8
8
|
import { USER_AGENT } from '../version.js';
|
|
9
9
|
const GET_ITEMS_MAX = 25;
|
|
10
|
+
const UPLOAD_WAIT_MS = 120_000;
|
|
11
|
+
const JUST_MADE_MS = 10 * 60_000;
|
|
12
|
+
const onItsWayUp = (it) => !it.url && !!it.local_only && !!it.created_at && Date.now() - Date.parse(it.created_at) < JUST_MADE_MS;
|
|
10
13
|
const EXTENSIONS = {
|
|
11
14
|
image: '.png',
|
|
12
15
|
video: '.mp4',
|
|
@@ -41,6 +44,22 @@ export async function download(argv, connection, mode) {
|
|
|
41
44
|
for (const ref of page.unresolved ?? [])
|
|
42
45
|
failed.push({ ref, error: 'No such item in this workspace' });
|
|
43
46
|
}
|
|
47
|
+
if (client.local) {
|
|
48
|
+
const deadline = Date.now() + UPLOAD_WAIT_MS;
|
|
49
|
+
let pending = items.filter(onItsWayUp);
|
|
50
|
+
if (pending.length && !mode.json)
|
|
51
|
+
note(`Waiting for ${pending.length === 1 ? 'it' : `${pending.length} files`} to finish uploading from the desktop app …`);
|
|
52
|
+
while (pending.length && Date.now() < deadline) {
|
|
53
|
+
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
54
|
+
const page = (await client.tool('get_items', { refs: pending.map((it) => it.item_id || it.ref).filter(Boolean) }).catch(() => ({ items: [] })));
|
|
55
|
+
for (const fresh of page.items) {
|
|
56
|
+
const at = items.findIndex((it) => (it.item_id && it.item_id === fresh.item_id) || (it.ref && it.ref === fresh.ref));
|
|
57
|
+
if (at >= 0 && fresh.url)
|
|
58
|
+
items[at] = fresh;
|
|
59
|
+
}
|
|
60
|
+
pending = items.filter(onItsWayUp);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
44
63
|
for (const item of items) {
|
|
45
64
|
const ref = item.ref || item.item_id || 'item';
|
|
46
65
|
if (!item.url) {
|
package/dist/commands/init.js
CHANGED
|
@@ -308,21 +308,23 @@ export async function init(argv, connection, mode) {
|
|
|
308
308
|
const connected = !(entries.length > 0 && entries.every((entry) => entry.points_to));
|
|
309
309
|
if (!dryRun && connected) {
|
|
310
310
|
const wrote = changes.filter((c) => c.action !== 'unchanged').map((c) => c.agent);
|
|
311
|
-
const named =
|
|
312
|
-
?
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
? {
|
|
316
|
-
: agent === '
|
|
317
|
-
? { name: '
|
|
318
|
-
:
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
: wrote.includes('
|
|
322
|
-
? { agent: '
|
|
323
|
-
:
|
|
324
|
-
? { agent: '
|
|
325
|
-
:
|
|
311
|
+
const named = argv.name?.trim()
|
|
312
|
+
? { name: argv.name.trim() }
|
|
313
|
+
: agent
|
|
314
|
+
? agent === 'claude-code' || agent === 'cursor' || agent === 'codex'
|
|
315
|
+
? { agent }
|
|
316
|
+
: agent === 'vscode'
|
|
317
|
+
? { name: 'VS Code' }
|
|
318
|
+
: agent === 'claude-desktop'
|
|
319
|
+
? { name: 'Claude Desktop' }
|
|
320
|
+
: null
|
|
321
|
+
: wrote.includes('Claude Code')
|
|
322
|
+
? { agent: 'claude-code' }
|
|
323
|
+
: wrote.includes('Cursor')
|
|
324
|
+
? { agent: 'cursor' }
|
|
325
|
+
: skipped.some((item) => item.agent === 'Codex')
|
|
326
|
+
? { agent: 'codex' }
|
|
327
|
+
: null;
|
|
326
328
|
if (named) {
|
|
327
329
|
try {
|
|
328
330
|
const client = await Client.create({ ...connection, baseUrl, cloud: true });
|
package/dist/commands/jobs.js
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
|
-
import { Client } from '../client.js';
|
|
1
|
+
import { ApiError, Client } from '../client.js';
|
|
2
2
|
import { line, note, pad, printResult } from '../output.js';
|
|
3
3
|
const TERMINAL = new Set(['succeeded', 'failed', 'cancelled']);
|
|
4
4
|
const POLL_SECONDS = 25;
|
|
5
5
|
export async function waitForJobs(client, ids, opts) {
|
|
6
6
|
const deadline = Date.now() + opts.timeoutMs;
|
|
7
|
+
let misses = 0;
|
|
7
8
|
for (;;) {
|
|
8
9
|
const remaining = Math.max(0, deadline - Date.now());
|
|
9
10
|
const wait = Math.min(POLL_SECONDS, Math.floor(remaining / 1000));
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
let data;
|
|
12
|
+
try {
|
|
13
|
+
data = (await client.tool('get_jobs', { ids, wait_seconds: wait }, {
|
|
14
|
+
timeoutMs: (wait + 30) * 1000,
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
const passing = error instanceof ApiError && (error.body.retryable === true || error.status >= 500);
|
|
19
|
+
misses += 1;
|
|
20
|
+
if (!passing || misses >= 10 || Date.now() >= deadline)
|
|
21
|
+
throw error;
|
|
22
|
+
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
misses = 0;
|
|
13
26
|
opts.onTick?.(data.jobs);
|
|
14
27
|
if (data.jobs.length === 0)
|
|
15
28
|
return [];
|
package/dist/index.js
CHANGED
|
@@ -47,6 +47,8 @@ Options
|
|
|
47
47
|
--idempotency-key <k> the key for a charged call, so a retry does not charge twice
|
|
48
48
|
--schemas with tools: include each tool's input schema
|
|
49
49
|
--annotation <kind> with tools: only read, write or destructive tools
|
|
50
|
+
--name <agent> with login or init: the agent's name, shown in Settings
|
|
51
|
+
and on the feed (otherwise "CLI agent")
|
|
50
52
|
--scope <where> with init: project or user, where the agent's settings are written
|
|
51
53
|
--dry-run / --force with init: preview what would be written, or overwrite what is there
|
|
52
54
|
--cloud talk to eversince.ai instead of the desktop app; to have
|
|
@@ -82,6 +84,7 @@ function toNumber(value, name) {
|
|
|
82
84
|
const OPTIONS = {
|
|
83
85
|
json: { type: 'boolean', default: false },
|
|
84
86
|
key: { type: 'string' },
|
|
87
|
+
name: { type: 'string' },
|
|
85
88
|
'base-url': { type: 'string' },
|
|
86
89
|
cloud: { type: 'boolean', default: false },
|
|
87
90
|
workspace: { type: 'string' },
|
|
@@ -141,7 +144,7 @@ async function main() {
|
|
|
141
144
|
try {
|
|
142
145
|
switch (command) {
|
|
143
146
|
case 'login':
|
|
144
|
-
return await login({ key: values.key, noBrowser: values['no-browser'] }, connection, mode);
|
|
147
|
+
return await login({ key: values.key, noBrowser: values['no-browser'], name: values.name }, connection, mode);
|
|
145
148
|
case 'logout':
|
|
146
149
|
return await logout(connection, mode);
|
|
147
150
|
case 'status':
|
|
@@ -188,6 +191,7 @@ async function main() {
|
|
|
188
191
|
force: values.force,
|
|
189
192
|
dryRun: values['dry-run'],
|
|
190
193
|
agent: values.agent,
|
|
194
|
+
name: values.name,
|
|
191
195
|
}, connection, mode);
|
|
192
196
|
default:
|
|
193
197
|
throw new Error(`Unknown command "${command}". Run \`eversince help\`.`);
|
package/dist/local.js
CHANGED
|
@@ -57,8 +57,13 @@ export async function openApp(onStart) {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
export async function localDoor(onStart) {
|
|
60
|
-
if (!desktopInstalled())
|
|
61
|
-
|
|
60
|
+
if (!desktopInstalled()) {
|
|
61
|
+
const record = readState();
|
|
62
|
+
if (!record || typeof record.connectKey !== 'string')
|
|
63
|
+
return null;
|
|
64
|
+
if ((await probe(record).catch(() => 'closed')) !== 'ours')
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
62
67
|
const state = await reachApp(undefined, onStart);
|
|
63
68
|
if (!state)
|
|
64
69
|
throw new Error('The Eversince app on this computer did not open. Open it and try again, or run with --cloud.');
|
package/package.json
CHANGED