@parall/cli 1.24.0 → 1.26.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/approvals.d.ts.map +1 -1
- package/dist/commands/approvals.js +65 -0
- package/dist/commands/chats.d.ts.map +1 -1
- package/dist/commands/chats.js +36 -0
- package/dist/lib/client.d.ts +5 -4
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/client.js +27 -11
- package/dist/lib/output.d.ts.map +1 -1
- package/dist/lib/output.js +15 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approvals.d.ts","sourceRoot":"","sources":["../../src/commands/approvals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"approvals.d.ts","sourceRoot":"","sources":["../../src/commands/approvals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,QAkIxD"}
|
|
@@ -37,6 +37,20 @@ export function registerApprovalCommands(program) {
|
|
|
37
37
|
printError(err);
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
|
+
approvals
|
|
41
|
+
.command('get')
|
|
42
|
+
.description('Get the status of a specific approval request')
|
|
43
|
+
.argument('<approvalId>', 'Approval request ID')
|
|
44
|
+
.action(async (approvalId) => {
|
|
45
|
+
try {
|
|
46
|
+
const { client } = resolveCredentials();
|
|
47
|
+
const result = await client.getApproval(stripPrllScheme(approvalId));
|
|
48
|
+
printJson(result);
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
printError(err);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
40
54
|
approvals
|
|
41
55
|
.command('cancel')
|
|
42
56
|
.description('Cancel a pending approval request')
|
|
@@ -64,4 +78,55 @@ export function registerApprovalCommands(program) {
|
|
|
64
78
|
printError(err);
|
|
65
79
|
}
|
|
66
80
|
});
|
|
81
|
+
approvals
|
|
82
|
+
.command('wait')
|
|
83
|
+
.description('Wait for an approval to reach a terminal state')
|
|
84
|
+
.argument('<approvalId>', 'Approval request ID')
|
|
85
|
+
.option('--timeout <seconds>', 'Max seconds to wait', '300')
|
|
86
|
+
.action(async (approvalId, opts) => {
|
|
87
|
+
try {
|
|
88
|
+
const { client } = resolveCredentials();
|
|
89
|
+
const id = stripPrllScheme(approvalId);
|
|
90
|
+
const timeoutSeconds = Number(opts.timeout);
|
|
91
|
+
if (!Number.isFinite(timeoutSeconds) || timeoutSeconds <= 0) {
|
|
92
|
+
printError(new Error('--timeout must be a positive number of seconds'));
|
|
93
|
+
}
|
|
94
|
+
const timeoutMs = timeoutSeconds * 1000;
|
|
95
|
+
const pollMs = 5000;
|
|
96
|
+
const deadline = Date.now() + timeoutMs;
|
|
97
|
+
while (true) {
|
|
98
|
+
const approval = await client.getApproval(id);
|
|
99
|
+
const isTerminal = approval.status !== 'pending'
|
|
100
|
+
&& !(approval.status === 'approved' && !approval.execution_status);
|
|
101
|
+
if (isTerminal) {
|
|
102
|
+
printJson(approval);
|
|
103
|
+
const ok = approval.status === 'approved' && approval.execution_status === 'succeeded';
|
|
104
|
+
process.exit(ok ? 0 : 1);
|
|
105
|
+
}
|
|
106
|
+
const now = Date.now();
|
|
107
|
+
if (now >= deadline) {
|
|
108
|
+
printJson(approval);
|
|
109
|
+
console.error('Timed out waiting for approval decision');
|
|
110
|
+
process.exit(2);
|
|
111
|
+
}
|
|
112
|
+
await new Promise(r => setTimeout(r, Math.min(pollMs, deadline - now)));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
printError(err);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
approvals
|
|
120
|
+
.command('actions')
|
|
121
|
+
.description('List available approval action types')
|
|
122
|
+
.action(async () => {
|
|
123
|
+
try {
|
|
124
|
+
const { client } = resolveCredentials();
|
|
125
|
+
const result = await client.getApprovableActions();
|
|
126
|
+
printJson(result);
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
printError(err);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
67
132
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chats.d.ts","sourceRoot":"","sources":["../../src/commands/chats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"chats.d.ts","sourceRoot":"","sources":["../../src/commands/chats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAyIpD"}
|
package/dist/commands/chats.js
CHANGED
|
@@ -34,6 +34,42 @@ export function registerChatCommands(program) {
|
|
|
34
34
|
printError(err);
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
|
+
chats
|
|
38
|
+
.command('discoverable')
|
|
39
|
+
.description('List discoverable chats in the organization')
|
|
40
|
+
.option('--query <q>', 'Optional name substring filter')
|
|
41
|
+
.option('--limit <n>', 'Maximum number of results', '20')
|
|
42
|
+
.action(async (opts) => {
|
|
43
|
+
try {
|
|
44
|
+
const { client, orgId } = resolveCredentials();
|
|
45
|
+
const params = {};
|
|
46
|
+
if (opts.query !== undefined)
|
|
47
|
+
params.q = opts.query;
|
|
48
|
+
const limit = Number(opts.limit);
|
|
49
|
+
if (Number.isFinite(limit))
|
|
50
|
+
params.limit = limit;
|
|
51
|
+
const result = await client.getDiscoverableChats(orgId, params);
|
|
52
|
+
printJson(result);
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
printError(err);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
chats
|
|
59
|
+
.command('join')
|
|
60
|
+
.description('Join a discoverable chat')
|
|
61
|
+
.argument('<chatId>', 'Chat ID')
|
|
62
|
+
.action(async (chatId) => {
|
|
63
|
+
try {
|
|
64
|
+
const { client, orgId } = resolveCredentials();
|
|
65
|
+
const result = await client.joinChat(orgId, stripPrllScheme(chatId));
|
|
66
|
+
printJson(result);
|
|
67
|
+
printRefHint(stripPrllScheme(chatId), 'Joined');
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
printError(err);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
37
73
|
chats
|
|
38
74
|
.command('create')
|
|
39
75
|
.description('Create a new chat')
|
package/dist/lib/client.d.ts
CHANGED
|
@@ -13,11 +13,12 @@ export type RuntimeContext = {
|
|
|
13
13
|
noReply: boolean;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
-
* Read per-dispatch context from ENV.
|
|
16
|
+
* Read per-dispatch context from ENV + sideband files.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
* 1.
|
|
20
|
-
* 2.
|
|
18
|
+
* Resolution order (first non-empty value wins per field):
|
|
19
|
+
* 1. PRLL_* env vars (set by OpenClaw/Hermes hooks per tool call)
|
|
20
|
+
* 2. PRLL_CONTEXT_FILE JSON (written by CC/Codex bridge gateway per dispatch)
|
|
21
|
+
* 3. PRLL_STEP_ID_FILE plain text (legacy step-id-only backward compat)
|
|
21
22
|
*/
|
|
22
23
|
export declare function resolveRuntimeContext(): RuntimeContext;
|
|
23
24
|
export declare function resolveCredentials(): ResolvedCredentials;
|
package/dist/lib/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,6DAA6D;AAC7D,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oGAAoG;IACpG,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,6DAA6D;AAC7D,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oGAAoG;IACpG,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,IAAI,cAAc,CAiCtD;AAED,wBAAgB,kBAAkB,IAAI,mBAAmB,CAoBxD"}
|
package/dist/lib/client.js
CHANGED
|
@@ -1,14 +1,36 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
2
|
import { ParallClient } from '@parall/sdk';
|
|
3
3
|
/**
|
|
4
|
-
* Read per-dispatch context from ENV.
|
|
4
|
+
* Read per-dispatch context from ENV + sideband files.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* 1.
|
|
8
|
-
* 2.
|
|
6
|
+
* Resolution order (first non-empty value wins per field):
|
|
7
|
+
* 1. PRLL_* env vars (set by OpenClaw/Hermes hooks per tool call)
|
|
8
|
+
* 2. PRLL_CONTEXT_FILE JSON (written by CC/Codex bridge gateway per dispatch)
|
|
9
|
+
* 3. PRLL_STEP_ID_FILE plain text (legacy step-id-only backward compat)
|
|
9
10
|
*/
|
|
10
11
|
export function resolveRuntimeContext() {
|
|
12
|
+
let sessionId = process.env.PRLL_SESSION_ID?.trim() || undefined;
|
|
11
13
|
let stepId = process.env.PRLL_STEP_ID?.trim() || undefined;
|
|
14
|
+
let chatId = process.env.PRLL_CHAT_ID?.trim() || undefined;
|
|
15
|
+
let triggerMessageId = process.env.PRLL_TRIGGER_MESSAGE_ID?.trim() || undefined;
|
|
16
|
+
let noReply = process.env.PRLL_NO_REPLY === '1';
|
|
17
|
+
if (process.env.PRLL_CONTEXT_FILE) {
|
|
18
|
+
try {
|
|
19
|
+
const raw = fs.readFileSync(process.env.PRLL_CONTEXT_FILE, 'utf-8').trim();
|
|
20
|
+
if (raw) {
|
|
21
|
+
const ctx = JSON.parse(raw);
|
|
22
|
+
sessionId ??= ctx.session_id || undefined;
|
|
23
|
+
chatId ??= ctx.chat_id || undefined;
|
|
24
|
+
triggerMessageId ??= ctx.trigger_message_id || undefined;
|
|
25
|
+
stepId ??= ctx.step_id || undefined;
|
|
26
|
+
if (ctx.no_reply === true)
|
|
27
|
+
noReply = true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
// File not yet written or malformed — no context
|
|
32
|
+
}
|
|
33
|
+
}
|
|
12
34
|
if (!stepId && process.env.PRLL_STEP_ID_FILE) {
|
|
13
35
|
try {
|
|
14
36
|
const content = fs.readFileSync(process.env.PRLL_STEP_ID_FILE, 'utf-8').trim();
|
|
@@ -19,13 +41,7 @@ export function resolveRuntimeContext() {
|
|
|
19
41
|
// File not yet written or unreadable — no step context
|
|
20
42
|
}
|
|
21
43
|
}
|
|
22
|
-
return {
|
|
23
|
-
sessionId: process.env.PRLL_SESSION_ID?.trim() || undefined,
|
|
24
|
-
stepId,
|
|
25
|
-
chatId: process.env.PRLL_CHAT_ID?.trim() || undefined,
|
|
26
|
-
triggerMessageId: process.env.PRLL_TRIGGER_MESSAGE_ID?.trim() || undefined,
|
|
27
|
-
noReply: process.env.PRLL_NO_REPLY === '1',
|
|
28
|
-
};
|
|
44
|
+
return { sessionId, stepId, chatId, triggerMessageId, noReply };
|
|
29
45
|
}
|
|
30
46
|
export function resolveCredentials() {
|
|
31
47
|
const url = process.env.PRLL_API_URL;
|
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":"AAEA,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE7C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAY,GAAG,IAAI,CAEvE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/lib/output.ts"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE7C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAY,GAAG,IAAI,CAEvE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK,CAyB9C"}
|
package/dist/lib/output.js
CHANGED
|
@@ -20,13 +20,27 @@ export function printError(err) {
|
|
|
20
20
|
let msg;
|
|
21
21
|
if (err instanceof ApiError) {
|
|
22
22
|
msg = { error: err.message, status: err.status, ...(err.code ? { code: err.code } : {}) };
|
|
23
|
+
console.error(JSON.stringify(msg));
|
|
24
|
+
if (err.code === 'PERMISSION_DENIED' && err.extras) {
|
|
25
|
+
const { action, resource_uri } = err.extras;
|
|
26
|
+
// Subset of authz.Service.RegisteredActions() — only actions agents commonly encounter.
|
|
27
|
+
// Verify the full list via GET /approvals/actions.
|
|
28
|
+
const approvable = new Set([
|
|
29
|
+
'chat.delete', 'chat.archive', 'chat.restore',
|
|
30
|
+
'task.delete', 'task.archive', 'task.restore',
|
|
31
|
+
]);
|
|
32
|
+
if (typeof action === 'string' && typeof resource_uri === 'string' && approvable.has(action)) {
|
|
33
|
+
console.error(`Tip: parall approvals request --action ${action} --resource ${resource_uri} --chat <chat_id> --title "..." --reason "..."`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
23
36
|
}
|
|
24
37
|
else if (err instanceof Error) {
|
|
25
38
|
msg = { error: err.message };
|
|
39
|
+
console.error(JSON.stringify(msg));
|
|
26
40
|
}
|
|
27
41
|
else {
|
|
28
42
|
msg = { error: String(err) };
|
|
43
|
+
console.error(JSON.stringify(msg));
|
|
29
44
|
}
|
|
30
|
-
console.error(JSON.stringify(msg));
|
|
31
45
|
return process.exit(1);
|
|
32
46
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parall/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0",
|
|
4
4
|
"description": "CLI client for Parall — universal agent & human access to Parall API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@modelcontextprotocol/sdk": "1.27.1",
|
|
31
31
|
"commander": "^13.0.0",
|
|
32
32
|
"zod": "^4.3.6",
|
|
33
|
-
"@parall/sdk": "1.
|
|
33
|
+
"@parall/sdk": "1.26.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^22.0.0",
|