visionclaw 0.1.217 → 0.1.218-beta.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/agent/engines/pi/tools.d.ts.map +1 -1
- package/dist/agent/engines/pi/tools.js +2 -1
- package/dist/agent/engines/pi/tools.js.map +1 -1
- package/dist/agent/fast-response-eligibility.d.ts.map +1 -1
- package/dist/agent/fast-response-eligibility.js +3 -0
- package/dist/agent/fast-response-eligibility.js.map +1 -1
- package/dist/agent/fund-league-hold.d.ts +1 -1
- package/dist/agent/fund-league-hold.d.ts.map +1 -1
- package/dist/agent/fund-league-hold.js +11 -1
- package/dist/agent/fund-league-hold.js.map +1 -1
- package/dist/agent/heartbeat-manager.d.ts +4 -0
- package/dist/agent/heartbeat-manager.d.ts.map +1 -1
- package/dist/agent/heartbeat-manager.js +56 -0
- package/dist/agent/heartbeat-manager.js.map +1 -1
- package/dist/agent/interrupt-handler.d.ts +0 -2
- package/dist/agent/interrupt-handler.d.ts.map +1 -1
- package/dist/agent/interrupt-handler.js +0 -4
- package/dist/agent/interrupt-handler.js.map +1 -1
- package/dist/agent/lifecycle-trace.d.ts +9 -0
- package/dist/agent/lifecycle-trace.d.ts.map +1 -1
- package/dist/agent/lifecycle-trace.js +16 -1
- package/dist/agent/lifecycle-trace.js.map +1 -1
- package/dist/agent/lifecycle-transitions.d.ts +21 -0
- package/dist/agent/lifecycle-transitions.d.ts.map +1 -0
- package/dist/agent/lifecycle-transitions.js +33 -0
- package/dist/agent/lifecycle-transitions.js.map +1 -0
- package/dist/agent/loop.d.ts.map +1 -1
- package/dist/agent/loop.js +4 -0
- package/dist/agent/loop.js.map +1 -1
- package/dist/agent/onboarding-gate.d.ts.map +1 -1
- package/dist/agent/onboarding-gate.js +5 -0
- package/dist/agent/onboarding-gate.js.map +1 -1
- package/dist/agent/reply-target.d.ts.map +1 -1
- package/dist/agent/reply-target.js +2 -0
- package/dist/agent/reply-target.js.map +1 -1
- package/dist/agent/status.d.ts.map +1 -1
- package/dist/agent/status.js +2 -0
- package/dist/agent/status.js.map +1 -1
- package/dist/agent/wake-cycle-runner.d.ts.map +1 -1
- package/dist/agent/wake-cycle-runner.js +10 -16
- package/dist/agent/wake-cycle-runner.js.map +1 -1
- package/dist/channels/qq-access.d.ts +294 -0
- package/dist/channels/qq-access.d.ts.map +1 -0
- package/dist/channels/qq-access.js +426 -0
- package/dist/channels/qq-access.js.map +1 -0
- package/dist/channels/qq-bind-link.d.ts +65 -0
- package/dist/channels/qq-bind-link.d.ts.map +1 -0
- package/dist/channels/qq-bind-link.js +108 -0
- package/dist/channels/qq-bind-link.js.map +1 -0
- package/dist/channels/qq-commands.d.ts.map +1 -1
- package/dist/channels/qq-commands.js +3 -0
- package/dist/channels/qq-commands.js.map +1 -1
- package/dist/channels/qq-group-names.d.ts +27 -0
- package/dist/channels/qq-group-names.d.ts.map +1 -0
- package/dist/channels/qq-group-names.js +64 -0
- package/dist/channels/qq-group-names.js.map +1 -0
- package/dist/channels/qq-group-welcome.d.ts +75 -0
- package/dist/channels/qq-group-welcome.d.ts.map +1 -0
- package/dist/channels/qq-group-welcome.js +165 -0
- package/dist/channels/qq-group-welcome.js.map +1 -0
- package/dist/channels/qq-owner-commands.d.ts +178 -0
- package/dist/channels/qq-owner-commands.d.ts.map +1 -0
- package/dist/channels/qq-owner-commands.js +425 -0
- package/dist/channels/qq-owner-commands.js.map +1 -0
- package/dist/channels/qq-owner-name.d.ts +41 -0
- package/dist/channels/qq-owner-name.d.ts.map +1 -0
- package/dist/channels/qq-owner-name.js +71 -0
- package/dist/channels/qq-owner-name.js.map +1 -0
- package/dist/channels/qq-status.d.ts +2 -0
- package/dist/channels/qq-status.d.ts.map +1 -1
- package/dist/channels/qq-status.js +4 -0
- package/dist/channels/qq-status.js.map +1 -1
- package/dist/channels/qq.d.ts +126 -3
- package/dist/channels/qq.d.ts.map +1 -1
- package/dist/channels/qq.js +688 -25
- package/dist/channels/qq.js.map +1 -1
- package/dist/config/qq-access.d.ts +102 -0
- package/dist/config/qq-access.d.ts.map +1 -0
- package/dist/config/qq-access.js +99 -0
- package/dist/config/qq-access.js.map +1 -0
- package/dist/config/types.d.ts +138 -3
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js +11 -0
- package/dist/config/types.js.map +1 -1
- package/dist/i18n/messages.d.ts +136 -0
- package/dist/i18n/messages.d.ts.map +1 -1
- package/dist/i18n/messages.js +108 -0
- package/dist/i18n/messages.js.map +1 -1
- package/dist/onboarding/onboarding-service-client.d.ts +58 -0
- package/dist/onboarding/onboarding-service-client.d.ts.map +1 -1
- package/dist/onboarding/onboarding-service-client.js +27 -0
- package/dist/onboarding/onboarding-service-client.js.map +1 -1
- package/dist/onboarding/remote-set-owner.d.ts.map +1 -1
- package/dist/onboarding/remote-set-owner.js +26 -0
- package/dist/onboarding/remote-set-owner.js.map +1 -1
- package/dist/onboarding/send-invite.d.ts +6 -2
- package/dist/onboarding/send-invite.d.ts.map +1 -1
- package/dist/onboarding/send-invite.js +43 -3
- package/dist/onboarding/send-invite.js.map +1 -1
- package/dist/threads/task-sidecar.d.ts +1 -1
- package/dist/threads/task-sidecar.d.ts.map +1 -1
- package/dist/threads/task-sidecar.js +5 -4
- package/dist/threads/task-sidecar.js.map +1 -1
- package/dist/tools/email.d.ts +1 -1
- package/dist/tools/event-trigger.d.ts +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +2 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/mcp-manager.d.ts +1 -1
- package/dist/tools/qq-access.d.ts +6 -0
- package/dist/tools/qq-access.d.ts.map +1 -0
- package/dist/tools/qq-access.js +36 -0
- package/dist/tools/qq-access.js.map +1 -0
- package/dist/tools/skill.d.ts +1 -1
- package/dist/tools/totp.d.ts +1 -1
- package/dist-agent/bundle.cjs +2 -2
- package/package.json +1 -1
- package/dist/builtin-skills/catalog/phone-adb-automation/SKILL.md +0 -412
- package/dist/builtin-skills/catalog/phone-adb-automation/phone_input.sh +0 -132
- package/dist/builtin-skills/catalog/phone-adb-automation/phone_launch.sh +0 -166
- package/dist/builtin-skills/catalog/phone-adb-automation/phone_screenshot.sh +0 -87
- package/dist/builtin-skills/catalog/phone-adb-automation/phone_security_kbd.py +0 -174
- package/dist/builtin-skills/catalog/phone-adb-automation/phone_setup.sh +0 -274
- package/dist/builtin-skills/catalog/phone-adb-automation/phone_swipe.sh +0 -111
- package/dist/builtin-skills/catalog/phone-adb-automation/phone_tap.sh +0 -87
- package/dist/builtin-skills/catalog/phone-adb-automation/phone_ui_parse.py +0 -176
- package/dist/builtin-skills/catalog/phone-adb-automation/phone_wake_unlock.sh +0 -67
- package/dist/builtin-skills/macos-automation/SKILL.md +0 -132
- package/dist/builtin-skills/transcribe-audio/SKILL.md +0 -122
- package/dist/builtin-skills/visionclaw-manual/SKILL.md +0 -337
- package/dist/obs/rdp/icons/icons/app_windows.svg +0 -4
- package/dist/obs/rdp/icons/icons/clip_get.svg +0 -4
- package/dist/obs/rdp/icons/icons/clip_send.svg +0 -4
- package/dist/obs/rdp/icons/icons/clip_shared.svg +0 -4
- package/dist/obs/rdp/icons/icons/clipboard.svg +0 -4
- package/dist/obs/rdp/icons/icons/clipboard_shared.svg +0 -4
- package/dist/obs/rdp/icons/icons/control.svg +0 -4
- package/dist/obs/rdp/icons/icons/desktop.svg +0 -4
- package/dist/obs/rdp/icons/icons/display.svg +0 -4
- package/dist/obs/rdp/icons/icons/launchpad.svg +0 -4
- package/dist/obs/rdp/icons/icons/mission_control.svg +0 -4
- package/dist/obs/rdp/icons/icons/screenshot.svg +0 -4
- package/dist/obs/rdp/icons/icons/zoom_actual.svg +0 -4
- package/dist/obs/rdp/icons/icons/zoom_fit.svg +0 -4
- package/dist/obs/rdp/icons/icons/zoom_in.svg +0 -4
- package/dist/obs/rdp/icons/icons/zoom_out.svg +0 -4
- package/dist/realtime/assets/index.html +0 -1058
- package/dist/realtime/assets/samples/alloy.mp3 +0 -0
- package/dist/realtime/assets/samples/ash.mp3 +0 -0
- package/dist/realtime/assets/samples/ballad.mp3 +0 -0
- package/dist/realtime/assets/samples/cedar.mp3 +0 -0
- package/dist/realtime/assets/samples/coral.mp3 +0 -0
- package/dist/realtime/assets/samples/echo.mp3 +0 -0
- package/dist/realtime/assets/samples/marin.mp3 +0 -0
- package/dist/realtime/assets/samples/sage.mp3 +0 -0
- package/dist/realtime/assets/samples/shimmer.mp3 +0 -0
- package/dist/realtime/assets/samples/verse.mp3 +0 -0
- package/dist-agent/assets/index.html +0 -1058
- package/dist-agent/assets/samples/alloy.mp3 +0 -0
- package/dist-agent/assets/samples/ash.mp3 +0 -0
- package/dist-agent/assets/samples/ballad.mp3 +0 -0
- package/dist-agent/assets/samples/cedar.mp3 +0 -0
- package/dist-agent/assets/samples/coral.mp3 +0 -0
- package/dist-agent/assets/samples/echo.mp3 +0 -0
- package/dist-agent/assets/samples/marin.mp3 +0 -0
- package/dist-agent/assets/samples/sage.mp3 +0 -0
- package/dist-agent/assets/samples/shimmer.mp3 +0 -0
- package/dist-agent/assets/samples/verse.mp3 +0 -0
- package/dist-agent/playwriter-relay.cjs +0 -95
- package/dist-agent/realtime/assets/index.html +0 -1058
- package/dist-agent/realtime/assets/samples/alloy.mp3 +0 -0
- package/dist-agent/realtime/assets/samples/ash.mp3 +0 -0
- package/dist-agent/realtime/assets/samples/ballad.mp3 +0 -0
- package/dist-agent/realtime/assets/samples/cedar.mp3 +0 -0
- package/dist-agent/realtime/assets/samples/coral.mp3 +0 -0
- package/dist-agent/realtime/assets/samples/echo.mp3 +0 -0
- package/dist-agent/realtime/assets/samples/marin.mp3 +0 -0
- package/dist-agent/realtime/assets/samples/sage.mp3 +0 -0
- package/dist-agent/realtime/assets/samples/shimmer.mp3 +0 -0
- package/dist-agent/realtime/assets/samples/verse.mp3 +0 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { type QqAccessConfig, type QqResponseMode, type QqSenderPolicy } from "../config/qq-access.js";
|
|
2
|
+
/** Group events the gateway can deliver on the GROUP_AND_C2C_EVENT intent (1 << 25). */
|
|
3
|
+
export type QqGroupMessageEvent = "GROUP_AT_MESSAGE_CREATE" | "GROUP_MESSAGE_CREATE";
|
|
4
|
+
export declare function isQqGroupMessageEvent(eventType: string): eventType is QqGroupMessageEvent;
|
|
5
|
+
export type GroupDecision = {
|
|
6
|
+
accept: true;
|
|
7
|
+
} | {
|
|
8
|
+
accept: false;
|
|
9
|
+
reason: "missing_member" | "group_not_allowed" | "member_not_allowed" | "owner_not_bound" | "mode_at_only";
|
|
10
|
+
};
|
|
11
|
+
export interface QqGroupPolicy {
|
|
12
|
+
mode: QqResponseMode;
|
|
13
|
+
senderPolicy: QqSenderPolicy;
|
|
14
|
+
/** Only read for the "list" policy. */
|
|
15
|
+
memberAllow: string[];
|
|
16
|
+
}
|
|
17
|
+
/** An owner binding verified by this process, not yet echoed back by the server. */
|
|
18
|
+
export interface QqOwnerBinding {
|
|
19
|
+
groupOpenid: string;
|
|
20
|
+
memberOpenid: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The settings that apply to one group: its own override where it has one,
|
|
24
|
+
* otherwise the global default, separately for the mode and the sender list.
|
|
25
|
+
* Null when the group is not allowed at all: not in `allow` and `allowAllGroups`
|
|
26
|
+
* is off. An override for a group that is not allowed grants nothing.
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveGroupPolicy(access: QqAccessConfig | undefined, groupOpenId: string): QqGroupPolicy | null;
|
|
29
|
+
/** The owner's member_openid in a group: from the server's confirmed list, or a binding this process just verified. */
|
|
30
|
+
export declare function ownerMemberIn(access: QqAccessConfig | undefined, groupOpenId: string, local?: readonly QqOwnerBinding[], options?: {
|
|
31
|
+
provenOnly?: boolean;
|
|
32
|
+
}): string[];
|
|
33
|
+
/** True when this member is the group's owner only because their nickname matched the owner's name (not proven). */
|
|
34
|
+
export declare function isNameRecognisedOwner(access: QqAccessConfig | undefined, groupOpenId: string, memberOpenId: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Decide whether a group message may reach the agent, using the group's own
|
|
37
|
+
* settings when it has an override and the global ones otherwise.
|
|
38
|
+
*
|
|
39
|
+
* A group author carries only `member_openid`, which differs per group and is
|
|
40
|
+
* a different identifier from the `user_openid` bound as `homeChannelOpenId`,
|
|
41
|
+
* so nothing here treats a group sender as the owner by default. The "owner"
|
|
42
|
+
* sender policy accepts only the member_openid the owner proved with a binding
|
|
43
|
+
* code in that very group.
|
|
44
|
+
*/
|
|
45
|
+
export declare function decideGroupMessage(input: {
|
|
46
|
+
eventType: QqGroupMessageEvent;
|
|
47
|
+
access: QqAccessConfig | undefined;
|
|
48
|
+
groupOpenId: string;
|
|
49
|
+
memberOpenId: string;
|
|
50
|
+
/** Owner bindings verified here and not yet confirmed by the server. */
|
|
51
|
+
localOwners?: readonly QqOwnerBinding[];
|
|
52
|
+
}): GroupDecision;
|
|
53
|
+
/**
|
|
54
|
+
* The single mode the agent reports on and the page explains: "all" when any
|
|
55
|
+
* allowed group answers every message (with allowAllGroups: the global mode is
|
|
56
|
+
* all, or any override is), otherwise "at". With no allowed group
|
|
57
|
+
* there is nothing to override, so it is the global mode. GRU computes the
|
|
58
|
+
* same value from the saved policy; keep the two in step.
|
|
59
|
+
*/
|
|
60
|
+
export declare function overallDesiredMode(access: QqAccessConfig): QqResponseMode;
|
|
61
|
+
export interface QqModeStatus {
|
|
62
|
+
desiredMode: QqResponseMode;
|
|
63
|
+
effectiveMode: QqResponseMode;
|
|
64
|
+
/**
|
|
65
|
+
* Stable code, present while no full-group-message event (GROUP_MESSAGE_CREATE) has reached this
|
|
66
|
+
* process: the platform has not enabled "receive all group messages" (or nobody posted yet).
|
|
67
|
+
* Reported whatever the response mode is, because reading and answering are separate.
|
|
68
|
+
*/
|
|
69
|
+
degradedReason?: "GROUP_MESSAGE_EVENT_NOT_OBSERVED";
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The bot always subscribes to every group message: GROUP_MESSAGE_CREATE rides on the same intent bit
|
|
73
|
+
* as @ messages (GROUP_AND_C2C_EVENT, 1 << 25), so there is nothing to opt into and an IDENTIFY is
|
|
74
|
+
* never rejected for it. Whether the platform really delivers them depends on a permission of the
|
|
75
|
+
* bot ("receive all group messages"); without it the gateway simply never sends the event and only
|
|
76
|
+
* @ messages arrive. Reading and answering are separate: the settings only decide whether a message
|
|
77
|
+
* makes the assistant answer.
|
|
78
|
+
*
|
|
79
|
+
* `degradedReason` is present while no GROUP_MESSAGE_CREATE has been seen on this connection (the
|
|
80
|
+
* platform has not enabled full group messages, or nobody has posted without @ yet). Then the
|
|
81
|
+
* effective response mode is "at" even if "every message" is chosen, honestly: it cannot answer what
|
|
82
|
+
* it never receives.
|
|
83
|
+
*/
|
|
84
|
+
export declare function resolveModeStatus(desiredMode: QqResponseMode, groupMessageEventObserved: boolean): QqModeStatus;
|
|
85
|
+
/** Longest message excerpt an agent reports; the server enforces the same limit. */
|
|
86
|
+
export declare const QQ_MESSAGE_PREVIEW_MAX_LENGTH = 30;
|
|
87
|
+
/**
|
|
88
|
+
* One-line excerpt of a group message for the owner to recognise a group or
|
|
89
|
+
* sender on the GRU bot page: whitespace and control characters collapse to
|
|
90
|
+
* single spaces, at most 30 characters. Returns undefined when nothing is left.
|
|
91
|
+
* The excerpt goes only into the heartbeat report; it is never logged.
|
|
92
|
+
*/
|
|
93
|
+
export declare function summarizeQqMessage(text: string | undefined): string | undefined;
|
|
94
|
+
/** A group or speaker name for display: control characters out, one line, at most 40 characters. */
|
|
95
|
+
export declare function cleanQqName(value: unknown): string | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Risk of recognising the owner by name, kept here so the code that does it points to one place:
|
|
98
|
+
* a QQ nickname can be copied, so a member who picks the owner's nickname before the owner speaks would be
|
|
99
|
+
* recognised as the owner. Mitigations: (1) only when the group has no owner binding at all, (2) a binding
|
|
100
|
+
* proven by a code or a Gru confirmation is never replaced, (3) a name binding is never treated as proof by the
|
|
101
|
+
* "only me" gate, (4) it is dropped as soon as a second member with the same name shows up, (5) the Gru page
|
|
102
|
+
* shows it as "recognised by name" and the owner can unbind it or confirm properly with the Bind button.
|
|
103
|
+
*/
|
|
104
|
+
export declare const QQ_NAME_MATCH_RISK = "owner recognised by nickname is unverified";
|
|
105
|
+
export interface QqGroupReport {
|
|
106
|
+
groupOpenid: string;
|
|
107
|
+
lastSeen: string;
|
|
108
|
+
removed?: true;
|
|
109
|
+
/** Excerpt of the latest message; omitted when unknown. Older servers ignore it. */
|
|
110
|
+
lastMessage?: string;
|
|
111
|
+
/** The group's name from GET /v2/groups/{id}/info; omitted when QQ would not say. Older servers ignore it. */
|
|
112
|
+
name?: string;
|
|
113
|
+
/** Only the name is new (found by asking QQ again, no event): the service must not touch "last seen". Older servers ignore it. */
|
|
114
|
+
nameOnly?: true;
|
|
115
|
+
}
|
|
116
|
+
export interface QqMemberReport {
|
|
117
|
+
groupOpenid: string;
|
|
118
|
+
memberOpenid: string;
|
|
119
|
+
lastSeen: string;
|
|
120
|
+
/** The speaker's QQ nickname (`author.username` of the group event); omitted when absent. Older servers ignore it. */
|
|
121
|
+
name?: string;
|
|
122
|
+
/** Excerpt of the latest message; omitted when unknown. Older servers ignore it. */
|
|
123
|
+
lastMessage?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* One "identity check" sample: which identity fields a received message's `author` carried. It exists
|
|
127
|
+
* so the owner can see on the GRU bot page whether QQ really returns `union_openid` (a stable id across
|
|
128
|
+
* private chat and groups, which would make the binding code unnecessary). Full values are kept because
|
|
129
|
+
* the page is the owner's own debug view; they are never logged and never include message text.
|
|
130
|
+
*/
|
|
131
|
+
export interface QqIdentityProbe {
|
|
132
|
+
/** Random id, so a re-sent report is not stored twice. */
|
|
133
|
+
id: string;
|
|
134
|
+
at: string;
|
|
135
|
+
event: "c2c" | "group_at" | "group_message";
|
|
136
|
+
/** Shortened group_openid (first 6…last 4), groups only. */
|
|
137
|
+
group?: string;
|
|
138
|
+
/** Names of the keys the author object had, even when their value was empty. */
|
|
139
|
+
keys: string[];
|
|
140
|
+
userOpenid?: string;
|
|
141
|
+
memberOpenid?: string;
|
|
142
|
+
unionOpenid?: string;
|
|
143
|
+
unionUserAccount?: string;
|
|
144
|
+
username?: string;
|
|
145
|
+
memberRole?: string;
|
|
146
|
+
}
|
|
147
|
+
export declare const QQ_IDENTITY_PROBE_MAX = 20;
|
|
148
|
+
/** The author object as QQ sends it; every field is optional and may be empty. */
|
|
149
|
+
export type QqAuthorFields = Record<string, unknown>;
|
|
150
|
+
/** Shorten a group_openid for display (first 6…last 4). */
|
|
151
|
+
export declare const shortQqId: (id: string) => string;
|
|
152
|
+
/** Build a sample from an event's author. Returns null when there is no author object at all. */
|
|
153
|
+
export declare function buildQqIdentityProbe(input: {
|
|
154
|
+
event: QqIdentityProbe["event"];
|
|
155
|
+
author: unknown;
|
|
156
|
+
group?: string;
|
|
157
|
+
at?: string;
|
|
158
|
+
id?: string;
|
|
159
|
+
}): QqIdentityProbe | null;
|
|
160
|
+
/** The latest samples not yet delivered; bounded, re-queued when a heartbeat fails. */
|
|
161
|
+
export declare class QqIdentityProbeTracker {
|
|
162
|
+
private pending;
|
|
163
|
+
note(probe: QqIdentityProbe | null): void;
|
|
164
|
+
drain(): QqIdentityProbe[];
|
|
165
|
+
requeue(probes: readonly QqIdentityProbe[]): void;
|
|
166
|
+
}
|
|
167
|
+
/** Heartbeat payload field `qqAccessReport`. */
|
|
168
|
+
export interface QqAccessReport {
|
|
169
|
+
groups: QqGroupReport[];
|
|
170
|
+
members: QqMemberReport[];
|
|
171
|
+
mode?: QqModeStatus;
|
|
172
|
+
/** Owner binding codes verified in a group. The code itself is never sent, only the id of the pending code. */
|
|
173
|
+
ownerBindings?: (QqOwnerBinding & {
|
|
174
|
+
bindId: string;
|
|
175
|
+
})[];
|
|
176
|
+
/** Groups the owner has now been told (privately) the bot joined. The service never lists them again. */
|
|
177
|
+
groupNoticeAcks?: string[];
|
|
178
|
+
/** Identity-check samples (author fields of received messages). Older servers ignore the field. */
|
|
179
|
+
identityProbes?: QqIdentityProbe[];
|
|
180
|
+
/**
|
|
181
|
+
* A member whose QQ nickname equals the owner's name, in a group with no owner yet: a guess, which the service
|
|
182
|
+
* re-checks (see QQ_NAME_MATCH_RISK). Older servers ignore the field.
|
|
183
|
+
*/
|
|
184
|
+
ownerNameClaims?: {
|
|
185
|
+
groupOpenid: string;
|
|
186
|
+
memberOpenid: string;
|
|
187
|
+
}[];
|
|
188
|
+
/** Groups where more than one member has the owner's name: any name recognition there is withdrawn. */
|
|
189
|
+
ownerNameAmbiguous?: string[];
|
|
190
|
+
}
|
|
191
|
+
export declare const QQ_REPORT_MAX_GROUPS = 100;
|
|
192
|
+
export declare const QQ_REPORT_MAX_MEMBERS = 200;
|
|
193
|
+
/**
|
|
194
|
+
* Buffers groups and speakers seen since the last successful heartbeat.
|
|
195
|
+
* Drained per heartbeat and re-queued if the heartbeat fails, so a network
|
|
196
|
+
* error never loses a first sighting. Unknown groups are recorded before the
|
|
197
|
+
* allowlist check on purpose: that is how the owner discovers them.
|
|
198
|
+
*/
|
|
199
|
+
export declare class QqAccessTracker {
|
|
200
|
+
private groups;
|
|
201
|
+
private members;
|
|
202
|
+
noteGroup(groupOpenId: string, options?: {
|
|
203
|
+
removed?: boolean;
|
|
204
|
+
at?: string;
|
|
205
|
+
lastMessage?: string;
|
|
206
|
+
name?: string;
|
|
207
|
+
nameOnly?: boolean;
|
|
208
|
+
}): void;
|
|
209
|
+
noteMember(groupOpenId: string, memberOpenId: string, at?: string, lastMessage?: string, name?: string): void;
|
|
210
|
+
/** Remove and return up to one heartbeat's worth of reports; null when idle. */
|
|
211
|
+
drain(): Pick<QqAccessReport, "groups" | "members"> | null;
|
|
212
|
+
/** Put an undelivered report back, without clobbering anything newer. */
|
|
213
|
+
requeue(report: Pick<QqAccessReport, "groups" | "members">): void;
|
|
214
|
+
}
|
|
215
|
+
/** What HeartbeatManager needs from the QQ adapter. */
|
|
216
|
+
export interface QqAccessReporter {
|
|
217
|
+
drainQqAccessReport(): QqAccessReport | null;
|
|
218
|
+
requeueQqAccessReport(report: QqAccessReport): void;
|
|
219
|
+
/** Optional: lets the reporter ask for an early heartbeat. */
|
|
220
|
+
setReportWaker?(wake: () => void): void;
|
|
221
|
+
/** Owner commands typed in the private chat, to relay in the heartbeat (service-side validation). */
|
|
222
|
+
drainQqOwnerCommands?(): {
|
|
223
|
+
id: string;
|
|
224
|
+
text: string;
|
|
225
|
+
confirm: boolean;
|
|
226
|
+
locale: "en" | "zh";
|
|
227
|
+
}[];
|
|
228
|
+
requeueQqOwnerCommands?(requests: {
|
|
229
|
+
id: string;
|
|
230
|
+
text: string;
|
|
231
|
+
confirm: boolean;
|
|
232
|
+
locale: "en" | "zh";
|
|
233
|
+
}[]): void;
|
|
234
|
+
/** The service's answers: command replies and groups still to announce to the owner. */
|
|
235
|
+
handleQqServiceResponse?(response: {
|
|
236
|
+
qqOwnerCommandReplies?: unknown;
|
|
237
|
+
qqGroupNotices?: unknown;
|
|
238
|
+
qqGroupNamesWanted?: unknown;
|
|
239
|
+
}): void;
|
|
240
|
+
}
|
|
241
|
+
export declare function isQqAccessReporter(value: unknown): value is QqAccessReporter;
|
|
242
|
+
/**
|
|
243
|
+
* The `/bind-owner <code>` command (and `/bind`, which handed out the code) is hidden for now: the only way to
|
|
244
|
+
* become the owner in a group is join -> private question -> "Bind me" button -> Gru confirmation link.
|
|
245
|
+
* While false the agent neither recognises nor answers the command (in a group or in private; it is plain text
|
|
246
|
+
* then), and the verification code below stays but is unreachable. Flip to true to bring the command back
|
|
247
|
+
* (also SHOW_BIND_OWNER_COMMAND in the onboarding service and the code box on the GRU page).
|
|
248
|
+
*/
|
|
249
|
+
export declare const SHOW_BIND_OWNER_COMMAND = false;
|
|
250
|
+
/** Prefix of the binding command an owner types into a group. */
|
|
251
|
+
export declare const QQ_OWNER_BIND_COMMAND = "/bind-owner";
|
|
252
|
+
/**
|
|
253
|
+
* Parse a group message as the owner binding command. Returns null when it is
|
|
254
|
+
* not that command at all, otherwise the normalized code ("" when missing).
|
|
255
|
+
* Such a message is only ever used for binding: never AI input, never logged.
|
|
256
|
+
*/
|
|
257
|
+
export declare function parseOwnerBindCommand(text: string, enabled?: boolean): {
|
|
258
|
+
code: string;
|
|
259
|
+
} | null;
|
|
260
|
+
export declare function hashOwnerBindCode(salt: string, code: string): string;
|
|
261
|
+
export type OwnerBindResult = "ok" | "invalid" | "rate_limited";
|
|
262
|
+
/**
|
|
263
|
+
* Verifies owner binding codes. Failures are limited per sender and per group in a
|
|
264
|
+
* sliding window (one group being guessed at does not lock the others), so a code cannot be guessed by trying; a used code (or an
|
|
265
|
+
* expired one) never works again, and nothing but the code's hash is held.
|
|
266
|
+
*/
|
|
267
|
+
export declare class QqOwnerBinder {
|
|
268
|
+
private readonly now;
|
|
269
|
+
private failures;
|
|
270
|
+
/** Groups the owner was already told are locked, with when. */
|
|
271
|
+
private readonly limitNotified;
|
|
272
|
+
private readonly used;
|
|
273
|
+
/** Verified here, waiting to be reported (and until the server echoes them). */
|
|
274
|
+
private readonly bound;
|
|
275
|
+
private readonly unreported;
|
|
276
|
+
constructor(now?: () => number);
|
|
277
|
+
attempt(access: QqAccessConfig | undefined, groupOpenId: string, memberOpenId: string, code: string): OwnerBindResult;
|
|
278
|
+
/**
|
|
279
|
+
* True once per group and window after it was locked: the owner should be told (privately, never in
|
|
280
|
+
* the group, where an attacker would see it). Bounded overall so it cannot become a message storm.
|
|
281
|
+
*/
|
|
282
|
+
takeLimitNotice(groupOpenId: string): boolean;
|
|
283
|
+
/** Bindings in force here before the server has echoed them. */
|
|
284
|
+
local(): QqOwnerBinding[];
|
|
285
|
+
/** The server confirmed these groups: stop carrying them locally. */
|
|
286
|
+
confirm(access: QqAccessConfig | undefined): void;
|
|
287
|
+
drain(): (QqOwnerBinding & {
|
|
288
|
+
bindId: string;
|
|
289
|
+
})[];
|
|
290
|
+
requeue(bindings: readonly (QqOwnerBinding & {
|
|
291
|
+
bindId: string;
|
|
292
|
+
})[]): void;
|
|
293
|
+
}
|
|
294
|
+
//# sourceMappingURL=qq-access.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qq-access.d.ts","sourceRoot":"","sources":["../../src/channels/qq-access.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,cAAc,EAEnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;AAEhC,wFAAwF;AACxF,MAAM,MAAM,mBAAmB,GAAG,yBAAyB,GAAG,sBAAsB,CAAC;AAErF,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,IAAI,mBAAmB,CAEzF;AAED,MAAM,MAAM,aAAa,GACrB;IAAE,MAAM,EAAE,IAAI,CAAA;CAAE,GAChB;IAAE,MAAM,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,gBAAgB,GAAG,mBAAmB,GAAG,oBAAoB,GAAG,iBAAiB,GAAG,cAAc,CAAA;CAAE,CAAC;AAElI,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,cAAc,CAAC;IACrB,YAAY,EAAE,cAAc,CAAC;IAC7B,uCAAuC;IACvC,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,oFAAoF;AACpF,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAKD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,EAAE,WAAW,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAgBhH;AAED,uHAAuH;AACvH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,cAAc,GAAG,SAAS,EAClC,WAAW,EAAE,MAAM,EACnB,KAAK,GAAE,SAAS,cAAc,EAAO,EACrC,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GACrC,MAAM,EAAE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