eversince 0.2.11 → 0.2.12

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/README.md CHANGED
@@ -3,10 +3,12 @@
3
3
  Your Eversince workspace, from the command line — for agents and the people who run them.
4
4
 
5
5
  ```bash
6
- npm install -g eversince
7
- eversince init
6
+ npx -y eversince@latest init
8
7
  ```
9
8
 
9
+ With a global install (`npm install -g eversince`, where npm can write without sudo), the
10
+ commands below are `eversince …`; from npx they are `npx -y eversince@latest …`.
11
+
10
12
  Without the desktop app, `eversince login` is needed only to run tools from the shell.
11
13
 
12
14
  `init` connects the agents on this machine and installs a skill that teaches them
package/dist/bridge.js CHANGED
@@ -14,13 +14,14 @@ function rpcError(id, message, code = -32000) {
14
14
  export function runBridge(options) {
15
15
  const file = options.stateFile ?? defaultStateFile();
16
16
  const cacheFile = cacheFileFor(file);
17
- const reconnect = options.reconnect ?? `Run \`eversince init --agent ${options.agent}\` to connect it again.`;
17
+ const self = options.command ?? 'eversince';
18
+ const reconnect = options.reconnect ?? `Run \`${self} init --agent ${options.agent}\` to connect it again.`;
18
19
  function connectionFor(state) {
19
20
  const found = (state?.connections ?? []).find((c) => c && (options.connectionId ? c.id === options.connectionId : c.agent === options.agent));
20
21
  return found && typeof found.token === 'string' ? { token: found.token } : null;
21
22
  }
22
23
  if (!readState(file)) {
23
- process.stderr.write('eversince: the Eversince app is not set up on this computer. Install it, open it and sign in, or run `eversince init --cloud` to connect this agent to eversince.ai instead.\n');
24
+ process.stderr.write(`eversince: the Eversince app is not set up on this computer. Install it, open it and sign in, or run \`${self} init --cloud\` to connect this agent to eversince.ai instead.\n`);
24
25
  process.exit(1);
25
26
  }
26
27
  let listFromCache = null;
@@ -47,7 +48,7 @@ export function runBridge(options) {
47
48
  state = await open();
48
49
  if (!state) {
49
50
  if (before && !existsSync(before.app))
50
- throw new Error('The Eversince app is no longer on this computer. Run `eversince init` to connect this agent to eversince.ai instead.');
51
+ throw new Error(`The Eversince app is no longer on this computer. Run \`${self} init\` to connect this agent to eversince.ai instead.`);
51
52
  throw new Error('The Eversince app did not open. Open it and try again.');
52
53
  }
53
54
  }
@@ -5,6 +5,7 @@ import { resolveBaseUrl, resolveWorkspace, writeSettings, hostOf } from '../conf
5
5
  import { Client, ApiError, loadCredentials, mayUseDesktop } from '../client.js';
6
6
  import { line, note, printResult } from '../output.js';
7
7
  import { desktopInstalled } from '../local.js';
8
+ import { probe, readState } from '../door.js';
8
9
  import { detectHostAgent } from '../host-agent.js';
9
10
  const KEY_PREFIX = 'es_live_';
10
11
  async function readKeyFromInput(fromStdin) {
@@ -131,8 +132,11 @@ export async function status(connection, mode) {
131
132
  const fromEnv = Boolean(process.env.ES_API_KEY);
132
133
  const installed = desktopInstalled();
133
134
  const desktop = installed && (await mayUseDesktop(connection));
135
+ const record = desktop ? readState() : null;
136
+ const answers = !desktop ? null : record ? await probe(record).catch(() => 'closed') : 'closed';
134
137
  const payload = {
135
138
  desktop_app: desktop ? 'used' : installed ? 'not_used' : 'not_installed',
139
+ desktop_app_state: answers === 'ours' ? 'open' : answers,
136
140
  signed_in: credentials !== null,
137
141
  host,
138
142
  base_url: baseUrl,
@@ -142,7 +146,16 @@ export async function status(connection, mode) {
142
146
  expires_at: credentials?.expiresAt ? new Date(credentials.expiresAt).toISOString() : null,
143
147
  };
144
148
  printResult(mode, payload, () => {
145
- line(desktop ? 'Commands run through the desktop app on this computer, for free.' : `Commands run in the cloud (${host}).`);
149
+ if (!desktop)
150
+ line(`Commands run in the cloud (${host}).`);
151
+ else if (answers === 'ours')
152
+ line('Commands run through the desktop app on this computer, for free. It is open.');
153
+ else if (answers === 'closed')
154
+ line('Commands run through the desktop app on this computer, for free. It is closed; the next command opens it.');
155
+ else if (answers === 'blocked')
156
+ line('Commands go to the desktop app on this computer, but this shell cannot reach it. Allow local network access, or add --cloud.');
157
+ else
158
+ line('Commands go to the desktop app on this computer, but another program answers on its port. Restart the app, or add --cloud.');
146
159
  const how = credentials ? (credentials.kind === 'api_key' ? 'with an API key' : 'in the browser') : '';
147
160
  const from = fromEnv ? ', from ES_API_KEY' : '';
148
161
  if (!credentials) {
@@ -6,7 +6,7 @@ import { discoverAuthorizationServer } from '../auth/oauth.js';
6
6
  import { Client } from '../client.js';
7
7
  import { resolveBaseUrl, hostOf } from '../config.js';
8
8
  import { line, note, printResult } from '../output.js';
9
- import { cliLauncher, connectThroughApp, desktopInstalled, launchedFromTemporaryCopy, openApp } from '../local.js';
9
+ import { connectThroughApp, desktopInstalled, hereCommand, openApp, stableLauncher } from '../local.js';
10
10
  import { detectHostAgent } from '../host-agent.js';
11
11
  export const APP_AGENTS = ['claude-code', 'codex', 'cursor', 'vscode', 'claude-desktop', 'other', 'cli'];
12
12
  function checkAgent(given) {
@@ -16,7 +16,7 @@ function checkAgent(given) {
16
16
  throw new Error(`--agent is one of ${APP_AGENTS.join(', ')}.`);
17
17
  return given;
18
18
  }
19
- const GET_THE_APP = 'With the Eversince desktop app on this computer, the same work runs free. Get it at https://eversince.ai, then run eversince init again.';
19
+ const getTheApp = () => hereCommand('With the Eversince desktop app on this computer, the same work runs free. Get it at https://eversince.ai, then run eversince init again.');
20
20
  const SERVER_KEY = 'eversince';
21
21
  function vscodeUserDir() {
22
22
  const home = homedir();
@@ -67,7 +67,7 @@ function skillTargets(scope) {
67
67
  return [{ agent: 'Claude Code', path: join(root, '.claude', 'skills', 'eversince-cli', 'SKILL.md') }];
68
68
  }
69
69
  function skillBody(mcpWhere) {
70
- return `---
70
+ return hereCommand(`---
71
71
  name: eversince-cli
72
72
  description: Reach an Eversince workspace from the shell: upload local files into the library, download items onto disk, call any workspace tool, and follow generation and render to completion. Use whenever the media is on this machine, the same operation runs over many items, or the work has to continue without an agent session.
73
73
  ---
@@ -110,7 +110,7 @@ files are on this machine or the work has to outlive the session.
110
110
  - \`--workspace <id>\` picks the workspace for one command, on eversince.ai (it needs
111
111
  \`eversince login\`; an API key keeps its own workspace), and changes nothing for anyone
112
112
  else. Left off, it is the workspace the desktop app has open, or the one this sign-in uses.
113
- `;
113
+ `);
114
114
  }
115
115
  async function exists(path) {
116
116
  try {
@@ -226,15 +226,12 @@ async function initThroughApp(argv, scope, mode) {
226
226
  if (agents.length === 0) {
227
227
  throw new Error(`Name the agent to connect with --agent: ${APP_AGENTS.join(', ')}.`);
228
228
  }
229
- if (agents.some((a) => a !== 'claude-desktop') && launchedFromTemporaryCopy()) {
230
- throw new Error('This CLI is a temporary copy. Install it with `npm install -g eversince`, then run `eversince init` again.');
231
- }
232
229
  const dryRun = argv.dryRun === true;
230
+ const cli = await stableLauncher(dryRun);
233
231
  const connections = [];
234
232
  if (!dryRun) {
235
233
  await openApp(() => { if (!mode.json)
236
234
  note('Opening the Eversince app on this computer.'); });
237
- const cli = cliLauncher();
238
235
  for (const agent of agents)
239
236
  connections.push(await connectThroughApp(agent, { cli, ...(name ? { name } : {}) }));
240
237
  }
@@ -250,12 +247,14 @@ async function initThroughApp(argv, scope, mode) {
250
247
  venue: 'desktop',
251
248
  dry_run: dryRun,
252
249
  agents,
250
+ runs: cli,
253
251
  connections: connections.map(({ token: _token, ...rest }) => { void _token; return rest; }),
254
252
  changes,
255
253
  ...(shadowed ? { shadowed_by: shadowed } : {}),
256
254
  }, () => {
257
255
  if (dryRun) {
258
256
  line(`Would connect ${agents.join(', ')} through the Eversince app on this computer.`);
257
+ line(`The agent would run ${cli.script}`);
259
258
  }
260
259
  for (const c of connections) {
261
260
  line(`Connected ${c.label} through the Eversince app on this computer. Work it does there is free.`);
@@ -337,7 +336,7 @@ export async function init(argv, connection, mode) {
337
336
  }
338
337
  }
339
338
  }
340
- printResult(mode, { venue: 'cloud', scope, mcp_url: mcpUrl, dry_run: dryRun, connected, changes, manual: skipped, ...(offerApp ? { desktop_app: GET_THE_APP } : {}) }, () => {
339
+ printResult(mode, { venue: 'cloud', scope, mcp_url: mcpUrl, dry_run: dryRun, connected, changes, manual: skipped, ...(offerApp ? { desktop_app: getTheApp() } : {}) }, () => {
341
340
  for (const change of changes) {
342
341
  line(`${change.action.padEnd(10)}${change.path}`);
343
342
  if (change.backup)
@@ -361,6 +360,6 @@ export async function init(argv, connection, mode) {
361
360
  line(`Connected to ${hostOf(baseUrl)}. Restart any running agent to pick it up.`);
362
361
  note('The agent authorises its own MCP connection; it does not use the CLI credential.');
363
362
  if (offerApp)
364
- line(GET_THE_APP);
363
+ line(getTheApp());
365
364
  });
366
365
  }
@@ -1,5 +1,6 @@
1
1
  import { Client } from '../client.js';
2
2
  import { line, pad, printResult } from '../output.js';
3
+ import { hereCommand } from '../local.js';
3
4
  export async function tools(argv, connection, mode) {
4
5
  const client = await Client.create(connection);
5
6
  const wantSchemas = argv.schemas === true || Boolean(argv.name) || mode.json;
@@ -26,7 +27,7 @@ export async function tools(argv, connection, mode) {
26
27
  line(JSON.stringify(tool.input_schema, null, 2));
27
28
  }
28
29
  line();
29
- line(`eversince run ${tool.name} '{ … }'`);
30
+ line(hereCommand(`eversince run ${tool.name} '{ … }'`));
30
31
  return;
31
32
  }
32
33
  if (data.instructions) {
@@ -39,6 +40,6 @@ export async function tools(argv, connection, mode) {
39
40
  for (const tool of list)
40
41
  line(`${pad(tool.name, width)}${tool.description}`);
41
42
  line();
42
- line(`${list.length} tools. \`eversince tools <name>\` for one in full.`);
43
+ line(hereCommand(`${list.length} tools. \`eversince tools <name>\` for one in full.`));
43
44
  });
44
45
  }
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ import { download } from './commands/download.js';
9
9
  import { jobs } from './commands/jobs.js';
10
10
  import { init, APP_AGENTS } from './commands/init.js';
11
11
  import { runBridge } from './bridge.js';
12
+ import { selfCommand } from './local.js';
12
13
  import { fail, line } from './output.js';
13
14
  import { VERSION } from './version.js';
14
15
  const USAGE = `eversince — your workspace, from the command line
@@ -186,7 +187,7 @@ async function main() {
186
187
  if (!agent || !APP_AGENTS.includes(agent)) {
187
188
  throw new Error(`eversince mcp needs --agent, one of ${APP_AGENTS.join(', ')}.`);
188
189
  }
189
- runBridge({ agent, connectionId: values.connection });
190
+ runBridge({ agent, connectionId: values.connection, command: selfCommand() });
190
191
  return;
191
192
  }
192
193
  case 'init':
package/dist/local.js CHANGED
@@ -1,5 +1,7 @@
1
- import { existsSync, realpathSync } from 'node:fs';
2
- import { delimiter, join } from 'node:path';
1
+ import { existsSync, readFileSync, realpathSync } from 'node:fs';
2
+ import { cp, mkdir, rename, rm } from 'node:fs/promises';
3
+ import { homedir } from 'node:os';
4
+ import { delimiter, dirname, join, sep } from 'node:path';
3
5
  import { fileURLToPath } from 'node:url';
4
6
  import { DoorBlocked, probe, reachApp, readState } from './door.js';
5
7
  import { detectHostAgent, kindForName } from './host-agent.js';
@@ -31,6 +33,52 @@ export function cliLauncher() {
31
33
  export function launchedFromTemporaryCopy() {
32
34
  return /[\\/]_npx[\\/]/.test(cliLauncher().script);
33
35
  }
36
+ function keptRoot() {
37
+ const root = join(process.env.ES_STATE_DIR || join(homedir(), '.eversince'), 'cli');
38
+ try {
39
+ return realpathSync(root);
40
+ }
41
+ catch {
42
+ return root;
43
+ }
44
+ }
45
+ function runsFromKeptCopy() {
46
+ return cliLauncher().script.startsWith(keptRoot() + sep);
47
+ }
48
+ export function selfCommand() {
49
+ return launchedFromTemporaryCopy() || runsFromKeptCopy() ? 'npx -y eversince@latest' : 'eversince';
50
+ }
51
+ export function hereCommand(text) {
52
+ const self = selfCommand();
53
+ if (self === 'eversince')
54
+ return text;
55
+ return text.replace(/(^|[^\w@/.-])eversince (?=(?:init|login|logout|status|tools|run|upload|download|jobs|workspace|mcp|help)\b)/g, `$1${self} `);
56
+ }
57
+ export async function stableLauncher(dryRun) {
58
+ const here = cliLauncher();
59
+ if (!launchedFromTemporaryCopy())
60
+ return here;
61
+ const from = dirname(dirname(here.script));
62
+ const version = JSON.parse(readFileSync(join(from, 'package.json'), 'utf8')).version ?? '0.0.0';
63
+ const to = join(keptRoot(), version);
64
+ const script = join(to, 'dist', 'index.js');
65
+ if (dryRun || existsSync(script))
66
+ return { node: here.node, script };
67
+ await mkdir(keptRoot(), { recursive: true });
68
+ const temp = `${to}.tmp-${process.pid}`;
69
+ await rm(temp, { recursive: true, force: true });
70
+ await cp(join(from, 'dist'), join(temp, 'dist'), { recursive: true });
71
+ await cp(join(from, 'package.json'), join(temp, 'package.json'));
72
+ try {
73
+ await rename(temp, to);
74
+ }
75
+ catch (error) {
76
+ await rm(temp, { recursive: true, force: true });
77
+ if (!existsSync(script))
78
+ throw error;
79
+ }
80
+ return { node: here.node, script };
81
+ }
34
82
  export async function connectThroughApp(agent, extra = {}) {
35
83
  const state = await reachApp();
36
84
  if (!state?.connectKey)
@@ -42,7 +90,7 @@ export async function connectThroughApp(agent, extra = {}) {
42
90
  });
43
91
  const payload = (await res.json().catch(() => null));
44
92
  if (!res.ok || !payload?.data) {
45
- throw new Error(payload?.error?.message ?? `The Eversince app refused to connect ${agent} (${res.status}).`);
93
+ throw new Error(payload?.error?.message ? hereCommand(payload.error.message) : `The Eversince app refused to connect ${agent} (${res.status}).`);
46
94
  }
47
95
  return payload.data;
48
96
  }
package/dist/output.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { hereCommand } from './local.js';
1
2
  export function printResult(mode, value, human) {
2
3
  if (mode.json) {
3
4
  process.stdout.write(`${JSON.stringify({ ok: true, data: value })}\n`);
@@ -15,14 +16,18 @@ export function fail(mode, error) {
15
16
  const asApi = error && typeof error === 'object' && 'body' in error
16
17
  ? error
17
18
  : null;
19
+ const message = hereCommand(error instanceof Error ? error.message : String(error));
20
+ const suggested = asApi?.body.suggested_action ? hereCommand(asApi.body.suggested_action) : undefined;
18
21
  if (mode.json) {
19
- const body = asApi?.body ?? { code: 'error', message: error instanceof Error ? error.message : String(error), retryable: false, suggested_action: 'Run eversince help for the commands and options.' };
22
+ const body = asApi?.body
23
+ ? { ...asApi.body, ...(asApi.body.message ? { message: hereCommand(asApi.body.message) } : {}), ...(suggested ? { suggested_action: suggested } : {}) }
24
+ : { code: 'error', message, retryable: false, suggested_action: hereCommand('Run eversince help for the commands and options.') };
20
25
  process.stdout.write(`${JSON.stringify({ ok: false, error: body, ...(asApi?.requestId ? { request_id: asApi.requestId } : {}) })}\n`);
21
26
  }
22
27
  else {
23
- process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
24
- if (asApi?.body.suggested_action)
25
- process.stderr.write(`${asApi.body.suggested_action}\n`);
28
+ process.stderr.write(`${message}\n`);
29
+ if (suggested)
30
+ process.stderr.write(`${suggested}\n`);
26
31
  if (asApi?.requestId)
27
32
  process.stderr.write(`request ${asApi.requestId}\n`);
28
33
  }
@@ -1 +1 @@
1
- 5b62425149cfdaa3b4aefedfe3ed59d39a73c09039e147f2e98b90a0f92de43b
1
+ 5295aed56e667ec559dc7386a87e7c0ea8ac334c4d29823a61042ace137cbe79
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eversince",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "The Eversince CLI. Eversince is the media workspace for agents: connect an agent, call any tool, move files and follow jobs from a shell.",
5
5
  "type": "module",
6
6
  "bin": {