@parall/cli 1.90.0 → 1.92.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/apps-access.d.ts +7 -0
- package/dist/commands/apps-access.d.ts.map +1 -1
- package/dist/commands/apps-access.js +41 -15
- package/dist/commands/browser.d.ts.map +1 -1
- package/dist/commands/browser.js +6 -1
- package/dist/commands/capabilities.d.ts +11 -0
- package/dist/commands/capabilities.d.ts.map +1 -0
- package/dist/commands/capabilities.js +20 -0
- package/dist/commands/clip-connect.d.ts.map +1 -1
- package/dist/commands/clip-connect.js +1 -4
- package/dist/commands/secrets.d.ts.map +1 -1
- package/dist/commands/secrets.js +37 -6
- package/dist/commands/templates-propose.d.ts +49 -0
- package/dist/commands/templates-propose.d.ts.map +1 -0
- package/dist/commands/templates-propose.js +262 -0
- package/dist/commands/templates.d.ts +11 -0
- package/dist/commands/templates.d.ts.map +1 -0
- package/dist/commands/templates.js +50 -0
- package/dist/index.js +8 -1
- package/dist/lib/output.d.ts +2 -0
- package/dist/lib/output.d.ts.map +1 -1
- package/dist/lib/output.js +4 -0
- package/dist/lib/wiki-shared.d.ts +23 -1
- package/dist/lib/wiki-shared.d.ts.map +1 -1
- package/dist/lib/wiki-shared.js +16 -2
- package/dist/lib/wiki-sync.d.ts.map +1 -1
- package/dist/lib/wiki-sync.js +5 -3
- package/package.json +4 -4
|
@@ -2,6 +2,13 @@ import type { MiniAppAccessLevel } from '@parall/sdk';
|
|
|
2
2
|
import type { Command } from 'commander';
|
|
3
3
|
/** A member level as given on the command line. */
|
|
4
4
|
export declare function parseMemberLevel(raw: string | undefined, what: string): MiniAppAccessLevel;
|
|
5
|
+
/** Who an access list row is for, as given on the command line: a person or
|
|
6
|
+
* agent (usr_…) or a team (team_…), bare or as a prll:// reference. Anything
|
|
7
|
+
* else stops before a request is made. */
|
|
8
|
+
export declare function parseGrantee(raw: string): {
|
|
9
|
+
kind: 'user' | 'team';
|
|
10
|
+
id: string;
|
|
11
|
+
};
|
|
5
12
|
/** A level on the access list: never below read. */
|
|
6
13
|
export declare function parseGrantLevel(raw: string | undefined): 'read' | 'write';
|
|
7
14
|
export declare function registerAppAccessCommands(app: Command): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apps-access.d.ts","sourceRoot":"","sources":["../../src/commands/apps-access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"apps-access.d.ts","sourceRoot":"","sources":["../../src/commands/apps-access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2DzC,mDAAmD;AACnD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAI1F;AAED;;0CAE0C;AAC1C,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAO/E;AAED,oDAAoD;AACpD,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAIzE;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,OAAO,QAqHrD"}
|
|
@@ -3,14 +3,17 @@ import { parsePositiveInt, printError, printJson, stripPrllScheme } from '../lib
|
|
|
3
3
|
import { appAndArg, appIdFrom, withApp } from './apps-args.js';
|
|
4
4
|
/** `parall app access list | members | add | remove | log`
|
|
5
5
|
* (docs/engineering-design/mini-app-access-design.md §6.3): how far the rest
|
|
6
|
-
* of the organization reaches into an app, the people given more
|
|
7
|
-
* one, and the record of
|
|
8
|
-
* change
|
|
6
|
+
* of the organization reaches into an app, the people and teams given more
|
|
7
|
+
* one by one (mini-app-access-team-grants-design.md §3), and the record of
|
|
8
|
+
* every change. The server decides who may see and change what; these
|
|
9
|
+
* commands only name the request. */
|
|
9
10
|
/** The levels the help and the local errors name: everyone else in the
|
|
10
|
-
* organization can be held at any of the three, a person
|
|
11
|
-
* at read or write. */
|
|
11
|
+
* organization can be held at any of the three, a person or team added one
|
|
12
|
+
* by one at read or write. */
|
|
12
13
|
const MEMBER_LEVELS = 'none, read or write';
|
|
13
14
|
const LEVELS = 'read or write';
|
|
15
|
+
/** What add and remove name after the app. */
|
|
16
|
+
const GRANTEE = 'user or team ID (usr_… or team_…)';
|
|
14
17
|
const ACCESS_HELP = `
|
|
15
18
|
Levels:
|
|
16
19
|
none not in their app list and does not open; references to it show as
|
|
@@ -23,6 +26,12 @@ People added one by one (add) get the higher of that and their own level:
|
|
|
23
26
|
the list only ever gives more, it never takes anyone below the member
|
|
24
27
|
level. The app's authors and org owners/admins always hold it outright.
|
|
25
28
|
|
|
29
|
+
A team can be added the same way (add <app> <team_…>): its level reaches
|
|
30
|
+
everyone on the team and on every team below it, agents included, and the
|
|
31
|
+
human managers of the teams above it. It follows the teams as they are, so
|
|
32
|
+
people joining or leaving a team need no change here; deleting the team
|
|
33
|
+
takes it off the list. Team IDs: parall teams list.
|
|
34
|
+
|
|
26
35
|
Who can change it: the app's authors (agents too) and org owners/admins.
|
|
27
36
|
Anyone who can open the app sees the member level and their own level
|
|
28
37
|
(list); only those who can change it also see the list and the record of
|
|
@@ -50,6 +59,17 @@ export function parseMemberLevel(raw, what) {
|
|
|
50
59
|
return level;
|
|
51
60
|
throw new Error(`${what} must be ${MEMBER_LEVELS}`);
|
|
52
61
|
}
|
|
62
|
+
/** Who an access list row is for, as given on the command line: a person or
|
|
63
|
+
* agent (usr_…) or a team (team_…), bare or as a prll:// reference. Anything
|
|
64
|
+
* else stops before a request is made. */
|
|
65
|
+
export function parseGrantee(raw) {
|
|
66
|
+
const id = stripPrllScheme(raw.trim());
|
|
67
|
+
if (id.startsWith('usr_'))
|
|
68
|
+
return { kind: 'user', id };
|
|
69
|
+
if (id.startsWith('team_'))
|
|
70
|
+
return { kind: 'team', id };
|
|
71
|
+
throw new Error(`${raw} is not a person or agent (usr_…) or a team (team_…); find team IDs with: parall teams list`);
|
|
72
|
+
}
|
|
53
73
|
/** A level on the access list: never below read. */
|
|
54
74
|
export function parseGrantLevel(raw) {
|
|
55
75
|
const level = raw?.trim();
|
|
@@ -60,11 +80,11 @@ export function parseGrantLevel(raw) {
|
|
|
60
80
|
export function registerAppAccessCommands(app) {
|
|
61
81
|
const access = app
|
|
62
82
|
.command('access')
|
|
63
|
-
.description('Who can use an app: everyone else in the organization (none, read or write), and people added one by one (read or write)')
|
|
83
|
+
.description('Who can use an app: everyone else in the organization (none, read or write), and people or teams added one by one (read or write)')
|
|
64
84
|
.addHelpText('after', ACCESS_HELP);
|
|
65
85
|
withApp(access
|
|
66
86
|
.command('list')
|
|
67
|
-
.description("Show the app's member level and your own level; its authors and org owners/admins also see
|
|
87
|
+
.description("Show the app's member level and your own level; its authors and org owners/admins also see the people and teams added one by one")).action(async (appId, opts) => {
|
|
68
88
|
try {
|
|
69
89
|
const id = appIdFrom(appId, opts.app);
|
|
70
90
|
const { client, orgId } = resolveCredentials();
|
|
@@ -93,17 +113,20 @@ export function registerAppAccessCommands(app) {
|
|
|
93
113
|
});
|
|
94
114
|
access
|
|
95
115
|
.command('add')
|
|
96
|
-
.description("Give a member of the organization (person or agent) read or write on the app, or change
|
|
116
|
+
.description("Give a member of the organization (person or agent) or a team read or write on the app, or change the level (the app's authors or an org owner/admin)")
|
|
97
117
|
.argument('[appId]', 'App ID (app_… or prll://app_…); or pass --app')
|
|
98
|
-
.argument('[
|
|
118
|
+
.argument('[id]', 'User or agent ID (usr_…), or team ID (team_…)')
|
|
99
119
|
.option('--app <appId>', 'App ID, in place of the first argument')
|
|
100
120
|
.requiredOption('--level <level>', LEVELS)
|
|
101
121
|
.action(async (first, second, opts) => {
|
|
102
122
|
try {
|
|
103
|
-
const [id,
|
|
123
|
+
const [id, raw] = appAndArg(first, second, opts.app, GRANTEE);
|
|
124
|
+
const grantee = parseGrantee(raw);
|
|
104
125
|
const level = parseGrantLevel(opts.level);
|
|
105
126
|
const { client, orgId } = resolveCredentials();
|
|
106
|
-
printJson(
|
|
127
|
+
printJson(grantee.kind === 'team'
|
|
128
|
+
? await client.setMiniAppAccessTeamGrant(orgId, id, grantee.id, level)
|
|
129
|
+
: await client.setMiniAppAccessGrant(orgId, id, grantee.id, level));
|
|
107
130
|
}
|
|
108
131
|
catch (err) {
|
|
109
132
|
printError(err);
|
|
@@ -111,15 +134,18 @@ export function registerAppAccessCommands(app) {
|
|
|
111
134
|
});
|
|
112
135
|
access
|
|
113
136
|
.command('remove')
|
|
114
|
-
.description("Take someone off the app's access list; they keep the member level (the app's authors or an org owner/admin)")
|
|
137
|
+
.description("Take someone, or a team, off the app's access list; they keep the member level (the app's authors or an org owner/admin)")
|
|
115
138
|
.argument('[appId]', 'App ID (app_… or prll://app_…); or pass --app')
|
|
116
|
-
.argument('[
|
|
139
|
+
.argument('[id]', 'User or agent ID (usr_…), or team ID (team_…)')
|
|
117
140
|
.option('--app <appId>', 'App ID, in place of the first argument')
|
|
118
141
|
.action(async (first, second, opts) => {
|
|
119
142
|
try {
|
|
120
|
-
const [id,
|
|
143
|
+
const [id, raw] = appAndArg(first, second, opts.app, GRANTEE);
|
|
144
|
+
const grantee = parseGrantee(raw);
|
|
121
145
|
const { client, orgId } = resolveCredentials();
|
|
122
|
-
printJson(
|
|
146
|
+
printJson(grantee.kind === 'team'
|
|
147
|
+
? await client.removeMiniAppAccessTeamGrant(orgId, id, grantee.id)
|
|
148
|
+
: await client.removeMiniAppAccessGrant(orgId, id, grantee.id));
|
|
123
149
|
}
|
|
124
150
|
catch (err) {
|
|
125
151
|
printError(err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/commands/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAcpC,wBAAgB,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAwCnD;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/commands/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAcpC,wBAAgB,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAwCnD;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAkD9D"}
|
package/dist/commands/browser.js
CHANGED
|
@@ -63,10 +63,15 @@ export function registerBrowserCommands(program) {
|
|
|
63
63
|
const { client, orgId } = resolveCredentials();
|
|
64
64
|
if (parsed.kind === 'profiles') {
|
|
65
65
|
const response = await client.listBrowserUseProfiles(orgId, parsed.profileId);
|
|
66
|
+
if (!json)
|
|
67
|
+
for (const warning of response.warnings ?? [])
|
|
68
|
+
console.error(`Warning: skipped device ${warning.device_id} (${warning.code}); the Profile list may be incomplete.`);
|
|
66
69
|
if (json)
|
|
67
70
|
console.log(JSON.stringify({ ok: true, ...response }));
|
|
68
71
|
else if (!response.data.length)
|
|
69
|
-
console.log(
|
|
72
|
+
console.log(response.warnings?.length
|
|
73
|
+
? 'No accessible Browser Profiles found on the remaining devices. Review the warnings.'
|
|
74
|
+
: 'No accessible Browser Profiles. Ask an org admin to grant access.');
|
|
70
75
|
else
|
|
71
76
|
for (const row of response.data)
|
|
72
77
|
console.log(`${row.profile_id} ${row.device_name} / ${row.name} ${row.placement} accessible ${row.lifecycle_state} ${row.availability}`);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* What this CLI vouches for, printed by `parall capabilities` for the bridge
|
|
4
|
+
* that runs it to declare in its runtime report (probeParallCliFeatures in
|
|
5
|
+
* @parall/agent-core). Each entry is a behavior of this CLI, not of the
|
|
6
|
+
* server.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CLI_FEATURES: readonly ["wiki_read_snapshot"];
|
|
9
|
+
/** The hidden command the agent bridge probes; not for agents or people. */
|
|
10
|
+
export declare function registerCapabilitiesCommand(program: Command, version: string): void;
|
|
11
|
+
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../src/commands/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,YAAY,iCAIf,CAAC;AAEX,4EAA4E;AAC5E,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAOnF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What this CLI vouches for, printed by `parall capabilities` for the bridge
|
|
3
|
+
* that runs it to declare in its runtime report (probeParallCliFeatures in
|
|
4
|
+
* @parall/agent-core). Each entry is a behavior of this CLI, not of the
|
|
5
|
+
* server.
|
|
6
|
+
*/
|
|
7
|
+
export const CLI_FEATURES = [
|
|
8
|
+
// `wiki sync` pins every download batch to the manifest's head_sha, so one
|
|
9
|
+
// sync reads one version (wiki-live-documents.md §7).
|
|
10
|
+
'wiki_read_snapshot',
|
|
11
|
+
];
|
|
12
|
+
/** The hidden command the agent bridge probes; not for agents or people. */
|
|
13
|
+
export function registerCapabilitiesCommand(program, version) {
|
|
14
|
+
program
|
|
15
|
+
.command('capabilities', { hidden: true })
|
|
16
|
+
.description('Print what this CLI supports as JSON, for the agent bridge')
|
|
17
|
+
.action(() => {
|
|
18
|
+
process.stdout.write(`${JSON.stringify({ version, features: CLI_FEATURES })}\n`);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clip-connect.d.ts","sourceRoot":"","sources":["../../src/commands/clip-connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"clip-connect.d.ts","sourceRoot":"","sources":["../../src/commands/clip-connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AA0GjD,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAqH9D"}
|
|
@@ -3,7 +3,7 @@ import { ApiError, CLIP_CONNECTION_CONNECT_ACTION } from '@parall/sdk';
|
|
|
3
3
|
import { printFiledApproval } from '../lib/approvers.js';
|
|
4
4
|
import { resolveCredentials, resolveRuntimeContext } from '../lib/client.js';
|
|
5
5
|
import { CLIP_REF_HELP, clipNotFoundError, connectorRefArg, findConnector, } from '../lib/connector-ref.js';
|
|
6
|
-
import { printError, printJson, printProgress, stripPrllScheme } from '../lib/output.js';
|
|
6
|
+
import { printError, printJson, printProgress, shellQuote, stripPrllScheme, } from '../lib/output.js';
|
|
7
7
|
// `parall connector connect` is how an agent that cannot run a connector yet
|
|
8
8
|
// gets an account for it (agent-connector-connect-design.md §4): it files a
|
|
9
9
|
// `clip.connection.connect` approval, and the person taps Connect on the card
|
|
@@ -13,9 +13,6 @@ Examples:
|
|
|
13
13
|
parall connector connect google-calendar --reason "Check whether you are free tomorrow afternoon"
|
|
14
14
|
parall connector connect jira --reason "File this bug in the team's Jira" --from org`;
|
|
15
15
|
const USAGE_HINT = '(example: parall connector connect google-calendar --reason "Check whether you are free tomorrow afternoon"; add --help for usage)';
|
|
16
|
-
function shellQuote(value) {
|
|
17
|
-
return `'${value.replaceAll("'", `'\\''`)}'`;
|
|
18
|
-
}
|
|
19
16
|
function detailsOf(err) {
|
|
20
17
|
const details = err.extras?.details;
|
|
21
18
|
return details && typeof details === 'object' ? details : {};
|
|
@@ -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;AA2IpC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,QAiHtD"}
|
package/dist/commands/secrets.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AGENT_SECRET_LAYER_ACTIONS, AGENT_SECRET_REQUEST_ACTION, } from '@parall/sdk';
|
|
2
2
|
import { printFiledApproval } from '../lib/approvers.js';
|
|
3
3
|
import { resolveCredentials } from '../lib/client.js';
|
|
4
|
-
import { printError, printJson, printProgress, stripPrllScheme } from '../lib/output.js';
|
|
4
|
+
import { printError, printJson, printProgress, shellQuote, stripPrllScheme, } from '../lib/output.js';
|
|
5
5
|
// The request action per layer: --from asks to use a key there, --in to have
|
|
6
6
|
// one made.
|
|
7
7
|
const ACTIONS = {
|
|
@@ -9,9 +9,31 @@ const ACTIONS = {
|
|
|
9
9
|
in: AGENT_SECRET_LAYER_ACTIONS.new,
|
|
10
10
|
};
|
|
11
11
|
const WHERE_FORMS = 'org, team:<team_…> or user:<usr_…>';
|
|
12
|
-
|
|
12
|
+
const DISPLAY_NAME_SLOT = '--display-name "<short name people read>"';
|
|
13
|
+
/**
|
|
14
|
+
* The request an agent copies, filling in only its purpose and chat — and,
|
|
15
|
+
* for a key that is made (--in), the name people will read for it.
|
|
16
|
+
*/
|
|
13
17
|
function requestCommand(name, flag, where) {
|
|
14
|
-
|
|
18
|
+
const displayName = flag === '--in' ? ` ${DISPLAY_NAME_SLOT}` : '';
|
|
19
|
+
return `parall secrets request ${name} ${flag} ${where}${displayName} --purpose "<one line>" --chat <chat>`;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The request as it was typed, with the display name still to fill in: what
|
|
23
|
+
* a refusal for a missing one gives the agent to copy.
|
|
24
|
+
*/
|
|
25
|
+
function requestWithDisplayNameSlot(name, opts) {
|
|
26
|
+
return [
|
|
27
|
+
'parall secrets request',
|
|
28
|
+
name,
|
|
29
|
+
...(opts.in !== undefined ? ['--in', shellQuote(opts.in)] : []),
|
|
30
|
+
DISPLAY_NAME_SLOT,
|
|
31
|
+
'--purpose',
|
|
32
|
+
shellQuote(opts.purpose),
|
|
33
|
+
...(opts.where !== undefined ? ['--where', shellQuote(opts.where)] : []),
|
|
34
|
+
'--chat',
|
|
35
|
+
shellQuote(opts.chat),
|
|
36
|
+
].join(' ');
|
|
15
37
|
}
|
|
16
38
|
/** Where a key it may ask to use lives, as --from takes it. */
|
|
17
39
|
function fromOf(entry) {
|
|
@@ -85,7 +107,7 @@ export function registerSecretCommands(program) {
|
|
|
85
107
|
.description('Find the keys you have or may ask for, and ask a person for one');
|
|
86
108
|
secrets
|
|
87
109
|
.command('list')
|
|
88
|
-
.description("List the keys you have and the ones you may ask to use — the organization's, your teams', other people's and agents' (names and purposes, never values) — your requests still waiting, and the teams you may propose a key in")
|
|
110
|
+
.description("List the keys you have and the ones you may ask to use — the organization's, your teams', other people's and agents' (names, display names and purposes, never values) — your requests still waiting, and the teams you may propose a key in")
|
|
89
111
|
.action(async () => {
|
|
90
112
|
try {
|
|
91
113
|
await printCatalog();
|
|
@@ -96,8 +118,8 @@ export function registerSecretCommands(program) {
|
|
|
96
118
|
});
|
|
97
119
|
secrets
|
|
98
120
|
.command('search')
|
|
99
|
-
.description('Like list, but only the keys whose name, purpose or owner contains the word (ignoring case); each one you may ask to use comes with the request to run')
|
|
100
|
-
.argument('<word>', 'A word from the key name, its purpose or its owner, e.g. github')
|
|
121
|
+
.description('Like list, but only the keys whose name, display name, purpose or owner contains the word (ignoring case); each one you may ask to use comes with the request to run')
|
|
122
|
+
.argument('<word>', 'A word from the key name, its display name, its purpose or its owner, e.g. github')
|
|
101
123
|
.action(async (word) => {
|
|
102
124
|
try {
|
|
103
125
|
await printCatalog(word);
|
|
@@ -114,6 +136,7 @@ export function registerSecretCommands(program) {
|
|
|
114
136
|
.requiredOption('--chat <chatId>', 'Chat to post the card in — the one you are working in (e.g. prll://cht_456)')
|
|
115
137
|
.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`)
|
|
116
138
|
.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')
|
|
117
140
|
.option('--where <text>', 'Where a person can get such a key, if you know (not with --from)')
|
|
118
141
|
.option('--shared', 'Same as --from org')
|
|
119
142
|
.action(async (name, opts) => {
|
|
@@ -128,15 +151,23 @@ export function registerSecretCommands(program) {
|
|
|
128
151
|
if (fromRaw !== undefined && opts.where !== undefined) {
|
|
129
152
|
throw new Error('--where does not apply with --from or --shared: nobody enters a value for a key that exists');
|
|
130
153
|
}
|
|
154
|
+
const displayName = opts.displayName?.trim();
|
|
155
|
+
if (fromRaw !== undefined && opts.displayName !== undefined) {
|
|
156
|
+
throw new Error('--display-name does not apply with --from or --shared: a key that exists keeps the name its owner gave it. Run the same command without --display-name');
|
|
157
|
+
}
|
|
131
158
|
const { client, orgId } = resolveCredentials();
|
|
132
159
|
const kind = fromRaw !== undefined ? 'from' : 'in';
|
|
133
160
|
const raw = fromRaw ?? opts.in;
|
|
134
161
|
const target = raw !== undefined ? parseWhere(`--${kind}`, raw, orgId) : undefined;
|
|
162
|
+
if (fromRaw === undefined && !displayName) {
|
|
163
|
+
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
|
+
}
|
|
135
165
|
const result = await client.requestApproval(orgId, {
|
|
136
166
|
action_type: target ? ACTIONS[kind][target.layer] : AGENT_SECRET_REQUEST_ACTION,
|
|
137
167
|
resource_uri: `prll://${target ? target.id : (await client.getMe()).id}`,
|
|
138
168
|
action_payload: {
|
|
139
169
|
name,
|
|
170
|
+
...(displayName ? { display_name: displayName } : {}),
|
|
140
171
|
purpose: opts.purpose,
|
|
141
172
|
...(opts.where !== undefined ? { source: opts.where } : {}),
|
|
142
173
|
},
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import { type TemplateCatalogItem } from '@parall/sdk';
|
|
3
|
+
/** What the command was asked to propose, as the copyable command repeats it. */
|
|
4
|
+
export interface ProposeInput {
|
|
5
|
+
template: string;
|
|
6
|
+
reason?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
params: Record<string, string>;
|
|
9
|
+
chat?: string;
|
|
10
|
+
threadRootId?: string;
|
|
11
|
+
}
|
|
12
|
+
/** A parameter still to fill in: its key, and what to ask the person for. */
|
|
13
|
+
export interface ParamPlaceholder {
|
|
14
|
+
key: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
}
|
|
17
|
+
/** A refusal with the step that would work instead. */
|
|
18
|
+
export declare class ProposeRefusal extends Error {
|
|
19
|
+
readonly nextStep?: string | undefined;
|
|
20
|
+
constructor(message: string, nextStep?: string | undefined);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The propose command in its named form: the values given, a placeholder for
|
|
24
|
+
* the reason when there is none, and one `--param key=<…>` per parameter
|
|
25
|
+
* still to fill in.
|
|
26
|
+
*/
|
|
27
|
+
export declare function proposeCommand(input: ProposeInput, missing?: ParamPlaceholder[]): string;
|
|
28
|
+
/** Parses repeatable --param key=value flags; a key given twice is refused. */
|
|
29
|
+
export declare function parseParams(values: string[] | undefined): Record<string, string>;
|
|
30
|
+
/** The template as given: its ID, or a name to look up in the catalog. */
|
|
31
|
+
export declare function templateArg(raw: string): {
|
|
32
|
+
id: string;
|
|
33
|
+
} | {
|
|
34
|
+
name: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Resolves a catalog name to its template ID. Anything that is not exactly
|
|
38
|
+
* one catalog entry stops here, before a card is filed.
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveTemplateName(name: string, catalog: TemplateCatalogItem[], input: Omit<ProposeInput, 'template'>): TemplateCatalogItem;
|
|
41
|
+
/** The next step for each refusal of the card itself. */
|
|
42
|
+
export declare function refusalStep(err: unknown, input: ProposeInput): string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* A refusal as the agent reads it: what was wrong, then what to run. Plain
|
|
45
|
+
* lines; the server's code stays in brackets for reference.
|
|
46
|
+
*/
|
|
47
|
+
export declare function refusalText(err: unknown, nextStep?: string): string;
|
|
48
|
+
export declare function registerTemplateProposeCommand(templates: Command): void;
|
|
49
|
+
//# sourceMappingURL=templates-propose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates-propose.d.ts","sourceRoot":"","sources":["../../src/commands/templates-propose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAIL,KAAK,mBAAmB,EAEzB,MAAM,aAAa,CAAC;AAqCrB,iFAAiF;AACjF,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,IAAI,CAAC,EAAE,MAA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EAM_HIRE_ACTION, } from '@parall/sdk';
|
|
2
|
+
import { printFiledApproval } from '../lib/approvers.js';
|
|
3
|
+
import { resolveCredentials, resolveRuntimeContext } from '../lib/client.js';
|
|
4
|
+
import { CALLER_SCOPE_NEXT_STEPS, printJson, printProgress, stripPrllScheme, } from '../lib/output.js';
|
|
5
|
+
// `parall templates propose` is how an agent suggests a whole agent team to
|
|
6
|
+
// the person it works with: it files a `template.team.hire` card in the chat
|
|
7
|
+
// it is working in, a person there taps 创建团队 (Create team), and the team is
|
|
8
|
+
// created in the background. The server freezes the template onto the card and
|
|
9
|
+
// checks everything else; this command only shapes the request and turns each
|
|
10
|
+
// refusal into the command that would work.
|
|
11
|
+
const REASON_PLACEHOLDER = '"<why it fits + its first task>"';
|
|
12
|
+
const LIST_STEP = 'Each team you can propose, with its command to copy: parall templates list';
|
|
13
|
+
const EXAMPLES = `
|
|
14
|
+
Example:
|
|
15
|
+
parall templates propose --template tpl_abc123 --reason "Fits your launch; first task: audit the signup funnel" --param company=Acme
|
|
16
|
+
|
|
17
|
+
Each template's ready-to-run line: parall templates list`;
|
|
18
|
+
const USAGE_HINT = `(example: parall templates propose --template <tpl_…> --reason ${REASON_PLACEHOLDER}; each template's line: parall templates list)`;
|
|
19
|
+
/** A refusal with the step that would work instead. */
|
|
20
|
+
export class ProposeRefusal extends Error {
|
|
21
|
+
nextStep;
|
|
22
|
+
constructor(message, nextStep) {
|
|
23
|
+
super(message);
|
|
24
|
+
this.nextStep = nextStep;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function shellArg(value) {
|
|
28
|
+
return /^[A-Za-z0-9_./:=@,+-]+$/.test(value) ? value : `'${value.replaceAll("'", `'\\''`)}'`;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The propose command in its named form: the values given, a placeholder for
|
|
32
|
+
* the reason when there is none, and one `--param key=<…>` per parameter
|
|
33
|
+
* still to fill in.
|
|
34
|
+
*/
|
|
35
|
+
export function proposeCommand(input, missing = []) {
|
|
36
|
+
const parts = ['parall templates propose', '--template', shellArg(input.template)];
|
|
37
|
+
parts.push('--reason', input.reason ? shellArg(input.reason) : REASON_PLACEHOLDER);
|
|
38
|
+
if (input.name)
|
|
39
|
+
parts.push('--name', shellArg(input.name));
|
|
40
|
+
const missingKeys = new Set(missing.map((p) => p.key));
|
|
41
|
+
for (const [key, value] of Object.entries(input.params)) {
|
|
42
|
+
if (!missingKeys.has(key))
|
|
43
|
+
parts.push('--param', shellArg(`${key}=${value}`));
|
|
44
|
+
}
|
|
45
|
+
for (const p of missing) {
|
|
46
|
+
const label = p.label?.trim().replace(/[<>]/g, '');
|
|
47
|
+
parts.push('--param', shellArg(`${p.key}=<${label || 'value'}>`));
|
|
48
|
+
}
|
|
49
|
+
if (input.chat)
|
|
50
|
+
parts.push('--chat', input.chat);
|
|
51
|
+
if (input.threadRootId)
|
|
52
|
+
parts.push('--thread-root-id', input.threadRootId);
|
|
53
|
+
return parts.join(' ');
|
|
54
|
+
}
|
|
55
|
+
/** A value still shaped like the placeholder it was copied from. */
|
|
56
|
+
const isPlaceholder = (value) => /^<[^<>]*>$/.test(value.trim());
|
|
57
|
+
function placeholderRefusal(option, value) {
|
|
58
|
+
return new ProposeRefusal(`${option} is still the placeholder ${value.trim()}: put the real value in its place.`, option === '--param'
|
|
59
|
+
? 'Ask the person for any value you do not know, then run the command again.'
|
|
60
|
+
: undefined);
|
|
61
|
+
}
|
|
62
|
+
/** Parses repeatable --param key=value flags; a key given twice is refused. */
|
|
63
|
+
export function parseParams(values) {
|
|
64
|
+
const out = {};
|
|
65
|
+
for (const raw of values ?? []) {
|
|
66
|
+
const eq = raw.indexOf('=');
|
|
67
|
+
const key = eq > 0 ? raw.slice(0, eq).trim() : '';
|
|
68
|
+
if (!key) {
|
|
69
|
+
throw new ProposeRefusal(`--param takes key=value, not "${raw}".`, 'Give each value as --param key=value, for example --param company=Acme.');
|
|
70
|
+
}
|
|
71
|
+
const value = raw.slice(eq + 1);
|
|
72
|
+
if (isPlaceholder(value))
|
|
73
|
+
throw placeholderRefusal('--param', `${key}=${value}`);
|
|
74
|
+
if (Object.hasOwn(out, key)) {
|
|
75
|
+
throw new ProposeRefusal(`--param ${key} is given twice.`, `Give ${key} once.`);
|
|
76
|
+
}
|
|
77
|
+
out[key] = value;
|
|
78
|
+
}
|
|
79
|
+
return out;
|
|
80
|
+
}
|
|
81
|
+
/** The template as given: its ID, or a name to look up in the catalog. */
|
|
82
|
+
export function templateArg(raw) {
|
|
83
|
+
const trimmed = raw.trim();
|
|
84
|
+
if (!trimmed)
|
|
85
|
+
throw new ProposeRefusal('--template is empty.', LIST_STEP);
|
|
86
|
+
if (isPlaceholder(trimmed))
|
|
87
|
+
throw placeholderRefusal('--template', trimmed);
|
|
88
|
+
const bare = stripPrllScheme(trimmed);
|
|
89
|
+
if (bare.startsWith('tpl_'))
|
|
90
|
+
return { id: bare };
|
|
91
|
+
// A prll:// reference is an ID, never a template's name.
|
|
92
|
+
if (trimmed.startsWith('prll://')) {
|
|
93
|
+
throw new ProposeRefusal(`${trimmed} is not a team template.`, LIST_STEP);
|
|
94
|
+
}
|
|
95
|
+
return { name: trimmed };
|
|
96
|
+
}
|
|
97
|
+
const memberNames = (t) => (t.members ?? []).map((m) => m.name).join(', ');
|
|
98
|
+
/**
|
|
99
|
+
* Resolves a catalog name to its template ID. Anything that is not exactly
|
|
100
|
+
* one catalog entry stops here, before a card is filed.
|
|
101
|
+
*/
|
|
102
|
+
export function resolveTemplateName(name, catalog, input) {
|
|
103
|
+
const wanted = name.trim().toLowerCase();
|
|
104
|
+
const matches = catalog.filter((t) => t.name.trim().toLowerCase() === wanted);
|
|
105
|
+
if (matches.length === 1)
|
|
106
|
+
return matches[0];
|
|
107
|
+
if (matches.length > 1) {
|
|
108
|
+
const lines = matches.map((t) => {
|
|
109
|
+
const members = memberNames(t);
|
|
110
|
+
return ` ${proposeCommand({ ...input, template: t.template_id })}${members ? ` # ${members}` : ''}`;
|
|
111
|
+
});
|
|
112
|
+
throw new ProposeRefusal(`More than one team template is named "${name.trim()}".`, `Pick one by its ID:\n${lines.join('\n')}`);
|
|
113
|
+
}
|
|
114
|
+
// Not a catalog name, but shaped like another kind of ID (cht_…, usr_…).
|
|
115
|
+
if (/^[a-z]{2,4}_[A-Za-z0-9]+$/.test(name.trim())) {
|
|
116
|
+
throw new ProposeRefusal(`${name.trim()} is not a team template.`, LIST_STEP);
|
|
117
|
+
}
|
|
118
|
+
throw new ProposeRefusal(`No team template is named "${name.trim()}".`, LIST_STEP);
|
|
119
|
+
}
|
|
120
|
+
function missingKeys(err) {
|
|
121
|
+
const details = err.extras?.details;
|
|
122
|
+
if (!details || typeof details !== 'object')
|
|
123
|
+
return [];
|
|
124
|
+
const missing = details.missing;
|
|
125
|
+
return Array.isArray(missing) ? missing.filter((k) => typeof k === 'string') : [];
|
|
126
|
+
}
|
|
127
|
+
/** The next step for each refusal of the card itself. */
|
|
128
|
+
export function refusalStep(err, input) {
|
|
129
|
+
if (!(err instanceof ApiError))
|
|
130
|
+
return undefined;
|
|
131
|
+
switch (err.code) {
|
|
132
|
+
case 'MISSING_PARAMETER': {
|
|
133
|
+
const keys = missingKeys(err);
|
|
134
|
+
const command = proposeCommand(input, keys.map((key) => ({ key })));
|
|
135
|
+
return `No card posted: the team needs ${keys.length > 0 ? keys.join(', ') : 'more values'} to name its channel or project. Ask the person for what you do not know, then run:\n ${command}`;
|
|
136
|
+
}
|
|
137
|
+
case 'INVALID_RESOURCE_URI':
|
|
138
|
+
case 'TEMPLATE_NOT_FOUND':
|
|
139
|
+
return `No card posted: ${input.template} is not a team template this organization can hire. ${LIST_STEP}`;
|
|
140
|
+
case 'REQUESTER_NOT_ALLOWED':
|
|
141
|
+
return 'No card posted: team cards come from an active agent of this organization. A person asks an agent in the chat to propose the team, or an org admin hires it on the Templates page.';
|
|
142
|
+
case 'INVALID_ACTION_PAYLOAD':
|
|
143
|
+
return 'No card posted. Fix what the error names (--reason, --name or --param) and run the command again; see `parall templates propose --help`.';
|
|
144
|
+
default:
|
|
145
|
+
return err.code ? CALLER_SCOPE_NEXT_STEPS[err.code] : undefined;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* A refusal as the agent reads it: what was wrong, then what to run. Plain
|
|
150
|
+
* lines; the server's code stays in brackets for reference.
|
|
151
|
+
*/
|
|
152
|
+
export function refusalText(err, nextStep) {
|
|
153
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
154
|
+
const code = err instanceof ApiError && err.code ? ` [${err.code}]` : '';
|
|
155
|
+
return `error: ${message}${code}${nextStep ? `\n${nextStep}` : ''}`;
|
|
156
|
+
}
|
|
157
|
+
function refuse(err, nextStep) {
|
|
158
|
+
console.error(refusalText(err, nextStep));
|
|
159
|
+
return process.exit(1);
|
|
160
|
+
}
|
|
161
|
+
/** Checks everything that can be refused before any request. */
|
|
162
|
+
function readInput(opts) {
|
|
163
|
+
const reason = opts.reason.trim();
|
|
164
|
+
if (!reason) {
|
|
165
|
+
throw new ProposeRefusal('--reason needs one line for the person: why this team fits and its first task.');
|
|
166
|
+
}
|
|
167
|
+
if (isPlaceholder(reason))
|
|
168
|
+
throw placeholderRefusal('--reason', reason);
|
|
169
|
+
const name = opts.name?.trim() || undefined;
|
|
170
|
+
if (name && isPlaceholder(name))
|
|
171
|
+
throw placeholderRefusal('--name', name);
|
|
172
|
+
const params = parseParams(opts.param);
|
|
173
|
+
const chat = opts.chat?.trim() || undefined;
|
|
174
|
+
if (chat && !stripPrllScheme(chat).startsWith('cht_')) {
|
|
175
|
+
throw new ProposeRefusal(`--chat takes a chat (cht_…), not ${chat}.`, 'Leave --chat out to post the card in the chat you are working in.');
|
|
176
|
+
}
|
|
177
|
+
const threadRootId = opts.threadRootId !== undefined ? stripPrllScheme(opts.threadRootId.trim()) : undefined;
|
|
178
|
+
if (threadRootId !== undefined && !threadRootId.startsWith('msg_')) {
|
|
179
|
+
throw new ProposeRefusal(`--thread-root-id takes the thread's first message (msg_…), not ${opts.threadRootId}.`);
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
template: opts.template,
|
|
183
|
+
reason,
|
|
184
|
+
name,
|
|
185
|
+
params,
|
|
186
|
+
chat: chat ? stripPrllScheme(chat) : undefined,
|
|
187
|
+
threadRootId,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function printProposed(result, fallbackTitle) {
|
|
191
|
+
printJson(result);
|
|
192
|
+
const team = result.title || fallbackTitle;
|
|
193
|
+
if (result.deduplicated) {
|
|
194
|
+
printFiledApproval(result, 'Already waiting');
|
|
195
|
+
printProgress(`Nothing new was posted: a card for this team is already waiting. Point the person to it (they tap 创建团队 (Create team)); to change it, withdraw it first with \`parall approvals cancel ${result.id}\` and run this command again.`);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
printProgress(`Tell the person, in their language: "I proposed ${team} on a card: tap 创建团队 (Create team) to create it, and I'll get the team started."`);
|
|
199
|
+
printFiledApproval(result, 'Created');
|
|
200
|
+
}
|
|
201
|
+
printProgress('End your turn now. You are woken when they decide and again when the team is ready — do not wait with `parall approvals wait`.');
|
|
202
|
+
}
|
|
203
|
+
export function registerTemplateProposeCommand(templates) {
|
|
204
|
+
templates
|
|
205
|
+
.command('propose')
|
|
206
|
+
.description('Propose a team from `parall templates list` to the person you are working with, on a card in the chat. When someone there taps 创建团队 (Create team) the team is created; you are woken when they decide and again when the team is ready, to open its new channel')
|
|
207
|
+
.usage(`--template <tpl_…> --reason ${REASON_PLACEHOLDER} [--name "<team name>"] [--param key=value]… [--chat <cht_…>] [--thread-root-id <msg_…>]`)
|
|
208
|
+
.requiredOption('--template <tpl_…>', 'Template ID from `parall templates list` (prll://tpl_… works too); a name from that list works when it is unique')
|
|
209
|
+
.requiredOption('--reason <text>', 'One line for the person, in their language: why this team fits and its first task (at most 300 characters)')
|
|
210
|
+
.option('--name <name>', "Name for the new team (default: the template's name)")
|
|
211
|
+
.option('--param <key=value>', 'A value for one of the template parameters; repeat for each. `parall templates list` shows the ones a template needs', (value, previous = []) => [...previous, value])
|
|
212
|
+
.option('--chat <cht_…>', 'Chat to post the card in (default: the chat you are working in)')
|
|
213
|
+
.option('--thread-root-id <msg_…>', 'Post the card in this thread of the chat; pass it when you are working in a thread, it is never inferred')
|
|
214
|
+
.showHelpAfterError(USAGE_HINT)
|
|
215
|
+
.addHelpText('after', EXAMPLES)
|
|
216
|
+
.action(async (opts) => {
|
|
217
|
+
let input;
|
|
218
|
+
try {
|
|
219
|
+
// Everything that can be refused locally is refused before any request.
|
|
220
|
+
input = readInput(opts);
|
|
221
|
+
const arg = templateArg(opts.template);
|
|
222
|
+
const chatId = input.chat ?? stripPrllScheme(resolveRuntimeContext().chatId ?? '');
|
|
223
|
+
if (!chatId) {
|
|
224
|
+
throw new ProposeRefusal('No chat to post the card in.', 'Pass --chat <cht_…>, the chat you are working in.');
|
|
225
|
+
}
|
|
226
|
+
const { client, orgId } = resolveCredentials();
|
|
227
|
+
let templateId;
|
|
228
|
+
let fallbackTitle;
|
|
229
|
+
if ('id' in arg) {
|
|
230
|
+
templateId = arg.id;
|
|
231
|
+
fallbackTitle = input.name ?? templateId;
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
const found = resolveTemplateName(arg.name, await client.listTemplateCatalog(orgId), input);
|
|
235
|
+
templateId = found.template_id;
|
|
236
|
+
fallbackTitle = input.name ?? found.name;
|
|
237
|
+
}
|
|
238
|
+
input = { ...input, template: templateId };
|
|
239
|
+
const payload = {
|
|
240
|
+
reason: input.reason,
|
|
241
|
+
...(input.name ? { team_name: input.name } : {}),
|
|
242
|
+
...(Object.keys(input.params).length > 0 ? { parameter_values: input.params } : {}),
|
|
243
|
+
};
|
|
244
|
+
const result = await client.requestApproval(orgId, {
|
|
245
|
+
action_type: TEMPLATE_TEAM_HIRE_ACTION,
|
|
246
|
+
resource_uri: `prll://${templateId}`,
|
|
247
|
+
chat_id: chatId,
|
|
248
|
+
...(input.threadRootId !== undefined ? { thread_root_id: input.threadRootId } : {}),
|
|
249
|
+
// The server titles the card with the team's name; the endpoint
|
|
250
|
+
// still requires one.
|
|
251
|
+
title: fallbackTitle,
|
|
252
|
+
action_payload: { ...payload },
|
|
253
|
+
});
|
|
254
|
+
printProposed(result, fallbackTitle);
|
|
255
|
+
}
|
|
256
|
+
catch (err) {
|
|
257
|
+
if (err instanceof ProposeRefusal)
|
|
258
|
+
refuse(err, err.nextStep);
|
|
259
|
+
refuse(err, input ? refusalStep(err, input) : undefined);
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { TemplateCatalogItem } from '@parall/sdk';
|
|
3
|
+
/**
|
|
4
|
+
* One block per template: name — mission, its members with their roles, and
|
|
5
|
+
* the propose command to copy, with only the reason and each required
|
|
6
|
+
* parameter left to fill in. Two templates can share a name; the ID in the
|
|
7
|
+
* command tells them apart.
|
|
8
|
+
*/
|
|
9
|
+
export declare function renderTemplateCatalog(templates: TemplateCatalogItem[]): string;
|
|
10
|
+
export declare function registerTemplateCommands(program: Command): void;
|
|
11
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/commands/templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAWvD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,mBAAmB,EAAE,GAAG,MAAM,CAc9E;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+B/D"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { resolveCredentials } from '../lib/client.js';
|
|
2
|
+
import { printError, printProgress } from '../lib/output.js';
|
|
3
|
+
import { proposeCommand, registerTemplateProposeCommand } from './templates-propose.js';
|
|
4
|
+
// `parall templates`: the agent teams this organization can hire, and the
|
|
5
|
+
// card that proposes one to a person (`propose`). Distinct from
|
|
6
|
+
// `parall app templates`, the Mini App template library.
|
|
7
|
+
const oneLine = (text) => text.replace(/\s+/g, ' ').trim();
|
|
8
|
+
/**
|
|
9
|
+
* One block per template: name — mission, its members with their roles, and
|
|
10
|
+
* the propose command to copy, with only the reason and each required
|
|
11
|
+
* parameter left to fill in. Two templates can share a name; the ID in the
|
|
12
|
+
* command tells them apart.
|
|
13
|
+
*/
|
|
14
|
+
export function renderTemplateCatalog(templates) {
|
|
15
|
+
return templates
|
|
16
|
+
.map((t) => {
|
|
17
|
+
const lines = [`${oneLine(t.name)} — ${oneLine(t.mission)}`];
|
|
18
|
+
const members = (t.members ?? []).map((m) => m.role?.trim() ? `${oneLine(m.name)} (${oneLine(m.role)})` : oneLine(m.name));
|
|
19
|
+
if (members.length > 0)
|
|
20
|
+
lines.push(` Members: ${members.join(', ')}`);
|
|
21
|
+
lines.push(` ${proposeCommand({ template: t.template_id, params: {} }, t.required_parameters ?? [])}`);
|
|
22
|
+
return lines.join('\n');
|
|
23
|
+
})
|
|
24
|
+
.join('\n\n');
|
|
25
|
+
}
|
|
26
|
+
export function registerTemplateCommands(program) {
|
|
27
|
+
const templates = program
|
|
28
|
+
.command('templates')
|
|
29
|
+
.description('Agent teams this organization can hire: list them, and propose one to the person you are working with on a card');
|
|
30
|
+
templates
|
|
31
|
+
.command('list')
|
|
32
|
+
.description('The team templates this organization can hire, each with the command that proposes it')
|
|
33
|
+
.addHelpText('after', '\nExample:\n parall templates list')
|
|
34
|
+
.action(async () => {
|
|
35
|
+
try {
|
|
36
|
+
const { client, orgId } = resolveCredentials();
|
|
37
|
+
const catalog = await client.listTemplateCatalog(orgId);
|
|
38
|
+
if (catalog.length === 0) {
|
|
39
|
+
printProgress('No team templates can be hired in this organization yet.');
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
console.log(renderTemplateCatalog(catalog));
|
|
43
|
+
printProgress(`${catalog.length} team template${catalog.length === 1 ? '' : 's'}. Pick the one that fits, replace each <…> in its line (ask the person for values you do not know) and run it; the card goes to the chat you are working in.`);
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
printError(err);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
registerTemplateProposeCommand(templates);
|
|
50
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { registerAgentCommands } from './commands/agents.js';
|
|
|
5
5
|
import { registerApprovalCommands } from './commands/approvals.js';
|
|
6
6
|
import { registerCloudProfileCommands } from './commands/cloud-profile.js';
|
|
7
7
|
import { registerBrowserCommands } from './commands/browser.js';
|
|
8
|
+
import { registerCapabilitiesCommand } from './commands/capabilities.js';
|
|
8
9
|
import { registerChatCommands } from './commands/chats.js';
|
|
9
10
|
import { registerClipCommands } from './commands/clip.js';
|
|
10
11
|
import { registerCommentCommands } from './commands/comments.js';
|
|
@@ -25,6 +26,7 @@ import { registerSecretCommands } from './commands/secrets.js';
|
|
|
25
26
|
import { registerSlackCommands } from './commands/slack.js';
|
|
26
27
|
import { registerTaskCommands } from './commands/tasks.js';
|
|
27
28
|
import { registerTeamCommands } from './commands/teams.js';
|
|
29
|
+
import { registerTemplateCommands } from './commands/templates.js';
|
|
28
30
|
import { registerTriggerCommands } from './commands/triggers.js';
|
|
29
31
|
import { registerUserCommands } from './commands/users.js';
|
|
30
32
|
import { registerWatchCommands } from './commands/watch.js';
|
|
@@ -66,6 +68,7 @@ registerProjectCommands(program);
|
|
|
66
68
|
registerProfileCommands(program);
|
|
67
69
|
registerSecretCommands(program);
|
|
68
70
|
registerTeamCommands(program);
|
|
71
|
+
registerTemplateCommands(program);
|
|
69
72
|
registerScheduleCommands(program);
|
|
70
73
|
registerTriggerCommands(program);
|
|
71
74
|
registerUserCommands(program);
|
|
@@ -82,10 +85,14 @@ registerCloudProfileCommands(program);
|
|
|
82
85
|
registerSlackCommands(program);
|
|
83
86
|
registerMSTeamsCommands(program);
|
|
84
87
|
registerWechatCommands(program);
|
|
88
|
+
registerCapabilitiesCommand(program, version);
|
|
85
89
|
const updateNotifier = createUpdateNotifier(version, {
|
|
86
90
|
canWriteHint: () => !stderrJoinsStdout(),
|
|
87
91
|
});
|
|
88
|
-
program.hook('postAction', () => {
|
|
92
|
+
program.hook('postAction', (_command, actionCommand) => {
|
|
93
|
+
// The bridge's probe runs at every bridge start; it never checks for updates.
|
|
94
|
+
if (actionCommand.name() === 'capabilities')
|
|
95
|
+
return;
|
|
89
96
|
if (process.exitCode === undefined || process.exitCode === 0) {
|
|
90
97
|
updateNotifier.afterSuccessfulCommand();
|
|
91
98
|
}
|
package/dist/lib/output.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export declare function printRefHint(entityId: string, action?: string): void;
|
|
|
27
27
|
* Strip the `prll://` scheme prefix from an entity ID if present.
|
|
28
28
|
* Allows CLI commands to accept both raw IDs (`tsk_abc`) and URIs (`prll://tsk_abc`).
|
|
29
29
|
*/
|
|
30
|
+
/** One shell word holding `value` exactly, for a command an agent copies. */
|
|
31
|
+
export declare function shellQuote(value: string): string;
|
|
30
32
|
export declare function stripPrllScheme(idOrUri: string): string;
|
|
31
33
|
/**
|
|
32
34
|
* Ensure a value carries the `prll://` scheme — the inverse of stripPrllScheme.
|
package/dist/lib/output.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,C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AgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAY,GAAG,IAAI,CAEvE;AAED;;;GAGG;AACH,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,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;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,MAAM,GAAG,SAAS,CAYpB;AASD;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAO1D,CAAC;AAEF;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,CAqEP"}
|
package/dist/lib/output.js
CHANGED
|
@@ -58,6 +58,10 @@ export function printRefHint(entityId, action = 'Created') {
|
|
|
58
58
|
* Strip the `prll://` scheme prefix from an entity ID if present.
|
|
59
59
|
* Allows CLI commands to accept both raw IDs (`tsk_abc`) and URIs (`prll://tsk_abc`).
|
|
60
60
|
*/
|
|
61
|
+
/** One shell word holding `value` exactly, for a command an agent copies. */
|
|
62
|
+
export function shellQuote(value) {
|
|
63
|
+
return `'${value.replaceAll("'", `'\\''`)}'`;
|
|
64
|
+
}
|
|
61
65
|
export function stripPrllScheme(idOrUri) {
|
|
62
66
|
return idOrUri.startsWith('prll://') ? idOrUri.slice(7) : idOrUri;
|
|
63
67
|
}
|
|
@@ -144,6 +144,21 @@ export type ServerManifestEntry = {
|
|
|
144
144
|
sha: string;
|
|
145
145
|
size: number;
|
|
146
146
|
};
|
|
147
|
+
/**
|
|
148
|
+
* GET manifest_url's body. `head_sha` is the commit every entry was read at;
|
|
149
|
+
* servers that predate it, or a read that could not name one commit, leave
|
|
150
|
+
* it out.
|
|
151
|
+
*/
|
|
152
|
+
export type ServerManifest = {
|
|
153
|
+
data: ServerManifestEntry[];
|
|
154
|
+
head_sha?: string;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* The commit to pin a sync's downloads to: the manifest's head_sha when it
|
|
158
|
+
* names one (40 hex digits), lowercase; undefined otherwise, and the sync
|
|
159
|
+
* downloads from the default branch as before.
|
|
160
|
+
*/
|
|
161
|
+
export declare function manifestHead(manifest: Pick<ServerManifest, 'head_sha'>): string | undefined;
|
|
147
162
|
/** Bulk download response entry. */
|
|
148
163
|
type BulkDownloadEntry = {
|
|
149
164
|
path: string;
|
|
@@ -253,7 +268,14 @@ export declare function wikiServiceFetch(url: string, token: string, options?: {
|
|
|
253
268
|
method?: string;
|
|
254
269
|
body?: string;
|
|
255
270
|
}): Promise<unknown>;
|
|
256
|
-
|
|
271
|
+
/**
|
|
272
|
+
* Download paths in batches. With `ref` (a manifest's head_sha) every batch
|
|
273
|
+
* reads that commit, so a commit landing between batches cannot mix versions;
|
|
274
|
+
* without it each batch reads the default branch as it is then.
|
|
275
|
+
*/
|
|
276
|
+
export declare function bulkDownloadFiles(bulkDownloadUrl: string, token: string, paths: string[], options?: {
|
|
277
|
+
ref?: string;
|
|
278
|
+
}): Promise<BulkDownloadEntry[]>;
|
|
257
279
|
export declare function computeGitBlobSHA(content: Buffer): string;
|
|
258
280
|
/**
|
|
259
281
|
* Mirror of the server's text classifier (filetype.IsText): content-type
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wiki-shared.d.ts","sourceRoot":"","sources":["../../src/lib/wiki-shared.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAK7F,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yFAAyF;IACzF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kFAAkF;IAClF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IAGjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,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
|
|
5
5
|
import { WikiServiceError } from './wiki-service-error.js';
|
|
6
6
|
import { promises as fs } from 'node:fs';
|
|
7
7
|
import path from 'node:path';
|
|
8
|
+
/**
|
|
9
|
+
* The commit to pin a sync's downloads to: the manifest's head_sha when it
|
|
10
|
+
* names one (40 hex digits), lowercase; undefined otherwise, and the sync
|
|
11
|
+
* downloads from the default branch as before.
|
|
12
|
+
*/
|
|
13
|
+
export function manifestHead(manifest) {
|
|
14
|
+
const head = manifest.head_sha?.toLowerCase();
|
|
15
|
+
return head && /^[0-9a-f]{40}$/.test(head) ? head : undefined;
|
|
16
|
+
}
|
|
8
17
|
// ---------------------------------------------------------------------------
|
|
9
18
|
// Constants
|
|
10
19
|
// ---------------------------------------------------------------------------
|
|
@@ -109,7 +118,12 @@ export async function wikiServiceFetch(url, token, options = {}) {
|
|
|
109
118
|
}
|
|
110
119
|
return response.json();
|
|
111
120
|
}
|
|
112
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Download paths in batches. With `ref` (a manifest's head_sha) every batch
|
|
123
|
+
* reads that commit, so a commit landing between batches cannot mix versions;
|
|
124
|
+
* without it each batch reads the default branch as it is then.
|
|
125
|
+
*/
|
|
126
|
+
export async function bulkDownloadFiles(bulkDownloadUrl, token, paths, options = {}) {
|
|
113
127
|
// Batch in chunks to avoid overly large requests
|
|
114
128
|
const BATCH_SIZE = 100;
|
|
115
129
|
const results = [];
|
|
@@ -117,7 +131,7 @@ export async function bulkDownloadFiles(bulkDownloadUrl, token, paths) {
|
|
|
117
131
|
const batch = paths.slice(i, i + BATCH_SIZE);
|
|
118
132
|
const raw = (await wikiServiceFetch(bulkDownloadUrl, token, {
|
|
119
133
|
method: 'POST',
|
|
120
|
-
body: JSON.stringify({ paths: batch }),
|
|
134
|
+
body: JSON.stringify(options.ref ? { paths: batch, ref: options.ref } : { paths: batch }),
|
|
121
135
|
}));
|
|
122
136
|
results.push(...raw.data);
|
|
123
137
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wiki-sync.d.ts","sourceRoot":"","sources":["../../src/lib/wiki-sync.ts"],"names":[],"mappings":"AAUA,OAAO,EAIL,KAAK,aAAa,EAElB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"wiki-sync.d.ts","sourceRoot":"","sources":["../../src/lib/wiki-sync.ts"],"names":[],"mappings":"AAUA,OAAO,EAIL,KAAK,aAAa,EAElB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,eAAe,EAerB,MAAM,kBAAkB,CAAC;AAqB1B,2FAA2F;AAK3F,MAAM,MAAM,UAAU,GAAG;IACvB;;;kDAG8C;IAC9C,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,EAAE,YAAY,EAAE,CAAC;QAC1B,MAAM,EAAE,WAAW,EAAE,CAAC;QACtB,8FAA8F;QAC9F,MAAM,EAAE,MAAM,EAAE,CAAC;KAClB,EAAE,CAAC;CACL,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAgC7F;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,IAAI,CAAA;CAAE,CA0BzF;AAMD;;;;;;;GAOG;AACH,6DAA6D;AAC7D,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,MA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e,CAAC,CA2c1B;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAYjB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CAC3C,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAkBf"}
|
package/dist/lib/wiki-sync.js
CHANGED
|
@@ -6,7 +6,7 @@ import path from 'node:path';
|
|
|
6
6
|
import { retireCopiesOnRefusal } from './wiki-copies.js';
|
|
7
7
|
import { pruneStaleMounts } from './wiki-stale-mounts.js';
|
|
8
8
|
import { hasDelimiterLine, mergeTextThreeWay } from './wiki-merge.js';
|
|
9
|
-
import { PRLL_WIKI_DIR, bulkDownloadFiles, computeGitBlobSHA, isReadableWiki, isWikiTextContent, removeEmptyParents, requireAgentId, resolveApiToken, resolveMountPath, resolvePathInsideRoot, resolveWikiRef, resolveWikiServiceBaseUrl, walkLocalFiles, wikiServiceFetch, } from './wiki-shared.js';
|
|
9
|
+
import { PRLL_WIKI_DIR, bulkDownloadFiles, computeGitBlobSHA, isReadableWiki, isWikiTextContent, manifestHead, removeEmptyParents, requireAgentId, resolveApiToken, resolveMountPath, resolvePathInsideRoot, resolveWikiRef, resolveWikiServiceBaseUrl, walkLocalFiles, wikiServiceFetch, } from './wiki-shared.js';
|
|
10
10
|
import { ensureBaselineObjects, gcBaselineObjects, probeLocalGitBlob, readBaselineObject, readLocalManifest, writeLocalManifest, } from './wiki-workspace.js';
|
|
11
11
|
const CONFLICTS_DIR = 'conflicts';
|
|
12
12
|
const REMOTE_CONFLICT_SUFFIX = '.remote';
|
|
@@ -137,8 +137,10 @@ export async function syncSingleWiki(ctx, wiki, mountPath) {
|
|
|
137
137
|
const baseUrl = resolveWikiServiceBaseUrl(ctx);
|
|
138
138
|
const manifestUrl = `${baseUrl}/wiki/v1/orgs/${ctx.orgId}/wikis/${wiki.id}/manifest`;
|
|
139
139
|
const bulkDownloadUrl = `${baseUrl}/wiki/v1/orgs/${ctx.orgId}/wikis/${wiki.id}/files/bulk-download`;
|
|
140
|
-
// 1. Fetch server manifest + read local manifest.
|
|
140
|
+
// 1. Fetch server manifest + read local manifest. Every download below is
|
|
141
|
+
// pinned to the commit the manifest was read at, when it names one.
|
|
141
142
|
const manifestResp = (await wikiServiceFetch(manifestUrl, token));
|
|
143
|
+
const head = manifestHead(manifestResp);
|
|
142
144
|
const serverEntries = manifestResp.data;
|
|
143
145
|
const serverByPath = new Map(serverEntries.map((e) => [e.path, e]));
|
|
144
146
|
const localManifest = await readLocalManifest(mountPath);
|
|
@@ -184,7 +186,7 @@ export async function syncSingleWiki(ctx, wiki, mountPath) {
|
|
|
184
186
|
const contentByPath = new Map();
|
|
185
187
|
const downloadErrorByPath = new Map();
|
|
186
188
|
if (fetchPaths.length > 0) {
|
|
187
|
-
const downloaded = await bulkDownloadFiles(bulkDownloadUrl, token, fetchPaths);
|
|
189
|
+
const downloaded = await bulkDownloadFiles(bulkDownloadUrl, token, fetchPaths, { ref: head });
|
|
188
190
|
const returnedPaths = new Set();
|
|
189
191
|
for (const entry of downloaded) {
|
|
190
192
|
returnedPaths.add(entry.path);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parall/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.92.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/
|
|
46
|
-
"@parall/
|
|
45
|
+
"@parall/sdk": "1.92.0",
|
|
46
|
+
"@parall/agent-core": "1.92.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.92.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",
|