khala-cli 0.4.16 → 0.4.18

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.
Files changed (46) hide show
  1. package/README.md +2 -2
  2. package/dist/{chunk-YMH6MKJJ.mjs → chunk-3RCRNCG3.mjs} +2 -2
  3. package/dist/{chunk-XD2AELOT.mjs → chunk-43THPTMD.mjs} +7 -7
  4. package/dist/chunk-4FUYRD3G.mjs +27 -0
  5. package/dist/{chunk-OSSYXQKY.mjs → chunk-4IOLQB34.mjs} +2 -2
  6. package/dist/{chunk-AYG5S5CG.mjs → chunk-4WHRO5ZU.mjs} +7 -7
  7. package/dist/{chunk-3AOD6N2X.mjs → chunk-5IZ3WN3S.mjs} +163 -81
  8. package/dist/{chunk-T5EJ7PRO.mjs → chunk-6ZL6OFW4.mjs} +12 -5
  9. package/dist/chunk-AU2FBBUY.mjs +20 -0
  10. package/dist/{chunk-K7UICTRQ.mjs → chunk-BG4JGKQG.mjs} +2 -2
  11. package/dist/chunk-EBKZETYL.mjs +142 -0
  12. package/dist/{chunk-ZKVCL3WP.mjs → chunk-ELI3YCFF.mjs} +51 -50
  13. package/dist/{chunk-3BMYI3II.mjs → chunk-FCOL5HBH.mjs} +17 -17
  14. package/dist/{chunk-4XN4FXQN.mjs → chunk-FDSHLUCQ.mjs} +10 -10
  15. package/dist/{chunk-TYHET72S.mjs → chunk-GVIPYERE.mjs} +3 -3
  16. package/dist/{chunk-DVNUQCCY.mjs → chunk-H2X64ISL.mjs} +3 -3
  17. package/dist/{chunk-G323ZXDL.mjs → chunk-HOKMRMNP.mjs} +2 -2
  18. package/dist/{chunk-ODMW45B6.mjs → chunk-IESMCVXV.mjs} +1 -1
  19. package/dist/{chunk-YAIJB4FT.mjs → chunk-JXV5S7FC.mjs} +12 -12
  20. package/dist/{chunk-JKBHRHSY.mjs → chunk-KCWHDC7S.mjs} +8 -8
  21. package/dist/chunk-KXLGRISD.mjs +19 -0
  22. package/dist/{chunk-4GVGGDP3.mjs → chunk-LNDZI73C.mjs} +4 -4
  23. package/dist/{chunk-PC7MEL4R.mjs → chunk-LOGBYBPA.mjs} +1 -1
  24. package/dist/{chunk-THOO43JY.mjs → chunk-MTDLNIUY.mjs} +1 -1
  25. package/dist/{chunk-7DAJUPE7.mjs → chunk-OZ5C2ZMB.mjs} +29 -25
  26. package/dist/{chunk-AU75ZQGN.mjs → chunk-QYVSNP2P.mjs} +1 -1
  27. package/dist/{chunk-EY27N2BY.mjs → chunk-RJZ6FAFC.mjs} +3 -3
  28. package/dist/{chunk-W33R7NQS.mjs → chunk-RWT4I2XJ.mjs} +36 -60
  29. package/dist/{chunk-GS7FTTHW.mjs → chunk-SRUPGV2G.mjs} +28 -11
  30. package/dist/{chunk-UWRWWFN5.mjs → chunk-TYRNBET6.mjs} +53 -11
  31. package/dist/{chunk-NXEQEY3M.mjs → chunk-UA6DEWBA.mjs} +1 -1
  32. package/dist/{chunk-QSIO26HF.mjs → chunk-VK7ZSKQZ.mjs} +9 -9
  33. package/dist/{chunk-RXQJ7W3V.mjs → chunk-WM75XLND.mjs} +6 -6
  34. package/dist/{chunk-E3IVG3BK.mjs → chunk-XXKDMHR2.mjs} +2 -2
  35. package/dist/{chunk-H27WKQYQ.mjs → chunk-YAXWRS5U.mjs} +2 -2
  36. package/dist/khala.mjs +11 -11
  37. package/dist/web/assets/local-3eMi9596.js +13 -0
  38. package/dist/web/assets/local-NETsM4LU.css +1 -0
  39. package/dist/web/index.html +2 -2
  40. package/package.json +1 -1
  41. package/dist/chunk-FEJE7ZOF.mjs +0 -47
  42. package/dist/chunk-M5II3E5T.mjs +0 -19
  43. package/dist/chunk-NEJRSW7R.mjs +0 -20
  44. package/dist/chunk-WFRW2X2S.mjs +0 -27
  45. package/dist/web/assets/local-d0y_F2g5.js +0 -13
  46. package/dist/web/assets/local-rpKMAzbU.css +0 -1
