@conveno/cli 0.2.0-rc.7 → 0.2.0-rc.9

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.
@@ -1,8 +1,8 @@
1
- import { execFile } from "node:child_process";
1
+ import { execFile, spawn } from "node:child_process";
2
2
  import { readFileSync, statSync } from "node:fs";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import { join } from "node:path";
5
- import { Rt as startTurnContext, U as findOnPath, ft as planProgram, it as ownSession, ot as parseCliVersion, ut as pendingHookContext, z as endTurnContinuation } from "./dist-D2hMvcZu.js";
5
+ import { H as endTurnContinuation, K as findOnPath, Kt as startTurnContext, _t as pendingHookContext, bt as planProgram, dt as ownSession, pt as parseCliVersion, xt as planSpawn } from "./dist-STNJjbNH.js";
6
6
  import { n as cs, t as Za } from "./toml-patch-DGzVRdd1.js";
7
7
  // ../adapters/codex/dist/index.js
8
8
  const SERVER_NAME = "conveno";
@@ -91,6 +91,266 @@ function removeServer(path, before) {
91
91
  } catch {}
92
92
  return Za(before, expected);
93
93
  }
94
+ const EVENT_NAME = {
95
+ session_start: "SessionStart",
96
+ user_prompt_submit: "UserPromptSubmit",
97
+ stop: "Stop",
98
+ permission_request: "PermissionRequest"
99
+ };
100
+ /** A hook key is `<file>:<event>:<group>:<handler>`; null for any other shape. */
101
+ function parseHookKey(key) {
102
+ const m = /^(.*):([a-z_]+):\d+:\d+$/.exec(key);
103
+ const event = m?.[2] ? EVENT_NAME[m[2]] : void 0;
104
+ return m?.[1] && event ? {
105
+ file: m[1],
106
+ event
107
+ } : null;
108
+ }
109
+ /** A path for comparing: one separator, and no case on Windows. */
110
+ const normalizePath = (p, platform) => {
111
+ const slashed = p.replace(/\\/g, "/");
112
+ return platform === "win32" ? slashed.toLowerCase() : slashed;
113
+ };
114
+ /**
115
+ * The hooks Conveno wrote: from the user-level hooks.json only, never managed, running exactly the
116
+ * command Conveno writes for that event. A hook from a project's `.codex/hooks.json`, or one that
117
+ * only ends the same way, is somebody else's and is never trusted here.
118
+ */
119
+ function ownHookFilter(rule) {
120
+ const file = normalizePath(rule.file, rule.platform);
121
+ return (h) => {
122
+ if (h.isManaged) return false;
123
+ const k = parseHookKey(h.key);
124
+ if (!k || normalizePath(k.file, rule.platform) !== file) return false;
125
+ return (h.command ?? "").trim() === rule.commandFor(k.event);
126
+ };
127
+ }
128
+ /** Ends the program and what it started. `child.kill()` alone leaves the real Codex behind a Windows .cmd shim. */
129
+ function killTree(child, spawnFn) {
130
+ try {
131
+ if (process.platform === "win32" && child.pid !== void 0) {
132
+ const t = spawnFn("taskkill", [
133
+ "/T",
134
+ "/F",
135
+ "/PID",
136
+ String(child.pid)
137
+ ], {
138
+ stdio: "ignore",
139
+ windowsHide: true
140
+ });
141
+ t.on("error", () => child.kill());
142
+ t.unref?.();
143
+ return;
144
+ }
145
+ child.kill();
146
+ } catch {}
147
+ }
148
+ async function withAppServer(o, run) {
149
+ const spawnFn = o.spawnFn ?? spawn;
150
+ const child = spawnFn(o.file, o.args, {
151
+ cwd: o.cwd,
152
+ ...o.env ? { env: { ...o.env } } : {},
153
+ windowsHide: true,
154
+ windowsVerbatimArguments: o.windowsVerbatimArguments,
155
+ stdio: [
156
+ "pipe",
157
+ "pipe",
158
+ "pipe"
159
+ ]
160
+ });
161
+ let buf = "";
162
+ let stderr = "";
163
+ let nextId = 1;
164
+ let ended;
165
+ let exited = false;
166
+ const pending = /* @__PURE__ */ new Map();
167
+ /** The program is gone or unusable: every request waiting, and every later one, fails now. */
168
+ const end = (e) => {
169
+ ended ??= e;
170
+ for (const done of [...pending.values()]) done({ error: { message: e.message } });
171
+ pending.clear();
172
+ };
173
+ const tail = () => stderr.trim() ? ` stderr: ${stderr.trim().slice(-300)}` : "";
174
+ child.on("error", (e) => end(e));
175
+ const gone = (code) => {
176
+ exited = true;
177
+ end(/* @__PURE__ */ new Error(`codex app-server exited (${String(code)}).${tail()}`));
178
+ };
179
+ child.on("exit", gone);
180
+ child.on("close", gone);
181
+ child.stdin?.on("error", (e) => end(e));
182
+ child.stderr?.on("data", (d) => {
183
+ stderr += String(d);
184
+ });
185
+ child.stdout?.on("data", (d) => {
186
+ buf += String(d);
187
+ for (;;) {
188
+ const nl = buf.indexOf("\n");
189
+ if (nl < 0) break;
190
+ const line = buf.slice(0, nl).trim();
191
+ buf = buf.slice(nl + 1);
192
+ if (!line.startsWith("{")) continue;
193
+ try {
194
+ const m = JSON.parse(line);
195
+ if (typeof m.id === "number") pending.get(m.id)?.(m);
196
+ } catch {}
197
+ }
198
+ });
199
+ const send = (msg) => {
200
+ try {
201
+ child.stdin?.write(`${JSON.stringify(msg)}\n`);
202
+ } catch (e) {
203
+ end(e instanceof Error ? e : new Error(String(e)));
204
+ }
205
+ };
206
+ const request = (method, params) => new Promise((resolve, reject) => {
207
+ if (ended) return reject(ended);
208
+ const id = nextId++;
209
+ pending.set(id, (m) => {
210
+ if (m.error) reject(/* @__PURE__ */ new Error(`${method}: ${m.error.message ?? "error"}`));
211
+ else resolve(m.result);
212
+ });
213
+ send({
214
+ jsonrpc: "2.0",
215
+ id,
216
+ method,
217
+ params
218
+ });
219
+ });
220
+ const timer = setTimeout(() => end(/* @__PURE__ */ new Error(`codex app-server did not answer in time.${tail()}`)), o.timeoutMs ?? 3e4);
221
+ try {
222
+ await request("initialize", { clientInfo: {
223
+ name: "conveno",
224
+ version: "0.0.0"
225
+ } });
226
+ send({
227
+ jsonrpc: "2.0",
228
+ method: "initialized"
229
+ });
230
+ return await run(request);
231
+ } finally {
232
+ clearTimeout(timer);
233
+ child.stdin?.end();
234
+ if (!exited) {
235
+ const kill = setTimeout(() => killTree(child, spawnFn), 2e3);
236
+ kill.unref();
237
+ child.once("exit", () => clearTimeout(kill));
238
+ }
239
+ }
240
+ }
241
+ const listHooks = async (request, cwd, isOurs) => {
242
+ return ((await request("hooks/list", { cwds: [cwd] })).data?.[0]?.hooks ?? []).filter(isOurs);
243
+ };
244
+ /** Conveno's hooks as Codex sees them now, whatever their trust status. */
245
+ const convenoHooks = (o) => withAppServer(o, (request) => listHooks(request, o.cwd, o.isOurs));
246
+ /** Trusts Conveno's hooks that need it, and nothing else. */
247
+ async function trustConvenoHooks(file, args, cwd, windowsVerbatimArguments, extra) {
248
+ const o = {
249
+ file,
250
+ args,
251
+ cwd,
252
+ ...windowsVerbatimArguments === void 0 ? {} : { windowsVerbatimArguments },
253
+ ...extra
254
+ };
255
+ return withAppServer(o, async (request) => {
256
+ const all = await listHooks(request, cwd, o.isOurs);
257
+ const ours = all.filter((h) => h.trustStatus === "untrusted" || h.trustStatus === "modified");
258
+ if (ours.length === 0) return {
259
+ listed: all.length,
260
+ trusted: [],
261
+ left: all.filter((h) => h.trustStatus !== "trusted").length
262
+ };
263
+ await request("config/batchWrite", {
264
+ edits: [{
265
+ keyPath: "hooks.state",
266
+ value: Object.fromEntries(ours.map((h) => [h.key, { trusted_hash: h.currentHash }])),
267
+ mergeStrategy: "upsert"
268
+ }],
269
+ reloadUserConfig: true
270
+ });
271
+ const after = await listHooks(request, cwd, o.isOurs);
272
+ return {
273
+ listed: all.length,
274
+ trusted: ours.map((h) => h.key),
275
+ left: after.filter((h) => h.trustStatus !== "trusted").length
276
+ };
277
+ });
278
+ }
279
+ /** A TOML quoted key: basic ("...") or literal ('...'). */
280
+ const QUOTED = String.raw`(?:"((?:[^"\\]|\\.)*)"|'([^']*)')`;
281
+ const unquote = (m) => m[2] ?? (m[1] ?? "").replace(/\\(.)/g, "$1");
282
+ /** The key of a `[hooks.state."<key>"]` (or single-quoted) table head, or undefined for any other line. */
283
+ function hookStateKey(line) {
284
+ const m = new RegExp(String.raw`^\[\s*hooks\s*\.\s*state\s*\.\s*${QUOTED}\s*\]\s*(?:#.*)?$`).exec(line.trim());
285
+ return m ? unquote(m) : void 0;
286
+ }
287
+ /**
288
+ * Where `hooks.state` entries are in a config.toml: a `[hooks.state."k"]` table, or a dotted key
289
+ * (`state."k".trusted_hash = ...` under `[hooks]`, `"k".trusted_hash = ...` under
290
+ * `[hooks.state]`, `hooks.state."k"...` before any table).
291
+ */
292
+ function hookStateEntries(toml) {
293
+ const out = [];
294
+ let prefix = String.raw`hooks\s*\.\s*state\s*\.\s*`;
295
+ toml.split("\n").forEach((raw, line) => {
296
+ const t = raw.trim();
297
+ if (t.startsWith("[")) {
298
+ const key = hookStateKey(t);
299
+ if (key !== void 0) out.push({
300
+ line,
301
+ key,
302
+ table: true
303
+ });
304
+ if (/^\[\s*hooks\s*\]\s*(?:#.*)?$/.test(t)) prefix = String.raw`state\s*\.\s*`;
305
+ else if (/^\[\s*hooks\s*\.\s*state\s*\]\s*(?:#.*)?$/.test(t)) prefix = "";
306
+ else prefix = null;
307
+ return;
308
+ }
309
+ if (prefix === null) return;
310
+ const m = new RegExp(`^${prefix}${QUOTED}\\s*(?:\\.\\s*[A-Za-z_-]+\\s*)?=`).exec(t);
311
+ if (m) out.push({
312
+ line,
313
+ key: unquote(m),
314
+ table: false
315
+ });
316
+ });
317
+ return out;
318
+ }
319
+ /** Remove the `hooks.state` entries for these keys from a config.toml text. */
320
+ function untrustHooks(toml, keys) {
321
+ const drop = new Set(keys);
322
+ const dead = hookStateEntries(toml).filter((e) => drop.has(e.key));
323
+ const tables = new Set(dead.filter((e) => e.table).map((e) => e.line));
324
+ const single = new Set(dead.filter((e) => !e.table).map((e) => e.line));
325
+ const out = [];
326
+ let skipping = false;
327
+ toml.split("\n").forEach((line, i) => {
328
+ if (line.trim().startsWith("[")) skipping = tables.has(i);
329
+ if (skipping) {
330
+ if (out.at(-1)?.trim() === "") out.pop();
331
+ return;
332
+ }
333
+ if (single.has(i)) return;
334
+ out.push(line);
335
+ });
336
+ return out.join("\n");
337
+ }
338
+ /** The text of a key as a TOML string, in the quote style the old one had. */
339
+ const requote = (old, key) => old.startsWith("'") ? `'${key}'` : `"${key.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
340
+ /**
341
+ * Give `hooks.state` entries another key. Codex keys trust by position, so when a hook group is
342
+ * removed, the entries of the groups after it follow them down; the hook itself is unchanged, so
343
+ * its hash still matches. `rename` returns the new key, or undefined to leave the entry alone.
344
+ */
345
+ function renameHooks(toml, rename) {
346
+ const lines = toml.split("\n");
347
+ for (const e of hookStateEntries(toml)) {
348
+ const to = rename(e.key);
349
+ if (to === void 0 || to === e.key) continue;
350
+ lines[e.line] = (lines[e.line] ?? "").replace(new RegExp(QUOTED), (tok) => requote(tok, to));
351
+ }
352
+ return lines.join("\n");
353
+ }
94
354
  const HOOK_EVENTS = [
95
355
  "SessionStart",
96
356
  "UserPromptSubmit",
@@ -150,18 +410,48 @@ function handlersOf(group) {
150
410
  }
151
411
  /** Hook entries for one event with our handlers removed; empty groups are dropped. */
152
412
  function withoutOurs(groups, event) {
413
+ return withOursReplaced(groups, event, void 0);
414
+ }
415
+ /**
416
+ * Hook entries for one event with our handlers removed. The first group that held only ours is
417
+ * replaced by `group` where it stood: Codex keys its trust by position, so a group moved to the
418
+ * end would shift the user's groups after it and orphan their trust. With no such group, `group`
419
+ * goes last.
420
+ */
421
+ function withOursReplaced(groups, event, group) {
153
422
  const out = [];
154
- for (const group of groups) {
155
- const handlers = handlersOf(group);
423
+ let placed = group === void 0;
424
+ for (const g of groups) {
425
+ const handlers = handlersOf(g);
156
426
  const kept = handlers.filter((h) => !isOurs(asObject(h).command, event));
157
- if (kept.length === handlers.length) out.push(group);
427
+ if (kept.length === handlers.length) out.push(g);
158
428
  else if (kept.length > 0) out.push({
159
- ...asObject(group),
429
+ ...asObject(g),
160
430
  hooks: kept
161
431
  });
432
+ else if (!placed) {
433
+ out.push(group);
434
+ placed = true;
435
+ }
162
436
  }
437
+ if (!placed) out.push(group);
163
438
  return out;
164
439
  }
440
+ /** Where each handler that stays moves to when ours are removed: `group:handler` to `group:handler`. */
441
+ function shiftedHandlers(groups, event) {
442
+ const moved = /* @__PURE__ */ new Map();
443
+ let g2 = 0;
444
+ groups.forEach((g, g1) => {
445
+ let h2 = 0;
446
+ handlersOf(g).forEach((h, h1) => {
447
+ if (isOurs(asObject(h).command, event)) return;
448
+ if (g1 !== g2 || h1 !== h2) moved.set(`${g1}:${h1}`, `${g2}:${h2}`);
449
+ h2++;
450
+ });
451
+ if (h2 > 0) g2++;
452
+ });
453
+ return moved;
454
+ }
165
455
  function hasOurs(groups, command) {
166
456
  return groups.some((g) => handlersOf(g).some((h) => asObject(h).command === command));
167
457
  }
@@ -178,11 +468,11 @@ async function planHooks(env) {
178
468
  const command = hookCommand(env, event);
179
469
  if (hasOurs(groups, command)) continue;
180
470
  changed = true;
181
- next[event] = [...withoutOurs(groups, event), { hooks: [{
471
+ next[event] = withOursReplaced(groups, event, { hooks: [{
182
472
  type: "command",
183
473
  command,
184
474
  timeout: HOOK_TIMEOUT_SECONDS
185
- }] }];
475
+ }] });
186
476
  }
187
477
  if (!changed) return [];
188
478
  const partKind = (event) => asArray(hooks[event]).some((g) => handlersOf(g).some((h) => isOurs(asObject(h).command, event))) ? "update" : "add";
@@ -486,19 +776,194 @@ const delivery = () => ({
486
776
  endOfTurn: true,
487
777
  idleWake: true
488
778
  });
489
- const codexAdapter = {
490
- cli: "codex",
491
- displayName: "Codex",
492
- deliveryTier: "next_turn",
493
- detect,
494
- async plan(env) {
495
- return [...await planMcp(env), ...await planHooks(env)];
496
- },
497
- async uninstallPlan(env) {
498
- return [...await uninstallMcp(env), ...await uninstallHooks(env)];
499
- },
500
- hook,
501
- delivery,
502
- daemonWake
779
+ /** The option that has setup trust Conveno's hooks in Codex, so `/hooks` never has to be run. */
780
+ const TRUST_OPTION = "codex-trust-hooks";
781
+ const TRUST_QUESTION = "Approve Conveno in Codex now, so it doesn't ask you the first time you open it?";
782
+ /** hooks/list and config/batchWrite are quick; a stuck Codex should not hold setup for long. */
783
+ const TRUST_TIMEOUT_MS = 15e3;
784
+ function appServerOpts(env, deps) {
785
+ const plan = planSpawn("codex", ["app-server"], {
786
+ platform: env.platform,
787
+ env: env.env
788
+ });
789
+ return {
790
+ file: plan.file,
791
+ args: plan.args,
792
+ cwd: env.cwd,
793
+ timeoutMs: TRUST_TIMEOUT_MS,
794
+ env: env.env,
795
+ isOurs: ownHookFilter({
796
+ file: hooksPath(env),
797
+ platform: env.platform,
798
+ commandFor: (event) => hookCommand(env, event)
799
+ }),
800
+ ...plan.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {},
801
+ ...deps.spawnFn ? { spawnFn: deps.spawnFn } : {}
802
+ };
803
+ }
804
+ function createTrustOption(deps) {
805
+ return {
806
+ id: TRUST_OPTION,
807
+ question: TRUST_QUESTION,
808
+ defaultYes: true,
809
+ approval: true,
810
+ async enabled(env) {
811
+ try {
812
+ const hooks = await convenoHooks(appServerOpts(env, deps));
813
+ return hooks.length > 0 && hooks.every((h) => h.trustStatus === "trusted");
814
+ } catch {
815
+ return false;
816
+ }
817
+ },
818
+ applyWrites(env) {
819
+ const path = configPath(env);
820
+ const slashed = path.replace(/\\/g, "/");
821
+ const home = env.home.replace(/\\/g, "/");
822
+ const shown = home && slashed.startsWith(home) ? `~${slashed.slice(home.length)}` : slashed;
823
+ return {
824
+ paths: [path],
825
+ note: `Also approves Conveno's hooks in Codex: Codex writes hooks.state in ${shown}`
826
+ };
827
+ },
828
+ async apply(env) {
829
+ const failed = {
830
+ ok: false,
831
+ message: "Couldn't approve Conveno in Codex. It will ask you the first time you open it."
832
+ };
833
+ try {
834
+ const o = appServerOpts(env, deps);
835
+ const r = await trustConvenoHooks(o.file, o.args, o.cwd, o.windowsVerbatimArguments, {
836
+ timeoutMs: o.timeoutMs,
837
+ env: o.env,
838
+ isOurs: o.isOurs,
839
+ ...o.spawnFn ? { spawnFn: o.spawnFn } : {}
840
+ });
841
+ return r.listed === 0 || r.left > 0 ? failed : { ok: true };
842
+ } catch {
843
+ return failed;
844
+ }
845
+ }
846
+ };
847
+ }
848
+ /** Whether hooks.json has a Conveno handler. */
849
+ async function hasConvenoHooks(env) {
850
+ try {
851
+ const doc = parseHooksJson(hooksPath(env), await readIfExists(hooksPath(env)));
852
+ const hooks = asObject(doc.hooks);
853
+ return [...HOOK_EVENTS, ...LEGACY_HOOK_EVENTS].some((e) => asArray(hooks[e]).some((g) => handlersOf(g).some((h) => isOurs(asObject(h).command, e))));
854
+ } catch {
855
+ return false;
856
+ }
857
+ }
858
+ const STATE_EVENTS = {
859
+ SessionStart: "session_start",
860
+ UserPromptSubmit: "user_prompt_submit",
861
+ Stop: "stop",
862
+ PermissionRequest: "permission_request"
503
863
  };
