khala-cli 0.3.0 → 0.4.0
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/README.md +15 -1
- package/dist/{chunk-ZRUF3P53.mjs → chunk-3WTRQEVS.mjs} +4 -4
- package/dist/{chunk-FGIU3YO2.mjs → chunk-3YSVED2R.mjs} +163 -9
- package/dist/{chunk-CTXFYQIX.mjs → chunk-7272YXO6.mjs} +6 -6
- package/dist/{chunk-6GOETMWV.mjs → chunk-AAX35R7C.mjs} +3 -3
- package/dist/{chunk-S6XASSNU.mjs → chunk-AYPFL33Q.mjs} +27 -9
- package/dist/{chunk-MGXWUWWP.mjs → chunk-BNT6YPFR.mjs} +21 -14
- package/dist/{chunk-Y3TDVOGT.mjs → chunk-ENNXMNKZ.mjs} +1 -1
- package/dist/{chunk-PQO6675G.mjs → chunk-G3SVNU4N.mjs} +70 -5
- package/dist/{chunk-HWKLLI7F.mjs → chunk-H2INZPFK.mjs} +10 -9
- package/dist/{chunk-525XNG6V.mjs → chunk-IKHXRKJQ.mjs} +1 -1
- package/dist/{chunk-4C2TBZVA.mjs → chunk-IVPQJSFO.mjs} +2 -2
- package/dist/{chunk-H2JCKPFR.mjs → chunk-K2SZLOBE.mjs} +2 -2
- package/dist/{chunk-HMGN52QY.mjs → chunk-NX27G3SB.mjs} +1 -1
- package/dist/{chunk-GO5DD2TR.mjs → chunk-SMCTSZYU.mjs} +4 -3
- package/dist/{chunk-UYTGV6TW.mjs → chunk-THNGKHZD.mjs} +6 -5
- package/dist/chunk-VUE2DDYY.mjs +34 -0
- package/dist/{chunk-6FNXMYOM.mjs → chunk-ZXJIFFFU.mjs} +1 -1
- package/dist/khala.mjs +9 -9
- package/dist/web/assets/local-CzaQ3d5Z.js +9 -0
- package/dist/web/assets/local-DHYvcQG0.css +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +3 -3
- package/dist/web/assets/local-DuGvSGji.css +0 -1
- package/dist/web/assets/local-hWRGqoWt.js +0 -9
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
CHANNEL_EVENT_TYPE,
|
|
4
4
|
LISTENING_MODE_COMMAND_TYPE,
|
|
5
5
|
LISTENING_MODE_MEMBER_KEY
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-SMCTSZYU.mjs";
|
|
7
|
+
import "./chunk-ZXJIFFFU.mjs";
|
|
8
8
|
|
|
9
9
|
// src/matrix/session.ts
|
|
10
10
|
import { createClient, ClientEvent, RoomEvent, MatrixEventEvent, SyncState, Direction, Method, EventType } from "matrix-js-sdk";
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
filesForDir,
|
|
5
5
|
readJson,
|
|
6
6
|
writeJsonAtomic
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-AYPFL33Q.mjs";
|
|
8
8
|
import {
|
|
9
9
|
DEFAULT_LISTENING_MODE,
|
|
10
10
|
decodeChannelEvent,
|
|
11
11
|
decodeListeningMode,
|
|
12
12
|
formatChannelEventLine
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-SMCTSZYU.mjs";
|
|
14
14
|
|
|
15
15
|
// src/inbox.ts
|
|
16
16
|
import * as fs from "node:fs/promises";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
define_KHALA_BUNDLE_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZXJIFFFU.mjs";
|
|
5
5
|
|
|
6
6
|
// src/bundle.ts
|
|
7
7
|
var bundle = typeof define_KHALA_BUNDLE_default === "undefined" ? void 0 : define_KHALA_BUNDLE_default;
|
|
@@ -212,7 +212,7 @@ function validateAgentName(input) {
|
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
// ../contracts/src/m1/agent-join.ts
|
|
215
|
-
var HARNESSES = ["claude", "codex"];
|
|
215
|
+
var HARNESSES = ["claude", "codex", "cursor"];
|
|
216
216
|
var M1_LABEL_MAX_BYTES = 512;
|
|
217
217
|
var agentConfirmPagePath = (id) => `/agent/confirm?joinId=${encodeURIComponent(id)}`;
|
|
218
218
|
function readHarness(input, path) {
|
|
@@ -403,8 +403,6 @@ function statusFor(content) {
|
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
export {
|
|
406
|
-
LISTENING_MODES,
|
|
407
|
-
decodeListeningMode,
|
|
408
406
|
fail2 as fail,
|
|
409
407
|
decodeWith2 as decodeWith,
|
|
410
408
|
object2 as object,
|
|
@@ -423,12 +421,15 @@ export {
|
|
|
423
421
|
utcTimestamp2 as utcTimestamp,
|
|
424
422
|
reserved,
|
|
425
423
|
validateAgentName,
|
|
424
|
+
HARNESSES,
|
|
426
425
|
M1_LABEL_MAX_BYTES,
|
|
427
426
|
agentConfirmPagePath,
|
|
428
427
|
readHarness,
|
|
429
428
|
readHttpUrl,
|
|
430
429
|
readMatrixUserId,
|
|
431
430
|
readRoomId,
|
|
431
|
+
LISTENING_MODES,
|
|
432
|
+
decodeListeningMode,
|
|
432
433
|
LISTENING_MODE_COMMAND_TYPE,
|
|
433
434
|
LISTENING_MODE_MEMBER_KEY,
|
|
434
435
|
DEFAULT_LISTENING_MODE,
|
|
@@ -4,16 +4,17 @@ import {
|
|
|
4
4
|
MODEL_NAMES,
|
|
5
5
|
checkName,
|
|
6
6
|
isDefaultAgentName
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-AAX35R7C.mjs";
|
|
8
8
|
import {
|
|
9
9
|
StateError,
|
|
10
10
|
readJson,
|
|
11
11
|
stateRoot,
|
|
12
12
|
writeJsonAtomic
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-AYPFL33Q.mjs";
|
|
14
14
|
import {
|
|
15
|
+
HARNESSES,
|
|
15
16
|
validateAgentName
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-SMCTSZYU.mjs";
|
|
17
18
|
|
|
18
19
|
// src/local/identity.ts
|
|
19
20
|
import * as fs from "node:fs/promises";
|
|
@@ -36,7 +37,7 @@ async function ensurePrivateRoot(root) {
|
|
|
36
37
|
if (error.code !== "EEXIST") throw error;
|
|
37
38
|
}
|
|
38
39
|
const stat = await fs.lstat(root);
|
|
39
|
-
if (!stat.isDirectory() || stat.isSymbolicLink() || (stat.mode & 63) !== 0 || typeof process.getuid === "function" && stat.uid !== process.getuid()) throw new StateError("unsafe_state_dir");
|
|
40
|
+
if (!stat.isDirectory() || stat.isSymbolicLink() || process.platform !== "win32" && (stat.mode & 63) !== 0 || typeof process.getuid === "function" && stat.uid !== process.getuid()) throw new StateError("unsafe_state_dir");
|
|
40
41
|
} catch (error) {
|
|
41
42
|
if (error instanceof StateError) throw error;
|
|
42
43
|
throw new StateError("storage_failed");
|
|
@@ -138,7 +139,7 @@ async function post(url, origin, body, deps, pollSecret) {
|
|
|
138
139
|
async function requestJoin(input, deps = {}) {
|
|
139
140
|
const parsed = parseChannelLink(input.link);
|
|
140
141
|
if (!parsed) throw new KhalaClientError("invalid_link", "invalid_link");
|
|
141
|
-
if (
|
|
142
|
+
if (!HARNESSES.includes(input.harness)) fail("invalid_harness");
|
|
142
143
|
const label = validateAgentName(input.label);
|
|
143
144
|
if (!label.ok || [...label.name].length > 40) fail("invalid_label");
|
|
144
145
|
const { origin } = parsed;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/cursor.ts
|
|
4
|
+
import { createHash } from "node:crypto";
|
|
5
|
+
var CURSOR_WORKSPACE_ENV = "KHALA_CURSOR_WORKSPACE";
|
|
6
|
+
var CURSOR_DEFAULT_SESSION = "cursor-default";
|
|
7
|
+
function normalizeWorkspace(root) {
|
|
8
|
+
let value = root.trim();
|
|
9
|
+
if (!value || value.includes("${")) return null;
|
|
10
|
+
if (/^file:\/\//iu.test(value)) {
|
|
11
|
+
try {
|
|
12
|
+
value = decodeURIComponent(new URL(value).pathname);
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
value = value.replaceAll("\\", "/");
|
|
18
|
+
if (/^\/[A-Za-z]:(?:\/|$)/u.test(value)) value = value.slice(1);
|
|
19
|
+
if (/^[A-Za-z]:(?:\/|$)/u.test(value)) value = value.toLowerCase();
|
|
20
|
+
value = value.replace(/\/+$/u, "");
|
|
21
|
+
if (/^[a-z]:$/u.test(value)) value += "/";
|
|
22
|
+
return value || null;
|
|
23
|
+
}
|
|
24
|
+
function cursorSessionId(root) {
|
|
25
|
+
const normalized = typeof root === "string" ? normalizeWorkspace(root) : null;
|
|
26
|
+
if (normalized === null) return CURSOR_DEFAULT_SESSION;
|
|
27
|
+
return `ws-${createHash("sha256").update(normalized).digest("hex").slice(0, 32)}`;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
CURSOR_WORKSPACE_ENV,
|
|
32
|
+
CURSOR_DEFAULT_SESSION,
|
|
33
|
+
cursorSessionId
|
|
34
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __khalaCreateRequire } from 'node:module'; const require = __khalaCreateRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// <define:__KHALA_BUNDLE__>
|
|
4
|
-
var define_KHALA_BUNDLE_default = { name: "khala-cli", version: "0.
|
|
4
|
+
var define_KHALA_BUNDLE_default = { name: "khala-cli", version: "0.4.0" };
|
|
5
5
|
|
|
6
6
|
export {
|
|
7
7
|
define_KHALA_BUNDLE_default
|
package/dist/khala.mjs
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
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-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-ENNXMNKZ.mjs";
|
|
6
|
+
import "./chunk-NX27G3SB.mjs";
|
|
7
|
+
import "./chunk-ZXJIFFFU.mjs";
|
|
8
8
|
|
|
9
9
|
// src/cli.ts
|
|
10
10
|
var HOOK_NAME = /^[a-z][a-z0-9-]{0,31}$/;
|
|
11
11
|
var STDIN_CAP = 1024 * 1024;
|
|
12
|
-
var USAGE = "usage: khala mcp | khala hook <name> | khala local <command> | khala install codex | khala --version";
|
|
12
|
+
var USAGE = "usage: khala mcp | khala hook <name> | khala local <command> | khala install codex | khala install cursor | khala --version";
|
|
13
13
|
async function readStdin() {
|
|
14
14
|
if (process.stdin.isTTY) return "";
|
|
15
15
|
const chunks = [];
|
|
@@ -78,12 +78,12 @@ async function runCli(argv, modules) {
|
|
|
78
78
|
|
|
79
79
|
// src/cli-bundle.ts
|
|
80
80
|
var hooks = {
|
|
81
|
-
deliver: () => import("./chunk-
|
|
82
|
-
"claude-wake": () => import("./chunk-
|
|
81
|
+
deliver: () => import("./chunk-G3SVNU4N.mjs"),
|
|
82
|
+
"claude-wake": () => import("./chunk-IKHXRKJQ.mjs")
|
|
83
83
|
};
|
|
84
84
|
process.exitCode = await runCli(process.argv.slice(2), {
|
|
85
|
-
mcp: () => () => import("./chunk-
|
|
86
|
-
local: () => () => import("./chunk-
|
|
87
|
-
install: () => () => import("./chunk-
|
|
85
|
+
mcp: () => () => import("./chunk-BNT6YPFR.mjs"),
|
|
86
|
+
local: () => () => import("./chunk-H2INZPFK.mjs"),
|
|
87
|
+
install: () => () => import("./chunk-3YSVED2R.mjs"),
|
|
88
88
|
hook: (name) => Object.hasOwn(hooks, name) ? hooks[name] : void 0
|
|
89
89
|
});
|