@parall/cli 1.54.0 → 1.55.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.
|
@@ -5,8 +5,14 @@ import { Command } from 'commander';
|
|
|
5
5
|
* architecture). The agent sends as the connected WeChat account itself;
|
|
6
6
|
* the vendor token + device id never reach the runtime — api-server
|
|
7
7
|
* performs the vendor call in-process.
|
|
8
|
+
*
|
|
9
|
+
* Verb surface = the vendor's in-scope interface aggregated: postText
|
|
10
|
+
* (send), fetchContactsList + getBriefInfo + getChatroomInfo (contacts),
|
|
11
|
+
* getProfile (profile), checkOnline (status). Every verb renders
|
|
12
|
+
* agent-readable text by default and `--json` for machine output.
|
|
13
|
+
*
|
|
8
14
|
* INTERNAL research preview: the capability is flag-gated to the internal
|
|
9
|
-
* org. Design: docs/engineering-design/wechat-channel-design.md §3.
|
|
15
|
+
* org. Design: docs/engineering-design/wechat-channel-design.md §3, §4.
|
|
10
16
|
*/
|
|
11
17
|
export declare function registerWechatCommands(program: Command): void;
|
|
12
18
|
//# sourceMappingURL=wechat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wechat.d.ts","sourceRoot":"","sources":["../../src/commands/wechat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"wechat.d.ts","sourceRoot":"","sources":["../../src/commands/wechat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,QAwItD"}
|
package/dist/commands/wechat.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { resolveCredentials } from '../lib/client.js';
|
|
2
2
|
import { printError, printJson } from '../lib/output.js';
|
|
3
|
+
import { resolveMessageText, TEXT_FILE_OPTION_DESC, TEXT_OPTION_DESC } from '../lib/text-input.js';
|
|
3
4
|
/**
|
|
4
5
|
* `parall wechat …` — the per-vendor platform verb for the personal-WeChat
|
|
5
6
|
* protocol channel (wechatapi.net, tier B in the multi-channel
|
|
6
7
|
* architecture). The agent sends as the connected WeChat account itself;
|
|
7
8
|
* the vendor token + device id never reach the runtime — api-server
|
|
8
9
|
* performs the vendor call in-process.
|
|
10
|
+
*
|
|
11
|
+
* Verb surface = the vendor's in-scope interface aggregated: postText
|
|
12
|
+
* (send), fetchContactsList + getBriefInfo + getChatroomInfo (contacts),
|
|
13
|
+
* getProfile (profile), checkOnline (status). Every verb renders
|
|
14
|
+
* agent-readable text by default and `--json` for machine output.
|
|
15
|
+
*
|
|
9
16
|
* INTERNAL research preview: the capability is flag-gated to the internal
|
|
10
|
-
* org. Design: docs/engineering-design/wechat-channel-design.md §3.
|
|
17
|
+
* org. Design: docs/engineering-design/wechat-channel-design.md §3, §4.
|
|
11
18
|
*/
|
|
12
19
|
export function registerWechatCommands(program) {
|
|
13
20
|
const wechat = program
|
|
@@ -17,18 +24,29 @@ export function registerWechatCommands(program) {
|
|
|
17
24
|
.command('send')
|
|
18
25
|
.description('Send a message to a WeChat conversation this connection has seen inbound')
|
|
19
26
|
.requiredOption('--to <wxid>', 'Vendor-native conversation id from the inbound event (a friend wxid, or a room id ending in @chatroom)')
|
|
20
|
-
.
|
|
27
|
+
.option('--text <text>', TEXT_OPTION_DESC)
|
|
28
|
+
.option('--text-file <path>', TEXT_FILE_OPTION_DESC)
|
|
21
29
|
.option('--at <wxid>', 'In group replies: @-mention one member (wxid of the person you are answering)')
|
|
30
|
+
.option('--json', 'Emit the full machine-readable response instead of the readable summary')
|
|
22
31
|
.action(async (opts) => {
|
|
23
32
|
try {
|
|
33
|
+
const text = resolveMessageText(opts);
|
|
34
|
+
if (text === undefined || text === '') {
|
|
35
|
+
throw new Error('Provide --text or --text-file');
|
|
36
|
+
}
|
|
24
37
|
const { client, orgId } = resolveCredentials();
|
|
25
38
|
const sent = await client.sendChannelMessage(orgId, {
|
|
26
39
|
channel_type: 'wechat',
|
|
27
40
|
conversation_id: opts.to,
|
|
28
|
-
text
|
|
41
|
+
text,
|
|
29
42
|
...(opts.at ? { at: opts.at } : {}),
|
|
30
43
|
});
|
|
31
|
-
|
|
44
|
+
if (opts.json) {
|
|
45
|
+
printJson(sent);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const where = opts.at ? ` @${opts.at}` : '';
|
|
49
|
+
console.log(`sent: ${sent.message_id} → ${sent.conversation_id}${where} (wechat)`);
|
|
32
50
|
}
|
|
33
51
|
catch (err) {
|
|
34
52
|
printError(err);
|
|
@@ -36,11 +54,81 @@ export function registerWechatCommands(program) {
|
|
|
36
54
|
});
|
|
37
55
|
wechat
|
|
38
56
|
.command('contacts')
|
|
39
|
-
.description('List the account address book:
|
|
40
|
-
.
|
|
57
|
+
.description('List the account address book with display names: friends, saved groups, followed official accounts')
|
|
58
|
+
.option('--json', 'Emit the full machine-readable response instead of the readable summary')
|
|
59
|
+
.action(async (opts) => {
|
|
60
|
+
try {
|
|
61
|
+
const { client, orgId } = resolveCredentials();
|
|
62
|
+
const page = await client.listWechatContacts(orgId);
|
|
63
|
+
if (opts.json) {
|
|
64
|
+
printJson(page);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const friendRows = page.friends.map((f) => `${f.wxid}\t${f.display}`.replace(/\t$/, ''));
|
|
68
|
+
const groupRows = page.chatrooms.map((c) => `${c.chatroom_id}\t${c.display}`.replace(/\t$/, ''));
|
|
69
|
+
console.log(`ADDRESS BOOK — friends: ${page.friends.length}, groups: ${page.chatrooms.length}, official accounts: ${page.ghs.length}`);
|
|
70
|
+
if (friendRows.length) {
|
|
71
|
+
console.log(`\nfriends (${page.friends.length}):\n ${friendRows.join('\n ')}`);
|
|
72
|
+
}
|
|
73
|
+
if (groupRows.length) {
|
|
74
|
+
console.log(`\ngroups (${page.chatrooms.length}):\n ${groupRows.join('\n ')}`);
|
|
75
|
+
}
|
|
76
|
+
if (page.ghs.length) {
|
|
77
|
+
console.log(`\nofficial accounts (${page.ghs.length}):\n ${page.ghs.join('\n ')}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
printError(err);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
wechat
|
|
85
|
+
.command('profile')
|
|
86
|
+
.description('Show the connected WeChat account identity (wxid / alias / nickName / app id)')
|
|
87
|
+
.option('--json', 'Emit the full machine-readable response instead of the readable summary')
|
|
88
|
+
.action(async (opts) => {
|
|
89
|
+
try {
|
|
90
|
+
const { client, orgId } = resolveCredentials();
|
|
91
|
+
const view = await client.wechatProfile(orgId);
|
|
92
|
+
if (opts.json) {
|
|
93
|
+
printJson(view);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
console.log('ACCOUNT');
|
|
97
|
+
console.log(` wxid: ${view.wxid}`);
|
|
98
|
+
if (view.nick_name)
|
|
99
|
+
console.log(` nickName: ${view.nick_name}`);
|
|
100
|
+
if (view.alias)
|
|
101
|
+
console.log(` alias: ${view.alias}`);
|
|
102
|
+
console.log(` app_id: ${view.app_id}`);
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
printError(err);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
wechat
|
|
109
|
+
.command('status')
|
|
110
|
+
.description('Check the connection health: live online probe, identity, last offline time')
|
|
111
|
+
.option('--json', 'Emit the full machine-readable response instead of the readable summary')
|
|
112
|
+
.action(async (opts) => {
|
|
41
113
|
try {
|
|
42
114
|
const { client, orgId } = resolveCredentials();
|
|
43
|
-
|
|
115
|
+
const view = await client.wechatStatus(orgId);
|
|
116
|
+
if (opts.json) {
|
|
117
|
+
printJson(view);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const label = view.online ? 'ONLINE' : 'OFFLINE';
|
|
121
|
+
console.log(`WeChat account: ${label}`);
|
|
122
|
+
console.log(` wxid: ${view.wxid}`);
|
|
123
|
+
if (view.nick_name)
|
|
124
|
+
console.log(` nickName: ${view.nick_name}`);
|
|
125
|
+
if (view.alias)
|
|
126
|
+
console.log(` alias: ${view.alias}`);
|
|
127
|
+
console.log(` app_id: ${view.app_id}`);
|
|
128
|
+
console.log(` last_offline_at: ${view.last_offline_at ?? 'never'}`);
|
|
129
|
+
if (!view.online) {
|
|
130
|
+
console.log(' → the account is offline; a human must re-login on the vendor side. Stop and tell the user.');
|
|
131
|
+
}
|
|
44
132
|
}
|
|
45
133
|
catch (err) {
|
|
46
134
|
printError(err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parall/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.55.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/
|
|
40
|
-
"@parall/
|
|
39
|
+
"@parall/agent-core": "1.55.0",
|
|
40
|
+
"@parall/sdk": "1.55.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.55.0"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "tsc",
|