@kombai/cli 0.1.2 → 0.1.4-beta.1
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/kombai.mjs +543 -170
- package/dist/mcp-apps/design-taste.js +142 -142
- package/dist/mcp-apps/plans.js +92 -92
- package/dist/mcp-apps/sign-in.js +78 -78
- package/dist/mcp-apps/starters.js +2615 -0
- package/package.json +1 -1
package/dist/kombai.mjs
CHANGED
|
@@ -829,9 +829,9 @@ function buildCanvasDownload(read2, bodies) {
|
|
|
829
829
|
const swaps = /* @__PURE__ */ new Map();
|
|
830
830
|
const nodeAssets = [];
|
|
831
831
|
for (const image of files.images ?? []) {
|
|
832
|
-
const
|
|
833
|
-
swaps.set(image.path, `${LOCAL_IMAGES_PREFIX}${
|
|
834
|
-
nodeAssets.push({ path:
|
|
832
|
+
const path26 = downloadAssetPathOf(image);
|
|
833
|
+
swaps.set(image.path, `${LOCAL_IMAGES_PREFIX}${path26}`);
|
|
834
|
+
nodeAssets.push({ path: path26, url: image.url, contentType: image.contentType });
|
|
835
835
|
}
|
|
836
836
|
const body = bodies[nodeId] ?? {};
|
|
837
837
|
const node = downloadNodeOf(lite, body, swaps);
|
|
@@ -882,8 +882,8 @@ function zipCanvasDownload(download, files) {
|
|
|
882
882
|
const parsed = Date.parse(download.modified);
|
|
883
883
|
const mtime = Number.isFinite(parsed) ? parsed : FALLBACK_ENTRY_TIME;
|
|
884
884
|
const entries = {};
|
|
885
|
-
for (const [
|
|
886
|
-
entries[
|
|
885
|
+
for (const [path26, bytes] of Object.entries(files).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)) {
|
|
886
|
+
entries[path26] = [bytes, { level: entryLevel(path26), mtime }];
|
|
887
887
|
}
|
|
888
888
|
return zipSync(entries);
|
|
889
889
|
}
|
|
@@ -993,7 +993,7 @@ var init_canvas_download = __esm({
|
|
|
993
993
|
}
|
|
994
994
|
};
|
|
995
995
|
escapeForRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
996
|
-
entryLevel = (
|
|
996
|
+
entryLevel = (path26) => path26.endsWith(".canvas") || path26.endsWith(".svg") ? 6 : 0;
|
|
997
997
|
}
|
|
998
998
|
});
|
|
999
999
|
|
|
@@ -1557,9 +1557,9 @@ var init_env = __esm({
|
|
|
1557
1557
|
preprod: { api: "https://api.assistant.preprod.kombai.com", web: "https://agent.preprod.kombai.com" },
|
|
1558
1558
|
prod: { api: "https://api.assistant.app.kombai.com", web: "https://agent.kombai.com" }
|
|
1559
1559
|
});
|
|
1560
|
-
DEFAULT_ENV = Object.hasOwn(ENVIRONMENTS, "
|
|
1560
|
+
DEFAULT_ENV = Object.hasOwn(ENVIRONMENTS, "preprod") ? (
|
|
1561
1561
|
/** @type {EnvName} */
|
|
1562
|
-
"
|
|
1562
|
+
"preprod"
|
|
1563
1563
|
) : "prod";
|
|
1564
1564
|
}
|
|
1565
1565
|
});
|
|
@@ -1762,11 +1762,11 @@ var init_version = __esm({
|
|
|
1762
1762
|
"src/lib/version.js"() {
|
|
1763
1763
|
"use strict";
|
|
1764
1764
|
init_define_KOMBAI_TELEMETRY();
|
|
1765
|
-
CLI_VERSION = true ? "0.1.
|
|
1765
|
+
CLI_VERSION = true ? "0.1.4-beta.1" : (
|
|
1766
1766
|
/** @type {{ version: string }} */
|
|
1767
1767
|
JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8")).version
|
|
1768
1768
|
);
|
|
1769
|
-
CLI_RUN = true ? "npx -y @kombai/cli@
|
|
1769
|
+
CLI_RUN = true ? "npx -y @kombai/cli@beta" : "npx -y @kombai/cli@latest";
|
|
1770
1770
|
}
|
|
1771
1771
|
});
|
|
1772
1772
|
|
|
@@ -1793,7 +1793,7 @@ function retryAfterMs(value) {
|
|
|
1793
1793
|
const at = Date.parse(value ?? "");
|
|
1794
1794
|
return Number.isFinite(at) ? Math.max(0, at - Date.now()) : 2e3;
|
|
1795
1795
|
}
|
|
1796
|
-
function apiError(status, body, method,
|
|
1796
|
+
function apiError(status, body, method, path26) {
|
|
1797
1797
|
const {
|
|
1798
1798
|
errorCode,
|
|
1799
1799
|
apiMessage,
|
|
@@ -1807,7 +1807,7 @@ function apiError(status, body, method, path25) {
|
|
|
1807
1807
|
...extras
|
|
1808
1808
|
};
|
|
1809
1809
|
const code2 = typeof errorCode === "string" ? errorCode : `HTTP_${status}`;
|
|
1810
|
-
const message = code2 === "DESIGN_NOT_FOUND" && rest.what === "canvas" ? PRIVATE_CANVAS : typeof apiMessage === "string" && apiMessage ? apiMessage : `${method} ${
|
|
1810
|
+
const message = code2 === "DESIGN_NOT_FOUND" && rest.what === "canvas" ? PRIVATE_CANVAS : typeof apiMessage === "string" && apiMessage ? apiMessage : `${method} ${path26} answered ${status}.`;
|
|
1811
1811
|
const guestRow = GUEST_ERRORS[code2];
|
|
1812
1812
|
const needsLogin = status === 401 || guestRow !== void 0;
|
|
1813
1813
|
const text = guestRow?.message?.(rest, typeof apiMessage === "string" ? apiMessage : "") ?? message;
|
|
@@ -1820,8 +1820,8 @@ function apiError(status, body, method, path25) {
|
|
|
1820
1820
|
details: Object.keys(rest).length ? rest : void 0
|
|
1821
1821
|
});
|
|
1822
1822
|
}
|
|
1823
|
-
function timedOut(method,
|
|
1824
|
-
return new CliError("CLI_TIMEOUT", `The command's deadline passed during ${method} ${
|
|
1823
|
+
function timedOut(method, path26) {
|
|
1824
|
+
return new CliError("CLI_TIMEOUT", `The command's deadline passed during ${method} ${path26}.`, {
|
|
1825
1825
|
exit: Exit.TIMED_OUT
|
|
1826
1826
|
});
|
|
1827
1827
|
}
|
|
@@ -1856,10 +1856,10 @@ var init_api = __esm({
|
|
|
1856
1856
|
* @param {string} path
|
|
1857
1857
|
* @param {number | undefined} status
|
|
1858
1858
|
*/
|
|
1859
|
-
constructor(method,
|
|
1860
|
-
super("CLI_NETWORK", `${method} ${
|
|
1859
|
+
constructor(method, path26, status) {
|
|
1860
|
+
super("CLI_NETWORK", `${method} ${path26} got no usable answer${status ? ` (${status})` : ""}.`, {
|
|
1861
1861
|
status,
|
|
1862
|
-
details: { method, path:
|
|
1862
|
+
details: { method, path: path26 }
|
|
1863
1863
|
});
|
|
1864
1864
|
this.lost = true;
|
|
1865
1865
|
}
|
|
@@ -1894,9 +1894,9 @@ var init_api = __esm({
|
|
|
1894
1894
|
* @returns {Promise<ApiResponse>}
|
|
1895
1895
|
*/
|
|
1896
1896
|
async call(options) {
|
|
1897
|
-
const { method, path:
|
|
1897
|
+
const { method, path: path26, retry = "safe" } = options;
|
|
1898
1898
|
const deadline = options.deadline ?? this.deadline;
|
|
1899
|
-
const url2 = `${this.baseUrl}${
|
|
1899
|
+
const url2 = `${this.baseUrl}${path26}${queryString(options.query)}`;
|
|
1900
1900
|
const headers = {
|
|
1901
1901
|
"x-kombai-cli": this.ctx.version,
|
|
1902
1902
|
"x-type": "agent",
|
|
@@ -1910,7 +1910,7 @@ var init_api = __esm({
|
|
|
1910
1910
|
let lostTries = 0;
|
|
1911
1911
|
for (; ; ) {
|
|
1912
1912
|
const limit = deadline.clamp(CALL_LIMIT_MS);
|
|
1913
|
-
if (limit <= 0) throw timedOut(method,
|
|
1913
|
+
if (limit <= 0) throw timedOut(method, path26);
|
|
1914
1914
|
let res;
|
|
1915
1915
|
if (method !== "GET") this.ctx.changeSent = true;
|
|
1916
1916
|
try {
|
|
@@ -1924,12 +1924,12 @@ var init_api = __esm({
|
|
|
1924
1924
|
} catch (error3) {
|
|
1925
1925
|
const blocked = blockedRequest(this.ctx.sandbox, error3);
|
|
1926
1926
|
if (blocked) throw blocked;
|
|
1927
|
-
if (deadline.expired()) throw timedOut(method,
|
|
1927
|
+
if (deadline.expired()) throw timedOut(method, path26);
|
|
1928
1928
|
if (retry === "safe" && lostTries < LOST_ANSWER_BACKOFF_MS.length) {
|
|
1929
|
-
await this.wait(LOST_ANSWER_BACKOFF_MS[lostTries++], deadline, method,
|
|
1929
|
+
await this.wait(LOST_ANSWER_BACKOFF_MS[lostTries++], deadline, method, path26);
|
|
1930
1930
|
continue;
|
|
1931
1931
|
}
|
|
1932
|
-
throw new LostAnswer(method,
|
|
1932
|
+
throw new LostAnswer(method, path26, void 0);
|
|
1933
1933
|
}
|
|
1934
1934
|
this.checkContractVersion(res.headers);
|
|
1935
1935
|
const parsed = await readBody(res);
|
|
@@ -1943,17 +1943,17 @@ var init_api = __esm({
|
|
|
1943
1943
|
}
|
|
1944
1944
|
if (UNKNOWN_OUTCOME_STATUSES.has(res.status)) {
|
|
1945
1945
|
if (retry === "safe" && lostTries < LOST_ANSWER_BACKOFF_MS.length) {
|
|
1946
|
-
await this.wait(LOST_ANSWER_BACKOFF_MS[lostTries++], deadline, method,
|
|
1946
|
+
await this.wait(LOST_ANSWER_BACKOFF_MS[lostTries++], deadline, method, path26);
|
|
1947
1947
|
continue;
|
|
1948
1948
|
}
|
|
1949
|
-
if (retry === "once") throw new LostAnswer(method,
|
|
1949
|
+
if (retry === "once") throw new LostAnswer(method, path26, res.status);
|
|
1950
1950
|
}
|
|
1951
1951
|
if (res.ok) {
|
|
1952
1952
|
if (headers["x-kombai-guest"] && parsed?.guest === true && typeof parsed.guestExpiresAt === "string")
|
|
1953
1953
|
await this.onGuestExpires?.(parsed.guestExpiresAt);
|
|
1954
1954
|
return { status: res.status, body: parsed, headers: res.headers };
|
|
1955
1955
|
}
|
|
1956
|
-
const error2 = apiError(res.status, parsed, method,
|
|
1956
|
+
const error2 = apiError(res.status, parsed, method, path26);
|
|
1957
1957
|
if (res.status === 503 && res.headers.has("retry-after")) {
|
|
1958
1958
|
error2.details = { ...error2.details, retryAfter: res.headers.get("retry-after") };
|
|
1959
1959
|
}
|
|
@@ -2038,8 +2038,8 @@ var init_api = __esm({
|
|
|
2038
2038
|
* @param {string} method
|
|
2039
2039
|
* @param {string} path
|
|
2040
2040
|
*/
|
|
2041
|
-
async wait(ms, deadline, method,
|
|
2042
|
-
if (deadline.remaining() <= ms) throw timedOut(method,
|
|
2041
|
+
async wait(ms, deadline, method, path26) {
|
|
2042
|
+
if (deadline.remaining() <= ms) throw timedOut(method, path26);
|
|
2043
2043
|
await this.ctx.sleep(ms);
|
|
2044
2044
|
}
|
|
2045
2045
|
/** @param {Headers} headers */
|
|
@@ -3767,7 +3767,7 @@ var init_codex_app = __esm({
|
|
|
3767
3767
|
init_define_KOMBAI_TELEMETRY();
|
|
3768
3768
|
CODEX_DESKTOP_ORIGINATOR = "Codex Desktop";
|
|
3769
3769
|
FIND_CANVAS_APP = "ALL_TOOLS.filter((t) => t.name.endsWith('canvas_app'))";
|
|
3770
|
-
VIEW_MISSING = "If no canvas_app tool exists, Kombai's view
|
|
3770
|
+
VIEW_MISSING = "If no canvas_app tool exists, Kombai's view isn't set up in Codex yet: run `kombai mcp install codex` without asking, tell the user in one line, and continue in a new task (kombai skill opening). Show no link instead.";
|
|
3771
3771
|
}
|
|
3772
3772
|
});
|
|
3773
3773
|
|
|
@@ -4270,7 +4270,7 @@ var require_supports_color = __commonJS({
|
|
|
4270
4270
|
"../../node_modules/supports-color/index.js"(exports, module) {
|
|
4271
4271
|
"use strict";
|
|
4272
4272
|
init_define_KOMBAI_TELEMETRY();
|
|
4273
|
-
var
|
|
4273
|
+
var os6 = __require("os");
|
|
4274
4274
|
var tty = __require("tty");
|
|
4275
4275
|
var hasFlag = require_has_flag();
|
|
4276
4276
|
var { env } = process;
|
|
@@ -4327,7 +4327,7 @@ var require_supports_color = __commonJS({
|
|
|
4327
4327
|
return min;
|
|
4328
4328
|
}
|
|
4329
4329
|
if (process.platform === "win32") {
|
|
4330
|
-
const osRelease =
|
|
4330
|
+
const osRelease = os6.release().split(".");
|
|
4331
4331
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
4332
4332
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
4333
4333
|
}
|
|
@@ -4921,11 +4921,11 @@ var require_is_docker = __commonJS({
|
|
|
4921
4921
|
"../../node_modules/is-docker/index.js"(exports, module) {
|
|
4922
4922
|
"use strict";
|
|
4923
4923
|
init_define_KOMBAI_TELEMETRY();
|
|
4924
|
-
var
|
|
4924
|
+
var fs21 = __require("fs");
|
|
4925
4925
|
var isDocker;
|
|
4926
4926
|
function hasDockerEnv() {
|
|
4927
4927
|
try {
|
|
4928
|
-
|
|
4928
|
+
fs21.statSync("/.dockerenv");
|
|
4929
4929
|
return true;
|
|
4930
4930
|
} catch (_) {
|
|
4931
4931
|
return false;
|
|
@@ -4933,7 +4933,7 @@ var require_is_docker = __commonJS({
|
|
|
4933
4933
|
}
|
|
4934
4934
|
function hasDockerCGroup() {
|
|
4935
4935
|
try {
|
|
4936
|
-
return
|
|
4936
|
+
return fs21.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
4937
4937
|
} catch (_) {
|
|
4938
4938
|
return false;
|
|
4939
4939
|
}
|
|
@@ -4952,21 +4952,21 @@ var require_is_wsl = __commonJS({
|
|
|
4952
4952
|
"../../node_modules/is-wsl/index.js"(exports, module) {
|
|
4953
4953
|
"use strict";
|
|
4954
4954
|
init_define_KOMBAI_TELEMETRY();
|
|
4955
|
-
var
|
|
4956
|
-
var
|
|
4955
|
+
var os6 = __require("os");
|
|
4956
|
+
var fs21 = __require("fs");
|
|
4957
4957
|
var isDocker = require_is_docker();
|
|
4958
4958
|
var isWsl3 = () => {
|
|
4959
4959
|
if (process.platform !== "linux") {
|
|
4960
4960
|
return false;
|
|
4961
4961
|
}
|
|
4962
|
-
if (
|
|
4962
|
+
if (os6.release().toLowerCase().includes("microsoft")) {
|
|
4963
4963
|
if (isDocker()) {
|
|
4964
4964
|
return false;
|
|
4965
4965
|
}
|
|
4966
4966
|
return true;
|
|
4967
4967
|
}
|
|
4968
4968
|
try {
|
|
4969
|
-
return
|
|
4969
|
+
return fs21.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isDocker() : false;
|
|
4970
4970
|
} catch (_) {
|
|
4971
4971
|
return false;
|
|
4972
4972
|
}
|
|
@@ -5030,15 +5030,15 @@ function toWSLPath(dir, fallback) {
|
|
|
5030
5030
|
return fallback;
|
|
5031
5031
|
}
|
|
5032
5032
|
}
|
|
5033
|
-
function getLocalAppDataPath(
|
|
5033
|
+
function getLocalAppDataPath(path26) {
|
|
5034
5034
|
const userRegExp = /\/mnt\/([a-z])\/Users\/([^\/:]+)\/AppData\//;
|
|
5035
|
-
const results = userRegExp.exec(
|
|
5035
|
+
const results = userRegExp.exec(path26) || [];
|
|
5036
5036
|
return `/mnt/${results[1]}/Users/${results[2]}/AppData/Local`;
|
|
5037
5037
|
}
|
|
5038
|
-
function getWSLLocalAppDataPath(
|
|
5038
|
+
function getWSLLocalAppDataPath(path26) {
|
|
5039
5039
|
const userRegExp = /\/([a-z])\/Users\/([^\/:]+)\/AppData\//;
|
|
5040
|
-
const results = userRegExp.exec(
|
|
5041
|
-
return toWSLPath(`${results[1]}:\\Users\\${results[2]}\\AppData\\Local`, getLocalAppDataPath(
|
|
5040
|
+
const results = userRegExp.exec(path26) || [];
|
|
5041
|
+
return toWSLPath(`${results[1]}:\\Users\\${results[2]}\\AppData\\Local`, getLocalAppDataPath(path26));
|
|
5042
5042
|
}
|
|
5043
5043
|
function makeUnixTmpDir() {
|
|
5044
5044
|
return childProcess.execSync("mktemp -d -t lighthouse.XXXXXXX").toString().trim();
|
|
@@ -5686,8 +5686,8 @@ var require_windows = __commonJS({
|
|
|
5686
5686
|
init_define_KOMBAI_TELEMETRY();
|
|
5687
5687
|
module.exports = isexe;
|
|
5688
5688
|
isexe.sync = sync;
|
|
5689
|
-
var
|
|
5690
|
-
function checkPathExt(
|
|
5689
|
+
var fs21 = __require("fs");
|
|
5690
|
+
function checkPathExt(path26, options) {
|
|
5691
5691
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
5692
5692
|
if (!pathext) {
|
|
5693
5693
|
return true;
|
|
@@ -5698,25 +5698,25 @@ var require_windows = __commonJS({
|
|
|
5698
5698
|
}
|
|
5699
5699
|
for (var i = 0; i < pathext.length; i++) {
|
|
5700
5700
|
var p = pathext[i].toLowerCase();
|
|
5701
|
-
if (p &&
|
|
5701
|
+
if (p && path26.substr(-p.length).toLowerCase() === p) {
|
|
5702
5702
|
return true;
|
|
5703
5703
|
}
|
|
5704
5704
|
}
|
|
5705
5705
|
return false;
|
|
5706
5706
|
}
|
|
5707
|
-
function checkStat(stat,
|
|
5707
|
+
function checkStat(stat, path26, options) {
|
|
5708
5708
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
5709
5709
|
return false;
|
|
5710
5710
|
}
|
|
5711
|
-
return checkPathExt(
|
|
5711
|
+
return checkPathExt(path26, options);
|
|
5712
5712
|
}
|
|
5713
|
-
function isexe(
|
|
5714
|
-
|
|
5715
|
-
cb(er, er ? false : checkStat(stat,
|
|
5713
|
+
function isexe(path26, options, cb) {
|
|
5714
|
+
fs21.stat(path26, function(er, stat) {
|
|
5715
|
+
cb(er, er ? false : checkStat(stat, path26, options));
|
|
5716
5716
|
});
|
|
5717
5717
|
}
|
|
5718
|
-
function sync(
|
|
5719
|
-
return checkStat(
|
|
5718
|
+
function sync(path26, options) {
|
|
5719
|
+
return checkStat(fs21.statSync(path26), path26, options);
|
|
5720
5720
|
}
|
|
5721
5721
|
}
|
|
5722
5722
|
});
|
|
@@ -5727,14 +5727,14 @@ var require_mode = __commonJS({
|
|
|
5727
5727
|
init_define_KOMBAI_TELEMETRY();
|
|
5728
5728
|
module.exports = isexe;
|
|
5729
5729
|
isexe.sync = sync;
|
|
5730
|
-
var
|
|
5731
|
-
function isexe(
|
|
5732
|
-
|
|
5730
|
+
var fs21 = __require("fs");
|
|
5731
|
+
function isexe(path26, options, cb) {
|
|
5732
|
+
fs21.stat(path26, function(er, stat) {
|
|
5733
5733
|
cb(er, er ? false : checkStat(stat, options));
|
|
5734
5734
|
});
|
|
5735
5735
|
}
|
|
5736
|
-
function sync(
|
|
5737
|
-
return checkStat(
|
|
5736
|
+
function sync(path26, options) {
|
|
5737
|
+
return checkStat(fs21.statSync(path26), options);
|
|
5738
5738
|
}
|
|
5739
5739
|
function checkStat(stat, options) {
|
|
5740
5740
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -5759,7 +5759,7 @@ var require_mode = __commonJS({
|
|
|
5759
5759
|
var require_isexe = __commonJS({
|
|
5760
5760
|
"../../node_modules/isexe/index.js"(exports, module) {
|
|
5761
5761
|
init_define_KOMBAI_TELEMETRY();
|
|
5762
|
-
var
|
|
5762
|
+
var fs21 = __require("fs");
|
|
5763
5763
|
var core;
|
|
5764
5764
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
5765
5765
|
core = require_windows();
|
|
@@ -5768,7 +5768,7 @@ var require_isexe = __commonJS({
|
|
|
5768
5768
|
}
|
|
5769
5769
|
module.exports = isexe;
|
|
5770
5770
|
isexe.sync = sync;
|
|
5771
|
-
function isexe(
|
|
5771
|
+
function isexe(path26, options, cb) {
|
|
5772
5772
|
if (typeof options === "function") {
|
|
5773
5773
|
cb = options;
|
|
5774
5774
|
options = {};
|
|
@@ -5778,7 +5778,7 @@ var require_isexe = __commonJS({
|
|
|
5778
5778
|
throw new TypeError("callback not provided");
|
|
5779
5779
|
}
|
|
5780
5780
|
return new Promise(function(resolve, reject) {
|
|
5781
|
-
isexe(
|
|
5781
|
+
isexe(path26, options || {}, function(er, is) {
|
|
5782
5782
|
if (er) {
|
|
5783
5783
|
reject(er);
|
|
5784
5784
|
} else {
|
|
@@ -5787,7 +5787,7 @@ var require_isexe = __commonJS({
|
|
|
5787
5787
|
});
|
|
5788
5788
|
});
|
|
5789
5789
|
}
|
|
5790
|
-
core(
|
|
5790
|
+
core(path26, options || {}, function(er, is) {
|
|
5791
5791
|
if (er) {
|
|
5792
5792
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
5793
5793
|
er = null;
|
|
@@ -5797,9 +5797,9 @@ var require_isexe = __commonJS({
|
|
|
5797
5797
|
cb(er, is);
|
|
5798
5798
|
});
|
|
5799
5799
|
}
|
|
5800
|
-
function sync(
|
|
5800
|
+
function sync(path26, options) {
|
|
5801
5801
|
try {
|
|
5802
|
-
return core.sync(
|
|
5802
|
+
return core.sync(path26, options || {});
|
|
5803
5803
|
} catch (er) {
|
|
5804
5804
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
5805
5805
|
return false;
|
|
@@ -5816,7 +5816,7 @@ var require_which = __commonJS({
|
|
|
5816
5816
|
"../../node_modules/which/which.js"(exports, module) {
|
|
5817
5817
|
init_define_KOMBAI_TELEMETRY();
|
|
5818
5818
|
var isWindows3 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
5819
|
-
var
|
|
5819
|
+
var path26 = __require("path");
|
|
5820
5820
|
var COLON = isWindows3 ? ";" : ":";
|
|
5821
5821
|
var isexe = require_isexe();
|
|
5822
5822
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -5854,7 +5854,7 @@ var require_which = __commonJS({
|
|
|
5854
5854
|
return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
5855
5855
|
const ppRaw = pathEnv[i];
|
|
5856
5856
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
5857
|
-
const pCmd =
|
|
5857
|
+
const pCmd = path26.join(pathPart, cmd);
|
|
5858
5858
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
5859
5859
|
resolve(subStep(p, i, 0));
|
|
5860
5860
|
});
|
|
@@ -5881,7 +5881,7 @@ var require_which = __commonJS({
|
|
|
5881
5881
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
5882
5882
|
const ppRaw = pathEnv[i];
|
|
5883
5883
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
5884
|
-
const pCmd =
|
|
5884
|
+
const pCmd = path26.join(pathPart, cmd);
|
|
5885
5885
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
5886
5886
|
for (let j = 0; j < pathExt.length; j++) {
|
|
5887
5887
|
const cur = p + pathExt[j];
|
|
@@ -5913,8 +5913,8 @@ import { existsSync } from "fs";
|
|
|
5913
5913
|
import path10 from "path";
|
|
5914
5914
|
function getEdgeLinux(name) {
|
|
5915
5915
|
try {
|
|
5916
|
-
let
|
|
5917
|
-
return
|
|
5916
|
+
let path26 = import_which.default.sync(name);
|
|
5917
|
+
return path26;
|
|
5918
5918
|
} catch (e) {
|
|
5919
5919
|
}
|
|
5920
5920
|
return null;
|
|
@@ -9698,6 +9698,275 @@ var init_ds = __esm({
|
|
|
9698
9698
|
}
|
|
9699
9699
|
});
|
|
9700
9700
|
|
|
9701
|
+
// ../shared/src/mcp/chatMcpRegistrationArg.ts
|
|
9702
|
+
var CHAT_MCP_REGISTRATION_ARG;
|
|
9703
|
+
var init_chatMcpRegistrationArg = __esm({
|
|
9704
|
+
"../shared/src/mcp/chatMcpRegistrationArg.ts"() {
|
|
9705
|
+
"use strict";
|
|
9706
|
+
init_define_KOMBAI_TELEMETRY();
|
|
9707
|
+
CHAT_MCP_REGISTRATION_ARG = "--registration";
|
|
9708
|
+
}
|
|
9709
|
+
});
|
|
9710
|
+
|
|
9711
|
+
// ../shared/src/mcp/codexKombaiEntry.ts
|
|
9712
|
+
function kombaiCliMcpEntry(platform2) {
|
|
9713
|
+
if (platform2 === "win32") {
|
|
9714
|
+
const [shell, ...shellArgs] = WINDOWS_SHELL_WRAPPER;
|
|
9715
|
+
return { command: shell, args: [...shellArgs, KOMBAI_CLI_MCP_COMMAND, ...KOMBAI_CLI_MCP_ARGS] };
|
|
9716
|
+
}
|
|
9717
|
+
return { command: KOMBAI_CLI_MCP_COMMAND, args: [...KOMBAI_CLI_MCP_ARGS] };
|
|
9718
|
+
}
|
|
9719
|
+
function tomlString(value) {
|
|
9720
|
+
return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
9721
|
+
}
|
|
9722
|
+
function codexKombaiBlock(platform2) {
|
|
9723
|
+
const entry = kombaiCliMcpEntry(platform2);
|
|
9724
|
+
return `[mcp_servers.${KOMBAI_MCP_KEY}]
|
|
9725
|
+
command = ${tomlString(entry.command)}
|
|
9726
|
+
args = [${entry.args.map(tomlString).join(", ")}]
|
|
9727
|
+
`;
|
|
9728
|
+
}
|
|
9729
|
+
function bracketBalance(line) {
|
|
9730
|
+
let balance = 0;
|
|
9731
|
+
let quote = null;
|
|
9732
|
+
for (let i = 0; i < line.length; i++) {
|
|
9733
|
+
const c = line[i];
|
|
9734
|
+
if (quote) {
|
|
9735
|
+
if (c === "\\" && quote === '"') i++;
|
|
9736
|
+
else if (c === quote) quote = null;
|
|
9737
|
+
} else if (c === '"' || c === "'") quote = c;
|
|
9738
|
+
else if (c === "#") break;
|
|
9739
|
+
else if (c === "[") balance++;
|
|
9740
|
+
else if (c === "]") balance--;
|
|
9741
|
+
}
|
|
9742
|
+
return balance;
|
|
9743
|
+
}
|
|
9744
|
+
function tomlLines(text) {
|
|
9745
|
+
const lines = [];
|
|
9746
|
+
let depth = 0;
|
|
9747
|
+
let multiline = null;
|
|
9748
|
+
for (const line of text.split(/\r?\n/)) {
|
|
9749
|
+
if (multiline) {
|
|
9750
|
+
if (line.split(multiline).length % 2 === 0) multiline = null;
|
|
9751
|
+
lines.push({ line, header: false });
|
|
9752
|
+
continue;
|
|
9753
|
+
}
|
|
9754
|
+
const header = depth === 0 && TOML_HEADER_LINE_RE.test(line);
|
|
9755
|
+
lines.push({ line, header });
|
|
9756
|
+
if (header) continue;
|
|
9757
|
+
depth = Math.max(0, depth + bracketBalance(line));
|
|
9758
|
+
multiline = MULTILINE_QUOTES.find((quotes) => line.split(quotes).length % 2 === 0) ?? null;
|
|
9759
|
+
}
|
|
9760
|
+
return lines;
|
|
9761
|
+
}
|
|
9762
|
+
function mcpServersTableDefinesKombai(text) {
|
|
9763
|
+
let inMcpServers = false;
|
|
9764
|
+
for (const { line, header } of tomlLines(text)) {
|
|
9765
|
+
if (header) inMcpServers = MCP_SERVERS_HEADER_RE.test(line);
|
|
9766
|
+
else if (inMcpServers && KOMBAI_KEY_LINE_RE.test(line)) return true;
|
|
9767
|
+
}
|
|
9768
|
+
return false;
|
|
9769
|
+
}
|
|
9770
|
+
function codexMcpServersInline(content) {
|
|
9771
|
+
for (const { line, header } of tomlLines(withoutBom(content))) {
|
|
9772
|
+
if (header) return false;
|
|
9773
|
+
if (MCP_SERVERS_KEY_LINE_RE.test(line)) return true;
|
|
9774
|
+
}
|
|
9775
|
+
return false;
|
|
9776
|
+
}
|
|
9777
|
+
function codexKombaiEntryKind(content, platform2) {
|
|
9778
|
+
const text = withoutBom(content);
|
|
9779
|
+
const blocks = text.match(KOMBAI_TOML_BLOCK_RE);
|
|
9780
|
+
if (!blocks) return mcpServersTableDefinesKombai(text) ? "foreign" /* Foreign */ : "none" /* None */;
|
|
9781
|
+
if (text.replace(/\r\n/g, "\n").includes(codexKombaiBlock(platform2))) return "cli" /* Cli */;
|
|
9782
|
+
const block = blocks.join("\n");
|
|
9783
|
+
return block.includes(`"${CHAT_MCP_REGISTRATION_ARG}"`) || LEGACY_LAUNCHER_RE.test(block) ? "legacy" /* Legacy */ : "foreign" /* Foreign */;
|
|
9784
|
+
}
|
|
9785
|
+
function codexKombaiEntryDisabled(content) {
|
|
9786
|
+
const blocks = withoutBom(content).match(KOMBAI_TOML_BLOCK_RE) ?? [];
|
|
9787
|
+
return blocks.some((block) => {
|
|
9788
|
+
const lines = tomlLines(block);
|
|
9789
|
+
const own = lines.findIndex((entry) => entry.header);
|
|
9790
|
+
const sub = lines.findIndex((entry, index) => index > own && entry.header);
|
|
9791
|
+
return lines.slice(own + 1, sub === -1 ? void 0 : sub).some(({ line }) => /^[ \t]*enabled[ \t]*=[ \t]*false\b/.test(line));
|
|
9792
|
+
});
|
|
9793
|
+
}
|
|
9794
|
+
function withoutCodexKombaiBlock(content) {
|
|
9795
|
+
const bom = content.startsWith(BOM) ? BOM : "";
|
|
9796
|
+
const text = withoutBom(content);
|
|
9797
|
+
let stripped = text.replace(KOMBAI_TOML_BLOCK_RE, "").trimEnd();
|
|
9798
|
+
if (stripped === text.trimEnd()) return null;
|
|
9799
|
+
if (KOMBAI_TOML_AT_START_RE.test(text)) stripped = stripped.replace(/^\r?\n/, "");
|
|
9800
|
+
if (stripped.length === 0) return "";
|
|
9801
|
+
const crlf = stripped.includes("\n") ? /\r\n[^\n]*$/.test(stripped) : text.includes("\r\n");
|
|
9802
|
+
return bom + stripped + (crlf ? "\r\n" : "\n");
|
|
9803
|
+
}
|
|
9804
|
+
function withCodexKombaiBlock(content, platform2) {
|
|
9805
|
+
const bom = content.startsWith(BOM) ? BOM : "";
|
|
9806
|
+
const text = withoutBom(content);
|
|
9807
|
+
const rest = withoutBom(withoutCodexKombaiBlock(text) ?? text).trimEnd();
|
|
9808
|
+
const block = codexKombaiBlock(platform2);
|
|
9809
|
+
if (rest.length === 0) return bom + block;
|
|
9810
|
+
const eol = text.includes("\r\n") ? "\r\n" : "\n";
|
|
9811
|
+
return `${bom}${rest}${eol}${eol}${eol === "\n" ? block : block.replace(/\n/g, eol)}`;
|
|
9812
|
+
}
|
|
9813
|
+
var KOMBAI_MCP_KEY, KOMBAI_CLI_MCP_COMMAND, KOMBAI_CLI_MCP_ARGS, WINDOWS_SHELL_WRAPPER, LEGACY_LAUNCHER_RE, KOMBAI_TOML_TABLE, TOML_OTHER_HEADER, KOMBAI_TOML_BLOCK_RE, KOMBAI_TOML_AT_START_RE, BOM, withoutBom, TOML_HEADER_LINE_RE, MULTILINE_QUOTES, MCP_SERVERS_HEADER_RE, KOMBAI_KEY_LINE_RE, MCP_SERVERS_KEY_LINE_RE;
|
|
9814
|
+
var init_codexKombaiEntry = __esm({
|
|
9815
|
+
"../shared/src/mcp/codexKombaiEntry.ts"() {
|
|
9816
|
+
"use strict";
|
|
9817
|
+
init_define_KOMBAI_TELEMETRY();
|
|
9818
|
+
init_chatMcpRegistrationArg();
|
|
9819
|
+
KOMBAI_MCP_KEY = "kombai";
|
|
9820
|
+
KOMBAI_CLI_MCP_COMMAND = "npx";
|
|
9821
|
+
KOMBAI_CLI_MCP_ARGS = ["-y", "@kombai/cli@latest", "mcp"];
|
|
9822
|
+
WINDOWS_SHELL_WRAPPER = ["cmd", "/c"];
|
|
9823
|
+
LEGACY_LAUNCHER_RE = /[\\/]+\.kombai[\\/]+bin[\\/]+mcp-gateway(?:\.cmd)?(?=$|")/;
|
|
9824
|
+
KOMBAI_TOML_TABLE = String.raw`[ \t]*mcp_servers[ \t]*\.[ \t]*(?:kombai|"kombai"|'kombai')[ \t]*`;
|
|
9825
|
+
TOML_OTHER_HEADER = String.raw`[ \t]*\[(?!${KOMBAI_TOML_TABLE}(?:\.|\]))[^\r\n]*\][ \t]*(?:#[^\r\n]*)?(?=\r?\n|$)`;
|
|
9826
|
+
KOMBAI_TOML_BLOCK_RE = new RegExp(
|
|
9827
|
+
String.raw`(?:^|\r?\n)[ \t]*\[${KOMBAI_TOML_TABLE}\][\s\S]*?(?=((?:\r?\n[ \t]*(?=\r?\n))*))\1` + String.raw`(?=(?:\r?\n[ \t]*(?:#[^\r\n]*)?)*(?:\r?\n${TOML_OTHER_HEADER}|$))`,
|
|
9828
|
+
"g"
|
|
9829
|
+
);
|
|
9830
|
+
KOMBAI_TOML_AT_START_RE = new RegExp(String.raw`^[ \t]*\[${KOMBAI_TOML_TABLE}\]`);
|
|
9831
|
+
BOM = "\uFEFF";
|
|
9832
|
+
withoutBom = (content) => content.startsWith(BOM) ? content.slice(BOM.length) : content;
|
|
9833
|
+
TOML_HEADER_LINE_RE = /^[ \t]*\[/;
|
|
9834
|
+
MULTILINE_QUOTES = ['"""', "'''"];
|
|
9835
|
+
MCP_SERVERS_HEADER_RE = /^[ \t]*\[[ \t]*(?:mcp_servers|"mcp_servers"|'mcp_servers')[ \t]*\][ \t]*(?:#.*)?$/;
|
|
9836
|
+
KOMBAI_KEY_LINE_RE = /^[ \t]*(?:kombai|"kombai"|'kombai')[ \t]*[.=]/;
|
|
9837
|
+
MCP_SERVERS_KEY_LINE_RE = /^[ \t]*(?:mcp_servers|"mcp_servers"|'mcp_servers')[ \t]*[.=]/;
|
|
9838
|
+
}
|
|
9839
|
+
});
|
|
9840
|
+
|
|
9841
|
+
// src/mcp/install.js
|
|
9842
|
+
import fs16 from "node:fs/promises";
|
|
9843
|
+
import path16 from "node:path";
|
|
9844
|
+
function codexHomeOf(env, osHome) {
|
|
9845
|
+
return env.CODEX_HOME ? path16.resolve(env.CODEX_HOME) : path16.join(osHome, ".codex");
|
|
9846
|
+
}
|
|
9847
|
+
async function readConfig2(codexHome) {
|
|
9848
|
+
try {
|
|
9849
|
+
await fs16.stat(codexHome);
|
|
9850
|
+
} catch (error2) {
|
|
9851
|
+
if (!isErrno(error2, "ENOENT")) throw error2;
|
|
9852
|
+
throw new CliError(
|
|
9853
|
+
"CLI_MCP_CLIENT_NOT_FOUND",
|
|
9854
|
+
`Codex hasn't created ${codexHome} yet: open Codex once, then run this again.`,
|
|
9855
|
+
{ details: { path: codexHome } }
|
|
9856
|
+
);
|
|
9857
|
+
}
|
|
9858
|
+
const file2 = codexConfigOf(codexHome);
|
|
9859
|
+
try {
|
|
9860
|
+
const target = await fs16.realpath(file2);
|
|
9861
|
+
const mode = (await fs16.stat(target)).mode & 511;
|
|
9862
|
+
return { file: file2, target, linked: target !== file2, content: await fs16.readFile(target, "utf8"), mode };
|
|
9863
|
+
} catch (error2) {
|
|
9864
|
+
if (!isErrno(error2, "ENOENT")) throw error2;
|
|
9865
|
+
let link = null;
|
|
9866
|
+
try {
|
|
9867
|
+
link = await fs16.lstat(file2);
|
|
9868
|
+
} catch (lstatError) {
|
|
9869
|
+
if (!isErrno(lstatError, "ENOENT")) throw lstatError;
|
|
9870
|
+
}
|
|
9871
|
+
if (link?.isSymbolicLink()) throw brokenLink(file2, path16.resolve(path16.dirname(file2), await fs16.readlink(file2)));
|
|
9872
|
+
return { file: file2, target: file2, linked: false, content: "", mode: NEW_CONFIG_MODE };
|
|
9873
|
+
}
|
|
9874
|
+
}
|
|
9875
|
+
function brokenLink(file2, target) {
|
|
9876
|
+
return new CliError(
|
|
9877
|
+
"CLI_MCP_CONFIG_LINK_BROKEN",
|
|
9878
|
+
`${file2} is a link to ${target}, which doesn't exist, so it was left as it is.`,
|
|
9879
|
+
{
|
|
9880
|
+
exit: Exit.REFUSED,
|
|
9881
|
+
next: `Ask the user to restore ${target} or remove the link ${file2}, then run this again.`,
|
|
9882
|
+
details: { path: file2, target }
|
|
9883
|
+
}
|
|
9884
|
+
);
|
|
9885
|
+
}
|
|
9886
|
+
function inlineMcpServers(file2) {
|
|
9887
|
+
return new CliError(
|
|
9888
|
+
"CLI_MCP_CONFIG_UNSUPPORTED",
|
|
9889
|
+
`${file2} sets mcp_servers as one value or with dotted keys, so Kombai can't add its server without breaking the file, which Codex would then refuse.`,
|
|
9890
|
+
{
|
|
9891
|
+
exit: Exit.REFUSED,
|
|
9892
|
+
next: `Ask the user to write the servers in ${file2} as [mcp_servers.<name>] tables, then run this again.`,
|
|
9893
|
+
details: { path: file2 }
|
|
9894
|
+
}
|
|
9895
|
+
);
|
|
9896
|
+
}
|
|
9897
|
+
function foreignEntry(file2) {
|
|
9898
|
+
return new CliError(
|
|
9899
|
+
"CLI_MCP_ENTRY_FOREIGN",
|
|
9900
|
+
`${file2} already has a kombai MCP server that Kombai did not add, so it was left as it is.`,
|
|
9901
|
+
{
|
|
9902
|
+
exit: Exit.REFUSED,
|
|
9903
|
+
next: `Ask the user to remove or rename the [mcp_servers.kombai] entry in ${file2}, then run this again.`,
|
|
9904
|
+
details: { path: file2 }
|
|
9905
|
+
}
|
|
9906
|
+
);
|
|
9907
|
+
}
|
|
9908
|
+
async function installCodexEntry(codexHome, platform2) {
|
|
9909
|
+
const { file: file2, target, content, mode } = await readConfig2(codexHome);
|
|
9910
|
+
const kind = codexKombaiEntryKind(content, platform2);
|
|
9911
|
+
if (kind === "foreign" /* Foreign */) throw foreignEntry(file2);
|
|
9912
|
+
if (kind === "cli" /* Cli */) return InstallOutcome.Already;
|
|
9913
|
+
if (codexMcpServersInline(content)) throw inlineMcpServers(file2);
|
|
9914
|
+
await writeFileAtomic(target, withCodexKombaiBlock(content, platform2), { mode });
|
|
9915
|
+
return kind === "legacy" /* Legacy */ ? InstallOutcome.Replaced : InstallOutcome.Added;
|
|
9916
|
+
}
|
|
9917
|
+
async function codexEntryDisabled(codexHome) {
|
|
9918
|
+
const { content } = await readConfig2(codexHome);
|
|
9919
|
+
return codexKombaiEntryDisabled(content);
|
|
9920
|
+
}
|
|
9921
|
+
async function uninstallCodexEntry(codexHome, platform2) {
|
|
9922
|
+
const { file: file2, target, linked, content, mode } = await readConfig2(codexHome);
|
|
9923
|
+
const kind = codexKombaiEntryKind(content, platform2);
|
|
9924
|
+
if (kind === "foreign" /* Foreign */) throw foreignEntry(file2);
|
|
9925
|
+
if (kind === "none" /* None */) return UninstallOutcome.Absent;
|
|
9926
|
+
const rest = withoutCodexKombaiBlock(content);
|
|
9927
|
+
if (rest === null) return UninstallOutcome.Absent;
|
|
9928
|
+
if (rest === "" && !linked) await fs16.rm(file2);
|
|
9929
|
+
else await writeFileAtomic(target, rest, { mode });
|
|
9930
|
+
return UninstallOutcome.Removed;
|
|
9931
|
+
}
|
|
9932
|
+
var McpClient, InstallOutcome, UninstallOutcome, CODEX_CONFIG, NEW_CONFIG_MODE, codexConfigOf;
|
|
9933
|
+
var init_install = __esm({
|
|
9934
|
+
"src/mcp/install.js"() {
|
|
9935
|
+
"use strict";
|
|
9936
|
+
init_define_KOMBAI_TELEMETRY();
|
|
9937
|
+
init_codexKombaiEntry();
|
|
9938
|
+
init_fsx();
|
|
9939
|
+
init_output();
|
|
9940
|
+
McpClient = Object.freeze({ Codex: "codex" });
|
|
9941
|
+
InstallOutcome = Object.freeze({
|
|
9942
|
+
/** There was no `kombai` entry: the CLI's block was added. */
|
|
9943
|
+
Added: "added",
|
|
9944
|
+
/** The CLI's block was there already: nothing was written. */
|
|
9945
|
+
Already: "already",
|
|
9946
|
+
/** An older Kombai build's entry was there: the CLI's block took its place. */
|
|
9947
|
+
Replaced: "replaced"
|
|
9948
|
+
});
|
|
9949
|
+
UninstallOutcome = Object.freeze({
|
|
9950
|
+
Removed: "removed",
|
|
9951
|
+
/** There was no Kombai entry to take out. */
|
|
9952
|
+
Absent: "absent"
|
|
9953
|
+
});
|
|
9954
|
+
CODEX_CONFIG = "config.toml";
|
|
9955
|
+
NEW_CONFIG_MODE = 384;
|
|
9956
|
+
codexConfigOf = (codexHome) => path16.join(codexHome, CODEX_CONFIG);
|
|
9957
|
+
}
|
|
9958
|
+
});
|
|
9959
|
+
|
|
9960
|
+
// ../shared/src/mcp/codexLinks.ts
|
|
9961
|
+
var CODEX_NEW_CHAT_URL;
|
|
9962
|
+
var init_codexLinks = __esm({
|
|
9963
|
+
"../shared/src/mcp/codexLinks.ts"() {
|
|
9964
|
+
"use strict";
|
|
9965
|
+
init_define_KOMBAI_TELEMETRY();
|
|
9966
|
+
CODEX_NEW_CHAT_URL = "codex://threads/new?prompt=";
|
|
9967
|
+
}
|
|
9968
|
+
});
|
|
9969
|
+
|
|
9701
9970
|
// ../../node_modules/zod/v3/helpers/util.js
|
|
9702
9971
|
var util, objectUtil, ZodParsedType, getParsedType;
|
|
9703
9972
|
var init_util = __esm({
|
|
@@ -10108,8 +10377,8 @@ var init_parseUtil = __esm({
|
|
|
10108
10377
|
init_errors();
|
|
10109
10378
|
init_en();
|
|
10110
10379
|
makeIssue = (params) => {
|
|
10111
|
-
const { data, path:
|
|
10112
|
-
const fullPath = [...
|
|
10380
|
+
const { data, path: path26, errorMaps, issueData } = params;
|
|
10381
|
+
const fullPath = [...path26, ...issueData.path || []];
|
|
10113
10382
|
const fullIssue = {
|
|
10114
10383
|
...issueData,
|
|
10115
10384
|
path: fullPath
|
|
@@ -10392,11 +10661,11 @@ var init_types = __esm({
|
|
|
10392
10661
|
init_parseUtil();
|
|
10393
10662
|
init_util();
|
|
10394
10663
|
ParseInputLazyPath = class {
|
|
10395
|
-
constructor(parent, value,
|
|
10664
|
+
constructor(parent, value, path26, key) {
|
|
10396
10665
|
this._cachedPath = [];
|
|
10397
10666
|
this.parent = parent;
|
|
10398
10667
|
this.data = value;
|
|
10399
|
-
this._path =
|
|
10668
|
+
this._path = path26;
|
|
10400
10669
|
this._key = key;
|
|
10401
10670
|
}
|
|
10402
10671
|
get path() {
|
|
@@ -13905,10 +14174,10 @@ function mergeDefs(...defs) {
|
|
|
13905
14174
|
function cloneDef(schema) {
|
|
13906
14175
|
return mergeDefs(schema._zod.def);
|
|
13907
14176
|
}
|
|
13908
|
-
function getElementAtPath(obj,
|
|
13909
|
-
if (!
|
|
14177
|
+
function getElementAtPath(obj, path26) {
|
|
14178
|
+
if (!path26)
|
|
13910
14179
|
return obj;
|
|
13911
|
-
return
|
|
14180
|
+
return path26.reduce((acc, key) => acc?.[key], obj);
|
|
13912
14181
|
}
|
|
13913
14182
|
function promiseAllObject(promisesObj) {
|
|
13914
14183
|
const keys = Object.keys(promisesObj);
|
|
@@ -14220,11 +14489,11 @@ function aborted(x, startIndex = 0) {
|
|
|
14220
14489
|
}
|
|
14221
14490
|
return false;
|
|
14222
14491
|
}
|
|
14223
|
-
function prefixIssues(
|
|
14492
|
+
function prefixIssues(path26, issues) {
|
|
14224
14493
|
return issues.map((iss) => {
|
|
14225
14494
|
var _a3;
|
|
14226
14495
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
14227
|
-
iss.path.unshift(
|
|
14496
|
+
iss.path.unshift(path26);
|
|
14228
14497
|
return iss;
|
|
14229
14498
|
});
|
|
14230
14499
|
}
|
|
@@ -27390,8 +27659,8 @@ var require_utils = __commonJS({
|
|
|
27390
27659
|
}
|
|
27391
27660
|
return ind;
|
|
27392
27661
|
}
|
|
27393
|
-
function removeDotSegments(
|
|
27394
|
-
let input =
|
|
27662
|
+
function removeDotSegments(path26) {
|
|
27663
|
+
let input = path26;
|
|
27395
27664
|
const output = [];
|
|
27396
27665
|
let nextSlash = -1;
|
|
27397
27666
|
let len = 0;
|
|
@@ -27591,8 +27860,8 @@ var require_schemes = __commonJS({
|
|
|
27591
27860
|
wsComponent.secure = void 0;
|
|
27592
27861
|
}
|
|
27593
27862
|
if (wsComponent.resourceName) {
|
|
27594
|
-
const [
|
|
27595
|
-
wsComponent.path =
|
|
27863
|
+
const [path26, query] = wsComponent.resourceName.split("?");
|
|
27864
|
+
wsComponent.path = path26 && path26 !== "/" ? path26 : void 0;
|
|
27596
27865
|
wsComponent.query = query;
|
|
27597
27866
|
wsComponent.resourceName = void 0;
|
|
27598
27867
|
}
|
|
@@ -30991,12 +31260,12 @@ var require_dist = __commonJS({
|
|
|
30991
31260
|
throw new Error(`Unknown format "${name}"`);
|
|
30992
31261
|
return f;
|
|
30993
31262
|
};
|
|
30994
|
-
function addFormats(ajv, list,
|
|
31263
|
+
function addFormats(ajv, list, fs21, exportName) {
|
|
30995
31264
|
var _a3;
|
|
30996
31265
|
var _b2;
|
|
30997
31266
|
(_a3 = (_b2 = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b2.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
30998
31267
|
for (const f of list)
|
|
30999
|
-
ajv.addFormat(f,
|
|
31268
|
+
ajv.addFormat(f, fs21[f]);
|
|
31000
31269
|
}
|
|
31001
31270
|
module.exports = exports = formatsPlugin;
|
|
31002
31271
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -31718,8 +31987,8 @@ var init_kombai_icon = __esm({
|
|
|
31718
31987
|
|
|
31719
31988
|
// src/commands/taste.js
|
|
31720
31989
|
import { createHash as createHash3, randomUUID as randomUUID2 } from "node:crypto";
|
|
31721
|
-
import
|
|
31722
|
-
import
|
|
31990
|
+
import fs17 from "node:fs/promises";
|
|
31991
|
+
import path17 from "node:path";
|
|
31723
31992
|
async function writeDirections(runDir, envelope) {
|
|
31724
31993
|
const parts = [];
|
|
31725
31994
|
const images = [];
|
|
@@ -31729,7 +31998,7 @@ async function writeDirections(runDir, envelope) {
|
|
|
31729
31998
|
if (text.trim()) parts.push(text);
|
|
31730
31999
|
} else if (item.type === "image" && item.data) {
|
|
31731
32000
|
const extension = IMAGE_EXTENSIONS[item.mimeType ?? ""] ?? "png";
|
|
31732
|
-
const file2 =
|
|
32001
|
+
const file2 = path17.join(runDir, `image-${images.length + 1}.${extension}`);
|
|
31733
32002
|
await writeFileAtomic(file2, Buffer.from(item.data, "base64"), { mode: 420 });
|
|
31734
32003
|
images.push(file2);
|
|
31735
32004
|
parts.push(``);
|
|
@@ -31809,8 +32078,8 @@ var init_taste = __esm({
|
|
|
31809
32078
|
async run(ctx, { flags }) {
|
|
31810
32079
|
await refuseGuest(ctx);
|
|
31811
32080
|
const variants = Number(flags.variants);
|
|
31812
|
-
const briefFile =
|
|
31813
|
-
const brief = await
|
|
32081
|
+
const briefFile = path17.resolve(ctx.cwd, String(flags.brief));
|
|
32082
|
+
const brief = await fs17.readFile(briefFile, "utf8").catch((error2) => {
|
|
31814
32083
|
if (isErrno(error2, "ENOENT"))
|
|
31815
32084
|
throw new CliError("CLI_FILE_MISSING", `${briefFile} does not exist.`, { details: { path: briefFile } });
|
|
31816
32085
|
if (isErrno(error2, "EISDIR"))
|
|
@@ -31829,7 +32098,7 @@ var init_taste = __esm({
|
|
|
31829
32098
|
const checkout2 = await resolveCheckout(ctx.cwd, { platform: ctx.platform, home: ctx.home });
|
|
31830
32099
|
const work = workDir(ctx.home, session.env, checkout2.checkoutId);
|
|
31831
32100
|
await loadWorkspace(work, checkout2);
|
|
31832
|
-
const tasteDir =
|
|
32101
|
+
const tasteDir = path17.join(work, "taste");
|
|
31833
32102
|
await ensureDir(tasteDir);
|
|
31834
32103
|
const fields = {
|
|
31835
32104
|
projectId: checkout2.projectId,
|
|
@@ -31839,7 +32108,7 @@ var init_taste = __esm({
|
|
|
31839
32108
|
...flags.cards === true ? { cards: true } : {},
|
|
31840
32109
|
client: { name: "kombai-cli", version: ctx.version }
|
|
31841
32110
|
};
|
|
31842
|
-
const pendingFile =
|
|
32111
|
+
const pendingFile = path17.join(tasteDir, "pending.json");
|
|
31843
32112
|
const key = createHash3("sha256").update(JSON.stringify(fields)).digest("hex");
|
|
31844
32113
|
const pending = (
|
|
31845
32114
|
/** @type {{ key?: string, createId?: string } | undefined} */
|
|
@@ -31861,7 +32130,7 @@ var init_taste = __esm({
|
|
|
31861
32130
|
error2.next = rerun;
|
|
31862
32131
|
}
|
|
31863
32132
|
if (error2 instanceof CliError && error2.code === "TASTE_CREATE_ID_REUSED") {
|
|
31864
|
-
await
|
|
32133
|
+
await fs17.rm(pendingFile, { force: true });
|
|
31865
32134
|
error2.next = rerun;
|
|
31866
32135
|
}
|
|
31867
32136
|
throw explainTasteError(error2, session.hosts.web);
|
|
@@ -31870,10 +32139,10 @@ var init_taste = __esm({
|
|
|
31870
32139
|
if (created.status === "awaiting_files") {
|
|
31871
32140
|
created = (await session.api.call({ method: "POST", path: `/design/taste/${created.run}/start`, body: {} })).body;
|
|
31872
32141
|
}
|
|
31873
|
-
const runDir =
|
|
32142
|
+
const runDir = path17.join(tasteDir, created.run);
|
|
31874
32143
|
await ensureDir(runDir);
|
|
31875
|
-
await writeFileAtomic(
|
|
31876
|
-
await
|
|
32144
|
+
await writeFileAtomic(path17.join(runDir, "brief.md"), brief, { mode: 420 });
|
|
32145
|
+
await fs17.rm(pendingFile, { force: true });
|
|
31877
32146
|
return { run: created.run, status: created.status, next: `kombai taste wait ${created.run}` };
|
|
31878
32147
|
}
|
|
31879
32148
|
};
|
|
@@ -31895,7 +32164,7 @@ var init_taste = __esm({
|
|
|
31895
32164
|
const session = await openSession(ctx, { deadline });
|
|
31896
32165
|
const checkout2 = await resolveCheckout(ctx.cwd, { platform: ctx.platform, home: ctx.home });
|
|
31897
32166
|
const work = workDir(ctx.home, session.env, checkout2.checkoutId);
|
|
31898
|
-
const runDir =
|
|
32167
|
+
const runDir = path17.join(work, "taste", run3);
|
|
31899
32168
|
const again = `kombai taste wait ${run3}`;
|
|
31900
32169
|
let seenRunning = false;
|
|
31901
32170
|
for (; ; ) {
|
|
@@ -31913,8 +32182,8 @@ var init_taste = __esm({
|
|
|
31913
32182
|
const envelope = JSON.parse(new TextDecoder().decode(await session.api.download(state.result.url)));
|
|
31914
32183
|
await loadWorkspace(work, checkout2);
|
|
31915
32184
|
await ensureDir(runDir);
|
|
31916
|
-
await writeJsonAtomic(
|
|
31917
|
-
const directions =
|
|
32185
|
+
await writeJsonAtomic(path17.join(runDir, "result.json"), envelope, { mode: 420 });
|
|
32186
|
+
const directions = path17.join(runDir, "directions.md");
|
|
31918
32187
|
const written = await writeDirections(runDir, envelope);
|
|
31919
32188
|
await writeFileAtomic(directions, written.text, { mode: 420 });
|
|
31920
32189
|
return {
|
|
@@ -31989,7 +32258,7 @@ html,body{margin:0;background:transparent}
|
|
|
31989
32258
|
});
|
|
31990
32259
|
|
|
31991
32260
|
// src/mcp/client-gate.js
|
|
31992
|
-
import
|
|
32261
|
+
import path18 from "node:path";
|
|
31993
32262
|
function declaresMcpApps(capabilities) {
|
|
31994
32263
|
if (!capabilities || typeof capabilities !== "object") return false;
|
|
31995
32264
|
const extensions = (
|
|
@@ -32009,7 +32278,7 @@ function declaresMcpApps(capabilities) {
|
|
|
32009
32278
|
return !Array.isArray(mimeTypes) || mimeTypes.includes(MCP_APP_MIME_TYPE);
|
|
32010
32279
|
}
|
|
32011
32280
|
function isCodexAppWideFolder(cwd, osHome, platform2, codexHome) {
|
|
32012
|
-
const p = platform2 === "win32" ?
|
|
32281
|
+
const p = platform2 === "win32" ? path18.win32 : path18.posix;
|
|
32013
32282
|
const fold = (value) => platform2 === "linux" ? value : value.toLowerCase();
|
|
32014
32283
|
const same = (a, b) => fold(p.resolve(a)) === fold(p.resolve(b));
|
|
32015
32284
|
const resolved = p.resolve(cwd);
|
|
@@ -32147,13 +32416,13 @@ var init_login_runner = __esm({
|
|
|
32147
32416
|
});
|
|
32148
32417
|
|
|
32149
32418
|
// src/mcp/download.js
|
|
32150
|
-
import
|
|
32151
|
-
import
|
|
32419
|
+
import fs18 from "node:fs/promises";
|
|
32420
|
+
import path19 from "node:path";
|
|
32152
32421
|
async function reserveName(dir, stem) {
|
|
32153
32422
|
for (let n = 0; ; n++) {
|
|
32154
|
-
const file2 =
|
|
32423
|
+
const file2 = path19.join(dir, n === 0 ? `${stem}${ZIP}` : `${stem} (${n})${ZIP}`);
|
|
32155
32424
|
try {
|
|
32156
|
-
await (await
|
|
32425
|
+
await (await fs18.open(file2, "wx")).close();
|
|
32157
32426
|
return file2;
|
|
32158
32427
|
} catch (error2) {
|
|
32159
32428
|
if (!isErrno(error2, "EEXIST") || n >= 999) throw error2;
|
|
@@ -32163,16 +32432,16 @@ async function reserveName(dir, stem) {
|
|
|
32163
32432
|
async function saveZip(dir, fileName, bytes) {
|
|
32164
32433
|
const base = fileName.toLowerCase().endsWith(ZIP) ? fileName.slice(0, -ZIP.length) : fileName;
|
|
32165
32434
|
const stem = WINDOWS_DEVICE_NAME_RE.test(base) ? `${base}-canvas` : base;
|
|
32166
|
-
const tmp =
|
|
32435
|
+
const tmp = path19.join(dir, tempName(`.${stem}${ZIP}`));
|
|
32167
32436
|
let file2 = null;
|
|
32168
32437
|
try {
|
|
32169
|
-
await
|
|
32170
|
-
await
|
|
32438
|
+
await fs18.mkdir(dir, { recursive: true });
|
|
32439
|
+
await fs18.writeFile(tmp, bytes, { flag: "wx" });
|
|
32171
32440
|
file2 = await reserveName(dir, stem);
|
|
32172
|
-
await
|
|
32441
|
+
await fs18.rename(tmp, file2);
|
|
32173
32442
|
return file2;
|
|
32174
32443
|
} catch (error2) {
|
|
32175
|
-
await Promise.all([
|
|
32444
|
+
await Promise.all([fs18.rm(tmp, { force: true }), file2 ? fs18.rm(file2, { force: true }) : void 0]).catch(
|
|
32176
32445
|
() => void 0
|
|
32177
32446
|
);
|
|
32178
32447
|
const reason = isErrnoLike(error2) ? error2.code : "the file could not be written";
|
|
@@ -33001,8 +33270,8 @@ var init_sign_in_card = __esm({
|
|
|
33001
33270
|
});
|
|
33002
33271
|
|
|
33003
33272
|
// src/mcp/cards.js
|
|
33004
|
-
import
|
|
33005
|
-
import
|
|
33273
|
+
import fs19 from "node:fs/promises";
|
|
33274
|
+
import path20 from "node:path";
|
|
33006
33275
|
import { fileURLToPath } from "node:url";
|
|
33007
33276
|
function createCards(ctx, options) {
|
|
33008
33277
|
const appBrowser = () => options.appBrowser?.() ?? null;
|
|
@@ -33011,7 +33280,7 @@ function createCards(ctx, options) {
|
|
|
33011
33280
|
const script = (spec) => {
|
|
33012
33281
|
let read2 = scripts.get(spec);
|
|
33013
33282
|
if (!read2) {
|
|
33014
|
-
read2 =
|
|
33283
|
+
read2 = fs19.readFile(path20.join(dir, spec.bundle), "utf8").catch(() => null);
|
|
33015
33284
|
scripts.set(spec, read2);
|
|
33016
33285
|
}
|
|
33017
33286
|
return read2;
|
|
@@ -33028,6 +33297,7 @@ function createCards(ctx, options) {
|
|
|
33028
33297
|
const toolsOf = (spec) => {
|
|
33029
33298
|
if (spec === TASTE) return [tasteTool(uriOf(spec))];
|
|
33030
33299
|
if (spec === PLANS) return [plansTool(uriOf(spec)), checkoutTool()];
|
|
33300
|
+
if (spec === STARTERS) return [startersTool(uriOf(spec))];
|
|
33031
33301
|
if (spec === SIGN_IN) return [signInTool(uriOf(spec)), chatSignInTool(), chatGuestTool()];
|
|
33032
33302
|
return [];
|
|
33033
33303
|
};
|
|
@@ -33081,6 +33351,7 @@ function createCards(ctx, options) {
|
|
|
33081
33351
|
if (name === TASTE_CARD_TOOL2 && specs.includes(TASTE)) return inAppWords(await showTaste(ctx, args, signInBuilt));
|
|
33082
33352
|
if (name === PLANS_CARD_TOOL && specs.includes(PLANS)) return inAppWords(await showPlans(ctx, signInBuilt));
|
|
33083
33353
|
if (name === CHECKOUT_TOOL && specs.includes(PLANS)) return inAppWords(await checkout(ctx, args, signInBuilt));
|
|
33354
|
+
if (name === STARTERS_CARD_TOOL && specs.includes(STARTERS)) return showStarters(args);
|
|
33084
33355
|
if (name === SIGN_IN_CARD_TOOL && specs.includes(SIGN_IN)) {
|
|
33085
33356
|
return showSignIn(ctx, args, appBrowser()?.label ?? null);
|
|
33086
33357
|
}
|
|
@@ -33115,6 +33386,26 @@ async function showTaste(ctx, args, signInBuilt) {
|
|
|
33115
33386
|
return shownWords(`Kombai could not show this taste brief: ${error2.message}`);
|
|
33116
33387
|
}
|
|
33117
33388
|
}
|
|
33389
|
+
function showStarters(args) {
|
|
33390
|
+
const { plugin } = args;
|
|
33391
|
+
if (plugin !== void 0 && (typeof plugin !== "string" || !KOMBAI_PLUGIN.test(plugin))) {
|
|
33392
|
+
return failed("plugin must be Kombai's plugin id in Codex (kombai@ and its marketplace), or left out.");
|
|
33393
|
+
}
|
|
33394
|
+
const prompts = STARTER_PROMPTS.map(({ title, text }) => ({
|
|
33395
|
+
title,
|
|
33396
|
+
text,
|
|
33397
|
+
prompt: plugin ? `[@Kombai](plugin://${plugin}) ${text.charAt(0).toLowerCase()}${text.slice(1)}` : `${text} with Kombai`
|
|
33398
|
+
}));
|
|
33399
|
+
return {
|
|
33400
|
+
structuredContent: { prompts },
|
|
33401
|
+
content: [
|
|
33402
|
+
{
|
|
33403
|
+
type: "text",
|
|
33404
|
+
text: "Showing prompts to try with Kombai in the chat. Each Try opens a new chat with its prompt. Do not list them in text, and end your turn."
|
|
33405
|
+
}
|
|
33406
|
+
]
|
|
33407
|
+
};
|
|
33408
|
+
}
|
|
33118
33409
|
async function showPlans(ctx, signInBuilt) {
|
|
33119
33410
|
const { hosts } = await currentEnv(ctx);
|
|
33120
33411
|
const plansLink = { url: `${hosts.web}/account/plan` };
|
|
@@ -33238,7 +33529,7 @@ function failed(message) {
|
|
|
33238
33529
|
function shownWords(message) {
|
|
33239
33530
|
return { content: [{ type: "text", text: message }] };
|
|
33240
33531
|
}
|
|
33241
|
-
var TASTE_CARD_TOOL2, PLANS_CARD_TOOL, CHECKOUT_TOOL, SIGN_IN_CARD_TOOL, CHAT_SIGN_IN_TOOL, CHAT_GUEST_TOOL, SIGNIN_REQUIRED, CARDS_DIR, GOOGLE_FONTS, INLINE, TASTE, PLANS, SIGN_IN, specsIn, reads, acts, icons, tasteTool, plansTool, checkoutTool, signInTool, chatSignInTool, chatGuestTool;
|
|
33532
|
+
var TASTE_CARD_TOOL2, PLANS_CARD_TOOL, CHECKOUT_TOOL, SIGN_IN_CARD_TOOL, CHAT_SIGN_IN_TOOL, CHAT_GUEST_TOOL, STARTERS_CARD_TOOL, KOMBAI_PLUGIN, STARTER_PROMPTS, SIGNIN_REQUIRED, CARDS_DIR, GOOGLE_FONTS, INLINE, TASTE, PLANS, SIGN_IN, STARTERS, specsIn, reads, acts, icons, tasteTool, plansTool, checkoutTool, signInTool, startersTool, chatSignInTool, chatGuestTool;
|
|
33242
33533
|
var init_cards = __esm({
|
|
33243
33534
|
"src/mcp/cards.js"() {
|
|
33244
33535
|
"use strict";
|
|
@@ -33259,6 +33550,13 @@ var init_cards = __esm({
|
|
|
33259
33550
|
SIGN_IN_CARD_TOOL = "sign_in_card";
|
|
33260
33551
|
CHAT_SIGN_IN_TOOL = "chat_sign_in";
|
|
33261
33552
|
CHAT_GUEST_TOOL = "chat_guest";
|
|
33553
|
+
STARTERS_CARD_TOOL = "starters_card";
|
|
33554
|
+
KOMBAI_PLUGIN = /^kombai@[A-Za-z0-9][A-Za-z0-9._~-]{0,199}$/;
|
|
33555
|
+
STARTER_PROMPTS = Object.freeze([
|
|
33556
|
+
{ title: "Coffee landing page", text: "Design a landing page for a specialty coffee brand" },
|
|
33557
|
+
{ title: "Pricing page directions", text: "Explore three design directions for a SaaS pricing page" },
|
|
33558
|
+
{ title: "Fitness dashboard", text: "Design an analytics dashboard for a fitness app" }
|
|
33559
|
+
]);
|
|
33262
33560
|
SIGNIN_REQUIRED = "CLI_SIGNIN_REQUIRED";
|
|
33263
33561
|
CARDS_DIR = fileURLToPath(new URL("./mcp-apps/", import.meta.url));
|
|
33264
33562
|
GOOGLE_FONTS = ["https://fonts.googleapis.com", "https://fonts.gstatic.com"];
|
|
@@ -33300,7 +33598,20 @@ var init_cards = __esm({
|
|
|
33300
33598
|
"openai/widgetHeightHint": 180
|
|
33301
33599
|
}
|
|
33302
33600
|
};
|
|
33303
|
-
|
|
33601
|
+
STARTERS = {
|
|
33602
|
+
uriBase: "ui://kombai/cli-starters",
|
|
33603
|
+
bundle: "starters.js",
|
|
33604
|
+
title: "Kombai",
|
|
33605
|
+
rootId: "kombai-starters",
|
|
33606
|
+
global: "__kombaiStarters",
|
|
33607
|
+
// No fetches at all: the prompts come in the tool result, and Try asks the host for a new chat.
|
|
33608
|
+
meta: {
|
|
33609
|
+
ui: { csp: { connectDomains: [], resourceDomains: [] }, prefersBorder: true },
|
|
33610
|
+
...INLINE,
|
|
33611
|
+
"openai/widgetHeightHint": 320
|
|
33612
|
+
}
|
|
33613
|
+
};
|
|
33614
|
+
specsIn = (set2) => set2 === Cards.All ? [TASTE, PLANS, STARTERS, SIGN_IN] : set2 === Cards.Taste ? [TASTE] : [];
|
|
33304
33615
|
reads = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
33305
33616
|
acts = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true };
|
|
33306
33617
|
icons = () => KOMBAI_ICONS.map((icon) => ({ ...icon, sizes: [...icon.sizes] }));
|
|
@@ -33369,6 +33680,24 @@ var init_cards = __esm({
|
|
|
33369
33680
|
annotations: reads,
|
|
33370
33681
|
_meta: { ui: { resourceUri, visibility: ["model", "app"] } }
|
|
33371
33682
|
});
|
|
33683
|
+
startersTool = (resourceUri) => ({
|
|
33684
|
+
name: STARTERS_CARD_TOOL,
|
|
33685
|
+
title: "Try Kombai",
|
|
33686
|
+
description: "Show prompts to try with Kombai as a card in this chat. Each has a Try button that opens a new chat with its prompt filled in. Call it at the end of Kombai's onboarding, with plugin set to the Kombai plugin id the onboarding skill gives, then end your turn with one line. Do not list the prompts in text.",
|
|
33687
|
+
inputSchema: {
|
|
33688
|
+
type: "object",
|
|
33689
|
+
properties: {
|
|
33690
|
+
plugin: {
|
|
33691
|
+
type: "string",
|
|
33692
|
+
description: "Kombai's plugin id in Codex, e.g. kombai@openai-curated-remote: each prompt mentions it. Leave it out to name Kombai in words."
|
|
33693
|
+
}
|
|
33694
|
+
},
|
|
33695
|
+
additionalProperties: false
|
|
33696
|
+
},
|
|
33697
|
+
icons: icons(),
|
|
33698
|
+
annotations: reads,
|
|
33699
|
+
_meta: { ui: { resourceUri, visibility: ["model", "app"] } }
|
|
33700
|
+
});
|
|
33372
33701
|
chatSignInTool = () => ({
|
|
33373
33702
|
name: CHAT_SIGN_IN_TOOL,
|
|
33374
33703
|
title: "Sign in to Kombai",
|
|
@@ -34229,7 +34558,7 @@ html.dark #cover{background:rgba(30,30,30,.6)}
|
|
|
34229
34558
|
|
|
34230
34559
|
// src/mcp/server.js
|
|
34231
34560
|
import os2 from "node:os";
|
|
34232
|
-
import
|
|
34561
|
+
import path21 from "node:path";
|
|
34233
34562
|
function createMcpServer(ctx, options = {}) {
|
|
34234
34563
|
const place = {
|
|
34235
34564
|
cwd: ctx.cwd,
|
|
@@ -34255,7 +34584,7 @@ function createMcpServer(ctx, options = {}) {
|
|
|
34255
34584
|
const login2 = createLoginRunner(ctx, { inApp: () => appBrowser() !== null });
|
|
34256
34585
|
const callSession = createSessionTool(ctx, { login: login2 });
|
|
34257
34586
|
const cards = createCards(ctx, { dir: options.cardsDir, login: login2, appBrowser });
|
|
34258
|
-
const downloadsDir =
|
|
34587
|
+
const downloadsDir = path21.join(place.osHome, "Downloads");
|
|
34259
34588
|
const resourceMeta = async () => {
|
|
34260
34589
|
const { hosts } = await currentEnv(ctx);
|
|
34261
34590
|
return {
|
|
@@ -34462,7 +34791,7 @@ var init_claude_desktop = __esm({
|
|
|
34462
34791
|
var codex_desktop_default;
|
|
34463
34792
|
var init_codex_desktop = __esm({
|
|
34464
34793
|
"src/skill/codex-desktop.md"() {
|
|
34465
|
-
codex_desktop_default = "You are running in the Codex app. Notes for it:\n\n- Kombai's tools here (canvas_app, sign_in_card, taste_card, plans_card) are not listed up front. Find them in\n exec with `ALL_TOOLS.filter((t) => t.name.startsWith('mcp__kombai'))` before you decide one is missing.\n- The canvas: Kombai's view, the canvas_app tool, is the only way to show it here. Call it with the canvas id\n right after `kombai canvas create`, before you write any design, or when you first use a canvas that isn't\n already open beside the chat, as `kombai skill opening` says. Never open a canvas in a browser or the in-app\n browser, and put no canvas or design link in a reply: the commands print none here, and a user who wants one\n copies it from the view (the canvas's Share, or a design's Copy link).\n- Taste: add --cards to every `kombai taste start`, and call taste_card when `kombai taste wait` answers with\n card.\n";
|
|
34794
|
+
codex_desktop_default = "You are running in the Codex app. Notes for it:\n\n- Kombai's tools here (canvas_app, sign_in_card, taste_card, plans_card) are not listed up front. Find them in\n exec with `ALL_TOOLS.filter((t) => t.name.startsWith('mcp__kombai'))` before you decide one is missing. Do that\n first, before any design work: if none exist, set up Kombai's view as `kombai skill opening` says and move the\n work to a new task, since this one can't show the canvas.\n- The canvas: Kombai's view, the canvas_app tool, is the only way to show it here. Call it with the canvas id\n right after `kombai canvas create`, before you write any design, or when you first use a canvas that isn't\n already open beside the chat, as `kombai skill opening` says. Never open a canvas in a browser or the in-app\n browser, and put no canvas or design link in a reply: the commands print none here, and a user who wants one\n copies it from the view (the canvas's Share, or a design's Copy link).\n- Taste: add --cards to every `kombai taste start`, and call taste_card when `kombai taste wait` answers with\n card.\n";
|
|
34466
34795
|
}
|
|
34467
34796
|
});
|
|
34468
34797
|
|
|
@@ -34502,7 +34831,7 @@ var init_html = __esm({
|
|
|
34502
34831
|
var opening_codex_default;
|
|
34503
34832
|
var init_opening_codex = __esm({
|
|
34504
34833
|
"src/skill/opening-codex.md"() {
|
|
34505
|
-
opening_codex_default = "# Showing the canvas\n\nIn the Codex app, Kombai's view shows a canvas beside the chat. It is the only way to show one here: no\nbrowser, no in-app browser, no link.\n\n1. **Find the view.** Codex lists no MCP tool up front, so search even when you see none: in exec,\n `ALL_TOOLS.filter((t) => t.name.endsWith('canvas_app'))`.\n2. **Call `canvas_app` with the canvas id** right after `kombai canvas create`, before you write any design,\n or when you first use a canvas that isn't already open beside the chat. A request from the canvas, copied\n from its page or put in the message box by the view, comes from a canvas the user has open: don't call it\n for that one. Set `node` to a design id to focus one. Each call opens another view, and the view updates\n live as you push, so call it again only when the user asks to see the canvas again or says they closed it.\n3. **No canvas_app tool?**
|
|
34834
|
+
opening_codex_default = "# Showing the canvas\n\nIn the Codex app, Kombai's view shows a canvas beside the chat. It is the only way to show one here: no\nbrowser, no in-app browser, no link.\n\n1. **Find the view.** Codex lists no MCP tool up front, so search even when you see none: in exec,\n `ALL_TOOLS.filter((t) => t.name.endsWith('canvas_app'))`.\n2. **Call `canvas_app` with the canvas id** right after `kombai canvas create`, before you write any design,\n or when you first use a canvas that isn't already open beside the chat. A request from the canvas, copied\n from its page or put in the message box by the view, comes from a canvas the user has open: don't call it\n for that one. Set `node` to a design id to focus one. Each call opens another view, and the view updates\n live as you push, so call it again only when the user asks to see the canvas again or says they closed it.\n3. **No canvas_app tool?** Kombai's view isn't set up in Codex yet: set it up now, without asking, before any\n design work. Run `kombai mcp install codex`, then tell the user in one line that it added Kombai's view to\n Codex. A running task never picks up a new MCP server, so the work belongs in a new task: offer in one line to\n continue there, with `[Continue in a new chat \u2192](codex://threads/new?prompt=\u2026)`, a link that opens it with its\n prompt filled in (build the link in exec with `encodeURIComponent`, then `(` and `)` as `%28` and `%29`, so a\n bracket in the request can't end the link). The prompt is Kombai's mention where the\n plugin's skill names Kombai's plugin id, then the user's request in their own words, the files they named, and\n any canvas or brief already made, so it continues rather than repeats. On yes, create it (`create_thread`) with\n the same prompt. Codex starts a new task only when the user asks; if they say no, or you can't create one, give\n them the prompt to paste into a new task. If it answers with `disabled: true`, Kombai's view is turned off in\n the user's Codex config: tell the user the canvas can't be shown until they turn it on, and start no task for it.\n If it answers `already` and this task started after the view was set up, Kombai's view isn't starting: tell the\n user the canvas can't be shown and why (Kombai's server fails to start, for example on a Node older than 20),\n and start no task for it. If the command fails, or running it outside the sandbox is declined, tell the user the canvas can't be\n shown in this chat, and don't show it any other way.\n4. **canvas_app answers an error?** Tell the user what it says in one line. Don't show the canvas any other\n way.\n\nMake changes with the commands, never through the view.\n\n**No links.** The commands print no canvas or design link here. The user watches every change in the view: end\nwith a short line on what you made or changed, naming designs by their labels, and don't ask them to open the\ncanvas. If the user asks for a link, tell them the view copies it: the canvas's Share button, or Copy link on a\ndesign's right-click menu. Never give the design's .html file. A user who wants the canvas in their own browser\nopens that copied link there; never open one yourself.\n\n**A new canvas is private.** Don't suggest the user send its link to anyone before sharing is on.\n\n**Never turn sharing on by yourself.** Run `kombai canvas share --on` only when the user asks for a link others can open, and tell them in the reply that anyone with the link can now view it, that teammates can edit it, and that the canvas's Share button copies it.\n";
|
|
34506
34835
|
}
|
|
34507
34836
|
});
|
|
34508
34837
|
|
|
@@ -34510,7 +34839,7 @@ var init_opening_codex = __esm({
|
|
|
34510
34839
|
var opening_default;
|
|
34511
34840
|
var init_opening = __esm({
|
|
34512
34841
|
"src/skill/opening.md"() {
|
|
34513
|
-
opening_default = "# Showing the canvas\n\nShow a canvas to the user once, when you create or first use it. The page updates live as you push, so\nnever open it again after a push. Pick the first of these that fits:\n\n1. **A `canvas_app` tool is among your tools** (the Kombai view; the Codex app lists no MCP tool up front, so\n filter ALL_TOOLS for canvas_app there before you pick): call `canvas_app` with the canvas id, and `node`\n set to a design id to focus one. It shows the canvas beside the chat. Call it once per canvas: each call\n opens another view. Make changes with the commands, never through the view.\n2. **No `canvas_app`, and you have a browser panel the user can see** (the one you sign in with,\n `kombai skill sign-in`: the Claude desktop app's Browser pane, VS Code's Integrated Browser through\n `open_browser_page`): `kombai canvas url --canvas <id> --in-app` prints a signed-in link. Open it in your\n panel. It works once, within 10 minutes; for a later visit, run it again.\n3. **Otherwise**: `kombai canvas open --canvas <id>` opens the canvas in the user's browser, signed in.\n If it answers opened: false (no browser on this machine), give the user the link it printed instead.\n\nIn the Codex app use 1 alone: with no canvas_app there,
|
|
34842
|
+
opening_default = "# Showing the canvas\n\nShow a canvas to the user once, when you create or first use it. The page updates live as you push, so\nnever open it again after a push. Pick the first of these that fits:\n\n1. **A `canvas_app` tool is among your tools** (the Kombai view; the Codex app lists no MCP tool up front, so\n filter ALL_TOOLS for canvas_app there before you pick): call `canvas_app` with the canvas id, and `node`\n set to a design id to focus one. It shows the canvas beside the chat. Call it once per canvas: each call\n opens another view. Make changes with the commands, never through the view.\n2. **No `canvas_app`, and you have a browser panel the user can see** (the one you sign in with,\n `kombai skill sign-in`: the Claude desktop app's Browser pane, VS Code's Integrated Browser through\n `open_browser_page`): `kombai canvas url --canvas <id> --in-app` prints a signed-in link. Open it in your\n panel. It works once, within 10 minutes; for a later visit, run it again.\n3. **Otherwise**: `kombai canvas open --canvas <id>` opens the canvas in the user's browser, signed in.\n If it answers opened: false (no browser on this machine), give the user the link it printed instead.\n\nIn the Codex app use 1 alone: with no canvas_app there, run `kombai mcp install codex` without asking and continue in\na new task, and show no link.\n\nTo point the user at one design, give the `url` node start, node pull or node push printed for it, or\nadd ?node=<node> to the canvas link. Never the design's .html file, and never a link that holds a\n#ticket=; it signs in whoever opens it first.\n\n**Beside the chat, no links.** Once `canvas_app` shows the canvas, the user watches every change there.\nEnd with a short line on what you made or changed, naming designs by their labels. Put no canvas or\ndesign link in your replies, and don't ask the user to open the canvas. Give a link only when the user\nasks for one.\n\n**A new canvas is private.** When you give the user a link, don't suggest they send it to anyone before sharing it.\n\n**Never turn sharing on by yourself.** Run `kombai canvas share --on` only when the user asks for a link others can open, and tell them in the reply that anyone with the link can now view it and teammates can edit it.\n";
|
|
34514
34843
|
}
|
|
34515
34844
|
});
|
|
34516
34845
|
|
|
@@ -34572,8 +34901,8 @@ var init_skill = __esm({
|
|
|
34572
34901
|
"sign-in": sign_in_default,
|
|
34573
34902
|
faq: faq_default
|
|
34574
34903
|
};
|
|
34575
|
-
RUN = `Commands here are written as \`kombai <command>\`.
|
|
34576
|
-
\`${CLI_RUN}
|
|
34904
|
+
RUN = `Commands here and in a result's next are written as \`kombai <command>\`. Run each as
|
|
34905
|
+
\`${CLI_RUN} <command>\`, in full, never from a variable.`;
|
|
34577
34906
|
APP_NOTES = { "claude-desktop": claude_desktop_default, "codex-desktop": codex_desktop_default };
|
|
34578
34907
|
skill = {
|
|
34579
34908
|
name: "skill",
|
|
@@ -34602,14 +34931,56 @@ var init_skill = __esm({
|
|
|
34602
34931
|
});
|
|
34603
34932
|
|
|
34604
34933
|
// src/commands/mcp.js
|
|
34605
|
-
|
|
34934
|
+
import os3 from "node:os";
|
|
34935
|
+
var CLIENT_ARG, HANDOFF, mcpInstall, mcpUninstall, mcp;
|
|
34606
34936
|
var init_mcp = __esm({
|
|
34607
34937
|
"src/commands/mcp.js"() {
|
|
34608
34938
|
"use strict";
|
|
34609
34939
|
init_define_KOMBAI_TELEMETRY();
|
|
34940
|
+
init_install();
|
|
34941
|
+
init_codexLinks();
|
|
34610
34942
|
init_server3();
|
|
34611
34943
|
init_output();
|
|
34612
34944
|
init_skill();
|
|
34945
|
+
CLIENT_ARG = [{ name: "client", required: true, values: Object.values(McpClient) }];
|
|
34946
|
+
HANDOFF = `Write the new task's prompt: Kombai's mention [@Kombai](plugin://<id>) where the skill names Kombai's plugin id, then the user's request in their own words, the files they named and any canvas or brief already made, so it continues rather than repeats. Offer the user, in one line, to continue in a new task, with [Continue in a new chat \u2192](${CODEX_NEW_CHAT_URL}\u2026), a link that opens one with the prompt filled in: build it in exec with encodeURIComponent, then ( and ) as %28 and %29. On yes, create the task (create_thread) with the same prompt. If you can't, give them the prompt to paste into a new task.`;
|
|
34947
|
+
mcpInstall = {
|
|
34948
|
+
name: "mcp install",
|
|
34949
|
+
summary: "Add Kombai's canvas view to Codex: writes the Kombai CLI's MCP server into Codex's config.toml. New Codex tasks get it.",
|
|
34950
|
+
args: CLIENT_ARG,
|
|
34951
|
+
example: "kombai mcp install codex",
|
|
34952
|
+
async run(ctx) {
|
|
34953
|
+
const codexHome = codexHomeOf(process.env, os3.homedir());
|
|
34954
|
+
const outcome = await installCodexEntry(codexHome, ctx.platform);
|
|
34955
|
+
const config2 = codexConfigOf(codexHome);
|
|
34956
|
+
if (outcome === InstallOutcome.Already && await codexEntryDisabled(codexHome)) {
|
|
34957
|
+
return {
|
|
34958
|
+
client: McpClient.Codex,
|
|
34959
|
+
outcome,
|
|
34960
|
+
config: config2,
|
|
34961
|
+
disabled: true,
|
|
34962
|
+
next: `Kombai's view is set up in ${config2} but turned off (enabled = false), so no Codex task gets it: tell the user the canvas can't be shown until they remove that line or set it to true, and start no new task for it.`
|
|
34963
|
+
};
|
|
34964
|
+
}
|
|
34965
|
+
return {
|
|
34966
|
+
client: McpClient.Codex,
|
|
34967
|
+
outcome,
|
|
34968
|
+
config: config2,
|
|
34969
|
+
next: outcome === InstallOutcome.Already ? `Kombai's view is already set up in ${config2}. If this task started after that and still has no canvas_app, the server isn't starting (\`npx -y @kombai/cli@latest mcp\` fails, for example on a Node older than 20): tell the user the canvas can't be shown and why, and start no further task for it. A task started before that has no canvas_app yet: move the work to a new task. ${HANDOFF}` : "Kombai's view is set up for new Codex tasks; this one never picks up a newly added MCP server. " + HANDOFF
|
|
34970
|
+
};
|
|
34971
|
+
}
|
|
34972
|
+
};
|
|
34973
|
+
mcpUninstall = {
|
|
34974
|
+
name: "mcp uninstall",
|
|
34975
|
+
summary: "Remove the entry `kombai mcp install` added.",
|
|
34976
|
+
args: CLIENT_ARG,
|
|
34977
|
+
example: "kombai mcp uninstall codex",
|
|
34978
|
+
async run(ctx) {
|
|
34979
|
+
const codexHome = codexHomeOf(process.env, os3.homedir());
|
|
34980
|
+
const outcome = await uninstallCodexEntry(codexHome, ctx.platform);
|
|
34981
|
+
return { client: McpClient.Codex, outcome, config: codexConfigOf(codexHome) };
|
|
34982
|
+
}
|
|
34983
|
+
};
|
|
34613
34984
|
mcp = {
|
|
34614
34985
|
name: "mcp",
|
|
34615
34986
|
summary: "Serve Kombai's canvas view and cards to Codex and Claude Code over stdin and stdout. The agent starts it; people don't run it.",
|
|
@@ -34630,8 +35001,8 @@ var init_mcp = __esm({
|
|
|
34630
35001
|
});
|
|
34631
35002
|
|
|
34632
35003
|
// src/commands/node.js
|
|
34633
|
-
import
|
|
34634
|
-
import
|
|
35004
|
+
import fs20 from "node:fs/promises";
|
|
35005
|
+
import path22 from "node:path";
|
|
34635
35006
|
async function placeText(cc) {
|
|
34636
35007
|
try {
|
|
34637
35008
|
const read2 = (await cc.session.api.call({ method: "GET", path: `/design/canvases/${cc.canvasId}` })).body;
|
|
@@ -34673,10 +35044,10 @@ function rectFrom(value) {
|
|
|
34673
35044
|
return { x, y, w, h };
|
|
34674
35045
|
}
|
|
34675
35046
|
async function readDrawingFile(ctx, given2) {
|
|
34676
|
-
const file2 =
|
|
35047
|
+
const file2 = path22.resolve(ctx.cwd, given2);
|
|
34677
35048
|
let bytes;
|
|
34678
35049
|
try {
|
|
34679
|
-
bytes = new Uint8Array(await
|
|
35050
|
+
bytes = new Uint8Array(await fs20.readFile(file2));
|
|
34680
35051
|
} catch (error2) {
|
|
34681
35052
|
if (isErrno(error2, "ENOENT"))
|
|
34682
35053
|
throw new CliError("CLI_FILE_MISSING", `${file2} does not exist.`, { details: { path: file2 } });
|
|
@@ -34931,7 +35302,7 @@ async function pushDrawing(ctx, cc, projectId, nodeId, entry, saved) {
|
|
|
34931
35302
|
if (!saved && sent === entry.files.content) {
|
|
34932
35303
|
return { nodeId, status: "unchanged", version: entry.version, images: { uploaded: 0, stored: 0 } };
|
|
34933
35304
|
}
|
|
34934
|
-
const before = parseStored(await
|
|
35305
|
+
const before = parseStored(await fs20.readFile(baseFile(paths, nodeId, "content")).catch(() => null));
|
|
34935
35306
|
const images = await storeDrawingPicture(cc, projectId, drawing, file2, nodeId, before?.src);
|
|
34936
35307
|
const body = {
|
|
34937
35308
|
ifVersion: saved?.version ?? entry.version,
|
|
@@ -35008,7 +35379,7 @@ async function storeDrawingPicture(cc, projectId, drawing, file2, nodeId, stored
|
|
|
35008
35379
|
}
|
|
35009
35380
|
throw error2;
|
|
35010
35381
|
}
|
|
35011
|
-
if (image.sha256 !==
|
|
35382
|
+
if (image.sha256 !== path22.posix.basename(src).split(".")[0]) {
|
|
35012
35383
|
throw badDrawing(
|
|
35013
35384
|
file2,
|
|
35014
35385
|
nodeId,
|
|
@@ -35130,14 +35501,14 @@ async function explainGone(ctx, cc, nodeId, error2) {
|
|
|
35130
35501
|
}
|
|
35131
35502
|
async function saveConflict2(paths, canvasId, nodeId, stored, files) {
|
|
35132
35503
|
await removeRemotes(paths, nodeId);
|
|
35133
|
-
const dir =
|
|
35134
|
-
await
|
|
35135
|
-
if (files.html) await writeFileAtomic(
|
|
35136
|
-
if (files.overrides) await writeFileAtomic(
|
|
35137
|
-
if (files.content) await writeFileAtomic(
|
|
35138
|
-
await writeJsonAtomic(
|
|
35504
|
+
const dir = path22.join(paths.remote, `${nodeId}@v${stored.version}`);
|
|
35505
|
+
await fs20.mkdir(dir, { recursive: true });
|
|
35506
|
+
if (files.html) await writeFileAtomic(path22.join(dir, "node.html"), files.html, { mode: 420 });
|
|
35507
|
+
if (files.overrides) await writeFileAtomic(path22.join(dir, "node.overrides.json"), files.overrides, { mode: 420 });
|
|
35508
|
+
if (files.content) await writeFileAtomic(path22.join(dir, "node.content.json"), files.content, { mode: 420 });
|
|
35509
|
+
await writeJsonAtomic(path22.join(dir, "images.json"), stored.images ?? [], { mode: 420 });
|
|
35139
35510
|
await writeJsonAtomic(
|
|
35140
|
-
|
|
35511
|
+
path22.join(dir, "node.json"),
|
|
35141
35512
|
{ version: stored.version, state: stored.state, modifiedBy: stored.modifiedBy, node: stored.node },
|
|
35142
35513
|
{ mode: 420 }
|
|
35143
35514
|
);
|
|
@@ -35160,16 +35531,16 @@ async function saveConflict2(paths, canvasId, nodeId, stored, files) {
|
|
|
35160
35531
|
);
|
|
35161
35532
|
}
|
|
35162
35533
|
async function latestRemote2(paths, nodeId) {
|
|
35163
|
-
const names = await
|
|
35534
|
+
const names = await fs20.readdir(paths.remote).catch(() => (
|
|
35164
35535
|
/** @type {string[]} */
|
|
35165
35536
|
[]
|
|
35166
35537
|
));
|
|
35167
35538
|
const versions = names.map((name) => name.startsWith(`${nodeId}@v`) ? Number(name.slice(nodeId.length + 2)) : NaN).filter(Number.isInteger).sort((a, b) => b - a);
|
|
35168
35539
|
if (!versions.length) return null;
|
|
35169
|
-
const dir =
|
|
35540
|
+
const dir = path22.join(paths.remote, `${nodeId}@v${versions[0]}`);
|
|
35170
35541
|
const saved = (
|
|
35171
35542
|
/** @type {{ version?: number, node?: unknown } | undefined} */
|
|
35172
|
-
await readJson(
|
|
35543
|
+
await readJson(path22.join(dir, "node.json"))
|
|
35173
35544
|
);
|
|
35174
35545
|
const node = saved?.node && typeof saved.node === "object" ? (
|
|
35175
35546
|
/** @type {Record<string, unknown>} */
|
|
@@ -35191,7 +35562,7 @@ async function readNode(cc, nodeId) {
|
|
|
35191
35562
|
}
|
|
35192
35563
|
async function readWorking(paths, nodeId, kind) {
|
|
35193
35564
|
try {
|
|
35194
|
-
return new Uint8Array(await
|
|
35565
|
+
return new Uint8Array(await fs20.readFile(workingFile(paths, nodeId, kind)));
|
|
35195
35566
|
} catch (error2) {
|
|
35196
35567
|
if (isErrno(error2, "ENOENT")) return null;
|
|
35197
35568
|
throw error2;
|
|
@@ -35199,7 +35570,7 @@ async function readWorking(paths, nodeId, kind) {
|
|
|
35199
35570
|
}
|
|
35200
35571
|
async function baseCopies2(paths, nodeId, entry) {
|
|
35201
35572
|
const files = {};
|
|
35202
|
-
for (const kind of KINDS) if (entry.files[kind]) files[kind] = await
|
|
35573
|
+
for (const kind of KINDS) if (entry.files[kind]) files[kind] = await fs20.readFile(baseFile(paths, nodeId, kind));
|
|
35203
35574
|
return files;
|
|
35204
35575
|
}
|
|
35205
35576
|
var PUSH_TRIES, START_TRIES2, TEXT_SIZE, PLACEMENT_GAP, EMPTY_HTML, CONFLICT_MARKER, RECT_PROBLEM, DATA_KIDS_MODULE, STOPS_PUSH, nodeStart, nodePull, nodePush, nodeLock, nodeUnlock;
|
|
@@ -35335,11 +35706,11 @@ var init_node = __esm({
|
|
|
35335
35706
|
return Object.keys(base.nodes).length === 0 && Object.keys(base.starts).length === 0;
|
|
35336
35707
|
});
|
|
35337
35708
|
if (fresh && unused && (error2.status === 404 || error2.status === 410)) {
|
|
35338
|
-
const files = await
|
|
35709
|
+
const files = await fs20.readdir(paths.nodes).catch(() => (
|
|
35339
35710
|
/** @type {string[]} */
|
|
35340
35711
|
[]
|
|
35341
35712
|
));
|
|
35342
|
-
if (!files.length) await
|
|
35713
|
+
if (!files.length) await fs20.rm(paths.dir, { recursive: true, force: true });
|
|
35343
35714
|
}
|
|
35344
35715
|
}
|
|
35345
35716
|
throw await canvasGone(cc, error2);
|
|
@@ -35464,7 +35835,7 @@ var init_node = __esm({
|
|
|
35464
35835
|
type,
|
|
35465
35836
|
version: read2.version,
|
|
35466
35837
|
state: read2.state,
|
|
35467
|
-
file: info.file ?
|
|
35838
|
+
file: info.file ? path22.join(paths.dir, info.file) : null,
|
|
35468
35839
|
...linkField(ctx, nodeLink(cc, nodeId)),
|
|
35469
35840
|
overrides: files.overrides ? workingFile(paths, nodeId, "overrides") : null,
|
|
35470
35841
|
images: read2.images ?? [],
|
|
@@ -35692,7 +36063,7 @@ var init_pngtiles = __esm({
|
|
|
35692
36063
|
|
|
35693
36064
|
// src/commands/screenshot.js
|
|
35694
36065
|
import { execFile as execFile2 } from "node:child_process";
|
|
35695
|
-
import
|
|
36066
|
+
import path23 from "node:path";
|
|
35696
36067
|
async function writeTiles(ctx, dir, nodeId, version2, png, screenshotFile) {
|
|
35697
36068
|
const tiles = png ? pngTiles(png, TILE_HEIGHT) : null;
|
|
35698
36069
|
if (!tiles) {
|
|
@@ -35703,8 +36074,8 @@ async function writeTiles(ctx, dir, nodeId, version2, png, screenshotFile) {
|
|
|
35703
36074
|
});
|
|
35704
36075
|
return [screenshotFile];
|
|
35705
36076
|
}
|
|
35706
|
-
if (tiles.length === 1) return [
|
|
35707
|
-
const files = tiles.map((_, i) =>
|
|
36077
|
+
if (tiles.length === 1) return [path23.join(dir, `${nodeId}@v${version2}.png`)];
|
|
36078
|
+
const files = tiles.map((_, i) => path23.join(dir, `${nodeId}@v${version2}.tile-${i + 1}.png`));
|
|
35708
36079
|
await Promise.all(files.map((file2, i) => writeFileAtomic(file2, tiles[i], { mode: 420 })));
|
|
35709
36080
|
return files;
|
|
35710
36081
|
}
|
|
@@ -35800,7 +36171,7 @@ var init_screenshot = __esm({
|
|
|
35800
36171
|
if (named2 && flags.canvas === void 0) {
|
|
35801
36172
|
throw new CliError("CLI_BAD_FLAG", "--node needs --canvas.", { next: "kombai screenshot fill --help" });
|
|
35802
36173
|
}
|
|
35803
|
-
const browserFlag = flags.browser === void 0 ? void 0 :
|
|
36174
|
+
const browserFlag = flags.browser === void 0 ? void 0 : path23.resolve(ctx.cwd, String(flags.browser));
|
|
35804
36175
|
if (browserFlag) {
|
|
35805
36176
|
await checkNamedBrowser(
|
|
35806
36177
|
browserFlag,
|
|
@@ -36008,14 +36379,14 @@ var init_screenshot = __esm({
|
|
|
36008
36379
|
if (shot.state === "ok" && shot.screenshot) {
|
|
36009
36380
|
const dir = canvasPaths(cc.work, canvasId).screenshots;
|
|
36010
36381
|
await ensureDir(dir);
|
|
36011
|
-
const screenshotFile =
|
|
36382
|
+
const screenshotFile = path23.join(dir, `${nodeId}@v${read2.version}.jpg`);
|
|
36012
36383
|
await writeFileAtomic(screenshotFile, await cc.session.api.download(shot.screenshot, deadline), {
|
|
36013
36384
|
mode: 420
|
|
36014
36385
|
});
|
|
36015
36386
|
let screenshotPngFile = null;
|
|
36016
36387
|
let png = null;
|
|
36017
36388
|
if (shot.screenshotPng) {
|
|
36018
|
-
screenshotPngFile =
|
|
36389
|
+
screenshotPngFile = path23.join(dir, `${nodeId}@v${read2.version}.png`);
|
|
36019
36390
|
png = await cc.session.api.download(shot.screenshotPng, deadline);
|
|
36020
36391
|
await writeFileAtomic(screenshotPngFile, png, { mode: 420 });
|
|
36021
36392
|
}
|
|
@@ -36078,7 +36449,7 @@ var init_screenshot = __esm({
|
|
|
36078
36449
|
);
|
|
36079
36450
|
}
|
|
36080
36451
|
ctx.stderr.write(
|
|
36081
|
-
`Download chrome-headless-shell ${PINNED_BUILD} (about 100 MB) into ${
|
|
36452
|
+
`Download chrome-headless-shell ${PINNED_BUILD} (about 100 MB) into ${path23.join(ctx.home, "browser")}? [y/N] `
|
|
36082
36453
|
);
|
|
36083
36454
|
if (!/^y(es)?$/i.test(await readLine())) throw new CliError("CLI_CANCELLED", "Nothing was downloaded.");
|
|
36084
36455
|
}
|
|
@@ -36088,7 +36459,7 @@ var init_screenshot = __esm({
|
|
|
36088
36459
|
/** @type {typeof import('../render/install-entry.js')} */
|
|
36089
36460
|
await import(INSTALL_MODULE)
|
|
36090
36461
|
);
|
|
36091
|
-
const executable = await installHeadlessShell(
|
|
36462
|
+
const executable = await installHeadlessShell(path23.join(ctx.home, "browser"), PINNED_BUILD);
|
|
36092
36463
|
const answer2 = await askVersion(executable, 3e4);
|
|
36093
36464
|
if (!answer2.version) {
|
|
36094
36465
|
throw new CliError(
|
|
@@ -36106,7 +36477,7 @@ var init_screenshot = __esm({
|
|
|
36106
36477
|
summary: "Save the path of a Chromium browser the search missed, after checking that it answers --version as Chromium. Clears a launch-failed skip.",
|
|
36107
36478
|
args: [{ name: "path", required: true }],
|
|
36108
36479
|
async run(ctx, { args }) {
|
|
36109
|
-
const browserPath =
|
|
36480
|
+
const browserPath = path23.resolve(ctx.cwd, args[0]);
|
|
36110
36481
|
await checkNamedBrowser(browserPath, "Give the path of a Chromium browser's program.");
|
|
36111
36482
|
const version2 = (ctx.platform === "win32" ? await fileVersion(browserPath) : null) ?? (await askVersion(browserPath)).version;
|
|
36112
36483
|
if (!version2) {
|
|
@@ -36177,24 +36548,26 @@ var init_commands = __esm({
|
|
|
36177
36548
|
browserInstall,
|
|
36178
36549
|
configBrowser,
|
|
36179
36550
|
skill,
|
|
36180
|
-
mcp
|
|
36551
|
+
mcp,
|
|
36552
|
+
mcpInstall,
|
|
36553
|
+
mcpUninstall
|
|
36181
36554
|
];
|
|
36182
36555
|
}
|
|
36183
36556
|
});
|
|
36184
36557
|
|
|
36185
36558
|
// src/lib/app-skills.js
|
|
36186
36559
|
import { access, lstat, readdir, rm } from "node:fs/promises";
|
|
36187
|
-
import
|
|
36560
|
+
import path24 from "node:path";
|
|
36188
36561
|
function appSkillDirsOf(home, env) {
|
|
36189
36562
|
const dirs = [
|
|
36190
|
-
|
|
36191
|
-
|
|
36192
|
-
|
|
36193
|
-
|
|
36194
|
-
|
|
36195
|
-
|
|
36563
|
+
path24.join(home, ".claude", "skills"),
|
|
36564
|
+
path24.join(home, ".agents", "skills"),
|
|
36565
|
+
path24.join(home, ".cursor", "skills"),
|
|
36566
|
+
path24.join(home, ".copilot", "skills"),
|
|
36567
|
+
path24.join(home, ".gemini", "skills"),
|
|
36568
|
+
path24.join(home, ".gemini", "config", "skills")
|
|
36196
36569
|
];
|
|
36197
|
-
if (env.CLAUDE_CONFIG_DIR) dirs.push(
|
|
36570
|
+
if (env.CLAUDE_CONFIG_DIR) dirs.push(path24.join(path24.resolve(env.CLAUDE_CONFIG_DIR), "skills"));
|
|
36198
36571
|
return [...new Set(dirs)];
|
|
36199
36572
|
}
|
|
36200
36573
|
async function removeAppSkillsOnce(ctx) {
|
|
@@ -36223,7 +36596,7 @@ async function removeAppSkills(dirs) {
|
|
|
36223
36596
|
return isAbsent(error2);
|
|
36224
36597
|
}
|
|
36225
36598
|
const removed = await Promise.all(
|
|
36226
|
-
names.filter((name) => APP_SKILL_NAMES.has(name)).map((name) => removeIfApps(
|
|
36599
|
+
names.filter((name) => APP_SKILL_NAMES.has(name)).map((name) => removeIfApps(path24.join(dir, name)))
|
|
36227
36600
|
);
|
|
36228
36601
|
return removed.every(Boolean);
|
|
36229
36602
|
})
|
|
@@ -36232,14 +36605,14 @@ async function removeAppSkills(dirs) {
|
|
|
36232
36605
|
}
|
|
36233
36606
|
async function removeIfApps(folder) {
|
|
36234
36607
|
try {
|
|
36235
|
-
await access(
|
|
36608
|
+
await access(path24.join(folder, APP_MARKER));
|
|
36236
36609
|
} catch (error2) {
|
|
36237
36610
|
return isAbsent(error2);
|
|
36238
36611
|
}
|
|
36239
36612
|
try {
|
|
36240
36613
|
if ((await lstat(folder)).isDirectory()) {
|
|
36241
36614
|
const names = (await readdir(folder)).filter((name) => name !== APP_MARKER);
|
|
36242
|
-
await Promise.all(names.map((name) => rm(
|
|
36615
|
+
await Promise.all(names.map((name) => rm(path24.join(folder, name), { recursive: true, force: true })));
|
|
36243
36616
|
}
|
|
36244
36617
|
await rm(folder, { recursive: true, force: true });
|
|
36245
36618
|
return true;
|
|
@@ -36493,7 +36866,7 @@ var init_posthog = __esm({
|
|
|
36493
36866
|
// src/lib/telemetry.js
|
|
36494
36867
|
import { spawn as spawn4 } from "node:child_process";
|
|
36495
36868
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
36496
|
-
import
|
|
36869
|
+
import os4 from "node:os";
|
|
36497
36870
|
async function guestBefore(ctx) {
|
|
36498
36871
|
if (!ctx.telemetry.keys) return void 0;
|
|
36499
36872
|
try {
|
|
@@ -36648,7 +37021,7 @@ function framesOf(stack) {
|
|
|
36648
37021
|
return frames.reverse();
|
|
36649
37022
|
}
|
|
36650
37023
|
function scrub(text) {
|
|
36651
|
-
const home =
|
|
37024
|
+
const home = os4.homedir();
|
|
36652
37025
|
return home.length > 1 ? text.split(home).join("~") : text;
|
|
36653
37026
|
}
|
|
36654
37027
|
var TELEMETRY_KEYS, SEND_MS, CHILD_SEND_MS, MAX_ERRORS, Telemetry, SENDER, FRAME;
|
|
@@ -36692,15 +37065,15 @@ var init_telemetry = __esm({
|
|
|
36692
37065
|
|
|
36693
37066
|
// src/lib/context.js
|
|
36694
37067
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
36695
|
-
import
|
|
36696
|
-
import
|
|
37068
|
+
import os5 from "node:os";
|
|
37069
|
+
import path25 from "node:path";
|
|
36697
37070
|
function createContext(overrides = {}) {
|
|
36698
37071
|
const platform2 = overrides.platform ?? process.platform;
|
|
36699
37072
|
const stdout = overrides.stdout ?? process.stdout;
|
|
36700
37073
|
const ctx = {
|
|
36701
37074
|
stdout,
|
|
36702
37075
|
stderr: process.stderr,
|
|
36703
|
-
home:
|
|
37076
|
+
home: path25.join(os5.homedir(), ".kombai", "cli"),
|
|
36704
37077
|
cwd: process.cwd(),
|
|
36705
37078
|
fetch: globalThis.fetch,
|
|
36706
37079
|
now: Date.now,
|
|
@@ -36723,7 +37096,7 @@ function createContext(overrides = {}) {
|
|
|
36723
37096
|
claudeDesktop: process.env.CLAUDE_CODE_ENTRYPOINT === "claude-desktop",
|
|
36724
37097
|
codexDesktop: inCodexDesktop(process.env),
|
|
36725
37098
|
changeSent: false,
|
|
36726
|
-
appSkillDirs: appSkillDirsOf(
|
|
37099
|
+
appSkillDirs: appSkillDirsOf(os5.homedir(), process.env),
|
|
36727
37100
|
...overrides
|
|
36728
37101
|
};
|
|
36729
37102
|
return ctx;
|