eversince 0.2.12 → 0.2.13

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
@@ -56,6 +56,7 @@ eversince init --agent codex connect one agent
56
56
  eversince mcp --agent codex the desktop app as a stdio MCP server (init writes this)
57
57
 
58
58
  eversince tools [name] what this workspace can do, live
59
+ eversince tools --all every tool's input fields, once
59
60
  eversince run <tool> '<json>' call any tool (--wait to follow async work; - reads stdin)
60
61
  eversince upload <files|folder> local files into the library
61
62
  eversince download <refs…> library items onto disk
package/dist/bridge.js CHANGED
@@ -1,4 +1,4 @@
1
- import { DoorBlocked, cacheFile as cacheFileFor, isBlocked, isRefused, probe, reachApp, readJson, readState, sandboxedWithoutNetwork, stateFile as defaultStateFile, } from './door.js';
1
+ import { DoorBlocked, cacheFile as cacheFileFor, isBlocked, isRefused, probe, reachApp, unreachedMessage, readJson, readState, sandboxedWithoutNetwork, stateFile as defaultStateFile, } from './door.js';
2
2
  import { existsSync } from 'node:fs';
3
3
  import { isConnectFailure } from './retry.js';
4
4
  function write(message) {
@@ -49,7 +49,7 @@ export function runBridge(options) {
49
49
  if (!state) {
50
50
  if (before && !existsSync(before.app))
51
51
  throw new Error(`The Eversince app is no longer on this computer. Run \`${self} init\` to connect this agent to eversince.ai instead.`);
52
- throw new Error('The Eversince app did not open. Open it and try again.');
52
+ throw new Error(unreachedMessage(`or run \`${self} init --cloud\` to connect this agent to eversince.ai instead`));
53
53
  }
54
54
  }
55
55
  const connection = connectionFor(state);
@@ -19,8 +19,10 @@ async function saveMedia(media, tool, out) {
19
19
  const safe = tool.replace(/[^\w.-]+/g, '-');
20
20
  const written = [];
21
21
  for (const [i, picture] of media.entries()) {
22
- if (typeof picture?.data !== 'string' || picture.data.length === 0)
22
+ if (typeof picture?.data !== 'string' || picture.data.length === 0) {
23
+ written.push(null);
23
24
  continue;
25
+ }
24
26
  const ext = MEDIA_EXTENSIONS[picture.mimeType ?? ''] ?? '.bin';
25
27
  const path = join(dir, `${safe}-${stamp}${media.length > 1 ? `-${i + 1}` : ''}${ext}`);
26
28
  await writeFile(path, Buffer.from(picture.data, 'base64'));
@@ -28,6 +30,18 @@ async function saveMedia(media, tool, out) {
28
30
  }
29
31
  return written;
30
32
  }
33
+ function withPicturePaths(data, saved) {
34
+ const answer = (data ?? {});
35
+ if (!Array.isArray(answer.items))
36
+ return answer;
37
+ const items = answer.items.map((item) => {
38
+ const at = item?.pictures;
39
+ if (!Array.isArray(at))
40
+ return item;
41
+ return { ...item, pictures: at.map((n) => (typeof n === 'number' ? saved[n] ?? null : n)).filter(Boolean) };
42
+ });
43
+ return { ...answer, items };
44
+ }
31
45
  async function readStdin() {
32
46
  const chunks = [];
33
47
  for await (const chunk of process.stdin)
@@ -69,8 +83,9 @@ export async function run(argv, connection, mode) {
69
83
  }
70
84
  const client = await Client.create(connection);
71
85
  const answered = await client.toolWithMedia(argv.name, input, { idempotencyKey: argv.idempotencyKey });
72
- const pictures = await saveMedia(answered.media, argv.name, argv.out);
73
- const result = pictures.length ? { ...answered.data, pictures } : answered.data;
86
+ const saved = await saveMedia(answered.media, argv.name, argv.out);
87
+ const pictures = saved.filter((p) => !!p);
88
+ const result = pictures.length ? { ...withPicturePaths(answered.data, saved), pictures } : answered.data;
74
89
  if (!argv.wait) {
75
90
  printResult(mode, result, () => {
76
91
  line(JSON.stringify(result, null, 2));
@@ -3,7 +3,7 @@ import { line, pad, printResult } from '../output.js';
3
3
  import { hereCommand } from '../local.js';
4
4
  export async function tools(argv, connection, mode) {
5
5
  const client = await Client.create(connection);
6
- const wantSchemas = argv.schemas === true || Boolean(argv.name) || mode.json;
6
+ const wantSchemas = argv.all === true || argv.schemas === true || Boolean(argv.name) || mode.json;
7
7
  const data = (await client.get('/api/v1/tools', {
8
8
  schemas: wantSchemas ? undefined : 'false',
9
9
  annotation: argv.annotation,
@@ -15,6 +15,16 @@ export async function tools(argv, connection, mode) {
15
15
  const near = data.tools.filter((t) => t.name.includes(argv.name)).slice(0, 5);
16
16
  throw new Error(`No tool named "${argv.name}".${near.length ? ` Did you mean: ${near.map((t) => t.name).join(', ')}?` : ' Run `eversince tools` for the list.'}`);
17
17
  }
18
+ if (argv.all && !argv.name) {
19
+ const compact = list.map((t) => ({ name: t.name, input: compactSchema(t.input_schema) }));
20
+ printResult(mode, { tools: compact }, () => {
21
+ for (const t of compact)
22
+ line(`${t.name} ${t.input}`);
23
+ line();
24
+ line(hereCommand('`eversince tools <name>` for one tool in full, with descriptions.'));
25
+ });
26
+ return;
27
+ }
18
28
  printResult(mode, argv.name ? list[0] : { instructions: data.instructions, tools: list }, () => {
19
29
  if (argv.name) {
20
30
  const tool = list[0];
@@ -43,3 +53,23 @@ export async function tools(argv, connection, mode) {
43
53
  line(hereCommand(`${list.length} tools. \`eversince tools <name>\` for one in full.`));
44
54
  });
45
55
  }
56
+ function compactSchema(schema, depth = 0) {
57
+ const node = (schema ?? {});
58
+ const options = (node.anyOf ?? node.oneOf);
59
+ if (Array.isArray(node.enum))
60
+ return node.enum.map(String).join('|');
61
+ if (options)
62
+ return [...new Set(options.map((o) => compactSchema(o, depth)))].join('|');
63
+ if (node.type === 'array')
64
+ return `${compactSchema(node.items, depth)}[]`;
65
+ const props = node.properties;
66
+ if (node.type === 'object' || props) {
67
+ if (!props)
68
+ return 'object';
69
+ if (depth >= 3)
70
+ return '{…}';
71
+ const required = new Set(Array.isArray(node.required) ? node.required : []);
72
+ return `{${Object.entries(props).map(([k, v]) => `${k}${required.has(k) ? '*' : ''}: ${compactSchema(v, depth + 1)}`).join(', ')}}`;
73
+ }
74
+ return Array.isArray(node.type) ? node.type.join('|') : String(node.type ?? 'any');
75
+ }
package/dist/door.js CHANGED
@@ -107,29 +107,42 @@ export function launch(state) {
107
107
  spawn(state.app, args, { stdio: 'ignore', detached: true, env }).on('error', () => undefined).unref();
108
108
  return true;
109
109
  }
110
- export async function reachApp(file = stateFile(), onStart) {
110
+ export async function reachApp(file, onStart) {
111
+ file ??= await answeringFile();
112
+ lastMiss = null;
111
113
  const state = readState(file);
112
- if (!state)
114
+ if (!state) {
115
+ lastMiss = 'missing';
113
116
  return null;
117
+ }
114
118
  const first = await probe(state);
115
119
  if (first === 'ours')
116
120
  return state;
117
121
  if (first === 'blocked')
118
122
  throw new DoorBlocked();
123
+ if (!existsSync(state.app)) {
124
+ lastMiss = 'missing';
125
+ return null;
126
+ }
119
127
  const devUrl = state.launch && typeof state.launch === 'object' && state.launch.env && typeof state.launch.env === 'object'
120
128
  ? state.launch.env.EVERSINCE_DEV_URL
121
129
  : undefined;
122
130
  if (typeof devUrl === 'string') {
123
131
  const up = await fetch(devUrl, { signal: AbortSignal.timeout(1500) }).then(() => true, () => false);
124
- if (!up)
132
+ if (!up) {
133
+ lastMiss = 'dev-down';
125
134
  return null;
135
+ }
126
136
  }
127
137
  onStart?.();
128
138
  try {
129
- if (!launch(state))
139
+ if (!launch(state)) {
140
+ lastMiss = 'missing';
130
141
  return null;
142
+ }
131
143
  }
132
144
  catch {
145
+ lastMiss = 'slow';
133
146
  return null;
134
147
  }
135
148
  const until = Date.now() + START_WAIT_MS;
@@ -144,5 +157,34 @@ export async function reachApp(file = stateFile(), onStart) {
144
157
  if (seen === 'blocked')
145
158
  throw new DoorBlocked();
146
159
  }
160
+ lastMiss = 'slow';
147
161
  return null;
148
162
  }
163
+ let lastMiss = null;
164
+ export function unreachedMessage(cloudHint = 'or run with --cloud') {
165
+ switch (lastMiss) {
166
+ case 'missing':
167
+ return `The Eversince app is not installed on this computer. Install it, ${cloudHint}.`;
168
+ case 'dev-down':
169
+ return `The development copy of the Eversince app is not running and its page server is down. Start it with npm run dev:desktop, ${cloudHint}.`;
170
+ case 'slow':
171
+ default:
172
+ return `The Eversince app was started but did not answer in time. Try again in a moment, ${cloudHint}.`;
173
+ }
174
+ }
175
+ export async function answeringFile() {
176
+ const first = stateFile();
177
+ if (process.env.ES_DESKTOP_STATE || !fromSource())
178
+ return first;
179
+ const firstState = readState(first);
180
+ if (firstState && (await probe(firstState).catch(() => 'closed')) === 'ours')
181
+ return first;
182
+ for (const file of stateCandidates()) {
183
+ if (file === first || !existsSync(file))
184
+ continue;
185
+ const state = readState(file);
186
+ if (state && (await probe(state).catch(() => 'closed')) === 'ours')
187
+ return file;
188
+ }
189
+ return first;
190
+ }
package/dist/index.js CHANGED
@@ -28,6 +28,7 @@ Getting set up
28
28
 
29
29
  Working
30
30
  eversince tools [name] what this workspace can do, live
31
+ eversince tools --all every tool's input fields, once
31
32
  eversince run <tool> '<json>' call any tool (--wait to follow async work)
32
33
  eversince run <tool> - arguments from stdin
33
34
  eversince upload <files|folder> local files into the library (through the
@@ -97,6 +98,7 @@ const OPTIONS = {
97
98
  workspace: { type: 'string' },
98
99
  out: { type: 'string', short: 'o' },
99
100
  schemas: { type: 'boolean', default: false },
101
+ all: { type: 'boolean', default: false },
100
102
  annotation: { type: 'string' },
101
103
  describe: { type: 'string' },
102
104
  concurrency: { type: 'string' },
@@ -159,7 +161,7 @@ async function main() {
159
161
  case 'workspace':
160
162
  return await workspace({ action: rest[0], target: rest[1] }, connection, mode);
161
163
  case 'tools':
162
- return await tools({ name: rest[0], schemas: values.schemas, annotation: values.annotation }, connection, mode);
164
+ return await tools({ name: rest[0], all: values.all, schemas: values.schemas, annotation: values.annotation }, connection, mode);
163
165
  case 'run':
164
166
  return await run({
165
167
  name: rest[0],
@@ -208,4 +210,14 @@ async function main() {
208
210
  fail(mode, error);
209
211
  }
210
212
  }
213
+ process.stdout.on('error', (error) => {
214
+ if (error.code === 'EPIPE')
215
+ process.exit(0);
216
+ throw error;
217
+ });
218
+ process.stderr.on('error', (error) => {
219
+ if (error.code === 'EPIPE')
220
+ process.exit(0);
221
+ throw error;
222
+ });
211
223
  main().catch((error) => fail({ json: process.argv.includes('--json') }, error));
package/dist/local.js CHANGED
@@ -3,7 +3,7 @@ import { cp, mkdir, rename, rm } from 'node:fs/promises';
3
3
  import { homedir } from 'node:os';
4
4
  import { delimiter, dirname, join, sep } from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
- import { DoorBlocked, probe, reachApp, readState } from './door.js';
6
+ import { DoorBlocked, probe, reachApp, readState, unreachedMessage } from './door.js';
7
7
  import { detectHostAgent, kindForName } from './host-agent.js';
8
8
  export function desktopInstalled() {
9
9
  const state = readState();
@@ -82,7 +82,7 @@ export async function stableLauncher(dryRun) {
82
82
  export async function connectThroughApp(agent, extra = {}) {
83
83
  const state = await reachApp();
84
84
  if (!state?.connectKey)
85
- throw new Error('The Eversince app on this computer did not open. Open it and try again, or run with --cloud.');
85
+ throw new Error(unreachedMessage());
86
86
  const res = await fetch(`http://127.0.0.1:${state.port}/connect`, {
87
87
  method: 'POST',
88
88
  headers: { authorization: `Bearer ${state.connectKey}`, 'content-type': 'application/json' },
@@ -103,7 +103,7 @@ async function connect() {
103
103
  }
104
104
  export async function openApp(onStart) {
105
105
  if (!(await reachApp(undefined, onStart))) {
106
- throw new Error('The Eversince app on this computer did not open. Open it and try again, or run with --cloud.');
106
+ throw new Error(unreachedMessage());
107
107
  }
108
108
  }
109
109
  export async function localDoor(onStart) {
@@ -116,7 +116,7 @@ export async function localDoor(onStart) {
116
116
  }
117
117
  const state = await reachApp(undefined, onStart);
118
118
  if (!state)
119
- throw new Error('The Eversince app on this computer did not open. Open it and try again, or run with --cloud.');
119
+ throw new Error(unreachedMessage());
120
120
  const host = detectHostAgent();
121
121
  const label = host?.name ?? 'CLI agent';
122
122
  const existing = state.connections?.find((c) => c?.label === label && c?.agent === kindForName(host?.name) && typeof c.token === 'string');
@@ -134,7 +134,7 @@ export async function localDoor(onStart) {
134
134
  throw new DoorBlocked();
135
135
  const opened = await reachApp(undefined, onStart);
136
136
  if (!opened)
137
- throw new Error('The Eversince app on this computer did not open. Open it and try again, or run with --cloud.');
137
+ throw new Error(unreachedMessage());
138
138
  return `http://127.0.0.1:${opened.port}`;
139
139
  },
140
140
  };
@@ -1 +1 @@
1
- 5295aed56e667ec559dc7386a87e7c0ea8ac334c4d29823a61042ace137cbe79
1
+ 76558d0f394c159e4e748ea3e71c0f135e71f588067f409fb35449fff9de3a26
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eversince",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
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": {