khala-cli 0.4.9 → 0.4.11

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 (48) hide show
  1. package/dist/THIRD_PARTY_NOTICES.txt +28 -0
  2. package/dist/{chunk-DJM23SIU.mjs → chunk-3KHLSF4A.mjs} +7 -8
  3. package/dist/{chunk-PDZ5Z5ZE.mjs → chunk-4CENUF7M.mjs} +24 -9
  4. package/dist/{chunk-QKWEZXR3.mjs → chunk-4PUNVPC3.mjs} +12 -4
  5. package/dist/{chunk-WDOHRV3D.mjs → chunk-7FFHZ7EI.mjs} +14 -14
  6. package/dist/chunk-AQX2OYEF.mjs +19 -0
  7. package/dist/{chunk-ITFD3JZS.mjs → chunk-BVG7PJNZ.mjs} +424 -78
  8. package/dist/{chunk-NGSYOVQ4.mjs → chunk-CXVANPY5.mjs} +2 -2
  9. package/dist/chunk-CYINL2V3.mjs +20 -0
  10. package/dist/{chunk-KMLXOPBQ.mjs → chunk-E5QRD6W3.mjs} +4 -2
  11. package/dist/{chunk-FO5GXCST.mjs → chunk-FGHPOKXG.mjs} +5 -5
  12. package/dist/{chunk-FZEH2IXZ.mjs → chunk-GVZD4TLW.mjs} +180 -26
  13. package/dist/{chunk-V4F3SYKW.mjs → chunk-H2L5GQ5W.mjs} +25 -17
  14. package/dist/chunk-HZH74L5T.mjs +901 -0
  15. package/dist/{chunk-NPSQNCOY.mjs → chunk-JNSB3E6C.mjs} +13 -4
  16. package/dist/{chunk-7R3EIDGR.mjs → chunk-LDW4HOQW.mjs} +1 -1
  17. package/dist/chunk-LNKI3CZO.mjs +15 -0
  18. package/dist/{chunk-TEFOQXBK.mjs → chunk-MAIMFERG.mjs} +3 -3
  19. package/dist/chunk-MYIZQCRW.mjs +27 -0
  20. package/dist/{chunk-TANCKTDK.mjs → chunk-N6UYX3SY.mjs} +72 -5
  21. package/dist/{chunk-6BO3JSUP.mjs → chunk-NE4S7N3R.mjs} +2 -2
  22. package/dist/{chunk-BLCRVRIK.mjs → chunk-NJ5ICCVZ.mjs} +456 -87
  23. package/dist/{chunk-3R6HFSLL.mjs → chunk-NN5RHU6C.mjs} +92 -38
  24. package/dist/{chunk-NIX5F4LT.mjs → chunk-NOKTVPSY.mjs} +330 -66
  25. package/dist/{chunk-3KDOTR54.mjs → chunk-NUQSDSVT.mjs} +1 -1
  26. package/dist/{chunk-BEO7WIIM.mjs → chunk-OSVXLZKJ.mjs} +28 -8
  27. package/dist/{chunk-SSO5RFOX.mjs → chunk-R5NDTJRA.mjs} +1 -1
  28. package/dist/{chunk-K7V7X6WU.mjs → chunk-TVQ4MSEI.mjs} +21 -4
  29. package/dist/{chunk-BV45NK7K.mjs → chunk-VWWI4S5A.mjs} +100 -6
  30. package/dist/{chunk-UK5GJO4Y.mjs → chunk-WA5LB5GN.mjs} +6 -5
  31. package/dist/chunk-X3BAMHAR.mjs +14 -0
  32. package/dist/{chunk-PAJ4JJPV.mjs → chunk-YDEZFVF7.mjs} +43 -6
  33. package/dist/{chunk-GSZADJMW.mjs → chunk-YFX5NDSL.mjs} +338 -81
  34. package/dist/{chunk-ANSR4IAW.mjs → chunk-YIKJI26V.mjs} +2 -2
  35. package/dist/{chunk-T7IL7V7Q.mjs → chunk-YNUCRFM2.mjs} +13 -10
  36. package/dist/iterm2_send.py +56 -0
  37. package/dist/khala.mjs +11 -11
  38. package/dist/web/assets/local-DPcMk9Xz.css +1 -0
  39. package/dist/web/assets/local-SDOFp8OA.js +9 -0
  40. package/dist/web/index.html +2 -2
  41. package/package.json +1 -1
  42. package/dist/chunk-47XNLAJG.mjs +0 -38
  43. package/dist/chunk-LBT47HLZ.mjs +0 -19
  44. package/dist/chunk-P3YIN7G7.mjs +0 -26
  45. package/dist/chunk-XBQDIKB5.mjs +0 -18
  46. package/dist/chunk-XUCWSYVS.mjs +0 -148
  47. package/dist/web/assets/local-CFzRHZpB.js +0 -9
  48. package/dist/web/assets/local-ciypUFoK.css +0 -1