@@ -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-AU75ZQGN.mjs";
4
+ } from "./chunk-QYVSNP2P.mjs";
5
5
 
6
6
  // ../contracts/src/m1/image.ts
7
7
  init_define_KHALA_BUNDLE();
@@ -46,14 +46,27 @@ function sniffImage(bytes) {
46
46
  const found = sniffType(bytes);
47
47
  return found && found.w >= 1 && found.h >= 1 && found.w <= MAX_DIMENSION && found.h <= MAX_DIMENSION ? found : null;
48
48
  }
49
+ var HEIF_BRANDS = ["heic", "heix", "hevc", "hevx", "heim", "heis", "mif1", "msf1"];
50
+ var isHeif = (b) => b.length >= 12 && ascii(b, 4, "ftyp") && HEIF_BRANDS.some((brand) => ascii(b, 8, brand));
49
51
  function checkImage(bytes) {
50
52
  if (bytes.length === 0) return { ok: false, reason: "empty" };
51
53
  if (bytes.length > IMAGE_MAX_BYTES) return { ok: false, reason: "too_large" };
52
54
  const image = sniffImage(bytes);
53
- return image ? { ok: true, image } : { ok: false, reason: "unsupported_type" };
55
+ return image ? { ok: true, image } : { ok: false, reason: isHeif(bytes) ? "heic" : "unsupported_type" };
54
56
  }
