@i14ks/ccv 0.28.0 → 0.30.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 +33 -8
- package/bundle/ccv.mjs +178 -34
- package/package.json +1 -1
- package/web/assets/{codemirror-Jn-nlEEo.js → codemirror-C4z5XNW9.js} +1 -1
- package/web/assets/{index-DIt15fZq.js → index-9Nat9dSu.js} +1 -1
- package/web/assets/{index-DP1WFH_k.js → index-BLhz6Q_f.js} +1 -1
- package/web/assets/index-C1aD9jbe.js +143 -0
- package/web/assets/{index-Bt0SR_BE.js → index-C3JSbs5Y.js} +1 -1
- package/web/assets/{index-CaVGDL0G.js → index-CQi4R7CF.js} +1 -1
- package/web/assets/{index-BP4uDvBo.js → index-CTg1EwJA.js} +1 -1
- package/web/assets/{index-CckLujnN.js → index-Ca4B7wAH.js} +1 -1
- package/web/assets/{index-CfBtWXkv.js → index-Cbicy5d2.js} +1 -1
- package/web/assets/{index-DdG4EILc.js → index-Cc5e0VaU.js} +1 -1
- package/web/assets/{index-hFxJfMy0.js → index-Cxys5D35.js} +1 -1
- package/web/assets/{index-OpaL2d_i.js → index-DL40CFHz.js} +1 -1
- package/web/assets/{index-n7R3xkAJ.js → index-DfPLp5-Q.js} +1 -1
- package/web/assets/{index-aFwgvegU.js → index-DuO49xlq.js} +1 -1
- package/web/assets/{index-DkcdGFc4.js → index-DztFqv4C.js} +1 -1
- package/web/assets/{index-aEpkBsNa.js → index-K29cA4S6.js} +1 -1
- package/web/assets/{index-P-Bcy60v.js → index-bPu_gqaI.js} +1 -1
- package/web/assets/{index-DdTtoxsO.js → index-lk4qxiUA.js} +1 -1
- package/web/assets/{index-SnbL_sGM.js → index-po2296dn.js} +1 -1
- package/web/assets/{index-Cjq5qPxL.css → index-txYMazKF.css} +1 -1
- package/web/assets/{index-C6yiLJP6.js → index-u00xWQNg.js} +1 -1
- package/web/assets/{index-CB9Ecmwu.js → index-zXz6X_ro.js} +1 -1
- package/web/index.html +2 -2
- package/web/assets/index-rXb9w15o.js +0 -143
package/README.md
CHANGED
|
@@ -64,14 +64,39 @@ Codex использует свои `AGENTS.md`, навыки, MCP и `~/.codex/
|
|
|
64
64
|
|
|
65
65
|
## Проекты и разговоры
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
Рабочее пространство занимает весь экран. Сверху — разделы «Проекты»,
|
|
68
|
+
«Сессии» и «Закрепы», фильтры по CLI и проекту, входящие и настройки.
|
|
69
|
+
Постоянной левой панели нет. В проект можно зайти, чтобы увидеть его сессии;
|
|
70
|
+
папки, ручной порядок и архив доступны через управление проектом.
|
|
71
|
+
|
|
72
|
+
`Ctrl+P` / `Cmd+P` открывает поиск проектов, сессий и действий и перехватывает
|
|
73
|
+
печать браузера. Стрелки выбирают результат, Enter открывает его,
|
|
74
|
+
Esc закрывает поиск. Фильтр CLI действует и в поиске.
|
|
75
|
+
|
|
76
|
+
Открывайте несколько разговоров из любых проектов: каждый появляется
|
|
77
|
+
отдельной карточкой со своим черновиком, моделью, контекстом и запросами
|
|
78
|
+
разрешений. Потяните за правый нижний угол, чтобы изменить ширину и высоту;
|
|
79
|
+
у сфокусированного угла работают стрелки, двойной клик сбрасывает размер.
|
|
80
|
+
Карточки переносятся по ширине экрана, а их размеры и черновики сохраняются
|
|
81
|
+
после перезагрузки. Закрытие карточки не останавливает CLI. Фильтр CLI скрывает
|
|
82
|
+
чужие карточки, сохраняя их работу и черновики.
|
|
83
|
+
|
|
84
|
+
В настройках можно выбрать модель по умолчанию отдельно для Claude Code,
|
|
85
|
+
Codex и Antigravity. Введите ID модели или выберите из каталога открытых
|
|
86
|
+
сессий этого CLI; пустое поле оставляет выбор самому CLI. Настройки применяются
|
|
87
|
+
к новым разговорам, продолженные и ответвлённые сохраняют выбранную модель.
|
|
88
|
+
Для этой настройки нужен обновлённый хост ccv на компьютере.
|
|
89
|
+
|
|
90
|
+
Входящие собирают вопросы, разрешения и результаты. «Вернуться в контекст»
|
|
91
|
+
раскрывает последнюю задачу, действия и ответ без обращения к модели.
|
|
92
|
+
«Ветки задачи» связывают разговоры в этапы и создают следующий этап с
|
|
93
|
+
подготовленным черновиком; связи сохраняются на хосте.
|
|
94
|
+
|
|
95
|
+
В разговоре Codex наберите `/`, чтобы увидеть доступные команды, включая
|
|
96
|
+
`/model`, `/permissions`, `/review`, `/compact`, `/login`, `/fork` и навыки,
|
|
97
|
+
полученные от установленного CLI через `skills/list`. Отключённые навыки
|
|
98
|
+
не предлагаются. `/skills` обновляет их каталог; вызов навыка передаёт его
|
|
99
|
+
имя и путь в app-server.
|
|
75
100
|
|
|
76
101
|
## Условия
|
|
77
102
|
|
package/bundle/ccv.mjs
CHANGED
|
@@ -4349,18 +4349,56 @@ function describe2(error) {
|
|
|
4349
4349
|
// ../host/dist/codex-session.js
|
|
4350
4350
|
import { EventEmitter as EventEmitter5 } from "node:events";
|
|
4351
4351
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
4352
|
+
import { execFile as execFile5 } from "node:child_process";
|
|
4353
|
+
import { promisify } from "node:util";
|
|
4354
|
+
|
|
4355
|
+
// ../host/dist/codex-commands.js
|
|
4356
|
+
var CODEX_COMMANDS = [
|
|
4357
|
+
["help", "\u0412\u0441\u0435 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0435 \u043A\u043E\u043C\u0430\u043D\u0434\u044B Codex", ""],
|
|
4358
|
+
["model", "\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0435 \u043C\u043E\u0434\u0435\u043B\u0438 \u0438 \u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435 \u043C\u043E\u0434\u0435\u043B\u0438", "<model>"],
|
|
4359
|
+
["effort", "\u0423\u0440\u043E\u0432\u0435\u043D\u044C \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043D\u0438\u044F: low, medium, high, xhigh", "<level>"],
|
|
4360
|
+
["permissions", "\u0420\u0435\u0436\u0438\u043C \u0434\u043E\u0441\u0442\u0443\u043F\u0430: default, acceptEdits, plan, bypassPermissions", "<mode>"],
|
|
4361
|
+
["plan", "\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0438\u043B\u0438 \u0432\u044B\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0440\u0435\u0436\u0438\u043C \u043F\u043B\u0430\u043D\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F", ""],
|
|
4362
|
+
["status", "\u0410\u043A\u043A\u0430\u0443\u043D\u0442 \u0438 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 Codex", ""],
|
|
4363
|
+
["login", "\u0412\u043E\u0439\u0442\u0438 \u0432 ChatGPT \u043F\u043E \u043A\u043E\u0434\u0443", ""],
|
|
4364
|
+
["logout", "\u0412\u044B\u0439\u0442\u0438 \u0438\u0437 \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430 Codex", ""],
|
|
4365
|
+
["compact", "\u0421\u0436\u0430\u0442\u044C \u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440\u0430", ""],
|
|
4366
|
+
["review", "\u041F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u0432 \u0440\u0430\u0431\u043E\u0447\u0435\u043C \u0434\u0435\u0440\u0435\u0432\u0435", ""],
|
|
4367
|
+
["diff", "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F Git", ""],
|
|
4368
|
+
["rename", "\u041F\u0435\u0440\u0435\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u0442\u044C \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440", "<title>"],
|
|
4369
|
+
["mcp", "\u041F\u043E\u0434\u043A\u043B\u044E\u0447\u0451\u043D\u043D\u044B\u0435 MCP-\u0441\u0435\u0440\u0432\u0435\u0440\u044B", ""],
|
|
4370
|
+
["skills", "\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C \u0441\u043F\u0438\u0441\u043E\u043A \u043D\u0430\u0432\u044B\u043A\u043E\u0432 \u0438 \u043F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0438 \u043A\u043E\u043C\u0430\u043D\u0434", ""],
|
|
4371
|
+
["init", "\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u0438\u043D\u0441\u0442\u0440\u0443\u043A\u0446\u0438\u0438 \u043F\u0440\u043E\u0435\u043A\u0442\u0430 AGENTS.md", ""],
|
|
4372
|
+
["new", "\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u043D\u043E\u0432\u044B\u0439 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440", ""],
|
|
4373
|
+
["clear", "\u041D\u0430\u0447\u0430\u0442\u044C \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440 \u0441 \u0447\u0438\u0441\u0442\u044B\u043C \u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442\u043E\u043C", ""],
|
|
4374
|
+
["resume", "\u041D\u0430\u0439\u0442\u0438 \u0438 \u043E\u0442\u043A\u0440\u044B\u0442\u044C \u0441\u043E\u0445\u0440\u0430\u043D\u0451\u043D\u043D\u044B\u0439 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440", ""],
|
|
4375
|
+
["fork", "\u041E\u0442\u0432\u0435\u0442\u0432\u0438\u0442\u044C \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440 \u0432 \u043D\u043E\u0432\u0443\u044E \u043A\u0430\u0440\u0442\u043E\u0447\u043A\u0443", ""],
|
|
4376
|
+
["stop", "\u041F\u0440\u0435\u0440\u0432\u0430\u0442\u044C \u0442\u0435\u043A\u0443\u0449\u0438\u0439 \u0445\u043E\u0434", ""],
|
|
4377
|
+
["exit", "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u0441\u0435\u0441\u0441\u0438\u044E Codex", ""]
|
|
4378
|
+
].map(([name, description, argumentHint]) => ({ name, description, argumentHint, aliases: name === "permissions" ? ["approvals"] : name === "exit" ? ["quit"] : [] }));
|
|
4379
|
+
function isCodexModelPrompt(text) {
|
|
4380
|
+
if (!text.startsWith("/"))
|
|
4381
|
+
return true;
|
|
4382
|
+
const name = text.trim().slice(1).split(/\s+/)[0];
|
|
4383
|
+
return name === "init" || name === "review" || !CODEX_COMMANDS.some((command) => command.name === name || command.aliases.includes(name ?? ""));
|
|
4384
|
+
}
|
|
4385
|
+
function codexSkills(response) {
|
|
4386
|
+
const result = /* @__PURE__ */ new Map();
|
|
4387
|
+
if (!response || typeof response !== "object" || !("data" in response) || !Array.isArray(response.data))
|
|
4388
|
+
return result;
|
|
4389
|
+
for (const group of response.data)
|
|
4390
|
+
for (const skill of Array.isArray(group?.skills) ? group.skills : []) {
|
|
4391
|
+
if (!skill || skill.enabled === false || typeof skill.name !== "string" || typeof skill.path !== "string" || !skill.path || !/^[\w.:-]+$/.test(skill.name))
|
|
4392
|
+
continue;
|
|
4393
|
+
const name = CODEX_COMMANDS.some((c) => c.name === skill.name || c.aliases.includes(skill.name)) ? `skill:${skill.name}` : skill.name;
|
|
4394
|
+
result.set(name, { name: skill.name, path: skill.path, description: skill.interface?.shortDescription ?? skill.description ?? "\u041D\u0430\u0432\u044B\u043A Codex" });
|
|
4395
|
+
}
|
|
4396
|
+
return result;
|
|
4397
|
+
}
|
|
4398
|
+
|
|
4399
|
+
// ../host/dist/codex-session.js
|
|
4352
4400
|
var TRANSIENT2 = /* @__PURE__ */ new Set(["assistant.delta", "thinking.delta", "state"]);
|
|
4353
|
-
var
|
|
4354
|
-
["help", "\u041A\u043E\u043C\u0430\u043D\u0434\u044B Codex"],
|
|
4355
|
-
["status", "\u0410\u043A\u043A\u0430\u0443\u043D\u0442 \u0438 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438"],
|
|
4356
|
-
["login", "\u0412\u043E\u0439\u0442\u0438 \u0432 ChatGPT \u043F\u043E \u043A\u043E\u0434\u0443 \u0441 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430"],
|
|
4357
|
-
["model", "\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u043C\u043E\u0434\u0435\u043B\u044C"],
|
|
4358
|
-
["effort", "\u0423\u0440\u043E\u0432\u0435\u043D\u044C \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043D\u0438\u044F"],
|
|
4359
|
-
["compact", "\u0421\u0436\u0430\u0442\u044C \u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442"],
|
|
4360
|
-
["mcp", "\u041F\u043E\u0434\u043A\u043B\u044E\u0447\u0451\u043D\u043D\u044B\u0435 MCP-\u0441\u0435\u0440\u0432\u0435\u0440\u044B"],
|
|
4361
|
-
["skills", "\u041D\u0430\u0432\u044B\u043A\u0438 \u043F\u0440\u043E\u0435\u043A\u0442\u0430"],
|
|
4362
|
-
["fork", "\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C \u0432 \u043E\u0442\u0434\u0435\u043B\u044C\u043D\u043E\u0439 \u0432\u0435\u0442\u043A\u0435 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440\u0430"]
|
|
4363
|
-
];
|
|
4401
|
+
var execFileAsync = promisify(execFile5);
|
|
4364
4402
|
var CodexSession = class extends EventEmitter5 {
|
|
4365
4403
|
provider = "codex";
|
|
4366
4404
|
id;
|
|
@@ -4372,6 +4410,7 @@ var CodexSession = class extends EventEmitter5 {
|
|
|
4372
4410
|
#store;
|
|
4373
4411
|
#record;
|
|
4374
4412
|
#client = null;
|
|
4413
|
+
#skills = /* @__PURE__ */ new Map();
|
|
4375
4414
|
#closing = Promise.resolve();
|
|
4376
4415
|
#state = "starting";
|
|
4377
4416
|
#lastTurn = null;
|
|
@@ -4570,19 +4609,34 @@ var CodexSession = class extends EventEmitter5 {
|
|
|
4570
4609
|
cwd: this.cwd,
|
|
4571
4610
|
model: this.#record.model ?? "",
|
|
4572
4611
|
permissionMode: this.#record.permissionMode,
|
|
4573
|
-
slashCommands:
|
|
4574
|
-
commands:
|
|
4612
|
+
slashCommands: CODEX_COMMANDS.map((c) => c.name),
|
|
4613
|
+
commands: CODEX_COMMANDS,
|
|
4575
4614
|
models,
|
|
4576
4615
|
tools: ["shell", "apply_patch", "web_search", "mcp"],
|
|
4577
4616
|
agents: [],
|
|
4578
4617
|
mcpServers: [],
|
|
4579
4618
|
flags: ["codex-app-server"]
|
|
4580
4619
|
};
|
|
4620
|
+
await this.#refreshCommands();
|
|
4581
4621
|
this.emit("capabilities");
|
|
4582
4622
|
this.#setState("idle");
|
|
4583
4623
|
void this.refreshUsage().catch(() => {
|
|
4584
4624
|
});
|
|
4585
4625
|
}
|
|
4626
|
+
async #refreshCommands() {
|
|
4627
|
+
const client = this.#client;
|
|
4628
|
+
if (!client)
|
|
4629
|
+
return;
|
|
4630
|
+
const response = await client.request("skills/list", { cwds: [this.cwd], forceReload: true }).catch(() => null);
|
|
4631
|
+
if (client !== this.#client || this.#state === "closed")
|
|
4632
|
+
return;
|
|
4633
|
+
this.#skills = codexSkills(response);
|
|
4634
|
+
if (!this.#capabilities)
|
|
4635
|
+
return;
|
|
4636
|
+
this.#capabilities.commands = [...CODEX_COMMANDS, ...[...this.#skills.entries()].map(([name, skill]) => ({ name, description: skill.description, argumentHint: "<\u0437\u0430\u0434\u0430\u0447\u0430>", aliases: [] }))];
|
|
4637
|
+
this.#capabilities.slashCommands = this.#capabilities.commands.map((c) => c.name);
|
|
4638
|
+
this.emit("capabilities");
|
|
4639
|
+
}
|
|
4586
4640
|
#effort(value) {
|
|
4587
4641
|
return ["low", "medium", "high", "xhigh", "max"].includes(String(value)) ? value : null;
|
|
4588
4642
|
}
|
|
@@ -4612,13 +4666,23 @@ var CodexSession = class extends EventEmitter5 {
|
|
|
4612
4666
|
const blocked = networkGuard.blockedReason();
|
|
4613
4667
|
if (blocked)
|
|
4614
4668
|
throw new Error(blocked);
|
|
4669
|
+
let turnText = text;
|
|
4670
|
+
let skill;
|
|
4615
4671
|
if (text.startsWith("/") && !images?.length) {
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4672
|
+
const [name, ...args] = text.trim().slice(1).split(/\s+/);
|
|
4673
|
+
skill = this.#skills.get(name ?? "");
|
|
4674
|
+
if (skill)
|
|
4675
|
+
turnText = `$${skill.name} ${args.join(" ")}`.trim();
|
|
4676
|
+
else if (name === "init")
|
|
4677
|
+
turnText = "Create or update AGENTS.md with concise project-specific instructions based on the repository. Inspect existing instructions first and preserve useful guidance.";
|
|
4678
|
+
else {
|
|
4679
|
+
try {
|
|
4680
|
+
await this.#command(text);
|
|
4681
|
+
} catch (error) {
|
|
4682
|
+
this.#recordEvent({ kind: "error", message: error instanceof Error ? error.message : String(error) });
|
|
4683
|
+
}
|
|
4684
|
+
return;
|
|
4620
4685
|
}
|
|
4621
|
-
return;
|
|
4622
4686
|
}
|
|
4623
4687
|
this.#interruptRequested = false;
|
|
4624
4688
|
this.#recordEvent({ kind: "user.message", text, ...images?.length ? { images } : {} });
|
|
@@ -4633,7 +4697,8 @@ var CodexSession = class extends EventEmitter5 {
|
|
|
4633
4697
|
const response = await this.#client.request("turn/start", {
|
|
4634
4698
|
threadId: this.#record.conversationId,
|
|
4635
4699
|
input: [
|
|
4636
|
-
{ type: "text", text, text_elements: [] },
|
|
4700
|
+
{ type: "text", text: turnText, text_elements: [] },
|
|
4701
|
+
...skill ? [{ type: "skill", name: skill.name, path: skill.path }] : [],
|
|
4637
4702
|
...(images ?? []).map((img) => ({ type: "image", url: `data:${img.mediaType};base64,${img.data}` }))
|
|
4638
4703
|
],
|
|
4639
4704
|
cwd: this.cwd,
|
|
@@ -4659,13 +4724,61 @@ var CodexSession = class extends EventEmitter5 {
|
|
|
4659
4724
|
case "model":
|
|
4660
4725
|
if (arg)
|
|
4661
4726
|
await this.setModel(arg);
|
|
4662
|
-
reply = `\u041C\u043E\u0434\u0435\u043B\u044C: ${this.#record.model}
|
|
4727
|
+
reply = `\u041C\u043E\u0434\u0435\u043B\u044C: ${this.#record.model}
|
|
4728
|
+
` + (arg ? "" : (this.#capabilities?.models ?? []).map((m) => `${m.value} \u2014 ${m.displayName}`).join("\n"));
|
|
4663
4729
|
break;
|
|
4664
4730
|
case "effort":
|
|
4665
4731
|
if (arg)
|
|
4666
4732
|
await this.setEffort(arg);
|
|
4667
4733
|
reply = `\u0423\u0441\u0438\u043B\u0438\u0435: ${this.#record.effort ?? "\u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E"}`;
|
|
4668
4734
|
break;
|
|
4735
|
+
case "permissions":
|
|
4736
|
+
case "approvals":
|
|
4737
|
+
if (arg)
|
|
4738
|
+
await this.setPermissionMode(arg);
|
|
4739
|
+
reply = `\u0420\u0435\u0436\u0438\u043C \u0434\u043E\u0441\u0442\u0443\u043F\u0430: ${this.#record.permissionMode}
|
|
4740
|
+
\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u044B: default, acceptEdits, plan, dontAsk, bypassPermissions`;
|
|
4741
|
+
break;
|
|
4742
|
+
case "plan":
|
|
4743
|
+
await this.setPermissionMode(this.#record.permissionMode === "plan" ? "default" : "plan");
|
|
4744
|
+
reply = `\u0420\u0435\u0436\u0438\u043C \u0434\u043E\u0441\u0442\u0443\u043F\u0430: ${this.#record.permissionMode}`;
|
|
4745
|
+
break;
|
|
4746
|
+
case "rename":
|
|
4747
|
+
if (!arg)
|
|
4748
|
+
throw new Error("\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u0435: /rename <title>");
|
|
4749
|
+
this.setTitle(arg);
|
|
4750
|
+
reply = `\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435: ${arg}`;
|
|
4751
|
+
break;
|
|
4752
|
+
case "logout":
|
|
4753
|
+
await this.#client.request("account/logout", {});
|
|
4754
|
+
reply = "\u0412\u044B \u0432\u044B\u0448\u043B\u0438 \u0438\u0437 \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430 Codex.";
|
|
4755
|
+
break;
|
|
4756
|
+
case "review": {
|
|
4757
|
+
this.#recordEvent({ kind: "user.message", text });
|
|
4758
|
+
this.#startedAt = Date.now();
|
|
4759
|
+
this.#interruptRequested = false;
|
|
4760
|
+
this.#setState("running");
|
|
4761
|
+
const done = new Promise((resolve) => {
|
|
4762
|
+
this.#turnDone = resolve;
|
|
4763
|
+
});
|
|
4764
|
+
try {
|
|
4765
|
+
const response = await this.#client.request("review/start", { threadId: this.#record.conversationId, delivery: "inline", target: arg ? { type: "custom", instructions: arg } : { type: "uncommittedChanges" } });
|
|
4766
|
+
if (this.#turnDone)
|
|
4767
|
+
this.#turnId = response.turn.id;
|
|
4768
|
+
await done;
|
|
4769
|
+
} catch (error) {
|
|
4770
|
+
this.#turnDone = null;
|
|
4771
|
+
this.#turnId = null;
|
|
4772
|
+
this.#setState("idle");
|
|
4773
|
+
throw error;
|
|
4774
|
+
}
|
|
4775
|
+
return;
|
|
4776
|
+
}
|
|
4777
|
+
case "diff": {
|
|
4778
|
+
const diff = await execFileAsync("git", ["--no-pager", "diff", "--no-ext-diff", "HEAD", "--"], { cwd: this.cwd, windowsHide: true, maxBuffer: 2 * 1024 * 1024 });
|
|
4779
|
+
reply = diff.stdout.trim() || "\u041D\u0435\u0442 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439 \u043E\u0442\u043D\u043E\u0441\u0438\u0442\u0435\u043B\u044C\u043D\u043E HEAD.";
|
|
4780
|
+
break;
|
|
4781
|
+
}
|
|
4669
4782
|
case "compact":
|
|
4670
4783
|
await this.#client.request("thread/compact/start", { threadId: this.#record.conversationId });
|
|
4671
4784
|
reply = "Codex \u043D\u0430\u0447\u0430\u043B \u0441\u0436\u0430\u0442\u0438\u0435 \u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442\u0430.";
|
|
@@ -4683,10 +4796,14 @@ var CodexSession = class extends EventEmitter5 {
|
|
|
4683
4796
|
reply = JSON.stringify(await this.#client.request("mcpServerStatus/list", {}), null, 2);
|
|
4684
4797
|
break;
|
|
4685
4798
|
case "skills":
|
|
4686
|
-
|
|
4799
|
+
await this.#refreshCommands();
|
|
4800
|
+
reply = [...this.#skills.entries()].map(([name2, skill]) => `/${name2} \u2014 ${skill.description}`).join("\n") || "\u0412 \u044D\u0442\u043E\u043C \u043F\u0440\u043E\u0435\u043A\u0442\u0435 \u043D\u0430\u0432\u044B\u043A\u0438 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B.";
|
|
4801
|
+
break;
|
|
4802
|
+
case "help":
|
|
4803
|
+
reply = (this.#capabilities?.commands ?? CODEX_COMMANDS).map((c) => `/${c.name}${c.argumentHint ? " " + c.argumentHint : ""} \u2014 ${c.description}`).join("\n");
|
|
4687
4804
|
break;
|
|
4688
4805
|
default:
|
|
4689
|
-
|
|
4806
|
+
throw new Error(`\u041A\u043E\u043C\u0430\u043D\u0434\u0430 /${name} \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430. \u041D\u0430\u0431\u0435\u0440\u0438\u0442\u0435 /help \u0434\u043B\u044F \u0441\u043F\u0438\u0441\u043A\u0430 \u043A\u043E\u043C\u0430\u043D\u0434.`);
|
|
4690
4807
|
}
|
|
4691
4808
|
this.#recordEvent({ kind: "user.message", text });
|
|
4692
4809
|
this.#recordEvent({ kind: "assistant.text", text: reply, blockId: randomUUID3() });
|
|
@@ -4700,6 +4817,10 @@ var CodexSession = class extends EventEmitter5 {
|
|
|
4700
4817
|
return;
|
|
4701
4818
|
}
|
|
4702
4819
|
switch (message.method) {
|
|
4820
|
+
case "skills/changed":
|
|
4821
|
+
void this.#refreshCommands().catch(() => {
|
|
4822
|
+
});
|
|
4823
|
+
break;
|
|
4703
4824
|
case "turn/started":
|
|
4704
4825
|
this.#turnId = p.turn.id;
|
|
4705
4826
|
this.#setState("running");
|
|
@@ -4910,6 +5031,8 @@ var CodexSession = class extends EventEmitter5 {
|
|
|
4910
5031
|
this.start();
|
|
4911
5032
|
}
|
|
4912
5033
|
async setPermissionMode(mode) {
|
|
5034
|
+
if (!["default", "acceptEdits", "plan", "dontAsk", "bypassPermissions", "auto"].includes(mode))
|
|
5035
|
+
throw new Error(`\u0420\u0435\u0436\u0438\u043C \u0434\u043E\u0441\u0442\u0443\u043F\u0430 Codex \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D: ${mode}`);
|
|
4913
5036
|
this.#record.permissionMode = mode;
|
|
4914
5037
|
this.#changed();
|
|
4915
5038
|
}
|
|
@@ -4984,7 +5107,7 @@ var CodexSession = class extends EventEmitter5 {
|
|
|
4984
5107
|
throw new Error("\u0420\u0435\u043F\u043B\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430");
|
|
4985
5108
|
if (target.event.text.startsWith("/"))
|
|
4986
5109
|
throw new Error("\u0421\u043B\u0443\u0436\u0435\u0431\u043D\u0443\u044E \u043A\u043E\u043C\u0430\u043D\u0434\u0443 \u043D\u0435\u043B\u044C\u0437\u044F \u043E\u0442\u0440\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C; \u043E\u0442\u043F\u0440\u0430\u0432\u044C\u0442\u0435 \u0435\u0451 \u0437\u0430\u043D\u043E\u0432\u043E");
|
|
4987
|
-
const modelIndex = messages.slice(0, userIndex).filter((entry) => entry.event.kind === "user.message" &&
|
|
5110
|
+
const modelIndex = messages.slice(0, userIndex).filter((entry) => entry.event.kind === "user.message" && isCodexModelPrompt(entry.event.text)).length;
|
|
4988
5111
|
const nativeMessages = [];
|
|
4989
5112
|
let cursor = null;
|
|
4990
5113
|
do {
|
|
@@ -5229,7 +5352,7 @@ var CodexStore = class extends AntigravityStore {
|
|
|
5229
5352
|
};
|
|
5230
5353
|
|
|
5231
5354
|
// ../host/dist/git.js
|
|
5232
|
-
import { execFile as
|
|
5355
|
+
import { execFile as execFile6 } from "node:child_process";
|
|
5233
5356
|
import { mkdtemp, readFile as readFile5, rm as rm3, writeFile as writeFile4 } from "node:fs/promises";
|
|
5234
5357
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
5235
5358
|
import path11 from "node:path";
|
|
@@ -5619,7 +5742,7 @@ var GitRepo = class {
|
|
|
5619
5742
|
#run(args, options2 = {}) {
|
|
5620
5743
|
const token = options2.token ?? "";
|
|
5621
5744
|
return new Promise((resolve, reject) => {
|
|
5622
|
-
const child =
|
|
5745
|
+
const child = execFile6(
|
|
5623
5746
|
"git",
|
|
5624
5747
|
// core.quotepath=false — иначе кириллические пути приезжают в виде
|
|
5625
5748
|
// «\320\277\321\200…» и в панели читаются как мусор.
|
|
@@ -5829,7 +5952,7 @@ function count(body, mark) {
|
|
|
5829
5952
|
}
|
|
5830
5953
|
|
|
5831
5954
|
// ../host/dist/github.js
|
|
5832
|
-
import { execFile as
|
|
5955
|
+
import { execFile as execFile7 } from "node:child_process";
|
|
5833
5956
|
import { mkdir as mkdir4, readFile as readFile6, writeFile as writeFile5 } from "node:fs/promises";
|
|
5834
5957
|
import path12 from "node:path";
|
|
5835
5958
|
var API = "https://api.github.com";
|
|
@@ -6018,7 +6141,7 @@ var GitHubAccount = class {
|
|
|
6018
6141
|
};
|
|
6019
6142
|
function gh(args) {
|
|
6020
6143
|
return new Promise((resolve, reject) => {
|
|
6021
|
-
|
|
6144
|
+
execFile7("gh", args, { timeout: GH_TIMEOUT_MS, windowsHide: true, encoding: "utf8" }, (error, stdout, stderr) => {
|
|
6022
6145
|
if (error)
|
|
6023
6146
|
return reject(new Error(stderr.trim() || error.message));
|
|
6024
6147
|
resolve(stdout);
|
|
@@ -7426,6 +7549,7 @@ var DEFAULT_APP_SETTINGS = {
|
|
|
7426
7549
|
// Модель за пользователя не выбираем: пока он не сказал иначе, сессия
|
|
7427
7550
|
// поднимается ровно с той, с которой её поднял бы консольный Claude Code.
|
|
7428
7551
|
startModel: null,
|
|
7552
|
+
startModels: { claude: null, codex: null, antigravity: null },
|
|
7429
7553
|
// Тот же режим, с которым сессия стартовала до появления этой настройки.
|
|
7430
7554
|
startPermissionMode: "default",
|
|
7431
7555
|
// Терминал по умолчанию закрыт — его включают, а не выключают: приложение,
|
|
@@ -7448,6 +7572,7 @@ var DEFAULT_APP_SETTINGS = {
|
|
|
7448
7572
|
var AppSettingsStore = class {
|
|
7449
7573
|
#settings = { ...DEFAULT_APP_SETTINGS };
|
|
7450
7574
|
#storePath;
|
|
7575
|
+
#writing = Promise.resolve();
|
|
7451
7576
|
constructor(dataDir) {
|
|
7452
7577
|
this.#storePath = path20.join(dataDir, "app-settings.json");
|
|
7453
7578
|
}
|
|
@@ -7460,7 +7585,7 @@ var AppSettingsStore = class {
|
|
|
7460
7585
|
}
|
|
7461
7586
|
}
|
|
7462
7587
|
get current() {
|
|
7463
|
-
return { ...this.#settings };
|
|
7588
|
+
return { ...this.#settings, startModels: { ...this.#settings.startModels } };
|
|
7464
7589
|
}
|
|
7465
7590
|
/**
|
|
7466
7591
|
* Применить присланное окном.
|
|
@@ -7473,8 +7598,13 @@ var AppSettingsStore = class {
|
|
|
7473
7598
|
async update(patch) {
|
|
7474
7599
|
const next = sanitize2(patch, this.#settings);
|
|
7475
7600
|
this.#settings = next;
|
|
7476
|
-
|
|
7477
|
-
|
|
7601
|
+
const writing = this.#writing.then(async () => {
|
|
7602
|
+
await mkdir11(path20.dirname(this.#storePath), { recursive: true });
|
|
7603
|
+
await writeFile12(this.#storePath, JSON.stringify(next, null, 2), "utf8");
|
|
7604
|
+
});
|
|
7605
|
+
this.#writing = writing.catch(() => {
|
|
7606
|
+
});
|
|
7607
|
+
await writing;
|
|
7478
7608
|
return this.current;
|
|
7479
7609
|
}
|
|
7480
7610
|
};
|
|
@@ -7506,6 +7636,18 @@ function sanitize2(value, fallback) {
|
|
|
7506
7636
|
else if (typeof model === "string")
|
|
7507
7637
|
result.startModel = model.trim() || null;
|
|
7508
7638
|
}
|
|
7639
|
+
const models = record.startModels;
|
|
7640
|
+
result.startModels = { ...fallback.startModels };
|
|
7641
|
+
if ("startModel" in record && !(models && typeof models === "object" && "claude" in models))
|
|
7642
|
+
result.startModels.claude = result.startModel;
|
|
7643
|
+
if (models && typeof models === "object" && !Array.isArray(models)) {
|
|
7644
|
+
for (const provider of PROVIDERS) {
|
|
7645
|
+
const model = models[provider];
|
|
7646
|
+
if (model === null || typeof model === "string")
|
|
7647
|
+
result.startModels[provider] = typeof model === "string" ? model.trim() || null : null;
|
|
7648
|
+
}
|
|
7649
|
+
}
|
|
7650
|
+
result.startModel = result.startModels.claude;
|
|
7509
7651
|
const mode = record.startPermissionMode;
|
|
7510
7652
|
if (typeof mode === "string" && PERMISSION_MODES.includes(mode)) {
|
|
7511
7653
|
result.startPermissionMode = mode;
|
|
@@ -9157,7 +9299,7 @@ var HostServer = class {
|
|
|
9157
9299
|
hostId: this.#hostId,
|
|
9158
9300
|
hostVersion: this.#options.version,
|
|
9159
9301
|
platform: process.platform,
|
|
9160
|
-
features: ["session-routing", "session-links"]
|
|
9302
|
+
features: ["session-routing", "session-links", "provider-default-models"]
|
|
9161
9303
|
});
|
|
9162
9304
|
this.#send(socket, { type: "workspace.list", ...this.#workspaceLists() });
|
|
9163
9305
|
this.#sendFolders(socket);
|
|
@@ -10436,6 +10578,8 @@ var HostServer = class {
|
|
|
10436
10578
|
throw new Error("\u0420\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u0430\u044F \u0441\u0435\u0441\u0441\u0438\u044F \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u0432 \u044D\u0442\u043E\u043C \u043F\u0440\u043E\u0435\u043A\u0442\u0435");
|
|
10437
10579
|
}
|
|
10438
10580
|
const provider = frame.provider ?? "claude";
|
|
10581
|
+
const defaultModel = this.#settings.current.startModels[provider];
|
|
10582
|
+
const startModel = frame.model ?? (!frame.resume ? defaultModel ?? void 0 : void 0);
|
|
10439
10583
|
if (!frame.resume && !this.#settings.current.enabledProviders.includes(provider)) {
|
|
10440
10584
|
throw new Error(`${provider === "codex" ? "Codex" : provider === "antigravity" ? "Antigravity" : "Claude"} \u0432\u044B\u043A\u043B\u044E\u0447\u0435\u043D \u0432 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430\u0445`);
|
|
10441
10585
|
}
|
|
@@ -10461,7 +10605,7 @@ var HostServer = class {
|
|
|
10461
10605
|
...codexRecord ? { record: codexRecord } : {},
|
|
10462
10606
|
fork: frame.fork,
|
|
10463
10607
|
permissionMode: frame.permissionMode ?? codexRecord?.permissionMode ?? "default",
|
|
10464
|
-
...
|
|
10608
|
+
...startModel ? { model: startModel } : {},
|
|
10465
10609
|
defaultTitle: workspace.name,
|
|
10466
10610
|
writableRoots: () => this.#writableRoots(workspace.path)
|
|
10467
10611
|
});
|
|
@@ -10482,7 +10626,7 @@ var HostServer = class {
|
|
|
10482
10626
|
store: this.#antigravity,
|
|
10483
10627
|
...agyRecord ? { record: agyRecord } : {},
|
|
10484
10628
|
...frame.permissionMode ? { permissionMode: frame.permissionMode } : {},
|
|
10485
|
-
...
|
|
10629
|
+
...startModel ? { model: startModel } : {},
|
|
10486
10630
|
defaultTitle: workspace.name
|
|
10487
10631
|
});
|
|
10488
10632
|
this.#wire(session2);
|
|
@@ -10503,7 +10647,7 @@ var HostServer = class {
|
|
|
10503
10647
|
resume: frame.resume,
|
|
10504
10648
|
fork: frame.fork,
|
|
10505
10649
|
permissionMode: frame.permissionMode ?? startDefaults.startPermissionMode,
|
|
10506
|
-
model:
|
|
10650
|
+
model: startModel,
|
|
10507
10651
|
...resumedTitle ? { title: resumedTitle } : {},
|
|
10508
10652
|
// Имя проекта вместо «Без названия»: свежую сессию в списке уже надо
|
|
10509
10653
|
// как-то называть, а сказать о ней пока нечего, кроме того, где она.
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as r,H as a}from"./index-
|
|
1
|
+
import{s as r,H as a}from"./index-DuO49xlq.js";import{E as e}from"./index-891wE-Rj.js";import{t as o}from"./index-C1aD9jbe.js";import"./index-BHot-lnj.js";const m=e.theme({"&":{height:"100%",color:"var(--text)",backgroundColor:"var(--bg)",fontSize:"13px"},".cm-scroller":{fontFamily:"var(--mono)",lineHeight:"1.6"},".cm-content":{caretColor:"var(--accent)"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--accent)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"var(--cm-selection)"},".cm-gutters":{backgroundColor:"var(--bg)",color:"var(--muted)",borderRight:"1px solid var(--border-soft)"},".cm-activeLineGutter":{backgroundColor:"var(--surface-2)",color:"var(--text-2)"},".cm-activeLine":{backgroundColor:"var(--cm-active)"},".cm-selectionMatch":{backgroundColor:"var(--cm-match)"},"&.cm-focused .cm-matchingBracket":{backgroundColor:"var(--cm-match)",outline:"1px solid var(--accent-line)"},".cm-foldPlaceholder":{backgroundColor:"var(--surface-2)",border:"1px solid var(--border)",color:"var(--muted)"},".cm-panels":{backgroundColor:"var(--surface)",color:"var(--text)",border:"1px solid var(--border)"},".cm-panels input, .cm-panels button, .cm-panels select":{fontFamily:"var(--sans)",fontSize:"12px",background:"var(--surface-2)",color:"var(--text)",border:"1px solid var(--border)",borderRadius:"6px",padding:"3px 6px"},".cm-searchMatch":{backgroundColor:"var(--cm-match)"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"var(--accent-soft)"},".cm-tooltip":{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:"8px",boxShadow:"var(--shadow-md)",color:"var(--text)"},".cm-tooltip-autocomplete ul li[aria-selected]":{background:"var(--surface-2)",color:"var(--text)"}}),i=r(a.define([{tag:[o.keyword,o.modifier,o.controlKeyword,o.moduleKeyword],color:"var(--cm-key)"},{tag:[o.name,o.deleted,o.character,o.macroName],color:"var(--text)"},{tag:[o.propertyName],color:"var(--cm-prop)"},{tag:[o.function(o.variableName),o.labelName],color:"var(--cm-fn)"},{tag:[o.color,o.constant(o.name),o.standard(o.name),o.bool],color:"var(--cm-const)"},{tag:[o.definition(o.name),o.separator],color:"var(--text)"},{tag:[o.typeName,o.className,o.changed,o.annotation,o.self,o.namespace],color:"var(--cm-type)"},{tag:[o.number,o.integer,o.float],color:"var(--cm-num)"},{tag:[o.string,o.special(o.string),o.regexp],color:"var(--cm-str)"},{tag:[o.operator,o.operatorKeyword,o.escape],color:"var(--cm-op)"},{tag:[o.meta,o.comment],color:"var(--cm-comment)",fontStyle:"italic"},{tag:o.strong,fontWeight:"650"},{tag:o.emphasis,fontStyle:"italic"},{tag:o.strikethrough,textDecoration:"line-through"},{tag:o.link,color:"var(--cm-str)",textDecoration:"underline"},{tag:o.heading,fontWeight:"650",color:"var(--cm-key)"},{tag:o.invalid,color:"var(--danger)"}]));export{i as editorHighlight,m as editorTheme};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{L as M,k as H,l as J,n as ee,o as te,e as ae}from"./index-
|
|
1
|
+
import{L as M,k as H,l as J,n as ee,o as te,e as ae}from"./index-DuO49xlq.js";import{s as re,t as o}from"./index-C1aD9jbe.js";import{E as ne,L as oe}from"./index-Cxys5D35.js";import{i as le,e as se}from"./index-Cc5e0VaU.js";import"./index-BHot-lnj.js";import"./index-891wE-Rj.js";const ie=36,R=1,ce=2,k=3,S=4,fe=5,de=6,Oe=7,me=8,ue=9,he=10,ke=11,Qe=12,ge=13,ve=14,xe=15,be=16,pe=17,q=18,Ce=19,$=20,A=21,L=22,Se=23,Pe=24;function y(t){return t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57}function ye(t){return t>=48&&t<=57||t>=97&&t<=102||t>=65&&t<=70}function h(t,e,r){for(let a=!1;;){if(t.next<0)return;if(t.next==e&&!a){t.advance();return}a=r&&!a&&t.next==92,t.advance()}}function we(t,e){e:for(;;){if(t.next<0)return;if(t.next==36){t.advance();for(let r=0;r<e.length;r++){if(t.next!=e.charCodeAt(r))continue e;t.advance()}if(t.next==36){t.advance();return}}else t.advance()}}function Te(t,e){let r="[{<(".indexOf(String.fromCharCode(e)),a=r<0?e:"]}>)".charCodeAt(r);for(;;){if(t.next<0)return;if(t.next==a&&t.peek(1)==39){t.advance(2);return}t.advance()}}function w(t,e){for(;!(t.next!=95&&!y(t.next));)e!=null&&(e+=String.fromCharCode(t.next)),t.advance();return e}function Ue(t){if(t.next==39||t.next==34||t.next==96){let e=t.next;t.advance(),h(t,e,!1)}else w(t)}function Z(t,e){for(;t.next==48||t.next==49;)t.advance();e&&t.next==e&&t.advance()}function D(t,e){for(;;){if(t.next==46){if(e)break;e=!0}else if(t.next<48||t.next>57)break;t.advance()}if(t.next==69||t.next==101)for(t.advance(),(t.next==43||t.next==45)&&t.advance();t.next>=48&&t.next<=57;)t.advance()}function j(t){for(;!(t.next<0||t.next==10);)t.advance()}function u(t,e){for(let r=0;r<e.length;r++)if(e.charCodeAt(r)==t)return!0;return!1}const P=` \r
|
|
2
2
|
`;function V(t,e,r){let a=Object.create(null);a.true=a.false=fe,a.null=a.unknown=de;for(let n of t.split(" "))n&&(a[n]=$);for(let n of e.split(" "))n&&(a[n]=A);for(let n of(r||"").split(" "))n&&(a[n]=Pe);return a}const Be="array binary bit boolean char character clob date decimal double float int integer interval large national nchar nclob numeric object precision real smallint time timestamp varchar varying ",Xe="absolute action add after all allocate alter and any are as asc assertion at authorization before begin between both breadth by call cascade cascaded case cast catalog check close collate collation column commit condition connect connection constraint constraints constructor continue corresponding count create cross cube current current_date current_default_transform_group current_transform_group_for_type current_path current_role current_time current_timestamp current_user cursor cycle data day deallocate declare default deferrable deferred delete depth deref desc describe descriptor deterministic diagnostics disconnect distinct do domain drop dynamic each else elseif end end-exec equals escape except exception exec execute exists exit external fetch first for foreign found from free full function general get global go goto grant group grouping handle having hold hour identity if immediate in indicator initially inner inout input insert intersect into is isolation join key language last lateral leading leave left level like limit local localtime localtimestamp locator loop map match method minute modifies module month names natural nesting new next no none not of old on only open option or order ordinality out outer output overlaps pad parameter partial path prepare preserve primary prior privileges procedure public read reads recursive redo ref references referencing relative release repeat resignal restrict result return returns revoke right role rollback rollup routine row rows savepoint schema scroll search second section select session session_user set sets signal similar size some space specific specifictype sql sqlexception sqlstate sqlwarning start state static system_user table temporary then timezone_hour timezone_minute to trailing transaction translation treat trigger under undo union unique unnest until update usage user using value values view when whenever where while with without work write year zone ",T={backslashEscapes:!1,hashComments:!1,spaceAfterDashes:!1,slashComments:!1,doubleQuotedStrings:!1,doubleDollarQuotedStrings:!1,unquotedBitLiterals:!1,treatBitsAsBytes:!1,charSetCasts:!1,plsqlQuotingMechanism:!1,operatorChars:"*+-%<>!=&|~^/",specialVar:"?",identifierQuotes:'"',caseInsensitiveIdentifiers:!1,words:V(Xe,Be)};function Ie(t,e,r,a){let n={};for(let l in T)n[l]=(t.hasOwnProperty(l)?t:T)[l];return e&&(n.words=V(e,r||"",a)),n}function W(t){return new ne(e=>{var r;let{next:a}=e;if(e.advance(),u(a,P)){for(;u(e.next,P);)e.advance();e.acceptToken(ie)}else if(a==36&&t.doubleDollarQuotedStrings){let n=w(e,"");e.next==36&&(e.advance(),we(e,n),e.acceptToken(k))}else if(a==39||a==34&&t.doubleQuotedStrings)h(e,a,t.backslashEscapes),e.acceptToken(k);else if(a==35&&t.hashComments||a==47&&e.next==47&&t.slashComments)j(e),e.acceptToken(R);else if(a==45&&e.next==45&&(!t.spaceAfterDashes||e.peek(1)==32))j(e),e.acceptToken(R);else if(a==47&&e.next==42){e.advance();for(let n=1;;){let l=e.next;if(e.next<0)break;if(e.advance(),l==42&&e.next==47){if(n--,e.advance(),!n)break}else l==47&&e.next==42&&(n++,e.advance())}e.acceptToken(ce)}else if((a==101||a==69)&&e.next==39)e.advance(),h(e,39,!0),e.acceptToken(k);else if((a==110||a==78)&&e.next==39&&t.charSetCasts)e.advance(),h(e,39,t.backslashEscapes),e.acceptToken(k);else if(a==95&&t.charSetCasts)for(let n=0;;n++){if(e.next==39&&n>1){e.advance(),h(e,39,t.backslashEscapes),e.acceptToken(k);break}if(!y(e.next))break;e.advance()}else if(t.plsqlQuotingMechanism&&(a==113||a==81)&&e.next==39&&e.peek(1)>0&&!u(e.peek(1),P)){let n=e.peek(1);e.advance(2),Te(e,n),e.acceptToken(k)}else if(u(a,t.identifierQuotes)){const n=a==91?93:a;h(e,n,!1),e.acceptToken(Ce)}else if(a==40)e.acceptToken(Oe);else if(a==41)e.acceptToken(me);else if(a==123)e.acceptToken(ue);else if(a==125)e.acceptToken(he);else if(a==91)e.acceptToken(ke);else if(a==93)e.acceptToken(Qe);else if(a==59)e.acceptToken(ge);else if(t.unquotedBitLiterals&&a==48&&e.next==98)e.advance(),Z(e),e.acceptToken(L);else if((a==98||a==66)&&(e.next==39||e.next==34)){const n=e.next;e.advance(),t.treatBitsAsBytes?(h(e,n,t.backslashEscapes),e.acceptToken(Se)):(Z(e,n),e.acceptToken(L))}else if(a==48&&(e.next==120||e.next==88)||(a==120||a==88)&&e.next==39){let n=e.next==39;for(e.advance();ye(e.next);)e.advance();n&&e.next==39&&e.advance(),e.acceptToken(S)}else if(a==46&&e.next>=48&&e.next<=57)D(e,!0),e.acceptToken(S);else if(a==46)e.acceptToken(ve);else if(a>=48&&a<=57)D(e,!1),e.acceptToken(S);else if(u(a,t.operatorChars)){for(;u(e.next,t.operatorChars);)e.advance();e.acceptToken(xe)}else if(u(a,t.specialVar))e.next==a&&e.advance(),Ue(e),e.acceptToken(pe);else if(a==58||a==44)e.acceptToken(be);else if(y(a)){let n=w(e,String.fromCharCode(a));e.acceptToken(e.next==46||e.peek(-n.length-1)==46?q:(r=t.words[n.toLowerCase()])!==null&&r!==void 0?r:q)}})}const F=W(T),_e=oe.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:"⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement",maxTerm:38,nodeProps:[["isolate",-4,1,2,3,19,""]],skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:"RORO",tokenizers:[0,F],topRules:{Script:[0,25]},tokenPrec:0});function U(t){let e=t.cursor().moveTo(t.from,-1);for(;/Comment/.test(e.name);)e.moveTo(e.from,-1);return e.node}function v(t,e){let r=t.sliceString(e.from,e.to),a=/^([`'"\[])(.*)([`'"\]])$/.exec(r);return a?a[2]:r}function p(t){return t&&(t.name=="Identifier"||t.name=="QuotedIdentifier")}function Re(t,e){if(e.name=="CompositeIdentifier"){let r=[];for(let a=e.firstChild;a;a=a.nextSibling)p(a)&&r.push(v(t,a));return r}return[v(t,e)]}function N(t,e){for(let r=[];;){if(!e||e.name!=".")return r;let a=U(e);if(!p(a))return r;r.unshift(v(t,a)),e=U(a)}}function qe(t,e){let r=ae(t).resolveInner(e,-1),a=Ze(t.doc,r);return r.name=="Identifier"||r.name=="QuotedIdentifier"||r.name=="Keyword"?{from:r.from,quoted:r.name=="QuotedIdentifier"?t.doc.sliceString(r.from,r.from+1):null,parents:N(t.doc,U(r)),aliases:a}:r.name=="."?{from:e,quoted:null,parents:N(t.doc,r),aliases:a}:{from:e,quoted:null,parents:[],empty:!0,aliases:a}}const Le=new Set("where group having order union intersect except all distinct limit offset fetch for".split(" "));function Ze(t,e){let r;for(let n=e;!r;n=n.parent){if(!n)return null;n.name=="Statement"&&(r=n)}let a=null;for(let n=r.firstChild,l=!1,c=null;n;n=n.nextSibling){let i=n.name=="Keyword"?t.sliceString(n.from,n.to).toLowerCase():null,s=null;if(!l)l=i=="from";else if(i=="as"&&c&&p(n.nextSibling))s=v(t,n.nextSibling);else{if(i&&Le.has(i))break;c&&p(n)&&(s=v(t,n))}s&&(a||(a=Object.create(null)),a[s]=Re(t,c)),c=/Identifier$/.test(n.name)?n:null}return a}function De(t,e,r){return r.map(a=>({...a,label:a.label[0]==t?a.label:t+a.label+e,apply:void 0}))}const je=/^\w*$/,Ne=/^[`'"\[]?\w*[`'"\]]?$/;function z(t){return t.self&&typeof t.self.label=="string"}class B{constructor(e,r){this.idQuote=e,this.idCaseInsensitive=r,this.list=[],this.children=void 0}child(e){let r=this.children||(this.children=Object.create(null)),a=r[e];return a||(e&&!this.list.some(n=>n.label==e)&&this.list.push(E(e,"type",this.idQuote,this.idCaseInsensitive)),r[e]=new B(this.idQuote,this.idCaseInsensitive))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let r=this.list.findIndex(a=>a.label==e.label);r>-1?this.list[r]=e:this.list.push(e)}addCompletions(e){for(let r of e)this.addCompletion(typeof r=="string"?E(r,"property",this.idQuote,this.idCaseInsensitive):r)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):z(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let r of Object.keys(e)){let a=e[r],n=null,l=r.replace(/\\?\./g,i=>i=="."?"\0":i).split("\0"),c=this;z(a)&&(n=a.self,a=a.children);for(let i=0;i<l.length;i++)n&&i==l.length-1&&c.addCompletion(n),c=c.child(l[i].replace(/\\\./g,"."));c.addNamespace(a)}}}function E(t,e,r,a){return new RegExp("^[a-z_][a-z_\\d]*$",a?"i":"").test(t)?{label:t,type:e}:{label:t,type:e,apply:r+t+K(r)}}function K(t){return t==="["?"]":t}function ze(t,e,r,a,n,l){var c;let i=((c=l==null?void 0:l.spec.identifierQuotes)===null||c===void 0?void 0:c[0])||'"',s=new B(i,!!(l!=null&&l.spec.caseInsensitiveIdentifiers)),d=n?s.child(n):null;return s.addNamespace(t),e&&(d||s).addCompletions(e),r&&s.addCompletions(r),d&&s.addCompletions(d.list),a&&s.addCompletions((d||s).child(a).list),O=>{let{parents:Q,from:I,quoted:_,empty:G,aliases:x}=qe(O.state,O.pos);if(G&&!O.explicit)return null;x&&Q.length==1&&(Q=x[Q[0]]||Q);let f=s;for(let m of Q){for(;!f.children||!f.children[m];)if(f==s&&d)f=d;else if(f==d&&a)f=f.child(a);else return null;let g=f.maybeChild(m);if(!g)return null;f=g}let b=f.list;if(f==s&&x&&(b=b.concat(Object.keys(x).map(m=>({label:m,type:"constant"})))),_){let m=_[0],g=K(m),Y=O.state.sliceDoc(O.pos,O.pos+1)==g;return{from:I,to:Y?O.pos+1:void 0,options:De(m,g,b),validFor:Ne}}else return{from:I,options:b,validFor:je}}}function Ee(t){return t==A?"type":t==$?"keyword":"variable"}function $e(t,e,r){let a=Object.keys(t).map(n=>r(e?n.toUpperCase():n,Ee(t[n])));return le(["QuotedIdentifier","String","LineComment","BlockComment","."],se(a))}let Ae=_e.configure({props:[J.add({Statement:ee()}),te.add({Statement(t,e){return{from:Math.min(t.from+100,e.doc.lineAt(t.from).to),to:t.to}},BlockComment(t){return{from:t.from+2,to:t.to-2}}}),re({Keyword:o.keyword,Type:o.typeName,Builtin:o.standard(o.name),Bits:o.number,Bytes:o.string,Bool:o.bool,Null:o.null,Number:o.number,String:o.string,Identifier:o.name,QuotedIdentifier:o.special(o.string),SpecialVar:o.special(o.name),LineComment:o.lineComment,BlockComment:o.blockComment,Operator:o.operator,"Semi Punctuation":o.punctuation,"( )":o.paren,"{ }":o.brace,"[ ]":o.squareBracket})]});class C{constructor(e,r,a){this.dialect=e,this.language=r,this.spec=a}get extension(){return this.language.extension}configureLanguage(e,r){return new C(this.dialect,this.language.configure(e,r),this.spec)}static define(e){let r=Ie(e,e.keywords,e.types,e.builtin),a=H.define({name:"sql",parser:Ae.configure({tokenizers:[{from:F,to:W(r)}]}),languageData:{commentTokens:{line:"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}});return new C(r,a,e)}}function Ve(t,e){return{label:t,type:e,boost:-1}}function We(t,e=!1,r){return $e(t.dialect.words,e,r||Ve)}function Fe(t){return t.schema?ze(t.schema,t.tables,t.schemas,t.defaultTable,t.defaultSchema,t.dialect||X):()=>null}function Ke(t){return t.schema?(t.dialect||X).language.data.of({autocomplete:Fe(t)}):[]}function tt(t={}){let e=t.dialect||X;return new M(e.language,[Ke(t),e.language.data.of({autocomplete:We(e,t.upperCaseKeywords,t.keywordCompletion)})])}const X=C.define({});export{C as SQLDialect,X as StandardSQL,We as keywordCompletionSource,Fe as schemaCompletionSource,tt as sql};
|