@@ -317,6 +317,34 @@ SOFTWARE.
317
317
 
318
318
 
319
319
 
320
+ smol-toml@1.8.0 — LICENSE
321
+
322
+ Copyright (c) Squirrel Chat et al., All rights reserved.
323
+
324
+ Redistribution and use in source and binary forms, with or without
325
+ modification, are permitted provided that the following conditions are met:
326
+
327
+ 1. Redistributions of source code must retain the above copyright notice, this
328
+ list of conditions and the following disclaimer.
329
+ 2. Redistributions in binary form must reproduce the above copyright notice,
330
+ this list of conditions and the following disclaimer in the
331
+ documentation and/or other materials provided with the distribution.
332
+ 3. Neither the name of the copyright holder nor the names of its contributors
333
+ may be used to endorse or promote products derived from this software without
334
+ specific prior written permission.
335
+
336
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
337
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
338
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
339
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
340
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
341
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
342
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
343
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
344
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
345
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
346
+
347
+
320
348
  sync-promise-expanded@2.0.0 — LICENSE
321
349
 
322
350
  This is free and unencumbered software released into the public domain.
@@ -1,21 +1,20 @@
1
1
  import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
2
2
  import {
3
3
  WATCH_USAGE,
4
- mentions,
5
4
  monitorArmed,
6
5
  monitorOwner,
7
6
  run,
8
7
  watchSession
9
- } from "./chunk-NIX5F4LT.mjs";
10
- import "./chunk-NGSYOVQ4.mjs";
11
- import "./chunk-TANCKTDK.mjs";
12
- import "./chunk-NPSQNCOY.mjs";
13
- import "./chunk-K7V7X6WU.mjs";
14
- import "./chunk-7R3EIDGR.mjs";
8
+ } from "./chunk-NOKTVPSY.mjs";
9
+ import "./chunk-CXVANPY5.mjs";
10
+ import "./chunk-N6UYX3SY.mjs";
11
+ import "./chunk-VWWI4S5A.mjs";
12
+ import "./chunk-JNSB3E6C.mjs";
13
+ import "./chunk-TVQ4MSEI.mjs";
14
+ import "./chunk-LDW4HOQW.mjs";
15
15
  export {
16
16
  WATCH_USAGE,
17
17
  run as default,
18
- mentions,
19
18
  monitorArmed,
20
19
  monitorOwner,
21
20
  watchSession
@@ -4,7 +4,7 @@ import {
4
4
  checkName,
5
5
  isDefaultAgentName,
6
6
  restartHelper
7
- } from "./chunk-FO5GXCST.mjs";
7
+ } from "./chunk-FGHPOKXG.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-NPSQNCOY.mjs";
16
+ } from "./chunk-JNSB3E6C.mjs";
17
17
  import {
18
18
  init_define_KHALA_BUNDLE
19
- } from "./chunk-7R3EIDGR.mjs";
19
+ } from "./chunk-LDW4HOQW.mjs";
20
20
 
21
21
  // src/local/identity.ts
22
22
  init_define_KHALA_BUNDLE();
@@ -288,12 +288,27 @@ async function pollUntilDeadline(input, options) {
288
288
  }
289
289
  }
