@parall/cli 1.74.0 → 1.76.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 (78) hide show
  1. package/dist/commands/approvals.d.ts.map +1 -1
  2. package/dist/commands/approvals.js +40 -13
  3. package/dist/commands/apps-action-local.d.ts +6 -1
  4. package/dist/commands/apps-action-local.d.ts.map +1 -1
  5. package/dist/commands/apps-action-local.js +11 -2
  6. package/dist/commands/apps-actions-sdk.generated.d.ts +1 -1
  7. package/dist/commands/apps-actions-sdk.generated.d.ts.map +1 -1
  8. package/dist/commands/apps-actions-sdk.generated.js +1 -1
  9. package/dist/commands/apps-actions.d.ts.map +1 -1
  10. package/dist/commands/apps-actions.js +13 -15
  11. package/dist/commands/apps-add.d.ts +6 -0
  12. package/dist/commands/apps-add.d.ts.map +1 -0
  13. package/dist/commands/apps-add.js +93 -0
  14. package/dist/commands/apps-args.d.ts +22 -0
  15. package/dist/commands/apps-args.d.ts.map +1 -0
  16. package/dist/commands/apps-args.js +62 -0
  17. package/dist/commands/apps-blocks.d.ts +96 -0
  18. package/dist/commands/apps-blocks.d.ts.map +1 -0
  19. package/dist/commands/apps-blocks.js +196 -0
  20. package/dist/commands/apps-check.d.ts.map +1 -1
  21. package/dist/commands/apps-check.js +8 -3
  22. package/dist/commands/apps-db.d.ts +3 -1
  23. package/dist/commands/apps-db.d.ts.map +1 -1
  24. package/dist/commands/apps-db.js +4 -7
  25. package/dist/commands/apps-dev-server.d.ts +3 -0
  26. package/dist/commands/apps-dev-server.d.ts.map +1 -1
  27. package/dist/commands/apps-dev-server.js +4 -0
  28. package/dist/commands/apps-dev-vars.d.ts +38 -0
  29. package/dist/commands/apps-dev-vars.d.ts.map +1 -0
  30. package/dist/commands/apps-dev-vars.js +107 -0
  31. package/dist/commands/apps-dev.d.ts.map +1 -1
  32. package/dist/commands/apps-dev.js +2 -1
  33. package/dist/commands/apps-local-runner.generated.d.ts +2 -1
  34. package/dist/commands/apps-local-runner.generated.d.ts.map +1 -1
  35. package/dist/commands/apps-local-runner.generated.js +2 -1
  36. package/dist/commands/apps-publish.d.ts +3 -1
  37. package/dist/commands/apps-publish.d.ts.map +1 -1
  38. package/dist/commands/apps-publish.js +27 -23
  39. package/dist/commands/apps-scaffold-actions.d.ts +4 -9
  40. package/dist/commands/apps-scaffold-actions.d.ts.map +1 -1
  41. package/dist/commands/apps-scaffold-actions.js +4 -163
  42. package/dist/commands/apps-scaffold.d.ts +5 -4
  43. package/dist/commands/apps-scaffold.d.ts.map +1 -1
  44. package/dist/commands/apps-scaffold.js +24 -144
  45. package/dist/commands/apps-template.d.ts +15 -0
  46. package/dist/commands/apps-template.d.ts.map +1 -0
  47. package/dist/commands/apps-template.js +105 -0
  48. package/dist/commands/apps-templates.gen.d.ts +5 -0
  49. package/dist/commands/apps-templates.gen.d.ts.map +1 -0
  50. package/dist/commands/apps-templates.gen.js +540 -0
  51. package/dist/commands/apps.d.ts +5 -4
  52. package/dist/commands/apps.d.ts.map +1 -1
  53. package/dist/commands/apps.js +42 -44
  54. package/dist/commands/comments.d.ts.map +1 -1
  55. package/dist/commands/comments.js +3 -2
  56. package/dist/commands/db-plane.d.ts +5 -14
  57. package/dist/commands/db-plane.d.ts.map +1 -1
  58. package/dist/commands/db-plane.js +63 -32
  59. package/dist/commands/db-target.d.ts +22 -0
  60. package/dist/commands/db-target.d.ts.map +1 -0
  61. package/dist/commands/db-target.js +43 -0
  62. package/dist/commands/dbs.d.ts +3 -6
  63. package/dist/commands/dbs.d.ts.map +1 -1
  64. package/dist/commands/dbs.js +28 -34
  65. package/dist/commands/secrets.d.ts +3 -0
  66. package/dist/commands/secrets.d.ts.map +1 -0
  67. package/dist/commands/secrets.js +66 -0
  68. package/dist/index.js +18 -2
  69. package/dist/lib/approvers.d.ts +12 -0
  70. package/dist/lib/approvers.d.ts.map +1 -0
  71. package/dist/lib/approvers.js +48 -0
  72. package/dist/lib/output.d.ts +30 -0
  73. package/dist/lib/output.d.ts.map +1 -1
  74. package/dist/lib/output.js +99 -6
  75. package/dist/lib/update-check.d.ts +4 -0
  76. package/dist/lib/update-check.d.ts.map +1 -1
  77. package/dist/lib/update-check.js +3 -1
  78. package/package.json +25 -5