55
- function stripJpegMetadata(bytes) {
56
- if (bytes[0] !== 255 || bytes[1] !== 216) return bytes;
57
+ function concat(parts) {
58
+ const out = new Uint8Array(parts.reduce((sum, part) => sum + part.length, 0));
59
+ let at = 0;
60
+ for (const part of parts) {
61
+ out.set(part, at);
62
+ at += part.length;
63
+ }
64
+ return out;
65
+ }
66
+ var u32 = (b, i) => (u16be(b, i) << 16 | u16be(b, i + 2)) >>> 0;
67
+ var u32le = (b, i) => (u16le(b, i) | u16le(b, i + 2) << 16) >>> 0;
68
+ var fourcc = (b, i) => String.fromCharCode(...b.subarray(i, i + 4));
69
+ function stripJpeg(bytes) {
57
70
  const parts = [bytes.subarray(0, 2)];
58
71
  let i = 2;
59
72
  while (i + 3 < bytes.length && bytes[i] === 255) {
@@ -65,14 +78,43 @@ function stripJpegMetadata(bytes) {
65
78
  i = end;
66
79
  }
67
80
  parts.push(bytes.subarray(i));
68
- const out = new Uint8Array(parts.reduce((sum, part) => sum + part.length, 0));
69
- let at = 0;
70
- for (const part of parts) {
71
- out.set(part, at);
72
- at += part.length;
81
+ return concat(parts);
82
+ }
83
+ var PNG_METADATA = /* @__PURE__ */ new Set(["eXIf", "tEXt", "zTXt", "iTXt", "tIME"]);
84
+ function stripPng(bytes) {
85
+ const parts = [bytes.subarray(0, 8)];
86
+ for (let i = 8; i + 12 <= bytes.length; ) {
87
+ const end = i + 12 + u32(bytes, i);
88
+ if (end > bytes.length) return bytes;
89
+ const type = fourcc(bytes, i + 4);
90
+ if (!PNG_METADATA.has(type)) parts.push(bytes.subarray(i, end));
91
+ i = end;
92
+ if (type === "IEND") break;
73
93
  }
94
+ return concat(parts);
95
+ }
96
+ function stripWebp(bytes) {
97
+ const parts = [bytes.subarray(0, 12)];
98
+ for (let i = 12; i + 8 <= bytes.length; ) {
99
+ const size = u32le(bytes, i + 4);
100
+ if (i + 8 + size > bytes.length) return bytes;
101
+ const end = Math.min(bytes.length, i + 8 + size + (size & 1));
102
+ const type = fourcc(bytes, i);
103
+ if (type !== "EXIF" && type !== "XMP ") parts.push(bytes.subarray(i, end));
104
+ i = end;
105
+ }
106
+ const out = concat(parts);
107
+ const riff = out.length - 8;
108
+ out.set([riff & 255, riff >> 8 & 255, riff >> 16 & 255, riff >>> 24], 4);
109
+ if (fourcc(out, 12) === "VP8X") out[20] = out[20] & ~12;
74
110
  return out;
75
111
  }
112
+ function stripImageMetadata(bytes, mimetype) {
113
+ if (mimetype === "image/jpeg") return stripJpeg(bytes);
114
+ if (mimetype === "image/png") return stripPng(bytes);
115
+ if (mimetype === "image/webp") return stripWebp(bytes);
116
+ return bytes;
117
+ }
76
118
  function base64(bytes, url = false) {
77
119
  let binary = "";
78
120
  for (let i = 0; i < bytes.length; i += 32768) binary += String.fromCharCode(...bytes.subarray(i, i + 32768));
@@ -148,13 +190,13 @@ function imageLabel(image) {
148
190
  // src/transport.ts
149
191
  init_define_KHALA_BUNDLE();
150
192
  var RESTORE_HISTORY_MAX_PAGES = 20;
151
- var startChannelSession = async (creds, options) => creds.transport === "local" ? (await import("./chunk-JKBHRHSY.mjs")).createLocalSession(creds) : (await import("./chunk-7DAJUPE7.mjs")).createAgentMatrixSession(creds, options);
193
+ var startChannelSession = async (creds, options) => creds.transport === "local" ? (await import("./chunk-KCWHDC7S.mjs")).createLocalSession(creds) : (await import("./chunk-OZ5C2ZMB.mjs")).createAgentMatrixSession(creds, options);
152
194
 
153
195
  export {
154
196
  IMAGE_MAX_BYTES,
155
197
  sniffImage,
156
198
  checkImage,
157
- stripJpegMetadata,
199
+ stripImageMetadata,
158
200
  encryptAttachment,
159
201
  decryptAttachment,
160
202
  imageEventContent,
@@ -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-AU75ZQGN.mjs";
4
+ } from "./chunk-QYVSNP2P.mjs";
5
5
 
6
6
  // src/matrix/decryption-retry.ts
7
7
  init_define_KHALA_BUNDLE();
@@ -1,24 +1,24 @@
1
1
  import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
2
2
  import {
3
3
  adapterFor
4
- } from "./chunk-W33R7NQS.mjs";
4
+ } from "./chunk-RWT4I2XJ.mjs";
5
5
  import {
6
6
  installedLauncher,
7
7
  launcherShellQuote,
8
8
  readWakeSettings
9
- } from "./chunk-YAIJB4FT.mjs";
9
+ } from "./chunk-JXV5S7FC.mjs";
10
10
  import {
11
11
  HARNESS_REGISTRY,
12
12
  filesForDir,
13
13
  readStateFile,
14
14
  stateRoot
15
- } from "./chunk-OSSYXQKY.mjs";
15
+ } from "./chunk-4IOLQB34.mjs";
16
16
  import {
17
17
  readWakeState
18
- } from "./chunk-PC7MEL4R.mjs";
18
+ } from "./chunk-LOGBYBPA.mjs";
19
19
  import {
20
20
  init_define_KHALA_BUNDLE
21
- } from "./chunk-AU75ZQGN.mjs";
21
+ } from "./chunk-QYVSNP2P.mjs";
22
22
 
