khala-cli 0.4.9 → 0.4.10
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/THIRD_PARTY_NOTICES.txt +28 -0
- package/dist/{chunk-NIX5F4LT.mjs → chunk-2AMWQ7RB.mjs} +330 -66
- package/dist/{chunk-PAJ4JJPV.mjs → chunk-3E5DH3Y6.mjs} +43 -6
- package/dist/{chunk-NGSYOVQ4.mjs → chunk-4BP7V3OP.mjs} +2 -2
- package/dist/{chunk-TEFOQXBK.mjs → chunk-4BZQ4GVW.mjs} +3 -3
- package/dist/{chunk-ITFD3JZS.mjs → chunk-5JSGA6OB.mjs} +424 -78
- package/dist/{chunk-QKWEZXR3.mjs → chunk-6AQVW5W7.mjs} +12 -4
- package/dist/{chunk-UK5GJO4Y.mjs → chunk-6J2PUM7L.mjs} +6 -5
- package/dist/{chunk-P3YIN7G7.mjs → chunk-6SUV3EW6.mjs} +11 -10
- package/dist/{chunk-GSZADJMW.mjs → chunk-ARIDZOTI.mjs} +309 -81
- package/dist/chunk-C2WEDMAF.mjs +15 -0
- package/dist/{chunk-DJM23SIU.mjs → chunk-CHC4VZF5.mjs} +7 -8
- package/dist/{chunk-BLCRVRIK.mjs → chunk-CKLCR5G4.mjs} +456 -87
- package/dist/{chunk-7R3EIDGR.mjs → chunk-EVT2DWNZ.mjs} +1 -1
- package/dist/{chunk-KMLXOPBQ.mjs → chunk-FJVVSKZ3.mjs} +4 -2
- package/dist/{chunk-3KDOTR54.mjs → chunk-G3NMB4PY.mjs} +1 -1
- package/dist/{chunk-SSO5RFOX.mjs → chunk-HHEZVPRR.mjs} +1 -1
- package/dist/{chunk-BV45NK7K.mjs → chunk-JKOJQTFT.mjs} +100 -6
- package/dist/{chunk-T7IL7V7Q.mjs → chunk-NDMFD5IM.mjs} +13 -10
- package/dist/{chunk-TANCKTDK.mjs → chunk-OEV5DFLW.mjs} +70 -5
- package/dist/{chunk-BEO7WIIM.mjs → chunk-OIZ4R5H7.mjs} +28 -8
- package/dist/{chunk-FZEH2IXZ.mjs → chunk-PJKI7SRI.mjs} +176 -26
- package/dist/{chunk-NPSQNCOY.mjs → chunk-PN25BUQ4.mjs} +13 -4
- package/dist/{chunk-3R6HFSLL.mjs → chunk-QDPJ4VT2.mjs} +92 -38
- package/dist/{chunk-FO5GXCST.mjs → chunk-SRZTHCXP.mjs} +5 -5
- package/dist/{chunk-LBT47HLZ.mjs → chunk-TSK3HJEG.mjs} +10 -9
- package/dist/{chunk-6BO3JSUP.mjs → chunk-UX34IVN5.mjs} +2 -2
- package/dist/{chunk-V4F3SYKW.mjs → chunk-VAC3JTAV.mjs} +25 -17
- package/dist/{chunk-PDZ5Z5ZE.mjs → chunk-VDZK4LW3.mjs} +24 -9
- package/dist/chunk-W6HM6F2U.mjs +901 -0
- package/dist/{chunk-WDOHRV3D.mjs → chunk-WPNMWNCL.mjs} +14 -14
- package/dist/chunk-WUDXHF2Q.mjs +14 -0
- package/dist/{chunk-XBQDIKB5.mjs → chunk-WZJ6DQJV.mjs} +9 -8
- package/dist/{chunk-ANSR4IAW.mjs → chunk-XR625T3I.mjs} +2 -2
- package/dist/{chunk-K7V7X6WU.mjs → chunk-ZSKLNZWZ.mjs} +21 -4
- package/dist/iterm2_send.py +56 -0
- package/dist/khala.mjs +11 -11
- package/dist/web/assets/local-CSPuGnH2.css +1 -0
- package/dist/web/assets/local-Dtyxaacx.js +9 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/chunk-47XNLAJG.mjs +0 -38
- package/dist/chunk-XUCWSYVS.mjs +0 -148
- package/dist/web/assets/local-CFzRHZpB.js +0 -9
- package/dist/web/assets/local-ciypUFoK.css +0 -1
package/dist/web/index.html
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
<link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon-32x32-B9Ubw1Dx.png" />
|
|
11
11
|
<link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon-16x16-D5waNSZD.png" />
|
|
12
12
|
<link rel="apple-touch-icon" sizes="180x180" href="/assets/apple-touch-icon-Du9V6qit.png" />
|
|
13
|
-
<script type="module" crossorigin src="/assets/local-
|
|
14
|
-
<link rel="stylesheet" crossorigin href="/assets/local-
|
|
13
|
+
<script type="module" crossorigin src="/assets/local-Dtyxaacx.js"></script>
|
|
14
|
+
<link rel="stylesheet" crossorigin href="/assets/local-CSPuGnH2.css">
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
|
17
17
|
<div id="app"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "khala-cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.10",
|
|
4
4
|
"description": "Khala channels for Claude Code, Codex and Cursor sessions: the khala MCP server, delivery hooks and local channels.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/aiur-team/khala/tree/main/packages/agent#readme",
|
package/dist/chunk-47XNLAJG.mjs
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
decodeChannelEvent,
|
|
4
|
-
formatChannelEventLine
|
|
5
|
-
} from "./chunk-BV45NK7K.mjs";
|
|
6
|
-
import {
|
|
7
|
-
init_define_KHALA_BUNDLE
|
|
8
|
-
} from "./chunk-7R3EIDGR.mjs";
|
|
9
|
-
|
|
10
|
-
// src/events/receive.ts
|
|
11
|
-
init_define_KHALA_BUNDLE();
|
|
12
|
-
function toEventInboxEntry(base, rawContent) {
|
|
13
|
-
const decoded = decodeChannelEvent(rawContent);
|
|
14
|
-
if (!decoded.ok) return null;
|
|
15
|
-
const content = decoded.value;
|
|
16
|
-
return {
|
|
17
|
-
entry: { ...base, kind: "event", body: formatChannelEventLine(content) + (content.url ? " " + content.url : "") },
|
|
18
|
-
...content.key !== void 0 ? { key: content.key } : {}
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
function createEventKeyFilter() {
|
|
22
|
-
const seen = /* @__PURE__ */ new Set();
|
|
23
|
-
return (key) => {
|
|
24
|
-
if (key === void 0) return true;
|
|
25
|
-
if (seen.has(key)) return false;
|
|
26
|
-
seen.add(key);
|
|
27
|
-
return true;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function isWakeEntry(entry) {
|
|
31
|
-
return entry.kind === "message";
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export {
|
|
35
|
-
toEventInboxEntry,
|
|
36
|
-
createEventKeyFilter,
|
|
37
|
-
isWakeEntry
|
|
38
|
-
};
|
package/dist/chunk-XUCWSYVS.mjs
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
adapterFor
|
|
4
|
-
} from "./chunk-ITFD3JZS.mjs";
|
|
5
|
-
import {
|
|
6
|
-
readWakeSettings
|
|
7
|
-
} from "./chunk-NIX5F4LT.mjs";
|
|
8
|
-
import {
|
|
9
|
-
HARNESS_REGISTRY,
|
|
10
|
-
filesForDir,
|
|
11
|
-
readStateFile,
|
|
12
|
-
stateRoot
|
|
13
|
-
} from "./chunk-NPSQNCOY.mjs";
|
|
14
|
-
import {
|
|
15
|
-
readWakeState
|
|
16
|
-
} from "./chunk-K7V7X6WU.mjs";
|
|
17
|
-
import {
|
|
18
|
-
init_define_KHALA_BUNDLE
|
|
19
|
-
} from "./chunk-7R3EIDGR.mjs";
|
|
20
|
-
|
|
21
|
-
// src/wake/status.ts
|
|
22
|
-
init_define_KHALA_BUNDLE();
|
|
23
|
-
import path from "node:path";
|
|
24
|
-
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.";
|
|
25
|
-
var WAKE_STATES = {
|
|
26
|
-
active: { reason: "Idle wake is on.", remedy: "" },
|
|
27
|
-
needs_consent: { reason: "Idle wake needs consent.", remedy: "khala wake on --driver <d>" },
|
|
28
|
-
unavailable: { reason: "No remote-control API is available.", remedy: "", reasons: {
|
|
29
|
-
wake_status_unavailable: "Wake status is unavailable.",
|
|
30
|
-
queue_missing: "Codex queue is missing.",
|
|
31
|
-
codex_binary_missing: "Codex queue is missing.",
|
|
32
|
-
codex_queue_unavailable: "Codex queue is unavailable.",
|
|
33
|
-
nonce_timeout: "The wake verification deadline passed.",
|
|
34
|
-
windows: "Windows has no supported remote-control API.",
|
|
35
|
-
driver_missing: "No wake driver is installed for this transport.",
|
|
36
|
-
monitor_missing: "The Muse monitor is not armed; start monitor on khala watch with persistent: true, wake_delay_ms: 0, show_lines: true.",
|
|
37
|
-
watcher_missing: "The Claude watcher is not armed.",
|
|
38
|
-
terminal_aborted: "The terminal wake check was cancelled.",
|
|
39
|
-
terminal_unavailable_on_platform: "This platform has no supported terminal remote-control API.",
|
|
40
|
-
terminal_empty_prompt_unavailable: "This harness has no verified empty-prompt pattern.",
|
|
41
|
-
terminal_consent_required: "Terminal wake needs consent; run khala wake on --driver terminal.",
|
|
42
|
-
terminal_capture_pending_prompt: "Terminal capture is pending; send the first Codex prompt.",
|
|
43
|
-
"no remote-control API": "No terminal remote-control API is available.",
|
|
44
|
-
terminal_not_idle: "The agent must be idle for at least 30 seconds before a terminal wake.",
|
|
45
|
-
terminal_agent_exited: "The captured agent process has exited or changed.",
|
|
46
|
-
terminal_pane_unsafe: "The terminal pane is unavailable or its input mode is unsafe.",
|
|
47
|
-
terminal_pane_not_owned: "The agent does not own the terminal pane foreground process group.",
|
|
48
|
-
terminal_prompt_not_empty: "The terminal prompt contains a draft or its cursor has moved.",
|
|
49
|
-
terminal_probe_failed: "The terminal remote-control check failed.",
|
|
50
|
-
wezterm_pane_missing: "The captured WezTerm pane is no longer available.",
|
|
51
|
-
wezterm_tty_unavailable: "WezTerm did not report the pane terminal device; ownership cannot be verified.",
|
|
52
|
-
wezterm_cursor_unavailable: "WezTerm did not report the cursor position; an empty prompt cannot be verified."
|
|
53
|
-
} },
|
|
54
|
-
disabled: { reason: "Idle wake is off.", remedy: "khala wake on --driver <d>" },
|
|
55
|
-
disabled_after_failures: { reason: "Idle wake was disabled after two unverified wakes.", remedy: "khala wake on --driver <d>" },
|
|
56
|
-
lapsed: { reason: "The Claude watcher passed its deadline; any prompt re-arms it.", remedy: "Send any prompt to re-arm the watcher." },
|
|
57
|
-
none_by_design: { reason: "The generic tier has no idle wake by design.", remedy: "" }
|
|
58
|
-
};
|
|
59
|
-
function wakeStatusText(driver, state, unavailableReason) {
|
|
60
|
-
const text = WAKE_STATES[state];
|
|
61
|
-
return { driver, state, reason: state === "unavailable" && unavailableReason ? WAKE_STATES.unavailable.reasons[unavailableReason] : text.reason, ...text.remedy ? { remedy: text.remedy.replace("<d>", driver) } : {} };
|
|
62
|
-
}
|
|
63
|
-
function wakeDrivers(harness) {
|
|
64
|
-
const adapter = adapterFor(harness);
|
|
65
|
-
const drivers = (adapter?.wakeLadder ?? []).map((driver) => ({ ...driver, runtime: driver }));
|
|
66
|
-
for (const driver of adapter?.wakeConsentDrivers ?? []) if (!drivers.some((item) => item.id === driver.id)) drivers.push(driver);
|
|
67
|
-
if (harness === "claude" && !drivers.some((driver) => driver.id === "watcher")) drivers.unshift({ id: "watcher", rung: 2, optIn: false });
|
|
68
|
-
return drivers.sort((a, b) => a.rung - b.rung);
|
|
69
|
-
}
|
|
70
|
-
function watcherAlive(pid) {
|
|
71
|
-
if (typeof pid !== "number" || !Number.isSafeInteger(pid) || pid <= 0) return false;
|
|
72
|
-
try {
|
|
73
|
-
process.kill(pid, 0);
|
|
74
|
-
return true;
|
|
75
|
-
} catch (error) {
|
|
76
|
-
return error.code === "EPERM";
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
async function wakeStatus(harness, options = {}) {
|
|
80
|
-
const env = options.env ?? process.env;
|
|
81
|
-
const settings = await readWakeSettings(stateRoot(env));
|
|
82
|
-
const states = options.files ? await readWakeState(options.files.dir) : {};
|
|
83
|
-
const drivers = wakeDrivers(harness);
|
|
84
|
-
if (!drivers.length) return [{ harness, rung: 0, ...wakeStatusText("none", harness === "generic" ? "none_by_design" : "unavailable", harness === "generic" ? void 0 : "driver_missing") }];
|
|
85
|
-
const rows = [];
|
|
86
|
-
for (const driver of drivers) {
|
|
87
|
-
const key = `${harness}/${driver.id}`;
|
|
88
|
-
let state;
|
|
89
|
-
let unavailableReason;
|
|
90
|
-
if (Object.hasOwn(settings.off, key)) state = "disabled";
|
|
91
|
-
else if (states[driver.id]?.disabled) state = "disabled_after_failures";
|
|
92
|
-
else if (driver.optIn && !Object.hasOwn(settings.consent, key)) state = "needs_consent";
|
|
93
|
-
else if (driver.id === "watcher") {
|
|
94
|
-
const watcher = options.files ? await readStateFile(options.files.dir, "watcher.json") : null;
|
|
95
|
-
state = watcher?.state === "expired" ? "lapsed" : watcher?.state === "armed" && watcherAlive(watcher.pid) ? "active" : "unavailable";
|
|
96
|
-
if (state === "unavailable") unavailableReason = "watcher_missing";
|
|
97
|
-
} else if (driver.runtime) {
|
|
98
|
-
const files = options.files ?? filesForDir(path.join(stateRoot(env), harness, "status"));
|
|
99
|
-
const ctx = { files, harness, sessionId: options.sessionId ?? "status", env, signal: new AbortController().signal, now: Date.now() };
|
|
100
|
-
const available = await driver.runtime.available(ctx);
|
|
101
|
-
state = available ? "active" : "unavailable";
|
|
102
|
-
if (!available) {
|
|
103
|
-
const reason = await driver.runtime.unavailableReason?.(ctx);
|
|
104
|
-
if (reason && Object.hasOwn(WAKE_STATES.unavailable.reasons, reason)) unavailableReason = reason;
|
|
105
|
-
}
|
|
106
|
-
} else {
|
|
107
|
-
state = "unavailable";
|
|
108
|
-
unavailableReason = process.platform === "win32" && driver.id === "terminal" ? "windows" : "driver_missing";
|
|
109
|
-
}
|
|
110
|
-
rows.push({
|
|
111
|
-
harness,
|
|
112
|
-
rung: driver.rung,
|
|
113
|
-
...wakeStatusText(driver.id, state, unavailableReason),
|
|
114
|
-
...harness === "codex" && driver.id === "queue" ? { note: CODEX_DAEMON_WAKE_NOTE } : {}
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
return rows;
|
|
118
|
-
}
|
|
119
|
-
function selectedWakeStatus(rows) {
|
|
120
|
-
const row = rows.find((item) => item.state === "active") ?? rows[0];
|
|
121
|
-
const { driver, state, reason, remedy, note } = row;
|
|
122
|
-
return { driver, state, reason, ...remedy ? { remedy } : {}, ...note ? { note } : {} };
|
|
123
|
-
}
|
|
124
|
-
var WAKE_HARNESSES = HARNESS_REGISTRY.map((row) => row.id);
|
|
125
|
-
async function wakeDisableNotice(dir) {
|
|
126
|
-
const { takeWakeDisableNotices } = await import("./chunk-KMLXOPBQ.mjs");
|
|
127
|
-
let drivers;
|
|
128
|
-
try {
|
|
129
|
-
const states = await readWakeState(dir);
|
|
130
|
-
if (!Object.values(states).some((state) => state.disabled && !state.noticeShown)) return void 0;
|
|
131
|
-
drivers = await takeWakeDisableNotices(dir);
|
|
132
|
-
} catch {
|
|
133
|
-
return void 0;
|
|
134
|
-
}
|
|
135
|
-
return drivers.length ? drivers.map((driver) => {
|
|
136
|
-
const status = wakeStatusText(driver, "disabled_after_failures");
|
|
137
|
-
return `Idle wake (${driver}): ${status.reason} Run \`${status.remedy}\` to re-enable it.`;
|
|
138
|
-
}).join("\n") : void 0;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export {
|
|
142
|
-
wakeStatusText,
|
|
143
|
-
wakeDrivers,
|
|
144
|
-
wakeStatus,
|
|
145
|
-
selectedWakeStatus,
|
|
146
|
-
WAKE_HARNESSES,
|
|
147
|
-
wakeDisableNotice
|
|
148
|
-
};
|