@parall/cli 1.38.0 → 1.40.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chats.d.ts","sourceRoot":"","sources":["../../src/commands/chats.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chats.d.ts","sourceRoot":"","sources":["../../src/commands/chats.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAwMpD"}
|
package/dist/commands/chats.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ApiError } from '@parall/sdk';
|
|
1
2
|
import { resolveCredentials } from '../lib/client.js';
|
|
2
3
|
import { printJson, printError, printRefHint, stripPrllScheme } from '../lib/output.js';
|
|
3
4
|
export function registerChatCommands(program) {
|
|
@@ -70,6 +71,23 @@ export function registerChatCommands(program) {
|
|
|
70
71
|
printError(err);
|
|
71
72
|
}
|
|
72
73
|
});
|
|
74
|
+
chats
|
|
75
|
+
.command('transfer-ownership')
|
|
76
|
+
.description('Transfer chat ownership to another member (owner only; you become admin)')
|
|
77
|
+
.argument('<chatId>', 'Chat ID')
|
|
78
|
+
.requiredOption('--user-id <userId>', 'Chat member to become the new owner')
|
|
79
|
+
.action(async (chatId, opts) => {
|
|
80
|
+
try {
|
|
81
|
+
const { client, orgId } = resolveCredentials();
|
|
82
|
+
await client.transferChatOwnership(orgId, stripPrllScheme(chatId), {
|
|
83
|
+
target_user_id: stripPrllScheme(opts.userId),
|
|
84
|
+
});
|
|
85
|
+
printJson({ ok: true });
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
printError(err);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
73
91
|
chats
|
|
74
92
|
.command('create')
|
|
75
93
|
.description('Create a new chat')
|
|
@@ -111,16 +129,41 @@ export function registerChatCommands(program) {
|
|
|
111
129
|
printError(err);
|
|
112
130
|
}
|
|
113
131
|
});
|
|
132
|
+
members
|
|
133
|
+
.command('set-role')
|
|
134
|
+
.description('Change a chat member role to admin or member (transferring ownership has its own command)')
|
|
135
|
+
.argument('<chatId>', 'Chat ID')
|
|
136
|
+
.requiredOption('--user-id <userId>', 'Target member')
|
|
137
|
+
.requiredOption('--role <role>', 'New role: admin or member')
|
|
138
|
+
.action(async (chatId, opts) => {
|
|
139
|
+
try {
|
|
140
|
+
if (opts.role !== 'admin' && opts.role !== 'member') {
|
|
141
|
+
// Local pre-check with the same structured envelope printError emits
|
|
142
|
+
// for server errors, so scripted callers always get status + code.
|
|
143
|
+
throw new ApiError(400, opts.role === 'owner'
|
|
144
|
+
? 'Use "chats transfer-ownership" to change the owner'
|
|
145
|
+
: '--role must be admin or member', 'INVALID_REQUEST');
|
|
146
|
+
}
|
|
147
|
+
const { client, orgId } = resolveCredentials();
|
|
148
|
+
await client.updateChatMemberRole(orgId, stripPrllScheme(chatId), stripPrllScheme(opts.userId), opts.role);
|
|
149
|
+
printJson({ ok: true });
|
|
150
|
+
}
|
|
151
|
+
catch (err) {
|
|
152
|
+
printError(err);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
114
155
|
members
|
|
115
156
|
.command('add')
|
|
116
157
|
.description('Add a member to a chat')
|
|
117
158
|
.argument('<chatId>', 'Chat ID')
|
|
118
159
|
.requiredOption('--user-id <userId>', 'User ID to add')
|
|
119
|
-
.option('--role <role>', 'Deprecated.
|
|
160
|
+
.option('--role <role>', 'Deprecated. New members always join as "member"')
|
|
120
161
|
.action(async (chatId, opts) => {
|
|
121
162
|
try {
|
|
122
163
|
if (opts.role !== undefined && opts.role !== 'member') {
|
|
123
|
-
throw new
|
|
164
|
+
throw new ApiError(400, opts.role === 'owner'
|
|
165
|
+
? 'New members always join as "member"; add them first, then use "chats transfer-ownership"'
|
|
166
|
+
: '--role only supports "member"; promote after adding via "chats members set-role"', 'INVALID_REQUEST');
|
|
124
167
|
}
|
|
125
168
|
const { client, orgId } = resolveCredentials();
|
|
126
169
|
await client.addChatMember(orgId, stripPrllScheme(chatId), stripPrllScheme(opts.userId));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parall/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.40.0",
|
|
4
4
|
"description": "CLI client for Parall — universal agent & human access to Parall API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"diff": "^8.0.3",
|
|
37
37
|
"js-yaml": "^4.1.0",
|
|
38
38
|
"zod": "^4.3.6",
|
|
39
|
-
"@parall/agent-core": "1.
|
|
40
|
-
"@parall/sdk": "1.
|
|
39
|
+
"@parall/agent-core": "1.40.0",
|
|
40
|
+
"@parall/sdk": "1.40.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/js-yaml": "^4.0.9",
|
|
44
44
|
"@types/node": "^22.0.0",
|
|
45
45
|
"typescript": "^5.7.0",
|
|
46
|
-
"@parall/agent-core": "1.
|
|
46
|
+
"@parall/agent-core": "1.40.0"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "tsc",
|