864
+ /**
865
+ * Trust entries of Conveno's hooks that can be found without asking Codex. Codex keys them
866
+ * `<hooks.json path>:<event>:<group>:<handler>`. With hooks.json still there, the entries of the
867
+ * handlers that are ours. With hooks.json gone (restored or removed first), every entry of those
868
+ * events for that file: only Conveno's setup trusted hooks there.
869
+ */
870
+ async function ownTrustKeys(env, toml) {
871
+ const file = hooksPath(env);
872
+ const norm = (p) => normalizePath(p, env.platform);
873
+ const raw = await readIfExists(file).catch(() => "");
874
+ const exists = raw !== null;
875
+ const events = Object.keys(STATE_EVENTS);
876
+ const want = /* @__PURE__ */ new Set();
877
+ if (exists) {
878
+ let hooks = {};
879
+ try {
880
+ hooks = asObject(parseHooksJson(file, raw).hooks);
881
+ } catch {
882
+ return [];
883
+ }
884
+ for (const event of events) asArray(hooks[event]).forEach((group, g) => {
885
+ handlersOf(group).forEach((h, i) => {
886
+ if (isOurs(asObject(h).command, event)) want.add(norm(`${file}:${STATE_EVENTS[event]}:${g}:${i}`));
887
+ });
888
+ });
889
+ }
890
+ const out = [];
891
+ for (const { key } of hookStateEntries(toml)) {
892
+ const k = norm(key);
893
+ if (exists ? want.has(k) : events.some((e) => k.startsWith(norm(`${file}:${STATE_EVENTS[e]}:`)))) out.push(key);
894
+ }
895
+ return out;
896
+ }
897
+ /**
898
+ * How the keys of the user's own hooks change when uninstall takes Conveno's handlers out of
899
+ * hooks.json: the groups after a removed one move down, and their trust entries must follow.
900
+ */
901
+ async function shiftedKeys(env) {
902
+ const file = hooksPath(env);
903
+ const moves = /* @__PURE__ */ new Map();
904
+ try {
905
+ const hooks = asObject(parseHooksJson(file, await readIfExists(file)).hooks);
906
+ for (const event of [...HOOK_EVENTS, ...LEGACY_HOOK_EVENTS]) for (const [from, to] of shiftedHandlers(asArray(hooks[event]), event)) moves.set(`${STATE_EVENTS[event]}:${from}`, `${STATE_EVENTS[event]}:${to}`);
907
+ } catch {
908
+ return () => void 0;
909
+ }
910
+ const same = normalizePath(file, env.platform);
911
+ return (key) => {
912
+ const k = parseHookKey(key);
913
+ if (!k || normalizePath(k.file, env.platform) !== same) return void 0;
914
+ const tail = /:([a-z_]+:\d+:\d+)$/.exec(key)?.[1];
915
+ const to = tail ? moves.get(tail) : void 0;
916
+ return to === void 0 ? void 0 : `${key.slice(0, key.length - (tail?.length ?? 0))}${to}`;
917
+ };
918
+ }
919
+ /**
920
+ * Takes the trust entries Codex recorded for Conveno's hooks out of config.toml. Found by the
921
+ * file's own keys first, so it works when hooks.json is already gone, and through Codex while
922
+ * the hooks still exist. Folded into the MCP removal when there is one, since both edit the same
923
+ * file. Entries for other hook files stay.
924
+ */
925
+ async function untrustChanges(env, deps, mcp) {
926
+ const path = configPath(env);
927
+ const before = await readIfExists(path);
928
+ if (before === null || hookStateEntries(before).length === 0) return mcp;
929
+ const keys = await ownTrustKeys(env, before);
930
+ if (await hasConvenoHooks(env)) try {
931
+ keys.push(...(await convenoHooks(appServerOpts(env, deps))).map((h) => h.key));
932
+ } catch {}
933
+ const first = mcp[0];
934
+ const base = first ? first.after : before;
935
+ const after = renameHooks(untrustHooks(base, keys), await shiftedKeys(env));
936
+ if (after === base) return mcp;
937
+ if (first) return [{
938
+ ...first,
939
+ after
940
+ }];
941
+ return [{
942
+ component: "hooks",
943
+ kind: "remove",
944
+ path,
945
+ before,
946
+ after,
947
+ description: "Remove the approval of Conveno's hooks from Codex config."
948
+ }];
949
+ }
950
+ function createCodexAdapter(deps = {}) {
951
+ return {
952
+ cli: "codex",
953
+ displayName: "Codex",
954
+ deliveryTier: "next_turn",
955
+ detect,
956
+ async plan(env) {
957
+ return [...await planMcp(env), ...await planHooks(env)];
958
+ },
959
+ optional: [createTrustOption(deps)],
960
+ async uninstallPlan(env) {
961
+ return [...await untrustChanges(env, deps, await uninstallMcp(env)), ...await uninstallHooks(env)];
962
+ },
963
+ hook,
964
+ delivery,
965
+ daemonWake
966
+ };
967
+ }
968
+ const codexAdapter = createCodexAdapter();
504
969
  export { codexAdapter as t };