@parall/cli 1.60.0 → 1.61.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.
@@ -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;AA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;AAMD,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,cAAc,CAAC;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;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')
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../src/commands/comments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4BpC;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GACzB;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAMpD;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,QA4HvD"}
1
+ {"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../src/commands/comments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4BpC;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GACzB;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAMpD;AAED;+CAC+C;AAC/C,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,QAAQ,GAAG,UAAU,GAAG,KAAK,GAAG,SAAS,CAM3C;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,QA4KvD"}
@@ -39,6 +39,16 @@ export function buildListTarget(target, opts) {
39
39
  }
40
40
  return { target_uri: uri };
41
41
  }
42
+ /** Strict command grammar for --resolution; the server stays authoritative
43
+ * for filter semantics. Exported for tests. */
44
+ export function resolveResolutionFlag(value) {
45
+ if (value === undefined)
46
+ return undefined;
47
+ if (value !== 'active' && value !== 'resolved' && value !== 'all') {
48
+ throw new Error('--resolution must be "active", "resolved", or "all"');
49
+ }
50
+ return value;
51
+ }
42
52
  /**
43
53
  * Generic, target-agnostic comment commands over `POST/GET/PATCH/DELETE
44
54
  * /comments`. Unlike `parall tasks comments` (task-only) and `parall wiki
@@ -57,7 +67,8 @@ export function registerCommentCommands(program) {
57
67
  .requiredOption('--target <uri>', 'Target prll:// URI (task / wiki page / changeset / inline anchor)')
58
68
  .option('--body <text>', BODY_OPTION_DESC)
59
69
  .option('--body-file <path>', BODY_FILE_OPTION_DESC)
60
- .option('--parent <id>', 'Parent comment ID (task comments only — threaded reply)')
70
+ .option('--parent <id>', 'Root comment ID — post as a threaded reply under it (works on any target type)')
71
+ .option('--quote <text>', 'Exact target text the comment anchors to (required for inline text-anchor targets)')
61
72
  .action(async (opts) => {
62
73
  try {
63
74
  // Grammar first: a body-flag error is a parameter error even when
@@ -66,6 +77,7 @@ export function registerCommentCommands(program) {
66
77
  const { client, orgId } = resolveCredentials();
67
78
  const result = await client.createComment(orgId, {
68
79
  target_uri: normalizeTarget(opts.target),
80
+ target_quote: opts.quote,
69
81
  body,
70
82
  parent_id: opts.parent ? stripPrllScheme(opts.parent) : undefined,
71
83
  });
@@ -88,13 +100,16 @@ export function registerCommentCommands(program) {
88
100
  .option('--cursor <cursor>', 'Pagination cursor')
89
101
  .option('--order <order>', 'Sort order (asc or desc)')
90
102
  .option('--exact', 'Match the target URI exactly (exclude inline anchored comments)')
103
+ .option('--resolution <state>', 'Filter by thread resolution state: active, resolved, or all')
91
104
  .action(async (opts) => {
92
105
  try {
106
+ const resolution = resolveResolutionFlag(opts.resolution);
93
107
  const { client, orgId } = resolveCredentials();
94
108
  const params = stripUndefined({
95
109
  limit: Number(opts.limit),
96
110
  cursor: opts.cursor,
97
111
  order: opts.order,
112
+ resolution,
98
113
  });
99
114
  const result = await client.getComments(orgId, {
100
115
  ...buildListTarget(opts.target, { exact: opts.exact }),
@@ -153,4 +168,32 @@ export function registerCommentCommands(program) {
153
168
  printError(err);
154
169
  }
155
170
  });
171
+ comments
172
+ .command('resolve')
173
+ .description('Resolve a comment thread (pass the root comment ID) — done handling its feedback')
174
+ .argument('<commentId>', 'Root comment ID')
175
+ .action(async (commentId) => {
176
+ try {
177
+ const { client, orgId } = resolveCredentials();
178
+ const result = await client.resolveComment(orgId, stripPrllScheme(commentId));
179
+ printJson(result);
180
+ }
181
+ catch (err) {
182
+ printError(err);
183
+ }
184
+ });
185
+ comments
186
+ .command('reopen')
187
+ .description('Reopen a resolved comment thread (required before replying into it)')
188
+ .argument('<commentId>', 'Root comment ID')
189
+ .action(async (commentId) => {
190
+ try {
191
+ const { client, orgId } = resolveCredentials();
192
+ const result = await client.reopenComment(orgId, stripPrllScheme(commentId));
193
+ printJson(result);
194
+ }
195
+ catch (err) {
196
+ printError(err);
197
+ }
198
+ });
156
199
  }
@@ -0,0 +1,5 @@
1
+ import { Command } from 'commander';
2
+ /** Org-wide task label catalog. Attaching/detaching labels on a task lives
3
+ * under `parall tasks labels` and `parall tasks update --label-ids`. */
4
+ export declare function registerLabelCommands(program: Command): void;
5
+ //# sourceMappingURL=labels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../src/commands/labels.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmCpC;wEACwE;AACxE,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,QAkFrD"}