290
290
  async function reportReady(input, deps = {}) {
291
- const response = await post(endpoint(input, "/api/agent/join/ready"), input.origin, {}, deps, input.pollSecret);
292
- if (response.status === 204) return;
293
- const code = serverCode(await json(response));
294
- if (response.status === 404) fail("ready_not_found");
295
- if (response.status === 409) fail("not_confirmed");
296
- gatewayError(response.status, code);
291
+ const now = deps.now ?? Date.now;
292
+ const deadline = now() + (deps.timeoutMs ?? 12e4);
293
+ for (let delay = 1e3; ; delay = Math.min(delay * 2, 15e3)) {
294
+ const response = await post(endpoint(input, "/api/agent/join/ready"), input.origin, {}, deps, input.pollSecret);
295
+ if (response.status === 204) return;
296
+ const code = serverCode(await json(response));
297
+ if ((response.status === 429 || response.status === 503 && code === "unavailable") && now() + delay <= deadline) {
298
+ try {
299
+ await (deps.sleep ?? sleep)(delay, deps.signal);
300
+ } catch {
301
+ fail("network");
302
+ }
303
+ continue;
304
+ }
305
+ readyError(response.status, code);
306
+ }
307
+ }
308
+ function readyError(status, code) {
309
+ if (status === 404) fail("ready_not_found");
310
+ if (status === 409) fail("not_confirmed");
311
+ gatewayError(status, code);
297
312
  fail("protocol");
298
313
  }
299
314
 
@@ -4,19 +4,20 @@ import {
4
4
  readJson,
5
5
  readProcess,
6
6
  writeJsonAtomic
7
- } from "./chunk-NPSQNCOY.mjs";
7
+ } from "./chunk-JNSB3E6C.mjs";
8
8
  import {
9
9
  init_define_KHALA_BUNDLE
10
- } from "./chunk-7R3EIDGR.mjs";
10
+ } from "./chunk-LDW4HOQW.mjs";
11
11
 
12
12
  // src/wake/terminal/capture.ts
13
13
  init_define_KHALA_BUNDLE();
14
14
  import path from "node:path";
15
15
  import { unlink } from "node:fs/promises";
16
+ var sessionUuid = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i;
16
17
  function validPane(value) {
17
18
  if (!value || typeof value !== "object") return false;
18
19
  const pane = value;
19
- return typeof pane.paneId === "string" && (pane.kind === "tmux" ? /^%\d+$/.test(pane.paneId) : pane.kind === "wezterm" && /^\d+$/.test(pane.paneId)) && Number.isSafeInteger(pane.agentPid) && pane.agentPid > 0 && typeof pane.capturedAt === "string" && Number.isFinite(Date.parse(pane.capturedAt)) && (pane.socket === void 0 || pane.kind === "tmux" && typeof pane.socket === "string" && pane.socket.startsWith("/") && !pane.socket.includes("\0")) && (pane.agentStartTime === void 0 || typeof pane.agentStartTime === "string" && pane.agentStartTime.length > 0);
20
+ return typeof pane.paneId === "string" && (pane.kind === "tmux" ? /^%\d+$/.test(pane.paneId) : pane.kind === "iterm2" ? sessionUuid.test(pane.paneId) : ["wezterm", "kitty"].includes(pane.kind) && /^\d+$/.test(pane.paneId)) && Number.isSafeInteger(pane.agentPid) && pane.agentPid > 0 && typeof pane.capturedAt === "string" && Number.isFinite(Date.parse(pane.capturedAt)) && (pane.socket === void 0 || typeof pane.socket === "string" && !pane.socket.includes("\0") && (pane.kind === "kitty" || pane.kind === "tmux" && pane.socket.startsWith("/"))) && (pane.agentStartTime === void 0 || typeof pane.agentStartTime === "string" && pane.agentStartTime.length > 0);
20
21
  }
