wechat-clawbot 0.9.1 → 0.9.2
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/README.md +204 -5
- package/README.zh.md +20 -0
- package/lib/bridge.d.ts.map +1 -1
- package/lib/bridge.js +73 -22
- package/lib/bridge.js.map +1 -1
- package/lib/claude-peer.d.ts +65 -1
- package/lib/claude-peer.d.ts.map +1 -1
- package/lib/claude-peer.js +944 -63
- package/lib/claude-peer.js.map +1 -1
- package/lib/cli.js +0 -0
- package/lib/client.js +34 -1
- package/lib/config.d.ts +52 -0
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +57 -0
- package/lib/config.js.map +1 -1
- package/lib/localtime.d.ts +37 -0
- package/lib/localtime.d.ts.map +1 -0
- package/lib/localtime.js +79 -0
- package/lib/localtime.js.map +1 -0
- package/lib/mcp-route.d.ts +2 -0
- package/lib/mcp-route.d.ts.map +1 -1
- package/lib/mcp-route.js +54 -2
- package/lib/mcp-route.js.map +1 -1
- package/lib/memory-auto.js +2 -2
- package/lib/memory-auto.js.map +1 -1
- package/lib/memory.d.ts.map +1 -1
- package/lib/memory.js +3 -2
- package/lib/memory.js.map +1 -1
- package/lib/prompt.d.ts.map +1 -1
- package/lib/prompt.js +101 -44
- package/lib/prompt.js.map +1 -1
- package/lib/tool.d.ts.map +1 -1
- package/lib/tool.js +69 -0
- package/lib/tool.js.map +1 -1
- package/lib/voice.d.ts +29 -0
- package/lib/voice.d.ts.map +1 -0
- package/lib/voice.js +172 -0
- package/lib/voice.js.map +1 -0
- package/package.json +1 -1
package/lib/claude-peer.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import type { ClaudePermissionMode, ClaudeResumeMode, ClawbotConfig } from "./config.js";
|
|
3
|
+
declare function findClaude(): string | undefined;
|
|
4
|
+
/** Is this transcript one of this plugin's own relay-helper runs? */
|
|
5
|
+
declare function isRelayHelperTranscript(file: string): boolean;
|
|
2
6
|
type Turn = {
|
|
3
7
|
role: "user" | "assistant";
|
|
4
8
|
at: string;
|
|
@@ -13,6 +17,8 @@ type SessionState = {
|
|
|
13
17
|
lastActivity: number;
|
|
14
18
|
/** Best available inference — see `running` below for why it is an inference. */
|
|
15
19
|
running: boolean;
|
|
20
|
+
/** The directory the session ran in, as recorded on its own entries. */
|
|
21
|
+
cwd?: string;
|
|
16
22
|
};
|
|
17
23
|
/**
|
|
18
24
|
* Read the last `limit` human-visible turns.
|
|
@@ -34,11 +40,69 @@ declare function readTail(file: string, limit: number): SessionState;
|
|
|
34
40
|
* synthetic transcript with a known answer can be checked instead.
|
|
35
41
|
*/
|
|
36
42
|
export declare const readTranscriptForTest: typeof readTail;
|
|
43
|
+
/**
|
|
44
|
+
* Test seam for the binary search — the piece that actually failed in
|
|
45
|
+
* production, and the one whose correctness depends on this machine's layout
|
|
46
|
+
* rather than on any logic here.
|
|
47
|
+
*/
|
|
48
|
+
export declare const resolveClaudeBinaryForTest: typeof findClaude;
|
|
49
|
+
/**
|
|
50
|
+
* Test seam for the approval-mode decision. Exported because the two branches
|
|
51
|
+
* that matter — a mode that needs a human, and no recorded mode at all — are
|
|
52
|
+
* exactly the ones a live machine will not reliably produce on demand, and
|
|
53
|
+
* getting them wrong reproduces the "it sits in manual mode" complaint.
|
|
54
|
+
*/
|
|
55
|
+
export declare const resolveReviveModeForTest: typeof resolveReviveMode;
|
|
56
|
+
/** Test seam: the backwards chunked scan for a session's mode and directory. */
|
|
57
|
+
export declare const reviveFactsForTest: typeof reviveFacts;
|
|
58
|
+
/**
|
|
59
|
+
* Test seam: "is this transcript one of ours". Exported because the live roster
|
|
60
|
+
* cannot test it — whether a helper session happens to fall inside the newest
|
|
61
|
+
* eight depends on what the machine did today, which makes the assertion pass
|
|
62
|
+
* for the wrong reason.
|
|
63
|
+
*/
|
|
64
|
+
export declare const isRelayHelperTranscriptForTest: typeof isRelayHelperTranscript;
|
|
65
|
+
/**
|
|
66
|
+
* The last-recorded facts a revive needs: the session's own approval mode, and
|
|
67
|
+
* the directory it was running in.
|
|
68
|
+
*
|
|
69
|
+
* Both are read by scanning BACKWARDS in growing windows rather than from the
|
|
70
|
+
* 64KB tail `readMetaTail` uses, because 64KB is demonstrably not enough:
|
|
71
|
+
*
|
|
72
|
+
* - `permissionMode` is only written when the mode CHANGES, so most sessions
|
|
73
|
+
* have none of it anywhere near the end (measured: 5 of the 8 newest).
|
|
74
|
+
* - `cwd` is on most records, but a single `attachment` record can be tens of
|
|
75
|
+
* KB (skill listings, MCP instruction blocks). On a 155KB transcript the
|
|
76
|
+
* last 64KB held only two trailing records, neither carrying a cwd — so the
|
|
77
|
+
* session came back with no directory at all, and the revive would have run
|
|
78
|
+
* in the wrong place.
|
|
79
|
+
*
|
|
80
|
+
* Called once, on the send path, for one session. The roster deliberately does
|
|
81
|
+
* NOT use this: it reads a fixed 64KB per session because it touches eight of
|
|
82
|
+
* them and a missing cwd there is cosmetic, not wrong.
|
|
83
|
+
*/
|
|
84
|
+
declare function reviveFacts(file: string): {
|
|
85
|
+
mode?: ClaudePermissionMode;
|
|
86
|
+
cwd?: string;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Decide the approval mode for a revive, and say where it came from.
|
|
90
|
+
*
|
|
91
|
+
* `inherit` (the default) means "run it the way that workspace was already
|
|
92
|
+
* running" — which is what the user asked for and what a transcript can actually
|
|
93
|
+
* answer. The two escape hatches are honest rather than silent: a mode that
|
|
94
|
+
* needs a human, or no recorded mode at all, falls back to `acceptEdits` and the
|
|
95
|
+
* reply says so.
|
|
96
|
+
*/
|
|
97
|
+
declare function resolveReviveMode(configured: ClaudeResumeMode, recorded: ClaudePermissionMode | undefined): {
|
|
98
|
+
mode: ClaudePermissionMode;
|
|
99
|
+
why: string;
|
|
100
|
+
};
|
|
37
101
|
/**
|
|
38
102
|
* Register all three tools on one context.
|
|
39
103
|
*
|
|
40
104
|
* @param agentCtx - the context whose agent should get the tools.
|
|
41
105
|
*/
|
|
42
|
-
export declare function registerClaudePeerTools(agentCtx: Context): void;
|
|
106
|
+
export declare function registerClaudePeerTools(agentCtx: Context, config?: Pick<ClawbotConfig, "claudeResumePermissionMode">): void;
|
|
43
107
|
export {};
|
|
44
108
|
//# sourceMappingURL=claude-peer.d.ts.map
|
package/lib/claude-peer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-peer.d.ts","sourceRoot":"","sources":["../src/claude-peer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"claude-peer.d.ts","sourceRoot":"","sources":["../src/claude-peer.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAInD,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAuKzF,iBAAS,UAAU,IAAI,MAAM,GAAG,SAAS,CAmCxC;AAkFD,qEAAqE;AACrE,iBAAS,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CActD;AA0LD,KAAK,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAuCrE,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,yEAAyE;IACzE,YAAY,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,OAAO,EAAE,OAAO,CAAC;IACjB,wEAAwE;IACxE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAmBF;;;;;;;;;;GAUG;AACH,iBAAS,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,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