@quadient/skillshare 1.14.0 → 1.15.1
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/agents-claude.js +9 -1
- package/dist/agents-codex.js +23 -0
- package/dist/agents-session.js +6 -0
- package/dist/agents-update.js +5 -1
- package/dist/agents.js +8 -2
- package/dist/help.js +1 -1
- package/dist/index.js +11 -9
- package/package.json +1 -1
package/dist/agents-claude.js
CHANGED
|
@@ -170,6 +170,8 @@ class ClaudeDriver {
|
|
|
170
170
|
cwd: workdir,
|
|
171
171
|
env: {
|
|
172
172
|
...mcpTokenEnvironment(servers), SKILLSHARE_SESSION_ID: this.context.sessionId,
|
|
173
|
+
// Claude Code holds suggestions back when the account nears a rate limit; the user can still turn them off with this variable.
|
|
174
|
+
CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION: process.env.CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION ?? 'true',
|
|
173
175
|
// Claude Code lets auto-memory write to its own folder even under the read-only allowlist; a sandboxed session writes nothing.
|
|
174
176
|
...(isSandboxed(this.context.start.configuration, this.context) ? { CLAUDE_CODE_DISABLE_AUTO_MEMORY: '1' } : {}),
|
|
175
177
|
},
|
|
@@ -178,7 +180,8 @@ class ClaudeDriver {
|
|
|
178
180
|
});
|
|
179
181
|
void this.process.exited.then(code => this.onExit(code));
|
|
180
182
|
// Claude Code answers initialize once it is ready, which turns a bad install or a bad flag into a clear start failure.
|
|
181
|
-
|
|
183
|
+
// Suggestions come after a turn's result; versions without them ignore the field.
|
|
184
|
+
await this.control({ subtype: 'initialize', promptSuggestions: true });
|
|
182
185
|
if (this.context.start.resumeThreadId)
|
|
183
186
|
this.adopt(this.context.start.resumeThreadId);
|
|
184
187
|
}
|
|
@@ -303,6 +306,11 @@ class ClaudeDriver {
|
|
|
303
306
|
return frame.isReplay === true ? this.replayed(frame.message?.content) : this.toolResults(frame.message?.content);
|
|
304
307
|
case 'result':
|
|
305
308
|
return this.result(frame);
|
|
309
|
+
case 'prompt_suggestion':
|
|
310
|
+
// A suggestion that arrives after the next message was written answers a conversation that has moved on.
|
|
311
|
+
if (!this.current && this.echoes.length === 0 && typeof frame.suggestion === 'string')
|
|
312
|
+
this.context.suggestion(frame.suggestion);
|
|
313
|
+
return;
|
|
306
314
|
}
|
|
307
315
|
}
|
|
308
316
|
/** Text arrives in deltas first; the complete assistant frame later replaces it under the same key. */
|
package/dist/agents-codex.js
CHANGED
|
@@ -117,6 +117,10 @@ class CodexDriver {
|
|
|
117
117
|
threadId = null;
|
|
118
118
|
current = null;
|
|
119
119
|
texts = new Map();
|
|
120
|
+
/** The last finished turn, the only one whose predicted next message is still worth showing. */
|
|
121
|
+
lastTurnId = null;
|
|
122
|
+
/** Cleared once Codex says it cannot predict, so later turns do not ask again. */
|
|
123
|
+
predictions = true;
|
|
120
124
|
closing = false;
|
|
121
125
|
constructor(context, options) {
|
|
122
126
|
this.context = context;
|
|
@@ -199,6 +203,15 @@ class CodexDriver {
|
|
|
199
203
|
this.closing = true;
|
|
200
204
|
await this.process?.kill();
|
|
201
205
|
}
|
|
206
|
+
/** Asks for the user's likely next message; it arrives as thread/prediction/updated. Codex 0.162 declares the method but does not implement it yet. */
|
|
207
|
+
predict() {
|
|
208
|
+
if (!this.predictions || !this.threadId || !this.lastTurnId)
|
|
209
|
+
return;
|
|
210
|
+
this.request('thread/prediction/request', { threadId: this.threadId, sourceTurnId: this.lastTurnId }).catch(error => {
|
|
211
|
+
if (/not implemented|method not found|unknown variant/i.test(String(error?.message)))
|
|
212
|
+
this.predictions = false;
|
|
213
|
+
});
|
|
214
|
+
}
|
|
202
215
|
request(method, params) {
|
|
203
216
|
if (!this.process)
|
|
204
217
|
return Promise.reject(new Error('Codex is not running.'));
|
|
@@ -314,6 +327,16 @@ class CodexDriver {
|
|
|
314
327
|
current.resolve(status === 'failed'
|
|
315
328
|
? { status, error: codexErrorText(turn.error?.message) ?? current.error ?? 'The turn failed.', stats }
|
|
316
329
|
: { status, stats });
|
|
330
|
+
this.lastTurnId = typeof turn.id === 'string' ? turn.id : current.id ?? null;
|
|
331
|
+
if (status === 'completed')
|
|
332
|
+
this.predict();
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
case 'thread/prediction/updated': {
|
|
336
|
+
const result = params.result ?? {};
|
|
337
|
+
if (this.current || params.sourceTurnId !== this.lastTurnId || result.type !== 'completed' || typeof result.text !== 'string')
|
|
338
|
+
return;
|
|
339
|
+
this.context.suggestion(result.text);
|
|
317
340
|
return;
|
|
318
341
|
}
|
|
319
342
|
}
|
package/dist/agents-session.js
CHANGED
|
@@ -5,6 +5,7 @@ export const SANDBOX_NOTE = 'This session is sandboxed: you can read files, sear
|
|
|
5
5
|
'run commands that modify anything.';
|
|
6
6
|
export const DEFAULT = 'default';
|
|
7
7
|
const MAX_TEXT = 50_000;
|
|
8
|
+
const MAX_SUGGESTION = 2_000;
|
|
8
9
|
export function isSandboxed(configuration, options) {
|
|
9
10
|
return options.sandbox === true || options.profile?.sandbox === true || configuration.sandbox === true;
|
|
10
11
|
}
|
|
@@ -152,6 +153,11 @@ export class SessionRunner {
|
|
|
152
153
|
sandbox: options.sandbox,
|
|
153
154
|
item: item => this.events.push({ type: 'item', ...item, text: item.text === undefined ? undefined : clip(item.text) }),
|
|
154
155
|
thread: threadId => this.events.push({ type: 'thread', threadId }),
|
|
156
|
+
suggestion: text => {
|
|
157
|
+
if (this.busy || this.closing || !text.trim())
|
|
158
|
+
return;
|
|
159
|
+
this.events.push({ type: 'suggestion', text: clip(text.trim(), MAX_SUGGESTION) });
|
|
160
|
+
},
|
|
155
161
|
exited: error => void this.finish(error ?? 'The agent stopped unexpectedly.'),
|
|
156
162
|
});
|
|
157
163
|
}
|
package/dist/agents-update.js
CHANGED
|
@@ -67,7 +67,10 @@ export function npmCommand() {
|
|
|
67
67
|
* Installs a CLI version into its own directory under versions, without touching a global install, so no administrator
|
|
68
68
|
* rights are needed. It lands under a temporary name first, so a listener never starts a half-installed version.
|
|
69
69
|
*/
|
|
70
|
+
export const isReleaseVersion = (version) => /^\d{1,6}\.\d{1,6}\.\d{1,6}$/.test(version);
|
|
70
71
|
export async function installVersion(appDir, version, options = {}) {
|
|
72
|
+
if (!isReleaseVersion(version))
|
|
73
|
+
throw new Error(`Refusing to install an invalid CLI version "${version}".`);
|
|
71
74
|
if ((await installedVersions(appDir)).includes(version))
|
|
72
75
|
return;
|
|
73
76
|
const target = join(versionsDirectory(appDir), version);
|
|
@@ -79,7 +82,8 @@ export async function installVersion(appDir, version, options = {}) {
|
|
|
79
82
|
await writeFile(join(staging, 'package.json'), JSON.stringify({ private: true }));
|
|
80
83
|
const npm = npmCommand();
|
|
81
84
|
const result = await (options.run ?? runCommand)(npm.command, [...npm.args, 'install', '--prefix', staging, '--no-audit', '--no-fund',
|
|
82
|
-
|
|
85
|
+
// Package scripts never run during an update; the CLI and its dependencies do not need them.
|
|
86
|
+
'--omit=dev', '--no-package-lock', '--ignore-scripts', options.spec ?? `${PACKAGE_NAME}@${version}`], { cwd: staging });
|
|
83
87
|
if (result.code !== 0)
|
|
84
88
|
throw new Error(`npm could not install ${PACKAGE_NAME}@${version}: ${lastLine(result.stderr) || `exit code ${result.code}`}`);
|
|
85
89
|
const installed = join(staging, 'node_modules', '@quadient', 'skillshare');
|
package/dist/agents.js
CHANGED
|
@@ -8,7 +8,7 @@ import { defaultServiceEnvironment, detectServiceAgents, installService, renderS
|
|
|
8
8
|
import { createCodexDriver } from './agents-codex.js';
|
|
9
9
|
import { detectAgents, expandHome, profilesPath } from './agents-detect.js';
|
|
10
10
|
import { SessionRunner, errorMessage, } from './agents-session.js';
|
|
11
|
-
import { RESTART_FOR_UPDATE, SERVICE_ENV, WORKER_ENV, acquireListenerLock, compareVersions, describeOtherListener, installVersion, releaseListenerLock, superviseListener, } from './agents-update.js';
|
|
11
|
+
import { RESTART_FOR_UPDATE, SERVICE_ENV, WORKER_ENV, acquireListenerLock, compareVersions, describeOtherListener, installVersion, isReleaseVersion, releaseListenerLock, superviseListener, } from './agents-update.js';
|
|
12
12
|
import { readCliVersion } from './help.js';
|
|
13
13
|
const root = '/api/agents';
|
|
14
14
|
const PROFILE_HINT = 'Declare named profiles in ' + profilesPath() + ' to set a working directory or extra arguments.';
|
|
@@ -253,7 +253,8 @@ export async function listen(options) {
|
|
|
253
253
|
let result = 'stopped';
|
|
254
254
|
function considerUpdate(version) {
|
|
255
255
|
const current = options.updater?.currentVersion ?? readCliVersion();
|
|
256
|
-
|
|
256
|
+
// Only a plain release number; npm would read anything else as a git, URL or file package spec.
|
|
257
|
+
if (!version || !isReleaseVersion(version) || compareVersions(version, current) <= 0 || updateReady === version || updating === version)
|
|
257
258
|
return;
|
|
258
259
|
if (!options.updater) {
|
|
259
260
|
if (updateMentioned !== version)
|
|
@@ -336,6 +337,9 @@ export async function listen(options) {
|
|
|
336
337
|
deliveries.delete(runner.sessionId); });
|
|
337
338
|
}
|
|
338
339
|
function handle(command) {
|
|
340
|
+
// The id names a local directory that is later deleted, so it must not be able to point elsewhere.
|
|
341
|
+
if (!isSessionId(command.sessionId))
|
|
342
|
+
return log(`! Ignored a command for an invalid session id.`);
|
|
339
343
|
const runner = sessions.get(command.sessionId);
|
|
340
344
|
switch (command.type) {
|
|
341
345
|
case 'start': return start(command);
|
|
@@ -408,3 +412,5 @@ function describe(detected) {
|
|
|
408
412
|
const profiles = detected.profiles.length ? `, profiles ${detected.profiles.map(p => p.name).join(', ')}` : '';
|
|
409
413
|
return (agents.length ? agents.join(', ') : 'no supported agent found') + profiles;
|
|
410
414
|
}
|
|
415
|
+
// Session ids from the server name local directories (pasted images); only plain identifiers are accepted.
|
|
416
|
+
export const isSessionId = (id) => typeof id === 'string' && /^[A-Za-z0-9_-]{1,64}$/.test(id);
|
package/dist/help.js
CHANGED
|
@@ -166,7 +166,7 @@ export function renderUsage(defaultUrl) {
|
|
|
166
166
|
...COMMANDS.map((command) => ` ${command.name.padEnd(width)} ${command.summary}`),
|
|
167
167
|
'',
|
|
168
168
|
'Options:',
|
|
169
|
-
' --token <token> Bearer token for API requests
|
|
169
|
+
' --token <token> Bearer token for API requests; visible in the process list, prefer SKILLSHARE_TOKEN',
|
|
170
170
|
' --server <url> Skillshare origin for login and Teams commands',
|
|
171
171
|
' --json Print machine-readable JSON (whoami, list, show, upload, pages, teams, salesforce, agents)',
|
|
172
172
|
' -h, --help Show help for a command',
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import { createServer } from 'node:http';
|
|
|
14
14
|
import { createHash, randomBytes } from 'node:crypto';
|
|
15
15
|
import { spawn } from 'node:child_process';
|
|
16
16
|
import { existsSync } from 'node:fs';
|
|
17
|
-
import { mkdir, open, readFile, readdir, rm, stat, writeFile } from 'node:fs/promises';
|
|
17
|
+
import { chmod, mkdir, open, readFile, readdir, rm, stat, writeFile } from 'node:fs/promises';
|
|
18
18
|
import { basename, join, relative, resolve } from 'node:path';
|
|
19
19
|
import { homedir } from 'node:os';
|
|
20
20
|
import { cancel, confirm, intro, isCancel, log, multiselect, outro, progress, select, spinner, text } from '@clack/prompts';
|
|
@@ -1887,10 +1887,15 @@ async function loadAnySession() {
|
|
|
1887
1887
|
}
|
|
1888
1888
|
}
|
|
1889
1889
|
async function storeSession(session) {
|
|
1890
|
-
await
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1890
|
+
await writePrivateFile(SESSION_PATH, JSON.stringify(session));
|
|
1891
|
+
}
|
|
1892
|
+
// Tokens and state stay readable by the current user only; the mode of writeFile applies just to new files.
|
|
1893
|
+
async function writePrivateFile(path, content) {
|
|
1894
|
+
const posix = process.platform !== 'win32';
|
|
1895
|
+
await mkdir(APP_DIR, { recursive: true, mode: posix ? 0o700 : undefined });
|
|
1896
|
+
await writeFile(path, content, { mode: posix ? 0o600 : undefined });
|
|
1897
|
+
if (posix)
|
|
1898
|
+
await chmod(path, 0o600);
|
|
1894
1899
|
}
|
|
1895
1900
|
async function logoutSession() {
|
|
1896
1901
|
try {
|
|
@@ -2120,10 +2125,7 @@ async function readStateFile(path) {
|
|
|
2120
2125
|
}
|
|
2121
2126
|
}
|
|
2122
2127
|
async function writeStateFile(path, value) {
|
|
2123
|
-
await
|
|
2124
|
-
await writeFile(path, `${JSON.stringify(value, null, 2)}\n`, {
|
|
2125
|
-
mode: process.platform === 'win32' ? undefined : 0o600,
|
|
2126
|
-
});
|
|
2128
|
+
await writePrivateFile(path, `${JSON.stringify(value, null, 2)}\n`);
|
|
2127
2129
|
}
|
|
2128
2130
|
async function removeLegacyLocalSkillMetadata(directory) {
|
|
2129
2131
|
try {
|