@parall/cli 1.60.0 → 1.62.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.
Files changed (37) hide show
  1. package/dist/commands/agents.d.ts +9 -0
  2. package/dist/commands/agents.d.ts.map +1 -1
  3. package/dist/commands/agents.js +288 -8
  4. package/dist/commands/approvals.d.ts.map +1 -1
  5. package/dist/commands/approvals.js +19 -0
  6. package/dist/commands/chats.d.ts.map +1 -1
  7. package/dist/commands/chats.js +84 -0
  8. package/dist/commands/clip.d.ts.map +1 -1
  9. package/dist/commands/clip.js +21 -18
  10. package/dist/commands/comments.d.ts +3 -0
  11. package/dist/commands/comments.d.ts.map +1 -1
  12. package/dist/commands/comments.js +44 -1
  13. package/dist/commands/labels.d.ts +5 -0
  14. package/dist/commands/labels.d.ts.map +1 -0
  15. package/dist/commands/labels.js +114 -0
  16. package/dist/commands/messages.d.ts.map +1 -1
  17. package/dist/commands/messages.js +35 -0
  18. package/dist/commands/projects.d.ts.map +1 -1
  19. package/dist/commands/projects.js +4 -2
  20. package/dist/commands/search.d.ts +5 -0
  21. package/dist/commands/search.d.ts.map +1 -1
  22. package/dist/commands/search.js +28 -1
  23. package/dist/commands/tasks.d.ts +13 -3
  24. package/dist/commands/tasks.d.ts.map +1 -1
  25. package/dist/commands/tasks.js +214 -8
  26. package/dist/commands/triggers.d.ts +19 -0
  27. package/dist/commands/triggers.d.ts.map +1 -0
  28. package/dist/commands/{external-triggers.js → triggers.js} +96 -95
  29. package/dist/commands/wiki-comments.d.ts +6 -0
  30. package/dist/commands/wiki-comments.d.ts.map +1 -0
  31. package/dist/commands/wiki-comments.js +108 -0
  32. package/dist/commands/wiki.d.ts.map +1 -1
  33. package/dist/commands/wiki.js +2 -98
  34. package/dist/index.js +4 -2
  35. package/package.json +4 -4
  36. package/dist/commands/external-triggers.d.ts +0 -19
  37. package/dist/commands/external-triggers.d.ts.map +0 -1
@@ -1,8 +1,17 @@
1
1
  import { Command } from 'commander';
2
2
  import type { AgentPresence, CreateAgentResponse, Machine, ParallClient } from '@parall/sdk';