23
23
  // src/wake/status.ts
24
24
  init_define_KHALA_BUNDLE();
@@ -746,11 +746,11 @@ function antigravityRegisterCommand(env = process.env, bin) {
746
746
  return launcherShellQuote(platform, bin ?? installedLauncher(platform, platform === "win32" ? path2.win32 : path2.posix, home, env).bin) + " wake register --harness antigravity";
747
747
  }
748
748
  function antigravityRegisterHint(env = process.env, bin) {
749
- return `Run ${antigravityRegisterCommand(env, bin)} through your own shell tool after khala_join and at every session start; repeat if the local server restarts. Never print or send the credential environment variables.`;
749
+ return `Run ${antigravityRegisterCommand(env, bin)} through your own shell tool after the Khala join tool and at every session start; repeat if the local server restarts. Never print or send the credential environment variables.`;
750
750
  }
751
751
 
752
752
  // src/wake/status.ts
753
- var CODEX_DAEMON_WAKE_NOTE = "Codex threads can keep answering mentions while the app-server daemon runs, even after the TUI exits. Stop with khala_leave, khala wake off --harness codex, or codex app-server daemon stop.";
753
+ var CODEX_DAEMON_WAKE_NOTE = "Codex threads can keep answering mentions while the app-server daemon runs, even after the TUI exits. Stop with the Khala leave tool, khala wake off --harness codex, or codex app-server daemon stop.";
754
754
  var WAKE_STATES = {
755
755
  held: { reason: "Held by your Qwen setting.", remedy: "/peers accept, or change agents.crossSessionInbound in Qwen settings." },
756
756
  active: { reason: "Idle wake is on.", remedy: "" },
@@ -761,7 +761,7 @@ var WAKE_STATES = {
761
761
  antigravity_credentials_rejected: "Antigravity native wake credentials were rejected.",
762
762
  qwen_session_missing: "Run wake status inside a Qwen session; its messaging socket is not inherited here.",
763
763
  qwen_socket_missing: "Qwen session registry or private controller credential is unavailable.",
764
- qwen_watcher_missing: "The Qwen background shell watcher is not armed; call khala_status inside Qwen for its installed run_shell_command command.",
764
+ qwen_watcher_missing: "The Qwen background shell watcher is not armed; call the Khala status tool inside Qwen for its installed run_shell_command command.",
765
765
  qwen_refused: "Qwen cross-session messaging is refused or off.",
766
766
  queue_missing: "Codex queue is missing.",
767
767
  codex_binary_missing: "Codex queue is missing.",
@@ -875,7 +875,7 @@ function selectedWakeStatus(rows) {
875
875
  }
876
876
  var WAKE_HARNESSES = HARNESS_REGISTRY.map((row) => row.id);
877
877
  async function wakeDisableNotice(dir) {
878
- const { takeWakeDisableNotices } = await import("./chunk-H27WKQYQ.mjs");
878
+ const { takeWakeDisableNotices } = await import("./chunk-YAXWRS5U.mjs");
879
879
  let drivers;
880
880
  try {
881
881
  const states = await readWakeState(dir);
@@ -3,27 +3,27 @@ import {
3
3
  WAKE_HARNESSES,
4
4
  wakeDrivers,
5
5
  wakeStatus
6
- } from "./chunk-QSIO26HF.mjs";
6
+ } from "./chunk-VK7ZSKQZ.mjs";
7
7
  import {
8
8
  adapterFor,
9
9
  registerAntigravityWake,
10
10
  resolveSources
11
- } from "./chunk-W33R7NQS.mjs";
11
+ } from "./chunk-RWT4I2XJ.mjs";
12
12
  import {
13
13
  CURSOR_DEFAULT_SESSION,
14
14
  updateWakeSettings
15
- } from "./chunk-YAIJB4FT.mjs";
15
+ } from "./chunk-JXV5S7FC.mjs";
16
16
  import {
17
17
  SESSION_ID_PATTERN,
18
18
  filesForDir,
19
19
  stateRoot
20
- } from "./chunk-OSSYXQKY.mjs";
20
+ } from "./chunk-4IOLQB34.mjs";
21
21
  import {
22
22
  resetWakeDriver
23
- } from "./chunk-PC7MEL4R.mjs";
23
+ } from "./chunk-LOGBYBPA.mjs";
24
24
  import {
25
25
  init_define_KHALA_BUNDLE
26
- } from "./chunk-AU75ZQGN.mjs";
26
+ } from "./chunk-QYVSNP2P.mjs";
27
27
 
