khala-cli 0.4.13 → 0.4.15
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/{chunk-QZUBLJW7.mjs → chunk-26TDBFRB.mjs} +2 -2
- package/dist/{chunk-3JA3Q5MK.mjs → chunk-3IHM2SW7.mjs} +1 -1
- package/dist/{chunk-XR3JSUPF.mjs → chunk-4OFZP46T.mjs} +24 -14
- package/dist/{chunk-SKJ6YV3G.mjs → chunk-4PZFWER6.mjs} +14 -13
- package/dist/{chunk-JLENHMKE.mjs → chunk-5B2GYFBD.mjs} +139 -46
- package/dist/{chunk-2AIADANH.mjs → chunk-5W73XTCG.mjs} +6 -6
- package/dist/{chunk-ICTAFDO6.mjs → chunk-5WXVNFMV.mjs} +3 -3
- package/dist/{chunk-SUUEWCY5.mjs → chunk-5XZKEFRD.mjs} +1 -1
- package/dist/{chunk-72W7IC2O.mjs → chunk-657MHRGF.mjs} +26 -5
- package/dist/{chunk-SUT7AKNZ.mjs → chunk-BCEKWOVJ.mjs} +6 -6
- package/dist/{chunk-P3XZEYZF.mjs → chunk-BI2TKRL3.mjs} +1 -1
- package/dist/{chunk-XI5FPUNN.mjs → chunk-C7PNUX5Y.mjs} +2 -2
- package/dist/{chunk-O4QJ3ZT6.mjs → chunk-CXIAXZAE.mjs} +3 -3
- package/dist/{chunk-QPYXV4BQ.mjs → chunk-EBDML25F.mjs} +10 -10
- package/dist/{chunk-SDBMJPIA.mjs → chunk-EEPFMGHU.mjs} +6 -6
- package/dist/{chunk-BJVJ5WJS.mjs → chunk-FQPHAPKV.mjs} +32 -29
- package/dist/{chunk-6P4PKPJW.mjs → chunk-IECJZUSO.mjs} +5 -5
- package/dist/{chunk-RUQDE5DI.mjs → chunk-LS5EHLCO.mjs} +1 -1
- package/dist/chunk-LYLDUHUX.mjs +47 -0
- package/dist/{chunk-KMDLTHDW.mjs → chunk-M2CLLH63.mjs} +2 -2
- package/dist/{chunk-MRSZOWFU.mjs → chunk-MEI5RBK5.mjs} +1 -1
- package/dist/{chunk-32SGUUP5.mjs → chunk-MHHNDW4A.mjs} +2 -2
- package/dist/{chunk-3GUVMXTM.mjs → chunk-Q7MJTMRR.mjs} +23 -17
- package/dist/chunk-QT5ZMQHY.mjs +27 -0
- package/dist/{chunk-ZWWTVM6R.mjs → chunk-RYJJVZMQ.mjs} +2 -2
- package/dist/chunk-SBJ33DW7.mjs +165 -0
- package/dist/{chunk-6DE4V756.mjs → chunk-UJQI2AKH.mjs} +32 -12
- package/dist/{chunk-NHW62KEB.mjs → chunk-WE3JID2S.mjs} +1 -1
- package/dist/chunk-WF6GBYGH.mjs +20 -0
- package/dist/{chunk-OIYAR2ND.mjs → chunk-WLUNHB2O.mjs} +7 -7
- package/dist/chunk-XS66DEGZ.mjs +19 -0
- package/dist/{chunk-ONAZVGVO.mjs → chunk-XZN4X37N.mjs} +50 -9
- package/dist/{chunk-BWVC3EKG.mjs → chunk-YG6KJFZW.mjs} +13 -13
- package/dist/{chunk-XRV5GUSI.mjs → chunk-ZUGJJGF4.mjs} +3 -3
- package/dist/khala.mjs +11 -11
- package/dist/web/assets/local-Bnba1v1f.js +13 -0
- package/dist/web/assets/local-CVtKWAts.css +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/chunk-2BNIPJVW.mjs +0 -27
- package/dist/chunk-I4POSYHZ.mjs +0 -132
- package/dist/chunk-JZZNVQKH.mjs +0 -14
- package/dist/chunk-TVQ5NHFX.mjs +0 -20
- package/dist/chunk-WZD4JAG6.mjs +0 -19
- package/dist/web/assets/local-DLmpMMaF.css +0 -1
- package/dist/web/assets/local-mElTRGcH.js +0 -11
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
listChannels
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-657MHRGF.mjs";
|
|
5
5
|
import {
|
|
6
6
|
TERMINAL_SESSION_DETAILS,
|
|
7
7
|
cachedProcessReader,
|
|
8
8
|
readStateFile,
|
|
9
9
|
readStatus,
|
|
10
10
|
validAgentRejoinSecret
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WE3JID2S.mjs";
|
|
12
12
|
import {
|
|
13
13
|
init_define_KHALA_BUNDLE
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-3IHM2SW7.mjs";
|
|
15
15
|
|
|
16
16
|
// src/session-start-wake.ts
|
|
17
17
|
init_define_KHALA_BUNDLE();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
init_define_KHALA_BUNDLE
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3IHM2SW7.mjs";
|
|
5
5
|
|
|
6
6
|
// src/wake/shared/nonce.ts
|
|
7
7
|
init_define_KHALA_BUNDLE();
|
|
@@ -2,7 +2,7 @@ import { createRequire as __khalaCreateRequire } from 'node:module'; const requi
|
|
|
2
2
|
import {
|
|
3
3
|
decodeChannelEvent,
|
|
4
4
|
formatChannelEventLine
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-C7PNUX5Y.mjs";
|
|
6
6
|
import {
|
|
7
7
|
StateError,
|
|
8
8
|
channelFiles,
|
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
stateKey,
|
|
15
15
|
writeJsonAtomic,
|
|
16
16
|
writeStateFile
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-WE3JID2S.mjs";
|
|
18
18
|
import {
|
|
19
19
|
init_define_KHALA_BUNDLE
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-3IHM2SW7.mjs";
|
|
21
21
|
|
|
22
22
|
// src/events/receive.ts
|
|
23
23
|
init_define_KHALA_BUNDLE();
|
|
@@ -58,7 +58,9 @@ function mentions(entry, name) {
|
|
|
58
58
|
return new RegExp(`(?<![\\p{L}\\p{N}_])@?${escaped}(?![\\p{L}\\p{N}_])`, "iu").test(entry.body);
|
|
59
59
|
}
|
|
60
60
|
function wakesAgent(entry, mode, you) {
|
|
61
|
-
|
|
61
|
+
if (mode === "mute" || !isWakeEntry(entry)) return false;
|
|
62
|
+
const pinged = entry.mention === true || mentions(entry, you);
|
|
63
|
+
return mode === "async" ? pinged : mode !== "sync" || entry.senderKind !== "agent" || pinged;
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
// src/inbox.ts
|
|
@@ -107,6 +109,17 @@ async function unread(files) {
|
|
|
107
109
|
const entries = await readEntries(files);
|
|
108
110
|
return { entries: entries.slice(cursor.deliveredCount), cursor };
|
|
109
111
|
}
|
|
112
|
+
function wakeStart(cursor) {
|
|
113
|
+
return Math.max(cursor.deliveredCount, Number.isSafeInteger(cursor.nudgedCount) ? cursor.nudgedCount : 0);
|
|
114
|
+
}
|
|
115
|
+
async function unwoken(files) {
|
|
116
|
+
return (await readEntries(files)).slice(wakeStart(await readCursor(files)));
|
|
117
|
+
}
|
|
118
|
+
async function markNudged(files, expected, count) {
|
|
119
|
+
const current = await readCursor(files);
|
|
120
|
+
if (current.deliveredCount !== expected.deliveredCount || current.lastDeliveredEventId !== expected.lastDeliveredEventId) return;
|
|
121
|
+
await writeJsonAtomic(files.cursor, { ...current, nudgedCount: count });
|
|
122
|
+
}
|
|
110
123
|
async function unreadCounts(files) {
|
|
111
124
|
const { entries } = await unread(files);
|
|
112
125
|
return { total: entries.length, messages: entries.filter((entry) => isWakeEntry(entry)).length };
|
|
@@ -120,7 +133,12 @@ async function advanceCursor(files, expected, delivered, shown = false) {
|
|
|
120
133
|
if (slice.length !== delivered.length || slice.some((entry, index) => entry.eventId !== delivered[index]?.eventId)) return "conflict";
|
|
121
134
|
const last = delivered[delivered.length - 1].eventId;
|
|
122
135
|
const shownEventId = shown ? last : current.shownEventId;
|
|
123
|
-
const next = {
|
|
136
|
+
const next = {
|
|
137
|
+
lastDeliveredEventId: last,
|
|
138
|
+
deliveredCount: expected.deliveredCount + delivered.length,
|
|
139
|
+
...shownEventId ? { shownEventId } : {},
|
|
140
|
+
...wakeStart(current) > expected.deliveredCount + delivered.length ? { nudgedCount: current.nudgedCount } : {}
|
|
141
|
+
};
|
|
124
142
|
await writeJsonAtomic(files.cursor, next);
|
|
125
143
|
return next;
|
|
126
144
|
}
|
|
@@ -287,6 +305,9 @@ export {
|
|
|
287
305
|
readEntries,
|
|
288
306
|
readCursor,
|
|
289
307
|
unread,
|
|
308
|
+
wakeStart,
|
|
309
|
+
unwoken,
|
|
310
|
+
markNudged,
|
|
290
311
|
advanceCursor,
|
|
291
312
|
appendInbox,
|
|
292
313
|
unreadCount,
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
sessionStartWakeChannels
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-5WXVNFMV.mjs";
|
|
5
5
|
import {
|
|
6
6
|
capturePane
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RYJJVZMQ.mjs";
|
|
8
8
|
import {
|
|
9
9
|
listChannels,
|
|
10
10
|
writeActivity
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-657MHRGF.mjs";
|
|
12
|
+
import "./chunk-C7PNUX5Y.mjs";
|
|
13
13
|
import {
|
|
14
14
|
TERMINAL_SESSION_DETAILS,
|
|
15
15
|
openSessionDir,
|
|
16
16
|
readJson
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-WE3JID2S.mjs";
|
|
18
18
|
import {
|
|
19
19
|
init_define_KHALA_BUNDLE
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-3IHM2SW7.mjs";
|
|
21
21
|
|
|
22
22
|
// hooks/session-start.ts
|
|
23
23
|
init_define_KHALA_BUNDLE();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
init_define_KHALA_BUNDLE
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3IHM2SW7.mjs";
|
|
5
5
|
|
|
6
6
|
// src/events/member-rename.ts
|
|
7
7
|
init_define_KHALA_BUNDLE();
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
utcTimestamp,
|
|
11
11
|
utf8Length,
|
|
12
12
|
version
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WE3JID2S.mjs";
|
|
14
14
|
import {
|
|
15
15
|
init_define_KHALA_BUNDLE
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-3IHM2SW7.mjs";
|
|
17
17
|
|
|
18
18
|
// ../contracts/src/m1/channel-event.ts
|
|
19
19
|
init_define_KHALA_BUNDLE();
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
checkName,
|
|
5
5
|
isDefaultAgentName,
|
|
6
6
|
restartHelper
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-IECJZUSO.mjs";
|
|
8
8
|
import {
|
|
9
9
|
StateError,
|
|
10
10
|
harnessInfo,
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
stateRoot,
|
|
14
14
|
validateAgentName,
|
|
15
15
|
writeJsonAtomic
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WE3JID2S.mjs";
|
|
17
17
|
import {
|
|
18
18
|
init_define_KHALA_BUNDLE
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-3IHM2SW7.mjs";
|
|
20
20
|
|
|
21
21
|
// src/local/identity.ts
|
|
22
22
|
init_define_KHALA_BUNDLE();
|
|
@@ -14,21 +14,21 @@ import {
|
|
|
14
14
|
decodeLocalSendResult,
|
|
15
15
|
ensureHelper,
|
|
16
16
|
localRoomPath
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-IECJZUSO.mjs";
|
|
18
|
+
import "./chunk-BI2TKRL3.mjs";
|
|
19
|
+
import "./chunk-MHHNDW4A.mjs";
|
|
20
|
+
import "./chunk-LS5EHLCO.mjs";
|
|
21
21
|
import {
|
|
22
22
|
LISTENING_MODE_COMMAND_TYPE
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-LYLDUHUX.mjs";
|
|
24
24
|
import {
|
|
25
25
|
CHANNEL_EVENT_TYPE,
|
|
26
26
|
memberRenameContent
|
|
27
|
-
} from "./chunk-
|
|
28
|
-
import "./chunk-
|
|
27
|
+
} from "./chunk-C7PNUX5Y.mjs";
|
|
28
|
+
import "./chunk-WE3JID2S.mjs";
|
|
29
29
|
import {
|
|
30
30
|
init_define_KHALA_BUNDLE
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-3IHM2SW7.mjs";
|
|
32
32
|
|
|
33
33
|
// src/local/session.ts
|
|
34
34
|
init_define_KHALA_BUNDLE();
|
|
@@ -229,7 +229,7 @@ async function createLocalSession(creds, opts = {}) {
|
|
|
229
229
|
try {
|
|
230
230
|
const page = decoded(await request(
|
|
231
231
|
"GET",
|
|
232
|
-
`events?after=${after}&wait=${LOCAL_LONG_POLL_MAX_S}&prev=1&wire=2`,
|
|
232
|
+
`events?after=${after}&wait=${LOCAL_LONG_POLL_MAX_S}&prev=1&wire=2&mute=1`,
|
|
233
233
|
void 0,
|
|
234
234
|
controller.signal,
|
|
235
235
|
(LOCAL_LONG_POLL_MAX_S + 10) * 1e3
|
|
@@ -326,7 +326,7 @@ async function createLocalSession(creds, opts = {}) {
|
|
|
326
326
|
after = result.seq;
|
|
327
327
|
joinedAt = result.ts;
|
|
328
328
|
await me();
|
|
329
|
-
const members = decoded(await withHelper(() => request("GET", "members?wire=2")), decodeLocalMembersResponse);
|
|
329
|
+
const members = decoded(await withHelper(() => request("GET", "members?wire=2&mute=1")), decodeLocalMembersResponse);
|
|
330
330
|
check(roomId);
|
|
331
331
|
for (const member of members.members) {
|
|
332
332
|
names.set(member.userId, member.displayName);
|
|
@@ -3,27 +3,27 @@ import {
|
|
|
3
3
|
WAKE_HARNESSES,
|
|
4
4
|
wakeDrivers,
|
|
5
5
|
wakeStatus
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5W73XTCG.mjs";
|
|
7
7
|
import {
|
|
8
8
|
adapterFor,
|
|
9
9
|
registerAntigravityWake,
|
|
10
10
|
resolveSources
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-FQPHAPKV.mjs";
|
|
12
12
|
import {
|
|
13
13
|
CURSOR_DEFAULT_SESSION,
|
|
14
14
|
updateWakeSettings
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-4OFZP46T.mjs";
|
|
16
16
|
import {
|
|
17
17
|
SESSION_ID_PATTERN,
|
|
18
18
|
filesForDir,
|
|
19
19
|
stateRoot
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-WE3JID2S.mjs";
|
|
21
21
|
import {
|
|
22
22
|
resetWakeDriver
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-5XZKEFRD.mjs";
|
|
24
24
|
import {
|
|
25
25
|
init_define_KHALA_BUNDLE
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-3IHM2SW7.mjs";
|
|
27
27
|
|
|
28
28
|
// src/wake/cli.ts
|
|
29
29
|
init_define_KHALA_BUNDLE();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
readPane
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RYJJVZMQ.mjs";
|
|
5
5
|
import {
|
|
6
6
|
CURSOR_DEFAULT_SESSION,
|
|
7
7
|
CURSOR_WORKSPACE_ENV,
|
|
@@ -18,14 +18,15 @@ import {
|
|
|
18
18
|
readListeningMode,
|
|
19
19
|
readWakeSettings,
|
|
20
20
|
verifyQwenTranscript
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-4OFZP46T.mjs";
|
|
22
22
|
import {
|
|
23
23
|
listChannels,
|
|
24
24
|
readActivity,
|
|
25
25
|
readCursor,
|
|
26
|
-
|
|
26
|
+
unwoken,
|
|
27
|
+
wakeStart,
|
|
27
28
|
wakesAgent
|
|
28
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-657MHRGF.mjs";
|
|
29
30
|
import {
|
|
30
31
|
HARNESS_REGISTRY,
|
|
31
32
|
SESSION_ID_PATTERN,
|
|
@@ -40,7 +41,7 @@ import {
|
|
|
40
41
|
stateRoot,
|
|
41
42
|
walkAncestors,
|
|
42
43
|
writeJsonAtomic
|
|
43
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-WE3JID2S.mjs";
|
|
44
45
|
import {
|
|
45
46
|
CODEX_IDLE_WAKE_NOTICE,
|
|
46
47
|
cancelAttempt,
|
|
@@ -52,10 +53,10 @@ import {
|
|
|
52
53
|
settleAttempts,
|
|
53
54
|
wakeLine,
|
|
54
55
|
withWakeLock
|
|
55
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-5XZKEFRD.mjs";
|
|
56
57
|
import {
|
|
57
58
|
init_define_KHALA_BUNDLE
|
|
58
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-3IHM2SW7.mjs";
|
|
59
60
|
|
|
60
61
|
// src/harness/index.ts
|
|
61
62
|
init_define_KHALA_BUNDLE();
|
|
@@ -630,11 +631,12 @@ function createWakeLadder(deps) {
|
|
|
630
631
|
const metadata = channel.legacy ? null : await readJson(path3.join(channel.files.dir, "channel.json"));
|
|
631
632
|
currentIdentities.set(channel.key, JSON.stringify([session?.roomId ?? channel.roomId, session?.userId, metadata?.joinedAt]));
|
|
632
633
|
const mode = await readListeningMode(channel.files);
|
|
633
|
-
if (mode === "
|
|
634
|
+
if (mode === "mute") continue;
|
|
634
635
|
const you = (await readJson(channel.files.status))?.displayName;
|
|
635
636
|
eligible.push({
|
|
636
637
|
channel,
|
|
637
|
-
|
|
638
|
+
mode,
|
|
639
|
+
counts: { messages: (await unwoken(channel.files)).filter((entry) => entry.sender !== session?.userId && wakesAgent(entry, mode, you)).length },
|
|
638
640
|
cursor: await readCursor(channel.files)
|
|
639
641
|
});
|
|
640
642
|
}
|
|
@@ -657,7 +659,7 @@ function createWakeLadder(deps) {
|
|
|
657
659
|
}
|
|
658
660
|
for (const key of changed) identities.delete(key);
|
|
659
661
|
for (const [key, identity] of currentIdentities) identities.set(key, identity);
|
|
660
|
-
const pairs = eligible.map(({ channel, cursor: cursor2 }) => [channel.key, cursor2
|
|
662
|
+
const pairs = eligible.map(({ channel, cursor: cursor2 }) => [channel.key, wakeStart(cursor2)]).sort(([a], [b]) => a.localeCompare(b));
|
|
661
663
|
const budgetKey = JSON.stringify(pairs);
|
|
662
664
|
if (changed.size) {
|
|
663
665
|
const inheritedKey = JSON.stringify(pairs.filter(([key]) => !changed.has(key)));
|
|
@@ -676,8 +678,8 @@ function createWakeLadder(deps) {
|
|
|
676
678
|
if (stopped || activity.state !== "idle") return;
|
|
677
679
|
const wakes = wakesAtCount.get(budgetKey) ?? 0;
|
|
678
680
|
if (wakes >= 2) return;
|
|
679
|
-
for (const { channel } of eligible) {
|
|
680
|
-
if (await readListeningMode(channel.files)
|
|
681
|
+
for (const { channel, mode } of eligible) {
|
|
682
|
+
if (await readListeningMode(channel.files) !== mode) {
|
|
681
683
|
pending = void 0;
|
|
682
684
|
return;
|
|
683
685
|
}
|
|
@@ -690,8 +692,8 @@ function createWakeLadder(deps) {
|
|
|
690
692
|
if (stopped) return false;
|
|
691
693
|
if (!await driverAllowed(stateRoot(ctx.env), ctx.harness, driver.id, driver.optIn)) return false;
|
|
692
694
|
if ((await readWakeState(deps.files.dir))[driver.id]?.disabled) return false;
|
|
693
|
-
for (const { channel } of eligible) {
|
|
694
|
-
if (await readListeningMode(channel.files)
|
|
695
|
+
for (const { channel, mode } of eligible) {
|
|
696
|
+
if (await readListeningMode(channel.files) !== mode) return false;
|
|
695
697
|
}
|
|
696
698
|
const current = await readActivity(deps.files);
|
|
697
699
|
return !stopped && current.state === "idle" && current.updatedAt === activity.updatedAt;
|
|
@@ -799,7 +801,7 @@ var codexWakeDriver = createCodexWakeDriver();
|
|
|
799
801
|
|
|
800
802
|
// src/harness/codex.ts
|
|
801
803
|
var emptyPrompt2 = { pattern: /^› ?(Ask Codex to do anything)?$/u, cursorColumn: 2 };
|
|
802
|
-
var install = async (flags, deps) => (await import("./chunk-
|
|
804
|
+
var install = async (flags, deps) => (await import("./chunk-YG6KJFZW.mjs")).runCodexInstall(flags, deps);
|
|
803
805
|
var codex = {
|
|
804
806
|
id: "codex",
|
|
805
807
|
// A string metadata id wins even when empty or invalid; validation happens after selection.
|
|
@@ -881,7 +883,7 @@ async function resolveSources(sources, meta, env, context) {
|
|
|
881
883
|
}
|
|
882
884
|
|
|
883
885
|
// src/harness/muse.ts
|
|
884
|
-
var install2 = async (flags, deps) => (await import("./chunk-
|
|
886
|
+
var install2 = async (flags, deps) => (await import("./chunk-YG6KJFZW.mjs")).runMuseInstall(flags, deps);
|
|
885
887
|
var muse = {
|
|
886
888
|
id: "muse",
|
|
887
889
|
sessionSources: [{ kind: "env", resolve: (_meta, env) => env.MUSE_SESSION_ID, rejoinable: () => true }, hookMapSource],
|
|
@@ -944,7 +946,7 @@ var copilotCodec = createCopilotCodec();
|
|
|
944
946
|
|
|
945
947
|
// src/harness/copilot.ts
|
|
946
948
|
var emptyPrompt3 = { pattern: /^❯ ?$/u, cursorColumn: 2 };
|
|
947
|
-
var install3 = async (flags, deps) => (await import("./chunk-
|
|
949
|
+
var install3 = async (flags, deps) => (await import("./chunk-YG6KJFZW.mjs")).runCopilotInstall(flags, deps);
|
|
948
950
|
var copilot = {
|
|
949
951
|
id: "copilot",
|
|
950
952
|
sessionSources: [{ kind: "env", resolve: (_meta, env) => env.COPILOT_AGENT_SESSION_ID, rejoinable: () => true }, hookMapSource],
|
|
@@ -992,7 +994,7 @@ var cursorCodec = {
|
|
|
992
994
|
};
|
|
993
995
|
|
|
994
996
|
// src/harness/cursor.ts
|
|
995
|
-
var install4 = async (flags, deps) => (await import("./chunk-
|
|
997
|
+
var install4 = async (flags, deps) => (await import("./chunk-YG6KJFZW.mjs")).runCursorInstall(flags, deps);
|
|
996
998
|
var cursor = {
|
|
997
999
|
id: "cursor",
|
|
998
1000
|
sessionSources: [{
|
|
@@ -1030,7 +1032,7 @@ function createQwenBackgroundDriver(platform = process.platform) {
|
|
|
1030
1032
|
verification: "none",
|
|
1031
1033
|
async available(ctx) {
|
|
1032
1034
|
const settings = await readWakeSettings(stateRoot(ctx.env));
|
|
1033
|
-
return platform === "win32" && !settings.off["qwen/socket"] && !settings.off["qwen/background-shell"] && await qwenInboundAllowed(ctx.env) && await (await import("./chunk-
|
|
1035
|
+
return platform === "win32" && !settings.off["qwen/socket"] && !settings.off["qwen/background-shell"] && await qwenInboundAllowed(ctx.env) && await (await import("./chunk-WLUNHB2O.mjs")).monitorArmed(ctx.files);
|
|
1034
1036
|
},
|
|
1035
1037
|
async unavailableReason(ctx) {
|
|
1036
1038
|
if (!await qwenInboundAllowed(ctx.env)) return "qwen_held";
|
|
@@ -1045,8 +1047,8 @@ var qwen = {
|
|
|
1045
1047
|
codec: qwenCodec,
|
|
1046
1048
|
restoreAtStartup: true,
|
|
1047
1049
|
sessionSources: [{ kind: "meta", resolve: (meta) => meta?.khala_session, rejoinable: () => true }, { kind: "env", resolve: (_meta, env) => qwenSession(env), rejoinable: () => true }, hookMapSource],
|
|
1048
|
-
install: async (flags, deps) => (await import("./chunk-
|
|
1049
|
-
uninstall: async (flags, deps) => (await import("./chunk-
|
|
1050
|
+
install: async (flags, deps) => (await import("./chunk-YG6KJFZW.mjs")).runQwenInstall(flags, deps),
|
|
1051
|
+
uninstall: async (flags, deps) => (await import("./chunk-YG6KJFZW.mjs")).runQwenInstall([...flags, "--uninstall"], deps),
|
|
1050
1052
|
wakeLadder: [createQwenSocketDriver(), createQwenBackgroundDriver()],
|
|
1051
1053
|
async verifyWake(stdin, files, now) {
|
|
1052
1054
|
const input = JSON.parse(stdin);
|
|
@@ -1090,7 +1092,7 @@ var geminiCodec = {
|
|
|
1090
1092
|
|
|
1091
1093
|
// src/harness/gemini.ts
|
|
1092
1094
|
var emptyPrompt4 = { pattern: /^ >(?: {3}Type your message or @path\/to\/file)?$/u, cursorColumn: 3 };
|
|
1093
|
-
var install5 = async (flags, deps) => (await import("./chunk-
|
|
1095
|
+
var install5 = async (flags, deps) => (await import("./chunk-YG6KJFZW.mjs")).runGeminiInstall(flags, deps);
|
|
1094
1096
|
var gemini = {
|
|
1095
1097
|
id: "gemini",
|
|
1096
1098
|
sessionSources: [{ kind: "env", resolve: (_meta, env) => env.GEMINI_SESSION_ID, rejoinable: () => true }, hookMapSource],
|
|
@@ -1268,7 +1270,7 @@ async function antigravityPromptText(input) {
|
|
|
1268
1270
|
|
|
1269
1271
|
// src/harness/antigravity.ts
|
|
1270
1272
|
var emptyPrompt5 = { pattern: /^>$/u, cursorColumn: 2 };
|
|
1271
|
-
var install6 = async (flags, deps) => (await import("./chunk-
|
|
1273
|
+
var install6 = async (flags, deps) => (await import("./chunk-YG6KJFZW.mjs")).runAntigravityInstall(flags, deps);
|
|
1272
1274
|
var antigravity = {
|
|
1273
1275
|
id: "antigravity",
|
|
1274
1276
|
restoreAtStartup: true,
|
|
@@ -1338,7 +1340,7 @@ init_define_KHALA_BUNDLE();
|
|
|
1338
1340
|
import path7 from "node:path";
|
|
1339
1341
|
var file2 = "opencode-wake.json";
|
|
1340
1342
|
async function budget(files) {
|
|
1341
|
-
const pairs = await Promise.all((await listChannels(files)).map(async (channel) => [channel.key, (await readCursor(channel.files))
|
|
1343
|
+
const pairs = await Promise.all((await listChannels(files)).map(async (channel) => [channel.key, wakeStart(await readCursor(channel.files))]));
|
|
1342
1344
|
return JSON.stringify(pairs.sort(([a], [b]) => a.localeCompare(b)));
|
|
1343
1345
|
}
|
|
1344
1346
|
var canAttempt = (prior, key, now) => !prior || prior.budget !== key || now - prior.at >= 6e4 && prior.attempts < 2;
|
|
@@ -1361,7 +1363,7 @@ var opencodeWakeDriver = {
|
|
|
1361
1363
|
if (!canAttempt(prior, key, ctx.now)) return "skipped";
|
|
1362
1364
|
const channels = [];
|
|
1363
1365
|
for (const channel of await listChannels(ctx.files)) {
|
|
1364
|
-
if (await readListeningMode(channel.files) !== "
|
|
1366
|
+
if (await readListeningMode(channel.files) !== "mute") channels.push(channel.key);
|
|
1365
1367
|
}
|
|
1366
1368
|
await writeJsonAtomic(path7.join(ctx.files.dir, file2), {
|
|
1367
1369
|
line,
|
|
@@ -1382,7 +1384,7 @@ async function pollOpenCodeWake(files, io, replay = false) {
|
|
|
1382
1384
|
if (!pending || activity.state !== "idle" || !await driverAllowed(stateRoot(io.env), "opencode", opencodeWakeDriver.id, false) || (await readWakeState(files.dir))[opencodeWakeDriver.id]?.disabled) return;
|
|
1383
1385
|
const channels = (await listChannels(files)).filter((channel) => !pending.channels || pending.channels.includes(channel.key));
|
|
1384
1386
|
if (!channels.length) return;
|
|
1385
|
-
for (const channel of channels) if (await readListeningMode(channel.files) === "
|
|
1387
|
+
for (const channel of channels) if (await readListeningMode(channel.files) === "mute") return;
|
|
1386
1388
|
const nonce = newNonce(), at = io.now().getTime();
|
|
1387
1389
|
await recordAttempt(files.dir, {
|
|
1388
1390
|
nonce,
|
|
@@ -1415,10 +1417,10 @@ async function pollOpenCodeWake(files, io, replay = false) {
|
|
|
1415
1417
|
let eligible = false;
|
|
1416
1418
|
for (const channel of await listChannels(files)) {
|
|
1417
1419
|
const mode = await readListeningMode(channel.files);
|
|
1418
|
-
if (mode === "
|
|
1420
|
+
if (mode === "mute") continue;
|
|
1419
1421
|
const session = await readJson(channel.files.session);
|
|
1420
1422
|
const you = (await readJson(channel.files.status))?.displayName;
|
|
1421
|
-
if ((await
|
|
1423
|
+
if ((await unwoken(channel.files)).some((entry) => entry.sender !== session?.userId && wakesAgent(entry, mode, you))) eligible = true;
|
|
1422
1424
|
}
|
|
1423
1425
|
if (!eligible) return;
|
|
1424
1426
|
await writeJsonAtomic(path7.join(files.dir, file2), { ...pending, delivered: true });
|
|
@@ -1427,7 +1429,7 @@ async function pollOpenCodeWake(files, io, replay = false) {
|
|
|
1427
1429
|
}
|
|
1428
1430
|
|
|
1429
1431
|
// src/harness/opencode.ts
|
|
1430
|
-
var install7 = async (flags, deps) => (await import("./chunk-
|
|
1432
|
+
var install7 = async (flags, deps) => (await import("./chunk-YG6KJFZW.mjs")).runOpenCodeInstall(flags, deps);
|
|
1431
1433
|
var opencode = {
|
|
1432
1434
|
id: "opencode",
|
|
1433
1435
|
sessionSources: [{ kind: "meta", resolve: (meta) => meta?.khala_session, rejoinable: () => true }, hookMapSource],
|
|
@@ -1471,6 +1473,7 @@ function adapterFor(id) {
|
|
|
1471
1473
|
}
|
|
1472
1474
|
|
|
1473
1475
|
export {
|
|
1476
|
+
STOP_NUDGE,
|
|
1474
1477
|
createCopilotCodec,
|
|
1475
1478
|
createWakeLadder,
|
|
1476
1479
|
registerAntigravityWake,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
KHALA_AGENT_VERSION
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MHHNDW4A.mjs";
|
|
5
5
|
import {
|
|
6
6
|
bundle
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LS5EHLCO.mjs";
|
|
8
8
|
import {
|
|
9
9
|
LISTENING_MODES
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-LYLDUHUX.mjs";
|
|
11
11
|
import {
|
|
12
12
|
HARNESS_REGISTRY,
|
|
13
13
|
M1_LABEL_MAX_BYTES,
|
|
@@ -35,10 +35,10 @@ import {
|
|
|
35
35
|
utcTimestamp,
|
|
36
36
|
utf8Length,
|
|
37
37
|
version
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-WE3JID2S.mjs";
|
|
39
39
|
import {
|
|
40
40
|
init_define_KHALA_BUNDLE
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-3IHM2SW7.mjs";
|
|
42
42
|
|
|
43
43
|
// src/client.ts
|
|
44
44
|
init_define_KHALA_BUNDLE();
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
decodeWith,
|
|
4
|
+
literal,
|
|
5
|
+
object,
|
|
6
|
+
readMatrixUserId,
|
|
7
|
+
version
|
|
8
|
+
} from "./chunk-WE3JID2S.mjs";
|
|
9
|
+
import {
|
|
10
|
+
init_define_KHALA_BUNDLE
|
|
11
|
+
} from "./chunk-3IHM2SW7.mjs";
|
|
12
|
+
|
|
13
|
+
// ../contracts/src/m1/listening-mode.ts
|
|
14
|
+
init_define_KHALA_BUNDLE();
|
|
15
|
+
var LISTENING_MODES = ["steer", "sync", "async", "mute"];
|
|
16
|
+
function decodeListeningMode(input) {
|
|
17
|
+
return decodeWith(() => literal(input, "", LISTENING_MODES));
|
|
18
|
+
}
|
|
19
|
+
var LISTENING_MODE_COMMAND_TYPE = "com.khala.listening_mode.v1";
|
|
20
|
+
var LISTENING_MODE_MEMBER_KEY = "com.khala.listening_mode";
|
|
21
|
+
var DEFAULT_LISTENING_MODE = "sync";
|
|
22
|
+
function decodeListeningModeCommand(input) {
|
|
23
|
+
return decodeWith(() => {
|
|
24
|
+
const r = object(input, "", ["v", "agent", "mode"]);
|
|
25
|
+
return {
|
|
26
|
+
v: version(r.field("v"), r.at("v")),
|
|
27
|
+
agent: readMatrixUserId(r.field("agent"), r.at("agent")),
|
|
28
|
+
mode: literal(r.field("mode"), r.at("mode"), LISTENING_MODES)
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function memberListeningMode(content) {
|
|
33
|
+
const value = typeof content === "object" && content !== null ? content[LISTENING_MODE_MEMBER_KEY] : void 0;
|
|
34
|
+
if (value === void 0) return DEFAULT_LISTENING_MODE;
|
|
35
|
+
const decoded = decodeListeningMode(value);
|
|
36
|
+
return decoded.ok ? decoded.value : "async";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
LISTENING_MODES,
|
|
41
|
+
decodeListeningMode,
|
|
42
|
+
LISTENING_MODE_COMMAND_TYPE,
|
|
43
|
+
LISTENING_MODE_MEMBER_KEY,
|
|
44
|
+
DEFAULT_LISTENING_MODE,
|
|
45
|
+
decodeListeningModeCommand,
|
|
46
|
+
memberListeningMode
|
|
47
|
+
};
|
|
@@ -2,10 +2,10 @@ import { createRequire as __khalaCreateRequire } from 'node:module'; const requi
|
|
|
2
2
|
import {
|
|
3
3
|
adapterFor,
|
|
4
4
|
resolveSources
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FQPHAPKV.mjs";
|
|
6
6
|
import {
|
|
7
7
|
init_define_KHALA_BUNDLE
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-3IHM2SW7.mjs";
|
|
9
9
|
|
|
10
10
|
// src/mcp/session-id.ts
|
|
11
11
|
init_define_KHALA_BUNDLE();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
init_define_KHALA_BUNDLE
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3IHM2SW7.mjs";
|
|
5
5
|
|
|
6
6
|
// src/matrix/decryption-retry.ts
|
|
7
7
|
init_define_KHALA_BUNDLE();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
bundle
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-LS5EHLCO.mjs";
|
|
5
5
|
import {
|
|
6
6
|
init_define_KHALA_BUNDLE
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3IHM2SW7.mjs";
|
|
8
8
|
|
|
9
9
|
// src/version.ts
|
|
10
10
|
init_define_KHALA_BUNDLE();
|