khala-cli 0.4.14 → 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-BSB77FJG.mjs → chunk-26TDBFRB.mjs} +2 -2
- package/dist/{chunk-H3XIRV2S.mjs → chunk-3IHM2SW7.mjs} +1 -1
- package/dist/{chunk-VQDIOGV7.mjs → chunk-4OFZP46T.mjs} +7 -7
- package/dist/{chunk-PISWOM3Q.mjs → chunk-4PZFWER6.mjs} +10 -10
- package/dist/{chunk-OPBOWFBB.mjs → chunk-5B2GYFBD.mjs} +132 -40
- package/dist/{chunk-O2NDYSYF.mjs → chunk-5W73XTCG.mjs} +6 -6
- package/dist/{chunk-WMZ7YE6H.mjs → chunk-5WXVNFMV.mjs} +3 -3
- package/dist/{chunk-G2TAYBYB.mjs → chunk-5XZKEFRD.mjs} +1 -1
- package/dist/{chunk-RXM47OGD.mjs → chunk-657MHRGF.mjs} +3 -3
- package/dist/{chunk-P2S3OAZ5.mjs → chunk-BCEKWOVJ.mjs} +6 -6
- package/dist/{chunk-PIYD4WCN.mjs → chunk-BI2TKRL3.mjs} +1 -1
- package/dist/{chunk-PFWYYXR5.mjs → chunk-C7PNUX5Y.mjs} +2 -2
- package/dist/{chunk-4YHVAWZF.mjs → chunk-CXIAXZAE.mjs} +3 -3
- package/dist/{chunk-2ZT7TFV5.mjs → chunk-EBDML25F.mjs} +8 -8
- package/dist/{chunk-4THILKJ5.mjs → chunk-EEPFMGHU.mjs} +6 -6
- package/dist/{chunk-TVWBZD24.mjs → chunk-FQPHAPKV.mjs} +16 -16
- package/dist/{chunk-KZO6BSPQ.mjs → chunk-IECJZUSO.mjs} +5 -5
- package/dist/{chunk-T3BRQFVF.mjs → chunk-LS5EHLCO.mjs} +1 -1
- package/dist/{chunk-VXHWS7JD.mjs → chunk-LYLDUHUX.mjs} +2 -2
- package/dist/{chunk-PYVAMHAG.mjs → chunk-M2CLLH63.mjs} +2 -2
- package/dist/{chunk-ZWDINIQJ.mjs → chunk-MEI5RBK5.mjs} +1 -1
- package/dist/{chunk-U2OUPWUW.mjs → chunk-MHHNDW4A.mjs} +2 -2
- package/dist/{chunk-QH5WZEIG.mjs → chunk-Q7MJTMRR.mjs} +9 -9
- package/dist/chunk-QT5ZMQHY.mjs +27 -0
- package/dist/{chunk-FOCBFFH5.mjs → chunk-RYJJVZMQ.mjs} +2 -2
- package/dist/chunk-SBJ33DW7.mjs +165 -0
- package/dist/{chunk-UBDI4XFO.mjs → chunk-UJQI2AKH.mjs} +10 -10
- package/dist/{chunk-N7B2VPDU.mjs → chunk-WE3JID2S.mjs} +1 -1
- package/dist/chunk-WF6GBYGH.mjs +20 -0
- package/dist/{chunk-RHAAMCRD.mjs → chunk-WLUNHB2O.mjs} +7 -7
- package/dist/chunk-XS66DEGZ.mjs +19 -0
- package/dist/{chunk-YXMJJAMH.mjs → chunk-XZN4X37N.mjs} +50 -9
- package/dist/{chunk-QEIYPWN4.mjs → chunk-YG6KJFZW.mjs} +12 -12
- package/dist/{chunk-W3LLNKEB.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-6CDTY2EG.mjs +0 -20
- package/dist/chunk-HPZY6LHL.mjs +0 -14
- package/dist/chunk-TMOAMJMV.mjs +0 -19
- package/dist/chunk-UQJHB4AH.mjs +0 -27
- package/dist/web/assets/local-DLmpMMaF.css +0 -1
- package/dist/web/assets/local-EzltpNwn.js +0 -11
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
ADAPTERS,
|
|
4
|
+
adapterFor,
|
|
5
|
+
createAdapterRegistry
|
|
6
|
+
} from "./chunk-FQPHAPKV.mjs";
|
|
7
|
+
import "./chunk-RYJJVZMQ.mjs";
|
|
8
|
+
import "./chunk-4OFZP46T.mjs";
|
|
9
|
+
import "./chunk-LYLDUHUX.mjs";
|
|
10
|
+
import "./chunk-657MHRGF.mjs";
|
|
11
|
+
import "./chunk-C7PNUX5Y.mjs";
|
|
12
|
+
import "./chunk-WE3JID2S.mjs";
|
|
13
|
+
import "./chunk-5XZKEFRD.mjs";
|
|
14
|
+
import "./chunk-3IHM2SW7.mjs";
|
|
15
|
+
export {
|
|
16
|
+
ADAPTERS,
|
|
17
|
+
adapterFor,
|
|
18
|
+
createAdapterRegistry
|
|
19
|
+
};
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
retryUnexpired
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MEI5RBK5.mjs";
|
|
5
5
|
import {
|
|
6
|
+
IMAGE_MAX_BYTES,
|
|
6
7
|
RESTORE_HISTORY_MAX_PAGES
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-SBJ33DW7.mjs";
|
|
9
|
+
import "./chunk-BI2TKRL3.mjs";
|
|
9
10
|
import {
|
|
10
11
|
LISTENING_MODE_COMMAND_TYPE,
|
|
11
12
|
LISTENING_MODE_MEMBER_KEY,
|
|
12
13
|
memberListeningMode
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-LYLDUHUX.mjs";
|
|
14
15
|
import {
|
|
15
16
|
CHANNEL_EVENT_TYPE,
|
|
16
17
|
encodeChannelEvent,
|
|
17
18
|
memberRenameContent
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-C7PNUX5Y.mjs";
|
|
19
20
|
import {
|
|
20
21
|
StateError
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-WE3JID2S.mjs";
|
|
22
23
|
import {
|
|
23
24
|
init_define_KHALA_BUNDLE
|
|
24
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-3IHM2SW7.mjs";
|
|
25
26
|
|
|
26
27
|
// src/matrix/session.ts
|
|
27
28
|
init_define_KHALA_BUNDLE();
|
|
@@ -59,7 +60,7 @@ async function createAgentMatrixSession(creds, opts) {
|
|
|
59
60
|
const started = Date.now();
|
|
60
61
|
const rejoinTxnId = `khala.rejoin.${randomUUID()}`;
|
|
61
62
|
const log = (line) => opts?.log?.(line);
|
|
62
|
-
const persistent = opts?.cryptoStore ? await (await import("./chunk-
|
|
63
|
+
const persistent = opts?.cryptoStore ? await (await import("./chunk-ZUGJJGF4.mjs")).openCryptoStore(opts.cryptoStore.dir, opts.cryptoStore.root, creds) : void 0;
|
|
63
64
|
const client = createClient({ ...persistent ? { store: persistent.sync } : {}, baseUrl: creds.homeserver, userId: creds.userId, accessToken: creds.accessToken, deviceId: creds.deviceId });
|
|
64
65
|
const handlers = /* @__PURE__ */ new Set();
|
|
65
66
|
const ended = /* @__PURE__ */ new Set();
|
|
@@ -315,7 +316,7 @@ async function createAgentMatrixSession(creds, opts) {
|
|
|
315
316
|
await client.initRustCrypto(persistent ? { useIndexedDB: true, cryptoDatabasePrefix: persistent.prefix } : { useIndexedDB: false });
|
|
316
317
|
} catch (error) {
|
|
317
318
|
if (!persistent?.restored || error instanceof StateError && error.code === "unsafe_state_dir") throw error;
|
|
318
|
-
throw new (await import("./chunk-
|
|
319
|
+
throw new (await import("./chunk-ZUGJJGF4.mjs")).CryptoStoreCorruptError();
|
|
319
320
|
}
|
|
320
321
|
const crypto = client.getCrypto();
|
|
321
322
|
if (!crypto) throw new Error("crypto_unavailable");
|
|
@@ -572,6 +573,46 @@ async function createAgentMatrixSession(creds, opts) {
|
|
|
572
573
|
const res = await guarded(roomId, () => client.sendTextMessage(roomId, text));
|
|
573
574
|
return { eventId: res.event_id };
|
|
574
575
|
},
|
|
576
|
+
async uploadMedia(ciphertext) {
|
|
577
|
+
if (stopped) throw new Error("session_stopped");
|
|
578
|
+
const res = await client.uploadContent(new Blob([new Uint8Array(ciphertext)]), { type: "application/octet-stream", includeFilename: false });
|
|
579
|
+
return res.content_uri;
|
|
580
|
+
},
|
|
581
|
+
async downloadMedia(mxc) {
|
|
582
|
+
if (stopped) throw new Error("session_stopped");
|
|
583
|
+
const url = client.mxcUrlToHttp(mxc, void 0, void 0, void 0, false, true, true);
|
|
584
|
+
if (!url) throw new Error("invalid_media_url");
|
|
585
|
+
const res = await fetch(url, { headers: { authorization: `Bearer ${creds.accessToken}` }, signal: AbortSignal.timeout(6e4) });
|
|
586
|
+
if (!res.ok || !res.body) throw new Error(`media_download_${res.status}`);
|
|
587
|
+
const chunks = [];
|
|
588
|
+
let size = 0;
|
|
589
|
+
const reader = res.body.getReader();
|
|
590
|
+
for (let next = await reader.read(); !next.done; next = await reader.read()) {
|
|
591
|
+
size += next.value.length;
|
|
592
|
+
if (size > IMAGE_MAX_BYTES * 2) {
|
|
593
|
+
void reader.cancel();
|
|
594
|
+
throw new Error("media_too_large");
|
|
595
|
+
}
|
|
596
|
+
chunks.push(next.value);
|
|
597
|
+
}
|
|
598
|
+
return Buffer.concat(chunks);
|
|
599
|
+
},
|
|
600
|
+
async sendContent(roomId, content) {
|
|
601
|
+
if (stopped) throw new Error("session_stopped");
|
|
602
|
+
const res = await guarded(roomId, () => client.sendEvent(roomId, EventType.RoomMessage, content));
|
|
603
|
+
return { eventId: res.event_id };
|
|
604
|
+
},
|
|
605
|
+
async eventContent(roomId, eventId) {
|
|
606
|
+
if (stopped) throw new Error("session_stopped");
|
|
607
|
+
const raw = await guarded(roomId, () => client.fetchRoomEvent(roomId, eventId));
|
|
608
|
+
const event = client.getEventMapper()({ ...raw, room_id: roomId });
|
|
609
|
+
try {
|
|
610
|
+
await client.decryptEventIfNeeded(event);
|
|
611
|
+
} catch {
|
|
612
|
+
return void 0;
|
|
613
|
+
}
|
|
614
|
+
return event.isDecryptionFailure() || event.getType() !== "m.room.message" ? void 0 : event.getContent();
|
|
615
|
+
},
|
|
575
616
|
async sendChannelEvent(roomId, content, txnId) {
|
|
576
617
|
if (stopped) throw new Error("session_stopped");
|
|
577
618
|
const res = await guarded(roomId, () => client.sendEvent(roomId, CHANNEL_EVENT_TYPE, content, txnId));
|
|
@@ -1,19 +1,19 @@
|
|
|
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
|
consentLine,
|
|
7
7
|
setWake
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-EEPFMGHU.mjs";
|
|
9
9
|
import {
|
|
10
10
|
antigravityRegisterHint,
|
|
11
11
|
wakeDrivers
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-5W73XTCG.mjs";
|
|
13
13
|
import {
|
|
14
14
|
adapterFor
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-FQPHAPKV.mjs";
|
|
16
|
+
import "./chunk-RYJJVZMQ.mjs";
|
|
17
17
|
import {
|
|
18
18
|
ManagedFiles,
|
|
19
19
|
cursorPaths,
|
|
@@ -29,19 +29,19 @@ import {
|
|
|
29
29
|
qwenHome,
|
|
30
30
|
readManaged,
|
|
31
31
|
textFormat
|
|
32
|
-
} from "./chunk-
|
|
33
|
-
import "./chunk-
|
|
34
|
-
import "./chunk-
|
|
35
|
-
import "./chunk-
|
|
32
|
+
} from "./chunk-4OFZP46T.mjs";
|
|
33
|
+
import "./chunk-LYLDUHUX.mjs";
|
|
34
|
+
import "./chunk-657MHRGF.mjs";
|
|
35
|
+
import "./chunk-C7PNUX5Y.mjs";
|
|
36
36
|
import {
|
|
37
37
|
ensureStateDir,
|
|
38
38
|
isHarnessId,
|
|
39
39
|
stateRoot
|
|
40
|
-
} from "./chunk-
|
|
41
|
-
import "./chunk-
|
|
40
|
+
} from "./chunk-WE3JID2S.mjs";
|
|
41
|
+
import "./chunk-5XZKEFRD.mjs";
|
|
42
42
|
import {
|
|
43
43
|
init_define_KHALA_BUNDLE
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-3IHM2SW7.mjs";
|
|
45
45
|
|
|
46
46
|
// src/install/main.ts
|
|
47
47
|
init_define_KHALA_BUNDLE();
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
retryUnexpired
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MEI5RBK5.mjs";
|
|
5
5
|
import {
|
|
6
6
|
StateError,
|
|
7
7
|
ensureStateDir,
|
|
8
8
|
writeJsonAtomic
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-WE3JID2S.mjs";
|
|
10
10
|
import {
|
|
11
11
|
__commonJS,
|
|
12
12
|
__export,
|
|
13
13
|
__toESM,
|
|
14
14
|
init_define_KHALA_BUNDLE
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-3IHM2SW7.mjs";
|
|
16
16
|
|
|
17
17
|
// ../../node_modules/.pnpm/immediate@3.3.0/node_modules/immediate/lib/nextTick.js
|
|
18
18
|
var require_nextTick = __commonJS({
|
package/dist/khala.mjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
KHALA_AGENT_VERSION
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-MHHNDW4A.mjs";
|
|
6
|
+
import "./chunk-LS5EHLCO.mjs";
|
|
7
7
|
import {
|
|
8
8
|
init_define_KHALA_BUNDLE
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3IHM2SW7.mjs";
|
|
10
10
|
|
|
11
11
|
// src/cli-bundle.ts
|
|
12
12
|
init_define_KHALA_BUNDLE();
|
|
@@ -84,15 +84,15 @@ async function runCli(argv, modules) {
|
|
|
84
84
|
|
|
85
85
|
// src/cli-bundle.ts
|
|
86
86
|
var hooks = {
|
|
87
|
-
"session-start": () => import("./chunk-
|
|
88
|
-
deliver: () => import("./chunk-
|
|
89
|
-
"claude-wake": () => import("./chunk-
|
|
87
|
+
"session-start": () => import("./chunk-BCEKWOVJ.mjs"),
|
|
88
|
+
deliver: () => import("./chunk-UJQI2AKH.mjs"),
|
|
89
|
+
"claude-wake": () => import("./chunk-4PZFWER6.mjs")
|
|
90
90
|
};
|
|
91
91
|
process.exitCode = await runCli(process.argv.slice(2), {
|
|
92
|
-
mcp: () => () => import("./chunk-
|
|
93
|
-
watch: () => () => import("./chunk-
|
|
94
|
-
local: () => () => import("./chunk-
|
|
95
|
-
install: () => () => import("./chunk-
|
|
96
|
-
wake: () => () => import("./chunk-
|
|
92
|
+
mcp: () => () => import("./chunk-5B2GYFBD.mjs"),
|
|
93
|
+
watch: () => () => import("./chunk-WLUNHB2O.mjs"),
|
|
94
|
+
local: () => () => import("./chunk-Q7MJTMRR.mjs"),
|
|
95
|
+
install: () => () => import("./chunk-YG6KJFZW.mjs"),
|
|
96
|
+
wake: () => () => import("./chunk-QT5ZMQHY.mjs"),
|
|
97
97
|
hook: (name) => Object.hasOwn(hooks, name) ? hooks[name] : void 0
|
|
98
98
|
});
|