eversince 0.2.13 → 0.2.15
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 +4 -3
- package/dist/bridge.js +8 -0
- package/dist/client.js +9 -4
- package/dist/commands/jobs.js +1 -0
- package/dist/commands/run.js +11 -1
- package/dist/commands/workspace.js +21 -8
- package/dist/index.js +2 -1
- package/dist/source.sha256 +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -129,9 +129,10 @@ eversince workspace use "Studio" # the CLI acts here from now on
|
|
|
129
129
|
eversince workspace clear # back to the account default
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
-
The choice is the CLI's own and travels on each request
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
The choice is the CLI's own and travels on each request, among the workspaces the
|
|
133
|
+
user allowed this sign-in. It does not move the workspace that connected agents are
|
|
134
|
+
using. An API key moves within its own workspaces with
|
|
135
|
+
`eversince run manage_settings '{"switch_workspace":"<name|id>"}'`.
|
|
135
136
|
|
|
136
137
|
## Options
|
|
137
138
|
|
package/dist/bridge.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
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
|
+
const EMPTY_LISTS = {
|
|
5
|
+
'resources/list': { resources: [] },
|
|
6
|
+
'resources/templates/list': { resourceTemplates: [] },
|
|
7
|
+
'prompts/list': { prompts: [] },
|
|
8
|
+
};
|
|
4
9
|
function write(message) {
|
|
5
10
|
process.stdout.write(`${typeof message === 'string' ? message : JSON.stringify(message)}\n`);
|
|
6
11
|
}
|
|
@@ -68,6 +73,9 @@ export function runBridge(options) {
|
|
|
68
73
|
return {};
|
|
69
74
|
if (message.method === 'ping')
|
|
70
75
|
return { reply: { jsonrpc: '2.0', id, result: {} } };
|
|
76
|
+
const empty = EMPTY_LISTS[message.method];
|
|
77
|
+
if (empty)
|
|
78
|
+
return { reply: { jsonrpc: '2.0', id, result: empty } };
|
|
71
79
|
const cache = readJson(cacheFile);
|
|
72
80
|
if (!cache)
|
|
73
81
|
return null;
|
package/dist/client.js
CHANGED
|
@@ -64,7 +64,7 @@ export class Client {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
const baseUrl = await resolveBaseUrl(opts.baseUrl);
|
|
67
|
-
const workspace = await resolveWorkspace(baseUrl, opts.workspace);
|
|
67
|
+
const workspace = opts.noWorkspace ? undefined : await resolveWorkspace(baseUrl, opts.workspace);
|
|
68
68
|
const credentials = opts.credentials ?? (await loadCredentials(baseUrl));
|
|
69
69
|
if (!credentials)
|
|
70
70
|
throw new NotLoggedIn(hostOf(baseUrl));
|
|
@@ -89,7 +89,12 @@ export class Client {
|
|
|
89
89
|
whole: true,
|
|
90
90
|
}));
|
|
91
91
|
const media = Array.isArray(envelope?.media) ? envelope.media : [];
|
|
92
|
-
|
|
92
|
+
const spent = envelope?.meta?.cloud_processing;
|
|
93
|
+
return {
|
|
94
|
+
data: envelope && typeof envelope === 'object' && 'data' in envelope ? envelope.data : envelope,
|
|
95
|
+
media,
|
|
96
|
+
...(spent && typeof spent === 'object' ? { cloudProcessing: spent } : {}),
|
|
97
|
+
};
|
|
93
98
|
}
|
|
94
99
|
async headers(method, options) {
|
|
95
100
|
await this.ensureFreshToken();
|
|
@@ -100,7 +105,7 @@ export class Client {
|
|
|
100
105
|
};
|
|
101
106
|
if (options.body !== undefined)
|
|
102
107
|
headers['content-type'] = 'application/json';
|
|
103
|
-
if (this.workspace
|
|
108
|
+
if (this.workspace)
|
|
104
109
|
headers['x-workspace-id'] = this.workspace;
|
|
105
110
|
if (method !== 'GET')
|
|
106
111
|
headers['idempotency-key'] = options.idempotencyKey ?? randomUUID();
|
|
@@ -108,7 +113,7 @@ export class Client {
|
|
|
108
113
|
}
|
|
109
114
|
async ensureFreshToken() {
|
|
110
115
|
const { kind, expiresAt, refreshToken, clientId } = this.credentials;
|
|
111
|
-
if (kind !== 'oauth' ||
|
|
116
|
+
if (kind !== 'oauth' || expiresAt === undefined || Date.now() < expiresAt)
|
|
112
117
|
return;
|
|
113
118
|
if (!refreshToken || !clientId) {
|
|
114
119
|
throw new ApiError(401, {
|
package/dist/commands/jobs.js
CHANGED
|
@@ -43,6 +43,7 @@ export function describe(job) {
|
|
|
43
43
|
job.retrying ? 'retrying' : null,
|
|
44
44
|
job.eta_seconds ? roughly(job.eta_seconds) : null,
|
|
45
45
|
job.refunded ? 'refunded' : null,
|
|
46
|
+
job.status === 'cancelled' && job.cloud_minutes === 0 ? 'nothing charged' : null,
|
|
46
47
|
job.note ?? null,
|
|
47
48
|
job.error?.message ?? null,
|
|
48
49
|
job.error?.charged ? 'charged' : null,
|
package/dist/commands/run.js
CHANGED
|
@@ -58,6 +58,11 @@ export function jobIdsIn(result) {
|
|
|
58
58
|
if (typeof value === 'string')
|
|
59
59
|
ids.push(value);
|
|
60
60
|
}
|
|
61
|
+
if (Array.isArray(r.job_ids)) {
|
|
62
|
+
for (const id of r.job_ids)
|
|
63
|
+
if (typeof id === 'string')
|
|
64
|
+
ids.push(id);
|
|
65
|
+
}
|
|
61
66
|
for (const key of ['jobs', 'items']) {
|
|
62
67
|
const value = r[key];
|
|
63
68
|
if (Array.isArray(value)) {
|
|
@@ -65,6 +70,8 @@ export function jobIdsIn(result) {
|
|
|
65
70
|
ids.push(...jobIdsIn(entry));
|
|
66
71
|
}
|
|
67
72
|
}
|
|
73
|
+
if (r.prepared && typeof r.prepared === 'object')
|
|
74
|
+
ids.push(...jobIdsIn(r.prepared));
|
|
68
75
|
return [...new Set(ids)];
|
|
69
76
|
}
|
|
70
77
|
export async function run(argv, connection, mode) {
|
|
@@ -85,7 +92,10 @@ export async function run(argv, connection, mode) {
|
|
|
85
92
|
const answered = await client.toolWithMedia(argv.name, input, { idempotencyKey: argv.idempotencyKey });
|
|
86
93
|
const saved = await saveMedia(answered.media, argv.name, argv.out);
|
|
87
94
|
const pictures = saved.filter((p) => !!p);
|
|
88
|
-
const
|
|
95
|
+
const drawn = pictures.length ? { ...withPicturePaths(answered.data, saved), pictures } : answered.data;
|
|
96
|
+
const result = answered.cloudProcessing && drawn && typeof drawn === 'object' && !Array.isArray(drawn)
|
|
97
|
+
? { ...drawn, cloud_processing: answered.cloudProcessing }
|
|
98
|
+
: drawn;
|
|
89
99
|
if (!argv.wait) {
|
|
90
100
|
printResult(mode, result, () => {
|
|
91
101
|
line(JSON.stringify(result, null, 2));
|
|
@@ -5,6 +5,10 @@ async function list(client) {
|
|
|
5
5
|
const data = (await client.get('/api/v1/workspaces'));
|
|
6
6
|
return data.workspaces ?? [];
|
|
7
7
|
}
|
|
8
|
+
async function allowedOf(client) {
|
|
9
|
+
const data = (await client.tool('manage_settings', { workspaces: true }));
|
|
10
|
+
return data?.workspaces ?? [];
|
|
11
|
+
}
|
|
8
12
|
export async function workspace(argv, connection, mode) {
|
|
9
13
|
const baseUrl = await resolveBaseUrl(connection.baseUrl);
|
|
10
14
|
const action = argv.action ?? 'list';
|
|
@@ -18,19 +22,24 @@ export async function workspace(argv, connection, mode) {
|
|
|
18
22
|
if (!argv.target)
|
|
19
23
|
throw new Error('Which workspace? `eversince workspace use <name|id>`');
|
|
20
24
|
if (client.authKind === 'api_key') {
|
|
21
|
-
throw new Error('
|
|
25
|
+
throw new Error('An API key moves between its workspaces with `eversince run manage_settings \'{"switch_workspace":"<name|id>"}\'`; `eversince run manage_settings \'{"workspaces":true}\'` lists them.');
|
|
22
26
|
}
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
+
const own = await Client.create({ ...connection, baseUrl, noWorkspace: true });
|
|
28
|
+
const [workspaces, allowed] = await Promise.all([list(client), allowedOf(own)]);
|
|
29
|
+
const target = argv.target.trim();
|
|
30
|
+
const find = (pool) => pool.find((w) => w.id === target) ?? pool.find((w) => (w.name ?? '').trim().toLowerCase() === target.toLowerCase());
|
|
31
|
+
const match = find(allowed);
|
|
27
32
|
if (!match) {
|
|
28
|
-
|
|
33
|
+
const elsewhere = find(workspaces);
|
|
34
|
+
if (elsewhere) {
|
|
35
|
+
throw new Error(`This connection is not allowed in ${elsewhere.name ?? elsewhere.id}. The user adds it in Eversince Settings, Agents.`);
|
|
36
|
+
}
|
|
37
|
+
throw new Error(`No workspace called "${argv.target}". \`eversince workspace\` marks the ones this sign-in may use.`);
|
|
29
38
|
}
|
|
30
39
|
await setWorkspaceFor(baseUrl, match.id);
|
|
31
40
|
printResult(mode, { workspace: match }, () => {
|
|
32
41
|
line(`Now working in ${match.name}.`);
|
|
33
|
-
note('This applies to the CLI only.
|
|
42
|
+
note('This applies to the CLI only. A connected agent moves its own with manage_settings switch_workspace.');
|
|
34
43
|
});
|
|
35
44
|
return;
|
|
36
45
|
}
|
|
@@ -41,10 +50,14 @@ export async function workspace(argv, connection, mode) {
|
|
|
41
50
|
return;
|
|
42
51
|
}
|
|
43
52
|
const width = Math.max(...workspaces.map((w) => (w.name ?? '').length)) + 2;
|
|
53
|
+
const marked = workspaces.some((w) => w.allowed === false);
|
|
44
54
|
for (const w of workspaces) {
|
|
45
55
|
const marker = current === w.id ? '*' : ' ';
|
|
46
|
-
|
|
56
|
+
const scope = marked ? pad(w.allowed === false ? 'not allowed' : 'allowed', 13) : '';
|
|
57
|
+
line(`${marker} ${pad(w.name ?? '(unnamed)', width)}${pad(w.role ?? '', 8)}${scope}${w.id}`);
|
|
47
58
|
}
|
|
59
|
+
if (marked)
|
|
60
|
+
note(`\nA workspace marked not allowed is added in Eversince Settings, ${client.authKind === 'api_key' ? 'API keys' : 'Agents'}.`);
|
|
48
61
|
if (!current)
|
|
49
62
|
note(`\nNo CLI workspace set for ${hostOf(baseUrl)}. Using the account default.`);
|
|
50
63
|
});
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,8 @@ Working
|
|
|
30
30
|
eversince tools [name] what this workspace can do, live
|
|
31
31
|
eversince tools --all every tool's input fields, once
|
|
32
32
|
eversince run <tool> '<json>' call any tool (--wait to follow async work)
|
|
33
|
-
eversince run <tool> - arguments from stdin
|
|
33
|
+
eversince run <tool> - arguments from stdin: for JSON holding an
|
|
34
|
+
apostrophe, which ends a '<json>' argument
|
|
34
35
|
eversince upload <files|folder> local files into the library (through the
|
|
35
36
|
desktop app, media is added where it sits)
|
|
36
37
|
eversince download <refs…> library items onto disk
|
package/dist/source.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
d0a7b9d8353f8d72ab5f3d9cbc94d4ea0ec872d5fe7831cac380fb5a6bb44f31
|
package/package.json
CHANGED