@parall/cli 1.92.0 → 1.94.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 (36) hide show
  1. package/dist/commands/apps-publish.d.ts.map +1 -1
  2. package/dist/commands/apps-publish.js +5 -2
  3. package/dist/commands/apps-scaffold.d.ts +3 -2
  4. package/dist/commands/apps-scaffold.d.ts.map +1 -1
  5. package/dist/commands/apps-scaffold.js +13 -4
  6. package/dist/commands/apps-shared-template-compose.d.ts +57 -0
  7. package/dist/commands/apps-shared-template-compose.d.ts.map +1 -0
  8. package/dist/commands/apps-shared-template-compose.js +176 -0
  9. package/dist/commands/apps-shared-template-init.d.ts +13 -0
  10. package/dist/commands/apps-shared-template-init.d.ts.map +1 -0
  11. package/dist/commands/apps-shared-template-init.js +130 -0
  12. package/dist/commands/apps-shared-template-package.d.ts +10 -0
  13. package/dist/commands/apps-shared-template-package.d.ts.map +1 -0
  14. package/dist/commands/apps-shared-template-package.js +112 -0
  15. package/dist/commands/apps-shared-template.d.ts +44 -0
  16. package/dist/commands/apps-shared-template.d.ts.map +1 -0
  17. package/dist/commands/apps-shared-template.js +214 -0
  18. package/dist/commands/apps-template-catalog.d.ts +5 -1
  19. package/dist/commands/apps-template-catalog.d.ts.map +1 -1
  20. package/dist/commands/apps-template-catalog.js +17 -4
  21. package/dist/commands/apps-template-download.d.ts +14 -1
  22. package/dist/commands/apps-template-download.d.ts.map +1 -1
  23. package/dist/commands/apps-template-download.js +6 -4
  24. package/dist/commands/apps-template-ref.d.ts +4 -0
  25. package/dist/commands/apps-template-ref.d.ts.map +1 -0
  26. package/dist/commands/apps-template-ref.js +31 -0
  27. package/dist/commands/apps-template-share-failure.d.ts +22 -0
  28. package/dist/commands/apps-template-share-failure.d.ts.map +1 -0
  29. package/dist/commands/apps-template-share-failure.js +201 -0
  30. package/dist/commands/apps-template-share.d.ts +19 -0
  31. package/dist/commands/apps-template-share.d.ts.map +1 -0
  32. package/dist/commands/apps-template-share.js +278 -0
  33. package/dist/commands/clip.js +12 -0
  34. package/dist/commands/secrets.d.ts.map +1 -1
  35. package/dist/commands/secrets.js +26 -4
  36. package/package.json +4 -4