28
28
  // src/wake/cli.ts
29
29
  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-ODMW45B6.mjs";
4
+ } from "./chunk-IESMCVXV.mjs";
5
5
  import {
6
6
  init_define_KHALA_BUNDLE
7
- } from "./chunk-AU75ZQGN.mjs";
7
+ } from "./chunk-QYVSNP2P.mjs";
8
8
 
9
9
  // src/version.ts
10
10
  init_define_KHALA_BUNDLE();
@@ -8,8 +8,8 @@ import {
8
8
  resetWakeDriver,
9
9
  settleAttempts,
10
10
  takeWakeDisableNotices
11
- } from "./chunk-PC7MEL4R.mjs";
12
- import "./chunk-AU75ZQGN.mjs";
11
+ } from "./chunk-LOGBYBPA.mjs";
12
+ import "./chunk-QYVSNP2P.mjs";
13
13
  export {
14
14
  cancelAttempt,
15
15
  confirmWakeText,
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-E3IVG3BK.mjs";
6
- import "./chunk-ODMW45B6.mjs";
5
+ } from "./chunk-XXKDMHR2.mjs";
6
+ import "./chunk-IESMCVXV.mjs";
7
7
  import {
8
8
  init_define_KHALA_BUNDLE
9
- } from "./chunk-AU75ZQGN.mjs";
9
+ } from "./chunk-QYVSNP2P.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-AYG5S5CG.mjs"),
88
- deliver: () => import("./chunk-ZKVCL3WP.mjs"),
89
- "claude-wake": () => import("./chunk-4XN4FXQN.mjs")
87
+ "session-start": () => import("./chunk-4WHRO5ZU.mjs"),
88
+ deliver: () => import("./chunk-ELI3YCFF.mjs"),
89
+ "claude-wake": () => import("./chunk-FDSHLUCQ.mjs")
90
90
  };
91
91
  process.exitCode = await runCli(process.argv.slice(2), {
92
- mcp: () => () => import("./chunk-3AOD6N2X.mjs"),
93
- watch: () => () => import("./chunk-XD2AELOT.mjs"),
94
- local: () => () => import("./chunk-GS7FTTHW.mjs"),
95
- install: () => () => import("./chunk-3BMYI3II.mjs"),
96
- wake: () => () => import("./chunk-WFRW2X2S.mjs"),
92
+ mcp: () => () => import("./chunk-5IZ3WN3S.mjs"),
93
+ watch: () => () => import("./chunk-43THPTMD.mjs"),
94
+ local: () => () => import("./chunk-SRUPGV2G.mjs"),
95
+ install: () => () => import("./chunk-FCOL5HBH.mjs"),
96
+ wake: () => () => import("./chunk-4FUYRD3G.mjs"),
97
97
  hook: (name) => Object.hasOwn(hooks, name) ? hooks[name] : void 0
98
98
  });