@@ -1,6 +1,7 @@
1
1
  import { resolveCredentials } from '../lib/client.js';
2
2
  import { printError, printJson, printRefHint, stripPrllScheme } from '../lib/output.js';
3
3
  import { registerDataPlaneCommands } from './db-plane.js';
4
+ import { resolveDatabaseId } from './db-target.js';
4
5
  const DEPRECATED_PROJECT = 'Deprecated and ignored: Databases belong to the organization and names are unique in it';
5
6
  /** Database entity: a PostgreSQL schema of its own inside the org's
6
7
  * database on the apps instance (docs/engineering-design/mini-app-design.md
@@ -8,18 +9,17 @@ const DEPRECATED_PROJECT = 'Deprecated and ignored: Databases belong to the orga
8
9
  * one, and it may also stand alone. This file manages the entity (visible
9
10
  * to every org member); the raw-SQL data plane (query / exec / schema / …)
10
11
  * is db-plane.ts — a construction surface for attached-app authors and org
11
- * owners/admins — mounted here with `--db` and under `parall app db` with
12
- * `--app`. Every command answers 404 while the deployment has cap:mini-apps
12
+ * owners/admins — mounted here and under `parall app db`, both taking the
13
+ * target as an argument, --db or --app (db-target.ts). Every command
14
+ * answers 404 while the deployment has cap:mini-apps
13
15
  * off and 403 MINI_APPS_UNAVAILABLE for an org without the mini-apps flag. */
14
16
  export function registerDbCommands(program) {
15
17
  const db = program
16
18
  .command('db')
17
19
  .description('Manage Databases (Mini App data); the SQL commands are the construction surface of app authors and org owners/admins');
18
20
  registerDataPlaneCommands(db, {
19
- flag: '--db <idOrName>',
20
- flagHelp: 'Database ID (adb_… or prll://adb_…) or its name',
21
+ primary: 'db',
21
22
  extraOptions: [{ flag: '--project <projectId>', help: DEPRECATED_PROJECT }],
22
- resolve: resolveDatabaseTarget,
23
23
  });
24
24
  db.command('list')
25
25
  .description("List the organization's Databases")
@@ -33,14 +33,12 @@ export function registerDbCommands(program) {
33
33
  printError(err);
34
34
  }
35
35
  });
36
- db.command('get')
37
- .description('Get a Database and the apps attached to it')
38
- .argument('<idOrName>', 'Database ID or its name')
36
+ withDb(db.command('get').description('Get a Database and the apps attached to it'))
39
37
  .option('--project <projectId>', DEPRECATED_PROJECT)
