@parall/sdk 1.55.3 → 1.55.4
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/client.d.ts +4 -19
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +7 -29
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/types.d.ts +22 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/wechat-client.d.ts +15 -0
- package/dist/wechat-client.d.ts.map +1 -0
- package/dist/wechat-client.js +28 -0
- package/dist/wechat-types.d.ts +27 -0
- package/dist/wechat-types.d.ts.map +1 -0
- package/dist/wechat-types.js +1 -0
- package/package.json +1 -1
- package/src/client.ts +8 -36
- package/src/constants.ts +1 -0
- package/src/index.ts +1 -0
- package/src/types.ts +22 -5
- package/src/wechat-client.ts +35 -0
- package/src/wechat-types.ts +28 -0
package/src/client.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type BrowserViewerRequestOptions, browserViewerRequestOptions } from './browser-viewer.js';
|
|
2
2
|
import { API_BASE, ENDPOINTS, WIKI_BASE } from './constants.js';
|
|
3
|
-
import {
|
|
3
|
+
import { WechatClient } from './wechat-client.js';
|
|
4
4
|
import type {
|
|
5
5
|
AddTeamMemberRequest,
|
|
6
6
|
AgentClip,
|
|
@@ -233,9 +233,6 @@ import type {
|
|
|
233
233
|
UpdateTeamRequest,
|
|
234
234
|
UpdateWikiChangesetRequest,
|
|
235
235
|
User,
|
|
236
|
-
WechatContactsPage,
|
|
237
|
-
WechatProfileView,
|
|
238
|
-
WechatStatusView,
|
|
239
236
|
Wiki,
|
|
240
237
|
WikiAccessStatus,
|
|
241
238
|
WikiAnchorResolveRequest,
|
|
@@ -282,7 +279,7 @@ export interface ParallClientOptions {
|
|
|
282
279
|
getFeatureFlagOverrides?: () => string | null | undefined;
|
|
283
280
|
}
|
|
284
281
|
|
|
285
|
-
export class ParallClient extends
|
|
282
|
+
export class ParallClient extends WechatClient {
|
|
286
283
|
private baseUrl: string;
|
|
287
284
|
private wikiBaseUrl: string;
|
|
288
285
|
private token: string | null;
|
|
@@ -2541,31 +2538,6 @@ export class ParallClient extends TaskLabelClient {
|
|
|
2541
2538
|
await this.request('POST', ENDPOINTS.SLACK_STATUS(orgId), input);
|
|
2542
2539
|
}
|
|
2543
2540
|
|
|
2544
|
-
/**
|
|
2545
|
-
* WeChat tier-B read verb (agent-only; internal research preview): the
|
|
2546
|
-
* account's address book — friends/chatrooms enriched with display names,
|
|
2547
|
-
* followed official accounts. Same live gate as the send verb.
|
|
2548
|
-
*/
|
|
2549
|
-
async listWechatContacts(orgId: string): Promise<WechatContactsPage> {
|
|
2550
|
-
return this.request('GET', ENDPOINTS.WECHAT_CONTACTS(orgId));
|
|
2551
|
-
}
|
|
2552
|
-
|
|
2553
|
-
/**
|
|
2554
|
-
* WeChat tier-B read verb (agent-only): the connected account's identity
|
|
2555
|
-
* (wxid / alias / nickName / app id).
|
|
2556
|
-
*/
|
|
2557
|
-
async wechatProfile(orgId: string): Promise<WechatProfileView> {
|
|
2558
|
-
return this.request('GET', ENDPOINTS.WECHAT_PROFILE(orgId));
|
|
2559
|
-
}
|
|
2560
|
-
|
|
2561
|
-
/**
|
|
2562
|
-
* WeChat tier-B read verb (agent-only): live online probe + identity +
|
|
2563
|
-
* the platform's offline record.
|
|
2564
|
-
*/
|
|
2565
|
-
async wechatStatus(orgId: string): Promise<WechatStatusView> {
|
|
2566
|
-
return this.request('GET', ENDPOINTS.WECHAT_STATUS(orgId));
|
|
2567
|
-
}
|
|
2568
|
-
|
|
2569
2541
|
async listChannelConversations(
|
|
2570
2542
|
orgId: string,
|
|
2571
2543
|
connectionId: string,
|
|
@@ -3162,13 +3134,13 @@ export class ParallClient extends TaskLabelClient {
|
|
|
3162
3134
|
async resolveRefs(
|
|
3163
3135
|
orgId: string,
|
|
3164
3136
|
refs: string[],
|
|
3165
|
-
options?: { sourceMessageId?: string },
|
|
3137
|
+
options?: { sourceMessageId?: string; full?: boolean },
|
|
3166
3138
|
): Promise<ResolveRefsResponse> {
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3139
|
+
return this.request('POST', ENDPOINTS.REFS_RESOLVE(orgId), {
|
|
3140
|
+
refs,
|
|
3141
|
+
source_message_id: options?.sourceMessageId,
|
|
3142
|
+
full: options?.full || undefined,
|
|
3143
|
+
});
|
|
3172
3144
|
}
|
|
3173
3145
|
|
|
3174
3146
|
async getBacklinks(
|
package/src/constants.ts
CHANGED
|
@@ -686,6 +686,7 @@ export const ENDPOINTS = {
|
|
|
686
686
|
SLACK_STATUS: (orgId: string) => `${API_BASE}/orgs/${orgId}/agents/me/slack/status`,
|
|
687
687
|
// WeChat tier-B read verbs (agent-only; internal research preview).
|
|
688
688
|
WECHAT_CONTACTS: (orgId: string) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/contacts`,
|
|
689
|
+
WECHAT_HISTORY: (orgId: string) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/history`,
|
|
689
690
|
WECHAT_PROFILE: (orgId: string) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/profile`,
|
|
690
691
|
WECHAT_STATUS: (orgId: string) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/status`,
|
|
691
692
|
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -1000,6 +1000,13 @@ export interface SendMessageRequest {
|
|
|
1000
1000
|
export interface MessageDispatchSource {
|
|
1001
1001
|
source_type: string;
|
|
1002
1002
|
source_id: string;
|
|
1003
|
+
/**
|
|
1004
|
+
* Conversation generation of the sending execution (parel v2 invocation
|
|
1005
|
+
* context). Required by the server for agents on the direct_session_v2
|
|
1006
|
+
* transport; a value older than the current New Session barrier is
|
|
1007
|
+
* rejected (STALE_GENERATION).
|
|
1008
|
+
*/
|
|
1009
|
+
generation?: number;
|
|
1003
1010
|
}
|
|
1004
1011
|
|
|
1005
1012
|
/** One WorkItem source pointer for the by-source complete surface. */
|
|
@@ -1730,16 +1737,25 @@ export interface UpdateTaskRequest {
|
|
|
1730
1737
|
*/
|
|
1731
1738
|
label_ids?: string[] | null;
|
|
1732
1739
|
/**
|
|
1733
|
-
* Dispatch
|
|
1734
|
-
* dispatch_lane + dispatch_event_id bind
|
|
1735
|
-
* lane (incumbency-checked)
|
|
1736
|
-
*
|
|
1740
|
+
* Dispatch binding (agent senders during a typed dispatch turn).
|
|
1741
|
+
* Lane-bound form (v1 consumers): dispatch_lane + dispatch_event_id bind
|
|
1742
|
+
* the update to the claimed typed lane (incumbency-checked).
|
|
1743
|
+
* By-id form (parel v2 converged consumers — no lane exists):
|
|
1744
|
+
* dispatch_event_id + dispatch_generation bind the update to the WorkItem
|
|
1745
|
+
* directly under the conversation-generation fence.
|
|
1746
|
+
* In both forms dispatch_effect_key additionally commits the update as
|
|
1737
1747
|
* the dispatch's idempotent Effect and resolves the WorkItem in the same
|
|
1738
|
-
* transaction
|
|
1748
|
+
* transaction. Lane-bound: exactly "task_update:<dispatch_event_id>" —
|
|
1749
|
+
* first update only; later updates go fenced keyless (the CLI sidecar
|
|
1750
|
+
* arbitrates). By-id: "task_update:<dispatch_event_id>:<payload-hash>" —
|
|
1751
|
+
* content-addressed, every distinct update carries its own key; the first
|
|
1752
|
+
* resolves the WorkItem and later keys land as their own Effects against
|
|
1753
|
+
* the already-resolved row.
|
|
1739
1754
|
*/
|
|
1740
1755
|
dispatch_lane?: string;
|
|
1741
1756
|
dispatch_event_id?: string;
|
|
1742
1757
|
dispatch_effect_key?: string;
|
|
1758
|
+
dispatch_generation?: number;
|
|
1743
1759
|
}
|
|
1744
1760
|
|
|
1745
1761
|
export interface CreateTaskRelationRequest {
|
|
@@ -4006,6 +4022,7 @@ export interface PresenceUpdateData {
|
|
|
4006
4022
|
export interface ResolveRefsRequest {
|
|
4007
4023
|
refs: string[];
|
|
4008
4024
|
source_message_id?: string;
|
|
4025
|
+
full?: boolean;
|
|
4009
4026
|
}
|
|
4010
4027
|
|
|
4011
4028
|
export interface ResolvedRef {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ENDPOINTS } from './constants.js';
|
|
2
|
+
import { TaskLabelClient } from './task-label-client.js';
|
|
3
|
+
import type { WechatContactsPage, WechatProfileView, WechatStatusView } from './types.js';
|
|
4
|
+
import type { WechatHistoryPage, WechatHistoryQuery } from './wechat-types.js';
|
|
5
|
+
|
|
6
|
+
/** WeChat channel read methods shared by every ParallClient instance. */
|
|
7
|
+
export abstract class WechatClient extends TaskLabelClient {
|
|
8
|
+
/** Address book enriched with display names. */
|
|
9
|
+
async listWechatContacts(orgId: string): Promise<WechatContactsPage> {
|
|
10
|
+
return this.request('GET', ENDPOINTS.WECHAT_CONTACTS(orgId));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Platform-retained context in chronological page order. */
|
|
14
|
+
async wechatHistory(
|
|
15
|
+
orgId: string,
|
|
16
|
+
conversation: string,
|
|
17
|
+
query?: WechatHistoryQuery,
|
|
18
|
+
): Promise<WechatHistoryPage> {
|
|
19
|
+
const params = new URLSearchParams({ conversation });
|
|
20
|
+
if (query?.before) params.set('before', query.before);
|
|
21
|
+
if (query?.since) params.set('since', query.since);
|
|
22
|
+
if (query?.limit !== undefined) params.set('limit', String(query.limit));
|
|
23
|
+
return this.request('GET', `${ENDPOINTS.WECHAT_HISTORY(orgId)}?${params.toString()}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Connected WeChat account identity. */
|
|
27
|
+
async wechatProfile(orgId: string): Promise<WechatProfileView> {
|
|
28
|
+
return this.request('GET', ENDPOINTS.WECHAT_PROFILE(orgId));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Live online probe, identity, and platform offline record. */
|
|
32
|
+
async wechatStatus(orgId: string): Promise<WechatStatusView> {
|
|
33
|
+
return this.request('GET', ENDPOINTS.WECHAT_STATUS(orgId));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Query for platform-retained WeChat context. */
|
|
2
|
+
export interface WechatHistoryQuery {
|
|
3
|
+
/** External message id returned as next_before by a previous page. */
|
|
4
|
+
before?: string;
|
|
5
|
+
/** Inclusive RFC3339 timestamp or YYYY-MM-DD (UTC midnight). */
|
|
6
|
+
since?: string;
|
|
7
|
+
/** Page size; defaults to 20 and is capped at 100. */
|
|
8
|
+
limit?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface WechatHistoryMessage {
|
|
12
|
+
/** Vendor external message id. */
|
|
13
|
+
id: string;
|
|
14
|
+
direction: 'inbound' | 'outbound';
|
|
15
|
+
sender_wxid: string;
|
|
16
|
+
sender_name: string;
|
|
17
|
+
text: string;
|
|
18
|
+
occurred_at: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface WechatHistoryPage {
|
|
22
|
+
conversation: string;
|
|
23
|
+
/** Chronological order: oldest to newest within this page. */
|
|
24
|
+
messages: WechatHistoryMessage[];
|
|
25
|
+
has_more: boolean;
|
|
26
|
+
/** Pass back as before to continue toward older messages. */
|
|
27
|
+
next_before?: string;
|
|
28
|
+
}
|