@quadient/skillshare 1.17.1 β†’ 1.19.0

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.js CHANGED
@@ -1,15 +1,19 @@
1
1
  import { createHash, randomBytes } from 'node:crypto';
2
- import { mkdir, readFile, rm, writeFile } from 'node:fs/promises';
3
- import { hostname, platform, tmpdir } from 'node:os';
4
- import { dirname, join } from 'node:path';
2
+ import { mkdirSync } from 'node:fs';
3
+ import { mkdir, readFile, readdir, rm, stat, writeFile } from 'node:fs/promises';
4
+ import { hostname, homedir, platform, tmpdir } from 'node:os';
5
+ import { dirname, isAbsolute, join } from 'node:path';
5
6
  import { setTimeout as delay } from 'node:timers/promises';
6
7
  import { createClaudeDriver } from './agents-claude.js';
7
- import { defaultServiceEnvironment, detectServiceAgents, installService, renderServiceStatus, serviceLogs, serviceStatus, uninstallService, } from './agents-service.js';
8
+ import { defaultServiceEnvironment, detectServiceAgents, installService, migrateServiceApprovalOptions, renderServiceStatus, serviceLogs, serviceStatus, uninstallService, } from './agents-service.js';
8
9
  import { createCodexDriver } from './agents-codex.js';
9
10
  import { detectAgents, expandHome, profilesPath } from './agents-detect.js';
11
+ import { loadAgentSettings, withoutLegacySandboxArgs } from './agents-settings.js';
10
12
  import { SessionRunner, errorMessage, } from './agents-session.js';
11
13
  import { RESTART_FOR_UPDATE, SERVICE_ENV, WORKER_ENV, acquireListenerLock, compareVersions, describeOtherListener, installVersion, isReleaseVersion, releaseListenerLock, superviseListener, } from './agents-update.js';
12
14
  import { readCliVersion } from './help.js';
15
+ import { uploadSessionEvents } from './agents-request-upload.js';
16
+ import { responseFingerprint } from './agents-response-hash.js';
13
17
  const root = '/api/agents';
14
18
  const PROFILE_HINT = 'Declare named profiles in ' + profilesPath() + ' to set a working directory or extra arguments.';
