@parall/cli 1.92.0 → 1.93.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/commands/clip.js
CHANGED
|
@@ -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,
|
|
@@ -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;
|
|
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"}
|
package/dist/commands/secrets.js
CHANGED
|
@@ -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 "<
|
|
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>', '
|
|
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
|
|
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 (
|
|
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.
|
|
3
|
+
"version": "1.93.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.
|
|
46
|
-
"@parall/agent-core": "1.
|
|
45
|
+
"@parall/sdk": "1.93.0",
|
|
46
|
+
"@parall/agent-core": "1.93.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.
|
|
74
|
+
"@parall/agent-core": "1.93.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",
|