@murmurv2/cli 2.13.0 → 2.14.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/package.json +3 -3
- package/runtime/bin/murmur-svc.exe +0 -0
- package/runtime/npm-runtime-manifest.json +57 -37
- package/runtime/package.json +1 -1
- package/runtime/packages/setup/dist/src/autoreply.d.ts +23 -0
- package/runtime/packages/setup/dist/src/autoreply.js +71 -0
- package/runtime/packages/setup/dist/src/cli.js +47 -1
- package/runtime/packages/setup/dist/src/clients.d.ts +5 -5
- package/runtime/packages/setup/dist/src/commands.d.ts +1 -0
- package/runtime/packages/setup/dist/src/commands.js +17 -5
- package/runtime/packages/setup/dist/src/connect.d.ts +5 -5
- package/runtime/packages/setup/dist/src/connect.js +3 -1
- package/runtime/packages/setup/dist/src/conversations.d.ts +193 -0
- package/runtime/packages/setup/dist/src/conversations.js +674 -0
- package/runtime/packages/setup/dist/src/platform/darwin.js +12 -0
- package/runtime/packages/setup/dist/src/platform/linux.js +24 -10
- package/runtime/packages/setup/dist/src/platform/windows.js +26 -7
- package/runtime/packages/setup/dist/src/types.d.ts +1 -1
- package/runtime/packages/setup/package.json +1 -1
- package/runtime/scripts/codex-app-server-wake.mjs +23 -4
- package/runtime/scripts/murmur-daemon.mjs +5 -2
- package/runtime/scripts/murmur-shell-send.mjs +5 -1
- package/runtime/scripts/owner-review-store.mjs +54 -0
- package/runtime/scripts/wake-monitor.mjs +49 -10
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import type { ServiceContext } from './types.js';
|
|
2
|
+
/** `dm:a:b` and `dm:b:a` are one conversation (same rule as wake-drain-claude.mjs canonicalConversationId). */
|
|
3
|
+
export declare function canonicalConversationId(id: string): string;
|
|
4
|
+
/** A hand-off note is a local row the person wrote for one of their own sessions; it never reaches the peer. */
|
|
5
|
+
export declare const NOTE_TRANSPORT = "desktop-note";
|
|
6
|
+
/** The auto-reply handler's marker: its exact first line, leading whitespace ignored. */
|
|
7
|
+
export declare const AUTO_MARKER = "[MURMUR-AUTO v1]";
|
|
8
|
+
export type OwnerKind = 'claude' | 'codex' | 'none';
|
|
9
|
+
export interface Owner {
|
|
10
|
+
kind: OwnerKind;
|
|
11
|
+
sessionKey: string | null;
|
|
12
|
+
pid: number | null;
|
|
13
|
+
alive: boolean | null;
|
|
14
|
+
/** The full Claude Code session id when the binding holds one (a UUID opens it with claude://resume). */
|
|
15
|
+
sessionId?: string | null;
|
|
16
|
+
listening: boolean | null;
|
|
17
|
+
cwd: string | null;
|
|
18
|
+
updatedAt: string | null;
|
|
19
|
+
via: 'conversation' | 'peer' | 'codex-task' | null;
|
|
20
|
+
}
|
|
21
|
+
export interface Reader {
|
|
22
|
+
pid: number | null;
|
|
23
|
+
lane: string | null;
|
|
24
|
+
cwd: string | null;
|
|
25
|
+
verified: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Working directory of a live process; null when the platform or permissions do not tell. */
|
|
28
|
+
export declare function processCwd(pid: number): Promise<string | null>;
|
|
29
|
+
/** Who a reply in this conversation will wake, with the precedence of wake-drain-claude.mjs liveOwner:
|
|
30
|
+
* canonical conversation binding, legacy raw-id binding, then the peer's binding. */
|
|
31
|
+
export declare function conversationOwner(context: ServiceContext, replyId: string, peer: string | null, readers: Reader[]): Promise<Owner>;
|
|
32
|
+
/** Serializes a read-modify-write of profile state with every other setup writer (`.setup-write.lock`).
|
|
33
|
+
* Read marks are frequent, so a busy lock is retried briefly instead of failing at once. */
|
|
34
|
+
export declare function withSetupLock<T>(context: ServiceContext, work: () => Promise<T>, waitMs?: number): Promise<T>;
|
|
35
|
+
/** Conversations with their newest message, attention counters, owner and newest inbound letter. Read-only. */
|
|
36
|
+
export declare function listConversations(context: ServiceContext, limit?: number, home?: string): Promise<{
|
|
37
|
+
schema: string;
|
|
38
|
+
agentId: string;
|
|
39
|
+
conversations: {
|
|
40
|
+
id: any;
|
|
41
|
+
replyConversationId: string;
|
|
42
|
+
peer: string | null;
|
|
43
|
+
lastAt: any;
|
|
44
|
+
count: number;
|
|
45
|
+
lastMessage: {
|
|
46
|
+
direction: any;
|
|
47
|
+
sender: any;
|
|
48
|
+
preview: string;
|
|
49
|
+
createdAt: any;
|
|
50
|
+
origin: string;
|
|
51
|
+
};
|
|
52
|
+
newestInbound: {
|
|
53
|
+
msgId: any;
|
|
54
|
+
text: string;
|
|
55
|
+
createdAt: any;
|
|
56
|
+
answeredFromDesktop: boolean;
|
|
57
|
+
} | null;
|
|
58
|
+
attention: {
|
|
59
|
+
deadLetter: number;
|
|
60
|
+
pendingDelivery: number;
|
|
61
|
+
};
|
|
62
|
+
waiting: string | null;
|
|
63
|
+
unread: number;
|
|
64
|
+
owner: Owner;
|
|
65
|
+
}[];
|
|
66
|
+
}>;
|
|
67
|
+
/** One conversation's history with delivery and wake state per message. Read-only and byte-bounded:
|
|
68
|
+
* texts above 1500 characters are cut (`truncated: true`), and older messages are dropped once the
|
|
69
|
+
* response would pass ~160 KB (`hasMore: true`), well under the app's 256 KiB read cap. */
|
|
70
|
+
export declare function showConversation(context: ServiceContext, id: string, limit?: number, home?: string): Promise<{
|
|
71
|
+
schema: string;
|
|
72
|
+
agentId: string;
|
|
73
|
+
id: string;
|
|
74
|
+
wireIds: string[];
|
|
75
|
+
peer: string | null;
|
|
76
|
+
replyConversationId: string;
|
|
77
|
+
hasMore: boolean;
|
|
78
|
+
owner: Owner;
|
|
79
|
+
messages: {
|
|
80
|
+
msgId: any;
|
|
81
|
+
direction: any;
|
|
82
|
+
sender: any;
|
|
83
|
+
origin: string;
|
|
84
|
+
author: {
|
|
85
|
+
kind: string;
|
|
86
|
+
app: string | null;
|
|
87
|
+
} | null;
|
|
88
|
+
autoReply: boolean;
|
|
89
|
+
text: string;
|
|
90
|
+
truncated: boolean;
|
|
91
|
+
createdAt: any;
|
|
92
|
+
delivery: {
|
|
93
|
+
state: string;
|
|
94
|
+
attempts: null;
|
|
95
|
+
reason: null;
|
|
96
|
+
reasonCode: null;
|
|
97
|
+
updatedAt: null;
|
|
98
|
+
} | {
|
|
99
|
+
state: string;
|
|
100
|
+
attempts: number;
|
|
101
|
+
reason: string | null;
|
|
102
|
+
reasonCode: string | null;
|
|
103
|
+
updatedAt: any;
|
|
104
|
+
} | null;
|
|
105
|
+
wake: {
|
|
106
|
+
status: any;
|
|
107
|
+
updatedAt: any;
|
|
108
|
+
} | null;
|
|
109
|
+
}[];
|
|
110
|
+
}>;
|
|
111
|
+
/** Where letters land right now: who a NEW conversation from each peer wakes, and which drains listen. Read-only. */
|
|
112
|
+
export declare function showRouting(context: ServiceContext, home?: string): Promise<{
|
|
113
|
+
schema: string;
|
|
114
|
+
agentId: string;
|
|
115
|
+
newFromPeer: {
|
|
116
|
+
peer: string;
|
|
117
|
+
lastSeenAt: string;
|
|
118
|
+
owner: Owner;
|
|
119
|
+
}[];
|
|
120
|
+
readers: Reader[];
|
|
121
|
+
storage: {
|
|
122
|
+
jetstream: boolean;
|
|
123
|
+
};
|
|
124
|
+
measuredAt: string;
|
|
125
|
+
}>;
|
|
126
|
+
/** Live Claude drains for this store, verified like wake-readers.ts, with lane and working folder. */
|
|
127
|
+
export declare function listReaders(context: ServiceContext, home?: string): Promise<Reader[]>;
|
|
128
|
+
/** The person read a conversation through one of its letters: a per-conversation mark in read-state.json.
|
|
129
|
+
* The profile-wide cursor of `inbox mark-read` is kept as it is. */
|
|
130
|
+
export declare function markConversationRead(context: ServiceContext, id: string, throughMsgId: string, expectedAgent: string): Promise<{
|
|
131
|
+
schema: string;
|
|
132
|
+
agentId: string;
|
|
133
|
+
id: string;
|
|
134
|
+
rowid: number;
|
|
135
|
+
}>;
|
|
136
|
+
/** The newest letters from peers across all conversations, each with the conversation it landed in and who
|
|
137
|
+
* reads it there. Hand-off notes and machine traffic are left out. Read-only. */
|
|
138
|
+
export declare function inboxFeed(context: ServiceContext, limit?: number, home?: string): Promise<{
|
|
139
|
+
schema: string;
|
|
140
|
+
agentId: string;
|
|
141
|
+
letters: {
|
|
142
|
+
msgId: any;
|
|
143
|
+
conversationId: string;
|
|
144
|
+
replyConversationId: any;
|
|
145
|
+
peer: any;
|
|
146
|
+
preview: string;
|
|
147
|
+
createdAt: any;
|
|
148
|
+
unread: boolean;
|
|
149
|
+
owner: Owner | undefined;
|
|
150
|
+
}[];
|
|
151
|
+
}>;
|
|
152
|
+
/** Sessions that can take a conversation now: live, listening Claude Code sessions with their folder, and
|
|
153
|
+
* open Codex tasks that already took part in a Murmur conversation. Read-only. */
|
|
154
|
+
export declare function listSessions(context: ServiceContext, home?: string): Promise<{
|
|
155
|
+
schema: string;
|
|
156
|
+
agentId: string;
|
|
157
|
+
claude: {
|
|
158
|
+
kind: string;
|
|
159
|
+
sessionKey: string;
|
|
160
|
+
cwd: string | null;
|
|
161
|
+
sessionPid: number | null;
|
|
162
|
+
}[];
|
|
163
|
+
codex: Record<string, unknown>[];
|
|
164
|
+
claudeFolders: {
|
|
165
|
+
path: string;
|
|
166
|
+
wake: boolean;
|
|
167
|
+
mcp: boolean;
|
|
168
|
+
}[];
|
|
169
|
+
}>;
|
|
170
|
+
/** Direct message from the person through the desktop app: the envelope, signing and outbox path of
|
|
171
|
+
* MCP murmur_send, DM only. It writes no Claude/Codex binding: the app is not a session, and replies
|
|
172
|
+
* must keep waking the session that owns the conversation.
|
|
173
|
+
*
|
|
174
|
+
* Every guard and both writes run in one `BEGIN IMMEDIATE` transaction, so two clients cannot both pass
|
|
175
|
+
* the already-answered or msg-id checks, and history and outbox commit together or not at all. */
|
|
176
|
+
export declare function sendDirect(context: ServiceContext, options: {
|
|
177
|
+
to: string;
|
|
178
|
+
conversationId: string;
|
|
179
|
+
msgId: string;
|
|
180
|
+
text?: string;
|
|
181
|
+
expectedAgent: string;
|
|
182
|
+
expectAfter?: string;
|
|
183
|
+
/** Send the full stored text of an earlier outbound letter of this conversation again, as a new letter.
|
|
184
|
+
* The app only sees letters cut at 1500 characters, so it passes the id and the engine supplies the text. */
|
|
185
|
+
resendOf?: string;
|
|
186
|
+
}): Promise<{
|
|
187
|
+
schema: string;
|
|
188
|
+
agentId: string;
|
|
189
|
+
msgId: string;
|
|
190
|
+
to: string;
|
|
191
|
+
conversationId: string;
|
|
192
|
+
state: string;
|
|
193
|
+
}>;
|