15
19
  export class AgentsHttpError extends Error {
@@ -101,9 +105,16 @@ export async function runAgentsCommand(client, args, flags, appDirectory, teamsW
101
105
  const max = maxConcurrency(flags);
102
106
  const worker = process.env[WORKER_ENV] === '1';
103
107
  const service = process.env[SERVICE_ENV] === '1';
108
+ if (service)
109
+ await migrateServiceApprovalOptions(appDirectory);
110
+ if (flags.sandbox === 'true') {
111
+ await loadAgentSettings(profilesPath(), true);
112
+ console.log('--sandbox was migrated to the Auto approval default. Change approval modes in Skillshare.');
113
+ }
104
114
  // The listener runs under a supervisor that starts it again on a newer CLI, unless updates are turned off.
105
115
  if (!worker && flags['no-update'] !== 'true') {
106
- const code = await superviseListener({ appDir: appDirectory, args: process.argv.slice(2), ownVersion: readCliVersion(), logFile: flags['log-file'], service });
116
+ const args = withoutLegacySandboxArgs(process.argv.slice(2));
117
+ const code = await superviseListener({ appDir: appDirectory, args, ownVersion: readCliVersion(), logFile: flags['log-file'], service });
107
118
  if (code !== 0)
108
119
  process.exitCode = code;
109
120
  return;
@@ -114,7 +125,6 @@ export async function runAgentsCommand(client, args, flags, appDirectory, teamsW
114
125
  throw new Error(describeOtherListener(other));
115
126
  }
116
127
  const workdir = expandHome(flags.workdir ?? process.cwd());
117
- const sandbox = flags.sandbox === 'true';
118
128
  const user = await client.get('/api/auth/me');
119
129
  const listenerId = await loadListenerId(appDirectory, client.baseUrl, user.id);
120
130
  const abort = new AbortController();
@@ -122,9 +132,7 @@ export async function runAgentsCommand(client, args, flags, appDirectory, teamsW
122
132
  const stop = () => abort.abort();
123
133
  process.on('SIGINT', stop);
124
134
  process.on('SIGTERM', stop);
125
- console.log(sandbox
126
- ? 'Sandboxed: agents may read files, search and use the Skillshare MCP tools, but cannot change files or run commands that modify anything.'
127
- : 'Agents run with your full local permissions and configuration, without permission prompts. Use --sandbox to keep them read-only.');
135
+ console.log('Sessions use the approval mode selected in Skillshare. Already-created sessions retain their permissions.');
128
136
  console.log('Sessions keep their agent running between messages and close it after 15 quiet minutes; the next message resumes it.');
129
137
  // Teams πŸ‘€ sessions need a live Teams session, so the listener keeps it renewed unless told not to.
130
138
  const teams = teamsWatch && flags['no-teams-watch'] !== 'true'
@@ -134,7 +142,7 @@ export async function runAgentsCommand(client, args, flags, appDirectory, teamsW
134
142
  let result = 'stopped';
135
143
  try {
136
144
  result = await listen({
137
- client, listenerId, name: flags.name, workdir, maxConcurrency: max, sandbox, signal: abort.signal, onProgress: console.log, service,
145
+ client, listenerId, name: flags.name, workdir, maxConcurrency: max, signal: abort.signal, onProgress: console.log, service,
138
146
  detect: service ? () => detectServiceAgents(appDirectory) : undefined,
139
147
  updater: worker ? { currentVersion: readCliVersion(), prepare: version => installVersion(appDirectory, version) } : undefined,
140
148
  });
@@ -165,7 +173,7 @@ export function serviceListenArgs(flags) {
165
173
  for (const key of ['name', 'max-concurrency', 'browser', 'browser-profile'])
166
174
  if (flags[key] !== undefined)
167
175
  args.push(`--${key}`, flags[key]);
168
- for (const key of ['sandbox', 'no-teams-watch', 'headless'])
176
+ for (const key of ['no-teams-watch', 'headless'])
169
177
  if (flags[key] === 'true')
170
178
  args.push(`--${key}`);
171
179
  return args;
@@ -178,6 +186,10 @@ export async function runServiceCommand(action, flags, appDirectory, server) {
178
186
  if (!server)
179
187
  throw new Error('agents service install needs a Skillshare server.');
180
188
  maxConcurrency(flags);
189
+ if (flags.sandbox === 'true') {
190
+ await loadAgentSettings(profilesPath(), true);
191
+ console.log('--sandbox was migrated to the Auto approval default. Change approval modes in Skillshare.');
192
+ }
181
193
  const workdir = expandHome(flags.workdir ?? process.cwd());
182
194
  const version = readCliVersion();
183
195
  console.log(`Installing Skillshare CLI ${version} for the agents service…`);
@@ -224,7 +236,7 @@ export function renderDetected(listenerId, server, detected) {
224
236
  if (detected.profiles.length === 0)
225
237
  lines.push(PROFILE_HINT);
226
238
  for (const profile of detected.profiles)
227
- lines.push(`Profile ${profile.name}: ${profile.agent}${profile.model ? ' ' + profile.model : ''}${profile.reasoning ? ' ' + profile.reasoning : ''}${profile.workdir ? ' in ' + profile.workdir : ''}${profile.sandbox ? ' (sandbox)' : ''}`);
239
+ lines.push(`Profile ${profile.name}: ${profile.agent}${profile.model ? ' ' + profile.model : ''}${profile.reasoning ? ' ' + profile.reasoning : ''}${profile.workdir ? ' in ' + profile.workdir : ''}${profile.defaultApprovalMode ? ` (${profile.defaultApprovalMode})` : ''}`);
228
240
  for (const problem of detected.problems)
229
241
  lines.push(`! ${problem}`);
230
242
  return lines.join('\n');
@@ -236,8 +248,10 @@ export async function listen(options) {
236
248
  const driver = options.driver ?? (start => start.configuration.agent === 'codex' ? codex : claude);
237
249
  const wait = options.wait ?? (async (ms, signal) => { await delay(ms, undefined, { signal }); });
238
250
  const now = options.now ?? Date.now;
251
+ const leaseNow = () => performance.now();
239
252
  const log = options.onProgress ?? (() => { });
240
253
  const sessions = new Map();
254
+ const browsing = new Map();
241
255
  // Messages reach a session in order even while earlier ones still download their images.
242
256
  const deliveries = new Map();
243
257
  const imageRoot = options.imageDirectory ?? join(tmpdir(), 'skillshare-agents');
@@ -274,13 +288,22 @@ export async function listen(options) {
274
288
  log(`! Could not download Skillshare CLI ${version} (${error instanceof Error ? error.message : String(error)}). Trying again in 30 minutes.`);
275
289
  }).finally(() => { updating = null; });
276
290
  }
277
- const capabilities = () => options.sandbox ? { ...detected.capabilities, sandbox: true } : detected.capabilities;
291
+ const capabilities = () => ({ ...detected.capabilities, sessionApprovals: true, lockdown: true });
278
292
  async function register() {
279
293
  const fingerprint = JSON.stringify(capabilities());
280
- const registered = await send(options.client, 'PUT', `${root}/listeners/${options.listenerId}`, {
294
+ const requiresApprovalDefaults = Boolean(capabilities().defaultApprovalMode || capabilities().profiles.some(profile => profile.defaultApprovalMode));
295
+ // A dedicated route rejects an older server before it can overwrite restrictions or dispatch queued work.
296
+ const path = `${root}/listeners/${options.listenerId}${requiresApprovalDefaults ? '/register' : ''}`;
297
+ const registered = await send(options.client, 'PUT', path, {
281
298
  name: options.name ?? hostname(), host: hostname(), os: platform(), cliVersion: readCliVersion(), maxConcurrency: options.maxConcurrency,
282
299
  capabilities: capabilities(), service: options.service === true, autoUpdate: options.updater !== undefined,
283
- }, options.signal);
300
+ }, options.signal).catch(error => {
301
+ if (requiresApprovalDefaults && error instanceof AgentsHttpError && error.status === 404)
302
+ throw new Error('Update Skillshare before connecting this listener; this server does not support safe approval-default registration.');
303
+ throw error;
304
+ });
305
+ if (requiresApprovalDefaults && (registered?.approvalDefaultsVersion ?? 0) < 1)
306
+ throw new Error('Update Skillshare before using migrated approval defaults; this server cannot acknowledge them safely.');
284
307
  registeredFingerprint = fingerprint;
285
308
  for (const problem of detected.problems)
286
309
  log(`! ${problem}`);
@@ -288,30 +311,55 @@ export async function listen(options) {
288
311
  }
289
312
  /** Posts a batch of session events: a rejected lease means the server moved on and the agent must stop. */
290
313
  function uploader(sessionId, leaseToken) {
314
+ const acknowledged = new WeakSet();
291
315
  return async (events) => {
292
316
  try {
293
- await send(options.client, 'POST', `${root}/sessions/${sessionId}/events`, { leaseToken, events });
317
+ await uploadSessionEvents(events, leaseToken, (suffix, body) => send(options.client, 'POST', `${root}/sessions/${sessionId}${suffix}`, body), acknowledged);
294
318
  return 'ok';
295
319
  }
296
320
  catch (error) {
297
- if (error instanceof AgentsHttpError && error.status >= 400 && error.status < 500)
321
+ if (error instanceof AgentsHttpError && error.status >= 400 && error.status < 500 && error.status !== 413)
298
322
  return 'gone';
299
323
  return 'retry';
300
324
  }
301
325
  };
302
326
  }
303
- function start(command) {
327
+ function start(command, polledAt) {
304
328
  if (!command.start || !command.leaseToken)
305
329
  return;
330
+ if (!Number.isFinite(command.leaseRemainingMs) || command.leaseRemainingMs <= 0 || polledAt + command.leaseRemainingMs <= leaseNow()) {
331
+ log('! Ignored a start without a current lease. Update Skillshare if this persists.');
332
+ return;
333
+ }
306
334
  // A start for a session already held replaces its agent, for example to hand it fresh credentials.
307
335
  const previous = sessions.get(command.sessionId);
308
336
  if (previous)
309
337
  void previous.stop();
310
- const profile = command.start.configuration.profile ? detected.profiles.find(p => p.name === command.start.configuration.profile) : undefined;
338
+ // A locked-down session gets an empty folder of its own and none of the local profile's arguments or approval settings.
339
+ const lockdown = command.start.lockdown === true;
340
+ const lockdownDir = lockdown ? join(tmpdir(), `skillshare-lockdown-${command.sessionId}-${randomBytes(6).toString('hex')}`) : undefined;
341
+ if (lockdown)
342
+ command.start = { ...command.start, configuration: { ...command.start.configuration, profile: undefined, approvalMode: undefined, sandbox: false, workdir: lockdownDir } };
343
+ const profile = !lockdown && command.start.configuration.profile ? detected.profiles.find(p => p.name === command.start.configuration.profile) : undefined;
344
+ const mode = command.start.configuration.approvalMode;
345
+ const supported = detected.capabilities.agents.find(agent => agent.kind === command.start.configuration.agent)?.approvalModes;
346
+ if (mode && !supported?.includes(mode)) {
347
+ void uploader(command.sessionId, command.leaseToken)([{ type: 'closed', error: `The installed ${command.start.configuration.agent} does not advertise support for approval mode ${mode}. Update the agent and let the listener refresh its capabilities.` }]);
348
+ return;
349
+ }
350
+ if (lockdownDir)
351
+ mkdirSync(lockdownDir, { recursive: true, mode: 0o700 });
311
352
  const runner = new SessionRunner({
312
- sessionId: command.sessionId, leaseToken: command.leaseToken, start: command.start, workdir: options.workdir, profile, sandbox: options.sandbox === true,
353
+ sessionId: command.sessionId, leaseToken: command.leaseToken, start: command.start, workdir: options.workdir, profile, sandbox: false,
313
354
  driver: driver(command.start), upload: uploader(command.sessionId, command.leaseToken), idleMs: options.idleMs, flushIntervalMs: options.flushIntervalMs,
314
355
  now,
356
+ leaseNow, leaseDeadline: polledAt + command.leaseRemainingMs,
357
+ authorizeResponse: async (response) => {
358
+ const result = await send(options.client, 'POST', `${root}/listeners/${options.listenerId}/sessions/${command.sessionId}/authorize-response`, {
359
+ leaseToken: command.leaseToken, requestId: response.requestId, revision: response.revision ?? 0, responseHash: responseFingerprint(response),
360
+ }, options.signal);
361
+ return result?.authorized === true;
362
+ },
315
363
  });
316
364
  sessions.set(command.sessionId, runner);
317
365
  log(`${command.start.resumeThreadId ? 'Resumed' : 'Started'} session ${command.sessionId} "${command.start.title}" with ${label(command.start)}.`);
@@ -321,6 +369,8 @@ export async function listen(options) {
321
369
  deliveries.delete(command.sessionId);
322
370
  await rm(join(imageRoot, command.sessionId), { recursive: true, force: true }).catch(() => { });
323
371
  }
372
+ if (lockdownDir)
373
+ await rm(lockdownDir, { recursive: true, force: true }).catch(() => { });
324
374
  log(`Closed session ${command.sessionId}.`);
325
375
  });
326
376
  deliver(runner, command.messages ?? []);
@@ -336,14 +386,24 @@ export async function listen(options) {
336
386
  void next.finally(() => { if (deliveries.get(runner.sessionId) === next)
337
387
  deliveries.delete(runner.sessionId); });
338
388
  }
339
- function handle(command) {
389
+ function handle(command, polledAt) {
390
+ if (command.type === 'browse' && command.requestId) {
391
+ if (browsing.has(command.requestId))
392
+ return;
393
+ const task = browseDirectories(command.path ?? '').then(result => send(options.client, 'POST', `${root}/listeners/${options.listenerId}/directories/${encodeURIComponent(command.requestId)}`, result)).then(() => { })
394
+ .catch(error => log(`! Directory browsing failed: ${errorMessage(error)}`))
395
+ .finally(() => { browsing.delete(command.requestId); });
396
+ browsing.set(command.requestId, task);
397
+ return;
398
+ }
340
399
  // The id names a local directory that is later deleted, so it must not be able to point elsewhere.
341
400
  if (!isSessionId(command.sessionId))
342
401
  return log(`! Ignored a command for an invalid session id.`);
343
402
  const runner = sessions.get(command.sessionId);
344
403
  switch (command.type) {
345
- case 'start': return start(command);
404
+ case 'start': return start(command, polledAt);
346
405
  case 'send': return runner && deliver(runner, command.messages ?? []);
406
+ case 'respond': return command.response && runner?.respond(command.response);
347
407
  case 'interrupt': return void runner?.interrupt();
348
408
  case 'close': return void runner?.close();
349
409
  }
@@ -363,14 +423,20 @@ export async function listen(options) {
363
423
  if (registeredFingerprint !== JSON.stringify(capabilities()))
364
424
  await register();
365
425
  const polledAt = now();
426
+ const leasePolledAt = leaseNow();
366
427
  const response = await send(options.client, 'POST', `${root}/listeners/${options.listenerId}/poll`, {
367
428
  // A session that is already closing is not reported, so the server treats its agent as gone.
368
429
  sessions: [...sessions.values()].filter(r => !r.stopping).map(r => ({ sessionId: r.sessionId, leaseToken: r.leaseToken })),
369
430
  waitSeconds: options.pollWaitSeconds ?? 25,
370
431
  }, options.signal);
371
432
  failures = 0;
433
+ for (const snapshot of response.leases ?? []) {
434
+ const runner = sessions.get(snapshot.sessionId);
435
+ if (runner?.leaseToken === snapshot.leaseToken && Number.isFinite(snapshot.remainingMs))
436
+ runner.renewLease(leasePolledAt + Math.max(0, snapshot.remainingMs));
437
+ }
372
438
  for (const command of response.commands)
373
- handle(command);
439
+ handle(command, leasePolledAt);
374
440
  considerUpdate(response.cliVersion);
375
441
  if (response.commands.length === 0 && now() - polledAt < 1000)
376
442
  await wait(1000, options.signal).catch(() => { });
@@ -400,6 +466,34 @@ export async function listen(options) {
400
466
  }
401
467
  return result;
402
468
  }
469
+ /** Browse the listener's filesystem without starting an agent or passing a path through a shell. */
470
+ export async function browseDirectories(path) {
471
+ try {
472
+ if (!path) {
473
+ const roots = process.platform === 'win32'
474
+ ? (await Promise.all(Array.from({ length: 26 }, (_, i) => `${String.fromCharCode(65 + i)}:\\`).map(async (root) => {
475
+ try {
476
+ return (await stat(root)).isDirectory() ? root : null;
477
+ }
478
+ catch {
479
+ return null;
480
+ }
481
+ }))).filter((value) => value !== null) : ['/'];
482
+ const directories = [...new Set([homedir(), ...roots])].map(value => ({ name: value, path: value }));
483
+ return { path: '', directories };
484
+ }
485
+ if (!isAbsolute(path))
486
+ throw new Error('Choose an absolute directory on the connected computer.');
487
+ const entries = await readdir(path, { withFileTypes: true });
488
+ const directories = entries.filter(entry => entry.isDirectory()).sort((a, b) => a.name.localeCompare(b.name)).slice(0, 1000)
489
+ .map(entry => ({ name: entry.name, path: join(path, entry.name) }))
490
+ .filter(entry => entry.name.length <= 500 && entry.path.length <= 2000);
491
+ return { path, ...(dirname(path) !== path ? { parent: dirname(path) } : {}), directories };
492
+ }
493
+ catch (error) {
494
+ return { path, directories: [], error: errorMessage(error).slice(0, 2000) };
495
+ }
496
+ }
403
497
  function label(start) {
404
498
  const { configuration } = start;
405
499
  if (configuration.profile)
package/dist/cli-args.js CHANGED
@@ -51,6 +51,9 @@ function assertKnownFlag(commandName, name) {
51
51
  const command = findCommand(commandName);
52
52
  if (!command)
53
53
  return;
54
+ // Compatibility only: old service launchers and scripts still reach the approval-default migration.
55
+ if (command.name === 'agents' && name === 'sandbox')
56
+ return;
54
57
  const allowed = [...GLOBAL_FLAGS, ...command.flags];
55
58
  if (allowed.includes(name))
56
59
  return;
package/dist/help.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { readFileSync } from 'node:fs';
2
2
  export const GLOBAL_FLAGS = ['token', 'server', 'help'];
3
- export const BOOLEAN_FLAGS = new Set(['dry-run', 'force', 'headless', 'help', 'json', 'no-teams-watch', 'no-update', 'resolved', 'sandbox']);
3
+ export const BOOLEAN_FLAGS = new Set(['all', 'digest', 'disabled', 'dry-run', 'force', 'headless', 'help', 'json', 'keep-unread', 'no-teams-watch', 'no-update', 'notify-again', 'original', 'owners-only', 'resolved', 'review', 'sandbox', 'unread']);
4
4
  export const COMMANDS = [
5
5
  {
6
6
  name: 'login',
@@ -110,7 +110,7 @@ export const COMMANDS = [
110
110
  'teams watch [local] [--browser chrome|msedge|chromium]',
111
111
  'teams status | test [--json]',
112
112
  'teams logout',
113
- 'teams access readOnly|fullAccess',
113
+ 'teams access readOnly|limitedAccess|fullAccess',
114
114
  'teams upload <file>',
115
115
  'teams download <url> --output <new-file>',
116
116
  ],
@@ -132,14 +132,51 @@ export const COMMANDS = [
132
132
  name: 'agents',
133
133
  summary: 'Run Claude Code or Codex sessions from Skillshare on this computer',
134
134
  usage: [
135
- 'agents listen [local] [--name <name>] [--workdir <directory>] [--max-concurrency <1-4>] [--sandbox] [--no-teams-watch] [--no-update]',
135
+ 'agents listen [local] [--name <name>] [--workdir <directory>] [--max-concurrency <1-4>] [--no-teams-watch] [--no-update]',
136
136
  'agents status [local] [--json]',
137
- 'agents service install [local] [--name <name>] [--workdir <directory>] [--max-concurrency <1-4>] [--sandbox] [--no-teams-watch]',
137
+ 'agents service install [local] [--name <name>] [--workdir <directory>] [--max-concurrency <1-4>] [--no-teams-watch]',
138
138
  'agents service status | logs [--lines <n>] | uninstall',
139
139
  ],
140
- description: 'A listener reports the installed agents, their models and reasoning levels, and the local profiles from ~/.config/skillshare/agents.json. It runs Claude Code and Codex sessions that you start and continue under Sessions in Skillshare; under Connected agents you choose which listener and configuration runs Teams πŸ‘€ sessions. Agents use your own login and run with your full local permissions, without permission prompts, unless --sandbox (or "sandbox": true in a profile) keeps them read-only. An idle agent is stopped after 15 minutes and resumed by the next message. With a Teams connection, the listener also keeps the Teams session renewed through local browser SSO, as skillshare teams watch does; --no-teams-watch turns that off. The listener updates itself: when Skillshare releases a newer CLI, it downloads it and restarts on it once no turn is running (--no-update turns that off). agents service install runs the listener in the background, started at every login (a launchd agent on macOS, a systemd user service on Linux, a scheduled task on Windows); status, logs and uninstall manage it.',
140
+ description: 'A listener reports the installed agents, their models and reasoning levels, and the local profiles from ~/.config/skillshare/agents.json. It runs Claude Code and Codex sessions that you start and continue under Sessions in Skillshare; under Connected agents you choose which listener and configuration runs Teams πŸ‘€ sessions. Agents use your own login and the approval mode chosen in Skillshare: Supervised, Auto-accept edits, Auto or Full access. Already-created sessions retain their permissions. An idle agent is stopped after 15 minutes and resumed by the next message. With a Teams connection, the listener also keeps the Teams session renewed through local browser SSO, as skillshare teams watch does; --no-teams-watch turns that off. The listener updates itself: when Skillshare releases a newer CLI, it downloads it and restarts on it once no turn is running (--no-update turns that off). agents service install runs the listener in the background, started at every login (a launchd agent on macOS, a systemd user service on Linux, a scheduled task on Windows); status, logs and uninstall manage it.',
141
141
  examples: ['skillshare agents status', 'skillshare agents listen --workdir ~/Research', 'skillshare agents service install --workdir ~/Research'],
142
- flags: ['name', 'workdir', 'max-concurrency', 'sandbox', 'no-teams-watch', 'no-update', 'log-file', 'lines', 'browser', 'headless', 'browser-profile', 'json'],
142
+ flags: ['name', 'workdir', 'max-concurrency', 'no-teams-watch', 'no-update', 'log-file', 'lines', 'browser', 'headless', 'browser-profile', 'json'],
143
+ },
144
+ {
145
+ name: 'news',
146
+ summary: 'Read, write and follow news',
147
+ usage: [
148
+ 'news [list] [--tag <slug>] [--importance <level>] [--unread] [--all] [--search <text>] [--limit <n>] [--before <cursor>] [--json]',
149
+ 'news show <id> [--keep-unread] [--json]',
150
+ 'news read <id>... | news read --all [--tag <slug>] [--importance <level>]',
151
+ 'news unread <id>...',
152
+ 'news post --title <title> --tags <slug>[,<slug>...] [--importance <level>] [--date <date>] [--lang <locale>] [--file <path> | <text> | -]',
153
+ 'news edit <id> [--title <title>] [--tags <slugs>] [--importance <level>] [--date <date>] [--file <path> | <text> | -] [--notify-again]',
154
+ 'news delete <id>',
155
+ 'news tags [<search>] [--json]',
156
+ 'news tag show <slug> | news tag create <slug> [--name <name>] [--description <text>] [--owners-only] [--lang <locale>]',
157
+ 'news tag edit <slug> [--name <name>] [--description <text>] [--owners-only true|false] [--owners <userId>,...]',
158
+ 'news subscribe <slug> [--importance important|normal|cosmetic]',
159
+ 'news unsubscribe <slug> | news subscriptions',
160
+ 'news show <id> [--lang <locale>] [--original]',
161
+ 'news notify on|off',
162
+ 'news review <tag> | news publish <draft id>',
163
+ 'news repos | news branches <repository> [--branches <regex>]',
164
+ 'news feeds <tag>',
165
+ 'news feed create <tag> --repo <alias> --branches <regex> [--digest] [--review] [--agent <listener>[:claude|codex[/<model>]]] [--backfill <days>]',
166
+ 'news feed edit <feed id> --tag <tag> [--repo …] [--branches …] [--digest true|false] [--review true|false] [--agent …|auto] [--disabled true|false]',
167
+ 'news feed run|preview|delete <feed id>',
168
+ ],
169
+ description: 'Without --all, list shows your feed: news from the tags you follow, at or above the importance you chose for each. --all lists everything (with --tag, one tag whether or not you follow it). Levels are important, normal and cosmetic; following with cosmetic shows everything. show marks the item read like opening it in the browser. read --all marks the whole feed (or one tag / importance) read and prints the command to undo it. post reads the Markdown text from --file, the arguments or stdin, and is written in your language: --lang, otherwise the language you last chose in the web app. A future --date schedules the item. Creating a tag makes you its owner and follower. News is shown in your language (--lang, else the one you chose in the web app); a missing translation is made by the agent of the author or a tag owner, locked down, and the original is shown meanwhile (--original always shows it). Repo feeds turn merged pull requests and commits of branches matching a regex into news of a tag: the connected agent of the feed owner, locked down, classifies each change as important, normal or cosmetic and writes it in all four languages. --review keeps that news as drafts for news review/publish; --digest writes one item a day; feed preview lets the agent write from recent changes without publishing. news branches shows which branches a regex follows. notify on sends browser notifications for important news in your feed.',
170
+ examples: [
171
+ 'skillshare news --unread',
172
+ 'skillshare news show 42',
173
+ 'skillshare news read --all --tag platform',
174
+ 'skillshare news post --title "Release 2.0" --tags platform,web --importance important --file notes.md',
175
+ 'skillshare news subscribe platform --importance important',
176
+ ],
177
+ flags: ['tag', 'importance', 'unread', 'all', 'search', 'limit', 'before', 'keep-unread', 'title', 'tags', 'date', 'lang', 'file',
178
+ 'notify-again', 'name', 'description', 'owners-only', 'owners', 'original', 'repo', 'branches', 'digest', 'review', 'agent', 'backfill',
179
+ 'disabled', 'json'],
143
180
  },
144
181
  {
145
182
  name: 'git',
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { refreshSession, withSessionLock, writeSessionAtomically } from './session-auth.js';
2
2
  import { configurePageLinks } from './page-links.js';
3
3
  import { runSalesforceCommand } from './salesforce.js';
4
+ import { runNewsCommand } from './news.js';
4
5
  import { assertCredentialDestination, resolveTeamsObjectId, runTeamsCommand, watchTeamsInBackground } from './teams.js';
5
6
  import { runAgentsCommand, runServiceCommand } from './agents.js';
6
7
  import { SERVICE_ENV } from './agents-update.js';
@@ -159,6 +160,14 @@ async function main() {
159
160
  await runSalesforceCommand(await createClient(baseUrl, options.token), options.positionals, options.flags, openBrowser);
160
161
  return;
161
162
  }
163
+ case 'news': {
164
+ const baseUrl = options.flags.server ?? await resolveActiveBaseUrl();
165
+ assertCredentialDestination(baseUrl);
166
+ if (!options.token && !await loadSession(baseUrl))
167
+ await login(baseUrl);
168
+ await runNewsCommand(await createClient(baseUrl, options.token), options.positionals, options.flags, print);
169
+ return;
170
+ }
162
171
  case 'agents': {
163
172
  // Managing the background service needs no server, except to install it.
164
173
  if (options.positionals[0] === 'service' && options.positionals[1] !== 'install') {