3
+ export declare function resolveThinkingEffort(value: string | undefined): string | undefined;
4
+ /** Update grammar adds the "none" sentinel — mapped to an empty string, which
5
+ * the server defines as "clear the stored effort and its runtime env". */
6
+ export declare function resolveUpdateThinkingEffort(value: string | undefined): string | undefined;
7
+ export declare function resolveInstructionsInput(opts: {
8
+ instructions?: string;
9
+ instructionsFile?: string;
10
+ }): string | undefined;
3
11
  export declare function validateMachineOptions(opts: {
4
12
  machineType?: string;
5
13
  machineLabel?: string;
14
+ machineId?: string;
6
15
  cpuCores?: number;
7
16
  memoryMB?: number;
8
17
  storageGB?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/commands/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,KAAK,EACV,aAAa,EAEb,mBAAmB,EACnB,OAAO,EACP,YAAY,EACb,MAAM,aAAa,CAAC;AAmCrB,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,QAqBA;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,QAmBA;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAA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;gBAEZ,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,cAAc,EAAE,KAAK,CAAC,EAAE,MAAM;CAM/E;AAaD,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC7C,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAuB9C;AAED,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC7C,OAAO,CAAC,aAAa,CAAC,CASxB;AA6CD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,QA+brD"}
@@ -1,4 +1,4 @@
1
- import { closeSync, openSync, unlinkSync, writeFileSync } from 'node:fs';
1
+ import { closeSync, openSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';
2
2
  import { resolveCredentials } from '../lib/client.js';
3
3
  import { printJson, printError, printRefHint, stripPrllScheme } from '../lib/output.js';
4
4
  function stripUndefined(obj) {
@@ -31,8 +31,51 @@ function parseOptionalSeconds(value, field, fallback) {
31
31
  }
32
32
  return parsed;
33
33
  }
34
+ // The full thinking-effort lexicon; which subset a given model accepts stays
35
+ // the server's domain (model-dependent).
36
+ const THINKING_EFFORTS = ['minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
37
+ export function resolveThinkingEffort(value) {
38
+ if (value === undefined)
39
+ return undefined;
40
+ if (!THINKING_EFFORTS.includes(value)) {
41
+ throw new Error(`--thinking-effort must be one of: ${THINKING_EFFORTS.join(', ')}`);
42
+ }
43
+ return value;
44
+ }
45
+ /** Update grammar adds the "none" sentinel — mapped to an empty string, which
46
+ * the server defines as "clear the stored effort and its runtime env". */
47
+ export function resolveUpdateThinkingEffort(value) {
48
+ if (value === 'none')
49
+ return '';
50
+ return resolveThinkingEffort(value);
51
+ }
52
+ const LLM_SOURCES = ['parall', 'custom'];
53
+ function resolveLLMSource(value) {
54
+ if (value === undefined)
55
+ return undefined;
56
+ if (!LLM_SOURCES.includes(value)) {
57
+ throw new Error(`--llm-source must be one of: ${LLM_SOURCES.join(', ')}`);
58
+ }
59
+ return value;
60
+ }
61
+ export function resolveInstructionsInput(opts) {
62
+ if (opts.instructions !== undefined && opts.instructionsFile !== undefined) {
63
+ throw new Error('--instructions and --instructions-file are mutually exclusive');
64
+ }
65
+ if (opts.instructionsFile !== undefined) {
66
+ return readFileSync(opts.instructionsFile, 'utf8');
67
+ }
68
+ return opts.instructions;
69
+ }
34
70
  export function validateMachineOptions(opts) {
35
71
  const hasCustomSpec = opts.cpuCores !== undefined || opts.memoryMB !== undefined || opts.storageGB !== undefined;
72
+ // The server silently ignores label/spec fields when machine_id binds an
73
+ // existing daemon machine — reject the combination so stated intent never
74
+ // becomes a silent no-op, per the CLI's grammar-first principle.
75
+ if (opts.machineId !== undefined &&
76
+ (opts.machineType === 'cloud' || opts.machineLabel !== undefined || hasCustomSpec)) {
77
+ throw new Error('--machine-id binds an existing daemon machine; it excludes --machine-type cloud, --machine-label, and custom specs');
78
+ }
36
79
  if (opts.machineLabel !== undefined && opts.machineType !== 'cloud') {
37
80
  throw new Error('--machine-label requires --machine-type cloud');
38
81
  }
@@ -210,19 +253,26 @@ export function registerAgentCommands(program) {
210
253
  .command('create')
211
254
  .description('Create an agent in the organization')
212
255
  .requiredOption('--name <name>', 'Agent display name')
213
- .option('--runtime-type <type>', 'Runtime type: openclaw, claude-code, codex, hermes')
256
+ .option('--runtime-type <type>', 'Runtime type: claude-code, codex, or parel (omit for a plain API-key agent)')
214
257
  .option('--machine-type <type>', 'Machine type. Use "cloud" to provision hosted compute')
215
258
  .option('--machine-label <label>', 'Hosted preset: lite, standard, pro, or custom')
259
+ .option('--machine-id <id>', 'Bind to an existing daemon-mode machine you own (excludes --machine-type cloud / --machine-label / custom specs)')
216
260
  .option('--cpu-cores <n>', 'CPU cores for machine-label=custom')
217
261
  .option('--memory-mb <n>', 'Memory in MiB for machine-label=custom')
218
262
  .option('--storage-gb <n>', 'Storage in GiB for machine-label=custom')
263
+ .option('--instructions <text>', 'Private Instructions for the agent')
264
+ .option('--instructions-file <path>', 'Read private Instructions from a file')
219
265
  .option('--model-management <mode>', 'Model management mode: platform or self')
220
266
  .option('--agent-model <model>', 'Platform-assigned model')
221
- .option('--agent-provider <provider>', 'Agent provider metadata')
222
- .option('--agent-endpoint <endpoint>', 'Agent endpoint metadata')
223
- .option('--agent-permissions <permissions>', 'Comma-separated agent permissions')
224
- .option('--openai-api-key <key>', 'Hosted Codex OpenAI API key override')
225
- .option('--openai-base-url <url>', 'Hosted Codex OpenAI-compatible base URL override')
267
+ .option('--thinking-effort <level>', `Model thinking effort (model-dependent): ${THINKING_EFFORTS.join(', ')}`)
268
+ .option('--llm-source <source>', 'LLM source: parall (managed proxy, default) or custom (provider overrides below)')
269
+ .option('--openai-api-key <key>', 'OpenAI API key override (codex runtimes)')
270
+ .option('--openai-base-url <url>', 'OpenAI-compatible base URL override (codex runtimes)')
271
+ .option('--anthropic-auth-token <token>', 'Anthropic auth token override (claude-code runtimes)')
272
+ .option('--anthropic-base-url <url>', 'Anthropic-compatible base URL override (claude-code runtimes)')
273
+ .option('--agent-provider <provider>', 'Legacy metadata for external API-key agents')
274
+ .option('--agent-endpoint <endpoint>', 'Legacy metadata for external API-key agents')
275
+ .option('--agent-permissions <permissions>', 'Legacy metadata (comma-separated); not enforced by the platform')
226
276
  .option('--api-key-file <path>', 'Write the one-time API key to a new 0600 file')
227
277
  .option('--show-api-key', 'Print the one-time API key to stdout; unsafe in logged agent runtimes')
228
278
  .option('--discard-api-key', 'Discard the one-time API key; use for cloud agents where the server injects it')
@@ -233,7 +283,7 @@ export function registerAgentCommands(program) {
233
283
  .action(async (opts) => {
234
284
  let apiKeyFileFd;
235
285
  try {
236
- const { client, orgId } = resolveCredentials();
286
+ // Grammar first: option errors surface before credential resolution.
237
287
  const cpuCores = parseOptionalInt(opts.cpuCores, 'cpu-cores');
238
288
  const memoryMB = parseOptionalInt(opts.memoryMb, 'memory-mb');
239
289
  const storageGB = parseOptionalInt(opts.storageGb, 'storage-gb');
@@ -246,6 +296,7 @@ export function registerAgentCommands(program) {
246
296
  validateMachineOptions({
247
297
  machineType: opts.machineType,
248
298
  machineLabel: opts.machineLabel,
299
+ machineId: opts.machineId,
249
300
  cpuCores,
250
301
  memoryMB,
251
302
  storageGB,
@@ -261,24 +312,31 @@ export function registerAgentCommands(program) {
261
312
  apiKeyFileFd = openSync(opts.apiKeyFile, 'wx', 0o600);
262
313
  }
263
314
  const providerConfig = stripUndefined({
315
+ llm_source: resolveLLMSource(opts.llmSource),
264
316
  openai_api_key: opts.openaiApiKey,
265
317
  openai_base_url: opts.openaiBaseUrl,
318
+ anthropic_auth_token: opts.anthropicAuthToken,
319
+ anthropic_base_url: opts.anthropicBaseUrl,
266
320
  });
267
321
  const req = stripUndefined({
268
322
  display_name: opts.name,
269
323
  runtime_type: opts.runtimeType,
270
324
  machine_type: opts.machineType,
271
325
  machine_label: opts.machineLabel,
326
+ machine_id: opts.machineId ? stripPrllScheme(opts.machineId) : undefined,
272
327
  cpu_cores: cpuCores,
273
328
  memory_mb: memoryMB,
274
329
  storage_gb: storageGB,
330
+ instructions: resolveInstructionsInput(opts),
275
331
  model_management: opts.modelManagement,
276
332
  agent_model: opts.agentModel,
333
+ thinking_effort: resolveThinkingEffort(opts.thinkingEffort),
277
334
  agent_provider: opts.agentProvider,
278
335
  agent_endpoint: opts.agentEndpoint,
279
336
  agent_permissions: parsePermissions(opts.agentPermissions),
280
337
  provider_config: Object.keys(providerConfig).length > 0 ? providerConfig : undefined,
281
338
  });
339
+ const { client, orgId } = resolveCredentials();
282
340
  const result = await client.createAgent(orgId, req);
283
341
  if (apiKeyFileFd !== undefined) {
284
342
  writeApiKeyFile(apiKeyFileFd, result.api_key);
@@ -324,4 +382,226 @@ export function registerAgentCommands(program) {
324
382
  printError(err);
325
383
  }
326
384
  });
385
+ agents
386
+ .command('update')
387
+ .description('Update an agent (creator/manager/org admin). Agents editing THEMSELVES should use "parall profile set" instead — its atomic endpoints route denials into the approval flow; this generic PATCH answers a plain 403')
388
+ .argument('<agentId>', 'Agent ID')
389
+ .option('--display-name <name>', 'Display name')
390
+ .option('--agent-model <model>', 'Platform-assigned model')
391
+ .option('--model-management <mode>', 'Model management mode: platform or self')
392
+ .option('--thinking-effort <level>', `Model thinking effort (model-dependent): ${THINKING_EFFORTS.join(', ')}, or "none" to reset to the model default`)
393
+ .option('--instructions <text>', 'Full replacement private Instructions')
394
+ .option('--instructions-file <path>', 'Read replacement private Instructions from a file')
395
+ .action(async (agentId, opts) => {
396
+ try {
397
+ const data = stripUndefined({
398
+ display_name: opts.displayName,
399
+ agent_model: opts.agentModel,
400
+ model_management: opts.modelManagement,
401
+ thinking_effort: resolveUpdateThinkingEffort(opts.thinkingEffort),
402
+ instructions: resolveInstructionsInput(opts),
403
+ });
404
+ if (Object.keys(data).length === 0) {
405
+ printError(new Error('No fields to update. Provide at least one option.'));
406
+ }
407
+ const { client, orgId } = resolveCredentials();
408
+ const result = await client.updateAgent(orgId, stripPrllScheme(agentId), data);
409
+ printJson(result);
410
+ }
411
+ catch (err) {
412
+ printError(err);
413
+ }
414
+ });
415
+ agents
416
+ .command('delete')
417
+ .description('Delete an agent (creator/manager/admin; its machine is reclaimed)')
418
+ .argument('<agentId>', 'Agent ID')
419
+ .action(async (agentId) => {
420
+ try {
421
+ const { client, orgId } = resolveCredentials();
422
+ await client.deleteAgent(orgId, stripPrllScheme(agentId));
423
+ printJson({ ok: true });
424
+ }
425
+ catch (err) {
426
+ printError(err);
427
+ }
428
+ });
429
+ agents
430
+ .command('new-session')
431
+ .description('Ask the agent runtime to start a fresh session (context reset; conversation history stays)')
432
+ .argument('<agentId>', 'Agent ID')
433
+ .action(async (agentId) => {
434
+ try {
435
+ const { client, orgId } = resolveCredentials();
436
+ const result = await client.requestNewAgentSession(orgId, stripPrllScheme(agentId));
437
+ printJson(result);
438
+ }
439
+ catch (err) {
440
+ printError(err);
441
+ }
442
+ });
443
+ agents
444
+ .command('deep-reset')
445
+ .description('Wipe a managed agent entity — sandbox filesystem, AGENTS.md, long-term memory — keeping the conversation line (destructive)')
446
+ .argument('<agentId>', 'Agent ID')
447
+ .action(async (agentId) => {
448
+ try {
449
+ const { client, orgId } = resolveCredentials();
450
+ const result = await client.deepResetAgent(orgId, stripPrllScheme(agentId));
451
+ printJson(result);
452
+ }
453
+ catch (err) {
454
+ printError(err);
455
+ }
456
+ });
457
+ agents
458
+ .command('activity')
459
+ .description("List an agent's recent activity messages")
460
+ .argument('<agentId>', 'Agent ID')
461
+ .option('--limit <n>', 'Maximum number of entries to return')
462
+ .action(async (agentId, opts) => {
463
+ try {
464
+ const limit = parseOptionalInt(opts.limit, 'limit');
465
+ const { client, orgId } = resolveCredentials();
466
+ const result = await client.getAgentActivity(orgId, stripPrllScheme(agentId), limit !== undefined ? { limit } : undefined);
467
+ printJson(result);
468
+ }
469
+ catch (err) {
470
+ printError(err);
471
+ }
472
+ });
473
+ agents
474
+ .command('monitor')
475
+ .description("Get an agent's live presence (online/offline, current session, telemetry)")
476
+ .argument('<agentId>', 'Agent ID')
477
+ .action(async (agentId) => {
478
+ try {
479
+ const { client, orgId } = resolveCredentials();
480
+ printJson(parseAgentMonitor(await client.getAgentMonitor(orgId, stripPrllScheme(agentId))));
481
+ }
482
+ catch (err) {
483
+ printError(err);
484
+ }
485
+ });
486
+ // ---- Sessions & steps (execution visibility) ----
487
+ const sessions = agents.command('sessions').description('Inspect agent sessions and steps');
488
+ sessions
489
+ .command('list')
490
+ .description('List sessions of an agent')
491
+ .argument('<agentId>', 'Agent ID')
492
+ .option('--status <status>', 'Comma-separated status filter (e.g. open)')
493
+ .option('--limit <n>', 'Maximum number of sessions to return')
494
+ .option('--cursor <cursor>', 'Pagination cursor')
495
+ .action(async (agentId, opts) => {
496
+ try {
497
+ const limit = parseOptionalInt(opts.limit, 'limit');
498
+ const { client, orgId } = resolveCredentials();
499
+ const result = await client.getAgentSessions(orgId, stripPrllScheme(agentId), {
500
+ ...(opts.status !== undefined ? { status: opts.status } : {}),
501
+ ...(limit !== undefined ? { limit } : {}),
502
+ ...(opts.cursor !== undefined ? { cursor: opts.cursor } : {}),
503
+ });
504
+ printJson(result);
505
+ }
506
+ catch (err) {
507
+ printError(err);
508
+ }
509
+ });
510
+ sessions
511
+ .command('get')
512
+ .description('Get one agent session')
513
+ .argument('<agentId>', 'Agent ID')
514
+ .argument('<sessionId>', 'Session ID')
515
+ .action(async (agentId, sessionId) => {
516
+ try {
517
+ const { client, orgId } = resolveCredentials();
518
+ const result = await client.getAgentSession(orgId, stripPrllScheme(agentId), stripPrllScheme(sessionId));
519
+ printJson(result);
520
+ }
521
+ catch (err) {
522
+ printError(err);
523
+ }
524
+ });
525
+ sessions
526
+ .command('steps')
527
+ .description('List steps of an agent session')
528
+ .argument('<agentId>', 'Agent ID')
529
+ .argument('<sessionId>', 'Session ID')
530
+ .option('--limit <n>', 'Maximum number of steps to return')
531
+ .option('--cursor <cursor>', 'Pagination cursor')
532
+ .action(async (agentId, sessionId, opts) => {
533
+ try {
534
+ const limit = parseOptionalInt(opts.limit, 'limit');
535
+ const { client, orgId } = resolveCredentials();
536
+ const result = await client.getAgentSessionSteps(orgId, stripPrllScheme(agentId), stripPrllScheme(sessionId), {
537
+ ...(limit !== undefined ? { limit } : {}),
538
+ ...(opts.cursor !== undefined ? { cursor: opts.cursor } : {}),
539
+ });
540
+ printJson(result);
541
+ }
542
+ catch (err) {
543
+ printError(err);
544
+ }
545
+ });
546
+ agents
547
+ .command('step')
548
+ .description('Get a single agent step by its ast_ ID (no session ID needed)')
549
+ .argument('<stepId>', 'Step ID')
550
+ .action(async (stepId) => {
551
+ try {
552
+ const { client, orgId } = resolveCredentials();
553
+ const result = await client.getAgentStepById(orgId, stripPrllScheme(stepId));
554
+ printJson(result);
555
+ }
556
+ catch (err) {
557
+ printError(err);
558
+ }
559
+ });
560
+ // ---- Manager relation ----
561
+ const manager = agents.command('manager').description("Read or change an agent's manager");
562
+ manager
563
+ .command('get')
564
+ .description("Get an agent's manager")
565
+ .argument('<agentId>', 'Agent ID')
566
+ .action(async (agentId) => {
567
+ try {
568
+ const { client, orgId } = resolveCredentials();
569
+ const result = await client.getAgentManager(orgId, stripPrllScheme(agentId));
570
+ printJson(result);
571
+ }
572
+ catch (err) {
573
+ printError(err);
574
+ }
575
+ });
576
+ manager
577
+ .command('set')
578
+ .description("Assign, transfer, or renounce an agent's manager (org admin/owner or the current manager)")
579
+ .argument('<agentId>', 'Agent ID')
580
+ .option('--user-id <userId>', 'New manager user ID')
581
+ .option('--none', 'Renounce: leave the agent with no manager')
582
+ .action(async (agentId, opts) => {
583
+ try {
584
+ if ((opts.userId !== undefined) === (opts.none === true)) {
585
+ printError(new Error('Provide exactly one of --user-id <id> or --none'));
586
+ }
587
+ const { client, orgId } = resolveCredentials();
588
+ const id = stripPrllScheme(agentId);
589
+ // Read-modify-write: the manager relation is CAS-guarded, so fetch
590
+ // the current version and write the full final state.
591
+ const current = await client.getAgentManager(orgId, id);
592
+ const body = {
593
+ manager_user_id: opts.none ? null : stripPrllScheme(opts.userId),
594
+ expected_version: current.version,
595
+ };
596
+ try {
597
+ printJson(await client.updateAgentManager(orgId, id, body));
598
+ }
599
+ catch (err) {
600
+ printError(err, body);
601
+ }
602
+ }
603
+ catch (err) {
604
+ printError(err);
605
+ }
606
+ });
327
607
  }
@@ -1 +1 @@
1
- {"version":3,"file":"approvals.d.ts","sourceRoot":"","sources":["../../src/commands/approvals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,QAwIxD"}
1
+ {"version":3,"file":"approvals.d.ts","sourceRoot":"","sources":["../../src/commands/approvals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,QA+JxD"}
@@ -78,6 +78,25 @@ export function registerApprovalCommands(program) {
78
78
  printError(err);
79
79
  }
80
80
  });
81
+ approvals
82
+ .command('decide')
83
+ .description('Approve or reject a pending approval request addressed to you')
84
+ .argument('<approvalId>', 'Approval request ID')
85
+ .argument('<decision>', 'approve or reject')
86
+ .option('--reason <text>', 'Why the request is rejected (rejections only)')
87
+ .action(async (approvalId, decision, opts) => {
88
+ try {
89
+ if (decision !== 'approve' && decision !== 'reject') {
90
+ throw new Error('decision must be "approve" or "reject"');
91
+ }
92
+ const { client } = resolveCredentials();
93
+ const result = await client.decideApproval(stripPrllScheme(approvalId), decision, opts.reason);
94
+ printJson(result);
95
+ }
96
+ catch (err) {
97
+ printError(err);
98
+ }
99
+ });
81
100
  approvals
82
101
  .command('wait')
83
102
  .description('Wait for an approval to reach a terminal state')
@@ -1 +1 @@
1
- {"version":3,"file":"chats.d.ts","sourceRoot":"","sources":["../../src/commands/chats.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAwMpD"}
1
+ {"version":3,"file":"chats.d.ts","sourceRoot":"","sources":["../../src/commands/chats.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAcpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAoRpD"}
@@ -1,6 +1,16 @@
1
1
  import { ApiError } from '@parall/sdk';
2
2
  import { resolveCredentials } from '../lib/client.js';
3
3
  import { printJson, printError, printRefHint, stripPrllScheme } from '../lib/output.js';
4
+ /** Strict command grammar for --visibility; membership/discoverability
5
+ * semantics stay the server's domain. */
6
+ function resolveVisibilityFlag(value) {
7
+ if (value === undefined)
8
+ return undefined;
9
+ if (value !== 'public' && value !== 'private') {
10
+ throw new Error('--visibility must be "public" or "private"');
11
+ }
12
+ return value;
13
+ }
4
14
  export function registerChatCommands(program) {
5
15
  const chats = program.command('chats').description('Manage chats');
6
16
  chats
@@ -95,8 +105,10 @@ export function registerChatCommands(program) {
95
105
  .requiredOption('--member-ids <ids>', 'Comma-separated member IDs')
96
106
  .option('--name <name>', 'Chat name')
97
107
  .option('--description <text>', 'Chat description')
108
+ .option('--visibility <visibility>', 'public (discoverable and joinable org-wide) or private (invite only; default)')
98
109
  .action(async (opts) => {
99
110
  try {
111
+ const visibility = resolveVisibilityFlag(opts.visibility);
100
112
  const { client, orgId } = resolveCredentials();
101
113
  const result = await client.createChat(orgId, {
102
114
  type: opts.type,
@@ -106,6 +118,7 @@ export function registerChatCommands(program) {
106
118
  .filter(Boolean),
107
119
  name: opts.name,
108
120
  description: opts.description,
121
+ visibility,
109
122
  });
110
123
  printJson(result);
111
124
  printRefHint(result.id);
@@ -114,6 +127,77 @@ export function registerChatCommands(program) {
114
127
  printError(err);
115
128
  }
116
129
  });
130
+ chats
131
+ .command('update')
132
+ .description('Update chat settings (name, description, visibility)')
133
+ .argument('<chatId>', 'Chat ID')
134
+ .option('--name <name>', 'Chat name')
135
+ .option('--description <text>', 'Chat description')
136
+ .option('--visibility <visibility>', 'public or private')
137
+ .action(async (chatId, opts) => {
138
+ try {
139
+ const data = {};
140
+ if (opts.name !== undefined)
141
+ data.name = opts.name;
142
+ if (opts.description !== undefined)
143
+ data.description = opts.description;
144
+ const visibility = resolveVisibilityFlag(opts.visibility);
145
+ if (visibility !== undefined)
146
+ data.visibility = visibility;
147
+ if (Object.keys(data).length === 0) {
148
+ printError(new Error('No fields to update. Provide at least one option.'));
149
+ return;
150
+ }
151
+ const { client, orgId } = resolveCredentials();
152
+ const result = await client.updateChat(orgId, stripPrllScheme(chatId), data);
153
+ printJson(result);
154
+ }
155
+ catch (err) {
156
+ printError(err);
157
+ }
158
+ });
159
+ chats
160
+ .command('archive')
161
+ .description('Archive a chat (hidden from active lists; restorable with "chats restore")')
162
+ .argument('<chatId>', 'Chat ID')
163
+ .action(async (chatId) => {
164
+ try {
165
+ const { client, orgId } = resolveCredentials();
166
+ await client.archiveChat(orgId, stripPrllScheme(chatId));
167
+ printJson({ ok: true });
168
+ }
169
+ catch (err) {
170
+ printError(err);
171
+ }
172
+ });
173
+ chats
174
+ .command('restore')
175
+ .description('Restore an archived chat')
176
+ .argument('<chatId>', 'Chat ID')
177
+ .action(async (chatId) => {
178
+ try {
179
+ const { client, orgId } = resolveCredentials();
180
+ await client.restoreChat(orgId, stripPrllScheme(chatId));
181
+ printJson({ ok: true });
182
+ }
183
+ catch (err) {
184
+ printError(err);
185
+ }
186
+ });
187
+ chats
188
+ .command('delete')
189
+ .description('Delete a chat (server-side soft delete, hidden from all views — prefer "chats archive" for restorable cleanup)')
190
+ .argument('<chatId>', 'Chat ID')
191
+ .action(async (chatId) => {
192
+ try {
193
+ const { client, orgId } = resolveCredentials();
194
+ await client.deleteChat(orgId, stripPrllScheme(chatId));
195
+ printJson({ ok: true });
196
+ }
197
+ catch (err) {
198
+ printError(err);
199
+ }
200
+ });
117
201
  const members = chats.command('members').description('Manage chat members');
118
202
  members
119
203
  .command('list')
@@ -1 +1 @@
1
- {"version":3,"file":"clip.d.ts","sourceRoot":"","sources":["../../src/commands/clip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwLpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QA2jBpD"}
1
+ {"version":3,"file":"clip.d.ts","sourceRoot":"","sources":["../../src/commands/clip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqMpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QA+iBpD"}
@@ -26,12 +26,21 @@ function connectionAnnotations(conn, deviceById) {
26
26
  out.target = 'desktop';
27
27
  out.device = device.name;
28
28
  out.device_status = device.status;
29
+ out.layer = device.managed_by === 'member' ? 'personal' : 'org';
29
30
  }
30
31
  }
31
32
  if (!conn.alias)
32
33
  out.hint = NO_ALIAS_HINT;
33
34
  return out;
34
35
  }
36
+ /**
37
+ * The rows an exec may target. A Browser Alias keeps its own connection row
38
+ * on the clip it installed (`connection_kind: 'browser_alias'`); ordinary exec
39
+ * never resolves it, so discovery must not advertise it as a `--connection`.
40
+ */
41
+ function execTargets(conns) {
42
+ return conns.filter((c) => c.connection_kind !== 'browser_alias');
43
+ }
35
44
  /** Compact connection form for discovery output (`clip list`). */
36
45
  function summarizeConnection(conn, deviceById) {
37
46
  return {
@@ -166,7 +175,7 @@ export function registerClipCommands(program) {
166
175
  };
167
176
  try {
168
177
  const resp = await client.listClipConnections(orgId, c.id);
169
- row.connections = (resp.data ?? []).map((conn) => summarizeConnection(conn, deviceById));
178
+ row.connections = execTargets(resp.data ?? []).map((conn) => summarizeConnection(conn, deviceById));
170
179
  }
171
180
  catch (err) {
172
181
  // One clip's broken connections read must not take down
@@ -349,7 +358,7 @@ export function registerClipCommands(program) {
349
358
  // A Go nil slice serializes as `null`, not `[]` — normalize so an
350
359
  // empty result always prints `[]` (ts/AGENTS.md § Cross-Language
351
360
  // Contract Edge Cases).
352
- const conns = resp.data ?? [];
361
+ const conns = execTargets(resp.data ?? []);
353
362
  const deviceById = conns.some((c) => c.device_id)
354
363
  ? await loadDeviceIndex(client, orgId)
355
364
  : new Map();
@@ -456,33 +465,28 @@ export function registerClipCommands(program) {
456
465
  .allowExcessArguments(true)
457
466
  .argument('[legacy...]')
458
467
  .action(() => {
459
- printError(new Error('`clip invoke` was removed with the v2 clip service. Execute with `parall clip exec <clip> <command> [json-args] --connection <ccn_|alias>` (or --edge <edgeId> for a desktop device you own); discover clips and connections with `parall clip list`.'));
468
+ printError(new Error('`clip invoke` was removed with the v2 clip service. Execute with `parall clip exec <clip> <command> [json-args] --connection <ccn_|alias>`; discover clips and connections with `parall clip list`.'));
460
469
  });
461
470
  clip
462
471
  .command('exec')
463
- .description('Execute a registry (Edge) clip command against an EXPLICIT target: --connection <ccn_|alias> (the only route to a cloud/hosted profile or MCP server) or --edge <edgeId> (a desktop device you own). Omitting both is an error')
472
+ .description('Execute a registry (Edge) clip command through an EXPLICIT connection: --connection <ccn_|alias> is the only target form — a desktop device, a cloud/hosted profile and an MCP server are all reached through the connection bound to the clip. Omitting it is an error')
464
473
  .argument('<clip>', 'Clip name in the org clip registry')
465
474
  .argument('<command>', 'Command name to execute')
466
475
  .argument('[args]', 'Command arguments (JSON string or plain text)')
467
- .option('--connection <ref>', 'Clip connection id (ccn_…) or alias — discover them with `parall clip connections <clip>`. REQUIRED to reach a cloud (hosted) profile OR an MCP connection: the binding is the authorization, and with several MCP accounts it names WHICH one you act as. The only other target form is --edge (a desktop device you own) — MCP is never reachable without --connection')
468
- .option('--edge <edgeId>', 'A desktop (BYOC) device you own. Mutually exclusive with --connection')
476
+ .option('--connection <ref>', 'Clip connection id (ccn_…) or alias — discover them with `parall clip connections <clip>`. REQUIRED for every exec: the connection is the unit access is granted on (who may run this clip through which account), and with several accounts it names WHICH one you act as')
469
477
  .option('--profile <name>', 'Browser profile (with --connection it may only restate the granted one)')
470
478
  .option('--timeout <ms>', 'Execution timeout in milliseconds', '30000')
471
479
  .option('--args-file <path>', "Read command args as JSON from a file ('-' = stdin) — shell-safe channel for quote-heavy JSON. Mutually exclusive with the [args] positional")
472
480
  .action(async (clipName, command, args, opts) => {
473
481
  try {
474
482
  const { client, orgId } = resolveCredentials();
475
- // Explicit target only, refused locally before any request. The
476
- // server still resolves a bare request to the caller's own online
477
- // desktop device (legacy BYOC fallback) so older pinned CLIs keep
478
- // working — but that resolution depends on whichever device happens
479
- // to be online, and for the common caller (a hosted agent, which
480
- // owns no desktop device) it can only fail after a round-trip.
481
- if (!opts?.connection && !opts?.edge) {
482
- printError(new Error('clip exec needs an explicit target: --connection <ccn_|alias> (cloud/MCP profiles — discover with `parall clip connections <clip>`) or --edge <edgeId> (a desktop device you own). The legacy no-flag form resolved to whichever of your own desktop devices was online; name the target instead.'));
483
- }
484
- if (opts?.connection && opts?.edge) {
485
- printError(new Error('--connection and --edge are mutually exclusive — pass exactly one target'));
483
+ // Explicit connection only, refused locally before any request. The
484
+ // server answers the same thing (400 CONNECTION_REQUIRED): the
485
+ // device selectors — `--edge` and the no-flag desktop fallback — are
486
+ // retired, because a connection is the unit exec access is granted
487
+ // on, for humans and agents alike.
488
+ if (!opts?.connection) {
489
+ printError(new Error("clip exec needs --connection <ccn_|alias> — discover this clip's connections with `parall clip connections <clip>`. (`--edge` and the no-flag desktop fallback were retired: every exec, on a desktop device too, goes through the connection bound to the clip.)"));
486
490
  }
487
491
  let parsedArgs;
488
492
  if (opts?.argsFile !== undefined) {
@@ -527,7 +531,6 @@ export function registerClipCommands(program) {
527
531
  command,
528
532
  args: parsedArgs,
529
533
  connection: opts?.connection,
530
- edge_id: opts?.edge,
531
534
  profile: opts?.profile,
532
535
  timeout: timeoutMs,
533
536
  };
@@ -15,6 +15,9 @@ export declare function buildListTarget(target: string, opts?: {
15
15
  } | {
16
16
  target_prefix: string;
17
17
  };
18
+ /** Strict command grammar for --resolution; the server stays authoritative
19
+ * for filter semantics. Exported for tests. */
20
+ export declare function resolveResolutionFlag(value: string | undefined): 'active' | 'resolved' | 'all' | undefined;
18
21
  /**
19
22
  * Generic, target-agnostic comment commands over `POST/GET/PATCH/DELETE
20
23
  * /comments`. Unlike `parall tasks comments` (task-only) and `parall wiki