@@ -0,0 +1,278 @@
1
+ import { resolveCredentials } from '../lib/client.js';
2
+ import { printError, printJson, printProgress, stripPrllScheme } from '../lib/output.js';
3
+ import { readTextFileArg } from '../lib/text-input.js';
4
+ import { day } from './apps-shared-template.js';
5
+ import { sharedTemplateId } from './apps-template-ref.js';
6
+ import { shareCommandLine, shareFailure, } from './apps-template-share-failure.js';
7
+ /**
8
+ * `parall app templates share` and `unshare` (mini-app-template-sharing-design.md
9
+ * §6.1): the agent of an app's author or of an org owner/admin shares the
10
+ * app's current version — its source and table structure, never its data —
11
+ * behind one link, with a note on how the team runs the app. The server
12
+ * checks everything that would go out (§5.2) and stores nothing when it finds
13
+ * the app's data or a key's value in it; apps-template-share-failure.ts
14
+ * turns that, and every other refusal, into what to do next. Names and IDs
15
+ * of the organization do not stop a share (§5.3): share lists them after
16
+ * the link as needing no change, so the agent does not clean them out of
17
+ * its own app.
18
+ */
19
+ const NOTE_MAX = 20_000;
20
+ const EXPIRIES = ['7d', '30d', '90d', 'never'];
21
+ const SHARE_HELP = `
22
+ Share only when the app's author or an org owner/admin asks you to; the
23
+ platform checks that too. What is shared is the app's current version: its
24
+ source and the structure of its tables, never its data. Anyone signed in
25
+ who has the link can build their own app from it, here or in another
26
+ organization.
27
+
28
+ The note (Markdown, at most 20,000 characters) is what the other team's
29
+ agent builds from. Write four things:
30
+ 1. What the app does.
31
+ 2. How the team uses it.
32
+ 3. How data gets into it.
33
+ 4. What you do around it: when you are woken, what you read, the rules
34
+ you write by, what you do at what time.
35
+
36
+ The template page shows a clickable demo: the app's real built pages,
37
+ answered from made-up data. Before you publish, write demo/demo.js in the
38
+ project — a plain script, no import or export, shared as written:
39
+
40
+ function createDemo(now) {
41
+ const items = [{ id: 1, title: 'Sample order', status: 'new' }];
42
+ return {
43
+ viewer: { display_name: 'Alex Demo', role: 'member' },
44
+ responders: {
45
+ items_list: () => ({ items }),
46
+ item_close: ({ id }) => {
47
+ const item = items.find((i) => i.id === id);
48
+ if (!item) throw new Error('No such item');
49
+ item.status = 'closed';
50
+ return item;
51
+ },
52
+ },
53
+ };
54
+ }
55
+
56
+ Answer every action in public/manifest.json with what the real action
57
+ returns, and throw new Error('…') where it would fail. A share without
58
+ demo/demo.js in the published source is refused.
59
+
60
+ Before storing anything, the platform compares all of it — the source,
61
+ demo.js and the built pages — with the values in the app's Database and the
62
+ keys you can read. When it finds one, nothing is
63
+ stored and each place is listed: change the app and publish again; leave
64
+ the file out (--exclude <path>); or, for a value that is not data (a status
65
+ name stored as text), let it through (--allow-value <value>). A key's value
66
+ is never let through: read it as ctx.env.<NAME> in the action instead.
67
+
68
+ Names and IDs of your organization — the names of members, channels and the
69
+ organization, Parall IDs, prll:// links — do not stop a share: they are
70
+ shared as they are, and listed as hints once it is done. They need no
71
+ change: the agent that builds from the template replaces them with its own,
72
+ and changing them would change your own app.
73
+
74
+ The link stays open 30 days unless --expires says otherwise, counted again
75
+ from every share. Running this again while the link is open updates the
76
+ same link to the app's current version and the new note; once it has
77
+ expired or been revoked, you get a new link. To revoke it:
78
+ parall app templates unshare --app <app_…>
79
+
80
+ Example:
81
+ parall app templates share --app app_… --note-file note.md`;
82
+ function collect(value, previous) {
83
+ return [...previous, value];
84
+ }
85
+ /** The app of share / unshare: app_… or prll://app_…. Anything else stops
86
+ * before a request, with the command that finds the app. */
87
+ export function parseShareApp(raw, verb) {
88
+ const id = stripPrllScheme(raw.trim());
89
+ if (id.startsWith('app_'))
90
+ return id;
91
+ const shared = sharedTemplateId(raw);
92
+ const fix = shared
93
+ ? `${shared} is a shared template, not an app; ${verb} takes the app it was shared from. Find the app with: parall app list`
94
+ : id.startsWith('adb_')
95
+ ? `${id} is a Database. Its apps: parall db get ${id}`
96
+ : 'Find the app with: parall app list';
97
+ throw new Error(`parall app templates ${verb} --app takes an app ID (app_… or prll://app_…), got "${raw}". ${fix}`);
98
+ }
99
+ /** A path for --exclude, as the source has it: no leading ./ or trailing /. */
100
+ function excludePath(raw) {
101
+ const path = raw
102
+ .trim()
103
+ .replace(/^(\.\/)+/, '')
104
+ .replace(/\/+$/, '');
105
+ if (path === '' || path.startsWith('/') || path.split('/').includes('..')) {
106
+ throw new Error(`--exclude takes a file or folder of the app's source, like db/seed.sql or exports/, got "${raw}"`);
107
+ }
108
+ return path;
109
+ }
110
+ /** The request share sends, checked here first: the note is there and fits,
111
+ * the expiry is one the server offers. Nothing is sent for what was not given. */
112
+ export function shareRequest(opts) {
113
+ if (opts.expires !== undefined && !EXPIRIES.includes(opts.expires)) {
114
+ throw new Error(`--expires must be ${EXPIRIES.join(', ')}; got "${opts.expires}"`);
115
+ }
116
+ const note = readTextFileArg('--note-file', opts.noteFile);
117
+ if (note.trim() === '') {
118
+ throw new Error(`The note in ${opts.noteFile} is empty. Write what the app does, how the team uses it, how data gets into it and what you do around it, then run this again.`);
119
+ }
120
+ const length = [...note].length;
121
+ if (length > NOTE_MAX) {
122
+ throw new Error(`The note in ${opts.noteFile} is ${length} characters, and it can be at most ${NOTE_MAX}. Shorten it and run this again.`);
123
+ }
124
+ if (opts.allowValue.some((value) => value === '')) {
125
+ throw new Error('--allow-value takes the value to let through; an empty one lets nothing through');
126
+ }
127
+ const exclude = [...new Set(opts.exclude.map(excludePath))];
128
+ const allow = [...new Set(opts.allowValue)];
129
+ return {
130
+ note,
131
+ ...(exclude.length > 0 ? { exclude } : {}),
132
+ ...(allow.length > 0 ? { allow_values: allow } : {}),
133
+ ...(opts.expires !== undefined ? { expires: opts.expires } : {}),
134
+ };
135
+ }
136
+ /** How many names and IDs share writes out, and how many places for each;
137
+ * the result's `hints` has every one Parall listed. */
138
+ const HINTS_SHOWN = 30;
139
+ const HINT_PLACES_SHOWN = 3;
140
+ /** What each kind of hint is called, in the order they are written out. */
141
+ const HINT_KINDS = new Map([
142
+ ['org', 'organization name'],
143
+ ['member', 'member name'],
144
+ ['channel', 'channel name'],
145
+ ['parall_id', 'Parall ID'],
146
+ ['parall_link', 'Parall link'],
147
+ ]);
148
+ const HINT_ORDER = [...HINT_KINDS.keys()];
149
+ function isHint(value) {
150
+ const h = value;
151
+ return (typeof h === 'object' &&
152
+ h !== null &&
153
+ typeof h.kind === 'string' &&
154
+ typeof h.where === 'string' &&
155
+ typeof h.line === 'number' &&
156
+ typeof h.text === 'string');
157
+ }
158
+ /** The names and IDs of the organization the template holds as they are
159
+ * (design §5.3), each once with the first places it is in, after a line
160
+ * saying they need no change. None when there are none, or the server is
161
+ * one from before hints. */
162
+ export function shareHints(result) {
163
+ const hints = Array.isArray(result.hints) ? result.hints.filter(isHint) : [];
164
+ if (hints.length === 0)
165
+ return [];
166
+ const found = new Map();
167
+ for (const hint of hints) {
168
+ const key = JSON.stringify([hint.kind, hint.text]);
169
+ const group = found.get(key) ?? { kind: hint.kind, text: hint.text, places: [] };
170
+ found.set(key, group);
171
+ const place = hint.line > 0 ? `${hint.where}:${hint.line}` : hint.where;
172
+ if (!group.places.includes(place))
173
+ group.places.push(place);
174
+ }
175
+ const rank = (kind) => {
176
+ const at = HINT_ORDER.indexOf(kind);
177
+ return at < 0 ? HINT_ORDER.length : at;
178
+ };
179
+ const groups = [...found.values()].sort((a, b) => rank(a.kind) - rank(b.kind));
180
+ const lines = groups.slice(0, HINTS_SHOWN).map(({ kind, text, places }) => {
181
+ const rest = places.length > HINT_PLACES_SHOWN ? ` and ${places.length - HINT_PLACES_SHOWN} more` : '';
182
+ return ` ${HINT_KINDS.get(kind) ?? kind} ${JSON.stringify(text)}: ${places.slice(0, HINT_PLACES_SHOWN).join(', ')}${rest}`;
183
+ });
184
+ const more = [
185
+ ...(groups.length > HINTS_SHOWN
186
+ ? [`${groups.length - HINTS_SHOWN} more (all in the result's "hints")`]
187
+ : []),
188
+ ...(result.hints_truncated === true ? ['more that Parall did not list'] : []),
189
+ ];
190
+ if (more.length > 0)
191
+ lines.push(` … and ${more.join(', and ')}.`);
192
+ return [
193
+ 'These names and IDs of your organization were shared as they are and need no change: the agent that builds from the template replaces them with its own, and changing them would change your own app.',
194
+ ...lines,
195
+ ];
196
+ }
197
+ /** "a", "a and b", "a, b and c". */
198
+ function inWords(items) {
199
+ return items.length > 2
200
+ ? `${items.slice(0, -1).join(', ')} and ${items[items.length - 1]}`
201
+ : items.join(' and ');
202
+ }
203
+ /** What share prints on stderr when it worked: the link, what to tell, and
204
+ * the names and IDs it holds that need no change. */
205
+ export function shareSummary(result, appId) {
206
+ const { share } = result;
207
+ const open = share.expires_at ? `open until ${day(share.expires_at)}` : 'open until revoked';
208
+ const first = result.created
209
+ ? `Shared version ${share.version_seq} of ${appId} as a template, ${open}: ${share.url} (a new link).`
210
+ : `Updated the open link to version ${share.version_seq} of ${appId}, ${open}: ${share.url} (the same link as before).`;
211
+ const hints = shareHints(result);
212
+ const tell = [
213
+ ...(result.removed.length > 0 ? [`what was left out (removed: ${result.removed.length})`] : []),
214
+ ...(result.tables.left_out.length > 0
215
+ ? [`which tables are not in it (tables.left_out: ${result.tables.left_out.join(', ')})`]
216
+ : []),
217
+ ...(hints.length > 0 ? ['which names and IDs of your organization it holds (below)'] : []),
218
+ ];
219
+ return [
220
+ first,
221
+ `Give the person this link${tell.length > 0 ? `, and say ${inWords(tell)}` : ''}.`,
222
+ ...hints,
223
+ ];
224
+ }
225
+ export function registerTemplateShareCommands(templates) {
226
+ templates
227
+ .command('share')
228
+ .description("Share an app as a template: a link anyone signed in can build their own app from (only when the app's author or an org owner/admin asks you)")
229
+ .requiredOption('--app <appId>', 'The app to share (app_… or prll://app_…)')
230
+ .requiredOption('--note-file <path>', "The note, Markdown, from a file ('-' = stdin): what it covers is below")
231
+ .option('--exclude <path>', "A file or folder of the app's source to leave out (repeatable)", collect, [])
232
+ .option('--allow-value <value>', "A value from the app's Database that is not data, to let through (repeatable)", collect, [])
233
+ .option('--expires <period>', 'How long the link stays open: 7d, 30d (default), 90d or never')
234
+ .addHelpText('after', SHARE_HELP)
235
+ .showHelpAfterError('Example: parall app templates share --app app_… --note-file note.md')
236
+ .action(async (opts) => {
237
+ try {
238
+ const appId = parseShareApp(opts.app, 'share');
239
+ const request = shareRequest(opts);
240
+ const { client, orgId } = resolveCredentials();
241
+ let result;
242
+ try {
243
+ result = await client.shareMiniAppTemplate(orgId, appId, request);
244
+ }
245
+ catch (err) {
246
+ const failure = shareFailure(err, appId, shareCommandLine(appId, opts));
247
+ return printError(failure.error, undefined, failure.step);
248
+ }
249
+ printJson(result);
250
+ for (const line of shareSummary(result, appId))
251
+ printProgress(line);
252
+ }
253
+ catch (err) {
254
+ printError(err);
255
+ }
256
+ });
257
+ templates
258
+ .command('unshare')
259
+ .description("Revoke an app's template link: it stops opening at once; apps already built from it are not affected")
260
+ .requiredOption('--app <appId>', 'The app whose link to revoke (app_… or prll://app_…)')
261
+ .showHelpAfterError('Example: parall app templates unshare --app app_…')
262
+ .action(async (opts) => {
263
+ try {
264
+ const appId = parseShareApp(opts.app, 'unshare');
265
+ const { client, orgId } = resolveCredentials();
266
+ const open = await client.getMiniAppTemplateShare(orgId, appId);
267
+ // Revoked even when none was open: one shared meanwhile goes too.
268
+ await client.revokeMiniAppTemplateShare(orgId, appId);
269
+ printJson({ app_id: appId, revoked: open ? { id: open.id, url: open.url } : null });
270
+ printProgress(open
271
+ ? `${open.url} no longer opens; apps already built from it are not affected.`
272
+ : `${appId} had no open template link; nothing changed.`);
273
+ }
274
+ catch (err) {
275
+ printError(err);
276
+ }
277
+ });
278
+ }
@@ -114,9 +114,11 @@ function registerClipTree(clip) {
114
114
  catch (err) {
115
115
  connectionsError = err instanceof Error ? err.message : String(err);
116
116
  }
117
+ // display_name is what people call it; commands still take `name`.
117
118
  const rows = clips.map((c) => ({
118
119
  id: c.id,
119
120
  name: c.name,
121
+ ...(c.display_name ? { display_name: c.display_name } : {}),
120
122
  ...(c.description ? { description: c.description } : {}),
121
123
  version: c.version ?? '-',
122
124
  visibility: c.visibility,
@@ -169,6 +171,7 @@ function registerClipTree(clip) {
169
171
  printJson(entries.map((c) => ({
170
172
  id: c.id,
171
173
  name: c.name,
174
+ ...(c.display_name ? { display_name: c.display_name } : {}),
172
175
  publisher: c.org_id === orgId ? 'your org' : c.org_id,
173
176
  ...(c.description ? { description: c.description } : {}),
174
177
  version: c.version ?? '-',
@@ -241,6 +244,7 @@ function registerClipTree(clip) {
241
244
  const info = {
242
245
  id: entry.id,
243
246
  name: entry.name,
247
+ ...(entry.display_name ? { display_name: entry.display_name } : {}),
244
248
  version: entry.version,
245
249
  description: entry.description,
246
250
  visibility: entry.visibility,
@@ -252,6 +256,14 @@ function registerClipTree(clip) {
252
256
  ...(entry.approved_version_id ? { approved_version_id: entry.approved_version_id } : {}),
253
257
  ...(entry.review_status ? { review_status: entry.review_status } : {}),
254
258
  ...(entry.review_note ? { review_note: entry.review_note } : {}),
259
+ // Your org's own connector: a display-name request awaiting Parall,
260
+ // or why the last one was rejected. Requests are made in the Web app.
261
+ ...(entry.display_name_request
262
+ ? { display_name_request: entry.display_name_request }
263
+ : {}),
264
+ ...(entry.display_name_review_note
265
+ ? { display_name_review_note: entry.display_name_review_note }
266
+ : {}),
255
267
  };
256
268
  printJson(info);
257
269
  }
@@ -1 +1 @@
1
- {"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../src/commands/secrets.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2IpC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,QAiHtD"}
1
+ {"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../src/commands/secrets.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6JpC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,QAsItD"}
@@ -16,7 +16,7 @@ const DISPLAY_NAME_SLOT = '--display-name "<short name people read>"';
16
16
  */
17
17
  function requestCommand(name, flag, where) {
18
18
  const displayName = flag === '--in' ? ` ${DISPLAY_NAME_SLOT}` : '';
19
- return `parall secrets request ${name} ${flag} ${where}${displayName} --purpose "<one line>" --chat <chat>`;
19
+ return `parall secrets request ${name} ${flag} ${where}${displayName} --purpose "<what the key is for>" --chat <chat>`;
20
20
  }
21
21
  /**
22
22
  * The request as it was typed, with the display name still to fill in: what
@@ -30,11 +30,22 @@ function requestWithDisplayNameSlot(name, opts) {
30
30
  DISPLAY_NAME_SLOT,
31
31
  '--purpose',
32
32
  shellQuote(opts.purpose),
33
+ ...(opts.reason !== undefined ? ['--reason', shellQuote(opts.reason)] : []),
33
34
  ...(opts.where !== undefined ? ['--where', shellQuote(opts.where)] : []),
34
35
  '--chat',
35
36
  shellQuote(opts.chat),
36
37
  ].join(' ');
37
38
  }
39
+ /**
40
+ * Whether a request for a key of the agent's own would replace one it has:
41
+ * the card then has to say why, which the purpose alone cannot. As the server
42
+ * decides it (the card's "needs a new key"): a key of its own that it has for
43
+ * long. One it was given for this time only is not replaced by asking again.
44
+ */
45
+ async function replacesOwnKey(client, orgId, name) {
46
+ const catalog = await client.getMyAgentSecretCatalog(orgId, name);
47
+ return (catalog.data ?? []).some((entry) => entry.scope === 'agent' && entry.name === name && entry.grant?.kind !== 'once');
48
+ }
38
49
  /** Where a key it may ask to use lives, as --from takes it. */
39
50
  function fromOf(entry) {
40
51
  if (entry.scope === 'org')
@@ -132,18 +143,25 @@ export function registerSecretCommands(program) {
132
143
  .command('request')
133
144
  .description('Post a request card for a key: to use one that exists (--from), to have a new one made (--in), or, with neither, for a key of your own — the person who manages you, or an org admin, enters it and a key of yours with the same name gets the new value.')
134
145
  .argument('<name>', 'The key name your commands will read, e.g. GITHUB_TOKEN')
135
- .requiredOption('--purpose <text>', 'One line for a non-engineer on what the key is for')
146
+ .requiredOption('--purpose <text>', 'What the key is FOR, one line for a non-engineer, e.g. "Open pull requests in the website repo"')
147
+ .option('--reason <text>', 'Why you need it NOW, not what it is for (that is --purpose), e.g. "The old token expired"; shown on the card as Markdown. Required when you replace a key of your own you already have')
136
148
  .requiredOption('--chat <chatId>', 'Chat to post the card in — the one you are working in (e.g. prll://cht_456)')
137
149
  .option('--from <where>', `Ask to use a key that exists, in ${WHERE_FORMS} (a person or another agent); copy it from \`parall secrets search\`. Whoever decides for that key approves; nobody enters a value`)
138
150
  .option('--in <where>', `Propose a new key in ${WHERE_FORMS} (a person); the person who approves types it, and the key stays there`)
139
- .option('--display-name <text>', 'The name people read for the key — the title of the card and its notification: say what it is in their language, at most 40 characters, e.g. "GitHub token". Required for a key that is made (every request without --from); a key that exists keeps the name it has')
151
+ .option('--display-name <text>', 'The name people read for the key, on the card and in its notification: say what it is in their language, at most 40 characters, e.g. "GitHub token". Required for a key that is made (every request without --from); a key that exists keeps the name it has')
140
152
  .option('--where <text>', 'Where a person can get such a key, if you know (not with --from)')
141
153
  .option('--shared', 'Same as --from org')
142
- .action(async (name, opts) => {
154
+ .action(async (rawName, opts) => {
143
155
  try {
156
+ // As the server reads it: looked up, compared and filed without the spaces around it.
157
+ const name = rawName.trim();
144
158
  if (opts.shared && opts.from !== undefined) {
145
159
  throw new Error('--shared is --from org: give one of them');
146
160
  }
161
+ const reason = opts.reason === undefined ? undefined : String(opts.reason).trim();
162
+ if (reason === '') {
163
+ throw new Error('--reason is empty: say why you need the key now, e.g. --reason "The old token expired" (what the key is for goes in --purpose), or leave --reason out');
164
+ }
147
165
  const fromRaw = opts.shared ? 'org' : opts.from;
148
166
  if (fromRaw !== undefined && opts.in !== undefined) {
149
167
  throw new Error('Give --from (use a key that exists) or --in (propose a new one), not both');
@@ -162,6 +180,9 @@ export function registerSecretCommands(program) {
162
180
  if (fromRaw === undefined && !displayName) {
163
181
  throw new Error(`--display-name is missing: a key that is made needs the name people read on the card instead of ${name} — what the key is, in their language, at most 40 characters (GitHub token, 公司邮箱密码). Run: ${requestWithDisplayNameSlot(name, opts)}`);
164
182
  }
183
+ if (!target && reason === undefined && (await replacesOwnKey(client, orgId, name))) {
184
+ throw new Error(`You already have ${name}, so this request replaces it: add --reason saying why it must change, e.g. --reason "The old token expired" (what the key is for goes in --purpose)`);
185
+ }
165
186
  const result = await client.requestApproval(orgId, {
166
187
  action_type: target ? ACTIONS[kind][target.layer] : AGENT_SECRET_REQUEST_ACTION,
167
188
  resource_uri: `prll://${target ? target.id : (await client.getMe()).id}`,
@@ -172,6 +193,7 @@ export function registerSecretCommands(program) {
172
193
  ...(opts.where !== undefined ? { source: opts.where } : {}),
173
194
  },
174
195
  chat_id: stripPrllScheme(opts.chat),
196
+ ...(reason !== undefined ? { reason } : {}),
175
197
  // The server writes the title; the endpoint still requires one.
176
198
  title: name,
177
199
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parall/cli",
3
- "version": "1.92.0",
3
+ "version": "1.94.0",
4
4
  "description": "CLI client for Parall — universal agent & human access to Parall API",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -42,8 +42,8 @@
42
42
  "node-diff3": "3.2.1",
43
43
  "tar-stream": "^3.2.1",
44
44
  "zod": "^4.3.6",
45
- "@parall/sdk": "1.92.0",
46
- "@parall/agent-core": "1.92.0"
45
+ "@parall/agent-core": "1.94.0",
46
+ "@parall/sdk": "1.94.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@dnd-kit/core": "6.3.1",
@@ -71,7 +71,7 @@
71
71
  "tw-animate-css": "1.4.0",
72
72
  "typescript": "^5.7.0",
73
73
  "vite": "6.4.1",
74
- "@parall/agent-core": "1.92.0"
74
+ "@parall/agent-core": "1.94.0"
75
75
  },
76
76
  "scripts": {
77
77
  "build": "node scripts/generate-miniapp-sdk.mjs --check && node scripts/generate-local-runner.mjs --check && node scripts/generate-app-templates.mjs --check && tsc",