21
22
  async function readPane(files) {
22
23
  const pane = await readJson(path.join(files.dir, "pane.json"));
@@ -37,7 +38,14 @@ async function capturePane(files, env, options = {}) {
37
38
  if (!socket?.startsWith("/") || socket.includes("\0") || !/^%\d+$/.test(env.TMUX_PANE ?? "")) return clear();
38
39
  target = { kind: "tmux", paneId: env.TMUX_PANE, socket };
39
40
  } else if (/^\d+$/.test(env.WEZTERM_PANE ?? "")) target = { kind: "wezterm", paneId: env.WEZTERM_PANE };
40
- else return clear();
41
+ else if (env.KITTY_WINDOW_ID !== void 0) {
42
+ if (!/^\d+$/.test(env.KITTY_WINDOW_ID)) return clear();
43
+ target = { kind: "kitty", paneId: env.KITTY_WINDOW_ID, ...env.KITTY_LISTEN_ON === void 0 ? {} : { socket: env.KITTY_LISTEN_ON } };
44
+ } else if (env.ITERM_SESSION_ID !== void 0) {
45
+ const uuid = /^w\d+t\d+p\d+:(.+)$/.exec(env.ITERM_SESSION_ID)?.[1];
46
+ if (!uuid || !sessionUuid.test(uuid)) return clear();
47
+ target = { kind: "iterm2", paneId: uuid };
48
+ } else return clear();
41
49
  const agent = await nearestNonShellAncestor(options.pid ?? process.pid, options.readProcess ?? readProcess);
42
50
  if (!agent) return clear();
43
51
  const pane = { ...target, agentPid: agent.pid, agentStartTime: agent.startTime, capturedAt: (options.now ?? (() => /* @__PURE__ */ new Date()))().toISOString() };
@@ -2,7 +2,7 @@ import { createRequire as __khalaCreateRequire } from 'node:module'; const requi
2
2
  import {
3
3
  parseChannelLink,
4
4
  resolveLocalOwnerName
5
- } from "./chunk-PDZ5Z5ZE.mjs";
5
+ } from "./chunk-4CENUF7M.mjs";
6
6
  import {
7
7
  LOCAL_AGENT_DEVICE_PREFIX,
8
8
  LOCAL_IDLE_EXIT_MS,
@@ -32,20 +32,14 @@ import {
32
32
  normalizeInitials,
33
33
  olderHelperVersion,
34
34
  readHelperFile
35
- } from "./chunk-FO5GXCST.mjs";
36
- import "./chunk-SSO5RFOX.mjs";
37
- import {
38
- CHANNEL_EVENT_TYPE,
39
- decodeChannelEvent,
40
- encodeChannelEvent,
41
- memberRenameContent
42
- } from "./chunk-BV45NK7K.mjs";
35
+ } from "./chunk-FGHPOKXG.mjs";
36
+ import "./chunk-R5NDTJRA.mjs";
43
37
  import {
44
38
  KHALA_AGENT_VERSION
45
- } from "./chunk-ANSR4IAW.mjs";
39
+ } from "./chunk-YIKJI26V.mjs";
46
40
  import {
47
41
  bundle
48
- } from "./chunk-3KDOTR54.mjs";
42
+ } from "./chunk-NUQSDSVT.mjs";
49
43
  import {
50
44
  DEFAULT_LISTENING_MODE,
51
45
  LISTENING_MODE_COMMAND_TYPE,
@@ -53,7 +47,13 @@ import {
53
47
  decodeListeningMode,
54
48
  decodeListeningModeCommand,
55
49
  memberListeningMode
56
- } from "./chunk-NGSYOVQ4.mjs";
50
+ } from "./chunk-CXVANPY5.mjs";
51
+ import {
52
+ CHANNEL_EVENT_TYPE,
53
+ decodeChannelEvent,
54
+ encodeChannelEvent,
55
+ memberRenameContent
56
+ } from "./chunk-VWWI4S5A.mjs";
57
57
  import {
58
58
  LEGACY_HARNESSES,
59
59
  StateError,
@@ -67,10 +67,10 @@ import {
67
67
  validAgentRejoinSecret,
68
68
  validAgentSessionId,
69
69
  writeJsonAtomic
70
- } from "./chunk-NPSQNCOY.mjs";
70
+ } from "./chunk-JNSB3E6C.mjs";
71
71
  import {
72
72
  init_define_KHALA_BUNDLE
73
- } from "./chunk-7R3EIDGR.mjs";
73
+ } from "./chunk-LDW4HOQW.mjs";
74
74
 
75
75
  // src/local/cli.ts
76
76
  init_define_KHALA_BUNDLE();
@@ -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-BVG7PJNZ.mjs";
7
+ import "./chunk-4PUNVPC3.mjs";
8
+ import "./chunk-NOKTVPSY.mjs";
9
+ import "./chunk-CXVANPY5.mjs";
10
+ import "./chunk-N6UYX3SY.mjs";
11
+ import "./chunk-VWWI4S5A.mjs";
12
+ import "./chunk-JNSB3E6C.mjs";
13
+ import "./chunk-TVQ4MSEI.mjs";
14
+ import "./chunk-LDW4HOQW.mjs";
15
+ export {
16
+ ADAPTERS,
17
+ adapterFor,
18
+ createAdapterRegistry
19
+ };