40
- .action(async (idOrName) => {
38
+ .action(async (idOrName, opts) => {
41
39
  try {
42
40
  const ctx = resolveCredentials();
43
- const id = await resolveDatabaseId(ctx, idOrName);
41
+ const id = await resolveDatabaseId(ctx, databaseFrom(idOrName, opts.db));
44
42
  printJson(await ctx.client.getMiniAppDatabase(ctx.orgId, id));
45
43
  }
46
44
  catch (err) {
@@ -66,9 +64,7 @@ export function registerDbCommands(program) {
66
64
  printError(err);
67
65
  }
68
66
  });
69
- db.command('update')
70
- .description('Update a Database (org owner/admin)')
71
- .argument('<idOrName>', 'Database ID or its name')
67
+ withDb(db.command('update').description('Update a Database (org owner/admin)'))
72
68
  .option('--project <projectId>', DEPRECATED_PROJECT)
73
69
  .option('--name <name>', 'New name')
74
70
  .option('--description <text>', 'New description (empty string clears)')
@@ -83,21 +79,19 @@ export function registerDbCommands(program) {
83
79
  if (Object.keys(data).length === 0) {
84
80
  throw new Error('Nothing to update: pass --name or --description');
85
81
  }
86
- const id = await resolveDatabaseId(ctx, idOrName);
82
+ const id = await resolveDatabaseId(ctx, databaseFrom(idOrName, opts.db));
87
83
  printJson(await ctx.client.updateMiniAppDatabase(ctx.orgId, id, data));
88
84
  }
89
85
  catch (err) {
90
86
  printError(err);
91
87
  }
92
88
  });
93
- db.command('delete')
94
- .description('Delete a Database nothing is attached to (org owner/admin)')
95
- .argument('<idOrName>', 'Database ID or its name')
89
+ withDb(db.command('delete').description('Delete a Database nothing is attached to (org owner/admin)'))
96
90
  .option('--project <projectId>', DEPRECATED_PROJECT)
97
- .action(async (idOrName) => {
91
+ .action(async (idOrName, opts) => {
98
92
  try {
99
93
  const ctx = resolveCredentials();
100
- const id = await resolveDatabaseId(ctx, idOrName);
94
+ const id = await resolveDatabaseId(ctx, databaseFrom(idOrName, opts.db));
101
95
  await ctx.client.deleteMiniAppDatabase(ctx.orgId, id);
102
96
  console.error(`Deleted ${id}`);
103
97
  }
@@ -106,21 +100,21 @@ export function registerDbCommands(program) {
106
100
  }
107
101
  });
108
102
  }
109
- async function resolveDatabaseTarget(ctx, opts) {
110
- return { kind: 'db', id: await resolveDatabaseId(ctx, opts.db ?? '') };
103
+ /** The Database an entity command names: as the argument or with --db,
104
+ * like the SQL commands (db-target.ts). */
105
+ function withDb(cmd) {
106
+ return cmd
107
+ .argument('[idOrName]', 'Database ID or its name; or pass --db')
108
+ .option('--db <idOrName>', 'Database ID or its name, in place of the argument');
111
109
  }
112
- /** A Database is addressed by id, or by its name — unique in the org,
113
- * case-insensitively. */
114
- export async function resolveDatabaseId(ctx, idOrName) {
115
- const value = stripPrllScheme(idOrName.trim());
116
- if (value === '')
117
- throw new Error('Pass a Database ID or name');
118
- if (value.startsWith('adb_'))
119
- return value;
120
- const all = await ctx.client.getMiniAppDatabases(ctx.orgId);
121
- const match = all.find((d) => d.name.toLowerCase() === value.toLowerCase());
122
- if (!match) {
123
- throw new Error(`No database named ${JSON.stringify(value)}; pass its adb_ id or check \`parall db list\``);
110
+ function databaseFrom(positional, flag) {
111
+ const arg = positional === undefined ? undefined : stripPrllScheme(positional.trim()) || undefined;
112
+ const opt = flag === undefined ? undefined : stripPrllScheme(flag.trim()) || undefined;
113
+ if (arg && opt && arg !== opt) {
114
+ throw new Error(`Name the Database once: the argument says ${arg}, --db says ${opt}`);
124
115
  }
125
- return match.id;
116
+ const value = arg ?? opt;
117
+ if (!value)
118
+ throw new Error('Name the Database: its ID (adb_…) or name, as the argument or with --db');
119
+ return value;
126
120
  }
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerSecretCommands(program: Command): void;
3
+ //# sourceMappingURL=secrets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../src/commands/secrets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,QA2EtD"}
@@ -0,0 +1,66 @@
1
+ import { printFiledApproval } from '../lib/approvers.js';
2
+ import { resolveCredentials } from '../lib/client.js';
3
+ import { printError, printJson, printProgress, stripPrllScheme } from '../lib/output.js';
4
+ // Secrets as an agent sees them (agent-secrets-design.md §12). An agent can
5
+ // list the names it has or may ask to use, and post a request card; it can
6
+ // never read or store a value — a person enters it on the card. `request` is
7
+ // shorthand for `approvals request` with the right action, target and payload.
8
+ export function registerSecretCommands(program) {
9
+ const secrets = program
10
+ .command('secrets')
11
+ .description('See the keys you have and ask a person for one');
12
+ secrets
13
+ .command('list')
14
+ .description("List the keys you have and the organization's shared keys you may ask to use (names and purposes, never values), plus your requests still waiting")
15
+ .action(async () => {
16
+ try {
17
+ const { client, orgId } = resolveCredentials();
18
+ printJson(await client.getMyAgentSecretCatalog(orgId));
19
+ }
20
+ catch (err) {
21
+ printError(err);
22
+ }
23
+ });
24
+ secrets
25
+ .command('request')
26
+ .description('Post a request card for a key. The person who manages you, or an org admin, enters the value on the card and approves; a key of yours with the same name gets the new value.')
27
+ .argument('<name>', 'The key name your commands will read, e.g. GITHUB_TOKEN')
28
+ .requiredOption('--purpose <text>', 'One line for a non-engineer on what the key is for')
29
+ .requiredOption('--chat <chatId>', 'Chat to post the card in — the one you are working in (e.g. prll://cht_456)')
30
+ .option('--where <text>', 'Where a person can get such a key, if you know')
31
+ .option('--shared', "Ask to use the organization's shared key of this name instead: an org admin approves and nobody enters a value")
32
+ .action(async (name, opts) => {
33
+ try {
34
+ if (opts.shared && opts.where !== undefined) {
35
+ throw new Error('--where does not apply with --shared: nobody enters a value for a shared key');
36
+ }
37
+ const { client, orgId } = resolveCredentials();
38
+ const result = await client.requestApproval(orgId, opts.shared
39
+ ? {
40
+ action_type: 'org.secret.agent.add',
41
+ resource_uri: `prll://${orgId}`,
42
+ action_payload: { name, purpose: opts.purpose },
43
+ chat_id: stripPrllScheme(opts.chat),
44
+ // The server writes the title; the endpoint still requires one.
45
+ title: name,
46
+ }
47
+ : {
48
+ action_type: 'agent.secret.request',
49
+ resource_uri: `prll://${(await client.getMe()).id}`,
50
+ action_payload: {
51
+ name,
52
+ purpose: opts.purpose,
53
+ ...(opts.where !== undefined ? { source: opts.where } : {}),
54
+ },
55
+ chat_id: stripPrllScheme(opts.chat),
56
+ title: name,
57
+ });
58
+ printJson(result);
59
+ printFiledApproval(result, result.deduplicated ? 'Already waiting' : 'Created');
60
+ printProgress('Now tell the people above, by name, what the key is for, then end your turn. You are woken when it is decided and the key is usable from that turn — do not wait with `parall approvals wait`.');
61
+ }
62
+ catch (err) {
63
+ printError(err);
64
+ }
65
+ });
66
+ }
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ import { registerProjectCommands } from './commands/projects.js';
20
20
  import { registerRefCommands } from './commands/refs.js';
21
21
  import { registerScheduleCommands } from './commands/schedules.js';
22
22
  import { registerSearchCommands } from './commands/search.js';
23
+ import { registerSecretCommands } from './commands/secrets.js';
23
24
  import { registerSlackCommands } from './commands/slack.js';
24
25
  import { registerTaskCommands } from './commands/tasks.js';
25
26
  import { registerTeamCommands } from './commands/teams.js';
@@ -29,7 +30,7 @@ import { registerWatchCommands } from './commands/watch.js';
29
30
  import { registerWechatCommands } from './commands/wechat.js';
30
31
  import { registerWikiCommands } from './commands/wiki.js';
31
32
  import { registerMiniAppCommands } from './lib/mini-app-discovery.js';
32
- import { printError } from './lib/output.js';
33
+ import { printError, stderrJoinsStdout } from './lib/output.js';
33
34
  import { createUpdateNotifier } from './lib/update-check.js';
34
35
  const version = typeof __PARALL_CLI_VERSION__ === 'string'
35
36
  ? __PARALL_CLI_VERSION__
@@ -39,6 +40,18 @@ program
39
40
  .name('parall')
40
41
  .description('CLI client for Parall — universal agent & human access to Parall API')
41
42
  .version(version);
43
+ // A command, option or argument this CLI does not know may simply be newer
44
+ // than it: instructions and skills describe the current release. Saying
45
+ // which version answered lets an agent tell a typo from an old install.
46
+ // Commander shares this output configuration with every subcommand.
47
+ program.configureOutput({
48
+ outputError: (str, write) => {
49
+ write(str);
50
+ if (/^error: (unknown command|unknown option|too many arguments)/.test(str)) {
51
+ write(`(this is parall ${version}; if your instructions name this command or option, update the CLI: npm install -g @parall/cli@latest)\n`);
52
+ }
53
+ },
54
+ });
42
55
  registerAgentCommands(program);
43
56
  registerApprovalCommands(program);
44
57
  registerChatCommands(program);
@@ -50,6 +63,7 @@ registerCommentCommands(program);
50
63
  registerLabelCommands(program);
51
64
  registerProjectCommands(program);
52
65
  registerProfileCommands(program);
66
+ registerSecretCommands(program);
53
67
  registerTeamCommands(program);
54
68
  registerScheduleCommands(program);
55
69
  registerTriggerCommands(program);
@@ -66,7 +80,9 @@ registerBrowserCommands(program);
66
80
  registerSlackCommands(program);
67
81
  registerMSTeamsCommands(program);
68
82
  registerWechatCommands(program);
69
- const updateNotifier = createUpdateNotifier(version);
83
+ const updateNotifier = createUpdateNotifier(version, {
84
+ canWriteHint: () => !stderrJoinsStdout(),
85
+ });
70
86
  program.hook('postAction', () => {
71
87
  if (process.exitCode === undefined || process.exitCode === 0) {
72
88
  updateNotifier.afterSuccessfulCommand();
@@ -0,0 +1,12 @@
1
+ import type { Approval, ApprovalApprovers, ApprovalWarning } from '@parall/sdk';
2
+ /** One line naming who can approve, with where each of them would see it. */
3
+ export declare function describeApprovers(set: ApprovalApprovers | null | undefined): string | undefined;
4
+ /** Prints who can approve and any advice, after the JSON result. */
5
+ export declare function printApprovers(set: ApprovalApprovers | null | undefined, warnings: ApprovalWarning[] | null | undefined, approvalId?: string): void;
6
+ /**
7
+ * Prints where a filed request is: the card's message link to point people
8
+ * at in chat (a request id is not a reference chat can show), and the
9
+ * request id for get, wait and cancel. Then who can approve it.
10
+ */
11
+ export declare function printFiledApproval(result: Approval, verb: string): void;
12
+ //# sourceMappingURL=approvers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approvers.d.ts","sourceRoot":"","sources":["../../src/lib/approvers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGhF,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAoB/F;AAED,oEAAoE;AACpE,wBAAgB,cAAc,CAC5B,GAAG,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,EACzC,QAAQ,EAAE,eAAe,EAAE,GAAG,IAAI,GAAG,SAAS,EAC9C,UAAU,CAAC,EAAE,MAAM,GAClB,IAAI,CAWN;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAIvE"}
@@ -0,0 +1,48 @@
1
+ import { printProgress } from './output.js';
2
+ /** One line naming who can approve, with where each of them would see it. */
3
+ export function describeApprovers(set) {
4
+ const users = set?.users;
5
+ if (!set || !users)
6
+ return undefined;
7
+ if (users.length === 0) {
8
+ return set.incomplete
9
+ ? 'Nobody found who can approve this, but some members could not be checked.'
10
+ : 'Nobody in this organization can approve this.';
11
+ }
12
+ const people = users.map((u) => {
13
+ const where = [];
14
+ if (u.in_chat !== undefined)
15
+ where.push(u.in_chat ? 'in this chat' : 'not in this chat');
16
+ if (u.in_inbox)
17
+ where.push('in their Inbox');
18
+ return where.length > 0 ? `${u.display_name} (${where.join(', ')})` : u.display_name;
19
+ });
20
+ const total = set.total ?? users.length;
21
+ const more = total > users.length ? `; ${total - users.length} more not listed` : '';
22
+ const partial = set.incomplete
23
+ ? ' Some members could not be checked; someone may be missing.'
24
+ : '';
25
+ return `Can approve (${total}): ${people.join(', ')}${more}.${partial}`;
26
+ }
27
+ /** Prints who can approve and any advice, after the JSON result. */
28
+ export function printApprovers(set, warnings, approvalId) {
29
+ const line = describeApprovers(set);
30
+ if (line)
31
+ printProgress(line);
32
+ for (const w of warnings ?? []) {
33
+ printProgress(`Warning (${w.code}): ${w.message}`);
34
+ if (w.code === 'NO_APPROVER_IN_CHAT' && approvalId) {
35
+ printProgress(`Withdraw this one before filing elsewhere: parall approvals cancel ${approvalId}`);
36
+ }
37
+ }
38
+ }
39
+ /**
40
+ * Prints where a filed request is: the card's message link to point people
41
+ * at in chat (a request id is not a reference chat can show), and the
42
+ * request id for get, wait and cancel. Then who can approve it.
43
+ */
44
+ export function printFiledApproval(result, verb) {
45
+ const card = result.message_id ? `card prll://${result.message_id} (link it in chat); ` : '';
46
+ printProgress(`${verb}: ${card}request ${result.id} (for parall approvals get/wait/cancel)`);
47
+ printApprovers(result.approvers, result.warnings, result.id);
48
+ }
@@ -1,4 +1,23 @@
1
1
  export declare function printJson(data: unknown): void;
2
+ /**
3
+ * Whether stderr goes into the same pipe as stdout: `parall … 2>&1 | jq`,
4
+ * `$(parall … 2>&1)`, or a caller reading both streams through one pipe or
5
+ * socket (Python `stderr=STDOUT`, Node `exec('parall … 2>&1')`). Then a
6
+ * line on stderr lands inside the output a script is parsing, so the CLI
7
+ * keeps its progress lines and hints to itself and stdout stays exactly the
8
+ * result. Errors are still written: there is no result to protect then.
9
+ *
10
+ * One regular file behind both streams does not count. An agent harness
11
+ * hands a command one file for both and shows it to the model (Claude
12
+ * Code's Bash tool does), and the model needs those lines; `> run.log 2>&1`
13
+ * asks for a log, not a result.
14
+ */
15
+ export declare function stderrJoinsStdout(): boolean;
16
+ /**
17
+ * A progress or status line for the person or agent watching: on stderr,
18
+ * never inside a result (see stderrJoinsStdout).
19
+ */
20
+ export declare function printProgress(line: string): void;
2
21
  /**
3
22
  * Print a prll:// URI hint to stderr after a mutation command.
4
23
  * Does not affect stdout JSON, but LLMs see it and can copy-paste the URI.
@@ -32,6 +51,17 @@ export declare function parsePositiveInt(raw: string | undefined): number | unde
32
51
  * See docs/engineering-design/project-roster-denial-design.md §3.2 / §5
33
52
  */
34
53
  export declare function projectRosterNextStep(details: unknown): string | undefined;
54
+ /**
55
+ * Plain-text next step for a Mini App authorship denial: a 403
56
+ * `PERMISSION_DENIED` whose `details.author_apps` names the apps whose
57
+ * authors may do what was refused. Nothing there is approvable; the way in
58
+ * is being added as an author, which any author or org owner/admin can do,
59
+ * so the step is the exact command for one of them to run. The server sends
60
+ * only the app IDs; the command is the CLI's. Undefined when no app is
61
+ * listed (only an org owner/admin can then), so the caller falls back to
62
+ * the generic guidance.
63
+ */
64
+ export declare function authorshipNextStep(details: unknown): string | undefined;
35
65
  /** Prints the error and exits 1. `nextStep` is plain-text guidance printed
36
66
  * after the error line of an API error. */
37
67
  export declare function printError(err: unknown, attemptedPayload?: Record<string, unknown>, nextStep?: string): never;
@@ -1 +1 @@
1
- {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/lib/output.ts"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE7C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAY,GAAG,IAAI,CAEvE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAW5E;AAmBD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAe1E;AAED;2CAC2C;AAC3C,wBAAgB,UAAU,CACxB,GAAG,EAAE,OAAO,EACZ,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1C,QAAQ,CAAC,EAAE,MAAM,GAChB,KAAK,CAsDP"}
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/lib/output.ts"],"names":[],"mappings":"AAGA,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE7C;AAID;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAoB3C;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAY,GAAG,IAAI,CAEvE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAW5E;AAmBD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAe1E;AAaD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAWvE;AASD;2CAC2C;AAC3C,wBAAgB,UAAU,CACxB,GAAG,EAAE,OAAO,EACZ,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1C,QAAQ,CAAC,EAAE,MAAM,GAChB,KAAK,CAgEP"}
@@ -1,13 +1,58 @@
1
+ import { fstatSync } from 'node:fs';
1
2
  import { ApiError } from '@parall/sdk';
2
3
  export function printJson(data) {
3
4
  console.log(JSON.stringify(data, null, 2));
4
5
  }
6
+ let joined;
7
+ /**
8
+ * Whether stderr goes into the same pipe as stdout: `parall … 2>&1 | jq`,
9
+ * `$(parall … 2>&1)`, or a caller reading both streams through one pipe or
10
+ * socket (Python `stderr=STDOUT`, Node `exec('parall … 2>&1')`). Then a
11
+ * line on stderr lands inside the output a script is parsing, so the CLI
12
+ * keeps its progress lines and hints to itself and stdout stays exactly the
13
+ * result. Errors are still written: there is no result to protect then.
14
+ *
15
+ * One regular file behind both streams does not count. An agent harness
16
+ * hands a command one file for both and shows it to the model (Claude
17
+ * Code's Bash tool does), and the model needs those lines; `> run.log 2>&1`
18
+ * asks for a log, not a result.
19
+ */
20
+ export function stderrJoinsStdout() {
21
+ if (joined === undefined) {
22
+ joined = false;
23
+ if (!process.stdout.isTTY && !process.stderr.isTTY) {
24
+ try {
25
+ const out = fstatSync(1);
26
+ const err = fstatSync(2);
27
+ // ino 0: a platform without inode numbers for pipes (Windows) —
28
+ // unknown, so keep the lines.
29
+ joined =
30
+ (out.isFIFO() || out.isSocket()) &&
31
+ out.ino !== 0 &&
32
+ out.dev === err.dev &&
33
+ out.ino === err.ino;
34
+ }
35
+ catch {
36
+ joined = false;
37
+ }
38
+ }
39
+ }
40
+ return joined;
41
+ }
42
+ /**
43
+ * A progress or status line for the person or agent watching: on stderr,
44
+ * never inside a result (see stderrJoinsStdout).
45
+ */
46
+ export function printProgress(line) {
47
+ if (!stderrJoinsStdout())
48
+ console.error(line);
49
+ }
5
50
  /**
6
51
  * Print a prll:// URI hint to stderr after a mutation command.
7
52
  * Does not affect stdout JSON, but LLMs see it and can copy-paste the URI.
8
53
  */
9
54
  export function printRefHint(entityId, action = 'Created') {
10
- console.error(`${action}: prll://${entityId}`);
55
+ printProgress(`${action}: prll://${entityId}`);
11
56
  }
12
57
  /**
13
58
  * Strip the `prll://` scheme prefix from an entity ID if present.
@@ -83,6 +128,46 @@ export function projectRosterNextStep(details) {
83
128
  return undefined;
84
129
  }
85
130
  }
131
+ /** Reads `details.author_apps` off a denial envelope: the apps whose
132
+ * authors may do what was refused (org owners/admins always may). Undefined
133
+ * unless it is a list of app IDs. */
134
+ function readAuthorApps(details) {
135
+ if (details === null || typeof details !== 'object')
136
+ return undefined;
137
+ const apps = details.author_apps;
138
+ if (!Array.isArray(apps) || !apps.every((id) => typeof id === 'string' && id.startsWith('app_')))
139
+ return undefined;
140
+ return apps;
141
+ }
142
+ /**
143
+ * Plain-text next step for a Mini App authorship denial: a 403
144
+ * `PERMISSION_DENIED` whose `details.author_apps` names the apps whose
145
+ * authors may do what was refused. Nothing there is approvable; the way in
146
+ * is being added as an author, which any author or org owner/admin can do,
147
+ * so the step is the exact command for one of them to run. The server sends
148
+ * only the app IDs; the command is the CLI's. Undefined when no app is
149
+ * listed (only an org owner/admin can then), so the caller falls back to
150
+ * the generic guidance.
151
+ */
152
+ export function authorshipNextStep(details) {
153
+ const apps = readAuthorApps(details);
154
+ if (!apps || apps.length === 0)
155
+ return undefined;
156
+ const me = process.env.PRLL_AGENT_ID?.trim();
157
+ const user = me?.startsWith('usr_') ? me : '<your user ID (parall whoami)>';
158
+ const app = `prll://${apps[0]}`;
159
+ const whose = apps.length === 1
160
+ ? `The authors of ${app}`
161
+ : `The authors of any of ${apps.map((id) => `prll://${id}`).join(', ')}`;
162
+ return `${whose} and org owners/admins can do this. To become an author, ask one of its authors (parall app authors list ${app}) or an org owner/admin to run:\n parall app authors add ${app} ${user}`;
163
+ }
164
+ /** The request a refused card delete names (`details.approval_id`). */
165
+ function readApprovalId(details) {
166
+ if (!details || typeof details !== 'object')
167
+ return undefined;
168
+ const id = details.approval_id;
169
+ return typeof id === 'string' && id ? id : undefined;
170
+ }
86
171
  /** Prints the error and exits 1. `nextStep` is plain-text guidance printed
87
172
  * after the error line of an API error. */
88
173
  export function printError(err, attemptedPayload, nextStep) {
@@ -97,10 +182,13 @@ export function printError(err, attemptedPayload, nextStep) {
97
182
  ...(err.approvable !== undefined ? { approvable: err.approvable } : {}),
98
183
  ...(err.extras ? { extras: err.extras } : {}),
99
184
  }));
100
- // Project-roster denial: the fix is joining the project (its own action
101
- // with its own endpoint), not an approval of the read — so this branch
102
- // replaces the approval guidance below rather than adding to it.
103
- const rosterStep = err.code === 'PERMISSION_DENIED' ? projectRosterNextStep(err.extras?.details) : undefined;
185
+ // Project-roster and Mini App authorship denials: the fix is joining the
186
+ // project or being added as an author (each its own action), not an
187
+ // approval of what was refused — so these replace the approval guidance
188
+ // below rather than adding to it.
189
+ const rosterStep = err.code === 'PERMISSION_DENIED'
190
+ ? (projectRosterNextStep(err.extras?.details) ?? authorshipNextStep(err.extras?.details))
191
+ : undefined;
104
192
  if (rosterStep) {
105
193
  console.error(rosterStep);
106
194
  }
@@ -125,9 +213,14 @@ export function printError(err, attemptedPayload, nextStep) {
125
213
  const payloadArg = attemptedPayload
126
214
  ? ` --payload '${JSON.stringify(attemptedPayload).replaceAll("'", `'\\''`)}'`
127
215
  : '';
128
- console.error(`${lead} Request approval:\n parall approvals request --action ${err.action} --resource ${err.resourceUri ?? '<resource>'}${payloadArg} --chat ${chat} --title "..." --reason "..."`);
216
+ const resource = err.resourceUri ?? '<resource>';
217
+ console.error(`${lead} First see who can approve it and pick a chat one of them is in (a direct chat with them works):\n parall approvals approvers --action ${err.action} --resource ${resource}${payloadArg} --chat ${chat}\nThen request approval there:\n parall approvals request --action ${err.action} --resource ${resource}${payloadArg} --chat ${chat} --title "..." --reason "..."`);
129
218
  }
130
219
  }
220
+ if (err.code === 'CARD_NOT_DELETABLE') {
221
+ const approvalId = readApprovalId(err.extras?.details);
222
+ console.error(`This card's request is still waiting. Withdraw the request instead:\n parall approvals cancel ${approvalId ?? '<approval_id>'}`);
223
+ }
131
224
  if (nextStep)
132
225
  console.error(nextStep);
133
226
  }
@@ -5,6 +5,10 @@ type UpdateNotifierOptions = {
5
5
  cachePath?: string;
6
6
  spawnWorker?: (cachePath: string) => void;
7
7
  writeHint?: (hint: string) => void;
8
+ /** False while a hint has nowhere to go but into the command's result
9
+ * (stderr merged into stdout); the hint then waits for a later command
10
+ * instead of counting as shown. */
11
+ canWriteHint?: () => boolean;
8
12
  disabled?: boolean;
9
13
  };
10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tB,OAAO,GAAE,qBAA0B,GAClC,cAAc,CA2DhB;AAED,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CA+Bf"}
@@ -183,6 +183,7 @@ export function createUpdateNotifier(currentVersion, options = {}) {
183
183
  const cachePath = options.cachePath ?? defaultCachePath();
184
184
  const spawnWorker = options.spawnWorker ?? spawnUpdateCheckWorker;
185
185
  const writeHint = options.writeHint ?? ((hint) => process.stderr.write(hint));
186
+ const canWriteHint = options.canWriteHint ?? (() => true);
186
187
  const disabled = options.disabled ?? updateChecksDisabled();
187
188
  return {
188
189
  afterSuccessfulCommand: () => {
@@ -195,7 +196,8 @@ export function createUpdateNotifier(currentVersion, options = {}) {
195
196
  let changed = false;
196
197
  if (state.latest_version &&
197
198
  isNewerRelease(currentVersion, state.latest_version) &&
198
- timestamp - (state.last_notified_at ?? 0) >= CHECK_INTERVAL_MS) {
199
+ timestamp - (state.last_notified_at ?? 0) >= CHECK_INTERVAL_MS &&
200
+ canWriteHint()) {
199
201
  hint =
200
202
  `Update available: parall ${currentVersion} → ${state.latest_version}. ` +
201
203
  'Upgrade @parall/cli@latest with your package manager.\n';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parall/cli",
3
- "version": "1.74.0",
3
+ "version": "1.76.0",
4
4
  "description": "CLI client for Parall — universal agent & human access to Parall API",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -42,19 +42,39 @@
42
42
  "node-diff3": "3.2.1",
43
43
  "tar-stream": "^3.2.1",
44
44
  "zod": "^4.3.6",
45
- "@parall/agent-core": "1.74.0",
46
- "@parall/sdk": "1.74.0"
45
+ "@parall/agent-core": "1.76.0",
46
+ "@parall/sdk": "1.76.0"
47
47
  },
48
48
  "devDependencies": {
49
+ "@dnd-kit/core": "6.3.1",
50
+ "@dnd-kit/sortable": "10.0.0",
51
+ "@dnd-kit/utilities": "3.2.2",
52
+ "@fontsource-variable/geist": "5.3.0",
53
+ "@tailwindcss/vite": "4.2.2",
49
54
  "@types/js-yaml": "^4.0.9",
50
55
  "@types/node": "^22.0.0",
56
+ "@types/react": "19.2.14",
57
+ "@types/react-dom": "19.2.3",
51
58
  "@types/tar-stream": "^3.1.4",
59
+ "@vitejs/plugin-react": "4.7.0",
60
+ "class-variance-authority": "0.7.1",
61
+ "clsx": "2.1.1",
62
+ "date-fns": "4.4.0",
52
63
  "esbuild": "^0.25.0",
64
+ "lucide-react": "0.576.0",
65
+ "radix-ui": "1.8.0",
66
+ "react": "19.2.5",
67
+ "react-dom": "19.2.5",
68
+ "sonner": "2.0.8",
69
+ "tailwind-merge": "3.5.0",
70
+ "tailwindcss": "4.2.2",
71
+ "tw-animate-css": "1.4.0",
53
72
  "typescript": "^5.7.0",
54
- "@parall/agent-core": "1.74.0"
73
+ "vite": "6.4.1",
74
+ "@parall/agent-core": "1.76.0"
55
75
  },
56
76
  "scripts": {
57
- "build": "node scripts/generate-miniapp-sdk.mjs --check && node scripts/generate-local-runner.mjs --check && tsc",
77
+ "build": "node scripts/generate-miniapp-sdk.mjs --check && node scripts/generate-local-runner.mjs --check && node scripts/generate-app-templates.mjs --check && tsc",
58
78
  "dev": "tsc --watch",
59
79
  "test": "pnpm run build && node --test test/*.test.mjs",
60
80
  "bundle": "node scripts/bundle.mjs"