Skip to content

The one and only agent harness for complex codebases. Project memory, planning, execution, and verified completion inside Codex.

chore: sync Codex marketplace v5.0.0-beta.62

github-actions[bot]e6be07d3bf9c
diff --git a/plugins/omo/.codex-plugin/plugin.json b/plugins/omo/.codex-plugin/plugin.json
index 76a4d4f1..67a3ca81 100644
--- a/plugins/omo/.codex-plugin/plugin.json
+++ b/plugins/omo/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "omo",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"description": "One Codex plugin namespace for Yeongyu's local Codex components.",
"author": {
"name": "Yeongyu Kim",
diff --git a/plugins/omo/components/bootstrap/dist/cli.js b/plugins/omo/components/bootstrap/dist/cli.js
index e5767ec0..2fae858b 100755
--- a/plugins/omo/components/bootstrap/dist/cli.js
+++ b/plugins/omo/components/bootstrap/dist/cli.js
@@ -1,7 +1,7 @@
#!/usr/bin/env node
// components/bootstrap/src/cli.ts
-import { realpathSync } from "node:fs";
+import { realpathSync as realpathSync2 } from "node:fs";
import { fileURLToPath as fileURLToPath4 } from "node:url";
// components/bootstrap/src/download.ts
@@ -438,9 +438,9 @@ async function readOptionalFile(path) {
}
// components/bootstrap/src/worker.ts
-import { appendFile as appendFile2, mkdir as mkdir8, readFile as readFile14 } from "node:fs/promises";
+import { appendFile as appendFile2, mkdir as mkdir8, readFile as readFile15 } from "node:fs/promises";
import { homedir as homedir5 } from "node:os";
-import { dirname as dirname9, join as join22, resolve as resolve7 } from "node:path";
+import { dirname as dirname10, join as join24, resolve as resolve8 } from "node:path";
import { fileURLToPath as fileURLToPath2 } from "node:url";
// components/bootstrap/src/provision.ts
@@ -1000,16 +1000,6579 @@ async function defaultVersionProbe2(binaryPath) {
}
// components/bootstrap/src/setup.ts
-import { copyFile as copyFile2, mkdir as mkdir7, readFile as readFile13, readdir as readdir5, rm as rm10, stat as stat5 } from "node:fs/promises";
-import { join as join21 } from "node:path";
+import { copyFile as copyFile2, mkdir as mkdir7, readFile as readFile14, readdir as readdir5, rm as rm11, stat as stat5 } from "node:fs/promises";
+import { join as join23 } from "node:path";
+
+// ../../../node_modules/.bun/[email protected]/node_modules/zod/v4/core/core.js
+var _a;
+function $constructor(name, initializer, params) {
+ function init(inst, def) {
+ if (!inst._zod) {
+ Object.defineProperty(inst, "_zod", {
+ value: {
+ def,
+ constr: _,
+ traits: new Set
+ },
+ enumerable: false
+ });
+ }
+ if (inst._zod.traits.has(name)) {
+ return;
+ }
+ inst._zod.traits.add(name);
+ initializer(inst, def);
+ const proto = _.prototype;
+ const keys = Object.keys(proto);
+ for (let i = 0;i < keys.length; i++) {
+ const k = keys[i];
+ if (!(k in inst)) {
+ inst[k] = proto[k].bind(inst);
+ }
+ }
+ }
+ const Parent = params?.Parent ?? Object;
+
+ class Definition extends Parent {
+ }
+ Object.defineProperty(Definition, "name", { value: name });
+ function _(def) {
+ var _a;
+ const inst = params?.Parent ? new Definition : this;
+ init(inst, def);
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
+ for (const fn of inst._zod.deferred) {
+ fn();
+ }
+ return inst;
+ }
+ Object.defineProperty(_, "init", { value: init });
+ Object.defineProperty(_, Symbol.hasInstance, {
+ value: (inst) => {
+ if (params?.Parent && inst instanceof params.Parent)
+ return true;
+ return inst?._zod?.traits?.has(name);
+ }
+ });
+ Object.defineProperty(_, "name", { value: name });
+ return _;
+}
+var $brand = Symbol("zod_brand");
+
+class $ZodAsyncError extends Error {
+ constructor() {
+ super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
+ }
+}
+
+class $ZodEncodeError extends Error {
+ constructor(name) {
+ super(`Encountered unidirectional transform during encode: ${name}`);
+ this.name = "ZodEncodeError";
+ }
+}
+(_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
+var globalConfig = globalThis.__zod_globalConfig;
+function config(newConfig) {
+ if (newConfig)
+ Object.assign(globalConfig, newConfig);
+ return globalConfig;
+}
+// ../../../node_modules/.bun/[email protected]/node_modules/zod/v4/core/util.js
+function getEnumValues(entries) {
+ const numericValues = Object.values(entries).filter((v) => typeof v === "number");
+ const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
+ return values;
+}
+function jsonStringifyReplacer(_, value) {
+ if (typeof value === "bigint")
+ return value.toString();
+ return value;
+}
+function cached(getter) {
+ const set = false;
+ return {
+ get value() {
+ if (!set) {
+ const value = getter();
+ Object.defineProperty(this, "value", { value });
+ return value;
+ }
+ throw new Error("cached value already set");
+ }
+ };
+}
+function nullish(input) {
+ return input === null || input === undefined;
+}
+function cleanRegex(source) {
+ const start = source.startsWith("^") ? 1 : 0;
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
+ return source.slice(start, end);
+}
+function floatSafeRemainder(val, step) {
+ const ratio = val / step;
+ const roundedRatio = Math.round(ratio);
+ const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
+ if (Math.abs(ratio - roundedRatio) < tolerance)
+ return 0;
+ return ratio - roundedRatio;
+}
+var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
+function defineLazy(object, key, getter) {
+ let value = undefined;
+ Object.defineProperty(object, key, {
+ get() {
+ if (value === EVALUATING) {
+ return;
+ }
+ if (value === undefined) {
+ value = EVALUATING;
+ value = getter();
+ }
+ return value;
+ },
+ set(v) {
+ Object.defineProperty(object, key, {
+ value: v
+ });
+ },
+ configurable: true
+ });
+}
+function assignProp(target, prop, value) {
+ Object.defineProperty(target, prop, {
+ value,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+}
+function mergeDefs(...defs) {
+ const mergedDescriptors = {};
+ for (const def of defs) {
+ const descriptors = Object.getOwnPropertyDescriptors(def);
+ Object.assign(mergedDescriptors, descriptors);
+ }
+ return Object.defineProperties({}, mergedDescriptors);
+}
+function esc(str) {
+ return JSON.stringify(str);
+}
+function slugify(input) {
+ return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
+}
+var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
+function isObject(data) {
+ return typeof data === "object" && data !== null && !Array.isArray(data);
+}
+var allowsEval = /* @__PURE__ */ cached(() => {
+ if (globalConfig.jitless) {
+ return false;
+ }
+ if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
+ return false;
+ }
+ try {
+ const F = Function;
+ new F("");
+ return true;
+ } catch (_) {
+ return false;
+ }
+});
+function isPlainObject(o) {
+ if (isObject(o) === false)
+ return false;
+ const ctor = o.constructor;
+ if (ctor === undefined)
+ return true;
+ if (typeof ctor !== "function")
+ return true;
+ const prot = ctor.prototype;
+ if (isObject(prot) === false)
+ return false;
+ if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
+ return false;
+ }
+ return true;
+}
+function shallowClone(o) {
+ if (isPlainObject(o))
+ return { ...o };
+ if (Array.isArray(o))
+ return [...o];
+ if (o instanceof Map)
+ return new Map(o);
+ if (o instanceof Set)
+ return new Set(o);
+ return o;
+}
+var propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
+function escapeRegex(str) {
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
+}
+function clone(inst, def, params) {
+ const cl = new inst._zod.constr(def ?? inst._zod.def);
+ if (!def || params?.parent)
+ cl._zod.parent = inst;
+ return cl;
+}
+function normalizeParams(_params) {
+ const params = _params;
+ if (!params)
+ return {};
+ if (typeof params === "string")
+ return { error: () => params };
+ if (params?.message !== undefined) {
+ if (params?.error !== undefined)
+ throw new Error("Cannot specify both `message` and `error` params");
+ params.error = params.message;
+ }
+ delete params.message;
+ if (typeof params.error === "string")
+ return { ...params, error: () => params.error };
+ return params;
+}
+function optionalKeys(shape) {
+ return Object.keys(shape).filter((k) => {
+ return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
+ });
+}
+var NUMBER_FORMAT_RANGES = {
+ safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
+ int32: [-2147483648, 2147483647],
+ uint32: [0, 4294967295],
+ float32: [-340282346638528860000000000000000000000, 340282346638528860000000000000000000000],
+ float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
+};
+function pick(schema, mask) {
+ const currDef = schema._zod.def;
+ const checks = currDef.checks;
+ const hasChecks = checks && checks.length > 0;
+ if (hasChecks) {
+ throw new Error(".pick() cannot be used on object schemas containing refinements");
+ }
+ const def = mergeDefs(schema._zod.def, {
+ get shape() {
+ const newShape = {};
+ for (const key in mask) {
+ if (!(key in currDef.shape)) {
+ throw new Error(`Unrecognized key: "${key}"`);
+ }
+ if (!mask[key])
+ continue;
+ newShape[key] = currDef.shape[key];
+ }
+ assignProp(this, "shape", newShape);
+ return newShape;
+ },
+ checks: []
+ });
+ return clone(schema, def);
+}
+function omit(schema, mask) {
+ const currDef = schema._zod.def;
+ const checks = currDef.checks;
+ const hasChecks = checks && checks.length > 0;
+ if (hasChecks) {
+ throw new Error(".omit() cannot be used on object schemas containing refinements");
+ }
+ const def = mergeDefs(schema._zod.def, {
+ get shape() {
+ const newShape = { ...schema._zod.def.shape };
+ for (const key in mask) {
+ if (!(key in currDef.shape)) {
+ throw new Error(`Unrecognized key: "${key}"`);
+ }
+ if (!mask[key])
+ continue;
+ delete newShape[key];
+ }
+ assignProp(this, "shape", newShape);
+ return newShape;
+ },
+ checks: []
+ });
+ return clone(schema, def);
+}
+function extend(schema, shape) {
+ if (!isPlainObject(shape)) {
+ throw new Error("Invalid input to extend: expected a plain object");
+ }
+ const checks = schema._zod.def.checks;
+ const hasChecks = checks && checks.length > 0;
+ if (hasChecks) {
+ const existingShape = schema._zod.def.shape;
+ for (const key in shape) {
+ if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {
+ throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
+ }
+ }
+ }
+ const def = mergeDefs(schema._zod.def, {
+ get shape() {
+ const _shape = { ...schema._zod.def.shape, ...shape };
+ assignProp(this, "shape", _shape);
+ return _shape;
+ }
+ });
+ return clone(schema, def);
+}
+function safeExtend(schema, shape) {
+ if (!isPlainObject(shape)) {
+ throw new Error("Invalid input to safeExtend: expected a plain object");
+ }
+ const def = mergeDefs(schema._zod.def, {
+ get shape() {
+ const _shape = { ...schema._zod.def.shape, ...shape };
+ assignProp(this, "shape", _shape);
+ return _shape;
+ }
+ });
+ return clone(schema, def);
+}
+function merge(a, b) {
+ if (a._zod.def.checks?.length) {
+ throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
+ }
+ const def = mergeDefs(a._zod.def, {
+ get shape() {
+ const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
+ assignProp(this, "shape", _shape);
+ return _shape;
+ },
+ get catchall() {
+ return b._zod.def.catchall;
+ },
+ checks: b._zod.def.checks ?? []
+ });
+ return clone(a, def);
+}
+function partial(Class, schema, mask) {
+ const currDef = schema._zod.def;
+ const checks = currDef.checks;
+ const hasChecks = checks && checks.length > 0;
+ if (hasChecks) {
+ throw new Error(".partial() cannot be used on object schemas containing refinements");
+ }
+ const def = mergeDefs(schema._zod.def, {
+ get shape() {
+ const oldShape = schema._zod.def.shape;
+ const shape = { ...oldShape };
+ if (mask) {
+ for (const key in mask) {
+ if (!(key in oldShape)) {
+ throw new Error(`Unrecognized key: "${key}"`);
+ }
+ if (!mask[key])
+ continue;
+ shape[key] = Class ? new Class({
+ type: "optional",
+ innerType: oldShape[key]
+ }) : oldShape[key];
+ }
+ } else {
+ for (const key in oldShape) {
+ shape[key] = Class ? new Class({
+ type: "optional",
+ innerType: oldShape[key]
+ }) : oldShape[key];
+ }
+ }
+ assignProp(this, "shape", shape);
+ return shape;
+ },
+ checks: []
+ });
+ return clone(schema, def);
+}
+function required(Class, schema, mask) {
+ const def = mergeDefs(schema._zod.def, {
+ get shape() {
+ const oldShape = schema._zod.def.shape;
+ const shape = { ...oldShape };
+ if (mask) {
+ for (const key in mask) {
+ if (!(key in shape)) {
+ throw new Error(`Unrecognized key: "${key}"`);
+ }
+ if (!mask[key])
+ continue;
+ shape[key] = new Class({
+ type: "nonoptional",
+ innerType: oldShape[key]
+ });
+ }
+ } else {
+ for (const key in oldShape) {
+ shape[key] = new Class({
+ type: "nonoptional",
+ innerType: oldShape[key]
+ });
+ }
+ }
+ assignProp(this, "shape", shape);
+ return shape;
+ }
+ });
+ return clone(schema, def);
+}
+function aborted(x, startIndex = 0) {
+ if (x.aborted === true)
+ return true;
+ for (let i = startIndex;i < x.issues.length; i++) {
+ if (x.issues[i]?.continue !== true) {
+ return true;
+ }
+ }
+ return false;
+}
+function explicitlyAborted(x, startIndex = 0) {
+ if (x.aborted === true)
+ return true;
+ for (let i = startIndex;i < x.issues.length; i++) {
+ if (x.issues[i]?.continue === false) {
+ return true;
+ }
+ }
+ return false;
+}
+function prefixIssues(path, issues) {
+ return issues.map((iss) => {
+ var _a;
+ (_a = iss).path ?? (_a.path = []);
+ iss.path.unshift(path);
+ return iss;
+ });
+}
+function unwrapMessage(message) {
+ return typeof message === "string" ? message : message?.message;
+}
+function finalizeIssue(iss, ctx, config) {
+ const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
+ const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
+ rest.path ?? (rest.path = []);
+ rest.message = message;
+ if (ctx?.reportInput) {
+ rest.input = _input;
+ }
+ return rest;
+}
+function getLengthableOrigin(input) {
+ if (Array.isArray(input))
+ return "array";
+ if (typeof input === "string")
+ return "string";
+ return "unknown";
+}
+function issue(...args) {
+ const [iss, input, inst] = args;
+ if (typeof iss === "string") {
+ return {
+ message: iss,
+ code: "custom",
+ input,
+ inst
+ };
+ }
+ return { ...iss };
+}
+
+// ../../../node_modules/.bun/[email protected]/node_modules/zod/v4/core/errors.js
+var initializer = (inst, def) => {
+ inst.name = "$ZodError";
+ Object.defineProperty(inst, "_zod", {
+ value: inst._zod,
+ enumerable: false
+ });
+ Object.defineProperty(inst, "issues", {
+ value: def,
+ enumerable: false
+ });
+ inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
+ Object.defineProperty(inst, "toString", {
+ value: () => inst.message,
+ enumerable: false
+ });
+};
+var $ZodError = $constructor("$ZodError", initializer);
+var $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
+function flattenError(error, mapper = (issue) => issue.message) {
+ const fieldErrors = {};
+ const formErrors = [];
+ for (const sub of error.issues) {
+ if (sub.path.length > 0) {
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
+ fieldErrors[sub.path[0]].push(mapper(sub));
+ } else {
+ formErrors.push(mapper(sub));
+ }
+ }
+ return { formErrors, fieldErrors };
+}
+function formatError(error, mapper = (issue) => issue.message) {
+ const fieldErrors = { _errors: [] };
+ const processError = (error, path = []) => {
+ for (const issue of error.issues) {
+ if (issue.code === "invalid_union" && issue.errors.length) {
+ issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
+ } else if (issue.code === "invalid_key") {
+ processError({ issues: issue.issues }, [...path, ...issue.path]);
+ } else if (issue.code === "invalid_element") {
+ processError({ issues: issue.issues }, [...path, ...issue.path]);
+ } else {
+ const fullpath = [...path, ...issue.path];
+ if (fullpath.length === 0) {
+ fieldErrors._errors.push(mapper(issue));
+ } else {
+ let curr = fieldErrors;
+ let i = 0;
+ while (i < fullpath.length) {
+ const el = fullpath[i];
+ const terminal = i === fullpath.length - 1;
+ if (!terminal) {
+ curr[el] = curr[el] || { _errors: [] };
+ } else {
+ curr[el] = curr[el] || { _errors: [] };
+ curr[el]._errors.push(mapper(issue));
+ }
+ curr = curr[el];
+ i++;
+ }
+ }
+ }
+ }
+ };
+ processError(error);
+ return fieldErrors;
+}
+
+// ../../../node_modules/.bun/[email protected]/node_modules/zod/v4/core/parse.js
+var _parse = (_Err) => (schema, value, _ctx, _params) => {
+ const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
+ const result = schema._zod.run({ value, issues: [] }, ctx);
+ if (result instanceof Promise) {
+ throw new $ZodAsyncError;
+ }
+ if (result.issues.length) {
+ const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
+ captureStackTrace(e, _params?.callee);
+ throw e;
+ }
+ return result.value;
+};
+var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
+ const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
+ let result = schema._zod.run({ value, issues: [] }, ctx);
+ if (result instanceof Promise)
+ result = await result;
+ if (result.issues.length) {
+ const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
+ captureStackTrace(e, params?.callee);
+ throw e;
+ }
+ return result.value;
+};
+var _safeParse = (_Err) => (schema, value, _ctx) => {
+ const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
+ const result = schema._zod.run({ value, issues: [] }, ctx);
+ if (result instanceof Promise) {
+ throw new $ZodAsyncError;
+ }
+ return result.issues.length ? {
+ success: false,
+ error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
+ } : { success: true, data: result.value };
+};
+var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
+var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
+ const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
+ let result = schema._zod.run({ value, issues: [] }, ctx);
+ if (result instanceof Promise)
+ result = await result;
+ return result.issues.length ? {
+ success: false,
+ error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
+ } : { success: true, data: result.value };
+};
+var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
+var _encode = (_Err) => (schema, value, _ctx) => {
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
+ return _parse(_Err)(schema, value, ctx);
+};
+var _decode = (_Err) => (schema, value, _ctx) => {
+ return _parse(_Err)(schema, value, _ctx);
+};
+var _encodeAsync = (_Err) => async (schema, value, _ctx) => {
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
+ return _parseAsync(_Err)(schema, value, ctx);
+};
+var _decodeAsync = (_Err) => async (schema, value, _ctx) => {
+ return _parseAsync(_Err)(schema, value, _ctx);
+};
+var _safeEncode = (_Err) => (schema, value, _ctx) => {
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
+ return _safeParse(_Err)(schema, value, ctx);
+};
+var _safeDecode = (_Err) => (schema, value, _ctx) => {
+ return _safeParse(_Err)(schema, value, _ctx);
+};
+var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
+ return _safeParseAsync(_Err)(schema, value, ctx);
+};
+var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
+ return _safeParseAsync(_Err)(schema, value, _ctx);
+};
+// ../../../node_modules/.bun/[email protected]/node_modules/zod/v4/core/regexes.js
+var cuid = /^[cC][0-9a-z]{6,}$/;
+var cuid2 = /^[0-9a-z]+$/;
+var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
+var xid = /^[0-9a-vA-V]{20}$/;
+var ksuid = /^[A-Za-z0-9]{27}$/;
+var nanoid = /^[a-zA-Z0-9_-]{21}$/;
+var duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
+var guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
+var uuid = (version) => {
+ if (!version)
+ return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
+ return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
+};
+var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
+var _emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
+function emoji() {
+ return new RegExp(_emoji, "u");
+}
+var ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
+var ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
+var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
+var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
+var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
+var base64url = /^[A-Za-z0-9_-]*$/;
+var httpProtocol = /^https?$/;
+var e164 = /^\+[1-9]\d{6,14}$/;
+var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
+var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
+function timeSource(args) {
+ const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
+ const regex = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
+ return regex;
+}
+function time(args) {
+ return new RegExp(`^${timeSource(args)}$`);
+}
+function datetime(args) {
+ const time = timeSource({ precision: args.precision });
+ const opts = ["Z"];
+ if (args.local)
+ opts.push("");
+ if (args.offset)
+ opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
+ const timeRegex = `${time}(?:${opts.join("|")})`;
+ return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
+}
+var string = (params) => {
+ const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
+ return new RegExp(`^${regex}$`);
+};
+var integer = /^-?\d+$/;
+var number = /^-?\d+(?:\.\d+)?$/;
+var boolean = /^(?:true|false)$/i;
+var lowercase = /^[^A-Z]*$/;
+var uppercase = /^[^a-z]*$/;
+
+// ../../../node_modules/.bun/[email protected]/node_modules/zod/v4/core/checks.js
+var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
+ var _a;
+ inst._zod ?? (inst._zod = {});
+ inst._zod.def = def;
+ (_a = inst._zod).onattach ?? (_a.onattach = []);
+});
+var numericOriginMap = {
+ number: "number",
+ bigint: "bigint",
+ object: "date"
+};
+var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
+ $ZodCheck.init(inst, def);
+ const origin = numericOriginMap[typeof def.value];
+ inst._zod.onattach.push((inst) => {
+ const bag = inst._zod.bag;
+ const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
+ if (def.value < curr) {
+ if (def.inclusive)
+ bag.maximum = def.value;
+ else
+ bag.exclusiveMaximum = def.value;
+ }
+ });
+ inst._zod.check = (payload) => {
+ if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
+ return;
+ }
+ payload.issues.push({
+ origin,
+ code: "too_big",
+ maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
+ input: payload.value,
+ inclusive: def.inclusive,
+ inst,
+ continue: !def.abort
+ });
+ };
+});
+var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
+ $ZodCheck.init(inst, def);
+ const origin = numericOriginMap[typeof def.value];
+ inst._zod.onattach.push((inst) => {
+ const bag = inst._zod.bag;
+ const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
+ if (def.value > curr) {
+ if (def.inclusive)
+ bag.minimum = def.value;
+ else
+ bag.exclusiveMinimum = def.value;
+ }
+ });
+ inst._zod.check = (payload) => {
+ if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
+ return;
+ }
+ payload.issues.push({
+ origin,
+ code: "too_small",
+ minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
+ input: payload.value,
+ inclusive: def.inclusive,
+ inst,
+ continue: !def.abort
+ });
+ };
+});
+var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
+ $ZodCheck.init(inst, def);
+ inst._zod.onattach.push((inst) => {
+ var _a;
+ (_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
+ });
+ inst._zod.check = (payload) => {
+ if (typeof payload.value !== typeof def.value)
+ throw new Error("Cannot mix number and bigint in multiple_of check.");
+ const isMultiple = typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0;
+ if (isMultiple)
+ return;
+ payload.issues.push({
+ origin: typeof payload.value,
+ code: "not_multiple_of",
+ divisor: def.value,
+ input: payload.value,
+ inst,
+ continue: !def.abort
+ });
+ };
+});
+var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat", (inst, def) => {
+ $ZodCheck.init(inst, def);
+ def.format = def.format || "float64";
+ const isInt = def.format?.includes("int");
+ const origin = isInt ? "int" : "number";
+ const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
+ inst._zod.onattach.push((inst) => {
+ const bag = inst._zod.bag;
+ bag.format = def.format;
+ bag.minimum = minimum;
+ bag.maximum = maximum;
+ if (isInt)
+ bag.pattern = integer;
+ });
+ inst._zod.check = (payload) => {
+ const input = payload.value;
+ if (isInt) {
+ if (!Number.isInteger(input)) {
+ payload.issues.push({
+ expected: origin,
+ format: def.format,
+ code: "invalid_type",
+ continue: false,
+ input,
+ inst
+ });
+ return;
+ }
+ if (!Number.isSafeInteger(input)) {
+ if (input > 0) {
+ payload.issues.push({
+ input,
+ code: "too_big",
+ maximum: Number.MAX_SAFE_INTEGER,
+ note: "Integers must be within the safe integer range.",
+ inst,
+ origin,
+ inclusive: true,
+ continue: !def.abort
+ });
+ } else {
+ payload.issues.push({
+ input,
+ code: "too_small",
+ minimum: Number.MIN_SAFE_INTEGER,
+ note: "Integers must be within the safe integer range.",
+ inst,
+ origin,
+ inclusive: true,
+ continue: !def.abort
+ });
+ }
+ return;
+ }
+ }
+ if (input < minimum) {
+ payload.issues.push({
+ origin: "number",
+ input,
+ code: "too_small",
+ minimum,
+ inclusive: true,
+ inst,
+ continue: !def.abort
+ });
+ }
+ if (input > maximum) {
+ payload.issues.push({
+ origin: "number",
+ input,
+ code: "too_big",
+ maximum,
+ inclusive: true,
+ inst,
+ continue: !def.abort
+ });
+ }
+ };
+});
+var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
+ var _a;
+ $ZodCheck.init(inst, def);
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
+ const val = payload.value;
+ return !nullish(val) && val.length !== undefined;
+ });
+ inst._zod.onattach.push((inst) => {
+ const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
+ if (def.maximum < curr)
+ inst._zod.bag.maximum = def.maximum;
+ });
+ inst._zod.check = (payload) => {
+ const input = payload.value;
+ const length = input.length;
+ if (length <= def.maximum)
+ return;
+ const origin = getLengthableOrigin(input);
+ payload.issues.push({
+ origin,
+ code: "too_big",
+ maximum: def.maximum,
+ inclusive: true,
+ input,
+ inst,
+ continue: !def.abort
+ });
+ };
+});
+var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
+ var _a;
+ $ZodCheck.init(inst, def);
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
+ const val = payload.value;
+ return !nullish(val) && val.length !== undefined;
+ });
+ inst._zod.onattach.push((inst) => {
+ const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
+ if (def.minimum > curr)
+ inst._zod.bag.minimum = def.minimum;
+ });
+ inst._zod.check = (payload) => {
+ const input = payload.value;
+ const length = input.length;
+ if (length >= def.minimum)
+ return;
+ const origin = getLengthableOrigin(input);
+ payload.issues.push({
+ origin,
+ code: "too_small",
+ minimum: def.minimum,
+ inclusive: true,
+ input,
+ inst,
+ continue: !def.abort
+ });
+ };
+});
+var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
+ var _a;
+ $ZodCheck.init(inst, def);
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
+ const val = payload.value;
+ return !nullish(val) && val.length !== undefined;
+ });
+ inst._zod.onattach.push((inst) => {
+ const bag = inst._zod.bag;
+ bag.minimum = def.length;
+ bag.maximum = def.length;
+ bag.length = def.length;
+ });
+ inst._zod.check = (payload) => {
+ const input = payload.value;
+ const length = input.length;
+ if (length === def.length)
+ return;
+ const origin = getLengthableOrigin(input);
+ const tooBig = length > def.length;
+ payload.issues.push({
+ origin,
+ ...tooBig ? { code: "too_big", maximum: def.length } : { code: "too_small", minimum: def.length },
+ inclusive: true,
+ exact: true,
+ input: payload.value,
+ inst,
+ continue: !def.abort
+ });
+ };
+});
+var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
+ var _a, _b;
+ $ZodCheck.init(inst, def);
+ inst._zod.onattach.push((inst) => {
+ const bag = inst._zod.bag;
+ bag.format = def.format;
+ if (def.pattern) {
+ bag.patterns ?? (bag.patterns = new Set);
+ bag.patterns.add(def.pattern);
+ }
+ });
+ if (def.pattern)
+ (_a = inst._zod).check ?? (_a.check = (payload) => {
+ def.pattern.lastIndex = 0;
+ if (def.pattern.test(payload.value))
+ return;
+ payload.issues.push({
+ origin: "string",
+ code: "invalid_format",
+ format: def.format,
+ input: payload.value,
+ ...def.pattern ? { pattern: def.pattern.toString() } : {},
+ inst,
+ continue: !def.abort
+ });
+ });
+ else
+ (_b = inst._zod).check ?? (_b.check = () => {});
+});
+var $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
+ $ZodCheckStringFormat.init(inst, def);
+ inst._zod.check = (payload) => {
+ def.pattern.lastIndex = 0;
+ if (def.pattern.test(payload.value))
+ return;
+ payload.issues.push({
+ origin: "string",
+ code: "invalid_format",
+ format: "regex",
+ input: payload.value,
+ pattern: def.pattern.toString(),
+ inst,
+ continue: !def.abort
+ });
+ };
+});
+var $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
+ def.pattern ?? (def.pattern = lowercase);
+ $ZodCheckStringFormat.init(inst, def);
+});
+var $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
+ def.pattern ?? (def.pattern = uppercase);
+ $ZodCheckStringFormat.init(inst, def);
+});
+var $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
+ $ZodCheck.init(inst, def);
+ const escapedRegex = escapeRegex(def.includes);
+ const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
+ def.pattern = pattern;
+ inst._zod.onattach.push((inst) => {
+ const bag = inst._zod.bag;
+ bag.patterns ?? (bag.patterns = new Set);
+ bag.patterns.add(pattern);
+ });
+ inst._zod.check = (payload) => {
+ if (payload.value.includes(def.includes, def.position))
+ return;
+ payload.issues.push({
+ origin: "string",
+ code: "invalid_format",
+ format: "includes",
+ includes: def.includes,
+ input: payload.value,
+ inst,
+ continue: !def.abort
+ });
+ };
+});
+var $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
+ $ZodCheck.init(inst, def);
+ const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
+ def.pattern ?? (def.pattern = pattern);
+ inst._zod.onattach.push((inst) => {
+ const bag = inst._zod.bag;
+ bag.patterns ?? (bag.patterns = new Set);
+ bag.patterns.add(pattern);
+ });
+ inst._zod.check = (payload) => {
+ if (payload.value.startsWith(def.prefix))
+ return;
+ payload.issues.push({
+ origin: "string",
+ code: "invalid_format",
+ format: "starts_with",
+ prefix: def.prefix,
+ input: payload.value,
+ inst,
+ continue: !def.abort
+ });
+ };
+});
+var $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
+ $ZodCheck.init(inst, def);
+ const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
+ def.pattern ?? (def.pattern = pattern);
+ inst._zod.onattach.push((inst) => {
+ const bag = inst._zod.bag;
+ bag.patterns ?? (bag.patterns = new Set);
+ bag.patterns.add(pattern);
+ });
+ inst._zod.check = (payload) => {
+ if (payload.value.endsWith(def.suffix))
+ return;
+ payload.issues.push({
+ origin: "string",
+ code: "invalid_format",
+ format: "ends_with",
+ suffix: def.suffix,
+ input: payload.value,
+ inst,
+ continue: !def.abort
+ });
+ };
+});
+var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
+ $ZodCheck.init(inst, def);
+ inst._zod.check = (payload) => {
+ payload.value = def.tx(payload.value);
+ };
+});
+
+// ../../../node_modules/.bun/[email protected]/node_modules/zod/v4/core/doc.js
+class Doc {
+ constructor(args = []) {
+ this.content = [];
+ this.indent = 0;
+ if (this)
+ this.args = args;
+ }
+ indented(fn) {
+ this.indent += 1;
+ fn(this);
+ this.indent -= 1;
+ }
+ write(arg) {
+ if (typeof arg === "function") {
+ arg(this, { execution: "sync" });
+ arg(this, { execution: "async" });
+ return;
+ }
+ const content = arg;
+ const lines = content.split(`
+`).filter((x) => x);
+ const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
+ const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
+ for (const line of dedented) {
+ this.content.push(line);
+ }
+ }
+ compile() {
+ const F = Function;
+ const args = this?.args;
+ const content = this?.content ?? [``];
+ const lines = [...content.map((x) => ` ${x}`)];
+ return new F(...args, lines.join(`
+`));
+ }
+}
+
+// ../../../node_modules/.bun/[email protected]/node_modules/zod/v4/core/versions.js
+var version = {
+ major: 4,
+ minor: 4,
+ patch: 3
+};
+
+// ../../../node_modules/.bun/[email protected]/node_modules/zod/v4/core/schemas.js
+var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
+ var _a;
+ inst ?? (inst = {});
+ inst._zod.def = def;
+ inst._zod.bag = inst._zod.bag || {};
+ inst._zod.version = version;
+ const checks = [...inst._zod.def.checks ?? []];
+ if (inst._zod.traits.has("$ZodCheck")) {
+ checks.unshift(inst);
+ }
+ for (const ch of checks) {
+ for (const fn of ch._zod.onattach) {
+ fn(inst);
+ }
+ }
+ if (checks.length === 0) {
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
+ inst._zod.deferred?.push(() => {
+ inst._zod.run = inst._zod.parse;
+ });
+ } else {
+ const runChecks = (payload, checks, ctx) => {
+ let isAborted = aborted(payload);
+ let asyncResult;
+ for (const ch of checks) {
+ if (ch._zod.def.when) {
+ if (explicitlyAborted(payload))
+ continue;
+ const shouldRun = ch._zod.def.when(payload);
+ if (!shouldRun)
+ continue;
+ } else if (isAborted) {
+ continue;
+ }
+ const currLen = payload.issues.length;
+ const _ = ch._zod.check(payload);
+ if (_ instanceof Promise && ctx?.async === false) {
+ throw new $ZodAsyncError;
+ }
+ if (asyncResult || _ instanceof Promise) {
+ asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
+ await _;
+ const nextLen = payload.issues.length;
+ if (nextLen === currLen)
+ return;
+ if (!isAborted)
+ isAborted = aborted(payload, currLen);
+ });
+ } else {
+ const nextLen = payload.issues.length;
+ if (nextLen === currLen)
+ continue;
+ if (!isAborted)
+ isAborted = aborted(payload, currLen);
+ }
+ }
+ if (asyncResult) {
+ return asyncResult.then(() => {
+ return payload;
+ });
+ }
+ return payload;
+ };
+ const handleCanaryResult = (canary, payload, ctx) => {
+ if (aborted(canary)) {
+ canary.aborted = true;
+ return canary;
+ }
+ const checkResult = runChecks(payload, checks, ctx);
+ if (checkResult instanceof Promise) {
+ if (ctx.async === false)
+ throw new $ZodAsyncError;
+ return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
+ }
+ return inst._zod.parse(checkResult, ctx);
+ };
+ inst._zod.run = (payload, ctx) => {
+ if (ctx.skipChecks) {
+ return inst._zod.parse(payload, ctx);
+ }
+ if (ctx.direction === "backward") {
+ const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
+ if (canary instanceof Promise) {
+ return canary.then((canary) => {
+ return handleCanaryResult(canary, payload, ctx);
+ });
+ }
+ return handleCanaryResult(canary, payload, ctx);
+ }
+ const result = inst._zod.parse(payload, ctx);
+ if (result instanceof Promise) {
+ if (ctx.async === false)
+ throw new $ZodAsyncError;
+ return result.then((result) => runChecks(result, checks, ctx));
+ }
+ return runChecks(result, checks, ctx);
+ };
+ }
+ defineLazy(inst, "~standard", () => ({
+ validate: (value) => {
+ try {
+ const r = safeParse(inst, value);
+ return r.success ? { value: r.data } : { issues: r.error?.issues };
+ } catch (_) {
+ return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
+ }
+ },
+ vendor: "zod",
+ version: 1
+ }));
+});
+var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
+ $ZodType.init(inst, def);
+ inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
+ inst._zod.parse = (payload, _) => {
+ if (def.coerce)
+ try {
+ payload.value = String(payload.value);
+ } catch (_) {}
+ if (typeof payload.value === "string")
+ return payload;
+ payload.issues.push({
+ expected: "string",
+ code: "invalid_type",
+ input: payload.value,
+ inst
+ });
+ return payload;
+ };
+});
+var $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
+ $ZodCheckStringFormat.init(inst, def);
+ $ZodString.init(inst, def);
+});
+var $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
+ def.pattern ?? (def.pattern = guid);
+ $ZodStringFormat.init(inst, def);
+});
+var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
+ if (def.version) {
+ const versionMap = {
+ v1: 1,
+ v2: 2,
+ v3: 3,
+ v4: 4,
+ v5: 5,
+ v6: 6,
+ v7: 7,
+ v8: 8
+ };
+ const v = versionMap[def.version];
+ if (v === undefined)
+ throw new Error(`Invalid UUID version: "${def.version}"`);
+ def.pattern ?? (def.pattern = uuid(v));
+ } else
+ def.pattern ?? (def.pattern = uuid());
+ $ZodStringFormat.init(inst, def);
+});
+var $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
+ def.pattern ?? (def.pattern = email);
+ $ZodStringFormat.init(inst, def);
+});
+var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
+ $ZodStringFormat.init(inst, def);
+ inst._zod.check = (payload) => {
+ try {
+ const trimmed = payload.value.trim();
+ if (!def.normalize && def.protocol?.source === httpProtocol.source) {
+ if (!/^https?:\/\//i.test(trimmed)) {
+ payload.issues.push({
+ code: "invalid_format",
+ format: "url",
+ note: "Invalid URL format",
+ input: payload.value,
+ inst,
+ continue: !def.abort
+ });
+ return;
+ }
+ }
+ const url = new URL(trimmed);
+ if (def.hostname) {
+ def.hostname.lastIndex = 0;
+ if (!def.hostname.test(url.hostname)) {
+ payload.issues.push({
+ code: "invalid_format",
+ format: "url",
+ note: "Invalid hostname",
+ pattern: def.hostname.source,
+ input: payload.value,
+ inst,
+ continue: !def.abort
+ });
+ }
+ }
+ if (def.protocol) {
+ def.protocol.lastIndex = 0;
+ if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
+ payload.issues.push({
+ code: "invalid_format",
+ format: "url",
+ note: "Invalid protocol",
+ pattern: def.protocol.source,
+ input: payload.value,
+ inst,
+ continue: !def.abort
+ });
+ }
+ }
+ if (def.normalize) {
+ payload.value = url.href;
+ } else {
+ payload.value = trimmed;
+ }
+ return;
+ } catch (_) {
+ payload.issues.push({
+ code: "invalid_format",
+ format: "url",
+ input: payload.value,
+ inst,
+ continue: !def.abort
+ });
+ }
+ };
+});
+var $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
+ def.pattern ?? (def.pattern = emoji());
+ $ZodStringFormat.init(inst, def);
+});
+var $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
+ def.pattern ?? (def.pattern = nanoid);
+ $ZodStringFormat.init(inst, def);
+});
+var $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
+ def.pattern ?? (def.pattern = cuid);
+ $ZodStringFormat.init(inst, def);
+});
+var $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
+ def.pattern ?? (def.pattern = cuid2);
+ $ZodStringFormat.init(inst, def);
+});
+var $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
+ def.pattern ?? (def.pattern = ulid);
+ $ZodStringFormat.init(inst, def);
+});
+var $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
+ def.pattern ?? (def.pattern = xid);
+ $ZodStringFormat.init(inst, def);
+});
+var $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
+ def.pattern ?? (def.pattern = ksuid);
+ $ZodStringFormat.init(inst, def);
+});
+var $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
+ def.pattern ?? (def.pattern = datetime(def));
+ $ZodStringFormat.init(inst, def);
+});
+var $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
+ def.pattern ?? (def.pattern = date);
+ $ZodStringFormat.init(inst, def);
+});
+var $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
+ def.pattern ?? (def.pattern = time(def));
+ $ZodStringFormat.init(inst, def);
+});
+var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
+ def.pattern ?? (def.pattern = duration);
+ $ZodStringFormat.init(inst, def);
+});
+var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
+ def.pattern ?? (def.pattern = ipv4);
+ $ZodStringFormat.init(inst, def);
+ inst._zod.bag.format = `ipv4`;
+});
+var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
+ def.pattern ?? (def.pattern = ipv6);
+ $ZodStringFormat.init(inst, def);
+ inst._zod.bag.format = `ipv6`;
+ inst._zod.check = (payload) => {
+ try {
+ new URL(`http://[${payload.value}]`);
+ } catch {
+ payload.issues.push({
+ code: "invalid_format",
+ format: "ipv6",
+ input: payload.value,
+ inst,
+ continue: !def.abort
+ });
+ }
+ };
+});
+var $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
+ def.pattern ?? (def.pattern = cidrv4);
+ $ZodStringFormat.init(inst, def);
+});
+var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
+ def.pattern ?? (def.pattern = cidrv6);
+ $ZodStringFormat.init(inst, def);
+ inst._zod.check = (payload) => {
+ const parts = payload.value.split("/");
+ try {
+ if (parts.length !== 2)
+ throw new Error;
+ const [address, prefix] = parts;
+ if (!prefix)
+ throw new Error;
+ const prefixNum = Number(prefix);
+ if (`${prefixNum}` !== prefix)
+ throw new Error;
+ if (prefixNum < 0 || prefixNum > 128)
+ throw new Error;
+ new URL(`http://[${address}]`);
+ } catch {
+ payload.issues.push({
+ code: "invalid_format",
+ format: "cidrv6",
+ input: payload.value,
+ inst,
+ continue: !def.abort
+ });
+ }
+ };
+});
+function isValidBase64(data) {
+ if (data === "")
+ return true;
+ if (/\s/.test(data))
+ return false;
+ if (data.length % 4 !== 0)
+ return false;
+ try {
+ atob(data);
+ return true;
+ } catch {
+ return false;
+ }
+}
+var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
+ def.pattern ?? (def.pattern = base64);
+ $ZodStringFormat.init(inst, def);
+ inst._zod.bag.contentEncoding = "base64";
+ inst._zod.check = (payload) => {
+ if (isValidBase64(payload.value))
+ return;
+ payload.issues.push({
+ code: "invalid_format",
+ format: "base64",
+ input: payload.value,
+ inst,
+ continue: !def.abort
+ });
+ };
+});
+function isValidBase64URL(data) {
+ if (!base64url.test(data))
+ return false;
+ const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
+ const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
+ return isValidBase64(padded);
+}
+var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
+ def.pattern ?? (def.pattern = base64url);
+ $ZodStringFormat.init(inst, def);
+ inst._zod.bag.contentEncoding = "base64url";
+ inst._zod.check = (payload) => {
+ if (isValidBase64URL(payload.value))
+ return;
+ payload.issues.push({
+ code: "invalid_format",
+ format: "base64url",
+ input: payload.value,
+ inst,
+ continue: !def.abort
+ });
+ };
+});
+var $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
+ def.pattern ?? (def.pattern = e164);
+ $ZodStringFormat.init(inst, def);
+});
+function isValidJWT(token, algorithm = null) {
+ try {
+ const tokensParts = token.split(".");
+ if (tokensParts.length !== 3)
+ return false;
+ const [header] = tokensParts;
+ if (!header)
+ return false;
+ const parsedHeader = JSON.parse(atob(header));
+ if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
+ return false;
+ if (!parsedHeader.alg)
+ return false;
+ if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm))
+ return false;
+ return true;
+ } catch {
+ return false;
+ }
+}
+var $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
+ $ZodStringFormat.init(inst, def);
+ inst._zod.check = (payload) => {
+ if (isValidJWT(payload.value, def.alg))
+ return;
+ payload.issues.push({
+ code: "invalid_format",
+ format: "jwt",
+ input: payload.value,
+ inst,
+ continue: !def.abort
+ });
+ };
+});
+var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
+ $ZodType.init(inst, def);
+ inst._zod.pattern = inst._zod.bag.pattern ?? number;
+ inst._zod.parse = (payload, _ctx) => {
+ if (def.coerce)
+ try {
+ payload.value = Number(payload.value);
+ } catch (_) {}
+ const input = payload.value;
+ if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
+ return payload;
+ }
+ const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : undefined : undefined;
+ payload.issues.push({
+ expected: "number",
+ code: "invalid_type",
+ input,
+ inst,
+ ...received ? { received } : {}
+ });
+ return payload;
+ };
+});
+var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
+ $ZodCheckNumberFormat.init(inst, def);
+ $ZodNumber.init(inst, def);
+});
+var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
+ $ZodType.init(inst, def);
+ inst._zod.pattern = boolean;
+ inst._zod.parse = (payload, _ctx) => {
+ if (def.coerce)
+ try {
+ payload.value = Boolean(payload.value);
+ } catch (_) {}
+ const input = payload.value;
+ if (typeof input === "boolean")
+ return payload;
+ payload.issues.push({
+ expected: "boolean",
+ code: "invalid_type",
+ input,
+ inst
+ });
+ return payload;
+ };
+});
+var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
+ $ZodType.init(inst, def);
+ inst._zod.parse = (payload) => payload;
+});
+var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
+ $ZodType.init(inst, def);
+ inst._zod.parse = (payload, _ctx) => {
+ payload.issues.push({
+ expected: "never",
+ code: "invalid_type",
+ input: payload.value,
+ inst
+ });
+ return payload;
+ };
+});
+function handleArrayResult(result, final, index) {
+ if (result.issues.length) {
+ final.issues.push(...prefixIssues(index, result.issues));
+ }
+ final.value[index] = result.value;
+}
+var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
+ $ZodType.init(inst, def);
+ inst._zod.parse = (payload, ctx) => {
+ const input = payload.value;
+ if (!Array.isArray(input)) {
+ payload.issues.push({
+ expected: "array",
+ code: "invalid_type",
+ input,
+ inst
+ });
+ return payload;
+ }
+ payload.value = Array(input.length);
+ const proms = [];
+ for (let i = 0;i < input.length; i++) {
+ const item = input[i];
+ const result = def.element._zod.run({
+ value: item,
+ issues: []
+ }, ctx);
+ if (result instanceof Promise) {
+ proms.push(result.then((result) => handleArrayResult(result, payload, i)));
+ } else {
+ handleArrayResult(result, payload, i);
+ }
+ }
+ if (proms.length) {
+ return Promise.all(proms).then(() => payload);
+ }
+ return payload;
+ };
+});
+function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
+ const isPresent = key in input;
+ if (result.issues.length) {
+ if (isOptionalIn && isOptionalOut && !isPresent) {
+ return;
+ }
+ final.issues.push(...prefixIssues(key, result.issues));
+ }
+ if (!isPresent && !isOptionalIn) {
+ if (!result.issues.length) {
+ final.issues.push({
+ code: "invalid_type",
+ expected: "nonoptional",
+ input: undefined,
+ path: [key]
+ });
+ }
+ return;
+ }
+ if (result.value === undefined) {
+ if (isPresent) {
+ final.value[key] = undefined;
+ }
+ } else {
+ final.value[key] = result.value;
+ }
+}
+function normalizeDef(def) {
+ const keys = Object.keys(def.shape);
+ for (const k of keys) {
+ if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
+ throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
+ }
+ }
+ const okeys = optionalKeys(def.shape);
+ return {
+ ...def,
+ keys,
+ keySet: new Set(keys),
+ numKeys: keys.length,
+ optionalKeys: new Set(okeys)
+ };
+}
+function handleCatchall(proms, input, payload, ctx, def, inst) {
+ const unrecognized = [];
+ const keySet = def.keySet;
+ const _catchall = def.catchall._zod;
+ const t = _catchall.def.type;
+ const isOptionalIn = _catchall.optin === "optional";
+ const isOptionalOut = _catchall.optout === "optional";
+ for (const key in input) {
+ if (key === "__proto__")
+ continue;
+ if (keySet.has(key))
+ continue;
+ if (t === "never") {
+ unrecognized.push(key);
+ continue;
+ }
+ const r = _catchall.run({ value: input[key], issues: [] }, ctx);
+ if (r instanceof Promise) {
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
+ } else {
+ handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
+ }
+ }
+ if (unrecognized.length) {
+ payload.issues.push({
+ code: "unrecognized_keys",
+ keys: unrecognized,
+ input,
+ inst
+ });
+ }
+ if (!proms.length)
+ return payload;
+ return Promise.all(proms).then(() => {
+ return payload;
+ });
+}
+var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
+ $ZodType.init(inst, def);
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
+ if (!desc?.get) {
+ const sh = def.shape;
+ Object.defineProperty(def, "shape", {
+ get: () => {
+ const newSh = { ...sh };
+ Object.defineProperty(def, "shape", {
+ value: newSh
+ });
+ return newSh;
+ }
+ });
+ }
+ const _normalized = cached(() => normalizeDef(def));
+ defineLazy(inst._zod, "propValues", () => {
+ const shape = def.shape;
+ const propValues = {};
+ for (const key in shape) {
+ const field = shape[key]._zod;
+ if (field.values) {
+ propValues[key] ?? (propValues[key] = new Set);
+ for (const v of field.values)
+ propValues[key].add(v);
+ }
+ }
+ return propValues;
+ });
+ const isObject2 = isObject;
+ const catchall = def.catchall;
+ let value;
+ inst._zod.parse = (payload, ctx) => {
+ value ?? (value = _normalized.value);
+ const input = payload.value;
+ if (!isObject2(input)) {
+ payload.issues.push({
+ expected: "object",
+ code: "invalid_type",
+ input,
+ inst
+ });
+ return payload;
+ }
+ payload.value = {};
+ const proms = [];
+ const shape = value.shape;
+ for (const key of value.keys) {
+ const el = shape[key];
+ const isOptionalIn = el._zod.optin === "optional";
+ const isOptionalOut = el._zod.optout === "optional";
+ const r = el._zod.run({ value: input[key], issues: [] }, ctx);
+ if (r instanceof Promise) {
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
+ } else {
+ handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
+ }
+ }
+ if (!catchall) {
+ return proms.length ? Promise.all(proms).then(() => payload) : payload;
+ }
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
+ };
+});
+var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
+ $ZodObject.init(inst, def);
+ const superParse = inst._zod.parse;
+ const _normalized = cached(() => normalizeDef(def));
+ const generateFastpass = (shape) => {
+ const doc = new Doc(["shape", "payload", "ctx"]);
+ const normalized = _normalized.value;
+ const parseStr = (key) => {
+ const k = esc(key);
+ return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
+ };
+ doc.write(`const input = payload.value;`);
+ const ids = Object.create(null);
+ let counter = 0;
+ for (const key of normalized.keys) {
+ ids[key] = `key_${counter++}`;
+ }
+ doc.write(`const newResult = {};`);
+ for (const key of normalized.keys) {
+ const id = ids[key];
+ const k = esc(key);
+ const schema = shape[key];
+ const isOptionalIn = schema?._zod?.optin === "optional";
+ const isOptionalOut = schema?._zod?.optout === "optional";
+ doc.write(`const ${id} = ${parseStr(key)};`);
+ if (isOptionalIn && isOptionalOut) {
+ doc.write(`
+ if (${id}.issues.length) {
+ if (${k} in input) {
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
+ ...iss,
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
+ })));
+ }
+ }
+
+ if (${id}.value === undefined) {
+ if (${k} in input) {
+ newResult[${k}] = undefined;
+ }
+ } else {
+ newResult[${k}] = ${id}.value;
+ }
+
+ `);
+ } else if (!isOptionalIn) {
+ doc.write(`
+ const ${id}_present = ${k} in input;
+ if (${id}.issues.length) {
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
+ ...iss,
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
+ })));
+ }
+ if (!${id}_present && !${id}.issues.length) {
+ payload.issues.push({
+ code: "invalid_type",
+ expected: "nonoptional",
+ input: undefined,
+ path: [${k}]
+ });
+ }
+
+ if (${id}_present) {
+ if (${id}.value === undefined) {
+ newResult[${k}] = undefined;
+ } else {
+ newResult[${k}] = ${id}.value;
+ }
+ }
+
+ `);
+ } else {
+ doc.write(`
+ if (${id}.issues.length) {
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
+ ...iss,
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
+ })));
+ }
+
+ if (${id}.value === undefined) {
+ if (${k} in input) {
+ newResult[${k}] = undefined;
+ }
+ } else {
+ newResult[${k}] = ${id}.value;
+ }
+
+ `);
+ }
+ }
+ doc.write(`payload.value = newResult;`);
+ doc.write(`return payload;`);
+ const fn = doc.compile();
+ return (payload, ctx) => fn(shape, payload, ctx);
+ };
+ let fastpass;
+ const isObject2 = isObject;
+ const jit = !globalConfig.jitless;
+ const allowsEval2 = allowsEval;
+ const fastEnabled = jit && allowsEval2.value;
+ const catchall = def.catchall;
+ let value;
+ inst._zod.parse = (payload, ctx) => {
+ value ?? (value = _normalized.value);
+ const input = payload.value;
+ if (!isObject2(input)) {
+ payload.issues.push({
+ expected: "object",
+ code: "invalid_type",
+ input,
+ inst
+ });
+ return payload;
+ }
+ if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
+ if (!fastpass)
+ fastpass = generateFastpass(def.shape);
+ payload = fastpass(payload, ctx);
+ if (!catchall)
+ return payload;
+ return handleCatchall([], input, payload, ctx, value, inst);
+ }
+ return superParse(payload, ctx);
+ };
+});
+function handleUnionResults(results, final, inst, ctx) {
+ for (const result of results) {
+ if (result.issues.length === 0) {
+ final.value = result.value;
+ return final;
+ }
+ }
+ const nonaborted = results.filter((r) => !aborted(r));
+ if (nonaborted.length === 1) {
+ final.value = nonaborted[0].value;
+ return nonaborted[0];
+ }
+ final.issues.push({
+ code: "invalid_union",
+ input: final.value,
+ inst,
+ errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
+ });
+ return final;
+}
+var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
+ $ZodType.init(inst, def);
+ defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : undefined);
+ defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined);
+ defineLazy(inst._zod, "values", () => {
+ if (def.options.every((o) => o._zod.values)) {
+ return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
+ }
+ return;
+ });
+ defineLazy(inst._zod, "pattern", () => {
+ if (def.options.every((o) => o._zod.pattern)) {
+ const patterns = def.options.map((o) => o._zod.pattern);
+ return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
+ }
+ return;
+ });
+ const first = def.options.length === 1 ? def.options[0]._zod.run : null;
+ inst._zod.parse = (payload, ctx) => {
+ if (first) {
+ return first(payload, ctx);
+ }
+ let async = false;
+ const results = [];
+ for (const option of def.options) {
+ const result = option._zod.run({
+ value: payload.value,
+ issues: []
+ }, ctx);
+ if (result instanceof Promise) {
+ results.push(result);
+ async = true;
+ } else {
+ if (result.issues.length === 0)
+ return result;
+ results.push(result);
+ }
+ }
+ if (!async)
+ return handleUnionResults(results, payload, inst, ctx);
+ return Promise.all(results).then((results) => {
+ return handleUnionResults(results, payload, inst, ctx);
+ });
+ };
+});
+var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
+ def.inclusive = false;
+ $ZodUnion.init(inst, def);
+ const _super = inst._zod.parse;
+ defineLazy(inst._zod, "propValues", () => {
+ const propValues = {};
+ for (const option of def.options) {
+ const pv = option._zod.propValues;
+ if (!pv || Object.keys(pv).length === 0)
+ throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
+ for (const [k, v] of Object.entries(pv)) {
+ if (!propValues[k])
+ propValues[k] = new Set;
+ for (const val of v) {
+ propValues[k].add(val);
+ }
+ }
+ }
+ return propValues;
+ });
+ const disc = cached(() => {
+ const opts = def.options;
+ const map = new Map;
+ for (const o of opts) {
+ const values = o._zod.propValues?.[def.discriminator];
+ if (!values || values.size === 0)
+ throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
+ for (const v of values) {
+ if (map.has(v)) {
+ throw new Error(`Duplicate discriminator value "${String(v)}"`);
+ }
+ map.set(v, o);
+ }
+ }
+ return map;
+ });
+ inst._zod.parse = (payload, ctx) => {
+ const input = payload.value;
+ if (!isObject(input)) {
+ payload.issues.push({
+ code: "invalid_type",
+ expected: "object",
+ input,
+ inst
+ });
+ return payload;
+ }
+ const opt = disc.value.get(input?.[def.discriminator]);
+ if (opt) {
+ return opt._zod.run(payload, ctx);
+ }
+ if (def.unionFallback || ctx.direction === "backward") {
+ return _super(payload, ctx);
+ }
+ payload.issues.push({
+ code: "invalid_union",
+ errors: [],
+ note: "No matching discriminator",
+ discriminator: def.discriminator,
+ options: Array.from(disc.value.keys()),
+ input,
+ path: [def.discriminator],
+ inst
+ });
+ return payload;
+ };
+});
+var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
+ $ZodType.init(inst, def);
+ inst._zod.parse = (payload, ctx) => {
+ const input = payload.value;
+ const left = def.left._zod.run({ value: input, issues: [] }, ctx);
+ const right = def.right._zod.run({ value: input, issues: [] }, ctx);
+ const async = left instanceof Promise || right instanceof Promise;
+ if (async) {
+ return Promise.all([left, right]).then(([left, right]) => {
+ return handleIntersectionResults(payload, left, right);
+ });
+ }
+ return handleIntersectionResults(payload, left, right);
+ };
+});
+function mergeValues(a, b) {
+ if (a === b) {
+ return { valid: true, data: a };
+ }
+ if (a instanceof Date && b instanceof Date && +a === +b) {
+ return { valid: true, data: a };
+ }
+ if (isPlainObject(a) && isPlainObject(b)) {
+ const bKeys = Object.keys(b);
+ const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
+ const newObj = { ...a, ...b };
+ for (const key of sharedKeys) {
+ const sharedValue = mergeValues(a[key], b[key]);
+ if (!sharedValue.valid) {
+ return {
+ valid: false,
+ mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
+ };
+ }
+ newObj[key] = sharedValue.data;
+ }
+ return { valid: true, data: newObj };
+ }
+ if (Array.isArray(a) && Array.isArray(b)) {
+ if (a.length !== b.length) {
+ return { valid: false, mergeErrorPath: [] };
+ }
+ const newArray = [];
+ for (let index = 0;index < a.length; index++) {
+ const itemA = a[index];
+ const itemB = b[index];
+ const sharedValue = mergeValues(itemA, itemB);
+ if (!sharedValue.valid) {
+ return {
+ valid: false,
+ mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
+ };
+ }
+ newArray.push(sharedValue.data);
+ }
+ return { valid: true, data: newArray };
+ }
+ return { valid: false, mergeErrorPath: [] };
+}
+function handleIntersectionResults(result, left, right) {
+ const unrecKeys = new Map;
+ let unrecIssue;
+ for (const iss of left.issues) {
+ if (iss.code === "unrecognized_keys") {
+ unrecIssue ?? (unrecIssue = iss);
+ for (const k of iss.keys) {
+ if (!unrecKeys.has(k))
+ unrecKeys.set(k, {});
+ unrecKeys.get(k).l = true;
+ }
+ } else {
+ result.issues.push(iss);
+ }
+ }
+ for (const iss of right.issues) {
+ if (iss.code === "unrecognized_keys") {
+ for (const k of iss.keys) {
+ if (!unrecKeys.has(k))
+ unrecKeys.set(k, {});
+ unrecKeys.get(k).r = true;
+ }
+ } else {
+ result.issues.push(iss);
+ }
+ }
+ const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
+ if (bothKeys.length && unrecIssue) {
+ result.issues.push({ ...unrecIssue, keys: bothKeys });
+ }
+ if (aborted(result))
+ return result;
+ const merged = mergeValues(left.value, right.value);
+ if (!merged.valid) {
+ throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
+ }
+ result.value = merged.data;
+ return result;
+}
+var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
+ $ZodType.init(inst, def);
+ inst._zod.parse = (payload, ctx) => {
+ const input = payload.value;
+ if (!isPlainObject(input)) {
+ payload.issues.push({
+ expected: "record",
+ code: "invalid_type",
+ input,
+ inst
+ });
+ return payload;
+ }
+ const proms = [];
+ const values = def.keyType._zod.values;
+ if (values) {
+ payload.value = {};
+ const recordKeys = new Set;
+ for (const key of values) {
+ if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
+ recordKeys.add(typeof key === "number" ? key.toString() : key);
+ const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
+ if (keyResult instanceof Promise) {
+ throw new Error("Async schemas not supported in object keys currently");
+ }
+ if (keyResult.issues.length) {
+ payload.issues.push({
+ code: "invalid_key",
+ origin: "record",
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
+ input: key,
+ path: [key],
+ inst
+ });
+ continue;
+ }
+ const outKey = keyResult.value;
+ const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
+ if (result instanceof Promise) {
+ proms.push(result.then((result) => {
+ if (result.issues.length) {
+ payload.issues.push(...prefixIssues(key, result.issues));
+ }
+ payload.value[outKey] = result.value;
+ }));
+ } else {
+ if (result.issues.length) {
+ payload.issues.push(...prefixIssues(key, result.issues));
+ }
+ payload.value[outKey] = result.value;
+ }
+ }
+ }
+ let unrecognized;
+ for (const key in input) {
+ if (!recordKeys.has(key)) {
+ unrecognized = unrecognized ?? [];
+ unrecognized.push(key);
+ }
+ }
+ if (unrecognized && unrecognized.length > 0) {
+ payload.issues.push({
+ code: "unrecognized_keys",
+ input,
+ inst,
+ keys: unrecognized
+ });
+ }
+ } else {
+ payload.value = {};
+ for (const key of Reflect.ownKeys(input)) {
+ if (key === "__proto__")
+ continue;
+ if (!Object.prototype.propertyIsEnumerable.call(input, key))
+ continue;
+ let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
+ if (keyResult instanceof Promise) {
+ throw new Error("Async schemas not supported in object keys currently");
+ }
+ const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
+ if (checkNumericKey) {
+ const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
+ if (retryResult instanceof Promise) {
+ throw new Error("Async schemas not supported in object keys currently");
+ }
+ if (retryResult.issues.length === 0) {
+ keyResult = retryResult;
+ }
+ }
+ if (keyResult.issues.length) {
+ if (def.mode === "loose") {
+ payload.value[key] = input[key];
+ } else {
+ payload.issues.push({
+ code: "invalid_key",
+ origin: "record",
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
+ input: key,
+ path: [key],
+ inst
+ });
+ }
+ continue;
+ }
+ const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
+ if (result instanceof Promise) {
+ proms.push(result.then((result) => {
+ if (result.issues.length) {
+ payload.issues.push(...prefixIssues(key, result.issues));
+ }
+ payload.value[keyResult.value] = result.value;
+ }));
+ } else {
+ if (result.issues.length) {
+ payload.issues.push(...prefixIssues(key, result.issues));
+ }
+ payload.value[keyResult.value] = result.value;
+ }
+ }
+ }
+ if (proms.length) {
+ return Promise.all(proms).then(() => payload);
+ }
+ return payload;
+ };
+});
+var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
+ $ZodType.init(inst, def);
+ const values = getEnumValues(def.entries);
+ const valuesSet = new Set(values);
+ inst._zod.values = valuesSet;
+ inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
+ inst._zod.parse = (payload, _ctx) => {
+ const input = payload.value;
+ if (valuesSet.has(input)) {
+ return payload;
+ }
+ payload.issues.push({
+ code: "invalid_value",
+ values,
+ input,
+ inst
+ });
+ return payload;
+ };
+});
+var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
+ $ZodType.init(inst, def);
+ if (def.values.length === 0) {
+ throw new Error("Cannot create literal schema with no valid values");
+ }
+ const values = new Set(def.values);
+ inst._zod.values = values;
+ inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
+ inst._zod.parse = (payload, _ctx) => {
+ const input = payload.value;
+ if (values.has(input)) {
+ return payload;
+ }
+ payload.issues.push({
+ code: "invalid_value",
+ values: def.values,
+ input,
+ inst
+ });
+ return payload;
+ };
+});
+var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
+ $ZodType.init(inst, def);
+ inst._zod.optin = "optional";
+ inst._zod.parse = (payload, ctx) => {
+ if (ctx.direction === "backward") {
+ throw new $ZodEncodeError(inst.constructor.name);
+ }
+ const _out = def.transform(payload.value, payload);
+ if (ctx.async) {
+ const output = _out instanceof Promise ? _out : Promise.resolve(_out);
+ return output.then((output) => {
+ payload.value = output;
+ payload.fallback = true;
+ return payload;
+ });
+ }
+ if (_out instanceof Promise) {
+ throw new $ZodAsyncError;
+ }
+ payload.value = _out;
+ payload.fallback = true;
+ return payload;
+ };
+});
+function handleOptionalResult(result, input) {
+ if (input === undefined && (result.issues.length || result.fallback)) {
+ return { issues: [], value: undefined };
+ }
+ return result;
+}
+var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
+ $ZodType.init(inst, def);
+ inst._zod.optin = "optional";
+ inst._zod.optout = "optional";
+ defineLazy(inst._zod, "values", () => {
+ return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;
+ });
+ defineLazy(inst._zod, "pattern", () => {
+ const pattern = def.innerType._zod.pattern;
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : undefined;
+ });
+ inst._zod.parse = (payload, ctx) => {
+ if (def.innerType._zod.optin === "optional") {
+ const input = payload.value;
+ const result = def.innerType._zod.run(payload, ctx);
+ if (result instanceof Promise)
+ return result.then((r) => handleOptionalResult(r, input));
+ return handleOptionalResult(result, input);
+ }
+ if (payload.value === undefined) {
+ return payload;
+ }
+ return def.innerType._zod.run(payload, ctx);
+ };
+});
+var $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
+ $ZodOptional.init(inst, def);
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
+ defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
+ inst._zod.parse = (payload, ctx) => {
+ return def.innerType._zod.run(payload, ctx);
+ };
+});
+var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
+ $ZodType.init(inst, def);
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
+ defineLazy(inst._zod, "pattern", () => {
+ const pattern = def.innerType._zod.pattern;
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : undefined;
+ });
+ defineLazy(inst._zod, "values", () => {
+ return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
+ });
+ inst._zod.parse = (payload, ctx) => {
+ if (payload.value === null)
+ return payload;
+ return def.innerType._zod.run(payload, ctx);
+ };
+});
+var $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
+ $ZodType.init(inst, def);
+ inst._zod.optin = "optional";
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
+ inst._zod.parse = (payload, ctx) => {
+ if (ctx.direction === "backward") {
+ return def.innerType._zod.run(payload, ctx);
+ }
+ if (payload.value === undefined) {
+ payload.value = def.defaultValue;
+ return payload;
+ }
+ const result = def.innerType._zod.run(payload, ctx);
+ if (result instanceof Promise) {
+ return result.then((result) => handleDefaultResult(result, def));
+ }
+ return handleDefaultResult(result, def);
+ };
+});
+function handleDefaultResult(payload, def) {
+ if (payload.value === undefined) {
+ payload.value = def.defaultValue;
+ }
+ return payload;
+}
+var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
+ $ZodType.init(inst, def);
+ inst._zod.optin = "optional";
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
+ inst._zod.parse = (payload, ctx) => {
+ if (ctx.direction === "backward") {
+ return def.innerType._zod.run(payload, ctx);
+ }
+ if (payload.value === undefined) {
+ payload.value = def.defaultValue;
+ }
+ return def.innerType._zod.run(payload, ctx);
+ };
+});
+var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
+ $ZodType.init(inst, def);
+ defineLazy(inst._zod, "values", () => {
+ const v = def.innerType._zod.values;
+ return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
+ });
+ inst._zod.parse = (payload, ctx) => {
+ const result = def.innerType._zod.run(payload, ctx);
+ if (result instanceof Promise) {
+ return result.then((result) => handleNonOptionalResult(result, inst));
+ }
+ return handleNonOptionalResult(result, inst);
+ };
+});
+function handleNonOptionalResult(payload, inst) {
+ if (!payload.issues.length && payload.value === undefined) {
+ payload.issues.push({
+ code: "invalid_type",
+ expected: "nonoptional",
+ input: payload.value,
+ inst
+ });
+ }
+ return payload;
+}
+var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
+ $ZodType.init(inst, def);
+ inst._zod.optin = "optional";
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
+ inst._zod.parse = (payload, ctx) => {
+ if (ctx.direction === "backward") {
+ return def.innerType._zod.run(payload, ctx);
+ }
+ const result = def.innerType._zod.run(payload, ctx);
+ if (result instanceof Promise) {
+ return result.then((result) => {
+ payload.value = result.value;
+ if (result.issues.length) {
+ payload.value = def.catchValue({
+ ...payload,
+ error: {
+ issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
+ },
+ input: payload.value
+ });
+ payload.issues = [];
+ payload.fallback = true;
+ }
+ return payload;
+ });
+ }
+ payload.value = result.value;
+ if (result.issues.length) {
+ payload.value = def.catchValue({
+ ...payload,
+ error: {
+ issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
+ },
+ input: payload.value
+ });
+ payload.issues = [];
+ payload.fallback = true;
+ }
+ return payload;
+ };
+});
+var $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
+ $ZodType.init(inst, def);
+ defineLazy(inst._zod, "values", () => def.in._zod.values);
+ defineLazy(inst._zod, "optin", () => def.in._zod.optin);
+ defineLazy(inst._zod, "optout", () => def.out._zod.optout);
+ defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
+ inst._zod.parse = (payload, ctx) => {
+ if (ctx.direction === "backward") {
+ const right = def.out._zod.run(payload, ctx);
+ if (right instanceof Promise) {
+ return right.then((right) => handlePipeResult(right, def.in, ctx));
+ }
+ return handlePipeResult(right, def.in, ctx);
+ }
+ const left = def.in._zod.run(payload, ctx);
+ if (left instanceof Promise) {
+ return left.then((left) => handlePipeResult(left, def.out, ctx));
+ }
+ return handlePipeResult(left, def.out, ctx);
+ };
+});
+function handlePipeResult(left, next, ctx) {
+ if (left.issues.length) {
+ left.aborted = true;
+ return left;
+ }
+ return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);
+}
+var $ZodPreprocess = /* @__PURE__ */ $constructor("$ZodPreprocess", (inst, def) => {
+ $ZodPipe.init(inst, def);
+});
+var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
+ $ZodType.init(inst, def);
+ defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
+ defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
+ defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
+ inst._zod.parse = (payload, ctx) => {
+ if (ctx.direction === "backward") {
+ return def.innerType._zod.run(payload, ctx);
+ }
+ const result = def.innerType._zod.run(payload, ctx);
+ if (result instanceof Promise) {
+ return result.then(handleReadonlyResult);
+ }
+ return handleReadonlyResult(result);
+ };
+});
+function handleReadonlyResult(payload) {
+ payload.value = Object.freeze(payload.value);
+ return payload;
+}
+var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
+ $ZodCheck.init(inst, def);
+ $ZodType.init(inst, def);
+ inst._zod.parse = (payload, _) => {
+ return payload;
+ };
+ inst._zod.check = (payload) => {
+ const input = payload.value;
+ const r = def.fn(input);
+ if (r instanceof Promise) {
+ return r.then((r) => handleRefineResult(r, payload, input, inst));
+ }
+ handleRefineResult(r, payload, input, inst);
+ return;
+ };
+});
+function handleRefineResult(result, payload, input, inst) {
+ if (!result) {
+ const _iss = {
+ code: "custom",
+ input,
+ inst,
+ path: [...inst._zod.def.path ?? []],
+ continue: !inst._zod.def.abort
+ };
+ if (inst._zod.def.params)
+ _iss.params = inst._zod.def.params;
+ payload.issues.push(issue(_iss));
+ }
+}
+// ../../../node_modules/.bun/[email protected]/node_modules/zod/v4/core/registries.js
+var _a2;
+var $output = Symbol("ZodOutput");
+var $input = Symbol("ZodInput");
+
+class $ZodRegistry {
+ constructor() {
+ this._map = new WeakMap;
+ this._idmap = new Map;
+ }
+ add(schema, ..._meta) {
+ const meta = _meta[0];
+ this._map.set(schema, meta);
+ if (meta && typeof meta === "object" && "id" in meta) {
+ this._idmap.set(meta.id, schema);
+ }
+ return this;
+ }
+ clear() {
+ this._map = new WeakMap;
+ this._idmap = new Map;
+ return this;
+ }
+ remove(schema) {
+ const meta = this._map.get(schema);
+ if (meta && typeof meta === "object" && "id" in meta) {
+ this._idmap.delete(meta.id);
+ }
+ this._map.delete(schema);
+ return this;
+ }
+ get(schema) {
+ const p = schema._zod.parent;
+ if (p) {
+ const pm = { ...this.get(p) ?? {} };
+ delete pm.id;
+ const f = { ...pm, ...this._map.get(schema) };
+ return Object.keys(f).length ? f : undefined;
+ }
+ return this._map.get(schema);
+ }
+ has(schema) {
+ return this._map.has(schema);
+ }
+}
+function registry() {
+ return new $ZodRegistry;
+}
+(_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
+var globalRegistry = globalThis.__zod_globalRegistry;
+// ../../../node_modules/.bun/[email protected]/node_modules/zod/v4/core/api.js
+function _string(Class, params) {
+ return new Class({
+ type: "string",
+ ...normalizeParams(params)
+ });
+}
+function _email(Class, params) {
+ return new Class({
+ type: "string",
+ format: "email",
+ check: "string_format",
+ abort: false,
+ ...normalizeParams(params)
+ });
+}
+function _guid(Class, params) {
+ return new Class({
+ type: "string",
+ format: "guid",
+ check: "string_format",
+ abort: false,
+ ...normalizeParams(params)
+ });
+}
+function _uuid(Class, params) {
+ return new Class({
+ type: "string",
+ format: "uuid",
+ check: "string_format",
+ abort: false,
+ ...normalizeParams(params)
+ });
+}
+function _uuidv4(Class, params) {
+ return new Class({
+ type: "string",
+ format: "uuid",
+ check: "string_format",
+ abort: false,
+ version: "v4",
+ ...normalizeParams(params)
+ });
+}
+function _uuidv6(Class, params) {
+ return new Class({
+ type: "string",
+ format: "uuid",
+ check: "string_format",
+ abort: false,
+ version: "v6",
+ ...normalizeParams(params)
+ });
+}
+function _uuidv7(Class, params) {
+ return new Class({
+ type: "string",
+ format: "uuid",
+ check: "string_format",
+ abort: false,
+ version: "v7",
+ ...normalizeParams(params)
+ });
+}
+function _url(Class, params) {
+ return new Class({
+ type: "string",
+ format: "url",
+ check: "string_format",
+ abort: false,
+ ...normalizeParams(params)
+ });
+}
+function _emoji2(Class, params) {
+ return new Class({
+ type: "string",
+ format: "emoji",
+ check: "string_format",
+ abort: false,
+ ...normalizeParams(params)
+ });
+}
+function _nanoid(Class, params) {
+ return new Class({
+ type: "string",
+ format: "nanoid",
+ check: "string_format",
+ abort: false,
+ ...normalizeParams(params)
+ });
+}
+function _cuid(Class, params) {
+ return new Class({
+ type: "string",
+ format: "cuid",
+ check: "string_format",
+ abort: false,
+ ...normalizeParams(params)
+ });
+}
+function _cuid2(Class, params) {
+ return new Class({
+ type: "string",
+ format: "cuid2",
+ check: "string_format",
+ abort: false,
+ ...normalizeParams(params)
+ });
+}
+function _ulid(Class, params) {
+ return new Class({
+ type: "string",
+ format: "ulid",
+ check: "string_format",
+ abort: false,
+ ...normalizeParams(params)
+ });
+}
+function _xid(Class, params) {
+ return new Class({
+ type: "string",
+ format: "xid",
+ check: "string_format",
+ abort: false,
+ ...normalizeParams(params)
+ });
+}
+function _ksuid(Class, params) {
+ return new Class({
+ type: "string",
+ format: "ksuid",
+ check: "string_format",
+ abort: false,
+ ...normalizeParams(params)
+ });
+}
+function _ipv4(Class, params) {
+ return new Class({
+ type: "string",
+ format: "ipv4",
+ check: "string_format",
+ abort: false,
+ ...normalizeParams(params)
+ });
+}
+function _ipv6(Class, params) {
+ return new Class({
+ type: "string",
+ format: "ipv6",
+ check: "string_format",
+ abort: false,
+ ...normalizeParams(params)
+ });
+}
+function _cidrv4(Class, params) {
+ return new Class({
+ type: "string",
+ format: "cidrv4",
+ check: "string_format",
+ abort: false,
+ ...normalizeParams(params)
+ });
+}
+function _cidrv6(Class, params) {
+ return new Class({
+ type: "string",
+ format: "cidrv6",
+ check: "string_format",
+ abort: false,
+ ...normalizeParams(params)
+ });
+}
+function _base64(Class, params) {
+ return new Class({
+ type: "string",
+ format: "base64",
+ check: "string_format",
+ abort: false,
+ ...normalizeParams(params)
+ });
+}
+function _base64url(Class, params) {
+ return new Class({
+ type: "string",
+ format: "base64url",
+ check: "string_format",
+ abort: false,
+ ...normalizeParams(params)
+ });
+}
+function _e164(Class, params) {
+ return new Class({
+ type: "string",
+ format: "e164",
+ check: "string_format",
+ abort: false,
+ ...normalizeParams(params)
+ });
+}
+function _jwt(Class, params) {
+ return new Class({
+ type: "string",
+ format: "jwt",
+ check: "string_format",
+ abort: false,
+ ...normalizeParams(params)
+ });
+}
+function _isoDateTime(Class, params) {
+ return new Class({
+ type: "string",
+ format: "datetime",
+ check: "string_format",
+ offset: false,
+ local: false,
+ precision: null,
+ ...normalizeParams(params)
+ });
+}
+function _isoDate(Class, params) {
+ return new Class({
+ type: "string",
+ format: "date",
+ check: "string_format",
+ ...normalizeParams(params)
+ });
+}
+function _isoTime(Class, params) {
+ return new Class({
+ type: "string",
+ format: "time",
+ check: "string_format",
+ precision: null,
+ ...normalizeParams(params)
+ });
+}
+function _isoDuration(Class, params) {
+ return new Class({
+ type: "string",
+ format: "duration",
+ check: "string_format",
+ ...normalizeParams(params)
+ });
+}
+function _number(Class, params) {
+ return new Class({
+ type: "number",
+ checks: [],
+ ...normalizeParams(params)
+ });
+}
+function _int(Class, params) {
+ return new Class({
+ type: "number",
+ check: "number_format",
+ abort: false,
+ format: "safeint",
+ ...normalizeParams(params)
+ });
+}
+function _boolean(Class, params) {
+ return new Class({
+ type: "boolean",
+ ...normalizeParams(params)
+ });
+}
+function _unknown(Class) {
+ return new Class({
+ type: "unknown"
+ });
+}
+function _never(Class, params) {
+ return new Class({
+ type: "never",
+ ...normalizeParams(params)
+ });
+}
+function _lt(value, params) {
+ return new $ZodCheckLessThan({
+ check: "less_than",
+ ...normalizeParams(params),
+ value,
+ inclusive: false
+ });
+}
+function _lte(value, params) {
+ return new $ZodCheckLessThan({
+ check: "less_than",
+ ...normalizeParams(params),
+ value,
+ inclusive: true
+ });
+}
+function _gt(value, params) {
+ return new $ZodCheckGreaterThan({
+ check: "greater_than",
+ ...normalizeParams(params),
+ value,
+ inclusive: false
+ });
+}
+function _gte(value, params) {
+ return new $ZodCheckGreaterThan({
+ check: "greater_than",
+ ...normalizeParams(params),
+ value,
+ inclusive: true
+ });
+}
+function _multipleOf(value, params) {
+ return new $ZodCheckMultipleOf({
+ check: "multiple_of",
+ ...normalizeParams(params),
+ value
+ });
+}
+function _maxLength(maximum, params) {
+ const ch = new $ZodCheckMaxLength({
+ check: "max_length",
+ ...normalizeParams(params),
+ maximum
+ });
+ return ch;
+}
+function _minLength(minimum, params) {
+ return new $ZodCheckMinLength({
+ check: "min_length",
+ ...normalizeParams(params),
+ minimum
+ });
+}
+function _length(length, params) {
+ return new $ZodCheckLengthEquals({
+ check: "length_equals",
+ ...normalizeParams(params),
+ length
+ });
+}
+function _regex(pattern, params) {
+ return new $ZodCheckRegex({
+ check: "string_format",
+ format: "regex",
+ ...normalizeParams(params),
+ pattern
+ });
+}
+function _lowercase(params) {
+ return new $ZodCheckLowerCase({
+ check: "string_format",
+ format: "lowercase",
+ ...normalizeParams(params)
+ });
+}
+function _uppercase(params) {
+ return new $ZodCheckUpperCase({
+ check: "string_format",
+ format: "uppercase",
+ ...normalizeParams(params)
+ });
+}
+function _includes(includes, params) {
+ return new $ZodCheckIncludes({
+ check: "string_format",
+ format: "includes",
+ ...normalizeParams(params),
+ includes
+ });
+}
+function _startsWith(prefix, params) {
+ return new $ZodCheckStartsWith({
+ check: "string_format",
+ format: "starts_with",
+ ...normalizeParams(params),
+ prefix
+ });
+}
+function _endsWith(suffix, params) {
+ return new $ZodCheckEndsWith({
+ check: "string_format",
+ format: "ends_with",
+ ...normalizeParams(params),
+ suffix
+ });
+}
+function _overwrite(tx) {
+ return new $ZodCheckOverwrite({
+ check: "overwrite",
+ tx
+ });
+}
+function _normalize(form) {
+ return _overwrite((input) => input.normalize(form));
+}
+function _trim() {
+ return _overwrite((input) => input.trim());
+}
+function _toLowerCase() {
+ return _overwrite((input) => input.toLowerCase());
+}
+function _toUpperCase() {
+ return _overwrite((input) => input.toUpperCase());
+}
+function _slugify() {
+ return _overwrite((input) => slugify(input));
+}
+function _array(Class, element, params) {
+ return new Class({
+ type: "array",
+ element,
+ ...normalizeParams(params)
+ });
+}
+function _refine(Class, fn, _params) {
+ const schema = new Class({
+ type: "custom",
+ check: "custom",
+ fn,
+ ...normalizeParams(_params)
+ });
+ return schema;
+}
+function _superRefine(fn, params) {
+ const ch = _check((payload) => {
+ payload.addIssue = (issue2) => {
+ if (typeof issue2 === "string") {
+ payload.issues.push(issue(issue2, payload.value, ch._zod.def));
+ } else {
+ const _issue = issue2;
+ if (_issue.fatal)
+ _issue.continue = false;
+ _issue.code ?? (_issue.code = "custom");
+ _issue.input ?? (_issue.input = payload.value);
+ _issue.inst ?? (_issue.inst = ch);
+ _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
+ payload.issues.push(issue(_issue));
+ }
+ };
+ return fn(payload.value, payload);
+ }, params);
+ return ch;
+}
+function _check(fn, params) {
+ const ch = new $ZodCheck({
+ check: "custom",
+ ...normalizeParams(params)
+ });
+ ch._zod.check = fn;
+ return ch;
+}
+// ../../../node_modules/.bun/[email protected]/node_modules/zod/v4/core/to-json-schema.js
+function initializeContext(params) {
+ let target = params?.target ?? "draft-2020-12";
+ if (target === "draft-4")
+ target = "draft-04";
+ if (target === "draft-7")
+ target = "draft-07";
+ return {
+ processors: params.processors ?? {},
+ metadataRegistry: params?.metadata ?? globalRegistry,
+ target,
+ unrepresentable: params?.unrepresentable ?? "throw",
+ override: params?.override ?? (() => {}),
+ io: params?.io ?? "output",
+ counter: 0,
+ seen: new Map,
+ cycles: params?.cycles ?? "ref",
+ reused: params?.reused ?? "inline",
+ external: params?.external ?? undefined
+ };
+}
+function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
+ var _a;
+ const def = schema._zod.def;
+ const seen = ctx.seen.get(schema);
+ if (seen) {
+ seen.count++;
+ const isCycle = _params.schemaPath.includes(schema);
+ if (isCycle) {
+ seen.cycle = _params.path;
+ }
+ return seen.schema;
+ }
+ const result = { schema: {}, count: 1, cycle: undefined, path: _params.path };
+ ctx.seen.set(schema, result);
+ const overrideSchema = schema._zod.toJSONSchema?.();
+ if (overrideSchema) {
+ result.schema = overrideSchema;
+ } else {
+ const params = {
+ ..._params,
+ schemaPath: [..._params.schemaPath, schema],
+ path: _params.path
+ };
+ if (schema._zod.processJSONSchema) {
+ schema._zod.processJSONSchema(ctx, result.schema, params);
+ } else {
+ const _json = result.schema;
+ const processor = ctx.processors[def.type];
+ if (!processor) {
+ throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
+ }
+ processor(schema, ctx, _json, params);
+ }
+ const parent = schema._zod.parent;
+ if (parent) {
+ if (!result.ref)
+ result.ref = parent;
+ process2(parent, ctx, params);
+ ctx.seen.get(parent).isParent = true;
+ }
+ }
+ const meta = ctx.metadataRegistry.get(schema);
+ if (meta)
+ Object.assign(result.schema, meta);
+ if (ctx.io === "input" && isTransforming(schema)) {
+ delete result.schema.examples;
+ delete result.schema.default;
+ }
+ if (ctx.io === "input" && "_prefault" in result.schema)
+ (_a = result.schema).default ?? (_a.default = result.schema._prefault);
+ delete result.schema._prefault;
+ const _result = ctx.seen.get(schema);
+ return _result.schema;
+}
+function extractDefs(ctx, schema) {
+ const root = ctx.seen.get(schema);
+ if (!root)
+ throw new Error("Unprocessed schema. This is a bug in Zod.");
+ const idToSchema = new Map;
+ for (const entry of ctx.seen.entries()) {
+ const id = ctx.metadataRegistry.get(entry[0])?.id;
+ if (id) {
+ const existing = idToSchema.get(id);
+ if (existing && existing !== entry[0]) {
+ throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
+ }
+ idToSchema.set(id, entry[0]);
+ }
+ }
+ const makeURI = (entry) => {
+ const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
+ if (ctx.external) {
+ const externalId = ctx.external.registry.get(entry[0])?.id;
+ const uriGenerator = ctx.external.uri ?? ((id) => id);
+ if (externalId) {
+ return { ref: uriGenerator(externalId) };
+ }
+ const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
+ entry[1].defId = id;
+ return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
+ }
+ if (entry[1] === root) {
+ return { ref: "#" };
+ }
+ const uriPrefix = `#`;
+ const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
+ const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
+ return { defId, ref: defUriPrefix + defId };
+ };
+ const extractToDef = (entry) => {
+ if (entry[1].schema.$ref) {
+ return;
+ }
+ const seen = entry[1];
+ const { ref, defId } = makeURI(entry);
+ seen.def = { ...seen.schema };
+ if (defId)
+ seen.defId = defId;
+ const schema = seen.schema;
+ for (const key in schema) {
+ delete schema[key];
+ }
+ schema.$ref = ref;
+ };
+ if (ctx.cycles === "throw") {
+ for (const entry of ctx.seen.entries()) {
+ const seen = entry[1];
+ if (seen.cycle) {
+ throw new Error("Cycle detected: " + `#/${seen.cycle?.join("/")}/<root>` + '\n\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.');
+ }
+ }
+ }
+ for (const entry of ctx.seen.entries()) {
+ const seen = entry[1];
+ if (schema === entry[0]) {
+ extractToDef(entry);
+ continue;
+ }
+ if (ctx.external) {
+ const ext = ctx.external.registry.get(entry[0])?.id;
+ if (schema !== entry[0] && ext) {
+ extractToDef(entry);
+ continue;
+ }
+ }
+ const id = ctx.metadataRegistry.get(entry[0])?.id;
+ if (id) {
+ extractToDef(entry);
+ continue;
+ }
+ if (seen.cycle) {
+ extractToDef(entry);
+ continue;
+ }
+ if (seen.count > 1) {
+ if (ctx.reused === "ref") {
+ extractToDef(entry);
+ continue;
+ }
+ }
+ }
+}
+function finalize(ctx, schema) {
+ const root = ctx.seen.get(schema);
+ if (!root)
+ throw new Error("Unprocessed schema. This is a bug in Zod.");
+ const flattenRef = (zodSchema) => {
+ const seen = ctx.seen.get(zodSchema);
+ if (seen.ref === null)
+ return;
+ const schema = seen.def ?? seen.schema;
+ const _cached = { ...schema };
+ const ref = seen.ref;
+ seen.ref = null;
+ if (ref) {
+ flattenRef(ref);
+ const refSeen = ctx.seen.get(ref);
+ const refSchema = refSeen.schema;
+ if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
+ schema.allOf = schema.allOf ?? [];
+ schema.allOf.push(refSchema);
+ } else {
+ Object.assign(schema, refSchema);
+ }
+ Object.assign(schema, _cached);
+ const isParentRef = zodSchema._zod.parent === ref;
+ if (isParentRef) {
+ for (const key in schema) {
+ if (key === "$ref" || key === "allOf")
+ continue;
+ if (!(key in _cached)) {
+ delete schema[key];
+ }
+ }
+ }
+ if (refSchema.$ref && refSeen.def) {
+ for (const key in schema) {
+ if (key === "$ref" || key === "allOf")
+ continue;
+ if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) {
+ delete schema[key];
+ }
+ }
+ }
+ }
+ const parent = zodSchema._zod.parent;
+ if (parent && parent !== ref) {
+ flattenRef(parent);
+ const parentSeen = ctx.seen.get(parent);
+ if (parentSeen?.schema.$ref) {
+ schema.$ref = parentSeen.schema.$ref;
+ if (parentSeen.def) {
+ for (const key in schema) {
+ if (key === "$ref" || key === "allOf")
+ continue;
+ if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) {
+ delete schema[key];
+ }
+ }
+ }
+ }
+ }
+ ctx.override({
+ zodSchema,
+ jsonSchema: schema,
+ path: seen.path ?? []
+ });
+ };
+ for (const entry of [...ctx.seen.entries()].reverse()) {
+ flattenRef(entry[0]);
+ }
+ const result = {};
+ if (ctx.target === "draft-2020-12") {
+ result.$schema = "https://json-schema.org/draft/2020-12/schema";
+ } else if (ctx.target === "draft-07") {
+ result.$schema = "http://json-schema.org/draft-07/schema#";
+ } else if (ctx.target === "draft-04") {
+ result.$schema = "http://json-schema.org/draft-04/schema#";
+ } else if (ctx.target === "openapi-3.0") {}
+ if (ctx.external?.uri) {
+ const id = ctx.external.registry.get(schema)?.id;
+ if (!id)
+ throw new Error("Schema is missing an `id` property");
+ result.$id = ctx.external.uri(id);
+ }
+ Object.assign(result, root.def ?? root.schema);
+ const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
+ if (rootMetaId !== undefined && result.id === rootMetaId)
+ delete result.id;
+ const defs = ctx.external?.defs ?? {};
+ for (const entry of ctx.seen.entries()) {
+ const seen = entry[1];
+ if (seen.def && seen.defId) {
+ if (seen.def.id === seen.defId)
+ delete seen.def.id;
+ defs[seen.defId] = seen.def;
+ }
+ }
+ if (ctx.external) {} else {
+ if (Object.keys(defs).length > 0) {
+ if (ctx.target === "draft-2020-12") {
+ result.$defs = defs;
+ } else {
+ result.definitions = defs;
+ }
+ }
+ }
+ try {
+ const finalized = JSON.parse(JSON.stringify(result));
+ Object.defineProperty(finalized, "~standard", {
+ value: {
+ ...schema["~standard"],
+ jsonSchema: {
+ input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
+ output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
+ }
+ },
+ enumerable: false,
+ writable: false
+ });
+ return finalized;
+ } catch (_err) {
+ throw new Error("Error converting schema to JSON.");
+ }
+}
+function isTransforming(_schema, _ctx) {
+ const ctx = _ctx ?? { seen: new Set };
+ if (ctx.seen.has(_schema))
+ return false;
+ ctx.seen.add(_schema);
+ const def = _schema._zod.def;
+ if (def.type === "transform")
+ return true;
+ if (def.type === "array")
+ return isTransforming(def.element, ctx);
+ if (def.type === "set")
+ return isTransforming(def.valueType, ctx);
+ if (def.type === "lazy")
+ return isTransforming(def.getter(), ctx);
+ if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") {
+ return isTransforming(def.innerType, ctx);
+ }
+ if (def.type === "intersection") {
+ return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
+ }
+ if (def.type === "record" || def.type === "map") {
+ return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
+ }
+ if (def.type === "pipe") {
+ if (_schema._zod.traits.has("$ZodCodec"))
+ return true;
+ return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
+ }
+ if (def.type === "object") {
+ for (const key in def.shape) {
+ if (isTransforming(def.shape[key], ctx))
+ return true;
+ }
+ return false;
+ }
+ if (def.type === "union") {
+ for (const option of def.options) {
+ if (isTransforming(option, ctx))
+ return true;
+ }
+ return false;
+ }
+ if (def.type === "tuple") {
+ for (const item of def.items) {
+ if (isTransforming(item, ctx))
+ return true;
+ }
+ if (def.rest && isTransforming(def.rest, ctx))
+ return true;
+ return false;
+ }
+ return false;
+}
+var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
+ const ctx = initializeContext({ ...params, processors });
+ process2(schema, ctx);
+ extractDefs(ctx, schema);
+ return finalize(ctx, schema);
+};
+var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
+ const { libraryOptions, target } = params ?? {};
+ const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
+ process2(schema, ctx);
+ extractDefs(ctx, schema);
+ return finalize(ctx, schema);
+};
+// ../../../node_modules/.bun/[email protected]/node_modules/zod/v4/core/json-schema-processors.js
+var formatMap = {
+ guid: "uuid",
+ url: "uri",
+ datetime: "date-time",
+ json_string: "json-string",
+ regex: ""
+};
+var stringProcessor = (schema, ctx, _json, _params) => {
+ const json = _json;
+ json.type = "string";
+ const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
+ if (typeof minimum === "number")
+ json.minLength = minimum;
+ if (typeof maximum === "number")
+ json.maxLength = maximum;
+ if (format) {
+ json.format = formatMap[format] ?? format;
+ if (json.format === "")
+ delete json.format;
+ if (format === "time") {
+ delete json.format;
+ }
+ }
+ if (contentEncoding)
+ json.contentEncoding = contentEncoding;
+ if (patterns && patterns.size > 0) {
+ const regexes = [...patterns];
+ if (regexes.length === 1)
+ json.pattern = regexes[0].source;
+ else if (regexes.length > 1) {
+ json.allOf = [
+ ...regexes.map((regex) => ({
+ ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
+ pattern: regex.source
+ }))
+ ];
+ }
+ }
+};
+var numberProcessor = (schema, ctx, _json, _params) => {
+ const json = _json;
+ const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
+ if (typeof format === "string" && format.includes("int"))
+ json.type = "integer";
+ else
+ json.type = "number";
+ const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
+ const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
+ const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
+ if (exMin) {
+ if (legacy) {
+ json.minimum = exclusiveMinimum;
+ json.exclusiveMinimum = true;
+ } else {
+ json.exclusiveMinimum = exclusiveMinimum;
+ }
+ } else if (typeof minimum === "number") {
+ json.minimum = minimum;
+ }
+ if (exMax) {
+ if (legacy) {
+ json.maximum = exclusiveMaximum;
+ json.exclusiveMaximum = true;
+ } else {
+ json.exclusiveMaximum = exclusiveMaximum;
+ }
+ } else if (typeof maximum === "number") {
+ json.maximum = maximum;
+ }
+ if (typeof multipleOf === "number")
+ json.multipleOf = multipleOf;
+};
+var booleanProcessor = (_schema, _ctx, json, _params) => {
+ json.type = "boolean";
+};
+var neverProcessor = (_schema, _ctx, json, _params) => {
+ json.not = {};
+};
+var unknownProcessor = (_schema, _ctx, _json, _params) => {};
+var enumProcessor = (schema, _ctx, json, _params) => {
+ const def = schema._zod.def;
+ const values = getEnumValues(def.entries);
+ if (values.every((v) => typeof v === "number"))
+ json.type = "number";
+ if (values.every((v) => typeof v === "string"))
+ json.type = "string";
+ json.enum = values;
+};
+var literalProcessor = (schema, ctx, json, _params) => {
+ const def = schema._zod.def;
+ const vals = [];
+ for (const val of def.values) {
+ if (val === undefined) {
+ if (ctx.unrepresentable === "throw") {
+ throw new Error("Literal `undefined` cannot be represented in JSON Schema");
+ }
+ } else if (typeof val === "bigint") {
+ if (ctx.unrepresentable === "throw") {
+ throw new Error("BigInt literals cannot be represented in JSON Schema");
+ } else {
+ vals.push(Number(val));
+ }
+ } else {
+ vals.push(val);
+ }
+ }
+ if (vals.length === 0) {} else if (vals.length === 1) {
+ const val = vals[0];
+ json.type = val === null ? "null" : typeof val;
+ if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
+ json.enum = [val];
+ } else {
+ json.const = val;
+ }
+ } else {
+ if (vals.every((v) => typeof v === "number"))
+ json.type = "number";
+ if (vals.every((v) => typeof v === "string"))
+ json.type = "string";
+ if (vals.every((v) => typeof v === "boolean"))
+ json.type = "boolean";
+ if (vals.every((v) => v === null))
+ json.type = "null";
+ json.enum = vals;
+ }
+};
+var customProcessor = (_schema, ctx, _json, _params) => {
+ if (ctx.unrepresentable === "throw") {
+ throw new Error("Custom types cannot be represented in JSON Schema");
+ }
+};
+var transformProcessor = (_schema, ctx, _json, _params) => {
+ if (ctx.unrepresentable === "throw") {
+ throw new Error("Transforms cannot be represented in JSON Schema");
+ }
+};
+var arrayProcessor = (schema, ctx, _json, params) => {
+ const json = _json;
+ const def = schema._zod.def;
+ const { minimum, maximum } = schema._zod.bag;
+ if (typeof minimum === "number")
+ json.minItems = minimum;
+ if (typeof maximum === "number")
+ json.maxItems = maximum;
+ json.type = "array";
+ json.items = process2(def.element, ctx, {
+ ...params,
+ path: [...params.path, "items"]
+ });
+};
+var objectProcessor = (schema, ctx, _json, params) => {
+ const json = _json;
+ const def = schema._zod.def;
+ json.type = "object";
+ json.properties = {};
+ const shape = def.shape;
+ for (const key in shape) {
+ json.properties[key] = process2(shape[key], ctx, {
+ ...params,
+ path: [...params.path, "properties", key]
+ });
+ }
+ const allKeys = new Set(Object.keys(shape));
+ const requiredKeys = new Set([...allKeys].filter((key) => {
+ const v = def.shape[key]._zod;
+ if (ctx.io === "input") {
+ return v.optin === undefined;
+ } else {
+ return v.optout === undefined;
+ }
+ }));
+ if (requiredKeys.size > 0) {
+ json.required = Array.from(requiredKeys);
+ }
+ if (def.catchall?._zod.def.type === "never") {
+ json.additionalProperties = false;
+ } else if (!def.catchall) {
+ if (ctx.io === "output")
+ json.additionalProperties = false;
+ } else if (def.catchall) {
+ json.additionalProperties = process2(def.catchall, ctx, {
+ ...params,
+ path: [...params.path, "additionalProperties"]
+ });
+ }
+};
+var unionProcessor = (schema, ctx, json, params) => {
+ const def = schema._zod.def;
+ const isExclusive = def.inclusive === false;
+ const options = def.options.map((x, i) => process2(x, ctx, {
+ ...params,
+ path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
+ }));
+ if (isExclusive) {
+ json.oneOf = options;
+ } else {
+ json.anyOf = options;
+ }
+};
+var intersectionProcessor = (schema, ctx, json, params) => {
+ const def = schema._zod.def;
+ const a = process2(def.left, ctx, {
+ ...params,
+ path: [...params.path, "allOf", 0]
+ });
+ const b = process2(def.right, ctx, {
+ ...params,
+ path: [...params.path, "allOf", 1]
+ });
+ const isSimpleIntersection = (val) => ("allOf" in val) && Object.keys(val).length === 1;
+ const allOf = [
+ ...isSimpleIntersection(a) ? a.allOf : [a],
+ ...isSimpleIntersection(b) ? b.allOf : [b]
+ ];
+ json.allOf = allOf;
+};
+var recordProcessor = (schema, ctx, _json, params) => {
+ const json = _json;
+ const def = schema._zod.def;
+ json.type = "object";
+ const keyType = def.keyType;
+ const keyBag = keyType._zod.bag;
+ const patterns = keyBag?.patterns;
+ if (def.mode === "loose" && patterns && patterns.size > 0) {
+ const valueSchema = process2(def.valueType, ctx, {
+ ...params,
+ path: [...params.path, "patternProperties", "*"]
+ });
+ json.patternProperties = {};
+ for (const pattern of patterns) {
+ json.patternProperties[pattern.source] = valueSchema;
+ }
+ } else {
+ if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
+ json.propertyNames = process2(def.keyType, ctx, {
+ ...params,
+ path: [...params.path, "propertyNames"]
+ });
+ }
+ json.additionalProperties = process2(def.valueType, ctx, {
+ ...params,
+ path: [...params.path, "additionalProperties"]
+ });
+ }
+ const keyValues = keyType._zod.values;
+ if (keyValues) {
+ const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
+ if (validKeyValues.length > 0) {
+ json.required = validKeyValues;
+ }
+ }
+};
+var nullableProcessor = (schema, ctx, json, params) => {
+ const def = schema._zod.def;
+ const inner = process2(def.innerType, ctx, params);
+ const seen = ctx.seen.get(schema);
+ if (ctx.target === "openapi-3.0") {
+ seen.ref = def.innerType;
+ json.nullable = true;
+ } else {
+ json.anyOf = [inner, { type: "null" }];
+ }
+};
+var nonoptionalProcessor = (schema, ctx, _json, params) => {
+ const def = schema._zod.def;
+ process2(def.innerType, ctx, params);
+ const seen = ctx.seen.get(schema);
+ seen.ref = def.innerType;
+};
+var defaultProcessor = (schema, ctx, json, params) => {
+ const def = schema._zod.def;
+ process2(def.innerType, ctx, params);
+ const seen = ctx.seen.get(schema);
+ seen.ref = def.innerType;
+ json.default = JSON.parse(JSON.stringify(def.defaultValue));
+};
+var prefaultProcessor = (schema, ctx, json, params) => {
+ const def = schema._zod.def;
+ process2(def.innerType, ctx, params);
+ const seen = ctx.seen.get(schema);
+ seen.ref = def.innerType;
+ if (ctx.io === "input")
+ json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
+};
+var catchProcessor = (schema, ctx, json, params) => {
+ const def = schema._zod.def;
+ process2(def.innerType, ctx, params);
+ const seen = ctx.seen.get(schema);
+ seen.ref = def.innerType;
+ let catchValue;
+ try {
+ catchValue = def.catchValue(undefined);
+ } catch {
+ throw new Error("Dynamic catch values are not supported in JSON Schema");
+ }
+ json.default = catchValue;
+};
+var pipeProcessor = (schema, ctx, _json, params) => {
+ const def = schema._zod.def;
+ const inIsTransform = def.in._zod.traits.has("$ZodTransform");
+ const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
+ process2(innerType, ctx, params);
+ const seen = ctx.seen.get(schema);
+ seen.ref = innerType;
+};
+var readonlyProcessor = (schema, ctx, json, params) => {
+ const def = schema._zod.def;
+ process2(def.innerType, ctx, params);
+ const seen = ctx.seen.get(schema);
+ seen.ref = def.innerType;
+ json.readOnly = true;
+};
+var optionalProcessor = (schema, ctx, _json, params) => {
+ const def = schema._zod.def;
+ process2(def.innerType, ctx, params);
+ const seen = ctx.seen.get(schema);
+ seen.ref = def.innerType;
+};
+// ../../../node_modules/.bun/[email protected]/node_modules/zod/v4/classic/iso.js
+var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
+ $ZodISODateTime.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+function datetime2(params) {
+ return _isoDateTime(ZodISODateTime, params);
+}
+var ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
+ $ZodISODate.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+function date2(params) {
+ return _isoDate(ZodISODate, params);
+}
+var ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
+ $ZodISOTime.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+function time2(params) {
+ return _isoTime(ZodISOTime, params);
+}
+var ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
+ $ZodISODuration.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+function duration2(params) {
+ return _isoDuration(ZodISODuration, params);
+}
+
+// ../../../node_modules/.bun/[email protected]/node_modules/zod/v4/classic/errors.js
+var initializer2 = (inst, issues) => {
+ $ZodError.init(inst, issues);
+ inst.name = "ZodError";
+ Object.defineProperties(inst, {
+ format: {
+ value: (mapper) => formatError(inst, mapper)
+ },
+ flatten: {
+ value: (mapper) => flattenError(inst, mapper)
+ },
+ addIssue: {
+ value: (issue) => {
+ inst.issues.push(issue);
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
+ }
+ },
+ addIssues: {
+ value: (issues) => {
+ inst.issues.push(...issues);
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
+ }
+ },
+ isEmpty: {
+ get() {
+ return inst.issues.length === 0;
+ }
+ }
+ });
+};
+var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, {
+ Parent: Error
+});
+
+// ../../../node_modules/.bun/[email protected]/node_modules/zod/v4/classic/parse.js
+var parse3 = /* @__PURE__ */ _parse(ZodRealError);
+var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
+var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
+var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
+var encode = /* @__PURE__ */ _encode(ZodRealError);
+var decode = /* @__PURE__ */ _decode(ZodRealError);
+var encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
+var decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
+var safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
+var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
+var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
+var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
+
+// ../../../node_modules/.bun/[email protected]/node_modules/zod/v4/classic/schemas.js
+var _installedGroups = /* @__PURE__ */ new WeakMap;
+function _installLazyMethods(inst, group, methods) {
+ const proto = Object.getPrototypeOf(inst);
+ let installed = _installedGroups.get(proto);
+ if (!installed) {
+ installed = new Set;
+ _installedGroups.set(proto, installed);
+ }
+ if (installed.has(group))
+ return;
+ installed.add(group);
+ for (const key in methods) {
+ const fn = methods[key];
+ Object.defineProperty(proto, key, {
+ configurable: true,
+ enumerable: false,
+ get() {
+ const bound = fn.bind(this);
+ Object.defineProperty(this, key, {
+ configurable: true,
+ writable: true,
+ enumerable: true,
+ value: bound
+ });
+ return bound;
+ },
+ set(v) {
+ Object.defineProperty(this, key, {
+ configurable: true,
+ writable: true,
+ enumerable: true,
+ value: v
+ });
+ }
+ });
+ }
+}
+var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
+ $ZodType.init(inst, def);
+ Object.assign(inst["~standard"], {
+ jsonSchema: {
+ input: createStandardJSONSchemaMethod(inst, "input"),
+ output: createStandardJSONSchemaMethod(inst, "output")
+ }
+ });
+ inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
+ inst.def = def;
+ inst.type = def.type;
+ Object.defineProperty(inst, "_def", { value: def });
+ inst.parse = (data, params) => parse3(inst, data, params, { callee: inst.parse });
+ inst.safeParse = (data, params) => safeParse2(inst, data, params);
+ inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
+ inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
+ inst.spa = inst.safeParseAsync;
+ inst.encode = (data, params) => encode(inst, data, params);
+ inst.decode = (data, params) => decode(inst, data, params);
+ inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
+ inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
+ inst.safeEncode = (data, params) => safeEncode(inst, data, params);
+ inst.safeDecode = (data, params) => safeDecode(inst, data, params);
+ inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
+ inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
+ _installLazyMethods(inst, "ZodType", {
+ check(...chks) {
+ const def = this.def;
+ return this.clone(mergeDefs(def, {
+ checks: [
+ ...def.checks ?? [],
+ ...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
+ ]
+ }), { parent: true });
+ },
+ with(...chks) {
+ return this.check(...chks);
+ },
+ clone(def, params) {
+ return clone(this, def, params);
+ },
+ brand() {
+ return this;
+ },
+ register(reg, meta) {
+ reg.add(this, meta);
+ return this;
+ },
+ refine(check, params) {
+ return this.check(refine(check, params));
+ },
+ superRefine(refinement, params) {
+ return this.check(superRefine(refinement, params));
+ },
+ overwrite(fn) {
+ return this.check(_overwrite(fn));
+ },
+ optional() {
+ return optional(this);
+ },
+ exactOptional() {
+ return exactOptional(this);
+ },
+ nullable() {
+ return nullable(this);
+ },
+ nullish() {
+ return optional(nullable(this));
+ },
+ nonoptional(params) {
+ return nonoptional(this, params);
+ },
+ array() {
+ return array(this);
+ },
+ or(arg) {
+ return union([this, arg]);
+ },
+ and(arg) {
+ return intersection(this, arg);
+ },
+ transform(tx) {
+ return pipe(this, transform(tx));
+ },
+ default(d) {
+ return _default(this, d);
+ },
+ prefault(d) {
+ return prefault(this, d);
+ },
+ catch(params) {
+ return _catch(this, params);
+ },
+ pipe(target) {
+ return pipe(this, target);
+ },
+ readonly() {
+ return readonly(this);
+ },
+ describe(description) {
+ const cl = this.clone();
+ globalRegistry.add(cl, { description });
+ return cl;
+ },
+ meta(...args) {
+ if (args.length === 0)
+ return globalRegistry.get(this);
+ const cl = this.clone();
+ globalRegistry.add(cl, args[0]);
+ return cl;
+ },
+ isOptional() {
+ return this.safeParse(undefined).success;
+ },
+ isNullable() {
+ return this.safeParse(null).success;
+ },
+ apply(fn) {
+ return fn(this);
+ }
+ });
+ Object.defineProperty(inst, "description", {
+ get() {
+ return globalRegistry.get(inst)?.description;
+ },
+ configurable: true
+ });
+ return inst;
+});
+var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
+ $ZodString.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
+ const bag = inst._zod.bag;
+ inst.format = bag.format ?? null;
+ inst.minLength = bag.minimum ?? null;
+ inst.maxLength = bag.maximum ?? null;
+ _installLazyMethods(inst, "_ZodString", {
+ regex(...args) {
+ return this.check(_regex(...args));
+ },
+ includes(...args) {
+ return this.check(_includes(...args));
+ },
+ startsWith(...args) {
+ return this.check(_startsWith(...args));
+ },
+ endsWith(...args) {
+ return this.check(_endsWith(...args));
+ },
+ min(...args) {
+ return this.check(_minLength(...args));
+ },
+ max(...args) {
+ return this.check(_maxLength(...args));
+ },
+ length(...args) {
+ return this.check(_length(...args));
+ },
+ nonempty(...args) {
+ return this.check(_minLength(1, ...args));
+ },
+ lowercase(params) {
+ return this.check(_lowercase(params));
+ },
+ uppercase(params) {
+ return this.check(_uppercase(params));
+ },
+ trim() {
+ return this.check(_trim());
+ },
+ normalize(...args) {
+ return this.check(_normalize(...args));
+ },
+ toLowerCase() {
+ return this.check(_toLowerCase());
+ },
+ toUpperCase() {
+ return this.check(_toUpperCase());
+ },
+ slugify() {
+ return this.check(_slugify());
+ }
+ });
+});
+var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
+ $ZodString.init(inst, def);
+ _ZodString.init(inst, def);
+ inst.email = (params) => inst.check(_email(ZodEmail, params));
+ inst.url = (params) => inst.check(_url(ZodURL, params));
+ inst.jwt = (params) => inst.check(_jwt(ZodJWT, params));
+ inst.emoji = (params) => inst.check(_emoji2(ZodEmoji, params));
+ inst.guid = (params) => inst.check(_guid(ZodGUID, params));
+ inst.uuid = (params) => inst.check(_uuid(ZodUUID, params));
+ inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params));
+ inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params));
+ inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params));
+ inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params));
+ inst.guid = (params) => inst.check(_guid(ZodGUID, params));
+ inst.cuid = (params) => inst.check(_cuid(ZodCUID, params));
+ inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params));
+ inst.ulid = (params) => inst.check(_ulid(ZodULID, params));
+ inst.base64 = (params) => inst.check(_base64(ZodBase64, params));
+ inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params));
+ inst.xid = (params) => inst.check(_xid(ZodXID, params));
+ inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params));
+ inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params));
+ inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params));
+ inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params));
+ inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));
+ inst.e164 = (params) => inst.check(_e164(ZodE164, params));
+ inst.datetime = (params) => inst.check(datetime2(params));
+ inst.date = (params) => inst.check(date2(params));
+ inst.time = (params) => inst.check(time2(params));
+ inst.duration = (params) => inst.check(duration2(params));
+});
+function string2(params) {
+ return _string(ZodString, params);
+}
+var ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
+ $ZodStringFormat.init(inst, def);
+ _ZodString.init(inst, def);
+});
+var ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
+ $ZodEmail.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+var ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
+ $ZodGUID.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+var ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
+ $ZodUUID.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+var ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
+ $ZodURL.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+var ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
+ $ZodEmoji.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+var ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
+ $ZodNanoID.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+var ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
+ $ZodCUID.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+var ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
+ $ZodCUID2.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+var ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
+ $ZodULID.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+var ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
+ $ZodXID.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+var ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
+ $ZodKSUID.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+var ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
+ $ZodIPv4.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+var ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
+ $ZodIPv6.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+var ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
+ $ZodCIDRv4.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+var ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
+ $ZodCIDRv6.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+var ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
+ $ZodBase64.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+var ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
+ $ZodBase64URL.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+var ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
+ $ZodE164.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
+ $ZodJWT.init(inst, def);
+ ZodStringFormat.init(inst, def);
+});
+var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
+ $ZodNumber.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
+ _installLazyMethods(inst, "ZodNumber", {
+ gt(value, params) {
+ return this.check(_gt(value, params));
+ },
+ gte(value, params) {
+ return this.check(_gte(value, params));
+ },
+ min(value, params) {
+ return this.check(_gte(value, params));
+ },
+ lt(value, params) {
+ return this.check(_lt(value, params));
+ },
+ lte(value, params) {
+ return this.check(_lte(value, params));
+ },
+ max(value, params) {
+ return this.check(_lte(value, params));
+ },
+ int(params) {
+ return this.check(int(params));
+ },
+ safe(params) {
+ return this.check(int(params));
+ },
+ positive(params) {
+ return this.check(_gt(0, params));
+ },
+ nonnegative(params) {
+ return this.check(_gte(0, params));
+ },
+ negative(params) {
+ return this.check(_lt(0, params));
+ },
+ nonpositive(params) {
+ return this.check(_lte(0, params));
+ },
+ multipleOf(value, params) {
+ return this.check(_multipleOf(value, params));
+ },
+ step(value, params) {
+ return this.check(_multipleOf(value, params));
+ },
+ finite() {
+ return this;
+ }
+ });
+ const bag = inst._zod.bag;
+ inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
+ inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
+ inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
+ inst.isFinite = true;
+ inst.format = bag.format ?? null;
+});
+function number2(params) {
+ return _number(ZodNumber, params);
+}
+var ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {
+ $ZodNumberFormat.init(inst, def);
+ ZodNumber.init(inst, def);
+});
+function int(params) {
+ return _int(ZodNumberFormat, params);
+}
+var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
+ $ZodBoolean.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
+});
+function boolean2(params) {
+ return _boolean(ZodBoolean, params);
+}
+var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
+ $ZodUnknown.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
+});
+function unknown() {
+ return _unknown(ZodUnknown);
+}
+var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
+ $ZodNever.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
+});
+function never(params) {
+ return _never(ZodNever, params);
+}
+var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
+ $ZodArray.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
+ inst.element = def.element;
+ _installLazyMethods(inst, "ZodArray", {
+ min(n, params) {
+ return this.check(_minLength(n, params));
+ },
+ nonempty(params) {
+ return this.check(_minLength(1, params));
+ },
+ max(n, params) {
+ return this.check(_maxLength(n, params));
+ },
+ length(n, params) {
+ return this.check(_length(n, params));
+ },
+ unwrap() {
+ return this.element;
+ }
+ });
+});
+function array(element, params) {
+ return _array(ZodArray, element, params);
+}
+var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
+ $ZodObjectJIT.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
+ defineLazy(inst, "shape", () => {
+ return def.shape;
+ });
+ _installLazyMethods(inst, "ZodObject", {
+ keyof() {
+ return _enum(Object.keys(this._zod.def.shape));
+ },
+ catchall(catchall) {
+ return this.clone({ ...this._zod.def, catchall });
+ },
+ passthrough() {
+ return this.clone({ ...this._zod.def, catchall: unknown() });
+ },
+ loose() {
+ return this.clone({ ...this._zod.def, catchall: unknown() });
+ },
+ strict() {
+ return this.clone({ ...this._zod.def, catchall: never() });
+ },
+ strip() {
+ return this.clone({ ...this._zod.def, catchall: undefined });
+ },
+ extend(incoming) {
+ return extend(this, incoming);
+ },
+ safeExtend(incoming) {
+ return safeExtend(this, incoming);
+ },
+ merge(other) {
+ return merge(this, other);
+ },
+ pick(mask) {
+ return pick(this, mask);
+ },
+ omit(mask) {
+ return omit(this, mask);
+ },
+ partial(...args) {
+ return partial(ZodOptional, this, args[0]);
+ },
+ required(...args) {
+ return required(ZodNonOptional, this, args[0]);
+ }
+ });
+});
+function object(shape, params) {
+ const def = {
+ type: "object",
+ shape: shape ?? {},
+ ...normalizeParams(params)
+ };
+ return new ZodObject(def);
+}
+var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
+ $ZodUnion.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
+ inst.options = def.options;
+});
+function union(options, params) {
+ return new ZodUnion({
+ type: "union",
+ options,
+ ...normalizeParams(params)
+ });
+}
+var ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => {
+ ZodUnion.init(inst, def);
+ $ZodDiscriminatedUnion.init(inst, def);
+});
+function discriminatedUnion(discriminator, options, params) {
+ return new ZodDiscriminatedUnion({
+ type: "union",
+ options,
+ discriminator,
+ ...normalizeParams(params)
+ });
+}
+var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
+ $ZodIntersection.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
+});
+function intersection(left, right) {
+ return new ZodIntersection({
+ type: "intersection",
+ left,
+ right
+ });
+}
+var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
+ $ZodRecord.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
+ inst.keyType = def.keyType;
+ inst.valueType = def.valueType;
+});
+function record(keyType, valueType, params) {
+ if (!valueType || !valueType._zod) {
+ return new ZodRecord({
+ type: "record",
+ keyType: string2(),
+ valueType: keyType,
+ ...normalizeParams(valueType)
+ });
+ }
+ return new ZodRecord({
+ type: "record",
+ keyType,
+ valueType,
+ ...normalizeParams(params)
+ });
+}
+var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
+ $ZodEnum.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
+ inst.enum = def.entries;
+ inst.options = Object.values(def.entries);
+ const keys = new Set(Object.keys(def.entries));
+ inst.extract = (values, params) => {
+ const newEntries = {};
+ for (const value of values) {
+ if (keys.has(value)) {
+ newEntries[value] = def.entries[value];
+ } else
+ throw new Error(`Key ${value} not found in enum`);
+ }
+ return new ZodEnum({
+ ...def,
+ checks: [],
+ ...normalizeParams(params),
+ entries: newEntries
+ });
+ };
+ inst.exclude = (values, params) => {
+ const newEntries = { ...def.entries };
+ for (const value of values) {
+ if (keys.has(value)) {
+ delete newEntries[value];
+ } else
+ throw new Error(`Key ${value} not found in enum`);
+ }
+ return new ZodEnum({
+ ...def,
+ checks: [],
+ ...normalizeParams(params),
+ entries: newEntries
+ });
+ };
+});
+function _enum(values, params) {
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
+ return new ZodEnum({
+ type: "enum",
+ entries,
+ ...normalizeParams(params)
+ });
+}
+var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
+ $ZodLiteral.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
+ inst.values = new Set(def.values);
+ Object.defineProperty(inst, "value", {
+ get() {
+ if (def.values.length > 1) {
+ throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
+ }
+ return def.values[0];
+ }
+ });
+});
+function literal(value, params) {
+ return new ZodLiteral({
+ type: "literal",
+ values: Array.isArray(value) ? value : [value],
+ ...normalizeParams(params)
+ });
+}
+var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
+ $ZodTransform.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
+ inst._zod.parse = (payload, _ctx) => {
+ if (_ctx.direction === "backward") {
+ throw new $ZodEncodeError(inst.constructor.name);
+ }
+ payload.addIssue = (issue2) => {
+ if (typeof issue2 === "string") {
+ payload.issues.push(issue(issue2, payload.value, def));
+ } else {
+ const _issue = issue2;
+ if (_issue.fatal)
+ _issue.continue = false;
+ _issue.code ?? (_issue.code = "custom");
+ _issue.input ?? (_issue.input = payload.value);
+ _issue.inst ?? (_issue.inst = inst);
+ payload.issues.push(issue(_issue));
+ }
+ };
+ const output = def.transform(payload.value, payload);
+ if (output instanceof Promise) {
+ return output.then((output) => {
+ payload.value = output;
+ payload.fallback = true;
+ return payload;
+ });
+ }
+ payload.value = output;
+ payload.fallback = true;
+ return payload;
+ };
+});
+function transform(fn) {
+ return new ZodTransform({
+ type: "transform",
+ transform: fn
+ });
+}
+var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
+ $ZodOptional.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
+ inst.unwrap = () => inst._zod.def.innerType;
+});
+function optional(innerType) {
+ return new ZodOptional({
+ type: "optional",
+ innerType
+ });
+}
+var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
+ $ZodExactOptional.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
+ inst.unwrap = () => inst._zod.def.innerType;
+});
+function exactOptional(innerType) {
+ return new ZodExactOptional({
+ type: "optional",
+ innerType
+ });
+}
+var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
+ $ZodNullable.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
+ inst.unwrap = () => inst._zod.def.innerType;
+});
+function nullable(innerType) {
+ return new ZodNullable({
+ type: "nullable",
+ innerType
+ });
+}
+var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
+ $ZodDefault.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
+ inst.unwrap = () => inst._zod.def.innerType;
+ inst.removeDefault = inst.unwrap;
+});
+function _default(innerType, defaultValue) {
+ return new ZodDefault({
+ type: "default",
+ innerType,
+ get defaultValue() {
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
+ }
+ });
+}
+var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
+ $ZodPrefault.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
+ inst.unwrap = () => inst._zod.def.innerType;
+});
+function prefault(innerType, defaultValue) {
+ return new ZodPrefault({
+ type: "prefault",
+ innerType,
+ get defaultValue() {
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
+ }
+ });
+}
+var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
+ $ZodNonOptional.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
+ inst.unwrap = () => inst._zod.def.innerType;
+});
+function nonoptional(innerType, params) {
+ return new ZodNonOptional({
+ type: "nonoptional",
+ innerType,
+ ...normalizeParams(params)
+ });
+}
+var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
+ $ZodCatch.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
+ inst.unwrap = () => inst._zod.def.innerType;
+ inst.removeCatch = inst.unwrap;
+});
+function _catch(innerType, catchValue) {
+ return new ZodCatch({
+ type: "catch",
+ innerType,
+ catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
+ });
+}
+var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
+ $ZodPipe.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
+ inst.in = def.in;
+ inst.out = def.out;
+});
+function pipe(in_, out) {
+ return new ZodPipe({
+ type: "pipe",
+ in: in_,
+ out
+ });
+}
+var ZodPreprocess = /* @__PURE__ */ $constructor("ZodPreprocess", (inst, def) => {
+ ZodPipe.init(inst, def);
+ $ZodPreprocess.init(inst, def);
+});
+var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
+ $ZodReadonly.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
+ inst.unwrap = () => inst._zod.def.innerType;
+});
+function readonly(innerType) {
+ return new ZodReadonly({
+ type: "readonly",
+ innerType
+ });
+}
+var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
+ $ZodCustom.init(inst, def);
+ ZodType.init(inst, def);
+ inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
+});
+function refine(fn, _params = {}) {
+ return _refine(ZodCustom, fn, _params);
+}
+function superRefine(fn, params) {
+ return _superRefine(fn, params);
+}
+function preprocess(fn, schema) {
+ return new ZodPreprocess({
+ type: "pipe",
+ in: transform(fn),
+ out: schema
+ });
+}
+
+// ../../omo-config-core/src/schema/reasoning-vocabulary.ts
+var REASONING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
+var REASONING_AUTO = "auto";
+var REASONING_LEVEL_SET = new Set(REASONING_LEVELS);
+var REASONING_LEVEL_OR_AUTO_SET = new Set([...REASONING_LEVELS, REASONING_AUTO]);
+function isReasoningLevel(value) {
+ return REASONING_LEVEL_SET.has(value);
+}
+function normalizeReasoning(input) {
+ const normalized = input.trim().toLowerCase();
+ if (!normalized)
+ return {};
+ if (normalized === "none")
+ return { level: "off" };
+ if (normalized === REASONING_AUTO)
+ return { level: REASONING_AUTO };
+ if (isReasoningLevel(normalized))
+ return { level: normalized };
+ return { passthrough: normalized };
+}
+function splitReasoningSuffix(model, options) {
+ if (typeof model !== "string")
+ return { base: "" };
+ const trimmed = model.trim();
+ if (!trimmed)
+ return { base: "" };
+ const separatorIndex = trimmed.lastIndexOf(":");
+ if (separatorIndex === -1)
+ return { base: trimmed };
+ const base = trimmed.slice(0, separatorIndex).trim();
+ const token = trimmed.slice(separatorIndex + 1).trim().toLowerCase();
+ if (!base || !REASONING_LEVEL_OR_AUTO_SET.has(token))
+ return { base: trimmed };
+ if (token === "max" && !(options?.allowMaxSuffix ?? base.includes("/")))
+ return { base: trimmed };
+ return { base, level: token };
+}
+
+// ../../omo-config-core/src/schema/model-ref.ts
+var REASONING_LEVELS_OR_AUTO = [...REASONING_LEVELS, "auto"];
+var OmoReasoningSchema = union([
+ _enum(REASONING_LEVELS_OR_AUTO),
+ string2()
+]);
+var OmoModelRefObjectSchema = object({
+ model: string2(),
+ reasoning: OmoReasoningSchema.optional(),
+ temperature: number2().min(0).max(2).optional(),
+ top_p: number2().min(0).max(1).optional(),
+ max_tokens: number2().int().positive().optional(),
+ provider_options: record(string2(), unknown()).optional()
+}).strict();
+var OmoModelRefSchema = union([string2(), OmoModelRefObjectSchema]);
+
+// ../../omo-config-core/src/schema/fallback-models.ts
+var OmoThinkingConfigSchema = object({
+ type: _enum(["enabled", "disabled"]),
+ budgetTokens: number2().optional()
+}).strict();
+var OmoReasoningEffortSchema = OmoReasoningSchema;
+function isRecord2(value) {
+ return typeof value === "object" && value !== null && !Array.isArray(value);
+}
+function canonicalReasoning(value) {
+ if (typeof value !== "string")
+ return;
+ const normalized = normalizeReasoning(value);
+ return normalized.level ?? normalized.passthrough;
+}
+function canonicalModelString(model) {
+ const colon = splitReasoningSuffix(model, { allowMaxSuffix: true });
+ if (colon.level !== undefined)
+ return `${colon.base}:${colon.level}`;
+ const trimmed = model.trim();
+ const parenthesized = trimmed.match(/^(.*)\(([^()]+)\)\s*$/);
+ const spaced = parenthesized === null ? trimmed.match(/^(.*\S)\s+([a-z][a-z0-9_-]*)$/i) : null;
+ const base = (parenthesized?.[1] ?? spaced?.[1])?.trim();
+ const token = (parenthesized?.[2] ?? spaced?.[2])?.trim();
+ if (base === undefined || token === undefined)
+ return trimmed;
+ const normalized = normalizeReasoning(token);
+ return normalized.level === undefined ? trimmed : `${base}:${normalized.level}`;
+}
+function normalizeLegacyModelFields(entry) {
+ const normalized = { ...entry };
+ delete normalized["variant"];
+ delete normalized["reasoningEffort"];
+ delete normalized["thinking"];
+ delete normalized["textVerbosity"];
+ delete normalized["maxTokens"];
+ delete normalized["providerOptions"];
+ if (typeof entry["model"] === "string")
+ normalized["model"] = canonicalModelString(entry["model"]);
+ const explicitReasoning = canonicalReasoning(entry["reasoning"]);
+ const variant = canonicalReasoning(entry["variant"]);
+ const reasoningEffort = canonicalReasoning(entry["reasoningEffort"]);
+ const thinking = isRecord2(entry["thinking"]) ? entry["thinking"] : undefined;
+ const reasoning = explicitReasoning ?? reasoningEffort ?? variant ?? (thinking?.["type"] === "disabled" ? "off" : undefined);
+ if (reasoning !== undefined)
+ normalized["reasoning"] = reasoning;
+ const providerOptions = isRecord2(entry["provider_options"]) ? { ...entry["provider_options"] } : isRecord2(entry["providerOptions"]) ? { ...entry["providerOptions"] } : {};
+ if (thinking?.["type"] === "enabled")
+ providerOptions["thinking"] = { ...thinking };
+ if (entry["textVerbosity"] !== undefined)
+ providerOptions["textVerbosity"] = entry["textVerbosity"];
+ if (Object.keys(providerOptions).length > 0)
+ normalized["provider_options"] = providerOptions;
+ if (entry["max_tokens"] !== undefined)
+ normalized["max_tokens"] = entry["max_tokens"];
+ else if (entry["maxTokens"] !== undefined)
+ normalized["max_tokens"] = entry["maxTokens"];
+ return normalized;
+}
+var OmoLegacyFallbackModelObjectInputSchema = object({
+ model: string2(),
+ reasoning: OmoReasoningSchema.optional(),
+ temperature: number2().min(0).max(2).optional(),
+ top_p: number2().min(0).max(1).optional(),
+ max_tokens: number2().int().positive().optional(),
+ provider_options: record(string2(), unknown()).optional(),
+ variant: string2().optional(),
+ reasoningEffort: OmoReasoningEffortSchema.optional(),
+ thinking: OmoThinkingConfigSchema.optional(),
+ textVerbosity: _enum(["low", "medium", "high"]).optional(),
+ maxTokens: number2().optional(),
+ providerOptions: record(string2(), unknown()).optional()
+}).strict();
+var OmoFallbackModelObjectSchema = preprocess((value) => isRecord2(value) ? normalizeLegacyModelFields(value) : value, OmoLegacyFallbackModelObjectInputSchema);
+var OmoFallbackModelsSchema = union([
+ string2(),
+ array(string2()),
+ array(OmoFallbackModelObjectSchema),
+ array(union([string2(), OmoFallbackModelObjectSchema]))
+]);
+
+// ../../omo-config-core/src/schema/agent.ts
+function isRecord3(value) {
+ return typeof value === "object" && value !== null && !Array.isArray(value);
+}
+var OmoAgentModelEntrySchema = union([string2(), OmoFallbackModelObjectSchema]);
+var OmoAgentDefInputSchema = object({
+ description: string2().optional(),
+ prompt: string2().optional(),
+ model: string2().optional(),
+ models: array(OmoAgentModelEntrySchema).optional(),
+ reasoning: OmoReasoningSchema.optional(),
+ variant: string2().optional(),
+ reasoningEffort: OmoReasoningEffortSchema.optional(),
+ tools: record(string2(), boolean2()).optional(),
+ execution_mode: _enum(["in-process", "process"]).optional(),
+ background: boolean2().optional(),
+ max_depth: number2().int().nonnegative().optional(),
+ allowed_subagents: array(string2()).optional(),
+ disallowed_tools: array(string2()).optional(),
+ max_turns: number2().int().nonnegative().optional(),
+ temperature: number2().min(0).max(2).optional(),
+ disable: boolean2().optional()
+}).strict();
+var OmoAgentDefSchema = preprocess((value) => isRecord3(value) ? normalizeLegacyModelFields(value) : value, OmoAgentDefInputSchema);
+var OmoAgentsConfigSchema = record(string2(), OmoAgentDefSchema);
+
+// ../../omo-config-core/src/schema/category.ts
+function isRecord4(value) {
+ return typeof value === "object" && value !== null && !Array.isArray(value);
+}
+var OmoCategoryConfigObjectSchema = object({
+ description: string2().optional(),
+ model: string2().optional(),
+ models: array(union([string2(), OmoFallbackModelObjectSchema])).optional(),
+ reasoning: OmoReasoningSchema.optional(),
+ temperature: number2().min(0).max(2).optional(),
+ top_p: number2().min(0).max(1).optional(),
+ max_tokens: number2().int().positive().optional(),
+ provider_options: record(string2(), unknown()).optional(),
+ fallback_models: OmoFallbackModelsSchema.optional(),
+ variant: string2().optional(),
+ maxTokens: number2().optional(),
+ thinking: OmoThinkingConfigSchema.optional(),
+ reasoningEffort: OmoReasoningEffortSchema.optional(),
+ textVerbosity: _enum(["low", "medium", "high"]).optional(),
+ tools: record(string2(), boolean2()).optional(),
+ prompt_append: string2().optional(),
+ max_prompt_tokens: number2().int().positive().optional(),
+ is_unstable_agent: boolean2().optional(),
+ disable: boolean2().optional(),
+ warn_unavailable: boolean2().optional()
+}).strict();
+var OmoCategoryConfigSchema = preprocess((value) => isRecord4(value) ? normalizeLegacyModelFields(value) : value, OmoCategoryConfigObjectSchema);
+var OmoCategoriesConfigSchema = record(string2(), OmoCategoryConfigSchema);
+
+// ../../omo-config-core/src/schema/git-master.ts
+var OmoGitMasterSettingsShape = {
+ commit_footer: union([boolean2(), string2()]),
+ include_co_authored_by: boolean2()
+};
+var OmoGitMasterSettingsLayerSchema = object(OmoGitMasterSettingsShape).partial().strict();
+var OmoGitMasterSettingsSchema = OmoGitMasterSettingsLayerSchema.extend({
+ commit_footer: union([boolean2(), string2()]).default(true),
+ include_co_authored_by: boolean2().default(true)
+}).strict();
+
+// ../../omo-config-core/src/schema/harness.ts
+var HARNESS_IDS = ["codex", "opencode", "omo"];
+var OMO_CONFIG_HARNESS_IDS = ["opencode", "senpi", "codex"];
+var OmoHarnessIdSchema = _enum(OMO_CONFIG_HARNESS_IDS);
+
+// ../../omo-config-core/src/schema/memory.ts
+var OmoMemoryReflectionTriggerSchema = object({
+ step_count: number2().int().nonnegative().default(25),
+ on_compaction: boolean2().default(true)
+}).strict();
+var OmoMemoryReflectionSchema = object({
+ enabled: boolean2().default(true),
+ trigger: OmoMemoryReflectionTriggerSchema.default({ step_count: 25, on_compaction: true }),
+ merge: _enum(["auto", "integration"]).default("auto"),
+ category: string2().min(1).default("quick"),
+ timeout_minutes: number2().int().positive().default(15),
+ sandbox: _enum(["auto", "required", "off"]).default("auto")
+}).strict();
+var OmoMemorySyncSchema = object({
+ remote: string2().min(1).optional(),
+ enabled: boolean2().default(true)
+}).strict();
+var OmoMemorySearchSchema = object({
+ enabled: boolean2().default(true)
+}).strict();
+var OmoMemoryRecallEventCapsSchema = object({
+ tool_args: number2().int().nonnegative().default(400),
+ result_head: number2().int().nonnegative().default(600),
+ assistant: number2().int().nonnegative().default(1500),
+ prompt: number2().int().nonnegative().default(4000)
+}).strict();
+var OmoMemoryRecallSchema = object({
+ enabled: boolean2().default(true),
+ max_items: number2().int().min(1).max(5).default(2),
+ category: string2().min(1).default("quick"),
+ event_caps: OmoMemoryRecallEventCapsSchema.default({ tool_args: 400, result_head: 600, assistant: 1500, prompt: 4000 }),
+ sidecar_max_tokens: number2().int().positive().default(48000),
+ max_concurrent_wakes: number2().int().positive().default(2),
+ tool_budget: number2().int().positive().default(8)
+}).strict();
+var OmoMemoryNudgeSchema = object({
+ enabled: boolean2().default(true),
+ every_user_turns: number2().int().min(1).default(10)
+}).strict();
+var OmoMemoryFactsSchema = object({
+ enabled: boolean2().default(true),
+ debounce_settles: number2().int().min(1).default(4)
+}).strict();
+var OmoMemoryDreamSchema = object({
+ enabled: boolean2().default(true),
+ idle_minutes: number2().int().min(0).default(30),
+ min_hours_between: number2().int().min(1).default(24),
+ shutdown_launch: boolean2().default(true),
+ auto_select_max: number2().int().min(1).max(10).default(5),
+ auto_select_max_chars: number2().int().min(1e4).default(150000)
+}).strict();
+var OmoMemoryPeopleSchema = object({
+ enabled: boolean2().default(true),
+ max_entries: number2().int().min(1).max(100).default(40),
+ max_entry_chars: number2().int().min(50).max(500).default(200)
+}).strict();
+var OmoMemorySoulSchema = object({
+ edit_notice: boolean2().default(true)
+}).strict();
+var OmoMemoryWriteNoticeSchema = object({
+ enabled: boolean2().default(true)
+}).strict();
+var OmoMemoryReflectionTriggerLayerSchema = object({
+ step_count: number2().int().nonnegative().optional(),
+ on_compaction: boolean2().optional()
+}).strict();
+var OmoMemoryReflectionLayerSchema = object({
+ enabled: boolean2().optional(),
+ trigger: OmoMemoryReflectionTriggerLayerSchema.optional(),
+ merge: _enum(["auto", "integration"]).optional(),
+ category: string2().min(1).optional(),
+ timeout_minutes: number2().int().positive().optional(),
+ sandbox: _enum(["auto", "required", "off"]).optional()
+}).strict();
+var OmoMemorySyncLayerSchema = object({
+ remote: string2().min(1).optional(),
+ enabled: boolean2().optional()
+}).strict();
+var OmoMemorySearchLayerSchema = object({
+ enabled: boolean2().optional()
+}).strict();
+var OmoMemoryRecallEventCapsLayerSchema = object({
+ tool_args: number2().int().nonnegative().optional(),
+ result_head: number2().int().nonnegative().optional(),
+ assistant: number2().int().nonnegative().optional(),
+ prompt: number2().int().nonnegative().optional()
+}).strict();
+var OmoMemoryRecallLayerSchema = object({
+ enabled: boolean2().optional(),
+ max_items: number2().int().min(1).max(5).optional(),
+ category: string2().min(1).optional(),
+ event_caps: OmoMemoryRecallEventCapsLayerSchema.optional(),
+ sidecar_max_tokens: number2().int().positive().optional(),
+ max_concurrent_wakes: number2().int().positive().optional(),
+ tool_budget: number2().int().positive().optional()
+}).strict();
+var OmoMemoryNudgeLayerSchema = object({
+ enabled: boolean2().optional(),
+ every_user_turns: number2().int().min(1).optional()
+}).strict();
+var OmoMemoryFactsLayerSchema = object({
+ enabled: boolean2().optional(),
+ debounce_settles: number2().int().min(1).optional()
+}).strict();
+var OmoMemoryDreamLayerSchema = object({
+ enabled: boolean2().optional(),
+ idle_minutes: number2().int().min(0).optional(),
+ min_hours_between: number2().int().min(1).optional(),
+ shutdown_launch: boolean2().optional(),
+ auto_select_max: number2().int().min(1).max(10).optional(),
+ auto_select_max_chars: number2().int().min(1e4).optional()
+}).strict();
+var OmoMemoryPeopleLayerSchema = object({
+ enabled: boolean2().optional(),
+ max_entries: number2().int().min(1).max(100).optional(),
+ max_entry_chars: number2().int().min(50).max(500).optional()
+}).strict();
+var OmoMemorySoulLayerSchema = object({
+ edit_notice: boolean2().optional()
+}).strict();
+var OmoMemoryWriteNoticeLayerSchema = object({
+ enabled: boolean2().optional()
+}).strict();
+var OmoMemoryAgentOverridesSchema = object({
+ enabled: boolean2().optional(),
+ agent: string2().min(1).optional(),
+ reflection: OmoMemoryReflectionLayerSchema.optional(),
+ nudge: OmoMemoryNudgeLayerSchema.optional(),
+ facts: OmoMemoryFactsLayerSchema.optional(),
+ dream: OmoMemoryDreamLayerSchema.optional(),
+ people: OmoMemoryPeopleLayerSchema.optional(),
+ soul: OmoMemorySoulLayerSchema.optional(),
+ write_notice: OmoMemoryWriteNoticeLayerSchema.optional(),
+ sync: OmoMemorySyncLayerSchema.optional(),
+ search: OmoMemorySearchLayerSchema.optional(),
+ recall: OmoMemoryRecallLayerSchema.optional(),
+ compile_warn_tokens: number2().int().positive().optional()
+}).strict();
+var OmoMemorySettingsSchema = object({
+ enabled: boolean2().default(true),
+ agent: string2().min(1).default("auto"),
+ reflection: OmoMemoryReflectionSchema.default({
+ enabled: true,
+ trigger: { step_count: 25, on_compaction: true },
+ merge: "auto",
+ category: "quick",
+ timeout_minutes: 15,
+ sandbox: "auto"
+ }),
+ nudge: OmoMemoryNudgeSchema.default({ enabled: true, every_user_turns: 10 }),
+ facts: OmoMemoryFactsSchema.default({ enabled: true, debounce_settles: 4 }),
+ dream: OmoMemoryDreamSchema.default({
+ enabled: true,
+ idle_minutes: 30,
+ min_hours_between: 24,
+ shutdown_launch: true,
+ auto_select_max: 5,
+ auto_select_max_chars: 150000
+ }),
+ people: OmoMemoryPeopleSchema.default({ enabled: true, max_entries: 40, max_entry_chars: 200 }),
+ soul: OmoMemorySoulSchema.default({ edit_notice: true }),
+ write_notice: OmoMemoryWriteNoticeSchema.default({ enabled: true }),
+ sync: OmoMemorySyncSchema.default({ enabled: true }),
+ search: OmoMemorySearchSchema.default({ enabled: true }),
+ recall: OmoMemoryRecallSchema.default({
+ enabled: true,
+ max_items: 2,
+ category: "quick",
+ event_caps: { tool_args: 400, result_head: 600, assistant: 1500, prompt: 4000 },
+ sidecar_max_tokens: 48000,
+ max_concurrent_wakes: 2,
+ tool_budget: 8
+ }),
+ compile_warn_tokens: number2().int().positive().default(30000),
+ agents: record(string2(), OmoMemoryAgentOverridesSchema).default({})
+}).strict();
+var OmoMemorySettingsLayerSchema = object({
+ enabled: boolean2().optional(),
+ agent: string2().min(1).optional(),
+ reflection: OmoMemoryReflectionLayerSchema.optional(),
+ nudge: OmoMemoryNudgeLayerSchema.optional(),
+ facts: OmoMemoryFactsLayerSchema.optional(),
+ dream: OmoMemoryDreamLayerSchema.optional(),
+ people: OmoMemoryPeopleLayerSchema.optional(),
+ soul: OmoMemorySoulLayerSchema.optional(),
+ write_notice: OmoMemoryWriteNoticeLayerSchema.optional(),
+ sync: OmoMemorySyncLayerSchema.optional(),
+ search: OmoMemorySearchLayerSchema.optional(),
+ recall: OmoMemoryRecallLayerSchema.optional(),
+ compile_warn_tokens: number2().int().positive().optional(),
+ agents: record(string2(), OmoMemoryAgentOverridesSchema).optional()
+}).strict();
+
+// ../../omo-config-core/src/schema/model-catalog.ts
+function isRecord5(value) {
+ return typeof value === "object" && value !== null && !Array.isArray(value);
+}
+var OmoModelCatalogEntryInputSchema = object({
+ model: string2(),
+ reasoning: OmoReasoningSchema.optional(),
+ variant: string2().optional(),
+ reasoningEffort: OmoReasoningEffortSchema.optional()
+}).strict();
+var OmoModelCatalogEntrySchema = preprocess((value) => isRecord5(value) ? normalizeLegacyModelFields(value) : value, OmoModelCatalogEntryInputSchema);
+var OmoModelCatalogSchema = record(string2(), OmoModelCatalogEntrySchema);
+var OmoModelCatalogEntryLayerInputSchema = OmoModelCatalogEntryInputSchema.partial();
+var OmoModelCatalogEntryLayerSchema = preprocess((value) => isRecord5(value) ? normalizeLegacyModelFields(value) : value, OmoModelCatalogEntryLayerInputSchema);
+var OmoModelCatalogLayerSchema = record(string2(), OmoModelCatalogEntryLayerSchema);
+
+// ../../omo-config-core/src/schema/model-profile.ts
+function isRecord6(value) {
+ return typeof value === "object" && value !== null && !Array.isArray(value);
+}
+var OmoModelProfileInputSchema = object({
+ display_name: string2().optional(),
+ models: array(union([string2(), OmoFallbackModelObjectSchema])).optional()
+}).strict();
+var OmoModelProfileSchema = preprocess((value) => isRecord6(value) ? normalizeLegacyModelFields(value) : value, OmoModelProfileInputSchema);
+var OmoModelProfilesSchema = record(string2(), OmoModelProfileSchema);
+var OmoModelProfileLayerInputSchema = OmoModelProfileInputSchema.partial();
+var OmoModelProfileLayerSchema = preprocess((value) => isRecord6(value) ? normalizeLegacyModelFields(value) : value, OmoModelProfileLayerInputSchema);
+var OmoModelProfilesLayerSchema = record(string2(), OmoModelProfileLayerSchema);
+
+// ../../omo-config-core/src/schema/task.ts
+import { availableParallelism } from "node:os";
+var DEFAULT_RESIDENCY_MAX_CHILDREN = 16;
+var ResidencyMaxChildrenInputSchema = union([number2().int().nonnegative(), literal("unlimited")]);
+var OmoTaskWaitSchema = object({
+ min_ms: number2().int().positive().default(5000),
+ default_ms: number2().int().positive().default(60000),
+ max_ms: number2().int().positive().default(600000)
+}).strict();
+var OmoTaskTeamSettingsSchema = object({
+ max_members: number2().int().min(1).max(8).default(8),
+ max_parallel_members: number2().int().min(1).max(8).default(4),
+ max_wall_clock_minutes: number2().int().positive().default(120)
+}).strict();
+var OmoTaskWarningsSchema = object({
+ unavailable_categories: boolean2().default(true)
+}).strict();
+var OmoTaskDagSettingsSchema = object({
+ max_nodes_per_run: number2().int().positive().default(64),
+ max_runs_per_session: number2().int().positive().default(16),
+ subscriber_ring: number2().int().positive().default(1000),
+ heartbeat_ms: number2().int().positive().default(15000),
+ history_default_limit: number2().int().positive().default(256),
+ history_max_limit: number2().int().positive().default(1000),
+ retention_days: number2().int().positive().default(7),
+ max_prompt_bytes: number2().int().positive().default(262144)
+}).strict();
+var OmoTaskSettingsSchema = object({
+ default_execution_mode: _enum(["in-process", "process"]).default("in-process"),
+ default_concurrency: number2().int().nonnegative().default(5),
+ global_concurrency: number2().int().nonnegative().default(8),
+ provider_concurrency: record(string2(), number2().int().nonnegative()).optional(),
+ model_concurrency: record(string2(), number2().int().nonnegative()).optional(),
+ max_depth: number2().int().nonnegative().default(1),
+ residency_max_children: ResidencyMaxChildrenInputSchema.default(8),
+ ttl_ms: number2().int().positive().default(86400000),
+ state_dir: string2().optional(),
+ reattach_on_reconcile: boolean2().optional(),
+ resume_children: boolean2().default(true),
+ warnings: OmoTaskWarningsSchema.default({ unavailable_categories: true }),
+ wait: OmoTaskWaitSchema.default({ min_ms: 5000, default_ms: 60000, max_ms: 600000 }),
+ team: OmoTaskTeamSettingsSchema.default({
+ max_members: 8,
+ max_parallel_members: 4,
+ max_wall_clock_minutes: 120
+ }),
+ dag: OmoTaskDagSettingsSchema.optional()
+}).strict();
+var OmoTaskDagSettingsLayerSchema = object({
+ max_nodes_per_run: number2().int().positive().optional(),
+ max_runs_per_session: number2().int().positive().optional(),
+ subscriber_ring: number2().int().positive().optional(),
+ heartbeat_ms: number2().int().positive().optional(),
+ history_default_limit: number2().int().positive().optional(),
+ history_max_limit: number2().int().positive().optional(),
+ retention_days: number2().int().positive().optional(),
+ max_prompt_bytes: number2().int().positive().optional()
+}).strict();
+var OmoTaskWaitLayerSchema = object({
+ min_ms: number2().int().positive().optional(),
+ default_ms: number2().int().positive().optional(),
+ max_ms: number2().int().positive().optional()
+}).strict();
+var OmoTaskTeamSettingsLayerSchema = object({
+ max_members: number2().int().min(1).max(8).optional(),
+ max_parallel_members: number2().int().min(1).max(8).optional(),
+ max_wall_clock_minutes: number2().int().positive().optional()
+}).strict();
+var OmoTaskWarningsLayerSchema = object({
+ unavailable_categories: boolean2().optional()
+}).strict();
+var OmoTaskSettingsLayerSchema = object({
+ default_execution_mode: _enum(["in-process", "process"]).optional(),
+ default_concurrency: number2().int().nonnegative().optional(),
+ global_concurrency: number2().int().nonnegative().optional(),
+ provider_concurrency: record(string2(), number2().int().nonnegative()).optional(),
+ model_concurrency: record(string2(), number2().int().nonnegative()).optional(),
+ max_depth: number2().int().nonnegative().optional(),
+ residency_max_children: ResidencyMaxChildrenInputSchema.optional(),
+ ttl_ms: number2().int().positive().optional(),
+ state_dir: string2().optional(),
+ reattach_on_reconcile: boolean2().optional(),
+ resume_children: boolean2().optional(),
+ warnings: OmoTaskWarningsLayerSchema.optional(),
+ wait: OmoTaskWaitLayerSchema.optional(),
+ team: OmoTaskTeamSettingsLayerSchema.optional(),
+ dag: OmoTaskDagSettingsLayerSchema.optional()
+}).strict();
+function resolveOmoTaskSettings(input, resolveParallelism = availableParallelism) {
+ const record2 = record(string2(), unknown()).parse(input);
+ return OmoTaskSettingsSchema.parse({
+ ...record2,
+ residency_max_children: record2["residency_max_children"] ?? Math.min(DEFAULT_RESIDENCY_MAX_CHILDREN, Math.max(8, resolveParallelism() * 2)),
+ global_concurrency: record2["global_concurrency"] ?? Math.max(8, resolveParallelism() * 2)
+ });
+}
+
+// ../../omo-config-core/src/schema/team.ts
+var OmoTeamMemberBaseSchema = object({
+ name: string2().min(1).regex(/^[a-z0-9-]+$/),
+ cwd: string2().optional(),
+ worktreePath: string2().optional(),
+ subscriptions: array(string2()).optional(),
+ backendType: _enum(["in-process", "tmux"]).default("in-process"),
+ color: string2().optional(),
+ isActive: boolean2().default(true)
+}).strict();
+var OmoTeamCategoryMemberSchema = OmoTeamMemberBaseSchema.extend({
+ kind: literal("category"),
+ category: string2().min(1),
+ prompt: string2().min(1)
+});
+var OmoTeamSubagentMemberSchema = OmoTeamMemberBaseSchema.extend({
+ kind: literal("subagent_type"),
+ subagent_type: string2().min(1),
+ prompt: string2().optional()
+});
+var OmoTeamMemberSchema = discriminatedUnion("kind", [
+ OmoTeamCategoryMemberSchema,
+ OmoTeamSubagentMemberSchema
+]);
+var OmoTeamSpecBaseSchema = object({
+ version: literal(1).default(1),
+ name: string2().min(1).regex(/^[a-z0-9-]+$/).optional(),
+ description: string2().optional(),
+ createdAt: number2().int().positive().optional(),
+ leadAgentId: string2().optional(),
+ teamAllowedPaths: array(string2()).optional(),
+ sessionPermission: string2().optional(),
+ members: array(OmoTeamMemberSchema).min(1).max(8)
+}).strict();
+var OmoTeamSpecSchema = OmoTeamSpecBaseSchema.superRefine((teamSpec, ctx) => {
+ if (teamSpec.leadAgentId === undefined && teamSpec.members.length > 1) {
+ ctx.addIssue({
+ code: "custom",
+ message: "leadAgentId required when a team has multiple members",
+ path: ["leadAgentId"]
+ });
+ }
+});
+var OmoTeamSpecLayerSchema = OmoTeamSpecBaseSchema.partial();
+var OmoTeamsConfigSchema = record(string2(), OmoTeamSpecSchema);
+var OmoTeamsConfigLayerSchema = record(string2(), OmoTeamSpecLayerSchema);
+
+// ../../omo-config-core/src/schema/telemetry.ts
+var OmoTelemetrySettingsShape = {
+ enabled: boolean2()
+};
+var OmoTelemetrySettingsLayerSchema = object(OmoTelemetrySettingsShape).partial().strict();
+var OmoTelemetrySettingsSchema = OmoTelemetrySettingsLayerSchema.extend({
+ enabled: boolean2().default(true)
+}).strict();
+
+// ../../omo-config-core/src/schema/format-on-mutation.ts
+var mode = _enum(["off", "best-effort", "required"]);
+var languages = record(string2(), boolean2()).optional();
+var OmoFormatOnMutationLayerSchema = object({
+ mode: mode.optional(),
+ languages,
+ maxFileBytes: number2().int().positive().optional(),
+ timeoutMs: number2().int().positive().optional()
+}).strict();
+var OmoFormatOnMutationSchema = OmoFormatOnMutationLayerSchema.extend({
+ mode: mode.default("best-effort"),
+ maxFileBytes: number2().int().positive().default(1048576),
+ timeoutMs: number2().int().positive().default(3000)
+}).strict();
+
+// ../../omo-config-core/src/schema/config.ts
+var OmoOpenCodeHarnessConfigSchema = record(string2(), unknown());
+var OmoTypedHarnessConfigSchema = object({
+ formatOnMutation: OmoFormatOnMutationLayerSchema.optional(),
+ categories: OmoCategoriesConfigSchema.optional(),
+ agents: OmoAgentsConfigSchema.optional(),
+ git_master: OmoGitMasterSettingsLayerSchema.optional(),
+ task: OmoTaskSettingsLayerSchema.optional(),
+ teams: OmoTeamsConfigLayerSchema.optional(),
+ models: OmoModelCatalogLayerSchema.optional(),
+ model_profiles: OmoModelProfilesLayerSchema.optional(),
+ model_profile: string2().optional(),
+ memory: OmoMemorySettingsLayerSchema.optional(),
+ telemetry: OmoTelemetrySettingsLayerSchema.optional()
+}).strict();
+var OmoConfigProfileSchema = object({
+ formatOnMutation: OmoFormatOnMutationLayerSchema.optional(),
+ categories: OmoCategoriesConfigSchema.optional(),
+ agents: OmoAgentsConfigSchema.optional(),
+ git_master: OmoGitMasterSettingsLayerSchema.optional(),
+ task: OmoTaskSettingsLayerSchema.optional(),
+ teams: OmoTeamsConfigLayerSchema.optional(),
+ models: OmoModelCatalogLayerSchema.optional(),
+ model_profiles: OmoModelProfilesLayerSchema.optional(),
+ model_profile: string2().optional(),
+ memory: OmoMemorySettingsLayerSchema.optional(),
+ telemetry: OmoTelemetrySettingsLayerSchema.optional(),
+ "[opencode]": OmoOpenCodeHarnessConfigSchema.optional(),
+ "[senpi]": OmoTypedHarnessConfigSchema.optional(),
+ "[codex]": OmoTypedHarnessConfigSchema.optional()
+}).strict();
+var OmoConfigSchema = object({
+ formatOnMutation: OmoFormatOnMutationSchema.optional(),
+ $schema: string2().optional(),
+ categories: OmoCategoriesConfigSchema.optional(),
+ agents: OmoAgentsConfigSchema.optional(),
+ git_master: OmoGitMasterSettingsSchema.optional(),
+ task: OmoTaskSettingsSchema.optional(),
+ teams: OmoTeamsConfigSchema.optional(),
+ models: OmoModelCatalogSchema.optional(),
+ model_profiles: OmoModelProfilesSchema.optional(),
+ model_profile: string2().optional(),
+ memory: OmoMemorySettingsSchema.optional(),
+ telemetry: OmoTelemetrySettingsSchema.optional(),
+ "[opencode]": OmoOpenCodeHarnessConfigSchema.optional(),
+ "[senpi]": OmoTypedHarnessConfigSchema.optional(),
+ "[codex]": OmoTypedHarnessConfigSchema.optional(),
+ profiles: record(string2(), OmoConfigProfileSchema).default({}),
+ _migrations: array(string2()).optional(),
+ legacy_migrations: record(string2(), unknown()).optional()
+}).strict();
+var OmoConfigLayerSchema = object({
+ formatOnMutation: OmoFormatOnMutationLayerSchema.optional(),
+ $schema: string2().optional(),
+ categories: OmoCategoriesConfigSchema.optional(),
+ agents: OmoAgentsConfigSchema.optional(),
+ git_master: OmoGitMasterSettingsLayerSchema.optional(),
+ task: OmoTaskSettingsLayerSchema.optional(),
+ teams: OmoTeamsConfigLayerSchema.optional(),
+ models: OmoModelCatalogLayerSchema.optional(),
+ model_profiles: OmoModelProfilesLayerSchema.optional(),
+ model_profile: string2().optional(),
+ memory: OmoMemorySettingsLayerSchema.optional(),
+ telemetry: OmoTelemetrySettingsLayerSchema.optional(),
+ "[opencode]": OmoOpenCodeHarnessConfigSchema.optional(),
+ "[senpi]": OmoTypedHarnessConfigSchema.optional(),
+ "[codex]": OmoTypedHarnessConfigSchema.optional(),
+ profiles: record(string2(), OmoConfigProfileSchema).optional(),
+ _migrations: array(string2()).optional(),
+ legacy_migrations: record(string2(), unknown()).optional()
+}).strict();
+
+// ../../../node_modules/.bun/[email protected]/node_modules/jsonc-parser/lib/esm/impl/scanner.js
+function createScanner(text, ignoreTrivia = false) {
+ const len = text.length;
+ let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
+ function scanHexDigits(count, exact) {
+ let digits = 0;
+ let value = 0;
+ while (digits < count || !exact) {
+ let ch = text.charCodeAt(pos);
+ if (ch >= 48 && ch <= 57) {
+ value = value * 16 + ch - 48;
+ } else if (ch >= 65 && ch <= 70) {
+ value = value * 16 + ch - 65 + 10;
+ } else if (ch >= 97 && ch <= 102) {
+ value = value * 16 + ch - 97 + 10;
+ } else {
+ break;
+ }
+ pos++;
+ digits++;
+ }
+ if (digits < count) {
+ value = -1;
+ }
+ return value;
+ }
+ function setPosition(newPosition) {
+ pos = newPosition;
+ value = "";
+ tokenOffset = 0;
+ token = 16;
+ scanError = 0;
+ }
+ function scanNumber() {
+ let start = pos;
+ if (text.charCodeAt(pos) === 48) {
+ pos++;
+ } else {
+ pos++;
+ while (pos < text.length && isDigit(text.charCodeAt(pos))) {
+ pos++;
+ }
+ }
+ if (pos < text.length && text.charCodeAt(pos) === 46) {
+ pos++;
+ if (pos < text.length && isDigit(text.charCodeAt(pos))) {
+ pos++;
+ while (pos < text.length && isDigit(text.charCodeAt(pos))) {
+ pos++;
+ }
+ } else {
+ scanError = 3;
+ return text.substring(start, pos);
+ }
+ }
+ let end = pos;
+ if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
+ pos++;
+ if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
+ pos++;
+ }
+ if (pos < text.length && isDigit(text.charCodeAt(pos))) {
+ pos++;
+ while (pos < text.length && isDigit(text.charCodeAt(pos))) {
+ pos++;
+ }
+ end = pos;
+ } else {
+ scanError = 3;
+ }
+ }
+ return text.substring(start, end);
+ }
+ function scanString() {
+ let result = "", start = pos;
+ while (true) {
+ if (pos >= len) {
+ result += text.substring(start, pos);
+ scanError = 2;
+ break;
+ }
+ const ch = text.charCodeAt(pos);
+ if (ch === 34) {
+ result += text.substring(start, pos);
+ pos++;
+ break;
+ }
+ if (ch === 92) {
+ result += text.substring(start, pos);
+ pos++;
+ if (pos >= len) {
+ scanError = 2;
+ break;
+ }
+ const ch2 = text.charCodeAt(pos++);
+ switch (ch2) {
+ case 34:
+ result += '"';
+ break;
+ case 92:
+ result += "\\";
+ break;
+ case 47:
+ result += "/";
+ break;
+ case 98:
+ result += "\b";
+ break;
+ case 102:
+ result += "\f";
+ break;
+ case 110:
+ result += `
+`;
+ break;
+ case 114:
+ result += "\r";
+ break;
+ case 116:
+ result += "\t";
+ break;
+ case 117:
+ const ch3 = scanHexDigits(4, true);
+ if (ch3 >= 0) {
+ result += String.fromCharCode(ch3);
+ } else {
+ scanError = 4;
+ }
+ break;
+ default:
+ scanError = 5;
+ }
+ start = pos;
+ continue;
+ }
+ if (ch >= 0 && ch <= 31) {
+ if (isLineBreak(ch)) {
+ result += text.substring(start, pos);
+ scanError = 2;
+ break;
+ } else {
+ scanError = 6;
+ }
+ }
+ pos++;
+ }
+ return result;
+ }
+ function scanNext() {
+ value = "";
+ scanError = 0;
+ tokenOffset = pos;
+ lineStartOffset = lineNumber;
+ prevTokenLineStartOffset = tokenLineStartOffset;
+ if (pos >= len) {
+ tokenOffset = len;
+ return token = 17;
+ }
+ let code = text.charCodeAt(pos);
+ if (isWhiteSpace(code)) {
+ do {
+ pos++;
+ value += String.fromCharCode(code);
+ code = text.charCodeAt(pos);
+ } while (isWhiteSpace(code));
+ return token = 15;
+ }
+ if (isLineBreak(code)) {
+ pos++;
+ value += String.fromCharCode(code);
+ if (code === 13 && text.charCodeAt(pos) === 10) {
+ pos++;
+ value += `
+`;
+ }
+ lineNumber++;
+ tokenLineStartOffset = pos;
+ return token = 14;
+ }
+ switch (code) {
+ case 123:
+ pos++;
+ return token = 1;
+ case 125:
+ pos++;
+ return token = 2;
+ case 91:
+ pos++;
+ return token = 3;
+ case 93:
+ pos++;
+ return token = 4;
+ case 58:
+ pos++;
+ return token = 6;
+ case 44:
+ pos++;
+ return token = 5;
+ case 34:
+ pos++;
+ value = scanString();
+ return token = 10;
+ case 47:
+ const start = pos - 1;
+ if (text.charCodeAt(pos + 1) === 47) {
+ pos += 2;
+ while (pos < len) {
+ if (isLineBreak(text.charCodeAt(pos))) {
+ break;
+ }
+ pos++;
+ }
+ value = text.substring(start, pos);
+ return token = 12;
+ }
+ if (text.charCodeAt(pos + 1) === 42) {
+ pos += 2;
+ const safeLength = len - 1;
+ let commentClosed = false;
+ while (pos < safeLength) {
+ const ch = text.charCodeAt(pos);
+ if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
+ pos += 2;
+ commentClosed = true;
+ break;
+ }
+ pos++;
+ if (isLineBreak(ch)) {
+ if (ch === 13 && text.charCodeAt(pos) === 10) {
+ pos++;
+ }
+ lineNumber++;
+ tokenLineStartOffset = pos;
+ }
+ }
+ if (!commentClosed) {
+ pos++;
+ scanError = 1;
+ }
+ value = text.substring(start, pos);
+ return token = 13;
+ }
+ value += String.fromCharCode(code);
+ pos++;
+ return token = 16;
+ case 45:
+ value += String.fromCharCode(code);
+ pos++;
+ if (pos === len || !isDigit(text.charCodeAt(pos))) {
+ return token = 16;
+ }
+ case 48:
+ case 49:
+ case 50:
+ case 51:
+ case 52:
+ case 53:
+ case 54:
+ case 55:
+ case 56:
+ case 57:
+ value += scanNumber();
+ return token = 11;
+ default:
+ while (pos < len && isUnknownContentCharacter(code)) {
+ pos++;
+ code = text.charCodeAt(pos);
+ }
+ if (tokenOffset !== pos) {
+ value = text.substring(tokenOffset, pos);
+ switch (value) {
+ case "true":
+ return token = 8;
+ case "false":
+ return token = 9;
+ case "null":
+ return token = 7;
+ }
+ return token = 16;
+ }
+ value += String.fromCharCode(code);
+ pos++;
+ return token = 16;
+ }
+ }
+ function isUnknownContentCharacter(code) {
+ if (isWhiteSpace(code) || isLineBreak(code)) {
+ return false;
+ }
+ switch (code) {
+ case 125:
+ case 93:
+ case 123:
+ case 91:
+ case 34:
+ case 58:
+ case 44:
+ case 47:
+ return false;
+ }
+ return true;
+ }
+ function scanNextNonTrivia() {
+ let result;
+ do {
+ result = scanNext();
+ } while (result >= 12 && result <= 15);
+ return result;
+ }
+ return {
+ setPosition,
+ getPosition: () => pos,
+ scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
+ getToken: () => token,
+ getTokenValue: () => value,
+ getTokenOffset: () => tokenOffset,
+ getTokenLength: () => pos - tokenOffset,
+ getTokenStartLine: () => lineStartOffset,
+ getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,
+ getTokenError: () => scanError
+ };
+}
+function isWhiteSpace(ch) {
+ return ch === 32 || ch === 9;
+}
+function isLineBreak(ch) {
+ return ch === 10 || ch === 13;
+}
+function isDigit(ch) {
+ return ch >= 48 && ch <= 57;
+}
+var CharacterCodes;
+(function(CharacterCodes) {
+ CharacterCodes[CharacterCodes["lineFeed"] = 10] = "lineFeed";
+ CharacterCodes[CharacterCodes["carriageReturn"] = 13] = "carriageReturn";
+ CharacterCodes[CharacterCodes["space"] = 32] = "space";
+ CharacterCodes[CharacterCodes["_0"] = 48] = "_0";
+ CharacterCodes[CharacterCodes["_1"] = 49] = "_1";
+ CharacterCodes[CharacterCodes["_2"] = 50] = "_2";
+ CharacterCodes[CharacterCodes["_3"] = 51] = "_3";
+ CharacterCodes[CharacterCodes["_4"] = 52] = "_4";
+ CharacterCodes[CharacterCodes["_5"] = 53] = "_5";
+ CharacterCodes[CharacterCodes["_6"] = 54] = "_6";
+ CharacterCodes[CharacterCodes["_7"] = 55] = "_7";
+ CharacterCodes[CharacterCodes["_8"] = 56] = "_8";
+ CharacterCodes[CharacterCodes["_9"] = 57] = "_9";
+ CharacterCodes[CharacterCodes["a"] = 97] = "a";
+ CharacterCodes[CharacterCodes["b"] = 98] = "b";
+ CharacterCodes[CharacterCodes["c"] = 99] = "c";
+ CharacterCodes[CharacterCodes["d"] = 100] = "d";
+ CharacterCodes[CharacterCodes["e"] = 101] = "e";
+ CharacterCodes[CharacterCodes["f"] = 102] = "f";
+ CharacterCodes[CharacterCodes["g"] = 103] = "g";
+ CharacterCodes[CharacterCodes["h"] = 104] = "h";
+ CharacterCodes[CharacterCodes["i"] = 105] = "i";
+ CharacterCodes[CharacterCodes["j"] = 106] = "j";
+ CharacterCodes[CharacterCodes["k"] = 107] = "k";
+ CharacterCodes[CharacterCodes["l"] = 108] = "l";
+ CharacterCodes[CharacterCodes["m"] = 109] = "m";
+ CharacterCodes[CharacterCodes["n"] = 110] = "n";
+ CharacterCodes[CharacterCodes["o"] = 111] = "o";
+ CharacterCodes[CharacterCodes["p"] = 112] = "p";
+ CharacterCodes[CharacterCodes["q"] = 113] = "q";
+ CharacterCodes[CharacterCodes["r"] = 114] = "r";
+ CharacterCodes[CharacterCodes["s"] = 115] = "s";
+ CharacterCodes[CharacterCodes["t"] = 116] = "t";
+ CharacterCodes[CharacterCodes["u"] = 117] = "u";
+ CharacterCodes[CharacterCodes["v"] = 118] = "v";
+ CharacterCodes[CharacterCodes["w"] = 119] = "w";
+ CharacterCodes[CharacterCodes["x"] = 120] = "x";
+ CharacterCodes[CharacterCodes["y"] = 121] = "y";
+ CharacterCodes[CharacterCodes["z"] = 122] = "z";
+ CharacterCodes[CharacterCodes["A"] = 65] = "A";
+ CharacterCodes[CharacterCodes["B"] = 66] = "B";
+ CharacterCodes[CharacterCodes["C"] = 67] = "C";
+ CharacterCodes[CharacterCodes["D"] = 68] = "D";
+ CharacterCodes[CharacterCodes["E"] = 69] = "E";
+ CharacterCodes[CharacterCodes["F"] = 70] = "F";
+ CharacterCodes[CharacterCodes["G"] = 71] = "G";
+ CharacterCodes[CharacterCodes["H"] = 72] = "H";
+ CharacterCodes[CharacterCodes["I"] = 73] = "I";
+ CharacterCodes[CharacterCodes["J"] = 74] = "J";
+ CharacterCodes[CharacterCodes["K"] = 75] = "K";
+ CharacterCodes[CharacterCodes["L"] = 76] = "L";
+ CharacterCodes[CharacterCodes["M"] = 77] = "M";
+ CharacterCodes[CharacterCodes["N"] = 78] = "N";
+ CharacterCodes[CharacterCodes["O"] = 79] = "O";
+ CharacterCodes[CharacterCodes["P"] = 80] = "P";
+ CharacterCodes[CharacterCodes["Q"] = 81] = "Q";
+ CharacterCodes[CharacterCodes["R"] = 82] = "R";
+ CharacterCodes[CharacterCodes["S"] = 83] = "S";
+ CharacterCodes[CharacterCodes["T"] = 84] = "T";
+ CharacterCodes[CharacterCodes["U"] = 85] = "U";
+ CharacterCodes[CharacterCodes["V"] = 86] = "V";
+ CharacterCodes[CharacterCodes["W"] = 87] = "W";
+ CharacterCodes[CharacterCodes["X"] = 88] = "X";
+ CharacterCodes[CharacterCodes["Y"] = 89] = "Y";
+ CharacterCodes[CharacterCodes["Z"] = 90] = "Z";
+ CharacterCodes[CharacterCodes["asterisk"] = 42] = "asterisk";
+ CharacterCodes[CharacterCodes["backslash"] = 92] = "backslash";
+ CharacterCodes[CharacterCodes["closeBrace"] = 125] = "closeBrace";
+ CharacterCodes[CharacterCodes["closeBracket"] = 93] = "closeBracket";
+ CharacterCodes[CharacterCodes["colon"] = 58] = "colon";
+ CharacterCodes[CharacterCodes["comma"] = 44] = "comma";
+ CharacterCodes[CharacterCodes["dot"] = 46] = "dot";
+ CharacterCodes[CharacterCodes["doubleQuote"] = 34] = "doubleQuote";
+ CharacterCodes[CharacterCodes["minus"] = 45] = "minus";
+ CharacterCodes[CharacterCodes["openBrace"] = 123] = "openBrace";
+ CharacterCodes[CharacterCodes["openBracket"] = 91] = "openBracket";
+ CharacterCodes[CharacterCodes["plus"] = 43] = "plus";
+ CharacterCodes[CharacterCodes["slash"] = 47] = "slash";
+ CharacterCodes[CharacterCodes["formFeed"] = 12] = "formFeed";
+ CharacterCodes[CharacterCodes["tab"] = 9] = "tab";
+})(CharacterCodes || (CharacterCodes = {}));
+
+// ../../../node_modules/.bun/[email protected]/node_modules/jsonc-parser/lib/esm/impl/string-intern.js
+var cachedSpaces = new Array(20).fill(0).map((_, index) => {
+ return " ".repeat(index);
+});
+var maxCachedValues = 200;
+var cachedBreakLinesWithSpaces = {
+ " ": {
+ "\n": new Array(maxCachedValues).fill(0).map((_, index) => {
+ return `
+` + " ".repeat(index);
+ }),
+ "\r": new Array(maxCachedValues).fill(0).map((_, index) => {
+ return "\r" + " ".repeat(index);
+ }),
+ "\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
+ return `\r
+` + " ".repeat(index);
+ })
+ },
+ "\t": {
+ "\n": new Array(maxCachedValues).fill(0).map((_, index) => {
+ return `
+` + "\t".repeat(index);
+ }),
+ "\r": new Array(maxCachedValues).fill(0).map((_, index) => {
+ return "\r" + "\t".repeat(index);
+ }),
+ "\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
+ return `\r
+` + "\t".repeat(index);
+ })
+ }
+};
+
+// ../../../node_modules/.bun/[email protected]/node_modules/jsonc-parser/lib/esm/impl/parser.js
+var ParseOptions;
+(function(ParseOptions) {
+ ParseOptions.DEFAULT = {
+ allowTrailingComma: false
+ };
+})(ParseOptions || (ParseOptions = {}));
+function parse4(text, errors = [], options = ParseOptions.DEFAULT) {
+ let currentProperty = null;
+ let currentParent = [];
+ const previousParents = [];
+ function onValue(value) {
+ if (Array.isArray(currentParent)) {
+ currentParent.push(value);
+ } else if (currentProperty !== null) {
+ currentParent[currentProperty] = value;
+ }
+ }
+ const visitor = {
+ onObjectBegin: () => {
+ const object = {};
+ onValue(object);
+ previousParents.push(currentParent);
+ currentParent = object;
+ currentProperty = null;
+ },
+ onObjectProperty: (name) => {
+ currentProperty = name;
+ },
+ onObjectEnd: () => {
+ currentParent = previousParents.pop();
+ },
+ onArrayBegin: () => {
+ const array = [];
+ onValue(array);
+ previousParents.push(currentParent);
+ currentParent = array;
+ currentProperty = null;
+ },
+ onArrayEnd: () => {
+ currentParent = previousParents.pop();
+ },
+ onLiteralValue: onValue,
+ onError: (error, offset, length) => {
+ errors.push({ error, offset, length });
+ }
+ };
+ visit(text, visitor, options);
+ return currentParent[0];
+}
+function visit(text, visitor, options = ParseOptions.DEFAULT) {
+ const _scanner = createScanner(text, false);
+ const _jsonPath = [];
+ let suppressedCallbacks = 0;
+ function toNoArgVisit(visitFunction) {
+ return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
+ }
+ function toOneArgVisit(visitFunction) {
+ return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
+ }
+ function toOneArgVisitWithPath(visitFunction) {
+ return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
+ }
+ function toBeginVisit(visitFunction) {
+ return visitFunction ? () => {
+ if (suppressedCallbacks > 0) {
+ suppressedCallbacks++;
+ } else {
+ let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());
+ if (cbReturn === false) {
+ suppressedCallbacks = 1;
+ }
+ }
+ } : () => true;
+ }
+ function toEndVisit(visitFunction) {
+ return visitFunction ? () => {
+ if (suppressedCallbacks > 0) {
+ suppressedCallbacks--;
+ }
+ if (suppressedCallbacks === 0) {
+ visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
+ }
+ } : () => true;
+ }
+ const onObjectBegin = toBeginVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toEndVisit(visitor.onObjectEnd), onArrayBegin = toBeginVisit(visitor.onArrayBegin), onArrayEnd = toEndVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);
+ const disallowComments = options && options.disallowComments;
+ const allowTrailingComma = options && options.allowTrailingComma;
+ function scanNext() {
+ while (true) {
+ const token = _scanner.scan();
+ switch (_scanner.getTokenError()) {
+ case 4:
+ handleError(14);
+ break;
+ case 5:
+ handleError(15);
+ break;
+ case 3:
+ handleError(13);
+ break;
+ case 1:
+ if (!disallowComments) {
+ handleError(11);
+ }
+ break;
+ case 2:
+ handleError(12);
+ break;
+ case 6:
+ handleError(16);
+ break;
+ }
+ switch (token) {
+ case 12:
+ case 13:
+ if (disallowComments) {
+ handleError(10);
+ } else {
+ onComment();
+ }
+ break;
+ case 16:
+ handleError(1);
+ break;
+ case 15:
+ case 14:
+ break;
+ default:
+ return token;
+ }
+ }
+ }
+ function handleError(error, skipUntilAfter = [], skipUntil = []) {
+ onError(error);
+ if (skipUntilAfter.length + skipUntil.length > 0) {
+ let token = _scanner.getToken();
+ while (token !== 17) {
+ if (skipUntilAfter.indexOf(token) !== -1) {
+ scanNext();
+ break;
+ } else if (skipUntil.indexOf(token) !== -1) {
+ break;
+ }
+ token = scanNext();
+ }
+ }
+ }
+ function parseString(isValue) {
+ const value = _scanner.getTokenValue();
+ if (isValue) {
+ onLiteralValue(value);
+ } else {
+ onObjectProperty(value);
+ _jsonPath.push(value);
+ }
+ scanNext();
+ return true;
+ }
+ function parseLiteral() {
+ switch (_scanner.getToken()) {
+ case 11:
+ const tokenValue = _scanner.getTokenValue();
+ let value = Number(tokenValue);
+ if (isNaN(value)) {
+ handleError(2);
+ value = 0;
+ }
+ onLiteralValue(value);
+ break;
+ case 7:
+ onLiteralValue(null);
+ break;
+ case 8:
+ onLiteralValue(true);
+ break;
+ case 9:
+ onLiteralValue(false);
+ break;
+ default:
+ return false;
+ }
+ scanNext();
+ return true;
+ }
+ function parseProperty() {
+ if (_scanner.getToken() !== 10) {
+ handleError(3, [], [2, 5]);
+ return false;
+ }
+ parseString(false);
+ if (_scanner.getToken() === 6) {
+ onSeparator(":");
+ scanNext();
+ if (!parseValue()) {
+ handleError(4, [], [2, 5]);
+ }
+ } else {
+ handleError(5, [], [2, 5]);
+ }
+ _jsonPath.pop();
+ return true;
+ }
+ function parseObject() {
+ onObjectBegin();
+ scanNext();
+ let needsComma = false;
+ while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
+ if (_scanner.getToken() === 5) {
+ if (!needsComma) {
+ handleError(4, [], []);
+ }
+ onSeparator(",");
+ scanNext();
+ if (_scanner.getToken() === 2 && allowTrailingComma) {
+ break;
+ }
+ } else if (needsComma) {
+ handleError(6, [], []);
+ }
+ if (!parseProperty()) {
+ handleError(4, [], [2, 5]);
+ }
+ needsComma = true;
+ }
+ onObjectEnd();
+ if (_scanner.getToken() !== 2) {
+ handleError(7, [2], []);
+ } else {
+ scanNext();
+ }
+ return true;
+ }
+ function parseArray() {
+ onArrayBegin();
+ scanNext();
+ let isFirstElement = true;
+ let needsComma = false;
+ while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
+ if (_scanner.getToken() === 5) {
+ if (!needsComma) {
+ handleError(4, [], []);
+ }
+ onSeparator(",");
+ scanNext();
+ if (_scanner.getToken() === 4 && allowTrailingComma) {
+ break;
+ }
+ } else if (needsComma) {
+ handleError(6, [], []);
+ }
+ if (isFirstElement) {
+ _jsonPath.push(0);
+ isFirstElement = false;
+ } else {
+ _jsonPath[_jsonPath.length - 1]++;
+ }
+ if (!parseValue()) {
+ handleError(4, [], [4, 5]);
+ }
+ needsComma = true;
+ }
+ onArrayEnd();
+ if (!isFirstElement) {
+ _jsonPath.pop();
+ }
+ if (_scanner.getToken() !== 4) {
+ handleError(8, [4], []);
+ } else {
+ scanNext();
+ }
+ return true;
+ }
+ function parseValue() {
+ switch (_scanner.getToken()) {
+ case 3:
+ return parseArray();
+ case 1:
+ return parseObject();
+ case 10:
+ return parseString(true);
+ default:
+ return parseLiteral();
+ }
+ }
+ scanNext();
+ if (_scanner.getToken() === 17) {
+ if (options.allowEmptyContent) {
+ return true;
+ }
+ handleError(4, [], []);
+ return false;
+ }
+ if (!parseValue()) {
+ handleError(4, [], []);
+ return false;
+ }
+ if (_scanner.getToken() !== 17) {
+ handleError(9, [], []);
+ }
+ return true;
+}
+
+// ../../../node_modules/.bun/[email protected]/node_modules/jsonc-parser/lib/esm/main.js
+var ScanError;
+(function(ScanError) {
+ ScanError[ScanError["None"] = 0] = "None";
+ ScanError[ScanError["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
+ ScanError[ScanError["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
+ ScanError[ScanError["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
+ ScanError[ScanError["InvalidUnicode"] = 4] = "InvalidUnicode";
+ ScanError[ScanError["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
+ ScanError[ScanError["InvalidCharacter"] = 6] = "InvalidCharacter";
+})(ScanError || (ScanError = {}));
+var SyntaxKind;
+(function(SyntaxKind) {
+ SyntaxKind[SyntaxKind["OpenBraceToken"] = 1] = "OpenBraceToken";
+ SyntaxKind[SyntaxKind["CloseBraceToken"] = 2] = "CloseBraceToken";
+ SyntaxKind[SyntaxKind["OpenBracketToken"] = 3] = "OpenBracketToken";
+ SyntaxKind[SyntaxKind["CloseBracketToken"] = 4] = "CloseBracketToken";
+ SyntaxKind[SyntaxKind["CommaToken"] = 5] = "CommaToken";
+ SyntaxKind[SyntaxKind["ColonToken"] = 6] = "ColonToken";
+ SyntaxKind[SyntaxKind["NullKeyword"] = 7] = "NullKeyword";
+ SyntaxKind[SyntaxKind["TrueKeyword"] = 8] = "TrueKeyword";
+ SyntaxKind[SyntaxKind["FalseKeyword"] = 9] = "FalseKeyword";
+ SyntaxKind[SyntaxKind["StringLiteral"] = 10] = "StringLiteral";
+ SyntaxKind[SyntaxKind["NumericLiteral"] = 11] = "NumericLiteral";
+ SyntaxKind[SyntaxKind["LineCommentTrivia"] = 12] = "LineCommentTrivia";
+ SyntaxKind[SyntaxKind["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
+ SyntaxKind[SyntaxKind["LineBreakTrivia"] = 14] = "LineBreakTrivia";
+ SyntaxKind[SyntaxKind["Trivia"] = 15] = "Trivia";
+ SyntaxKind[SyntaxKind["Unknown"] = 16] = "Unknown";
+ SyntaxKind[SyntaxKind["EOF"] = 17] = "EOF";
+})(SyntaxKind || (SyntaxKind = {}));
+var parse5 = parse4;
+var ParseErrorCode;
+(function(ParseErrorCode) {
+ ParseErrorCode[ParseErrorCode["InvalidSymbol"] = 1] = "InvalidSymbol";
+ ParseErrorCode[ParseErrorCode["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
+ ParseErrorCode[ParseErrorCode["PropertyNameExpected"] = 3] = "PropertyNameExpected";
+ ParseErrorCode[ParseErrorCode["ValueExpected"] = 4] = "ValueExpected";
+ ParseErrorCode[ParseErrorCode["ColonExpected"] = 5] = "ColonExpected";
+ ParseErrorCode[ParseErrorCode["CommaExpected"] = 6] = "CommaExpected";
+ ParseErrorCode[ParseErrorCode["CloseBraceExpected"] = 7] = "CloseBraceExpected";
+ ParseErrorCode[ParseErrorCode["CloseBracketExpected"] = 8] = "CloseBracketExpected";
+ ParseErrorCode[ParseErrorCode["EndOfFileExpected"] = 9] = "EndOfFileExpected";
+ ParseErrorCode[ParseErrorCode["InvalidCommentToken"] = 10] = "InvalidCommentToken";
+ ParseErrorCode[ParseErrorCode["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
+ ParseErrorCode[ParseErrorCode["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
+ ParseErrorCode[ParseErrorCode["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
+ ParseErrorCode[ParseErrorCode["InvalidUnicode"] = 14] = "InvalidUnicode";
+ ParseErrorCode[ParseErrorCode["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
+ ParseErrorCode[ParseErrorCode["InvalidCharacter"] = 16] = "InvalidCharacter";
+})(ParseErrorCode || (ParseErrorCode = {}));
+function printParseErrorCode(code) {
+ switch (code) {
+ case 1:
+ return "InvalidSymbol";
+ case 2:
+ return "InvalidNumberFormat";
+ case 3:
+ return "PropertyNameExpected";
+ case 4:
+ return "ValueExpected";
+ case 5:
+ return "ColonExpected";
+ case 6:
+ return "CommaExpected";
+ case 7:
+ return "CloseBraceExpected";
+ case 8:
+ return "CloseBracketExpected";
+ case 9:
+ return "EndOfFileExpected";
+ case 10:
+ return "InvalidCommentToken";
+ case 11:
+ return "UnexpectedEndOfComment";
+ case 12:
+ return "UnexpectedEndOfString";
+ case 13:
+ return "UnexpectedEndOfNumber";
+ case 14:
+ return "InvalidUnicode";
+ case 15:
+ return "InvalidEscapeCharacter";
+ case 16:
+ return "InvalidCharacter";
+ }
+ return "<unknown ParseErrorCode>";
+}
+
+// ../../omo-config-core/src/loader/merge.ts
+var DANGEROUS_KEYS = new Set(["__proto__", "constructor", "prototype"]);
+function isUnsafeObjectKey(key) {
+ return DANGEROUS_KEYS.has(key);
+}
+function isPlainObject2(value) {
+ return typeof value === "object" && value !== null && !Array.isArray(value) && Object.prototype.toString.call(value) === "[object Object]";
+}
+function sanitizeOmoConfigValue(value) {
+ if (Array.isArray(value))
+ return value.map((entry) => sanitizeOmoConfigValue(entry));
+ if (!isPlainObject2(value))
+ return value;
+ const sanitized = {};
+ for (const [key, entry] of Object.entries(value)) {
+ if (isUnsafeObjectKey(key))
+ continue;
+ sanitized[key] = sanitizeOmoConfigValue(entry);
+ }
+ return sanitized;
+}
+function mergeOmoConfigRecords(base, override) {
+ const result = { ...base };
+ for (const [key, value] of Object.entries(override)) {
+ if (isUnsafeObjectKey(key))
+ continue;
+ const safeValue = sanitizeOmoConfigValue(value);
+ const baseValue = result[key];
+ result[key] = isPlainObject2(baseValue) && isPlainObject2(safeValue) ? mergeOmoConfigRecords(baseValue, safeValue) : safeValue;
+ }
+ return result;
+}
+
+// ../../omo-config-core/src/loader/paths.ts
+import { userInfo } from "node:os";
+import { dirname as dirname5, join as join8, posix, resolve as resolve3 } from "node:path";
+
+// ../../omo-config-core/src/internal/posix-path.ts
+function toPosixPath(path) {
+ return path.split("\\").join("/");
+}
+
+// ../../omo-config-core/src/loader/types.ts
+import { existsSync as existsSync2, lstatSync, readFileSync, realpathSync } from "node:fs";
+var DEFAULT_READ_FILE_SYSTEM = {
+ existsSync: existsSync2,
+ lstatSync,
+ readFileSync,
+ realpathSync
+};
+
+// ../../omo-config-core/src/loader/paths.ts
+var MAX_PROJECT_CONFIG_DIRECTORY_DEPTH = 256;
+var ACCOUNT_HOME_DIR = userInfo().homedir;
+function resolveHomeDir(env = process.env) {
+ const homeDir = env.HOME ?? env.USERPROFILE ?? process.cwd();
+ return homeDir.startsWith("/") ? posix.resolve(homeDir) : toPosixPath(resolve3(homeDir));
+}
+function resolveUserOmoConfigDirectory(env = process.env) {
+ return join8(resolveHomeDir(env), ".omo");
+}
+function detectUserOmoJsonPath(env, fileSystem) {
+ const configDir = resolveUserOmoConfigDirectory(env);
+ const jsoncPath = join8(configDir, "omo.jsonc");
+ if (fileSystem.existsSync(jsoncPath))
+ return jsoncPath;
+ const jsonPath = join8(configDir, "omo.json");
+ return fileSystem.existsSync(jsonPath) ? jsonPath : jsoncPath;
+}
+function isSymlinkedProjectPath(path, fileSystem) {
+ if (fileSystem.lstatSync === undefined || !fileSystem.existsSync(path))
+ return false;
+ try {
+ return fileSystem.lstatSync(path).isSymbolicLink();
+ } catch (error) {
+ if (error instanceof Error)
+ return true;
+ throw error;
+ }
+}
+function isLoadableProjectConfigFile(path, fileSystem) {
+ return fileSystem.existsSync(path) && !isSymlinkedProjectPath(path, fileSystem);
+}
+function detectOmoJsonPath(dir, fileSystem) {
+ const omoDir = join8(dir, ".omo");
+ if (isSymlinkedProjectPath(omoDir, fileSystem))
+ return null;
+ const jsoncPath = join8(omoDir, "omo.jsonc");
+ if (isLoadableProjectConfigFile(jsoncPath, fileSystem))
+ return jsoncPath;
+ const jsonPath = join8(omoDir, "omo.json");
+ return isLoadableProjectConfigFile(jsonPath, fileSystem) ? jsonPath : null;
+}
+function realpathOrSelf(path, fileSystem) {
+ if (fileSystem.realpathSync === undefined)
+ return path;
+ try {
+ return fileSystem.realpathSync(path);
+ } catch {
+ return path;
+ }
+}
+function findProjectConfigPathsFarthestFirst(cwd, homeDir, fileSystem, accountHomeDir = homeDir) {
+ const startDir = resolve3(cwd);
+ const boundaryDirs = [...new Set([resolve3(homeDir), resolve3(accountHomeDir)])];
+ const realBoundaryDirs = new Set(boundaryDirs.map((path) => realpathOrSelf(path, fileSystem)));
+ const nearestFirst = [];
+ let currentDir = startDir;
+ for (let depth = 0;depth < MAX_PROJECT_CONFIG_DIRECTORY_DEPTH; depth += 1) {
+ const isHomeDir = boundaryDirs.includes(currentDir) || realBoundaryDirs.has(realpathOrSelf(currentDir, fileSystem));
+ const configPath = isHomeDir ? null : detectOmoJsonPath(currentDir, fileSystem);
+ if (configPath !== null)
+ nearestFirst.push(configPath);
+ if (isHomeDir)
+ break;
+ const parentDir = dirname5(currentDir);
+ if (parentDir === currentDir)
+ break;
+ currentDir = parentDir;
+ }
+ return nearestFirst.reverse();
+}
+function resolveOmoConfigPaths(options) {
+ const fileSystem = options.fileSystem ?? DEFAULT_READ_FILE_SYSTEM;
+ const env = options.env ?? process.env;
+ const userPath = detectUserOmoJsonPath(env, fileSystem);
+ const projectPaths = findProjectConfigPathsFarthestFirst(options.cwd, resolveHomeDir(env), fileSystem, ACCOUNT_HOME_DIR);
+ return [
+ { path: userPath, scope: "user" },
+ ...projectPaths.map((path) => ({ path, scope: "project" }))
+ ];
+}
+
+// ../../omo-config-core/src/loader/resolution.ts
+var HARNESS_KEYS = [...new Set([...HARNESS_IDS, ...OMO_CONFIG_HARNESS_IDS])].map((harness) => `[${harness}]`);
+function profileName(value) {
+ return value === "" ? undefined : value;
+}
+function profileNameFromOpenCodeConfigDir(path) {
+ const match = path?.match(/(?:^|[\\/])profiles[\\/]([^\\/]+)[\\/]*$/);
+ return profileName(match?.[1]);
+}
+function resolveOmoProfileName(options = {}) {
+ const env = options.env ?? process.env;
+ return profileName(options.profile) ?? profileName(env["OMO_PROFILE"]) ?? profileName(env["OCX_PROFILE"]) ?? profileNameFromOpenCodeConfigDir(env["OPENCODE_CONFIG_DIR"]);
+}
+function toRecord(value) {
+ if (value === null || typeof value !== "object" || Array.isArray(value))
+ return;
+ return Object.fromEntries(Object.entries(value));
+}
+function withoutControlKeys(config) {
+ const result = {};
+ for (const [key, value] of Object.entries(config)) {
+ if (key === "profiles" || HARNESS_KEYS.includes(key))
+ continue;
+ result[key] = value;
+ }
+ return result;
+}
+function harnessLayer(config, harness) {
+ if (harness === undefined)
+ return {};
+ return toRecord(config[`[${harness}]`]) ?? {};
+}
+function resolveOmoConfigView(options) {
+ const profiles = toRecord(options.config["profiles"]);
+ const profile = options.profile === undefined ? undefined : toRecord(profiles?.[options.profile]);
+ const diagnostics = profile === undefined && options.profile !== undefined ? [{
+ kind: "profile",
+ message: `Activated omo profile "${options.profile}" does not exist; using the base configuration`,
+ path: `profiles.${options.profile}`
+ }] : [];
+ const layers = [
+ withoutControlKeys(options.config),
+ harnessLayer(options.config, options.harness),
+ profile === undefined ? {} : withoutControlKeys(profile),
+ profile === undefined ? {} : harnessLayer(profile, options.harness)
+ ];
+ let config = {};
+ for (const layer of layers)
+ config = mergeOmoConfigRecords(config, layer);
+ const resolvedProfile = options.profile !== undefined && profile !== undefined ? options.profile : undefined;
+ return {
+ config: withoutControlKeys(config),
+ diagnostics,
+ ...resolvedProfile === undefined ? {} : { profile: resolvedProfile }
+ };
+}
+
+// ../../omo-config-core/src/loader/loader.ts
+function parseJsoncSafe(content) {
+ const errors = [];
+ const data = parse5(content.charCodeAt(0) === 65279 ? content.slice(1) : content, errors, {
+ allowTrailingComma: true,
+ disallowComments: false
+ });
+ return {
+ data: errors.length === 0 ? data : null,
+ errors: errors.map((error) => ({
+ message: printParseErrorCode(error.error),
+ offset: error.offset
+ }))
+ };
+}
+var DEFAULT_RAW_CONFIG = {
+ agents: {},
+ categories: {},
+ task: resolveOmoTaskSettings({}),
+ teams: {}
+};
+function stripResolutionControlKeys(config) {
+ const {
+ "[codex]": _codex,
+ "[opencode]": _opencode,
+ "[senpi]": _senpi,
+ profiles: _profiles,
+ ...resolved
+ } = config;
+ return resolved;
+}
+function validationDiagnostic(path, issues) {
+ const issuePaths = issues.map((issue) => issue.path.map((segment) => String(segment)).join("."));
+ return {
+ kind: "validation",
+ message: `Invalid omo config at ${path}: ${issuePaths.join(", ")}`,
+ path,
+ issuePaths
+ };
+}
+function unrecognizedKeyIssues(issues) {
+ return issues.flatMap((issue) => issue.code === "unrecognized_keys" ? [{ keys: issue.keys, path: issue.path.map((segment) => String(segment)) }] : []);
+}
+function hasUnsafeUnrecognizedKey(issues) {
+ return issues.some((issue) => issue.keys.some((key) => isUnsafeObjectKey(key)));
+}
+function hasTamperedPrototype(value) {
+ if (Array.isArray(value))
+ return value.some((entry) => hasTamperedPrototype(entry));
+ if (!isRecord7(value))
+ return false;
+ const prototype = Object.getPrototypeOf(value);
+ if (prototype !== Object.prototype && prototype !== null)
+ return true;
+ return Object.values(value).some((entry) => hasTamperedPrototype(entry));
+}
+function isRecord7(value) {
+ return typeof value === "object" && value !== null && !Array.isArray(value);
+}
+function containerAt(record, path) {
+ let container = record;
+ for (const segment of path) {
+ const next = container[segment];
+ if (!isRecord7(next))
+ return null;
+ container = next;
+ }
+ return container;
+}
+function stripUnrecognizedKeys(record, issues) {
+ const stripped = structuredClone(record);
+ const issuePaths = [];
+ for (const issue of issues) {
+ const container = containerAt(stripped, issue.path);
+ if (container === null)
+ continue;
+ for (const key of issue.keys) {
+ delete container[key];
+ issuePaths.push([...issue.path, key].join("."));
+ }
+ }
+ return { issuePaths, stripped };
+}
+function toRecord2(value) {
+ if (value === null || typeof value !== "object" || Array.isArray(value))
+ return null;
+ const record = {};
+ for (const [key, entry] of Object.entries(value)) {
+ record[key] = entry;
+ }
+ return record;
+}
+function readConfigSource(path, scope, fileSystem) {
+ if (!fileSystem.existsSync(path)) {
+ return { source: { exists: false, loaded: false, path, scope } };
+ }
+ let content;
+ try {
+ content = fileSystem.readFileSync(path, "utf-8");
+ } catch (error) {
+ const message = error instanceof Error ? error.message : String(error);
+ return {
+ diagnostic: { kind: "read", message: `Failed to read ${path}: ${message}`, path },
+ source: { exists: true, loaded: false, path, scope }
+ };
+ }
+ const parsed = parseJsoncSafe(content);
+ if (parsed.errors.length > 0) {
+ return {
+ diagnostic: {
+ kind: "parse",
+ message: `JSONC parse error in ${path}: ${parsed.errors.map((error) => error.message).join(", ")}`,
+ path
+ },
+ source: { exists: true, loaded: false, path, scope }
+ };
+ }
+ if (hasTamperedPrototype(parsed.data)) {
+ return {
+ diagnostic: { kind: "validation", message: `Invalid omo config at ${path}: "__proto__" member is not allowed`, path },
+ source: { exists: true, loaded: false, path, scope }
+ };
+ }
+ const parsedRecord = toRecord2(parsed.data);
+ const validation = OmoConfigLayerSchema.safeParse(parsed.data);
+ if (!validation.success) {
+ const unrecognized = unrecognizedKeyIssues(validation.error.issues);
+ if (hasUnsafeUnrecognizedKey(unrecognized)) {
+ return {
+ diagnostic: validationDiagnostic(path, validation.error.issues),
+ source: { exists: true, loaded: false, path, scope }
+ };
+ }
+ const rejected = {
+ diagnostic: validationDiagnostic(path, validation.error.issues),
+ source: { exists: true, loaded: false, path, scope }
+ };
+ const unknownIssues = unrecognizedKeyIssues(validation.error.issues);
+ if (parsedRecord === null || unknownIssues.length === 0)
+ return rejected;
+ const { issuePaths, stripped } = stripUnrecognizedKeys(parsedRecord, unknownIssues);
+ if (!OmoConfigLayerSchema.safeParse(stripped).success)
+ return rejected;
+ return {
+ diagnostic: {
+ kind: "unknown-keys",
+ message: `Ignored unknown keys in ${path}: ${issuePaths.join(", ")}`,
+ path,
+ issuePaths
+ },
+ source: { exists: true, loaded: true, path, scope },
+ value: stripped
+ };
+ }
+ if (parsedRecord === null) {
+ return {
+ diagnostic: { kind: "validation", message: `Invalid omo config at ${path}: root must be an object`, path },
+ source: { exists: true, loaded: false, path, scope }
+ };
+ }
+ return {
+ source: { exists: true, loaded: true, path, scope },
+ value: parsedRecord
+ };
+}
+function loadOmoConfig(options = {}) {
+ const fileSystem = options.fileSystem ?? DEFAULT_READ_FILE_SYSTEM;
+ const cwd = options.cwd ?? process.cwd();
+ let merged = {};
+ const diagnostics = [];
+ const layers = [];
+ const sources = [];
+ for (const candidate of resolveOmoConfigPaths({
+ cwd,
+ ...options.env === undefined ? {} : { env: options.env },
+ fileSystem,
+ ...options.platform === undefined ? {} : { platform: options.platform }
+ })) {
+ const loaded = readConfigSource(candidate.path, candidate.scope, fileSystem);
+ sources.push(loaded.source);
+ if (loaded.diagnostic !== undefined)
+ diagnostics.push(loaded.diagnostic);
+ if (loaded.value !== undefined) {
+ layers.push({ config: loaded.value, source: loaded.source });
+ merged = mergeOmoConfigRecords(merged, loaded.value);
+ }
+ }
+ const requestedProfile = resolveOmoProfileName({
+ ...options.env === undefined ? {} : { env: options.env },
+ ...options.profile === undefined ? {} : { profile: options.profile }
+ });
+ const resolved = resolveOmoConfigView({
+ config: merged,
+ ...options.harness === undefined ? {} : { harness: options.harness },
+ ...requestedProfile === undefined ? {} : { profile: requestedProfile }
+ });
+ const finalConfig = OmoConfigSchema.safeParse(mergeOmoConfigRecords(DEFAULT_RAW_CONFIG, resolved.config));
+ if (finalConfig.success) {
+ return {
+ config: stripResolutionControlKeys(finalConfig.data),
+ diagnostics: [...diagnostics, ...resolved.diagnostics],
+ layers,
+ ...resolved.profile === undefined ? {} : { profile: resolved.profile },
+ sources
+ };
+ }
+ return {
+ config: stripResolutionControlKeys(OmoConfigSchema.parse(DEFAULT_RAW_CONFIG)),
+ diagnostics: [...diagnostics, ...resolved.diagnostics, validationDiagnostic("(merged omo config)", finalConfig.error.issues)],
+ layers,
+ ...resolved.profile === undefined ? {} : { profile: resolved.profile },
+ sources
+ };
+}
+
+// ../src/install/codex-default-role-config.ts
+function readDefaultRoleConfig(options = {}) {
+ const result = loadOmoConfig({ ...options, harness: "codex" });
+ return {
+ enabled: result.config.agents?.default?.disable !== true,
+ warnings: result.diagnostics.map((diagnostic) => diagnostic.message)
+ };
+}
// ../src/install/link-cached-plugin-agents.ts
-import { copyFile, lstat as lstat3, mkdir as mkdir4, readdir as readdir2, rm as rm6, writeFile as writeFile4 } from "node:fs/promises";
-import { basename as basename3, join as join10 } from "node:path";
+import { copyFile, lstat as lstat5, mkdir as mkdir4, readdir as readdir2, rm as rm7, writeFile as writeFile5 } from "node:fs/promises";
+import { basename as basename4, join as join13 } from "node:path";
// ../src/install/preserved-agent-settings.ts
import { lstat, readFile as readFile4, readdir, writeFile as writeFile3 } from "node:fs/promises";
-import { join as join8 } from "node:path";
+import { join as join9 } from "node:path";
// ../src/install/toml-section-editor.ts
function findTomlSection(config, header) {
@@ -1746,7 +8309,7 @@ function resolveManagedAgentReasoning(input) {
// ../src/install/preserved-agent-settings.ts
async function capturePreservedAgentReasoning(input) {
- const agentsDir = join8(input.codexHome, "agents");
+ const agentsDir = join9(input.codexHome, "agents");
if (!await exists(agentsDir))
return new Map;
const preserved = new Map;
@@ -1754,7 +8317,7 @@ async function capturePreservedAgentReasoning(input) {
for (const entry of agentEntries) {
if (!entry.name.endsWith(".toml"))
continue;
- const content = await readTextIfExists(join8(agentsDir, entry.name));
+ const content = await readTextIfExists(join9(agentsDir, entry.name));
if (content === null)
continue;
const effort = extractReasoningEffort(content);
@@ -1768,7 +8331,7 @@ async function capturePreservedAgentReasoning(input) {
return preserved;
}
async function capturePreservedAgentServiceTier(input) {
- const agentsDir = join8(input.codexHome, "agents");
+ const agentsDir = join9(input.codexHome, "agents");
if (!await exists(agentsDir))
return new Map;
const preserved = new Map;
@@ -1776,7 +8339,7 @@ async function capturePreservedAgentServiceTier(input) {
for (const entry of agentEntries) {
if (!entry.name.endsWith(".toml"))
continue;
- const content = await readTextIfExists(join8(agentsDir, entry.name));
+ const content = await readTextIfExists(join9(agentsDir, entry.name));
if (content === null)
continue;
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
@@ -1910,7 +8473,7 @@ function nodeErrorCode(error) {
// ../src/install/retired-managed-agent-purge.ts
import { lstat as lstat2, readFile as readFile5, rm as rm5 } from "node:fs/promises";
-import { join as join9 } from "node:path";
+import { join as join10 } from "node:path";
var RETIRED_MANAGED_AGENT_FILES = [
{
fileName: "codex-ultrawork-reviewer.toml",
@@ -1922,11 +8485,11 @@ var RETIRED_MANAGED_AGENT_FILES = [
}
];
async function purgeRetiredManagedAgentFiles(input) {
- const agentsDir = join9(input.codexHome, "agents");
+ const agentsDir = join10(input.codexHome, "agents");
if (!await exists2(agentsDir))
return;
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
- const agentPath = join9(agentsDir, retiredAgent.fileName);
+ const agentPath = join10(agentsDir, retiredAgent.fileName);
if (!await exists2(agentPath))
continue;
const agentStat = await lstat2(agentPath);
@@ -1966,6 +8529,178 @@ function nodeErrorCode2(error) {
return typeof error.code === "string" ? error.code : null;
}
+// ../src/install/default-agent-role.ts
+import { createHash as createHash3 } from "node:crypto";
+import { lstat as lstat4, readFile as readFile6, rm as rm6 } from "node:fs/promises";
+import { join as join12 } from "node:path";
+
+// ../src/install/codex-config-atomic-write.ts
+import { lstat as lstat3, readlink, realpath, rename as rename3, unlink, writeFile as writeFile4 } from "node:fs/promises";
+import { basename as basename3, dirname as dirname6, isAbsolute as isAbsolute2, join as join11, resolve as resolve4 } from "node:path";
+var RENAME_RETRY_DELAYS_MS = [10, 25, 50];
+var RETRIABLE_RENAME_CODES = new Set(["EPERM", "EBUSY"]);
+async function writeFileAtomic(targetPath, data) {
+ const writeTarget = await resolveSymlinkTarget(targetPath);
+ const temporaryPath = join11(dirname6(writeTarget), `.tmp-${basename3(writeTarget)}-${process.pid}-${Date.now()}`);
+ await writeFile4(temporaryPath, data);
+ try {
+ await renameWithRetry(temporaryPath, writeTarget);
+ } catch (error) {
+ await unlink(temporaryPath).catch((unlinkError) => {
+ if (unlinkError instanceof Error)
+ return;
+ return;
+ });
+ throw error;
+ }
+}
+async function resolveSymlinkTarget(targetPath) {
+ try {
+ const linkStats = await lstat3(targetPath);
+ if (!linkStats.isSymbolicLink())
+ return targetPath;
+ } catch (error) {
+ if (error instanceof Error)
+ return targetPath;
+ return targetPath;
+ }
+ try {
+ return await realpath(targetPath);
+ } catch (error) {
+ if (!(error instanceof Error))
+ throw error;
+ const linkValue = await readlink(targetPath);
+ return isAbsolute2(linkValue) ? linkValue : resolve4(dirname6(targetPath), linkValue);
+ }
+}
+async function renameWithRetry(fromPath, toPath) {
+ for (let attempt = 0;; attempt += 1) {
+ try {
+ await rename3(fromPath, toPath);
+ return;
+ } catch (error) {
+ if (!isRetriableRenameError(error) || attempt >= RENAME_RETRY_DELAYS_MS.length) {
+ throw error;
+ }
+ await delay(RENAME_RETRY_DELAYS_MS[attempt] ?? 0);
+ }
+ }
+}
+function isRetriableRenameError(error) {
+ if (!(error instanceof Error) || !("code" in error))
+ return false;
+ return typeof error.code === "string" && RETRIABLE_RENAME_CODES.has(error.code);
+}
+function delay(milliseconds) {
+ return new Promise((resolveDelay) => setTimeout(resolveDelay, milliseconds));
+}
+
+// ../src/install/codex-config-agents.ts
+var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE = ["codex-ultrawork-reviewer"];
+var CURRENT_MANAGED_CODEX_AGENT_NAMES = [
+ "explorer",
+ "lazycodex-worker-high",
+ "lazycodex-worker-low",
+ "lazycodex-worker-medium",
+ "librarian",
+ "metis",
+ "momus",
+ "plan"
+];
+var MANAGED_CODEX_AGENT_NAMES = [
+ ...LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE,
+ ...CURRENT_MANAGED_CODEX_AGENT_NAMES
+];
+function removeStaleManagedAgentBlocks(config, keepAgentNames) {
+ const managedAgentNames = new Set(MANAGED_CODEX_AGENT_NAMES);
+ return splitTomlSections(config).filter((section) => {
+ if (section.header === null)
+ return true;
+ const agentName = parseAgentHeaderName(section.header);
+ if (agentName === null || !managedAgentNames.has(agentName) || keepAgentNames.has(agentName))
+ return true;
+ return !section.text.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`);
+ }).map((section) => section.text).join("").replace(/\n{3,}/g, `
+
+`);
+}
+function hasForeignAgentRegistration(config, agentConfig) {
+ const section = findTomlSection(config, `agents.${tomlKeySegment(agentConfig.name)}`);
+ if (!section)
+ return false;
+ return !section.text.includes(`config_file = ${JSON.stringify(agentConfig.configFile)}`);
+}
+function ensureAgentConfig(config, agentConfig) {
+ const header = `agents.${tomlKeySegment(agentConfig.name)}`;
+ const section = findTomlSection(config, header);
+ const configFile = JSON.stringify(agentConfig.configFile);
+ if (!section)
+ return appendBlock(config, `[${header}]
+config_file = ${configFile}
+`);
+ return replaceOrInsertSetting(config, section, "config_file", configFile);
+}
+function tomlKeySegment(value) {
+ return /^[A-Za-z0-9_-]+$/.test(value) ? value : JSON.stringify(value);
+}
+
+// ../src/install/default-agent-role.ts
+var REGISTRATION = { name: "default", configFile: "./agents/default.toml" };
+async function installDefaultAgentRole(input) {
+ const target = join12(input.codexHome, "agents", "default.toml");
+ const receipt = join12(input.codexHome, "agents", ".lazycodex-default.sha256");
+ const configPath = join12(input.codexHome, "config.toml");
+ const config = await readIfPresent(configPath);
+ const entry = await lstat4(target).catch((error) => {
+ if (error instanceof Error && "code" in error && error.code === "ENOENT")
+ return null;
+ throw error;
+ });
+ if (entry !== null && !entry.isFile()) {
+ if (!input.enabled)
+ return null;
+ throw new Error("Preserved user-owned agents/default.toml: refusing to replace a symlink or directory");
+ }
+ const existing = await readIfPresent(target);
+ const digest = await readIfPresent(receipt);
+ const owned = existing !== null && digest === hash(existing);
+ const foreign = hasForeignAgentRegistration(config ?? "", REGISTRATION);
+ if (!input.enabled) {
+ if (owned) {
+ if (!foreign && config !== null) {
+ const next = splitTomlSections(config).filter((section) => section.header === null || parseAgentHeaderName(section.header) !== "default").map((section) => section.text).join("");
+ if (next !== config)
+ await writeFileAtomic(configPath, next);
+ }
+ await rm6(target);
+ await rm6(receipt);
+ }
+ return null;
+ }
+ if (foreign || existing !== null && !owned) {
+ throw new Error("Preserved user-owned agents.default / agents/default.toml. Move it aside to install the LazyCodex fallback, or set [codex].agents.default.disable = true in omo.jsonc. Explicit LazyCodex roles remain required.");
+ }
+ const worker = await readFile6(input.worker.path, "utf8");
+ const content = worker.replace(/^name\s*=\s*["']lazycodex-worker-medium["']\s*$/m, 'name = "default"');
+ if (content === worker)
+ throw new Error("Cannot derive default: medium worker has no matching internal name");
+ await writeFileAtomic(target, content);
+ await writeFileAtomic(receipt, hash(content));
+ return { name: "default.toml", path: target, target: input.worker.target };
+}
+async function readIfPresent(path) {
+ try {
+ return await readFile6(path, "utf8");
+ } catch (error) {
+ if (error instanceof Error && "code" in error && error.code === "ENOENT")
+ return null;
+ throw error;
+ }
+}
+function hash(content) {
+ return createHash3("sha256").update(content).digest("hex");
+}
+
// ../src/install/link-cached-plugin-agents.ts
var MANIFEST_FILE = ".installed-agents.json";
async function linkCachedPluginAgents(input) {
@@ -1975,13 +8710,13 @@ async function linkCachedPluginAgents(input) {
await writeManifest(input.pluginRoot, []);
return [];
}
- const agentsDir = join10(input.codexHome, "agents");
+ const agentsDir = join13(input.codexHome, "agents");
await mkdir4(agentsDir, { recursive: true });
const linked = [];
for (const agentPath of bundledAgents) {
- const agentFileName = basename3(agentPath);
+ const agentFileName = basename4(agentPath);
const agentName = agentNameFromToml2(agentFileName);
- const linkPath = join10(agentsDir, agentFileName);
+ const linkPath = join13(agentsDir, agentFileName);
await replaceWithCopy(linkPath, agentPath);
await restorePreservedReasoning({
agentName,
@@ -1996,11 +8731,17 @@ async function linkCachedPluginAgents(input) {
});
linked.push({ name: agentFileName, path: linkPath, target: agentPath });
}
+ const worker = linked.find((entry) => entry.name === "lazycodex-worker-medium.toml");
+ if (worker !== undefined) {
+ const fallback = await installDefaultAgentRole({ codexHome: input.codexHome, worker, enabled: input.defaultRoleEnabled !== false });
+ if (fallback !== null)
+ linked.push(fallback);
+ }
await writeManifest(input.pluginRoot, linked.map((entry) => entry.path));
return linked;
}
async function discoverBundledAgents(pluginRoot) {
- const componentsRoot = join10(pluginRoot, "components");
+ const componentsRoot = join13(pluginRoot, "components");
if (!await exists3(componentsRoot))
return [];
const componentEntries = await readdir2(componentsRoot, { withFileTypes: true });
@@ -2008,14 +8749,14 @@ async function discoverBundledAgents(pluginRoot) {
for (const entry of componentEntries) {
if (!entry.isDirectory())
continue;
- const agentsRoot = join10(componentsRoot, entry.name, "agents");
+ const agentsRoot = join13(componentsRoot, entry.name, "agents");
if (!await exists3(agentsRoot))
continue;
const agentEntries = await readdir2(agentsRoot, { withFileTypes: true });
for (const file of agentEntries) {
if (!file.isFile() || !file.name.endsWith(".toml"))
continue;
- agents.push(join10(agentsRoot, file.name));
+ agents.push(join13(agentsRoot, file.name));
}
}
agents.sort();
@@ -2028,16 +8769,16 @@ async function replaceWithCopy(linkPath, target) {
async function prepareReplacement(linkPath) {
if (!await exists3(linkPath))
return;
- const entryStat = await lstat3(linkPath);
+ const entryStat = await lstat5(linkPath);
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
}
- await rm6(linkPath, { force: true });
+ await rm7(linkPath, { force: true });
}
async function writeManifest(pluginRoot, agentPaths) {
- const manifestPath = join10(pluginRoot, MANIFEST_FILE);
+ const manifestPath = join13(pluginRoot, MANIFEST_FILE);
const payload = { agents: [...agentPaths].sort() };
- await writeFile4(manifestPath, `${JSON.stringify(payload, null, "\t")}
+ await writeFile5(manifestPath, `${JSON.stringify(payload, null, "\t")}
`);
}
function agentNameFromToml2(fileName) {
@@ -2045,7 +8786,7 @@ function agentNameFromToml2(fileName) {
}
async function exists3(path) {
try {
- await lstat3(path);
+ await lstat5(path);
return true;
} catch (error) {
if (nodeErrorCode3(error) !== "ENOENT")
@@ -2060,8 +8801,8 @@ function nodeErrorCode3(error) {
}
// ../src/install/codex-cache-bins.ts
-import { chmod as chmod2, lstat as lstat7, mkdir as mkdir5, readFile as readFile8, readdir as readdir4, readlink as readlink3, rm as rm9, stat as stat4, symlink, writeFile as writeFile5 } from "node:fs/promises";
-import { basename as basename4, isAbsolute as isAbsolute3, join as join14, relative as relative2, resolve as resolve4, sep } from "node:path";
+import { chmod as chmod2, lstat as lstat9, mkdir as mkdir5, readFile as readFile9, readdir as readdir4, readlink as readlink4, rm as rm10, stat as stat4, symlink, writeFile as writeFile6 } from "node:fs/promises";
+import { basename as basename5, isAbsolute as isAbsolute4, join as join17, relative as relative2, resolve as resolve6, sep } from "node:path";
// ../src/install/codex-cache-command-shim.ts
var COMMAND_SHIM_MARKER = ":: generated by oh-my-openagent Codex installer";
@@ -2105,14 +8846,14 @@ function windowsCommandShim(targetPath) {
}
// ../src/install/codex-cache-dangling-bins.ts
-import { lstat as lstat5, readFile as readFile6, readdir as readdir3, readlink, rm as rm7, stat as stat3 } from "node:fs/promises";
-import { dirname as dirname5, isAbsolute as isAbsolute2, join as join11, resolve as resolve3 } from "node:path";
+import { lstat as lstat7, readFile as readFile7, readdir as readdir3, readlink as readlink2, rm as rm8, stat as stat3 } from "node:fs/promises";
+import { dirname as dirname7, isAbsolute as isAbsolute3, join as join14, resolve as resolve5 } from "node:path";
// ../src/install/codex-cache-fs.ts
-import { lstat as lstat4 } from "node:fs/promises";
+import { lstat as lstat6 } from "node:fs/promises";
async function fileExistsStrict(path) {
try {
- await lstat4(path);
+ await lstat6(path);
return true;
} catch (error) {
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
@@ -2134,7 +8875,7 @@ async function removeDanglingManagedComponentBins(binDir, platform, managedBinNa
const binName = managedBinNameForEntry(entry.name, platform);
if (binName === null || !managedBinNames.has(binName))
continue;
- const linkPath = join11(binDir, entry.name);
+ const linkPath = join14(binDir, entry.name);
if (platform === "win32") {
await removeDanglingGeneratedCommandShim(linkPath);
continue;
@@ -2149,13 +8890,13 @@ function managedBinNameForEntry(name, platform) {
}
async function removeDanglingManagedSymlink(linkPath) {
try {
- const linkStat = await lstat5(linkPath);
+ const linkStat = await lstat7(linkPath);
if (!linkStat.isSymbolicLink())
return;
- const linkTarget = await readlink(linkPath);
- const target = isAbsolute2(linkTarget) ? linkTarget : resolve3(dirname5(linkPath), linkTarget);
+ const linkTarget = await readlink2(linkPath);
+ const target = isAbsolute3(linkTarget) ? linkTarget : resolve5(dirname7(linkPath), linkTarget);
if (!await isFileSystemEntry(target) && isManagedComponentBinTarget(target))
- await rm7(linkPath, { force: true });
+ await rm8(linkPath, { force: true });
} catch (error) {
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
return;
@@ -2164,15 +8905,15 @@ async function removeDanglingManagedSymlink(linkPath) {
}
async function removeDanglingGeneratedCommandShim(linkPath) {
try {
- const linkStat = await lstat5(linkPath);
+ const linkStat = await lstat7(linkPath);
if (!linkStat.isFile())
return;
- const content = await readFile6(linkPath, "utf8");
+ const content = await readFile7(linkPath, "utf8");
if (!content.includes(COMMAND_SHIM_MARKER))
return;
const target = extractCommandShimTarget(content);
if (target !== null && !await isFileSystemEntry(target) && isManagedComponentBinTarget(target))
- await rm7(linkPath, { force: true });
+ await rm8(linkPath, { force: true });
} catch (error) {
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
return;
@@ -2215,8 +8956,8 @@ function hasOmoCodexPluginPrefix(parts, endExclusive) {
}
// ../src/install/codex-cache-legacy-bins.ts
-import { lstat as lstat6, readFile as readFile7, readlink as readlink2, rm as rm8 } from "node:fs/promises";
-import { join as join12 } from "node:path";
+import { lstat as lstat8, readFile as readFile8, readlink as readlink3, rm as rm9 } from "node:fs/promises";
+import { join as join15 } from "node:path";
var LEGACY_CODEX_COMPONENT_BINS = [
{ name: "omo", component: "ulw-loop" },
{ name: "codex-comment-checker", component: "comment-checker" },
@@ -2229,26 +8970,26 @@ var LEGACY_CODEX_COMPONENT_BINS = [
var LEGACY_CODEX_COMPONENT_BIN_NAMES = LEGACY_CODEX_COMPONENT_BINS.map((entry) => entry.name);
async function removeLegacyCodexComponentBins(binDir, platform) {
for (const entry of LEGACY_CODEX_COMPONENT_BINS) {
- const linkPath = join12(binDir, platform === "win32" ? `${entry.name}.cmd` : entry.name);
+ const linkPath = join15(binDir, platform === "win32" ? `${entry.name}.cmd` : entry.name);
await removeLegacyCodexComponentBin(linkPath, entry.component, platform);
}
}
async function removeLegacyCodexComponentBin(linkPath, component, platform) {
try {
- const stat = await lstat6(linkPath);
+ const stat = await lstat8(linkPath);
if (platform !== "win32") {
if (!stat.isSymbolicLink())
return;
- const target = await readlink2(linkPath);
+ const target = await readlink3(linkPath);
if (isManagedLegacyComponentTarget(target, component))
- await rm8(linkPath, { force: true });
+ await rm9(linkPath, { force: true });
return;
}
if (!stat.isFile())
return;
- const content = await readFile7(linkPath, "utf8");
+ const content = await readFile8(linkPath, "utf8");
if (content.includes(COMMAND_SHIM_MARKER))
- await rm8(linkPath, { force: true });
+ await rm9(linkPath, { force: true });
} catch (error) {
if (isNodeErrorWithCode2(error) && error.code === "ENOENT")
return;
@@ -2280,13 +9021,13 @@ function isNodeErrorWithCode2(error) {
}
// ../src/install/codex-cache-runtime-wrapper.ts
-import { join as join13 } from "node:path";
+import { join as join16 } from "node:path";
var RUNTIME_WRAPPER_MARKER = "OMO_GENERATED_RUNTIME_WRAPPER";
function posixRuntimeWrapper(binName, cliPath, codexHome, binDir, nodeCliPath) {
- const ulwLoopBin = toPosixPath(join13(binDir, "omo-ulw-loop"));
- const nodeCli = escapePosixDoubleQuoted(toPosixPath(nodeCliPath));
- const escapedCliPath = escapePosixDoubleQuoted(toPosixPath(cliPath));
- const escapedCodexHome = escapePosixDoubleQuoted(toPosixPath(codexHome));
+ const ulwLoopBin = toPosixPath2(join16(binDir, "omo-ulw-loop"));
+ const nodeCli = escapePosixDoubleQuoted(toPosixPath2(nodeCliPath));
+ const escapedCliPath = escapePosixDoubleQuoted(toPosixPath2(cliPath));
+ const escapedCodexHome = escapePosixDoubleQuoted(toPosixPath2(codexHome));
const escapedUlwLoopBin = escapePosixDoubleQuoted(ulwLoopBin);
return [
"#!/bin/sh",
@@ -2330,7 +9071,7 @@ function posixRuntimeWrapper(binName, cliPath, codexHome, binDir, nodeCliPath) {
`);
}
function windowsRuntimeWrapper(binName, cliPath, codexHome, binDir, nodeCliPath) {
- const ulwLoopBin = join13(binDir, "omo-ulw-loop.cmd");
+ const ulwLoopBin = join16(binDir, "omo-ulw-loop.cmd");
return [
"@echo off",
`rem ${RUNTIME_WRAPPER_MARKER}`,
@@ -2366,7 +9107,7 @@ function windowsRuntimeWrapper(binName, cliPath, codexHome, binDir, nodeCliPath)
].join(`\r
`);
}
-function toPosixPath(path) {
+function toPosixPath2(path) {
return path.replaceAll("\\", "/");
}
function escapePosixDoubleQuoted(value) {
@@ -2396,23 +9137,23 @@ async function linkCachedPluginBins(input) {
return linked;
}
async function linkRootRuntimeBin(input) {
- const cliPath = join14(input.repoRoot, "dist", "cli", "index.js");
+ const cliPath = join17(input.repoRoot, "dist", "cli", "index.js");
const platform = input.platform ?? process.platform;
- const legacyPath = join14(input.binDir, platform === "win32" ? "omo.cmd" : "omo");
+ const legacyPath = join17(input.binDir, platform === "win32" ? "omo.cmd" : "omo");
if (!await isFile2(cliPath)) {
await removeGeneratedRuntimeWrapper(legacyPath);
return null;
}
const binName = "omo-agent-toolkit";
- const nodeCliPath = join14(input.repoRoot, "dist", "cli-node", "index.js");
+ const nodeCliPath = join17(input.repoRoot, "dist", "cli-node", "index.js");
await mkdir5(input.binDir, { recursive: true });
if (platform === "win32") {
- const linkPath = join14(input.binDir, `${binName}.cmd`);
+ const linkPath = join17(input.binDir, `${binName}.cmd`);
await replaceRuntimeWrapper(linkPath, windowsRuntimeWrapper(binName, cliPath, input.codexHome, input.binDir, nodeCliPath));
await removeGeneratedRuntimeWrapper(legacyPath);
return { name: binName, path: linkPath, target: cliPath };
}
- const linkPath = join14(input.binDir, binName);
+ const linkPath = join17(input.binDir, binName);
await replaceRuntimeWrapper(linkPath, posixRuntimeWrapper(binName, cliPath, input.codexHome, input.binDir, nodeCliPath));
await chmod2(linkPath, 493);
await removeGeneratedRuntimeWrapper(legacyPath);
@@ -2420,11 +9161,11 @@ async function linkRootRuntimeBin(input) {
}
async function linkCachedPluginBin(binDir, link, platform) {
if (platform === "win32") {
- const linkPath = join14(binDir, `${link.name}.cmd`);
+ const linkPath = join17(binDir, `${link.name}.cmd`);
await replaceCommandShim(linkPath, link.target);
return linkPath;
}
- const linkPath = join14(binDir, link.name);
+ const linkPath = join17(binDir, link.name);
await replaceSymlink(linkPath, link.target);
return linkPath;
}
@@ -2445,27 +9186,27 @@ async function discoverPackageBins(root) {
async function collectPackageBins(directory, root, links) {
const entries = await readdir4(directory, { withFileTypes: true });
if (entries.some((entry) => entry.isFile() && entry.name === "package.json")) {
- await appendPackageBinLinks(join14(directory, "package.json"), directory, root, links);
+ await appendPackageBinLinks(join17(directory, "package.json"), directory, root, links);
}
for (const entry of entries) {
if (!entry.isDirectory())
continue;
if (entry.name === "node_modules" || entry.name === ".git" || entry.name === "dist")
continue;
- const childPath = join14(directory, entry.name);
+ const childPath = join17(directory, entry.name);
if (!childPath.startsWith(root))
continue;
await collectPackageBins(childPath, root, links);
}
}
async function appendPackageBinLinks(packageJsonPath, packageRoot, root, links) {
- const packageJson = JSON.parse(await readFile8(packageJsonPath, "utf8"));
+ const packageJson = JSON.parse(await readFile9(packageJsonPath, "utf8"));
if (!isPlainRecord(packageJson))
return;
const packageName = packageJson.name;
const packageBin = packageJson.bin;
if (typeof packageBin === "string" && typeof packageName === "string") {
- const name = assertSafeCommandName(basename4(packageName));
+ const name = assertSafeCommandName(basename5(packageName));
if (!isReservedNestedBinName(name, packageRoot, root)) {
links.push({ name, target: resolvePackageBinTarget(packageRoot, packageBin) });
}
@@ -2494,10 +9235,10 @@ function isReservedNestedBinName(name, packageRoot, root) {
function resolvePackageBinTarget(packageRoot, target) {
if (target.includes("\x00"))
throw new Error("Package bin target must stay inside package root");
- const root = resolve4(packageRoot);
- const resolvedTarget = resolve4(root, target);
+ const root = resolve6(packageRoot);
+ const resolvedTarget = resolve6(root, target);
const relativeTarget = relative2(root, resolvedTarget);
- if (relativeTarget === "" || relativeTarget !== ".." && !relativeTarget.startsWith(`..${sep}`) && !isAbsolute3(relativeTarget)) {
+ if (relativeTarget === "" || relativeTarget !== ".." && !relativeTarget.startsWith(`..${sep}`) && !isAbsolute4(relativeTarget)) {
return resolvedTarget;
}
throw new Error("Package bin target must stay inside package root");
@@ -2505,28 +9246,28 @@ function resolvePackageBinTarget(packageRoot, target) {
async function replaceSymlink(linkPath, targetPath) {
if (await existingNonSymlink(linkPath))
throw new Error(`${linkPath} already exists and is not a symlink`);
- await rm9(linkPath, { force: true });
+ await rm10(linkPath, { force: true });
await symlink(targetPath, linkPath);
}
async function replaceCommandShim(linkPath, targetPath) {
if (await existingNonShim(linkPath))
throw new Error(`${linkPath} already exists and is not a command shim`);
- await writeFile5(linkPath, windowsCommandShim(targetPath));
+ await writeFile6(linkPath, windowsCommandShim(targetPath));
}
async function replaceRuntimeWrapper(linkPath, content) {
if (await existingNonRuntimeWrapper(linkPath))
throw new Error(`${linkPath} already exists and is not a generated OMO runtime wrapper`);
- await rm9(linkPath, { force: true });
- await writeFile5(linkPath, content);
+ await rm10(linkPath, { force: true });
+ await writeFile6(linkPath, content);
}
async function removeGeneratedRuntimeWrapper(path) {
try {
- const entry = await lstat7(path);
+ const entry = await lstat9(path);
if (!entry.isFile() && !entry.isSymbolicLink())
return;
const content = await readGeneratedWrapperContent(path);
if (content.includes(RUNTIME_WRAPPER_MARKER))
- await rm9(path, { force: true });
+ await rm10(path, { force: true });
} catch (error) {
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
return;
@@ -2535,7 +9276,7 @@ async function removeGeneratedRuntimeWrapper(path) {
}
async function readGeneratedWrapperContent(path) {
try {
- return await readFile8(path, "utf8");
+ return await readFile9(path, "utf8");
} catch (error) {
if (isNodeErrorWithCode(error) && (error.code === "ENOENT" || error.code === "EISDIR"))
return "";
@@ -2544,12 +9285,12 @@ async function readGeneratedWrapperContent(path) {
}
async function existingNonRuntimeWrapper(path) {
try {
- const stat = await lstat7(path);
+ const stat = await lstat9(path);
if (stat.isSymbolicLink())
return false;
if (!stat.isFile())
return true;
- const content = await readFile8(path, "utf8");
+ const content = await readFile9(path, "utf8");
return !content.includes(RUNTIME_WRAPPER_MARKER);
} catch (error) {
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
@@ -2559,10 +9300,10 @@ async function existingNonRuntimeWrapper(path) {
}
async function existingNonShim(path) {
try {
- const stat = await lstat7(path);
+ const stat = await lstat9(path);
if (!stat.isFile())
return true;
- const content = await readFile8(path, "utf8");
+ const content = await readFile9(path, "utf8");
if (content.includes(COMMAND_SHIM_MARKER))
return false;
throw new Error(`${path} already exists and is not a generated command shim`);
@@ -2574,10 +9315,10 @@ async function existingNonShim(path) {
}
async function existingNonSymlink(path) {
try {
- const stat = await lstat7(path);
+ const stat = await lstat9(path);
if (!stat.isSymbolicLink())
return true;
- await readlink3(path);
+ await readlink4(path);
return false;
} catch (error) {
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
@@ -2586,119 +9327,9 @@ async function existingNonSymlink(path) {
}
}
-// ../src/install/codex-config-agents.ts
-var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE = ["codex-ultrawork-reviewer"];
-var CURRENT_MANAGED_CODEX_AGENT_NAMES = [
- "explorer",
- "lazycodex-worker-high",
- "lazycodex-worker-low",
- "lazycodex-worker-medium",
- "librarian",
- "metis",
- "momus",
- "plan"
-];
-var MANAGED_CODEX_AGENT_NAMES = [
- ...LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE,
- ...CURRENT_MANAGED_CODEX_AGENT_NAMES
-];
-function removeStaleManagedAgentBlocks(config, keepAgentNames) {
- const managedAgentNames = new Set(MANAGED_CODEX_AGENT_NAMES);
- return splitTomlSections(config).filter((section) => {
- if (section.header === null)
- return true;
- const agentName = parseAgentHeaderName(section.header);
- if (agentName === null || !managedAgentNames.has(agentName) || keepAgentNames.has(agentName))
- return true;
- return !section.text.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`);
- }).map((section) => section.text).join("").replace(/\n{3,}/g, `
-
-`);
-}
-function hasForeignAgentRegistration(config, agentConfig) {
- const section = findTomlSection(config, `agents.${tomlKeySegment(agentConfig.name)}`);
- if (!section)
- return false;
- return !section.text.includes(`config_file = ${JSON.stringify(agentConfig.configFile)}`);
-}
-function ensureAgentConfig(config, agentConfig) {
- const header = `agents.${tomlKeySegment(agentConfig.name)}`;
- const section = findTomlSection(config, header);
- const configFile = JSON.stringify(agentConfig.configFile);
- if (!section)
- return appendBlock(config, `[${header}]
-config_file = ${configFile}
-`);
- return replaceOrInsertSetting(config, section, "config_file", configFile);
-}
-function tomlKeySegment(value) {
- return /^[A-Za-z0-9_-]+$/.test(value) ? value : JSON.stringify(value);
-}
-
// ../src/install/codex-config-toml.ts
-import { mkdir as mkdir6, readFile as readFile10 } from "node:fs/promises";
-import { dirname as dirname8 } from "node:path";
-
-// ../src/install/codex-config-atomic-write.ts
-import { lstat as lstat8, readlink as readlink4, realpath, rename as rename3, unlink, writeFile as writeFile6 } from "node:fs/promises";
-import { basename as basename5, dirname as dirname6, isAbsolute as isAbsolute4, join as join15, resolve as resolve5 } from "node:path";
-var RENAME_RETRY_DELAYS_MS = [10, 25, 50];
-var RETRIABLE_RENAME_CODES = new Set(["EPERM", "EBUSY"]);
-async function writeFileAtomic(targetPath, data) {
- const writeTarget = await resolveSymlinkTarget(targetPath);
- const temporaryPath = join15(dirname6(writeTarget), `.tmp-${basename5(writeTarget)}-${process.pid}-${Date.now()}`);
- await writeFile6(temporaryPath, data);
- try {
- await renameWithRetry(temporaryPath, writeTarget);
- } catch (error) {
- await unlink(temporaryPath).catch((unlinkError) => {
- if (unlinkError instanceof Error)
- return;
- return;
- });
- throw error;
- }
-}
-async function resolveSymlinkTarget(targetPath) {
- try {
- const linkStats = await lstat8(targetPath);
- if (!linkStats.isSymbolicLink())
- return targetPath;
- } catch (error) {
- if (error instanceof Error)
- return targetPath;
- return targetPath;
- }
- try {
- return await realpath(targetPath);
- } catch (error) {
- if (!(error instanceof Error))
- throw error;
- const linkValue = await readlink4(targetPath);
- return isAbsolute4(linkValue) ? linkValue : resolve5(dirname6(targetPath), linkValue);
- }
-}
-async function renameWithRetry(fromPath, toPath) {
- for (let attempt = 0;; attempt += 1) {
- try {
- await rename3(fromPath, toPath);
- return;
- } catch (error) {
- if (!isRetriableRenameError(error) || attempt >= RENAME_RETRY_DELAYS_MS.length) {
- throw error;
- }
- await delay(RENAME_RETRY_DELAYS_MS[attempt] ?? 0);
- }
- }
-}
-function isRetriableRenameError(error) {
- if (!(error instanceof Error) || !("code" in error))
- return false;
- return typeof error.code === "string" && RETRIABLE_RENAME_CODES.has(error.code);
-}
-function delay(milliseconds) {
- return new Promise((resolveDelay) => setTimeout(resolveDelay, milliseconds));
-}
+import { mkdir as mkdir6, readFile as readFile11 } from "node:fs/promises";
+import { dirname as dirname9 } from "node:path";
// ../src/install/toml-setting-reader.ts
function hasTomlRootDottedKeyPrefix(config, rootKey) {
@@ -3139,8 +9770,8 @@ function isRootSetting(line, key) {
}
// ../src/install/codex-model-catalog.ts
-import { readFile as readFile9 } from "node:fs/promises";
-import { join as join16 } from "node:path";
+import { readFile as readFile10 } from "node:fs/promises";
+import { join as join18 } from "node:path";
var FALLBACK_CODEX_MODEL_CATALOG = {
current: {
model: "gpt-6-astra",
@@ -3171,9 +9802,9 @@ var FALLBACK_CODEX_MODEL_CATALOG = {
]
};
async function readCodexModelCatalog(codexPackageRoot) {
- const catalogPath = join16(codexPackageRoot, "plugin", "model-catalog.json");
+ const catalogPath = join18(codexPackageRoot, "plugin", "model-catalog.json");
try {
- const parsed = JSON.parse(await readFile9(catalogPath, "utf8"));
+ const parsed = JSON.parse(await readFile10(catalogPath, "utf8"));
return parseCodexModelCatalog(parsed) ?? FALLBACK_CODEX_MODEL_CATALOG;
} catch (error) {
if (error instanceof Error)
@@ -3254,8 +9885,8 @@ function isRootSetting2(line, key) {
}
// ../src/install/codex-multi-agent-v2-config.ts
-import { readFileSync } from "node:fs";
-import { dirname as dirname7, isAbsolute as isAbsolute5, join as join17 } from "node:path";
+import { readFileSync as readFileSync2 } from "node:fs";
+import { dirname as dirname8, isAbsolute as isAbsolute5, join as join19 } from "node:path";
var CODEX_AGENTS_HEADER = "agents";
var CODEX_MULTI_AGENT_V2_HEADER = "features.multi_agent_v2";
function ensureCodexMultiAgentV2Config(config, options = {}) {
@@ -3283,13 +9914,13 @@ function resolveCodexMultiAgentVersion(config, configPath) {
}
function resolveCatalogPath(configuredPath, configPath) {
if (configuredPath === null)
- return join17(dirname7(configPath), "models_cache.json");
- return isAbsolute5(configuredPath) ? configuredPath : join17(dirname7(configPath), configuredPath);
+ return join19(dirname8(configPath), "models_cache.json");
+ return isAbsolute5(configuredPath) ? configuredPath : join19(dirname8(configPath), configuredPath);
}
function readCatalogMultiAgentVersion(model, cachePath) {
let raw;
try {
- raw = readFileSync(cachePath, "utf8");
+ raw = readFileSync2(cachePath, "utf8");
} catch {
return null;
}
@@ -3299,10 +9930,10 @@ function readCatalogMultiAgentVersion(model, cachePath) {
} catch {
return null;
}
- if (!isRecord2(cache) || !Array.isArray(cache.models))
+ if (!isRecord8(cache) || !Array.isArray(cache.models))
return null;
for (const entry of cache.models) {
- if (!isRecord2(entry))
+ if (!isRecord8(entry))
continue;
if (entry.slug !== model && entry.id !== model)
continue;
@@ -3327,7 +9958,7 @@ function readRootModelCatalogPath(config) {
const single = config.match(/^\s*model_catalog_json\s*=\s*'([^']+)'/m);
return single?.[1] ?? null;
}
-function isRecord2(value) {
+function isRecord8(value) {
return typeof value === "object" && value !== null && !Array.isArray(value);
}
function removeFeatureFlagSetting(config, featureName) {
@@ -3395,10 +10026,10 @@ function readBooleanSetting(sectionText, key) {
// ../src/install/codex-config-toml.ts
async function updateCodexConfig(input) {
- await mkdir6(dirname8(input.configPath), { recursive: true });
+ await mkdir6(dirname9(input.configPath), { recursive: true });
let config;
try {
- config = await readFile10(input.configPath, "utf8");
+ config = await readFile11(input.configPath, "utf8");
} catch (error) {
if (!isMissingFileError(error))
throw error;
@@ -3444,14 +10075,14 @@ function isMissingFileError(error) {
}
// ../src/install/codex-git-bash-mcp-env.ts
-import { readFile as readFile11, writeFile as writeFile7 } from "node:fs/promises";
-import { join as join18 } from "node:path";
+import { readFile as readFile12, writeFile as writeFile7 } from "node:fs/promises";
+import { join as join20 } from "node:path";
var GIT_BASH_ENV_KEY = "OMO_CODEX_GIT_BASH_PATH";
async function stampGitBashMcpEnv(input) {
- const manifestPath = join18(input.pluginRoot, ".mcp.json");
+ const manifestPath = join20(input.pluginRoot, ".mcp.json");
if (!await fileExistsStrict(manifestPath))
return false;
- const parsed = JSON.parse(await readFile11(manifestPath, "utf8"));
+ const parsed = JSON.parse(await readFile12(manifestPath, "utf8"));
if (!isPlainRecord(parsed) || !isPlainRecord(parsed["mcpServers"]))
return false;
let changed = false;
@@ -3475,9 +10106,9 @@ async function stampGitBashMcpEnv(input) {
}
// ../src/install/codex-hook-trust.ts
-import { createHash as createHash3 } from "node:crypto";
-import { readFile as readFile12 } from "node:fs/promises";
-import { join as join19 } from "node:path";
+import { createHash as createHash4 } from "node:crypto";
+import { readFile as readFile13 } from "node:fs/promises";
+import { join as join21 } from "node:path";
var EVENT_LABELS = new Map([
["PreToolUse", "pre_tool_use"],
["PermissionRequest", "permission_request"],
@@ -3491,18 +10122,18 @@ var EVENT_LABELS = new Map([
["Stop", "stop"]
]);
async function trustedHookStatesForPlugin(input) {
- const manifestPath = join19(input.pluginRoot, ".codex-plugin", "plugin.json");
+ const manifestPath = join21(input.pluginRoot, ".codex-plugin", "plugin.json");
if (!await exists4(manifestPath))
return [];
- const manifest = JSON.parse(await readFile12(manifestPath, "utf8"));
+ const manifest = JSON.parse(await readFile13(manifestPath, "utf8"));
if (!isPlainRecord(manifest))
return [];
const states = [];
for (const hookPath of hookManifestPaths(manifest.hooks)) {
- const hooksPath = join19(input.pluginRoot, hookPath);
+ const hooksPath = join21(input.pluginRoot, hookPath);
if (!await exists4(hooksPath))
continue;
- const parsed = JSON.parse(await readFile12(hooksPath, "utf8"));
+ const parsed = JSON.parse(await readFile13(hooksPath, "utf8"));
if (!isPlainRecord(parsed) || !isPlainRecord(parsed.hooks))
continue;
states.push(...trustedHookStatesForHooksFile({
@@ -3567,7 +10198,7 @@ function commandHookHash(eventName, matcher, handler, command) {
if (typeof matcher === "string")
identity.matcher = matcher;
const canonical = JSON.stringify(canonicalJson(identity));
- return `sha256:${createHash3("sha256").update(canonical).digest("hex")}`;
+ return `sha256:${createHash4("sha256").update(canonical).digest("hex")}`;
}
function canonicalJson(value) {
if (Array.isArray(value))
@@ -3585,7 +10216,7 @@ function stripDotSlash(value) {
}
async function exists4(path) {
try {
- await readFile12(path, "utf8");
+ await readFile13(path, "utf8");
return true;
} catch (error) {
if (error instanceof Error)
@@ -3596,22 +10227,22 @@ async function exists4(path) {
// ../src/install/codex-installer-bin-dir.ts
import { homedir as homedir4 } from "node:os";
-import { join as join20, resolve as resolve6 } from "node:path";
+import { join as join22, resolve as resolve7 } from "node:path";
function resolveCodexInstallerBinDir(input) {
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
- return resolve6(explicitBinDir.trim());
+ return resolve7(explicitBinDir.trim());
const homeDir = input.homeDir ?? homedir4();
- const defaultCodexHome = resolve6(homeDir, ".codex");
- const resolvedCodexHome = resolve6(input.codexHome);
+ const defaultCodexHome = resolve7(homeDir, ".codex");
+ const resolvedCodexHome = resolve7(input.codexHome);
if (resolvedCodexHome !== defaultCodexHome)
- return join20(resolvedCodexHome, "bin");
- return resolve6(homeDir, ".local", "bin");
+ return join22(resolvedCodexHome, "bin");
+ return resolve7(homeDir, ".local", "bin");
}
// ../../utils/src/runtime/git-bash.ts
import { execFileSync as execFileSync2 } from "node:child_process";
-import { existsSync as existsSync2 } from "node:fs";
+import { existsSync as existsSync3 } from "node:fs";
var GIT_BASH_ENV_KEY2 = "OMO_CODEX_GIT_BASH_PATH";
var PROGRAM_FILES_GIT_BASH = "C:\\Program Files\\Git\\bin\\bash.exe";
var PROGRAM_FILES_X86_GIT_BASH = "C:\\Program Files (x86)\\Git\\bin\\bash.exe";
@@ -3652,7 +10283,7 @@ var resolveGitBashForCurrentProcess = (input = {}) => {
return resolveGitBash({
platform: input.platform ?? process.platform,
env: input.env ?? process.env,
- exists: existsSync2,
+ exists: existsSync3,
where: whereCommand
});
};
@@ -3761,20 +10392,25 @@ async function resolveGitBashStep(options, degraded) {
return false;
}
async function linkBundledAgentsStep(options) {
- const agentsTarget = join21(options.codexHome, "agents");
+ const agentsTarget = join23(options.codexHome, "agents");
try {
- const stageRoot = join21(options.pluginData, "bootstrap", "agents-stage");
+ const stageRoot = join23(options.pluginData, "bootstrap", "agents-stage");
await stageBundledAgents(options.pluginRoot, stageRoot);
const preservedReasoning = await capturePreservedAgentReasoning({ codexHome: options.codexHome });
const preservedServiceTier = await capturePreservedAgentServiceTier({ codexHome: options.codexHome });
+ const config = readDefaultRoleConfig({ env: options.env });
const linked = await linkCachedPluginAgents({
codexHome: options.codexHome,
pluginRoot: stageRoot,
preservedReasoning,
- preservedServiceTier
+ preservedServiceTier,
+ defaultRoleEnabled: config.enabled
});
const agentConfigs = linked.map((link) => ({ configFile: `./agents/${link.name}`, name: agentNameFromToml3(link.name) })).sort((left, right) => left.name.localeCompare(right.name));
- return { agentConfigs, degraded: [] };
+ return {
+ agentConfigs,
+ degraded: config.warnings.map((reason) => ({ component: "agents-config", hint: BOOTSTRAP_DOCTOR_HINT, reason }))
+ };
} catch (error) {
return {
agentConfigs: [],
@@ -3789,23 +10425,23 @@ async function linkBundledAgentsStep(options) {
}
}
async function stageBundledAgents(pluginRoot, stageRoot) {
- await rm10(stageRoot, { force: true, recursive: true });
+ await rm11(stageRoot, { force: true, recursive: true });
await mkdir7(stageRoot, { recursive: true });
- const componentsRoot = join21(pluginRoot, "components");
+ const componentsRoot = join23(pluginRoot, "components");
for (const componentName of await directoryNames(componentsRoot)) {
- const agentsDir = join21(componentsRoot, componentName, "agents");
+ const agentsDir = join23(componentsRoot, componentName, "agents");
const agentFiles = (await fileNames(agentsDir)).filter((name) => name.endsWith(".toml"));
if (agentFiles.length === 0)
continue;
- const stagedAgentsDir = join21(stageRoot, "components", componentName, "agents");
+ const stagedAgentsDir = join23(stageRoot, "components", componentName, "agents");
await mkdir7(stagedAgentsDir, { recursive: true });
for (const agentFile of agentFiles) {
- await copyFile2(join21(agentsDir, agentFile), join21(stagedAgentsDir, agentFile));
+ await copyFile2(join23(agentsDir, agentFile), join23(stagedAgentsDir, agentFile));
}
}
}
async function updateConfigStep(options, inputs, degraded) {
- const configPath = join21(options.codexHome, "config.toml");
+ const configPath = join23(options.codexHome, "config.toml");
try {
await assertWritableConfigIfPresent(configPath);
const existingConfig = await readConfigIfPresent(configPath);
@@ -3851,7 +10487,7 @@ function errorCode(error) {
}
async function readConfigIfPresent(configPath) {
try {
- return await readFile13(configPath, "utf8");
+ return await readFile14(configPath, "utf8");
} catch (error) {
if (errorCode(error) === "ENOENT")
return "";
@@ -3872,7 +10508,7 @@ async function linkComponentBinsStep(options, degraded) {
await linkRuntimeWrapperStep(options, binDir, degraded);
}
async function linkRuntimeWrapperStep(options, binDir, degraded) {
- const cliPath = join21(options.pluginRoot, "dist", "cli", "index.js");
+ const cliPath = join23(options.pluginRoot, "dist", "cli", "index.js");
try {
const linked = await linkRootRuntimeBin({
binDir,
@@ -3905,7 +10541,7 @@ async function stampGitBashEnvStep(options, degraded) {
degraded.push({
component: "git-bash-env",
hint: BOOTSTRAP_DOCTOR_HINT,
- reason: `failed to stamp ${join21(options.pluginRoot, ".mcp.json")}: ${errorMessage(error)}`
+ reason: `failed to stamp ${join23(options.pluginRoot, ".mcp.json")}: ${errorMessage(error)}`
});
}
}
@@ -3973,11 +10609,11 @@ function resolvePluginDataRoot(env) {
const fromEnv = env["PLUGIN_DATA"]?.trim();
if (fromEnv !== undefined && fromEnv.length > 0)
return fromEnv;
- return join22(homedir5(), ".local", "share", "lazycodex");
+ return join24(homedir5(), ".local", "share", "lazycodex");
}
async function readPluginVersion(pluginRoot) {
try {
- const parsed = JSON.parse(await readFile14(join22(pluginRoot, ".codex-plugin", "plugin.json"), "utf8"));
+ const parsed = JSON.parse(await readFile15(join24(pluginRoot, ".codex-plugin", "plugin.json"), "utf8"));
if (typeof parsed !== "object" || parsed === null)
return;
const version = parsed["version"];
@@ -4047,7 +10683,7 @@ async function runBootstrapWorker(options = {}) {
degraded.push({
component: "bootstrap",
hint: BOOTSTRAP_DOCTOR_HINT,
- reason: `plugin version unresolved from ${join22(pluginRoot, ".codex-plugin", "plugin.json")}`
+ reason: `plugin version unresolved from ${join24(pluginRoot, ".codex-plugin", "plugin.json")}`
});
}
for (const step of steps) {
@@ -4086,12 +10722,12 @@ function resolvePluginRoot(env) {
const fromEnv = env["PLUGIN_ROOT"]?.trim();
if (fromEnv !== undefined && fromEnv.length > 0)
return fromEnv;
- return resolve7(dirname9(fileURLToPath2(import.meta.url)), "..", "..", "..");
+ return resolve8(dirname10(fileURLToPath2(import.meta.url)), "..", "..", "..");
}
async function appendBootstrapLog(pluginData, now, event, details) {
try {
- const logPath = join22(pluginData, "bootstrap", "bootstrap.log");
- await mkdir8(dirname9(logPath), { recursive: true });
+ const logPath = join24(pluginData, "bootstrap", "bootstrap.log");
+ await mkdir8(dirname10(logPath), { recursive: true });
await appendFile2(logPath, `${JSON.stringify({ timestamp: new Date(now).toISOString(), event, ...details })}
`);
} catch {}
@@ -4256,7 +10892,7 @@ function isProcessEntry() {
if (entry === undefined)
return false;
try {
- return realpathSync(entry) === realpathSync(fileURLToPath4(import.meta.url));
+ return realpathSync2(entry) === realpathSync2(fileURLToPath4(import.meta.url));
} catch {
return false;
}
diff --git a/plugins/omo/components/bootstrap/hooks/hooks.json b/plugins/omo/components/bootstrap/hooks/hooks.json
index c17f5999..1f87fda6 100644
--- a/plugins/omo/components/bootstrap/hooks/hooks.json
+++ b/plugins/omo/components/bootstrap/hooks/hooks.json
@@ -8,7 +8,7 @@
"command": "node \"${PLUGIN_ROOT}/components/bootstrap/dist/cli.js\" hook session-start",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\bootstrap.ps1\"",
"timeout": 30,
- "statusMessage": "(OmO 5.0.0-beta.60) Checking Bootstrap Provisioning"
+ "statusMessage": "(OmO 5.0.0-beta.62) Checking Bootstrap Provisioning"
}
]
}
diff --git a/plugins/omo/components/bootstrap/package.json b/plugins/omo/components/bootstrap/package.json
index 72d10b47..0065fd18 100644
--- a/plugins/omo/components/bootstrap/package.json
+++ b/plugins/omo/components/bootstrap/package.json
@@ -1,6 +1,6 @@
{
"name": "@sisyphuslabs/codex-bootstrap",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"description": "Codex SessionStart bootstrap component that provisions LazyCodex runtime dependencies from a detached worker.",
"type": "module",
"private": true,
diff --git a/plugins/omo/components/bootstrap/src/setup.ts b/plugins/omo/components/bootstrap/src/setup.ts
index c83dec84..78961fe1 100644
--- a/plugins/omo/components/bootstrap/src/setup.ts
+++ b/plugins/omo/components/bootstrap/src/setup.ts
@@ -1,5 +1,6 @@
import { copyFile, mkdir, readFile, readdir, rm, stat } from "node:fs/promises";
import { join } from "node:path";
+import { readDefaultRoleConfig } from "../../../../src/install/codex-default-role-config.ts";
// These relative imports resolve at BUILD time in the monorepo; esbuild
// inlines the installer source modules into dist/cli.js so PLUGIN_ROOT ships
@@ -94,16 +95,21 @@ async function linkBundledAgentsStep(options: WorkerSetupOptions): Promise<Agent
await stageBundledAgents(options.pluginRoot, stageRoot);
const preservedReasoning = await capturePreservedAgentReasoning({ codexHome: options.codexHome });
const preservedServiceTier = await capturePreservedAgentServiceTier({ codexHome: options.codexHome });
+ const config = readDefaultRoleConfig({ env: options.env });
const linked = await linkCachedPluginAgents({
codexHome: options.codexHome,
pluginRoot: stageRoot,
preservedReasoning,
preservedServiceTier,
+ defaultRoleEnabled: config.enabled,
});
const agentConfigs = linked
.map((link) => ({ configFile: `./agents/${link.name}`, name: agentNameFromToml(link.name) }))
.sort((left, right) => left.name.localeCompare(right.name));
- return { agentConfigs, degraded: [] };
+ return {
+ agentConfigs,
+ degraded: config.warnings.map((reason) => ({ component: "agents-config", hint: BOOTSTRAP_DOCTOR_HINT, reason })),
+ };
} catch (error) {
return {
agentConfigs: [],
diff --git a/plugins/omo/components/comment-checker/hooks/hooks.json b/plugins/omo/components/comment-checker/hooks/hooks.json
index e26d3962..dafe1ce1 100644
--- a/plugins/omo/components/comment-checker/hooks/hooks.json
+++ b/plugins/omo/components/comment-checker/hooks/hooks.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-tool-use",
"timeout": 30,
- "statusMessage": "(OmO 5.0.0-beta.60) Checking Comments"
+ "statusMessage": "(OmO 5.0.0-beta.62) Checking Comments"
}
]
}
diff --git a/plugins/omo/components/comment-checker/package.json b/plugins/omo/components/comment-checker/package.json
index c8bf1657..ff6eb333 100644
--- a/plugins/omo/components/comment-checker/package.json
+++ b/plugins/omo/components/comment-checker/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-comment-checker",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"description": "Codex plugin that runs comment-checker after edit-like PostToolUse hooks.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/git-bash/hooks/hooks.json b/plugins/omo/components/git-bash/hooks/hooks.json
index 82daebf2..075d8bef 100644
--- a/plugins/omo/components/git-bash/hooks/hooks.json
+++ b/plugins/omo/components/git-bash/hooks/hooks.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook pre-tool-use",
"timeout": 5,
- "statusMessage": "(OmO 5.0.0-beta.60) Recommending Git Bash MCP"
+ "statusMessage": "(OmO 5.0.0-beta.62) Recommending Git Bash MCP"
}
]
}
@@ -20,7 +20,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-compact",
"timeout": 5,
- "statusMessage": "(OmO 5.0.0-beta.60) Resetting Git Bash MCP Reminder"
+ "statusMessage": "(OmO 5.0.0-beta.62) Resetting Git Bash MCP Reminder"
}
]
}
diff --git a/plugins/omo/components/git-bash/package.json b/plugins/omo/components/git-bash/package.json
index 8d555846..a4bc7a34 100644
--- a/plugins/omo/components/git-bash/package.json
+++ b/plugins/omo/components/git-bash/package.json
@@ -1,6 +1,6 @@
{
"name": "@sisyphuslabs/codex-git-bash-hook",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"description": "Codex hook component that reminds Windows sessions to prefer the OMO git_bash MCP.",
"type": "module",
"private": true,
diff --git a/plugins/omo/components/lazycodex-executor-verify/hooks/hooks.json b/plugins/omo/components/lazycodex-executor-verify/hooks/hooks.json
index e400294b..58693aa2 100644
--- a/plugins/omo/components/lazycodex-executor-verify/hooks/hooks.json
+++ b/plugins/omo/components/lazycodex-executor-verify/hooks/hooks.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/lazycodex-executor-verify/dist/cli.js\" hook subagent-stop",
"timeout": 10,
- "statusMessage": "(OmO 5.0.0-beta.60) Verifying LazyCodex Executor Evidence"
+ "statusMessage": "(OmO 5.0.0-beta.62) Verifying LazyCodex Executor Evidence"
}
]
}
diff --git a/plugins/omo/components/lazycodex-executor-verify/package.json b/plugins/omo/components/lazycodex-executor-verify/package.json
index a478c495..10b48b23 100644
--- a/plugins/omo/components/lazycodex-executor-verify/package.json
+++ b/plugins/omo/components/lazycodex-executor-verify/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-lazycodex-executor-verify",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"description": "Codex SubagentStop evidence verifier for LazyCodex executor completions.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/lsp/dist/.omo-runtime-manifest.json b/plugins/omo/components/lsp/dist/.omo-runtime-manifest.json
index 1a0fa368..116ec94e 100644
--- a/plugins/omo/components/lsp/dist/.omo-runtime-manifest.json
+++ b/plugins/omo/components/lsp/dist/.omo-runtime-manifest.json
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
- "version": "5.0.0-beta.60",
- "inputDigest": "sha256:35c40ea27ccc412089d9bcf1e58810b6889dd51c24d269191d092bf8ed3c4c4d",
+ "version": "5.0.0-beta.62",
+ "inputDigest": "sha256:e446f10ad4c491792dbc8ed087ce021ad5586be482dffee363dd2f14c242f003",
"outputs": [
{
"path": "cli.d.ts",
diff --git a/plugins/omo/components/lsp/hooks/hooks.json b/plugins/omo/components/lsp/hooks/hooks.json
index 75cdaf0c..6c247793 100644
--- a/plugins/omo/components/lsp/hooks/hooks.json
+++ b/plugins/omo/components/lsp/hooks/hooks.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-tool-use",
"timeout": 60,
- "statusMessage": "(OmO 5.0.0-beta.60) Checking LSP Diagnostics"
+ "statusMessage": "(OmO 5.0.0-beta.62) Checking LSP Diagnostics"
}
]
}
@@ -21,7 +21,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-compact",
"timeout": 5,
- "statusMessage": "(OmO 5.0.0-beta.60) Resetting LSP Diagnostics Cache"
+ "statusMessage": "(OmO 5.0.0-beta.62) Resetting LSP Diagnostics Cache"
}
]
}
diff --git a/plugins/omo/components/lsp/package.json b/plugins/omo/components/lsp/package.json
index ec58f010..d029e1a1 100644
--- a/plugins/omo/components/lsp/package.json
+++ b/plugins/omo/components/lsp/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-lsp",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"description": "Codex plugin that exposes Language Server Protocol tools and post-edit diagnostics.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/rules/hooks/hooks.json b/plugins/omo/components/rules/hooks/hooks.json
index 60ce0abe..cb6ff0d2 100644
--- a/plugins/omo/components/rules/hooks/hooks.json
+++ b/plugins/omo/components/rules/hooks/hooks.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook session-start",
"timeout": 10,
- "statusMessage": "(OmO 5.0.0-beta.60) Loading Project Rules"
+ "statusMessage": "(OmO 5.0.0-beta.62) Loading Project Rules"
}
]
}
@@ -19,7 +19,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook user-prompt-submit",
"timeout": 10,
- "statusMessage": "(OmO 5.0.0-beta.60) Loading Project Rules"
+ "statusMessage": "(OmO 5.0.0-beta.62) Loading Project Rules"
}
]
}
@@ -32,7 +32,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-tool-use",
"timeout": 10,
- "statusMessage": "(OmO 5.0.0-beta.60) Matching Project Rules"
+ "statusMessage": "(OmO 5.0.0-beta.62) Matching Project Rules"
}
]
}
@@ -45,7 +45,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-compact",
"timeout": 10,
- "statusMessage": "(OmO 5.0.0-beta.60) Resetting Project Rule Cache"
+ "statusMessage": "(OmO 5.0.0-beta.62) Resetting Project Rule Cache"
}
]
}
diff --git a/plugins/omo/components/rules/package.json b/plugins/omo/components/rules/package.json
index 3402561a..8aa13093 100644
--- a/plugins/omo/components/rules/package.json
+++ b/plugins/omo/components/rules/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-rules",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"description": "Codex plugin that injects project rule files into model context through lifecycle hooks.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/teammode/hooks/hooks.json b/plugins/omo/components/teammode/hooks/hooks.json
index 3d1097be..0b9a8803 100644
--- a/plugins/omo/components/teammode/hooks/hooks.json
+++ b/plugins/omo/components/teammode/hooks/hooks.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-tool-use",
"timeout": 10,
- "statusMessage": "(OmO 5.0.0-beta.60) Checking Thread Title Hygiene"
+ "statusMessage": "(OmO 5.0.0-beta.62) Checking Thread Title Hygiene"
}
]
}
diff --git a/plugins/omo/components/teammode/package.json b/plugins/omo/components/teammode/package.json
index 42c981f1..ce12ddf5 100644
--- a/plugins/omo/components/teammode/package.json
+++ b/plugins/omo/components/teammode/package.json
@@ -1,6 +1,6 @@
{
"name": "@sisyphuslabs/codex-teammode",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"description": "Codex team-mode hook component that keeps background thread titles descriptive after create_thread.",
"type": "module",
"private": true,
diff --git a/plugins/omo/components/telemetry/hooks/hooks.json b/plugins/omo/components/telemetry/hooks/hooks.json
index b3c91b96..f807423b 100644
--- a/plugins/omo/components/telemetry/hooks/hooks.json
+++ b/plugins/omo/components/telemetry/hooks/hooks.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook session-start",
"timeout": 5,
- "statusMessage": "(OmO 5.0.0-beta.60) Recording Session Telemetry"
+ "statusMessage": "(OmO 5.0.0-beta.62) Recording Session Telemetry"
}
]
}
diff --git a/plugins/omo/components/telemetry/package.json b/plugins/omo/components/telemetry/package.json
index d3859e78..69d6095c 100644
--- a/plugins/omo/components/telemetry/package.json
+++ b/plugins/omo/components/telemetry/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-telemetry",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"description": "Codex plugin component that emits omo-codex anonymous daily-active telemetry on SessionStart.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/ultrawork/dist/cli.js b/plugins/omo/components/ultrawork/dist/cli.js
index 6dd37ea0..e68e5452 100755
--- a/plugins/omo/components/ultrawork/dist/cli.js
+++ b/plugins/omo/components/ultrawork/dist/cli.js
@@ -353,17 +353,26 @@ make the child continue old parent context instead of the delegated task.
If your tool list has a flat \`spawn_agent\` with a required \`task_name\` instead of \`multi_agent_v1.*\` (\`multi_agent_v2\`), rewrite: \`fork_context: false\` becomes \`fork_turns: "none"\`, \`send_input\` becomes \`send_message\`, finished agents end on their own (no \`close_agent\`; \`followup_task\` re-tasks, \`interrupt_agent\` stops), and \`wait_agent\` takes only \`timeout_ms\`, returning on any child mailbox activity.
# TOML-backed subagent routing compatibility
-Installed role TOMLs (\`~/.codex/agents/\`) bind ONLY via \`agent_type\`.
-\`multi_agent_v1.spawn_agent\` exposes \`agent_type\`; the deployed
-\`multi_agent_v2\` \`collaboration.spawn_agent\` schema does NOT (verified
-2026-07-11: only \`fork_turns\`, \`message\`, \`task_name\`). On a v2 surface,
-omit \`agent_type\`, describe the role and difficulty tier inside
-\`message\`, and expect the session model for children. Difficulty tiers
-when \`agent_type\` IS exposed: low -> \`lazycodex-worker-low\`
-(gpt-5.6-luna/high), medium -> \`lazycodex-worker-medium\`
-(gpt-5.6-luna/max), high -> \`lazycodex-worker-high\` (gpt-5.6-sol/max);
-explorer/librarian carry their own TOMLs (gpt-5.6-luna/low). Difficulty
-(model power) is orthogonal to LIGHT/HEAVY rigor (process size).
+Inspect the ACTUAL spawn tool schema, not a version or namespace assumption.
+When \`agent_type\` is exposed (V1 or V2), EVERY spawn MUST pass an exact
+LazyCodex role: \`explorer\`, \`librarian\`, \`plan\`, \`metis\`, \`momus\`,
+\`lazycodex-worker-low\`, \`lazycodex-worker-medium\`, \`lazycodex-worker-high\`,
+\`lazycodex-code-reviewer\`, \`lazycodex-qa-executor\`, \`lazycodex-gate-reviewer\`,
+or \`lazycodex-clone-fidelity-reviewer\`. Map implementation difficulty to
+worker low/medium/high; their installed TOMLs supply model and instructions.
+Never select generic \`worker\`/\`default\` or describe a role instead of selecting it.
+Use \`fork_turns: "none"\` on V2 or \`fork_context: false\` on V1 unless full
+history is deliberately required; even a deliberate fork MUST name its role.
+
+Legacy-schema exception: ONLY when \`agent_type\` is absent, omit that unsupported
+field and carry the role, difficulty, and complete instructions in \`message\`;
+explicitly disable history. This cannot select a specialized TOML. The managed
+\`default\` supplies the medium worker for unnamed non-forks, unless opted out or
+blocked by a preserved user default. The spawn guard cannot see the schema and
+rejects unnamed requests: report incompatible routing, do not retry generically.
+An unnamed full-history fork skips role application inside Codex; no LazyCodex
+config can fix that upstream gap. Never claim this path has been repaired.
+Difficulty (model power) is orthogonal to LIGHT/HEAVY rigor (process size).
Treat child status as a progress signal, not a timeout counter. For
work likely to exceed one wait cycle, tell the child to send
diff --git a/plugins/omo/components/ultrawork/hooks/hooks.json b/plugins/omo/components/ultrawork/hooks/hooks.json
index abaf3fdf..663ee53f 100644
--- a/plugins/omo/components/ultrawork/hooks/hooks.json
+++ b/plugins/omo/components/ultrawork/hooks/hooks.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook user-prompt-submit",
"timeout": 5,
- "statusMessage": "(OmO 5.0.0-beta.60) Checking Ultrawork Trigger"
+ "statusMessage": "(OmO 5.0.0-beta.62) Checking Ultrawork Trigger"
}
]
}
diff --git a/plugins/omo/components/ultrawork/package.json b/plugins/omo/components/ultrawork/package.json
index 66ec4c62..eeb265d7 100644
--- a/plugins/omo/components/ultrawork/package.json
+++ b/plugins/omo/components/ultrawork/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-ultrawork",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"description": "Codex plugin that injects the ultrawork orchestration directive and ships LazyCodex planning, review, QA, and gate agent roles.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/ultrawork/src/directive-content.ts b/plugins/omo/components/ultrawork/src/directive-content.ts
index 40465f1b..de78a850 100644
--- a/plugins/omo/components/ultrawork/src/directive-content.ts
+++ b/plugins/omo/components/ultrawork/src/directive-content.ts
@@ -1,4 +1,4 @@
// GENERATED by scripts/sync-directive.mjs from packages/prompts-core/prompts/ultrawork/codex.md.
// Do not hand-edit. Freshness is enforced by test/directive-source.test.ts.
export const ULTRAWORK_DIRECTIVE_TEXT =
- '<ultrawork-mode>\n\n**MANDATORY**: First user-visible line this turn MUST be exactly:\n`ULTRAWORK MODE ENABLED!`\n\n[CODE RED] Maximum precision. Outcome-first. Evidence-driven.\n\n# Role\nExpert coding agent. Ship verified work. No process narration.\n\n# Goal\nDeliver EXACTLY what the user asked, end-to-end working, proven by\ncaptured evidence: a failing-first proof that went RED→GREEN through\nthe cheapest faithful channel, plus real-surface proof sized by the\ntier below. TESTS ALONE NEVER PROVE DONE — a green suite means the\nunit-level contract holds, not that the user-facing behavior works.\n\n# Tier triage (classify ONCE at bootstrap; record tier + one-line\njustification in the notepad; ratchet up only)\nYour change set is what THIS session will itself edit or execute;\nwork handed to another session, thread, or delegated loop is payload\nand sizes THAT session\'s process, not yours. Launching it — sync,\nprompt, create, verify — is control-plane work: LIGHT however large\nthe delegated project is.\nDefault is LIGHT. Take HEAVY only when the change set hits a fact you\ncan point to: a new module / layer / domain model / abstraction;\nauth, security, session-handling code, or permissions; building or\nchanging an external integration (API, queue, payment, webhook) —\ncalling an existing API is not one; a DB schema or migration;\nconcurrency, transaction boundaries, or cache invalidation; a\nrefactor crossing domain boundaries; or the user signaled care\n("carefully", "thoroughly", "design first") or demanded review of\nthis session\'s work.\nWhen unsure, take HEAVY. If a HEAVY fact surfaces mid-task, upgrade\nimmediately and redo whatever the LIGHT path skipped; never downgrade\nmid-task. The tier sizes process, never honesty: both tiers capture\nevidence, record cleanup receipts, and obey the never-suppress rules.\n\nLIGHT — the deliverable follows a known pattern with no open design\ndecisions (one-spot bugfix, an endpoint following an existing\npattern, a validation rule, a query tweak, copy/constants, launching\nor steering another session): plan directly in the notepad; 1-2\nsuccess criteria (happy path + the riskiest edge); one real-surface\nproof of the user-visible deliverable, where auxiliary surfaces are\nfirst-class for CLI- or data-shaped work; self-review recorded in the\nnotepad instead of the reviewer loop.\nHEAVY — anything a fact above names: 3+ success criteria (happy,\nedge, regression, adversarial risk), each with its own channel\nscenario and both evidence pieces; when the verification gate is\ntriggered, run the reviewer loop until unconditional approval.\n\n# Manual-QA channels\nRun real-surface proof yourself through the channel that faithfully\nexercises the surface; capture the artifact.\n\n 1. HTTP call — hit the live endpoint with `curl -i` (or a\n Playwright APIRequestContext); capture status line + headers +\n body.\n 2. Terminal / TUI - drive a real pty and prove it through the\n xterm.js web terminal (see the TUI visual QA note below). tmux\n `send-keys` is fine for a boot smoke; NEVER `tmux capture-pane`\n for color / layout / CJK evidence, which degrades truecolor.\n 3. Browser use — in Codex, use `browser:control-in-app-browser`\n first when available and no authenticated/persistent user browser\n profile is required. Otherwise use Chrome to drive the REAL page;\n if Chrome is not available, download and use agent-browser\n (https://github.com/vercel-labs/agent-browser). Capture action\n log + screenshot path. Never downgrade to a non-browser surface\n for a browser-facing criterion. NEVER clear cookies, cache, or\n site data (`Network.clearBrowserCookies`, `Storage.clearCookies`,\n `chrome.browsingData.remove`, "clear browsing data") on the user\'s\n real/main browser profile — it wipes their logged-in state. If you\n need that profile\'s login state, clone it first (`rsync -a\n <profile>/ <tmp-clone>/`) and launch Chrome / agent-browser against\n the clone as the user-data-dir; run any clearing there only.\n 4. Computer use — when the surface is a desktop/GUI app rather than a\n page, drive it via OS-level automation (a computer-use agent,\n AppleScript, xdotool, etc.) against the running app; capture\n action log + screenshot. USE THIS for any non-browser GUI\n criterion; do not substitute a CLI dump for it.\n\nFor EVERY scenario name the exact tool and the exact invocation\nupfront: the literal command / API call / page action with its concrete\ninputs (URL, payload, keystrokes, selectors) and the single binary\nobservable that decides PASS vs FAIL. "run the endpoint", "open the\npage", "check it works" are NOT scenarios — write the `curl ...`, the\n`send-keys ...`, the Browser plugin action, the `page.click(...)`, the\nexpected status/text.\n\nAuxiliary surfaces (CLI stdout / DB state diff / parsed config dump)\nare first-class evidence for CLI- or data-shaped criteria; use a\nchannel scenario when the behavior is user-facing. `--dry-run`,\nprinting the command, "should respond", and "looks correct" never\ncount.\n\nFor TUI visual QA, render the terminal through the real xterm.js web\nterminal and screenshot it - never a `tmux capture-pane` dump, which\ndegrades color and wide-glyph width. In this repo:\n`node script/qa/web-terminal-visual-qa.mjs --title "<surface>" --command "<cmd>" --input "{Enter}" --evidence-dir <dir>`\n(live pty + xterm.js in Chrome; `--from-file <capture>` replays a raw\nstream). Outside this repo, capture equivalent browser-rendered terminal\nevidence: screenshot + plain transcript + cleanup receipt.\n\n# Bootstrap (DO ALL FOUR BEFORE ANY OTHER WORK — NO SKIPPING)\n\n## 0. Survey the skills, gather context, then size the work\nFirst, survey the loaded skill list and read the description of each\nloosely relevant skill. Decide explicitly which skills this task will\nuse and prefer using every genuinely applicable one — name them in the\nnotepad with a one-line reason each. Skipping a skill that fits the\ntask is a defect. Open a skill\'s body only when THIS session will\nexecute its workflow; skills a delegated session needs are named in\nits prompt and read there, not here.\nNext, fire the first discovery wave under Finding things below.\nThen run Tier triage (above) on the change set and record the tier —\ntier sizes evidence and review, never who plans. Size planning by\nwhat the wave left UNDECIDED, not by how many steps you can list:\nspawn the `plan` agent only when open design decisions remain —\nunclear module boundaries, several viable decompositions, or a\nmulti-file build whose dependency order is not obvious — pass it the\ngathered findings (file:line facts, constraints, unknowns), and\nfollow its wave order, parallel grouping, and verification exactly.\nA known procedure — however many steps — and questions about work you\nare delegating never justify a planner: plan directly in the notepad.\nNever spawn `plan` before the discovery wave has returned.\n\n## 1. Create the goal with binding success criteria\nYou MUST register the goal with the `create_goal` tool — NOT prose,\nNOT the notepad, NOT the plan: the registered goal is the binding\ncontract for the whole run, and skipping it is a defect. Call it with\nexactly `objective`; do not include `status`. Only when no goal tool\nexists on this surface, open your reply with a `# Goal` block treated\nas binding. Goals are unlimited; never invent a numeric budget or\nlimit.\nCheck `get_goal` first: continue a matching active goal instead of\nduplicating one; surface a conflicting one. Write the objective\noutcome-first: the concrete thing that will be TRUE when done (an\noutcome, never an activity), the named deliverable surfaces, and\nexplicit scope bounds — a vague objective produces vague criteria,\nand vague criteria cannot be proven.\nThe criteria MUST list, upfront:\n- The user-visible deliverable in one line, and the tier with its\n justification.\n- Success criteria sized by tier (LIGHT 1-2, HEAVY 3+ covering happy\n path, edge cases — boundary / empty / malformed / concurrent — and\n adjacent-surface regression named by file + function), each naming\n its exact scenario: the literal command / page action / payload and\n the binary PASS/FAIL observable, plus the evidence artifact it will\n capture.\n- For each criterion, the failing-first proof (test id or scenario)\n that will be captured RED BEFORE the implementation and GREEN after.\n Evidence added after the green code does NOT satisfy this.\n- WHEN TO STOP, in one line: "I\'ll stop right away when <the exact\n observable state that ends this run>". The Stop rules bind to this\n line — the moment it holds, you stop.\n\nThese scenarios are the contract. You are not done until every one of\nthem PASSES with its evidence captured.\n\n## 2. Open the durable notepad\nRun: `NOTE=$(mktemp -t ulw-$(date +%Y%m%d-%H%M%S).XXXXXX.md)`. Echo the\npath. Initialise it with these sections and APPEND (never rewrite) as\nyou work:\n\n```\n# Ultrawork Notepad — <one-line goal>\nStarted: <ISO timestamp>\n\n## Plan (exhaustively detailed)\n<every step you will take, in order, broken to atomic actions>\n\n## Success criteria + QA scenarios\n<copied from the goal>\n\n## Now\n<the single step in progress>\n\n## Todo\n<every remaining step, ordered>\n\n## Findings\n<every non-obvious fact discovered, with file:line refs>\n\n## Learnings\n<patterns / pitfalls / principles to remember next turn>\n```\n\nAppend each finding, decision, command, RED/GREEN capture, and QA\nartifact path the moment it happens. Update `## Now` and\n`## Todo` on every transition. Append-only — never rewrite. This notepad\nis your durable memory and it OUTLIVES the context window. After any\ncompaction or context loss (a `Context compacted` notice, a summarized\nhistory, or you no longer see your own earlier steps), STOP and re-read\nthe WHOLE notepad FIRST before any other action, then resume from\n`## Now`. Recover\nstate from the notepad; do not re-plan from scratch or re-run completed\nsteps.\n\n## 3. Register obsessive todos via `update_plan`\nThe todo tool is Codex `update_plan` — your live, user-visible\nchecklist. Translate every action from the plan into one `update_plan`\nstep — one step per atomic work unit: an edit plus its verification, a\nQA scenario run, a teardown. Keep each step small enough to finish\nwithin a few tool calls.\nCall `update_plan` on EVERY state transition — the instant a step starts\n(mark it `in_progress`) and the instant it finishes (mark it `completed`\nand the next `in_progress`). Exactly ONE `in_progress` at a time. Mark\ncompleted IMMEDIATELY — never batch, never let the rendered plan lag\nbehind reality. Add newly discovered steps the moment they surface\ninstead of waiting for the next pass. Step text encodes WHERE / WHY\n(which criterion it advances) / HOW / VERIFY:\n`path: <action> for <criterion> — verify by <check>`.\n\nGOOD pair (test-first, ordered):\n `foo.test.ts: Write FAILING case invalid-email→ValidationError for criterion 2 — verify by RED with assertion msg`\n `src/foo/bar.ts: Implement validateEmail() RFC-5322-lite for criterion 2 — verify by foo.test.ts GREEN + curl 400 body`\nBAD: "Implement feature" / "Fix bug" / "Add tests later" / writing\nproduction code before its failing test → rewrite.\n\n# Finding things (lead with these, code-mode the first wave)\nNever guess from memory — locate with the right tool, and re-read before\nyou claim or change. **USE CODE MODE AGGRESSIVELY FOR BOUNDED WAVES.**\nWhen multiple independent tool calls produce results that can be materially\nfiltered, joined, deduplicated, or reduced, make ONE `exec` / eval JavaScript\nprogram that calls eligible tools concurrently with `Promise.all` and emits only\ndecision-relevant evidence. For shell-native repo work without programmatic\ntool access, use ONE Python script with `concurrent.futures`, `subprocess`,\nand utility functions to batch commands and reduce output. Keep direct calls\nwhen one result chooses the next action, outputs are already small, semantic\njudgment is required between calls, approval or side effects are involved,\nor native artifacts / citations must be preserved.\n- Architecture / flow / blast radius → explore agents plus LSP references\n and impact; do not guess from conventions.\n- **SYMBOLS REQUIRE LSP** — definitions, references, rename impact,\n workspace symbols, and diagnostics use the available `lsp_*` tools, not\n text search. Run diagnostics after edits and treat errors as blocking.\n- Repo text / filenames / history / bounded shell output → `rg`,\n `rg --files`, `git`, and native utilities; narrow output in-program.\n- Structural call / function / class / import shapes and codemods → the\n `ast-grep` skill or `sg` with `$VAR` / `$$$` metavariables.\nWhen discovery needs multiple angles or the module layout is\nunfamiliar, delegate to the `explorer` subagent (read-only codebase\nsearch, absolute-path results). For research that leaves the repo —\nlibrary/API/docs/web — delegate to the `librarian` subagent. Spawn them\n`fork_context: false` and keep doing root work while they run.\n\n# Execution loop (PIN → RED → GREEN → SURFACE → CLEAN)\nUntil every success criterion PASSES with its evidence captured:\n1. Pick next criterion → mark in_progress → update notepad `## Now`.\n2. PIN + RED: when refactoring behavior whose regressions the change\n could hide, first pin it with a characterization test that passes on\n the unchanged code. Then\n capture the failing-first proof through the cheapest faithful\n channel — a unit test where a seam exists, an integration/e2e test\n where the behavior lives in wiring, or the criterion\'s real-surface\n scenario captured failing when no test seam exists. It must fail\n for the RIGHT reason (not a syntax error, not a missing import).\n Paste RED output into the notepad. No production code yet.\n TEST-ONLY TARGET (regression coverage for behavior that is already\n correct): there is no natural RED and no production change to make\n — this is the sole exception to the production-RED/GREEN steps.\n Substitute a mutation proof: temporarily force the exact regression\n each new assertion names (revert the fix commit or break the seam,\n never committed), capture the assertion failing, then revert the\n mutation and capture GREEN. An assertion that stays green under its\n mutation is not coverage — fix the fixture (a value equal to the\n default it must override proves nothing) or assert the artifact the\n criterion names, never an expected value re-derived from the output\n under test. Reverting the probe IS the GREEN; skip step 3\'s\n production change for a TEST-ONLY task and go to step 4.\n PROSE TARGET (prompt, SKILL.md, rule, markdown): the wording is\n NOT the behavior — never pin sentences, phrase presence/absence,\n or word/char counts. PIN only a machine-consumed value (parsed\n frontmatter field, a sentinel token a hook greps, the doc\'s JSON\n sample through its real validator) or one `toBe` equality between\n two shipped copies. A pure-prose change with no machine consumer\n has NO seam: ship it on review + QA-by-read, NO test — a text grep\n is pretend-coverage, not RED proof.\n3. GREEN (skip for TEST-ONLY — reverting the mutation is GREEN): write\n the SMALLEST production change that flips RED→GREEN.\n Before GREEN work that depends on external review, PR, issue, or\n branch state, refresh current branch/PR/issue state and preserve existing ordering/policy;\n separate compatibility detection from policy changes unless the goal\n explicitly asks to change policy.\n Re-run the proof. Capture GREEN output. A GREEN far larger than the\n criterion implies means the proof was too coarse — split it.\n4. SURFACE: run the real-surface proof the criterion named (channel\n table above; auxiliary surface for CLI- or data-shaped criteria),\n end-to-end, yourself. If the RED proof was the scenario itself,\n re-run it now and capture it passing. Paste the artifact path into\n the notepad.\n5. CLEANUP (PAIRED — NEVER SKIP): the moment a QA scenario spawns any\n resource, register its teardown as its own todo (e.g.\n `cleanup: kill server pid for criterion 2 — verify kill -0 fails`).\n Every runtime artifact the QA spawned in step 4 MUST be torn down\n before this step completes:\n server PIDs (`kill <pid>`; verify `kill -0` fails), `tmux` sessions\n (`tmux kill-session -t ulw-qa-<criterion>`; verify with `tmux ls`),\n browser / Playwright contexts (`.close()`), containers\n (`docker rm -f`), bound ports (`lsof -i :<port>` empty), temp\n sockets / files / dirs (`rm -rf` the `mktemp` paths), QA-only env\n vars. Append a one-line cleanup receipt to the notepad next to the\n artifact, e.g. `cleanup: killed 12345; tmux kill-session ulw-qa-foo;\n rm -rf /tmp/ulw.aB12cD`. No receipt → criterion stays in_progress.\n6. Verify: LSP diagnostics clean on changed files + the test scope\n this criterion touched green (no skipped, no xfail added this\n turn). Re-run a validation command (suite, typecheck, build) only\n when its inputs changed since its last green run; ONE full-suite\n pass belongs immediately before the final message, not after\n every increment.\n7. Mark completed. Append non-obvious findings / learnings.\n8. After each increment, re-run the scenarios that increment could\n have affected; re-run the full set once, right before the final\n message. Record PASS/FAIL inline with the evidence paths AND the\n cleanup receipt. Loop until all PASS.\n\nWithin a step, follow Finding things; NEVER parallelise RED and GREEN of\nthe same criterion.\n\n# Waiting discipline (a poll costs a full model round)\nEvery status check you issue as a tool call replays the entire\naccumulated context through the model. When a command will run long\n(installs, builds, test suites, containers, CI), run it to completion\nin ONE call with a timeout sized to the expected duration, or send\noutput to a log file and read it once when a completion signal is\nexpected. Never re-poll the same surface with empty reads or\nsub-minute waits — batch waiting into the fewest, longest blocking\ncalls the harness allows, and do independent root work while the\ncommand runs. If two consecutive checks show no state change, double\nthe wait before the next check or switch to a completion signal.\n\n# Codex subagent reliability\nEvery `multi_agent_v1.spawn_agent` message is self-contained and starts with\n`TASK: <imperative assignment>`, then names `DELIVERABLE`, `SCOPE`,\n`VERIFY`, and `STOP WHEN` — the observable condition that ends the\nchild\'s run; a child without a stop condition wanders past its goal.\nState that it is an executable assignment, not a context handoff. Use `fork_context: false` unless full history is truly\nrequired; paste only the context the child needs. Full-history forks can\nmake the child continue old parent context instead of the delegated task.\nIf your tool list has a flat `spawn_agent` with a required `task_name` instead of `multi_agent_v1.*` (`multi_agent_v2`), rewrite: `fork_context: false` becomes `fork_turns: "none"`, `send_input` becomes `send_message`, finished agents end on their own (no `close_agent`; `followup_task` re-tasks, `interrupt_agent` stops), and `wait_agent` takes only `timeout_ms`, returning on any child mailbox activity.\n\n# TOML-backed subagent routing compatibility\nInstalled role TOMLs (`~/.codex/agents/`) bind ONLY via `agent_type`.\n`multi_agent_v1.spawn_agent` exposes `agent_type`; the deployed\n`multi_agent_v2` `collaboration.spawn_agent` schema does NOT (verified\n2026-07-11: only `fork_turns`, `message`, `task_name`). On a v2 surface,\nomit `agent_type`, describe the role and difficulty tier inside\n`message`, and expect the session model for children. Difficulty tiers\nwhen `agent_type` IS exposed: low -> `lazycodex-worker-low`\n(gpt-5.6-luna/high), medium -> `lazycodex-worker-medium`\n(gpt-5.6-luna/max), high -> `lazycodex-worker-high` (gpt-5.6-sol/max);\nexplorer/librarian carry their own TOMLs (gpt-5.6-luna/low). Difficulty\n(model power) is orthogonal to LIGHT/HEAVY rigor (process size).\n\nTreat child status as a progress signal, not a timeout counter. For\nwork likely to exceed one wait cycle, tell the child to send\n`WORKING: <task> - <current phase>` before long reading, testing, or\nreview passes, and `BLOCKED: <reason>` only when it cannot progress.\nTrack spawned agent names locally. Use `multi_agent_v1.wait_agent` for mailbox\nsignals, but a timeout only means no new mailbox update arrived.\nTreat a running child as alive and keep doing independent root work.\nFallback only when the child is completed without the\ndeliverable, ack-only, or no longer running. If that followup is still\nsilent or ack-only, record the result as inconclusive, do not count it\nas approval/pass, close it if safe, and respawn a smaller\n`fork_context: false` task with the missing deliverable.\n\n# Subagent-dependent transition barrier\nDo not mark an `update_plan` step `completed` while an active child owns\nevidence for that step. Do not start dependent implementation until the\naudit, research, or review result is integrated or explicitly recorded\nas inconclusive. Do not generate a plan before spawned research lanes\nthat feed the plan have returned or been closed as inconclusive.\nSpawn every independent child for the current wave first. After the wave\nis launched, run `multi_agent_v1.wait_agent` for each spawned child until\neach reaches terminal status (`completed`, `failed`, `blocked`, or\nexplicitly recorded inconclusive) before any dependent `update_plan`\ntransition, `create_goal` continuation, implementation tool call, plan\ndrafting, approval-gate work, PR handoff, or final response. A timeout is\nnot terminal status.\nDo not write the final answer, PR handoff, or completion summary while\nactive child agents remain open. Use `multi_agent_v1.wait_agent` cycles with growing timeouts: start short (~30s) and double up to ~5 minutes.\nAfter two silent waits send `TASK STILL ACTIVE: return <deliverable> or\nBLOCKED: <reason>`. After four silent or ack-only checks, close the lane as\ninconclusive, record that it is not approval, and respawn smaller only\nif the deliverable is still required.\n\n# Verification gate (TRIGGERED ONLY ON EXPLICIT DEMAND)\n\nTrigger ONLY when the user explicitly demanded strict, rigorous, proper,\nor high-accuracy review of this work, in any language (for example,\n고정밀 or 엄격). The tier alone never triggers the gate. HEAVY without\nsuch a demand records the same self-review as LIGHT.\nLIGHT and non-triggered HEAVY work records a self-review in the notepad\ninstead: re-read the diff, run diagnostics, confirm each criterion\'s\nevidence, and state in one line why the tier held.\n\nWhen triggered, follow this procedure (NON-NEGOTIABLE):\n1. Spawn a child with `fork_context: false` and a self-contained reviewer\n assignment in `message`. The `multi_agent_v1.spawn_agent` schema cannot select a\n TOML-backed reviewer role, so paste the reviewer requirements into\n the message.\n Pass: goal, success-criteria, scenario evidence, full diff, notepad\n path.\n2. Verify each reviewer concern yourself. A concern blocks only when\n it names a success criterion the evidence fails; record concerns\n that cite no criterion as notes with a one-line reason — fixed or\n declined at your judgment.\n3. Fix every criterion-cited blocker. Re-run ONLY the scenario QA\n affected by the fix; capture fresh evidence for the delta. Update\n notepad.\n4. Re-submit to the SAME reviewer at most twice, passing only the\n delta diff, the blockers it cited, and the already-approved criteria\n marked out-of-scope. An approval whose only remaining items are\n notes counts as approval.\n5. On approval, declare done. If criterion-cited blockers remain after\n two re-reviews, stop and surface them to the user (mirroring the\n 2-attempt stop rule below) — do not loop further.\n\n# Commits\nCommit frequently: one atomic commit per verified increment (RED→GREEN\n+ its evidence), never one end-of-run omnibus; each commit builds +\ntests green on its own; no WIP on the final branch.\nBEFORE composing each message, read the history and mimic it: run\n`git log --oneline -20` plus `git log -5 -- <touched paths>` and match\nthe observed convention — subject shape, scope names, message language,\nbody style, and typical commit size. Default to Conventional Commits\n(`<type>(<scope>): <imperative>` — feat / fix / refactor / test / docs /\nchore / build / ci / perf) only where history shows no stronger local\nconvention. If a plan file exists, final commit footer:\n`Plan: .omo/plans/<slug>.md`. Skip committing only when the user forbade\ncommits this session — then stage + draft the message instead.\n\n# Constraints\n- Every behavior change needs a failing-first proof captured BEFORE\n the production change, through the cheapest faithful channel (unit\n test at a seam; integration/e2e in wiring; the real-surface scenario\n when no test seam exists). If you typed production code first, STOP,\n revert, capture the proof failing, then redo the change. Exempt\n only: pure formatting, comment-only edits, dependency bumps with no\n behavior delta, rename-only moves — justify each in `## Findings`.\n- A test that cannot fail for the regression it names is NOT\n evidence: mock-call assertions, pinned constants, a fixture equal\n to the default it must override, an expected value re-derived from\n the output under test. Prefer a real-surface proof with no new\n test over a tautological one.\n- Refactors: characterization tests pinning current observable\n behavior FIRST, green against the old code, green throughout.\n- Smallest correct change. No drive-by refactors.\n- Never suppress lints / errors / test failures. Never delete, skip,\n `.only`, `.skip`, `xfail`, or comment out tests to green the suite.\n- Never claim done from inference — only from captured evidence.\n\n# Output discipline\n- First line literally: `ULTRAWORK MODE ENABLED!`\n- After bootstrap: 1-2 paragraph plan summary + notepad path.\n- During execution: surface only state changes (RED captured, GREEN\n captured, scenario PASS/FAIL with evidence paths, reviewer verdict).\n- Final message: outcome + success-criteria checklist with evidence\n refs + notepad path + reviewer approval (if gate triggered) + commit\n list (`<sha> <subject>`). No file-by-file changelog unless asked.\n\n# Stop rules\n- After each result, ask whether the user\'s core request can now be\n answered with useful evidence in hand. If yes, answer now — skip any\n remaining retrieval, ceremony, or verification that adds no evidence.\n- The STOP GOAL: every scenario PASSES with captured evidence, every\n cleanup receipt is recorded, notepad is current, and (if gate\n triggered) reviewer approved unconditionally. Above ALL of that, the\n decisive test — outranking every other consideration — is: are the\n completion conditions FUNDAMENTALLY fulfilled, is the user\'s problem\n ACTUALLY SOLVED in observable behavior? If no, you are NOT done,\n whatever the ledger says. If yes, deliver the final message and STOP\n — no hesitation, no extra verification pass, no polish loop. Work\n past the stop goal is scope creep, not diligence.\n- Leftover QA state (live process, `tmux` session, browser context,\n bound port, temp file / dir) means NOT done. Tear it down, record\n the receipt, then continue.\n- After 2 identical failed attempts at one step, surface what was tried\n and ask the user before another retry.\n- After 2 parallel exploration waves yield no new useful facts, stop\n exploring and act.\n\n</ultrawork-mode>\n';
+ '<ultrawork-mode>\n\n**MANDATORY**: First user-visible line this turn MUST be exactly:\n`ULTRAWORK MODE ENABLED!`\n\n[CODE RED] Maximum precision. Outcome-first. Evidence-driven.\n\n# Role\nExpert coding agent. Ship verified work. No process narration.\n\n# Goal\nDeliver EXACTLY what the user asked, end-to-end working, proven by\ncaptured evidence: a failing-first proof that went RED→GREEN through\nthe cheapest faithful channel, plus real-surface proof sized by the\ntier below. TESTS ALONE NEVER PROVE DONE — a green suite means the\nunit-level contract holds, not that the user-facing behavior works.\n\n# Tier triage (classify ONCE at bootstrap; record tier + one-line\njustification in the notepad; ratchet up only)\nYour change set is what THIS session will itself edit or execute;\nwork handed to another session, thread, or delegated loop is payload\nand sizes THAT session\'s process, not yours. Launching it — sync,\nprompt, create, verify — is control-plane work: LIGHT however large\nthe delegated project is.\nDefault is LIGHT. Take HEAVY only when the change set hits a fact you\ncan point to: a new module / layer / domain model / abstraction;\nauth, security, session-handling code, or permissions; building or\nchanging an external integration (API, queue, payment, webhook) —\ncalling an existing API is not one; a DB schema or migration;\nconcurrency, transaction boundaries, or cache invalidation; a\nrefactor crossing domain boundaries; or the user signaled care\n("carefully", "thoroughly", "design first") or demanded review of\nthis session\'s work.\nWhen unsure, take HEAVY. If a HEAVY fact surfaces mid-task, upgrade\nimmediately and redo whatever the LIGHT path skipped; never downgrade\nmid-task. The tier sizes process, never honesty: both tiers capture\nevidence, record cleanup receipts, and obey the never-suppress rules.\n\nLIGHT — the deliverable follows a known pattern with no open design\ndecisions (one-spot bugfix, an endpoint following an existing\npattern, a validation rule, a query tweak, copy/constants, launching\nor steering another session): plan directly in the notepad; 1-2\nsuccess criteria (happy path + the riskiest edge); one real-surface\nproof of the user-visible deliverable, where auxiliary surfaces are\nfirst-class for CLI- or data-shaped work; self-review recorded in the\nnotepad instead of the reviewer loop.\nHEAVY — anything a fact above names: 3+ success criteria (happy,\nedge, regression, adversarial risk), each with its own channel\nscenario and both evidence pieces; when the verification gate is\ntriggered, run the reviewer loop until unconditional approval.\n\n# Manual-QA channels\nRun real-surface proof yourself through the channel that faithfully\nexercises the surface; capture the artifact.\n\n 1. HTTP call — hit the live endpoint with `curl -i` (or a\n Playwright APIRequestContext); capture status line + headers +\n body.\n 2. Terminal / TUI - drive a real pty and prove it through the\n xterm.js web terminal (see the TUI visual QA note below). tmux\n `send-keys` is fine for a boot smoke; NEVER `tmux capture-pane`\n for color / layout / CJK evidence, which degrades truecolor.\n 3. Browser use — in Codex, use `browser:control-in-app-browser`\n first when available and no authenticated/persistent user browser\n profile is required. Otherwise use Chrome to drive the REAL page;\n if Chrome is not available, download and use agent-browser\n (https://github.com/vercel-labs/agent-browser). Capture action\n log + screenshot path. Never downgrade to a non-browser surface\n for a browser-facing criterion. NEVER clear cookies, cache, or\n site data (`Network.clearBrowserCookies`, `Storage.clearCookies`,\n `chrome.browsingData.remove`, "clear browsing data") on the user\'s\n real/main browser profile — it wipes their logged-in state. If you\n need that profile\'s login state, clone it first (`rsync -a\n <profile>/ <tmp-clone>/`) and launch Chrome / agent-browser against\n the clone as the user-data-dir; run any clearing there only.\n 4. Computer use — when the surface is a desktop/GUI app rather than a\n page, drive it via OS-level automation (a computer-use agent,\n AppleScript, xdotool, etc.) against the running app; capture\n action log + screenshot. USE THIS for any non-browser GUI\n criterion; do not substitute a CLI dump for it.\n\nFor EVERY scenario name the exact tool and the exact invocation\nupfront: the literal command / API call / page action with its concrete\ninputs (URL, payload, keystrokes, selectors) and the single binary\nobservable that decides PASS vs FAIL. "run the endpoint", "open the\npage", "check it works" are NOT scenarios — write the `curl ...`, the\n`send-keys ...`, the Browser plugin action, the `page.click(...)`, the\nexpected status/text.\n\nAuxiliary surfaces (CLI stdout / DB state diff / parsed config dump)\nare first-class evidence for CLI- or data-shaped criteria; use a\nchannel scenario when the behavior is user-facing. `--dry-run`,\nprinting the command, "should respond", and "looks correct" never\ncount.\n\nFor TUI visual QA, render the terminal through the real xterm.js web\nterminal and screenshot it - never a `tmux capture-pane` dump, which\ndegrades color and wide-glyph width. In this repo:\n`node script/qa/web-terminal-visual-qa.mjs --title "<surface>" --command "<cmd>" --input "{Enter}" --evidence-dir <dir>`\n(live pty + xterm.js in Chrome; `--from-file <capture>` replays a raw\nstream). Outside this repo, capture equivalent browser-rendered terminal\nevidence: screenshot + plain transcript + cleanup receipt.\n\n# Bootstrap (DO ALL FOUR BEFORE ANY OTHER WORK — NO SKIPPING)\n\n## 0. Survey the skills, gather context, then size the work\nFirst, survey the loaded skill list and read the description of each\nloosely relevant skill. Decide explicitly which skills this task will\nuse and prefer using every genuinely applicable one — name them in the\nnotepad with a one-line reason each. Skipping a skill that fits the\ntask is a defect. Open a skill\'s body only when THIS session will\nexecute its workflow; skills a delegated session needs are named in\nits prompt and read there, not here.\nNext, fire the first discovery wave under Finding things below.\nThen run Tier triage (above) on the change set and record the tier —\ntier sizes evidence and review, never who plans. Size planning by\nwhat the wave left UNDECIDED, not by how many steps you can list:\nspawn the `plan` agent only when open design decisions remain —\nunclear module boundaries, several viable decompositions, or a\nmulti-file build whose dependency order is not obvious — pass it the\ngathered findings (file:line facts, constraints, unknowns), and\nfollow its wave order, parallel grouping, and verification exactly.\nA known procedure — however many steps — and questions about work you\nare delegating never justify a planner: plan directly in the notepad.\nNever spawn `plan` before the discovery wave has returned.\n\n## 1. Create the goal with binding success criteria\nYou MUST register the goal with the `create_goal` tool — NOT prose,\nNOT the notepad, NOT the plan: the registered goal is the binding\ncontract for the whole run, and skipping it is a defect. Call it with\nexactly `objective`; do not include `status`. Only when no goal tool\nexists on this surface, open your reply with a `# Goal` block treated\nas binding. Goals are unlimited; never invent a numeric budget or\nlimit.\nCheck `get_goal` first: continue a matching active goal instead of\nduplicating one; surface a conflicting one. Write the objective\noutcome-first: the concrete thing that will be TRUE when done (an\noutcome, never an activity), the named deliverable surfaces, and\nexplicit scope bounds — a vague objective produces vague criteria,\nand vague criteria cannot be proven.\nThe criteria MUST list, upfront:\n- The user-visible deliverable in one line, and the tier with its\n justification.\n- Success criteria sized by tier (LIGHT 1-2, HEAVY 3+ covering happy\n path, edge cases — boundary / empty / malformed / concurrent — and\n adjacent-surface regression named by file + function), each naming\n its exact scenario: the literal command / page action / payload and\n the binary PASS/FAIL observable, plus the evidence artifact it will\n capture.\n- For each criterion, the failing-first proof (test id or scenario)\n that will be captured RED BEFORE the implementation and GREEN after.\n Evidence added after the green code does NOT satisfy this.\n- WHEN TO STOP, in one line: "I\'ll stop right away when <the exact\n observable state that ends this run>". The Stop rules bind to this\n line — the moment it holds, you stop.\n\nThese scenarios are the contract. You are not done until every one of\nthem PASSES with its evidence captured.\n\n## 2. Open the durable notepad\nRun: `NOTE=$(mktemp -t ulw-$(date +%Y%m%d-%H%M%S).XXXXXX.md)`. Echo the\npath. Initialise it with these sections and APPEND (never rewrite) as\nyou work:\n\n```\n# Ultrawork Notepad — <one-line goal>\nStarted: <ISO timestamp>\n\n## Plan (exhaustively detailed)\n<every step you will take, in order, broken to atomic actions>\n\n## Success criteria + QA scenarios\n<copied from the goal>\n\n## Now\n<the single step in progress>\n\n## Todo\n<every remaining step, ordered>\n\n## Findings\n<every non-obvious fact discovered, with file:line refs>\n\n## Learnings\n<patterns / pitfalls / principles to remember next turn>\n```\n\nAppend each finding, decision, command, RED/GREEN capture, and QA\nartifact path the moment it happens. Update `## Now` and\n`## Todo` on every transition. Append-only — never rewrite. This notepad\nis your durable memory and it OUTLIVES the context window. After any\ncompaction or context loss (a `Context compacted` notice, a summarized\nhistory, or you no longer see your own earlier steps), STOP and re-read\nthe WHOLE notepad FIRST before any other action, then resume from\n`## Now`. Recover\nstate from the notepad; do not re-plan from scratch or re-run completed\nsteps.\n\n## 3. Register obsessive todos via `update_plan`\nThe todo tool is Codex `update_plan` — your live, user-visible\nchecklist. Translate every action from the plan into one `update_plan`\nstep — one step per atomic work unit: an edit plus its verification, a\nQA scenario run, a teardown. Keep each step small enough to finish\nwithin a few tool calls.\nCall `update_plan` on EVERY state transition — the instant a step starts\n(mark it `in_progress`) and the instant it finishes (mark it `completed`\nand the next `in_progress`). Exactly ONE `in_progress` at a time. Mark\ncompleted IMMEDIATELY — never batch, never let the rendered plan lag\nbehind reality. Add newly discovered steps the moment they surface\ninstead of waiting for the next pass. Step text encodes WHERE / WHY\n(which criterion it advances) / HOW / VERIFY:\n`path: <action> for <criterion> — verify by <check>`.\n\nGOOD pair (test-first, ordered):\n `foo.test.ts: Write FAILING case invalid-email→ValidationError for criterion 2 — verify by RED with assertion msg`\n `src/foo/bar.ts: Implement validateEmail() RFC-5322-lite for criterion 2 — verify by foo.test.ts GREEN + curl 400 body`\nBAD: "Implement feature" / "Fix bug" / "Add tests later" / writing\nproduction code before its failing test → rewrite.\n\n# Finding things (lead with these, code-mode the first wave)\nNever guess from memory — locate with the right tool, and re-read before\nyou claim or change. **USE CODE MODE AGGRESSIVELY FOR BOUNDED WAVES.**\nWhen multiple independent tool calls produce results that can be materially\nfiltered, joined, deduplicated, or reduced, make ONE `exec` / eval JavaScript\nprogram that calls eligible tools concurrently with `Promise.all` and emits only\ndecision-relevant evidence. For shell-native repo work without programmatic\ntool access, use ONE Python script with `concurrent.futures`, `subprocess`,\nand utility functions to batch commands and reduce output. Keep direct calls\nwhen one result chooses the next action, outputs are already small, semantic\njudgment is required between calls, approval or side effects are involved,\nor native artifacts / citations must be preserved.\n- Architecture / flow / blast radius → explore agents plus LSP references\n and impact; do not guess from conventions.\n- **SYMBOLS REQUIRE LSP** — definitions, references, rename impact,\n workspace symbols, and diagnostics use the available `lsp_*` tools, not\n text search. Run diagnostics after edits and treat errors as blocking.\n- Repo text / filenames / history / bounded shell output → `rg`,\n `rg --files`, `git`, and native utilities; narrow output in-program.\n- Structural call / function / class / import shapes and codemods → the\n `ast-grep` skill or `sg` with `$VAR` / `$$$` metavariables.\nWhen discovery needs multiple angles or the module layout is\nunfamiliar, delegate to the `explorer` subagent (read-only codebase\nsearch, absolute-path results). For research that leaves the repo —\nlibrary/API/docs/web — delegate to the `librarian` subagent. Spawn them\n`fork_context: false` and keep doing root work while they run.\n\n# Execution loop (PIN → RED → GREEN → SURFACE → CLEAN)\nUntil every success criterion PASSES with its evidence captured:\n1. Pick next criterion → mark in_progress → update notepad `## Now`.\n2. PIN + RED: when refactoring behavior whose regressions the change\n could hide, first pin it with a characterization test that passes on\n the unchanged code. Then\n capture the failing-first proof through the cheapest faithful\n channel — a unit test where a seam exists, an integration/e2e test\n where the behavior lives in wiring, or the criterion\'s real-surface\n scenario captured failing when no test seam exists. It must fail\n for the RIGHT reason (not a syntax error, not a missing import).\n Paste RED output into the notepad. No production code yet.\n TEST-ONLY TARGET (regression coverage for behavior that is already\n correct): there is no natural RED and no production change to make\n — this is the sole exception to the production-RED/GREEN steps.\n Substitute a mutation proof: temporarily force the exact regression\n each new assertion names (revert the fix commit or break the seam,\n never committed), capture the assertion failing, then revert the\n mutation and capture GREEN. An assertion that stays green under its\n mutation is not coverage — fix the fixture (a value equal to the\n default it must override proves nothing) or assert the artifact the\n criterion names, never an expected value re-derived from the output\n under test. Reverting the probe IS the GREEN; skip step 3\'s\n production change for a TEST-ONLY task and go to step 4.\n PROSE TARGET (prompt, SKILL.md, rule, markdown): the wording is\n NOT the behavior — never pin sentences, phrase presence/absence,\n or word/char counts. PIN only a machine-consumed value (parsed\n frontmatter field, a sentinel token a hook greps, the doc\'s JSON\n sample through its real validator) or one `toBe` equality between\n two shipped copies. A pure-prose change with no machine consumer\n has NO seam: ship it on review + QA-by-read, NO test — a text grep\n is pretend-coverage, not RED proof.\n3. GREEN (skip for TEST-ONLY — reverting the mutation is GREEN): write\n the SMALLEST production change that flips RED→GREEN.\n Before GREEN work that depends on external review, PR, issue, or\n branch state, refresh current branch/PR/issue state and preserve existing ordering/policy;\n separate compatibility detection from policy changes unless the goal\n explicitly asks to change policy.\n Re-run the proof. Capture GREEN output. A GREEN far larger than the\n criterion implies means the proof was too coarse — split it.\n4. SURFACE: run the real-surface proof the criterion named (channel\n table above; auxiliary surface for CLI- or data-shaped criteria),\n end-to-end, yourself. If the RED proof was the scenario itself,\n re-run it now and capture it passing. Paste the artifact path into\n the notepad.\n5. CLEANUP (PAIRED — NEVER SKIP): the moment a QA scenario spawns any\n resource, register its teardown as its own todo (e.g.\n `cleanup: kill server pid for criterion 2 — verify kill -0 fails`).\n Every runtime artifact the QA spawned in step 4 MUST be torn down\n before this step completes:\n server PIDs (`kill <pid>`; verify `kill -0` fails), `tmux` sessions\n (`tmux kill-session -t ulw-qa-<criterion>`; verify with `tmux ls`),\n browser / Playwright contexts (`.close()`), containers\n (`docker rm -f`), bound ports (`lsof -i :<port>` empty), temp\n sockets / files / dirs (`rm -rf` the `mktemp` paths), QA-only env\n vars. Append a one-line cleanup receipt to the notepad next to the\n artifact, e.g. `cleanup: killed 12345; tmux kill-session ulw-qa-foo;\n rm -rf /tmp/ulw.aB12cD`. No receipt → criterion stays in_progress.\n6. Verify: LSP diagnostics clean on changed files + the test scope\n this criterion touched green (no skipped, no xfail added this\n turn). Re-run a validation command (suite, typecheck, build) only\n when its inputs changed since its last green run; ONE full-suite\n pass belongs immediately before the final message, not after\n every increment.\n7. Mark completed. Append non-obvious findings / learnings.\n8. After each increment, re-run the scenarios that increment could\n have affected; re-run the full set once, right before the final\n message. Record PASS/FAIL inline with the evidence paths AND the\n cleanup receipt. Loop until all PASS.\n\nWithin a step, follow Finding things; NEVER parallelise RED and GREEN of\nthe same criterion.\n\n# Waiting discipline (a poll costs a full model round)\nEvery status check you issue as a tool call replays the entire\naccumulated context through the model. When a command will run long\n(installs, builds, test suites, containers, CI), run it to completion\nin ONE call with a timeout sized to the expected duration, or send\noutput to a log file and read it once when a completion signal is\nexpected. Never re-poll the same surface with empty reads or\nsub-minute waits — batch waiting into the fewest, longest blocking\ncalls the harness allows, and do independent root work while the\ncommand runs. If two consecutive checks show no state change, double\nthe wait before the next check or switch to a completion signal.\n\n# Codex subagent reliability\nEvery `multi_agent_v1.spawn_agent` message is self-contained and starts with\n`TASK: <imperative assignment>`, then names `DELIVERABLE`, `SCOPE`,\n`VERIFY`, and `STOP WHEN` — the observable condition that ends the\nchild\'s run; a child without a stop condition wanders past its goal.\nState that it is an executable assignment, not a context handoff. Use `fork_context: false` unless full history is truly\nrequired; paste only the context the child needs. Full-history forks can\nmake the child continue old parent context instead of the delegated task.\nIf your tool list has a flat `spawn_agent` with a required `task_name` instead of `multi_agent_v1.*` (`multi_agent_v2`), rewrite: `fork_context: false` becomes `fork_turns: "none"`, `send_input` becomes `send_message`, finished agents end on their own (no `close_agent`; `followup_task` re-tasks, `interrupt_agent` stops), and `wait_agent` takes only `timeout_ms`, returning on any child mailbox activity.\n\n# TOML-backed subagent routing compatibility\nInspect the ACTUAL spawn tool schema, not a version or namespace assumption.\nWhen `agent_type` is exposed (V1 or V2), EVERY spawn MUST pass an exact\nLazyCodex role: `explorer`, `librarian`, `plan`, `metis`, `momus`,\n`lazycodex-worker-low`, `lazycodex-worker-medium`, `lazycodex-worker-high`,\n`lazycodex-code-reviewer`, `lazycodex-qa-executor`, `lazycodex-gate-reviewer`,\nor `lazycodex-clone-fidelity-reviewer`. Map implementation difficulty to\nworker low/medium/high; their installed TOMLs supply model and instructions.\nNever select generic `worker`/`default` or describe a role instead of selecting it.\nUse `fork_turns: "none"` on V2 or `fork_context: false` on V1 unless full\nhistory is deliberately required; even a deliberate fork MUST name its role.\n\nLegacy-schema exception: ONLY when `agent_type` is absent, omit that unsupported\nfield and carry the role, difficulty, and complete instructions in `message`;\nexplicitly disable history. This cannot select a specialized TOML. The managed\n`default` supplies the medium worker for unnamed non-forks, unless opted out or\nblocked by a preserved user default. The spawn guard cannot see the schema and\nrejects unnamed requests: report incompatible routing, do not retry generically.\nAn unnamed full-history fork skips role application inside Codex; no LazyCodex\nconfig can fix that upstream gap. Never claim this path has been repaired.\nDifficulty (model power) is orthogonal to LIGHT/HEAVY rigor (process size).\n\nTreat child status as a progress signal, not a timeout counter. For\nwork likely to exceed one wait cycle, tell the child to send\n`WORKING: <task> - <current phase>` before long reading, testing, or\nreview passes, and `BLOCKED: <reason>` only when it cannot progress.\nTrack spawned agent names locally. Use `multi_agent_v1.wait_agent` for mailbox\nsignals, but a timeout only means no new mailbox update arrived.\nTreat a running child as alive and keep doing independent root work.\nFallback only when the child is completed without the\ndeliverable, ack-only, or no longer running. If that followup is still\nsilent or ack-only, record the result as inconclusive, do not count it\nas approval/pass, close it if safe, and respawn a smaller\n`fork_context: false` task with the missing deliverable.\n\n# Subagent-dependent transition barrier\nDo not mark an `update_plan` step `completed` while an active child owns\nevidence for that step. Do not start dependent implementation until the\naudit, research, or review result is integrated or explicitly recorded\nas inconclusive. Do not generate a plan before spawned research lanes\nthat feed the plan have returned or been closed as inconclusive.\nSpawn every independent child for the current wave first. After the wave\nis launched, run `multi_agent_v1.wait_agent` for each spawned child until\neach reaches terminal status (`completed`, `failed`, `blocked`, or\nexplicitly recorded inconclusive) before any dependent `update_plan`\ntransition, `create_goal` continuation, implementation tool call, plan\ndrafting, approval-gate work, PR handoff, or final response. A timeout is\nnot terminal status.\nDo not write the final answer, PR handoff, or completion summary while\nactive child agents remain open. Use `multi_agent_v1.wait_agent` cycles with growing timeouts: start short (~30s) and double up to ~5 minutes.\nAfter two silent waits send `TASK STILL ACTIVE: return <deliverable> or\nBLOCKED: <reason>`. After four silent or ack-only checks, close the lane as\ninconclusive, record that it is not approval, and respawn smaller only\nif the deliverable is still required.\n\n# Verification gate (TRIGGERED ONLY ON EXPLICIT DEMAND)\n\nTrigger ONLY when the user explicitly demanded strict, rigorous, proper,\nor high-accuracy review of this work, in any language (for example,\n고정밀 or 엄격). The tier alone never triggers the gate. HEAVY without\nsuch a demand records the same self-review as LIGHT.\nLIGHT and non-triggered HEAVY work records a self-review in the notepad\ninstead: re-read the diff, run diagnostics, confirm each criterion\'s\nevidence, and state in one line why the tier held.\n\nWhen triggered, follow this procedure (NON-NEGOTIABLE):\n1. Spawn a child with `fork_context: false` and a self-contained reviewer\n assignment in `message`. The `multi_agent_v1.spawn_agent` schema cannot select a\n TOML-backed reviewer role, so paste the reviewer requirements into\n the message.\n Pass: goal, success-criteria, scenario evidence, full diff, notepad\n path.\n2. Verify each reviewer concern yourself. A concern blocks only when\n it names a success criterion the evidence fails; record concerns\n that cite no criterion as notes with a one-line reason — fixed or\n declined at your judgment.\n3. Fix every criterion-cited blocker. Re-run ONLY the scenario QA\n affected by the fix; capture fresh evidence for the delta. Update\n notepad.\n4. Re-submit to the SAME reviewer at most twice, passing only the\n delta diff, the blockers it cited, and the already-approved criteria\n marked out-of-scope. An approval whose only remaining items are\n notes counts as approval.\n5. On approval, declare done. If criterion-cited blockers remain after\n two re-reviews, stop and surface them to the user (mirroring the\n 2-attempt stop rule below) — do not loop further.\n\n# Commits\nCommit frequently: one atomic commit per verified increment (RED→GREEN\n+ its evidence), never one end-of-run omnibus; each commit builds +\ntests green on its own; no WIP on the final branch.\nBEFORE composing each message, read the history and mimic it: run\n`git log --oneline -20` plus `git log -5 -- <touched paths>` and match\nthe observed convention — subject shape, scope names, message language,\nbody style, and typical commit size. Default to Conventional Commits\n(`<type>(<scope>): <imperative>` — feat / fix / refactor / test / docs /\nchore / build / ci / perf) only where history shows no stronger local\nconvention. If a plan file exists, final commit footer:\n`Plan: .omo/plans/<slug>.md`. Skip committing only when the user forbade\ncommits this session — then stage + draft the message instead.\n\n# Constraints\n- Every behavior change needs a failing-first proof captured BEFORE\n the production change, through the cheapest faithful channel (unit\n test at a seam; integration/e2e in wiring; the real-surface scenario\n when no test seam exists). If you typed production code first, STOP,\n revert, capture the proof failing, then redo the change. Exempt\n only: pure formatting, comment-only edits, dependency bumps with no\n behavior delta, rename-only moves — justify each in `## Findings`.\n- A test that cannot fail for the regression it names is NOT\n evidence: mock-call assertions, pinned constants, a fixture equal\n to the default it must override, an expected value re-derived from\n the output under test. Prefer a real-surface proof with no new\n test over a tautological one.\n- Refactors: characterization tests pinning current observable\n behavior FIRST, green against the old code, green throughout.\n- Smallest correct change. No drive-by refactors.\n- Never suppress lints / errors / test failures. Never delete, skip,\n `.only`, `.skip`, `xfail`, or comment out tests to green the suite.\n- Never claim done from inference — only from captured evidence.\n\n# Output discipline\n- First line literally: `ULTRAWORK MODE ENABLED!`\n- After bootstrap: 1-2 paragraph plan summary + notepad path.\n- During execution: surface only state changes (RED captured, GREEN\n captured, scenario PASS/FAIL with evidence paths, reviewer verdict).\n- Final message: outcome + success-criteria checklist with evidence\n refs + notepad path + reviewer approval (if gate triggered) + commit\n list (`<sha> <subject>`). No file-by-file changelog unless asked.\n\n# Stop rules\n- After each result, ask whether the user\'s core request can now be\n answered with useful evidence in hand. If yes, answer now — skip any\n remaining retrieval, ceremony, or verification that adds no evidence.\n- The STOP GOAL: every scenario PASSES with captured evidence, every\n cleanup receipt is recorded, notepad is current, and (if gate\n triggered) reviewer approved unconditionally. Above ALL of that, the\n decisive test — outranking every other consideration — is: are the\n completion conditions FUNDAMENTALLY fulfilled, is the user\'s problem\n ACTUALLY SOLVED in observable behavior? If no, you are NOT done,\n whatever the ledger says. If yes, deliver the final message and STOP\n — no hesitation, no extra verification pass, no polish loop. Work\n past the stop goal is scope creep, not diligence.\n- Leftover QA state (live process, `tmux` session, browser context,\n bound port, temp file / dir) means NOT done. Tear it down, record\n the receipt, then continue.\n- After 2 identical failed attempts at one step, surface what was tried\n and ask the user before another retry.\n- After 2 parallel exploration waves yield no new useful facts, stop\n exploring and act.\n\n</ultrawork-mode>\n';
diff --git a/plugins/omo/components/ulw-execute-continuation/hooks/hooks.json b/plugins/omo/components/ulw-execute-continuation/hooks/hooks.json
index 9f1f2407..7e4c0480 100644
--- a/plugins/omo/components/ulw-execute-continuation/hooks/hooks.json
+++ b/plugins/omo/components/ulw-execute-continuation/hooks/hooks.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ulw-execute-continuation/dist/cli.js\" hook stop",
"timeout": 10,
- "statusMessage": "(OmO 5.0.0-beta.60) Checking Ulw-Execute Continuation"
+ "statusMessage": "(OmO 5.0.0-beta.62) Checking Ulw-Execute Continuation"
}
]
}
diff --git a/plugins/omo/components/ulw-execute-continuation/package.json b/plugins/omo/components/ulw-execute-continuation/package.json
index f51493f4..aaf492d3 100644
--- a/plugins/omo/components/ulw-execute-continuation/package.json
+++ b/plugins/omo/components/ulw-execute-continuation/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-ulw-execute-continuation",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"description": "Codex Stop hook continuation injector for omo-codex ulw-execute plans.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/ulw-loop/CHANGELOG.md b/plugins/omo/components/ulw-loop/CHANGELOG.md
index c4f28d04..3385dcac 100644
--- a/plugins/omo/components/ulw-loop/CHANGELOG.md
+++ b/plugins/omo/components/ulw-loop/CHANGELOG.md
@@ -2,6 +2,8 @@
## [0.1.0] - unreleased
+- LazyCodex native spawns now require an explicit bundled role before plan, budget, or artifact checks. Unknown and unnamed roles fail loudly; Senpi admission is unchanged. Guidance follows the actual spawn schema, including V2 `agent_type` when exposed. Installer/bootstrap provide an opt-out-able, ownership-checked medium-worker `default` for unnamed non-forks. An unnamed full-history fork still skips role application inside Codex: configuration cannot repair that upstream gap, and enforcement depends on Codex invoking the trusted hook. Legacy schemas without `agent_type` retain message-carried instructions but are rejected by the schema-blind guard rather than silently falling through.
+
- Bundled `directive.md` picks up the ultrawork test-proportionality change: the execution-loop PIN step asks for characterization pins only when refactoring behavior whose regressions the change could hide. Stays byte-identical to `prompts-core/ultrawork/codex.md` and the ultrawork component's `directive.md`.
- **Hooks:** new `Stop` hook auto-resumes a turn that died with unfinished goals (defers to ulw-execute-continuation while its plan has remaining tasks, bails under context pressure, and caps at two resumes without ledger movement via a separate `.stuck` marker). New `PreToolUse` spawn guard adds a per-session fan-out cap (`OMO_SPAWN_FANOUT_LIMIT`, default 60) and denies final gate-reviewer spawns while the reviewer artifacts the gate audits are missing.
diff --git a/plugins/omo/components/ulw-loop/directive.md b/plugins/omo/components/ulw-loop/directive.md
index df6800a6..d34f69d5 100644
--- a/plugins/omo/components/ulw-loop/directive.md
+++ b/plugins/omo/components/ulw-loop/directive.md
@@ -340,17 +340,26 @@ make the child continue old parent context instead of the delegated task.
If your tool list has a flat `spawn_agent` with a required `task_name` instead of `multi_agent_v1.*` (`multi_agent_v2`), rewrite: `fork_context: false` becomes `fork_turns: "none"`, `send_input` becomes `send_message`, finished agents end on their own (no `close_agent`; `followup_task` re-tasks, `interrupt_agent` stops), and `wait_agent` takes only `timeout_ms`, returning on any child mailbox activity.
# TOML-backed subagent routing compatibility
-Installed role TOMLs (`~/.codex/agents/`) bind ONLY via `agent_type`.
-`multi_agent_v1.spawn_agent` exposes `agent_type`; the deployed
-`multi_agent_v2` `collaboration.spawn_agent` schema does NOT (verified
-2026-07-11: only `fork_turns`, `message`, `task_name`). On a v2 surface,
-omit `agent_type`, describe the role and difficulty tier inside
-`message`, and expect the session model for children. Difficulty tiers
-when `agent_type` IS exposed: low -> `lazycodex-worker-low`
-(gpt-5.6-luna/high), medium -> `lazycodex-worker-medium`
-(gpt-5.6-luna/max), high -> `lazycodex-worker-high` (gpt-5.6-sol/max);
-explorer/librarian carry their own TOMLs (gpt-5.6-luna/low). Difficulty
-(model power) is orthogonal to LIGHT/HEAVY rigor (process size).
+Inspect the ACTUAL spawn tool schema, not a version or namespace assumption.
+When `agent_type` is exposed (V1 or V2), EVERY spawn MUST pass an exact
+LazyCodex role: `explorer`, `librarian`, `plan`, `metis`, `momus`,
+`lazycodex-worker-low`, `lazycodex-worker-medium`, `lazycodex-worker-high`,
+`lazycodex-code-reviewer`, `lazycodex-qa-executor`, `lazycodex-gate-reviewer`,
+or `lazycodex-clone-fidelity-reviewer`. Map implementation difficulty to
+worker low/medium/high; their installed TOMLs supply model and instructions.
+Never select generic `worker`/`default` or describe a role instead of selecting it.
+Use `fork_turns: "none"` on V2 or `fork_context: false` on V1 unless full
+history is deliberately required; even a deliberate fork MUST name its role.
+
+Legacy-schema exception: ONLY when `agent_type` is absent, omit that unsupported
+field and carry the role, difficulty, and complete instructions in `message`;
+explicitly disable history. This cannot select a specialized TOML. The managed
+`default` supplies the medium worker for unnamed non-forks, unless opted out or
+blocked by a preserved user default. The spawn guard cannot see the schema and
+rejects unnamed requests: report incompatible routing, do not retry generically.
+An unnamed full-history fork skips role application inside Codex; no LazyCodex
+config can fix that upstream gap. Never claim this path has been repaired.
+Difficulty (model power) is orthogonal to LIGHT/HEAVY rigor (process size).
Treat child status as a progress signal, not a timeout counter. For
work likely to exceed one wait cycle, tell the child to send
diff --git a/plugins/omo/components/ulw-loop/dist/cli.js b/plugins/omo/components/ulw-loop/dist/cli.js
index 4963b7eb..c3e94ae7 100644
--- a/plugins/omo/components/ulw-loop/dist/cli.js
+++ b/plugins/omo/components/ulw-loop/dist/cli.js
@@ -3059,6 +3059,15 @@ var ULW_LOOP_MANIFEST = {
};
// components/ulw-loop/src/sdk/factory.ts
+function validateCodexGoalJson(raw) {
+ if (raw === undefined)
+ return;
+ try {
+ JSON.parse(raw);
+ } catch (error) {
+ throw new UlwLoopError(`Invalid codexGoal: ${error instanceof Error ? error.message : "not valid JSON"}`, "ULW_LOOP_CODEX_GOAL_JSON_INVALID", { cause: error });
+ }
+}
function validateContext(context) {
if (!context.cwd.trim())
throw new UlwLoopError("cwd is required.", "ULW_LOOP_CWD_REQUIRED");
@@ -3088,6 +3097,10 @@ function nextActionsFrom(result) {
return [];
return result.nextActions.filter((action) => typeof action === "string").slice(0, 8);
}
+function checkpointWithValidatedSnapshot(context, scope, args) {
+ validateCodexGoalJson(args.codexGoalJson);
+ return checkpointUlwLoop(context.cwd, args, scope, { surface: context.surface });
+}
function createAgentToolkit(context, deps = {}) {
validateContext(context);
const scope = { sessionId: context.sessionId };
@@ -3148,7 +3161,7 @@ function createAgentToolkit(context, deps = {}) {
};
}),
completeGoals: (args = {}) => invoke("complete-goals", () => startNextUlwLoop(context.cwd, args, scope)),
- checkpoint: (args) => invoke("checkpoint", () => args.printTemplate === true ? checkpointTemplate(context.cwd, scope, args.goalId, { surface: context.surface }) : checkpointUlwLoop(context.cwd, args, scope, { surface: context.surface })),
+ checkpoint: (args) => invoke("checkpoint", () => args.printTemplate === true ? checkpointTemplate(context.cwd, scope, args.goalId, { surface: context.surface }) : checkpointWithValidatedSnapshot(context, scope, args)),
steer: (args) => invoke("steer", () => steerUlwLoop(context.cwd, args, scope)),
addGoal: (args) => invoke("add-goal", () => addUlwLoopGoal(context.cwd, args, scope)),
criteria: (args) => invoke("criteria", async () => {
@@ -3809,7 +3822,36 @@ function readAll(stdin) {
import { randomBytes } from "node:crypto";
import { existsSync as existsSync6, mkdirSync as mkdirSync2, readFileSync as readFileSync5, renameSync, statSync as statSync3, writeFileSync } from "node:fs";
import { dirname as dirname3, join as join3 } from "node:path";
-var SPAWN_TOOL_TOKENS = new Set(["spawn_agent", "collaborationspawn_agent", "collaboration.spawn_agent"]);
+
+// components/ulw-loop/src/spawn-role-guard.ts
+var LAZYCODEX_SPAWN_ROLES = new Set([
+ "explorer",
+ "lazycodex-clone-fidelity-reviewer",
+ "lazycodex-code-reviewer",
+ "lazycodex-gate-reviewer",
+ "lazycodex-qa-executor",
+ "lazycodex-worker-high",
+ "lazycodex-worker-low",
+ "lazycodex-worker-medium",
+ "librarian",
+ "metis",
+ "momus",
+ "plan"
+]);
+function spawnRoleDenial(input) {
+ const role = typeof input === "object" && input !== null && "agent_type" in input ? input.agent_type : undefined;
+ if (typeof role === "string" && LAZYCODEX_SPAWN_ROLES.has(role))
+ return null;
+ return `LazyCodex requires an explicit registered agent_type: ${[...LAZYCODEX_SPAWN_ROLES].join(", ")}. Received ${JSON.stringify(role) ?? "no agent_type"}. Use the matching role and fork_turns: "none" (V2) or fork_context: false (V1), unless full history is deliberately required. The hook cannot see the tool schema; if agent_type is unavailable, stop and report incompatible role routing rather than spawning a generic agent. Describing a role in message does not select its TOML.`;
+}
+
+// components/ulw-loop/src/spawn-guard.ts
+var SPAWN_TOOL_TOKENS = new Set([
+ "spawn_agent",
+ "multi_agent_v1.spawn_agent",
+ "collaborationspawn_agent",
+ "collaboration.spawn_agent"
+]);
var DEFAULT_FANOUT_LIMIT = 24;
var DEFAULT_REVIEW_SPAWN_LIMIT = 3;
var GATE_MESSAGE_PATTERN = /lazycodex-gate-reviewer|omo-senpi-gate-reviewer|final gate review/i;
@@ -3820,6 +3862,16 @@ var REVIEW_AGENT_TYPES = [
];
var REVIEW_AGENT_TYPE_SET = new Set(REVIEW_AGENT_TYPES);
function applySpawnGuards(payload, options = {}) {
+ if (payload.hook_event_name !== "PreToolUse" || !SPAWN_TOOL_TOKENS.has(payload.tool_name))
+ return "";
+ if (resolveToolkitSurface() === "lazycodex") {
+ const reason = spawnRoleDenial(payload.tool_input);
+ if (reason !== null)
+ return deny(reason);
+ }
+ return applySpawnBudgetGuards(payload, options);
+}
+function applySpawnBudgetGuards(payload, options = {}) {
if (payload.hook_event_name !== "PreToolUse" || !SPAWN_TOOL_TOKENS.has(payload.tool_name))
return "";
const breaker = readAdmissionBreaker(payload.session_id);
@@ -3886,14 +3938,15 @@ async function runSpawnGuardCli(stdin, stdout) {
for await (const chunk of stdin)
chunks.push(Buffer.from(chunk));
const payload = parsePreToolUsePayload(Buffer.concat(chunks).toString("utf8"));
- if (payload === null)
+ if (payload === null) {
+ stdout.write(deny("LazyCodex spawn guard received an invalid hook payload; role routing was not verified."));
return;
+ }
const output = applySpawnGuards(payload);
if (output.length > 0)
stdout.write(output);
} catch (error) {
- if (error instanceof Error)
- return;
+ stdout.write(deny(`LazyCodex spawn guard failed: ${error instanceof Error ? error.message : String(error)}`));
}
}
function peekFanOutBudget(stateDir) {
diff --git a/plugins/omo/components/ulw-loop/dist/sdk/factory.js b/plugins/omo/components/ulw-loop/dist/sdk/factory.js
index 57d846cb..a3f82531 100644
--- a/plugins/omo/components/ulw-loop/dist/sdk/factory.js
+++ b/plugins/omo/components/ulw-loop/dist/sdk/factory.js
@@ -9,6 +9,18 @@ import { UlwLoopError } from "../runtime.js";
import { statusNextActions } from "../status-next-actions.js";
import { steerUlwLoop } from "../steering.js";
import { ULW_LOOP_MANIFEST } from "./manifest.js";
+// The SDK takes inline values only, so a snapshot that is not JSON is a caller error - normalize it
+// to the same stable code the CLI reports instead of letting it surface as a generic failure.
+function validateCodexGoalJson(raw) {
+ if (raw === undefined)
+ return;
+ try {
+ JSON.parse(raw);
+ }
+ catch (error) {
+ throw new UlwLoopError(`Invalid codexGoal: ${error instanceof Error ? error.message : "not valid JSON"}`, "ULW_LOOP_CODEX_GOAL_JSON_INVALID", { cause: error });
+ }
+}
function validateContext(context) {
if (!context.cwd.trim())
throw new UlwLoopError("cwd is required.", "ULW_LOOP_CWD_REQUIRED");
@@ -42,6 +54,10 @@ function nextActionsFrom(result) {
return [];
return result.nextActions.filter((action) => typeof action === "string").slice(0, 8);
}
+function checkpointWithValidatedSnapshot(context, scope, args) {
+ validateCodexGoalJson(args.codexGoalJson);
+ return checkpointUlwLoop(context.cwd, args, scope, { surface: context.surface });
+}
export function createAgentToolkit(context, deps = {}) {
validateContext(context);
const scope = { sessionId: context.sessionId };
@@ -108,7 +124,7 @@ export function createAgentToolkit(context, deps = {}) {
completeGoals: (args = {}) => invoke("complete-goals", () => startNextUlwLoop(context.cwd, args, scope)),
checkpoint: (args) => invoke("checkpoint", () => args.printTemplate === true
? checkpointTemplate(context.cwd, scope, args.goalId, { surface: context.surface })
- : checkpointUlwLoop(context.cwd, args, scope, { surface: context.surface })),
+ : checkpointWithValidatedSnapshot(context, scope, args)),
steer: (args) => invoke("steer", () => steerUlwLoop(context.cwd, args, scope)),
addGoal: (args) => invoke("add-goal", () => addUlwLoopGoal(context.cwd, args, scope)),
criteria: (args) => invoke("criteria", async () => {
diff --git a/plugins/omo/components/ulw-loop/dist/spawn-guard.d.ts b/plugins/omo/components/ulw-loop/dist/spawn-guard.d.ts
index c4ed97f2..8043a073 100644
--- a/plugins/omo/components/ulw-loop/dist/spawn-guard.d.ts
+++ b/plugins/omo/components/ulw-loop/dist/spawn-guard.d.ts
@@ -4,5 +4,6 @@ export interface SpawnGuardOptions {
readonly lockTimeoutMs?: number;
}
export declare function applySpawnGuards(payload: PreToolUsePayload, options?: SpawnGuardOptions): string;
+export declare function applySpawnBudgetGuards(payload: PreToolUsePayload, options?: SpawnGuardOptions): string;
export declare function runSpawnAdmissionRecorderCli(stdin: NodeJS.ReadableStream, stdout: NodeJS.WritableStream): Promise<void>;
export declare function runSpawnGuardCli(stdin: NodeJS.ReadableStream, stdout: NodeJS.WritableStream): Promise<void>;
diff --git a/plugins/omo/components/ulw-loop/dist/spawn-guard.js b/plugins/omo/components/ulw-loop/dist/spawn-guard.js
index 792afaf7..44407510 100644
--- a/plugins/omo/components/ulw-loop/dist/spawn-guard.js
+++ b/plugins/omo/components/ulw-loop/dist/spawn-guard.js
@@ -4,12 +4,18 @@ import { dirname, join } from "node:path";
import { parsePreToolUsePayload } from "./codex-hook.js";
import { isFinalRunCompletionCandidate } from "./goal-status.js";
import { ulwLoopAttemptEvidenceDir, ulwLoopDir, ulwLoopStateLockPath } from "./paths.js";
+import { spawnRoleDenial } from "./spawn-role-guard.js";
import { isStateLockTimeout, withStateLockSync } from "./state-lock.js";
import { GATE_REVIEWER_AGENT_NAMES, REVIEWER_ROLES_BY_SURFACE, resolveToolkitSurface, reviewerRolesFor, } from "./surface.js";
// spawn_agent = v1; collaborationspawn_agent = the delimiter-free flattened v2
// hook token from codex-rs hook_names.rs; collaboration.spawn_agent = the
// dotted token observed live in the task-1 probe (hook-tool-tokens.txt).
-const SPAWN_TOOL_TOKENS = new Set(["spawn_agent", "collaborationspawn_agent", "collaboration.spawn_agent"]);
+const SPAWN_TOOL_TOKENS = new Set([
+ "spawn_agent",
+ "multi_agent_v1.spawn_agent",
+ "collaborationspawn_agent",
+ "collaboration.spawn_agent",
+]);
export const DEFAULT_FANOUT_LIMIT = 24;
const DEFAULT_REVIEW_SPAWN_LIMIT = 3;
const GATE_MESSAGE_PATTERN = /lazycodex-gate-reviewer|omo-senpi-gate-reviewer|final gate review/i;
@@ -20,6 +26,16 @@ const REVIEW_AGENT_TYPES = [
];
const REVIEW_AGENT_TYPE_SET = new Set(REVIEW_AGENT_TYPES);
export function applySpawnGuards(payload, options = {}) {
+ if (payload.hook_event_name !== "PreToolUse" || !SPAWN_TOOL_TOKENS.has(payload.tool_name))
+ return "";
+ if (resolveToolkitSurface() === "lazycodex") {
+ const reason = spawnRoleDenial(payload.tool_input);
+ if (reason !== null)
+ return deny(reason);
+ }
+ return applySpawnBudgetGuards(payload, options);
+}
+export function applySpawnBudgetGuards(payload, options = {}) {
if (payload.hook_event_name !== "PreToolUse" || !SPAWN_TOOL_TOKENS.has(payload.tool_name))
return "";
const breaker = readAdmissionBreaker(payload.session_id);
@@ -93,15 +109,16 @@ export async function runSpawnGuardCli(stdin, stdout) {
for await (const chunk of stdin)
chunks.push(Buffer.from(chunk));
const payload = parsePreToolUsePayload(Buffer.concat(chunks).toString("utf8"));
- if (payload === null)
+ if (payload === null) {
+ stdout.write(deny("LazyCodex spawn guard received an invalid hook payload; role routing was not verified."));
return;
+ }
const output = applySpawnGuards(payload);
if (output.length > 0)
stdout.write(output);
}
catch (error) {
- if (error instanceof Error)
- return;
+ stdout.write(deny(`LazyCodex spawn guard failed: ${error instanceof Error ? error.message : String(error)}`));
}
}
// Read-only fan-out eligibility check. Returns a denial reason when the next
diff --git a/plugins/omo/components/ulw-loop/dist/spawn-role-guard.d.ts b/plugins/omo/components/ulw-loop/dist/spawn-role-guard.d.ts
new file mode 100644
index 00000000..323a4076
--- /dev/null
+++ b/plugins/omo/components/ulw-loop/dist/spawn-role-guard.d.ts
@@ -0,0 +1,2 @@
+export declare const LAZYCODEX_SPAWN_ROLES: ReadonlySet<string>;
+export declare function spawnRoleDenial(input: unknown): string | null;
diff --git a/plugins/omo/components/ulw-loop/dist/spawn-role-guard.js b/plugins/omo/components/ulw-loop/dist/spawn-role-guard.js
new file mode 100644
index 00000000..a0dee22f
--- /dev/null
+++ b/plugins/omo/components/ulw-loop/dist/spawn-role-guard.js
@@ -0,0 +1,22 @@
+// Explicit selectors, pinned by a test to the bundled role TOMLs. The generated
+// default is a non-fork fallback, not a selector: a user can opt out of owning it.
+export const LAZYCODEX_SPAWN_ROLES = new Set([
+ "explorer",
+ "lazycodex-clone-fidelity-reviewer",
+ "lazycodex-code-reviewer",
+ "lazycodex-gate-reviewer",
+ "lazycodex-qa-executor",
+ "lazycodex-worker-high",
+ "lazycodex-worker-low",
+ "lazycodex-worker-medium",
+ "librarian",
+ "metis",
+ "momus",
+ "plan",
+]);
+export function spawnRoleDenial(input) {
+ const role = typeof input === "object" && input !== null && "agent_type" in input ? input.agent_type : undefined;
+ if (typeof role === "string" && LAZYCODEX_SPAWN_ROLES.has(role))
+ return null;
+ return `LazyCodex requires an explicit registered agent_type: ${[...LAZYCODEX_SPAWN_ROLES].join(", ")}. Received ${JSON.stringify(role) ?? "no agent_type"}. Use the matching role and fork_turns: "none" (V2) or fork_context: false (V1), unless full history is deliberately required. The hook cannot see the tool schema; if agent_type is unavailable, stop and report incompatible role routing rather than spawning a generic agent. Describing a role in message does not select its TOML.`;
+}
diff --git a/plugins/omo/components/ulw-loop/hooks/hooks.json b/plugins/omo/components/ulw-loop/hooks/hooks.json
index 6bb30bd5..2748c3ed 100644
--- a/plugins/omo/components/ulw-loop/hooks/hooks.json
+++ b/plugins/omo/components/ulw-loop/hooks/hooks.json
@@ -7,20 +7,20 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook user-prompt-submit --with-ultrawork",
"timeout": 10,
- "statusMessage": "(OmO 5.0.0-beta.60) Checking Ulw-Loop Steering"
+ "statusMessage": "(OmO 5.0.0-beta.62) Checking Ulw-Loop Steering"
}
]
}
],
"PostToolUse": [
{
- "matcher": "^(spawn_agent|collaborationspawn_agent|collaboration\\.spawn_agent)$",
+ "matcher": "^(spawn_agent|multi_agent_v1\\.spawn_agent|collaborationspawn_agent|collaboration\\.spawn_agent)$",
"hooks": [
{
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-tool-use-spawn",
"timeout": 5,
- "statusMessage": "(OmO 5.0.0-beta.60) Recording Spawn Admission"
+ "statusMessage": "(OmO 5.0.0-beta.62) Recording Spawn Admission"
}
]
}
@@ -33,18 +33,18 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook pre-tool-use",
"timeout": 5,
- "statusMessage": "(OmO 5.0.0-beta.60) Enforcing Unlimited Ulw-Loop Budget"
+ "statusMessage": "(OmO 5.0.0-beta.62) Enforcing Unlimited Ulw-Loop Budget"
}
]
},
{
- "matcher": "^(spawn_agent|collaborationspawn_agent|collaboration\\.spawn_agent)$",
+ "matcher": "^(spawn_agent|multi_agent_v1\\.spawn_agent|collaborationspawn_agent|collaboration\\.spawn_agent)$",
"hooks": [
{
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook pre-tool-use-spawn",
"timeout": 5,
- "statusMessage": "(OmO 5.0.0-beta.60) Guarding Ulw-Loop Spawns"
+ "statusMessage": "(OmO 5.0.0-beta.62) Guarding Ulw-Loop Spawns"
}
]
}
@@ -56,7 +56,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook stop",
"timeout": 10,
- "statusMessage": "(OmO 5.0.0-beta.60) Checking Ulw-Loop Resume"
+ "statusMessage": "(OmO 5.0.0-beta.62) Checking Ulw-Loop Resume"
}
]
}
diff --git a/plugins/omo/components/ulw-loop/package.json b/plugins/omo/components/ulw-loop/package.json
index ca12135a..d31e97ba 100644
--- a/plugins/omo/components/ulw-loop/package.json
+++ b/plugins/omo/components/ulw-loop/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-ulw-loop",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"description": "Codex plugin: durable repo-native multi-goal orchestration with embedded success criteria and observable evidence audit.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/ulw-loop/src/sdk/factory.ts b/plugins/omo/components/ulw-loop/src/sdk/factory.ts
index 77924a56..f0d1a73a 100644
--- a/plugins/omo/components/ulw-loop/src/sdk/factory.ts
+++ b/plugins/omo/components/ulw-loop/src/sdk/factory.ts
@@ -24,6 +24,21 @@ import type {
ToolkitUnknownRequest,
} from "./types.js";
+// The SDK takes inline values only, so a snapshot that is not JSON is a caller error - normalize it
+// to the same stable code the CLI reports instead of letting it surface as a generic failure.
+function validateCodexGoalJson(raw: string | undefined): void {
+ if (raw === undefined) return;
+ try {
+ JSON.parse(raw);
+ } catch (error) {
+ throw new UlwLoopError(
+ `Invalid codexGoal: ${error instanceof Error ? error.message : "not valid JSON"}`,
+ "ULW_LOOP_CODEX_GOAL_JSON_INVALID",
+ { cause: error },
+ );
+ }
+}
+
function validateContext(context: ToolkitContext): void {
if (!context.cwd.trim()) throw new UlwLoopError("cwd is required.", "ULW_LOOP_CWD_REQUIRED");
if (!context.sessionId.trim())
@@ -63,6 +78,15 @@ function nextActionsFrom(result: object): readonly string[] {
return result.nextActions.filter((action): action is string => typeof action === "string").slice(0, 8);
}
+function checkpointWithValidatedSnapshot(
+ context: ToolkitContext,
+ scope: UlwLoopScope,
+ args: Exclude<CheckpointArgs, { readonly printTemplate: true }>,
+): ReturnType<typeof checkpointUlwLoop> {
+ validateCodexGoalJson(args.codexGoalJson);
+ return checkpointUlwLoop(context.cwd, args, scope, { surface: context.surface });
+}
+
export function createAgentToolkit(context: ToolkitContext, deps: AgentToolkitDependencies = {}): AgentToolkit {
validateContext(context);
const scope: UlwLoopScope = { sessionId: context.sessionId };
@@ -139,7 +163,7 @@ export function createAgentToolkit(context: ToolkitContext, deps: AgentToolkitDe
invoke("checkpoint", () =>
args.printTemplate === true
? checkpointTemplate(context.cwd, scope, args.goalId, { surface: context.surface })
- : checkpointUlwLoop(context.cwd, args, scope, { surface: context.surface }),
+ : checkpointWithValidatedSnapshot(context, scope, args),
),
steer: (args) => invoke("steer", () => steerUlwLoop(context.cwd, args, scope)),
addGoal: (args) => invoke("add-goal", () => addUlwLoopGoal(context.cwd, args, scope)),
diff --git a/plugins/omo/components/ulw-loop/src/spawn-guard.ts b/plugins/omo/components/ulw-loop/src/spawn-guard.ts
index 8b993a95..bdac27e4 100644
--- a/plugins/omo/components/ulw-loop/src/spawn-guard.ts
+++ b/plugins/omo/components/ulw-loop/src/spawn-guard.ts
@@ -6,6 +6,7 @@ import type { PreToolUsePayload } from "./codex-hook.js";
import { parsePreToolUsePayload } from "./codex-hook.js";
import { isFinalRunCompletionCandidate } from "./goal-status.js";
import { ulwLoopAttemptEvidenceDir, ulwLoopDir, ulwLoopStateLockPath } from "./paths.js";
+import { spawnRoleDenial } from "./spawn-role-guard.js";
import { isStateLockTimeout, type StateLockOptions, withStateLockSync } from "./state-lock.js";
import {
GATE_REVIEWER_AGENT_NAMES,
@@ -18,7 +19,12 @@ import type { UlwLoopPlan } from "./types.js";
// spawn_agent = v1; collaborationspawn_agent = the delimiter-free flattened v2
// hook token from codex-rs hook_names.rs; collaboration.spawn_agent = the
// dotted token observed live in the task-1 probe (hook-tool-tokens.txt).
-const SPAWN_TOOL_TOKENS = new Set(["spawn_agent", "collaborationspawn_agent", "collaboration.spawn_agent"]);
+const SPAWN_TOOL_TOKENS = new Set([
+ "spawn_agent",
+ "multi_agent_v1.spawn_agent",
+ "collaborationspawn_agent",
+ "collaboration.spawn_agent",
+]);
export const DEFAULT_FANOUT_LIMIT = 24;
const DEFAULT_REVIEW_SPAWN_LIMIT = 3;
const GATE_MESSAGE_PATTERN = /lazycodex-gate-reviewer|omo-senpi-gate-reviewer|final gate review/i;
@@ -34,6 +40,15 @@ export interface SpawnGuardOptions {
}
export function applySpawnGuards(payload: PreToolUsePayload, options: SpawnGuardOptions = {}): string {
+ if (payload.hook_event_name !== "PreToolUse" || !SPAWN_TOOL_TOKENS.has(payload.tool_name)) return "";
+ if (resolveToolkitSurface() === "lazycodex") {
+ const reason = spawnRoleDenial(payload.tool_input);
+ if (reason !== null) return deny(reason);
+ }
+ return applySpawnBudgetGuards(payload, options);
+}
+
+export function applySpawnBudgetGuards(payload: PreToolUsePayload, options: SpawnGuardOptions = {}): string {
if (payload.hook_event_name !== "PreToolUse" || !SPAWN_TOOL_TOKENS.has(payload.tool_name)) return "";
const breaker = readAdmissionBreaker(payload.session_id);
if (breaker !== null)
@@ -110,11 +125,14 @@ export async function runSpawnGuardCli(stdin: NodeJS.ReadableStream, stdout: Nod
const chunks: Buffer[] = [];
for await (const chunk of stdin) chunks.push(Buffer.from(chunk));
const payload = parsePreToolUsePayload(Buffer.concat(chunks).toString("utf8"));
- if (payload === null) return;
+ if (payload === null) {
+ stdout.write(deny("LazyCodex spawn guard received an invalid hook payload; role routing was not verified."));
+ return;
+ }
const output = applySpawnGuards(payload);
if (output.length > 0) stdout.write(output);
} catch (error) {
- if (error instanceof Error) return;
+ stdout.write(deny(`LazyCodex spawn guard failed: ${error instanceof Error ? error.message : String(error)}`));
}
}
diff --git a/plugins/omo/components/ulw-loop/src/spawn-role-guard.ts b/plugins/omo/components/ulw-loop/src/spawn-role-guard.ts
new file mode 100644
index 00000000..71946208
--- /dev/null
+++ b/plugins/omo/components/ulw-loop/src/spawn-role-guard.ts
@@ -0,0 +1,22 @@
+// Explicit selectors, pinned by a test to the bundled role TOMLs. The generated
+// default is a non-fork fallback, not a selector: a user can opt out of owning it.
+export const LAZYCODEX_SPAWN_ROLES: ReadonlySet<string> = new Set([
+ "explorer",
+ "lazycodex-clone-fidelity-reviewer",
+ "lazycodex-code-reviewer",
+ "lazycodex-gate-reviewer",
+ "lazycodex-qa-executor",
+ "lazycodex-worker-high",
+ "lazycodex-worker-low",
+ "lazycodex-worker-medium",
+ "librarian",
+ "metis",
+ "momus",
+ "plan",
+]);
+
+export function spawnRoleDenial(input: unknown): string | null {
+ const role = typeof input === "object" && input !== null && "agent_type" in input ? input.agent_type : undefined;
+ if (typeof role === "string" && LAZYCODEX_SPAWN_ROLES.has(role)) return null;
+ return `LazyCodex requires an explicit registered agent_type: ${[...LAZYCODEX_SPAWN_ROLES].join(", ")}. Received ${JSON.stringify(role) ?? "no agent_type"}. Use the matching role and fork_turns: "none" (V2) or fork_context: false (V1), unless full history is deliberately required. The hook cannot see the tool schema; if agent_type is unavailable, stop and report incompatible role routing rather than spawning a generic agent. Describing a role in message does not select its TOML.`;
+}
diff --git a/plugins/omo/components/ulw-loop/test/sdk-driver-states.test.ts b/plugins/omo/components/ulw-loop/test/sdk-driver-states.test.ts
new file mode 100644
index 00000000..f0391def
--- /dev/null
+++ b/plugins/omo/components/ulw-loop/test/sdk-driver-states.test.ts
@@ -0,0 +1,145 @@
+import { mkdtemp, rm } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { afterEach, describe, expect, it } from "vitest";
+
+import { readUlwLoopPlan } from "../src/plan-io.js";
+import { createAgentToolkit } from "../src/sdk.js";
+
+const workDirs: string[] = [];
+
+afterEach(async () => {
+ for (const dir of workDirs.splice(0)) await rm(dir, { recursive: true, force: true });
+});
+
+interface Seeded {
+ readonly cwd: string;
+ readonly sessionId: string;
+ readonly goalId: string;
+ readonly objective: string;
+}
+
+// One fixture shape for every driver state: a real plan whose first goal is ready to close, so the
+// only thing under test is what the driver snapshot does to the checkpoint.
+async function seed(sessionId: string): Promise<Seeded> {
+ const cwd = await mkdtemp(join(tmpdir(), "ulw-driver-"));
+ workDirs.push(cwd);
+ const toolkit = createAgentToolkit({ cwd, sessionId, surface: "omo-senpi" });
+ const created = await toolkit.createGoals({ brief: "- alpha goal\n- beta goal" });
+ if (!created.ok) throw new Error("fixture could not create goals");
+ const started = await toolkit.completeGoals({});
+ if (!started.ok || started.operation !== "complete-goals" || "done" in started.result)
+ throw new Error("fixture could not start a goal");
+ const goalId = started.result.goal.id;
+ const criteria = await toolkit.criteria({ goalId });
+ if (!criteria.ok || criteria.operation !== "criteria") throw new Error("fixture has no criteria");
+ for (const criterion of criteria.result.criteria) {
+ const recorded = await toolkit.recordEvidence({
+ goalId,
+ criterionId: criterion.id,
+ status: "pass",
+ evidence: "driver-state fixture proof",
+ });
+ if (!recorded.ok) throw new Error("fixture could not record evidence");
+ }
+ const plan = await readUlwLoopPlan(cwd, { sessionId });
+ return { cwd, sessionId, goalId, objective: plan.codexObjective ?? "" };
+}
+
+async function closeWith(seeded: Seeded, snapshot?: Record<string, unknown>) {
+ const toolkit = createAgentToolkit({ cwd: seeded.cwd, sessionId: seeded.sessionId, surface: "omo-senpi" });
+ return toolkit.checkpoint({
+ goalId: seeded.goalId,
+ status: "complete",
+ evidence: "driver-state checkpoint",
+ ...(snapshot === undefined ? {} : { codexGoalJson: JSON.stringify(snapshot) }),
+ });
+}
+
+describe("SDK driver-goal states", () => {
+ describe("#given no driver snapshot", () => {
+ it("#when the goal is checkpointed #then it completes and advises creating the driver goal", async () => {
+ const seeded = await seed("driver-absent");
+
+ const closed = await closeWith(seeded);
+
+ expect(closed.ok).toBe(true);
+ if (closed.ok) expect(closed.nextActions.join(" ")).toContain("create_goal");
+ });
+ });
+
+ describe("#given an active driver carrying the plan objective", () => {
+ it("#when the goal is checkpointed #then it completes with no objective difference reported", async () => {
+ const seeded = await seed("driver-active");
+
+ const closed = await closeWith(seeded, { goal: { objective: seeded.objective, status: "active" } });
+
+ expect(closed.ok).toBe(true);
+ if (closed.ok) {
+ expect([...(closed.warnings ?? []), ...closed.nextActions].join(" ")).not.toContain(
+ "driver_objective_differs",
+ );
+ }
+ });
+ });
+
+ describe("#given a driver completed before the plan finished", () => {
+ it("#when the goal is checkpointed #then it completes and advises re-creating the driver", async () => {
+ const seeded = await seed("driver-early");
+
+ const closed = await closeWith(seeded, { goal: { objective: seeded.objective, status: "complete" } });
+
+ expect(closed.ok).toBe(true);
+ if (closed.ok) expect(closed.nextActions.join(" ")).toContain("create_goal");
+ });
+ });
+
+ describe("#given a driver the harness has limited", () => {
+ for (const status of ["paused", "usage_limited", "budget_limited"] as const) {
+ it(`#when the driver is ${status} #then the checkpoint still completes and advises resuming it`, async () => {
+ const seeded = await seed(`driver-${status}`);
+
+ const closed = await closeWith(seeded, { goal: { objective: seeded.objective, status } });
+
+ expect(closed.ok).toBe(true);
+ if (closed.ok) expect(closed.nextActions.join(" ")).toContain("/goal resume");
+ });
+ }
+ });
+
+ describe("#given a driver whose objective differs from the plan", () => {
+ it("#when the goal is checkpointed #then the difference is reported, never a rejection", async () => {
+ const seeded = await seed("driver-differs");
+
+ const closed = await closeWith(seeded, { goal: { objective: "a different objective", status: "active" } });
+
+ expect(closed.ok).toBe(true);
+ if (closed.ok) {
+ expect([...(closed.warnings ?? []), ...closed.nextActions].join(" ")).toContain("driver_objective_differs");
+ }
+ });
+ });
+
+ describe("#given snapshot input that is neither JSON nor a readable path", () => {
+ it("#when the goal is checkpointed #then the typed error is returned and the goal stays open", async () => {
+ const seeded = await seed("driver-malformed");
+
+ const closed = await closeWith(seeded);
+ expect(closed.ok).toBe(true);
+
+ const second = await seed("driver-malformed-2");
+ const toolkit = createAgentToolkit({ cwd: second.cwd, sessionId: second.sessionId, surface: "omo-senpi" });
+ const rejected = await toolkit.checkpoint({
+ goalId: second.goalId,
+ status: "complete",
+ evidence: "driver-state checkpoint",
+ codexGoalJson: "not json and not a path",
+ });
+
+ expect(rejected.ok).toBe(false);
+ if (!rejected.ok) expect(rejected.error.code).toBe("ULW_LOOP_CODEX_GOAL_JSON_INVALID");
+ const plan = await readUlwLoopPlan(second.cwd, { sessionId: second.sessionId });
+ expect(plan.goals.find((goal) => goal.id === second.goalId)?.status).not.toBe("complete");
+ });
+ });
+});
diff --git a/plugins/omo/components/ulw-loop/test/spawn-guard.test.ts b/plugins/omo/components/ulw-loop/test/spawn-guard.test.ts
index c3d72904..45c1ae5f 100644
--- a/plugins/omo/components/ulw-loop/test/spawn-guard.test.ts
+++ b/plugins/omo/components/ulw-loop/test/spawn-guard.test.ts
@@ -6,7 +6,13 @@ import { Readable, Writable } from "node:stream";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { PreToolUsePayload } from "../src/codex-hook.ts";
-import { applySpawnGuards, DEFAULT_FANOUT_LIMIT, runSpawnAdmissionRecorderCli } from "../src/spawn-guard.ts";
+// Budget/artifact behavior is independent of role admission; the native entry
+// point and its composition are covered in spawn-role-matrix.test.ts.
+import {
+ applySpawnBudgetGuards as applySpawnGuards,
+ DEFAULT_FANOUT_LIMIT,
+ runSpawnAdmissionRecorderCli,
+} from "../src/spawn-guard.ts";
let workDir: string;
let originalLimit: string | undefined;
diff --git a/plugins/omo/components/ulw-loop/test/spawn-role-matrix.test.ts b/plugins/omo/components/ulw-loop/test/spawn-role-matrix.test.ts
new file mode 100644
index 00000000..1f1f52fd
--- /dev/null
+++ b/plugins/omo/components/ulw-loop/test/spawn-role-matrix.test.ts
@@ -0,0 +1,113 @@
+import { mkdir, mkdtemp, readdir, readFile, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { Readable, Writable } from "node:stream";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { applySpawnGuards, runSpawnGuardCli } from "../src/spawn-guard.js";
+import { LAZYCODEX_SPAWN_ROLES } from "../src/spawn-role-guard.js";
+
+let cwd: string;
+beforeEach(async () => {
+ cwd = await mkdtemp(join(tmpdir(), "spawn-role-matrix-"));
+ vi.stubEnv("OMO_AGENT_TOOLKIT_SURFACE", "lazycodex");
+ vi.stubEnv("PLUGIN_DATA", join(cwd, "data"));
+});
+afterEach(async () => {
+ vi.unstubAllEnvs();
+ await rm(cwd, { recursive: true, force: true });
+});
+
+function guard(tool_name: string, tool_input: Record<string, unknown>) {
+ return applySpawnGuards({
+ cwd,
+ hook_event_name: "PreToolUse",
+ model: "test",
+ permission_mode: "default",
+ session_id: "matrix",
+ tool_name,
+ tool_input,
+ tool_use_id: "call",
+ transcript_path: null,
+ turn_id: "turn",
+ });
+}
+
+describe("#given no active plan #when native spawns cross the role boundary", () => {
+ for (const tool of [
+ "spawn_agent",
+ "multi_agent_v1.spawn_agent",
+ "collaborationspawn_agent",
+ "collaboration.spawn_agent",
+ ]) {
+ for (const fork of [false, true]) {
+ for (const registered of [false, true]) {
+ for (const named of [false, true]) {
+ it(`${tool}: named=${named}, full-history=${fork}, registered=${registered}`, () => {
+ const role = registered ? "lazycodex-worker-medium" : "worker";
+ const input = {
+ message: "TASK: implement",
+ ...(named ? { agent_type: role } : {}),
+ ...(tool.includes("collaboration")
+ ? { fork_turns: fork ? "all" : "none", task_name: "work" }
+ : { fork_context: fork }),
+ };
+ const output = guard(tool, input);
+ if (named && registered) expect(output).toBe("");
+ else expect(JSON.parse(output).hookSpecificOutput.permissionDecision).toBe("deny");
+ });
+ }
+ }
+ }
+ }
+ it.each(["default", "deep", "explore", "", "unknown", 42, null])(
+ "rejects non-registry or malformed agent_type=%s",
+ (agent_type) => {
+ expect(JSON.parse(guard("spawn_agent", { agent_type })).hookSpecificOutput.permissionDecision).toBe("deny");
+ },
+ );
+ it("rejects omitted fork_turns and role rather than silently inheriting full history", () => {
+ expect(
+ JSON.parse(guard("collaboration.spawn_agent", { task_name: "work", message: "TASK: work" })).hookSpecificOutput
+ .permissionDecision,
+ ).toBe("deny");
+ });
+ it("does not change Senpi role admission", () => {
+ vi.stubEnv("OMO_AGENT_TOOLKIT_SURFACE", "omo-senpi");
+ expect(guard("spawn_agent", { agent_type: "deep" })).toBe("");
+ });
+ it("pins explicit selectors to actual bundled TOML names", async () => {
+ const root = new URL("../../ultrawork/agents/", import.meta.url);
+ const names = await Promise.all(
+ (await readdir(root))
+ .filter((file) => file.endsWith(".toml"))
+ .map(async (file) => {
+ const content = await readFile(new URL(file, root), "utf8");
+ return /^name = "([^"]+)"/m.exec(content)?.[1];
+ }),
+ );
+ expect([...LAZYCODEX_SPAWN_ROLES].sort()).toEqual(names.sort());
+ });
+ it("still enforces admission breakers after role validation", async () => {
+ await mkdir(join(cwd, "data", "spawn-breaker"), { recursive: true });
+ await writeFile(join(cwd, "data", "spawn-breaker", "matrix.json"), JSON.stringify({ reason: "capacity" }));
+ expect(JSON.parse(guard("spawn_agent", { agent_type: "explorer" })).hookSpecificOutput.permissionDecision).toBe(
+ "deny",
+ );
+ });
+ it("fails loudly on malformed hook input", async () => {
+ let output = "";
+ await runSpawnGuardCli(
+ Readable.from(["{bad-json"]),
+ new Writable({
+ write(chunk, _encoding, callback) {
+ output += chunk.toString();
+ callback();
+ },
+ }),
+ );
+ expect(JSON.parse(output).hookSpecificOutput.permissionDecision).toBe("deny");
+ });
+ it("does not intercept other tools", () => {
+ expect(guard("read_file", {})).toBe("");
+ });
+});
diff --git a/plugins/omo/dist/cli-node/index.js b/plugins/omo/dist/cli-node/index.js
index f0098041..2998b23f 100755
--- a/plugins/omo/dist/cli-node/index.js
+++ b/plugins/omo/dist/cli-node/index.js
@@ -65,7 +65,7 @@ var package_default;
var init_package = __esm(() => {
package_default = {
name: "oh-my-opencode",
- version: "5.0.0-beta.60",
+ version: "5.0.0-beta.62",
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
main: "./dist/index.js",
types: "dist/index.d.ts",
@@ -250,7 +250,7 @@ var init_package = __esm(() => {
zod: "^4.4.3"
},
devDependencies: {
- "@code-yeongyu/senpi": "2026.9.12-2",
+ "@code-yeongyu/senpi": "2026.9.13",
"@oh-my-opencode/agents-md-core": "workspace:*",
"@oh-my-opencode/ast-grep-mcp": "workspace:*",
"@oh-my-opencode/boulder-state": "workspace:*",
@@ -291,18 +291,18 @@ var init_package = __esm(() => {
typescript: "^7.0.2"
},
optionalDependencies: {
- "oh-my-opencode-darwin-arm64": "5.0.0-beta.60",
- "oh-my-opencode-darwin-x64": "5.0.0-beta.60",
- "oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.60",
- "oh-my-opencode-linux-arm64": "5.0.0-beta.60",
- "oh-my-opencode-linux-arm64-musl": "5.0.0-beta.60",
- "oh-my-opencode-linux-x64": "5.0.0-beta.60",
- "oh-my-opencode-linux-x64-baseline": "5.0.0-beta.60",
- "oh-my-opencode-linux-x64-musl": "5.0.0-beta.60",
- "oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.60",
- "oh-my-opencode-windows-arm64": "5.0.0-beta.60",
- "oh-my-opencode-windows-x64": "5.0.0-beta.60",
- "oh-my-opencode-windows-x64-baseline": "5.0.0-beta.60"
+ "oh-my-opencode-darwin-arm64": "5.0.0-beta.62",
+ "oh-my-opencode-darwin-x64": "5.0.0-beta.62",
+ "oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.62",
+ "oh-my-opencode-linux-arm64": "5.0.0-beta.62",
+ "oh-my-opencode-linux-arm64-musl": "5.0.0-beta.62",
+ "oh-my-opencode-linux-x64": "5.0.0-beta.62",
+ "oh-my-opencode-linux-x64-baseline": "5.0.0-beta.62",
+ "oh-my-opencode-linux-x64-musl": "5.0.0-beta.62",
+ "oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.62",
+ "oh-my-opencode-windows-arm64": "5.0.0-beta.62",
+ "oh-my-opencode-windows-x64": "5.0.0-beta.62",
+ "oh-my-opencode-windows-x64-baseline": "5.0.0-beta.62"
},
overrides: {
"@earendil-works/pi-agent-core": "0.84.2",
@@ -77023,20 +77023,20 @@ var init_config_manager = __esm(() => {
// packages/telemetry-core/src/activity-state.ts
import { existsSync as existsSync24, mkdirSync as mkdirSync8, readFileSync as readFileSync11 } from "node:fs";
-import { basename as basename8, join as join50 } from "node:path";
+import { basename as basename8, join as join51 } from "node:path";
function resolveTelemetryStateDir(product, options = {}) {
const dataDir = resolveXdgDataDir(product.cacheDirName, {
env: options.env,
osProvider: options.osProvider
});
- const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join50(options.env.XDG_DATA_HOME, product.cacheDirName);
+ const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join51(options.env.XDG_DATA_HOME, product.cacheDirName);
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename8(dataDir) === product.cacheDirName) {
return dataDir;
}
- return join50(dataDir, product.cacheDirName);
+ return join51(dataDir, product.cacheDirName);
}
function getTelemetryActivityStateFilePath(stateDir) {
- return join50(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
+ return join51(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
}
function getDailyActiveCaptureState(input) {
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
@@ -77107,9 +77107,9 @@ var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY =
// packages/telemetry-core/src/diagnostics.ts
import { appendFileSync as appendFileSync2, existsSync as existsSync25, mkdirSync as mkdirSync9, readFileSync as readFileSync12 } from "node:fs";
-import { join as join51 } from "node:path";
+import { join as join52 } from "node:path";
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
- return join51(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
+ return join52(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
}
function writeTelemetryDiagnostic(input, options) {
const now = options.now ?? new Date;
@@ -84416,13 +84416,13 @@ var init_index_node = __esm(() => {
});
// packages/telemetry-core/src/machine-id.ts
-import { createHash as createHash4 } from "node:crypto";
+import { createHash as createHash5 } from "node:crypto";
import os4 from "node:os";
function getDefaultTelemetryOsProvider() {
return os4;
}
function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetryOsProvider()) {
- return createHash4("sha256").update(`${machineIdPrefix}${osProvider.hostname()}`).digest("hex");
+ return createHash5("sha256").update(`${machineIdPrefix}${osProvider.hostname()}`).digest("hex");
}
var init_machine_id = () => {};
@@ -84621,7 +84621,7 @@ var package_default2;
var init_package2 = __esm(() => {
package_default2 = {
name: "@oh-my-opencode/omo-codex",
- version: "5.0.0-beta.60",
+ version: "5.0.0-beta.62",
type: "module",
private: true,
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
@@ -85493,7 +85493,7 @@ var init_update_toasts = __esm(() => {
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
import { existsSync as existsSync46 } from "node:fs";
-import { dirname as dirname30, join as join73 } from "node:path";
+import { dirname as dirname30, join as join74 } from "node:path";
import { fileURLToPath as fileURLToPath5 } from "node:url";
function defaultGetModuleHostingWorkspace() {
try {
@@ -85647,7 +85647,7 @@ var init_background_update_check = __esm(() => {
init_update_toasts();
defaultDeps4 = {
existsSync: existsSync46,
- join: join73,
+ join: join74,
runBunInstallWithDetails,
log: log2,
getOpenCodeCacheDir,
@@ -88069,7 +88069,19 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
}
// packages/omo-codex/src/install/install-codex.ts
-import { join as join52, resolve as resolve12 } from "node:path";
+import { join as join53, resolve as resolve12 } from "node:path";
+
+// packages/omo-codex/src/install/codex-default-role-config.ts
+init_src4();
+function readDefaultRoleConfig(options = {}) {
+ const result = loadOmoConfig({ ...options, harness: "codex" });
+ return {
+ enabled: result.config.agents?.default?.disable !== true,
+ warnings: result.diagnostics.map((diagnostic) => diagnostic.message)
+ };
+}
+
+// packages/omo-codex/src/install/install-codex.ts
import { existsSync as existsSync26 } from "node:fs";
import { homedir as homedir6 } from "node:os";
@@ -89996,6 +90008,12 @@ function removeStaleManagedAgentBlocks(config, keepAgentNames) {
`);
}
+function hasForeignAgentRegistration(config, agentConfig) {
+ const section = findTomlSection(config, `agents.${tomlKeySegment(agentConfig.name)}`);
+ if (!section)
+ return false;
+ return !section.text.includes(`config_file = ${JSON.stringify(agentConfig.configFile)}`);
+}
function ensureAgentConfig(config, agentConfig) {
const header = `agents.${tomlKeySegment(agentConfig.name)}`;
const section = findTomlSection(config, header);
@@ -90965,8 +90983,8 @@ function toCodexResolution(resolution) {
}
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
-import { copyFile, lstat as lstat9, mkdir as mkdir6, readdir as readdir7, rm as rm8, writeFile as writeFile7 } from "node:fs/promises";
-import { basename as basename6, join as join40 } from "node:path";
+import { copyFile, lstat as lstat10, mkdir as mkdir6, readdir as readdir7, rm as rm9, writeFile as writeFile7 } from "node:fs/promises";
+import { basename as basename6, join as join41 } from "node:path";
// packages/omo-codex/src/install/preserved-agent-settings.ts
import { lstat as lstat7, readFile as readFile13, readdir as readdir6, writeFile as writeFile6 } from "node:fs/promises";
@@ -91383,6 +91401,66 @@ function nodeErrorCode2(error) {
return typeof error.code === "string" ? error.code : null;
}
+// packages/omo-codex/src/install/default-agent-role.ts
+import { createHash as createHash3 } from "node:crypto";
+import { lstat as lstat9, readFile as readFile15, rm as rm8 } from "node:fs/promises";
+import { join as join40 } from "node:path";
+var REGISTRATION = { name: "default", configFile: "./agents/default.toml" };
+async function installDefaultAgentRole(input) {
+ const target = join40(input.codexHome, "agents", "default.toml");
+ const receipt = join40(input.codexHome, "agents", ".lazycodex-default.sha256");
+ const configPath = join40(input.codexHome, "config.toml");
+ const config = await readIfPresent(configPath);
+ const entry = await lstat9(target).catch((error) => {
+ if (error instanceof Error && "code" in error && error.code === "ENOENT")
+ return null;
+ throw error;
+ });
+ if (entry !== null && !entry.isFile()) {
+ if (!input.enabled)
+ return null;
+ throw new Error("Preserved user-owned agents/default.toml: refusing to replace a symlink or directory");
+ }
+ const existing = await readIfPresent(target);
+ const digest = await readIfPresent(receipt);
+ const owned = existing !== null && digest === hash(existing);
+ const foreign = hasForeignAgentRegistration(config ?? "", REGISTRATION);
+ if (!input.enabled) {
+ if (owned) {
+ if (!foreign && config !== null) {
+ const next = splitTomlSections(config).filter((section) => section.header === null || parseAgentHeaderName(section.header) !== "default").map((section) => section.text).join("");
+ if (next !== config)
+ await writeFileAtomic(configPath, next);
+ }
+ await rm8(target);
+ await rm8(receipt);
+ }
+ return null;
+ }
+ if (foreign || existing !== null && !owned) {
+ throw new Error("Preserved user-owned agents.default / agents/default.toml. Move it aside to install the LazyCodex fallback, or set [codex].agents.default.disable = true in omo.jsonc. Explicit LazyCodex roles remain required.");
+ }
+ const worker = await readFile15(input.worker.path, "utf8");
+ const content = worker.replace(/^name\s*=\s*["']lazycodex-worker-medium["']\s*$/m, 'name = "default"');
+ if (content === worker)
+ throw new Error("Cannot derive default: medium worker has no matching internal name");
+ await writeFileAtomic(target, content);
+ await writeFileAtomic(receipt, hash(content));
+ return { name: "default.toml", path: target, target: input.worker.target };
+}
+async function readIfPresent(path) {
+ try {
+ return await readFile15(path, "utf8");
+ } catch (error) {
+ if (error instanceof Error && "code" in error && error.code === "ENOENT")
+ return null;
+ throw error;
+ }
+}
+function hash(content) {
+ return createHash3("sha256").update(content).digest("hex");
+}
+
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
var MANIFEST_FILE = ".installed-agents.json";
async function linkCachedPluginAgents(input) {
@@ -91392,13 +91470,13 @@ async function linkCachedPluginAgents(input) {
await writeManifest(input.pluginRoot, []);
return [];
}
- const agentsDir = join40(input.codexHome, "agents");
+ const agentsDir = join41(input.codexHome, "agents");
await mkdir6(agentsDir, { recursive: true });
const linked = [];
for (const agentPath of bundledAgents) {
const agentFileName = basename6(agentPath);
const agentName = agentNameFromToml2(agentFileName);
- const linkPath = join40(agentsDir, agentFileName);
+ const linkPath = join41(agentsDir, agentFileName);
await replaceWithCopy(linkPath, agentPath);
await restorePreservedReasoning({
agentName,
@@ -91413,11 +91491,17 @@ async function linkCachedPluginAgents(input) {
});
linked.push({ name: agentFileName, path: linkPath, target: agentPath });
}
+ const worker = linked.find((entry) => entry.name === "lazycodex-worker-medium.toml");
+ if (worker !== undefined) {
+ const fallback = await installDefaultAgentRole({ codexHome: input.codexHome, worker, enabled: input.defaultRoleEnabled !== false });
+ if (fallback !== null)
+ linked.push(fallback);
+ }
await writeManifest(input.pluginRoot, linked.map((entry) => entry.path));
return linked;
}
async function discoverBundledAgents(pluginRoot) {
- const componentsRoot = join40(pluginRoot, "components");
+ const componentsRoot = join41(pluginRoot, "components");
if (!await exists4(componentsRoot))
return [];
const componentEntries = await readdir7(componentsRoot, { withFileTypes: true });
@@ -91425,14 +91509,14 @@ async function discoverBundledAgents(pluginRoot) {
for (const entry of componentEntries) {
if (!entry.isDirectory())
continue;
- const agentsRoot = join40(componentsRoot, entry.name, "agents");
+ const agentsRoot = join41(componentsRoot, entry.name, "agents");
if (!await exists4(agentsRoot))
continue;
const agentEntries = await readdir7(agentsRoot, { withFileTypes: true });
for (const file of agentEntries) {
if (!file.isFile() || !file.name.endsWith(".toml"))
continue;
- agents.push(join40(agentsRoot, file.name));
+ agents.push(join41(agentsRoot, file.name));
}
}
agents.sort();
@@ -91445,14 +91529,14 @@ async function replaceWithCopy(linkPath, target) {
async function prepareReplacement(linkPath) {
if (!await exists4(linkPath))
return;
- const entryStat = await lstat9(linkPath);
+ const entryStat = await lstat10(linkPath);
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
}
- await rm8(linkPath, { force: true });
+ await rm9(linkPath, { force: true });
}
async function writeManifest(pluginRoot, agentPaths) {
- const manifestPath = join40(pluginRoot, MANIFEST_FILE);
+ const manifestPath = join41(pluginRoot, MANIFEST_FILE);
const payload = { agents: [...agentPaths].sort() };
await writeFile7(manifestPath, `${JSON.stringify(payload, null, "\t")}
`);
@@ -91462,7 +91546,7 @@ function agentNameFromToml2(fileName) {
}
async function exists4(path) {
try {
- await lstat9(path);
+ await lstat10(path);
return true;
} catch (error) {
if (nodeErrorCode3(error) !== "ENOENT")
@@ -91477,12 +91561,12 @@ function nodeErrorCode3(error) {
}
// packages/omo-codex/src/install/codex-marketplace.ts
-import { readFile as readFile15 } from "node:fs/promises";
-import { join as join41 } from "node:path";
+import { readFile as readFile16 } from "node:fs/promises";
+import { join as join42 } from "node:path";
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
async function readMarketplace(repoRoot, options) {
- const marketplacePath = options?.marketplacePath ?? join41(repoRoot, DEFAULT_MARKETPLACE_PATH);
- const raw = await readFile15(marketplacePath, "utf8");
+ const marketplacePath = options?.marketplacePath ?? join42(repoRoot, DEFAULT_MARKETPLACE_PATH);
+ const raw = await readFile16(marketplacePath, "utf8");
const parsed = JSON.parse(raw);
if (!isPlainRecord4(parsed))
throw new Error("marketplace.json must be an object");
@@ -91500,10 +91584,10 @@ async function readMarketplace(repoRoot, options) {
function resolvePluginSource(repoRoot, plugin, options) {
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
const relativePath = sourcePath.slice(2);
- return join41(repoRoot, ...relativePath.split(/[\\/]/));
+ return join42(repoRoot, ...relativePath.split(/[\\/]/));
}
async function readPluginManifest(pluginRoot) {
- const raw = await readFile15(join41(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
+ const raw = await readFile16(join42(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
const parsed = JSON.parse(raw);
if (!isPlainRecord4(parsed))
throw new Error(`${pluginRoot} plugin.json must be an object`);
@@ -91584,8 +91668,8 @@ function validateLocalSourcePath(path) {
}
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
-import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm9, writeFile as writeFile8 } from "node:fs/promises";
-import { join as join42, sep as sep6 } from "node:path";
+import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm10, writeFile as writeFile8 } from "node:fs/promises";
+import { join as join43, sep as sep6 } from "node:path";
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
async function writeInstalledMarketplaceSnapshot(input) {
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
@@ -91598,28 +91682,28 @@ async function writeInstalledMarketplaceSnapshot(input) {
return snapshotPlugins;
}
function installedMarketplaceRoot(codexHome, marketplaceName) {
- return join42(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
+ return join43(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
}
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
- const manifestDir = join42(marketplaceRoot, ".agents", "plugins");
+ const manifestDir = join43(marketplaceRoot, ".agents", "plugins");
await mkdir7(manifestDir, { recursive: true });
- const tempPath = join42(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
+ const tempPath = join43(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
await writeFile8(tempPath, `${JSON.stringify(marketplace, null, "\t")}
`);
- await rename4(tempPath, join42(manifestDir, "marketplace.json"));
+ await rename4(tempPath, join43(manifestDir, "marketplace.json"));
}
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
- const pluginsDir = join42(marketplaceRoot, "plugins");
+ const pluginsDir = join43(marketplaceRoot, "plugins");
await mkdir7(pluginsDir, { recursive: true });
- const targetPath = join42(pluginsDir, plugin.name);
- const tempPath = join42(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
- await rm9(tempPath, { recursive: true, force: true });
+ const targetPath = join43(pluginsDir, plugin.name);
+ const tempPath = join43(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
+ await rm10(tempPath, { recursive: true, force: true });
await cp3(plugin.sourcePath, tempPath, {
recursive: true,
filter: (source) => shouldCopyMarketplaceSourcePath(source, plugin.sourcePath)
});
await copyBundledMcpRuntimeDists({ pluginRoot: tempPath, sourceRoot: plugin.sourcePath });
- await rm9(targetPath, { recursive: true, force: true });
+ await rm10(targetPath, { recursive: true, force: true });
await rename4(tempPath, targetPath);
await rewriteCachedMcpManifest(targetPath, plugin.sourcePath);
return { name: plugin.name, path: targetPath };
@@ -91633,11 +91717,11 @@ function shouldCopyMarketplaceSourcePath(path, root) {
}
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
-import { readdir as readdir8, readFile as readFile16, writeFile as writeFile9 } from "node:fs/promises";
-import { join as join43 } from "node:path";
+import { readdir as readdir8, readFile as readFile17, writeFile as writeFile9 } from "node:fs/promises";
+import { join as join44 } from "node:path";
async function readDistributionManifest(repoRoot) {
try {
- const parsed = JSON.parse(await readFile16(join43(repoRoot, "package.json"), "utf8"));
+ const parsed = JSON.parse(await readFile17(join44(repoRoot, "package.json"), "utf8"));
if (!isPlainRecord4(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
return;
return {
@@ -91661,19 +91745,19 @@ function resolveLazyCodexPluginVersion(input) {
return input.manifestVersion ?? "local";
}
async function stampLazyCodexPluginVersion(input) {
- const manifestPath = join43(input.pluginRoot, ".codex-plugin", "plugin.json");
+ const manifestPath = join44(input.pluginRoot, ".codex-plugin", "plugin.json");
const hookPaths = await readPluginHookPaths(manifestPath);
await stampJsonVersion(manifestPath, input.version);
- await stampJsonVersion(join43(input.pluginRoot, "package.json"), input.version);
+ await stampJsonVersion(join44(input.pluginRoot, "package.json"), input.version);
for (const hookPath of hookPaths) {
- await stampHookStatusMessages(join43(input.pluginRoot, hookPath), input.version);
+ await stampHookStatusMessages(join44(input.pluginRoot, hookPath), input.version);
}
await stampComponentVersions(input);
}
async function writeLazyCodexInstallSnapshot(input) {
if (input.distributionManifest === undefined)
return;
- await writeFile9(join43(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
+ await writeFile9(join44(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
packageName: input.distributionManifest.name,
version: input.distributionManifest.version
}, null, "\t")}
@@ -91681,7 +91765,7 @@ async function writeLazyCodexInstallSnapshot(input) {
}
async function stampJsonVersion(path, version) {
try {
- const parsed = JSON.parse(await readFile16(path, "utf8"));
+ const parsed = JSON.parse(await readFile17(path, "utf8"));
if (!isPlainRecord4(parsed))
return;
parsed.version = version;
@@ -91695,7 +91779,7 @@ async function stampJsonVersion(path, version) {
}
async function readPluginHookPaths(manifestPath) {
try {
- const parsed = JSON.parse(await readFile16(manifestPath, "utf8"));
+ const parsed = JSON.parse(await readFile17(manifestPath, "utf8"));
if (!isPlainRecord4(parsed))
return [];
if (typeof parsed.hooks === "string" && parsed.hooks.trim().length > 0)
@@ -91715,7 +91799,7 @@ function stripDotSlash3(path) {
}
async function stampHookStatusMessages(path, version) {
try {
- const parsed = JSON.parse(await readFile16(path, "utf8"));
+ const parsed = JSON.parse(await readFile17(path, "utf8"));
if (!isPlainRecord4(parsed))
return;
stampHookGroups(parsed.hooks, version);
@@ -91730,16 +91814,16 @@ async function stampHookStatusMessages(path, version) {
async function stampComponentVersions(input) {
let entries;
try {
- entries = await readdir8(join43(input.pluginRoot, "components"));
+ entries = await readdir8(join44(input.pluginRoot, "components"));
} catch (error) {
if (error instanceof Error)
return;
throw error;
}
for (const entry of entries) {
- const componentRoot = join43(input.pluginRoot, "components", entry);
- await stampJsonVersion(join43(componentRoot, "package.json"), input.version);
- await stampHookStatusMessages(join43(componentRoot, "hooks", "hooks.json"), input.version);
+ const componentRoot = join44(input.pluginRoot, "components", entry);
+ await stampJsonVersion(join44(componentRoot, "package.json"), input.version);
+ await stampHookStatusMessages(join44(componentRoot, "hooks", "hooks.json"), input.version);
}
}
function stampHookGroups(hooks, version) {
@@ -91796,8 +91880,8 @@ var defaultRunCommand = async (command, args, options) => {
};
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
-import { copyFile as copyFile2, lstat as lstat10, readFile as readFile17, writeFile as writeFile10 } from "node:fs/promises";
-import { dirname as dirname16, join as join44, resolve as resolve10 } from "node:path";
+import { copyFile as copyFile2, lstat as lstat11, readFile as readFile18, writeFile as writeFile10 } from "node:fs/promises";
+import { dirname as dirname16, join as join45, resolve as resolve10 } from "node:path";
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
var PROJECT_LOCAL_ARTIFACT_PATHS = [
".codex/hooks.json",
@@ -91816,7 +91900,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
const artifacts = await collectProjectLocalArtifacts(project.artifactRoots);
const configs = [];
for (const configPath of project.configPaths) {
- const original = await readFile17(configPath, "utf8");
+ const original = await readFile18(configPath, "utf8");
const repair = repairProjectLocalCodexConfigText(original);
if (!repair.changed) {
configs.push({
@@ -91900,17 +91984,17 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
}
- const codexHomeConfigPath = codexHome === undefined ? null : join44(resolve10(codexHome), "config.toml");
+ const codexHomeConfigPath = codexHome === undefined ? null : join45(resolve10(codexHome), "config.toml");
let current = resolve10(startDirectory);
const configPathsFromCwd = [];
while (true) {
- const configPath = join44(current, ".codex", "config.toml");
+ const configPath = join45(current, ".codex", "config.toml");
if (await isRegularProjectLocalConfig(current, configPath)) {
if (codexHomeConfigPath === null || resolve10(configPath) !== codexHomeConfigPath) {
configPathsFromCwd.push(configPath);
}
}
- if (await exists5(join44(current, ".git"))) {
+ if (await exists5(join45(current, ".git"))) {
return configPathsFromCwd.length === 0 ? null : {
projectRoot: current,
configPaths: [...configPathsFromCwd].reverse(),
@@ -91930,7 +92014,7 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
}
}
async function isRegularProjectLocalConfig(directory, configPath) {
- const codexDirStat = await maybeLstat(join44(directory, ".codex"));
+ const codexDirStat = await maybeLstat(join45(directory, ".codex"));
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
return false;
const configStat = await maybeLstat(configPath);
@@ -91950,7 +92034,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
const seenPaths = new Set;
for (const projectRoot of projectRoots) {
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
- const artifactPath = join44(projectRoot, relativePath);
+ const artifactPath = join45(projectRoot, relativePath);
if (seenPaths.has(artifactPath))
continue;
const entryStat = await maybeLstat(artifactPath);
@@ -91984,7 +92068,7 @@ function formatBackupTimestamp(date) {
}
async function maybeLstat(path) {
try {
- return await lstat10(path);
+ return await lstat11(path);
} catch (error) {
if (nodeErrorCode4(error) === "ENOENT")
return null;
@@ -92025,14 +92109,14 @@ function formatUnknownError(error) {
}
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
-import { createHash as createHash3 } from "node:crypto";
-import { lstat as lstat11, readFile as readFile19, readdir as readdir10, rm as rm10 } from "node:fs/promises";
+import { createHash as createHash4 } from "node:crypto";
+import { lstat as lstat12, readFile as readFile20, readdir as readdir10, rm as rm11 } from "node:fs/promises";
import { tmpdir as tmpdir3 } from "node:os";
-import { join as join45, posix as posix6 } from "node:path";
+import { join as join46, posix as posix6 } from "node:path";
// packages/omo-codex/src/install/lsp-daemon-reaper-attestation.ts
import { execFile } from "node:child_process";
-import { readFile as readFile18, readdir as readdir9, readlink as readlink5 } from "node:fs/promises";
+import { readFile as readFile19, readdir as readdir9, readlink as readlink5 } from "node:fs/promises";
import { connect } from "node:net";
import { basename as basename7 } from "node:path";
var PROBE_TIMEOUT_MS = 500;
@@ -92074,7 +92158,7 @@ async function attestLegacyDaemonOwnership(input, deps = {}) {
return false;
}
async function attestLinuxOwnership(input, deps) {
- const readFileImpl = deps.readFile ?? readFile18;
+ const readFileImpl = deps.readFile ?? readFile19;
const readDirImpl = deps.readDir ?? readdir9;
const readLinkImpl = deps.readLink ?? readlink5;
const procNetUnix = await readText(readFileImpl, "/proc/net/unix");
@@ -92201,7 +92285,7 @@ async function readBinary(readFileImpl, path) {
var LEGACY_EXIT_WAIT_TIMEOUT_MS = 5000;
var LEGACY_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
async function reapLspDaemons(codexHome, deps = {}) {
- const daemonRoot = join45(codexHome, "codex-lsp", "daemon");
+ const daemonRoot = join46(codexHome, "codex-lsp", "daemon");
const platform = deps.platform ?? process.platform;
const tmpDir = deps.tmpDir ?? tmpdir3();
const probe = deps.probeLegacyJsonRpc ?? probeLegacyJsonRpcEndpoint;
@@ -92211,7 +92295,7 @@ async function reapLspDaemons(codexHome, deps = {}) {
const entries = await readdir10(daemonRoot, { withFileTypes: true }).catch(() => []);
const results = [];
for (const entry of [...entries].sort((left, right) => left.name.localeCompare(right.name))) {
- const versionPath = join45(daemonRoot, entry.name);
+ const versionPath = join46(daemonRoot, entry.name);
const parsedVersion = parseVersionEntry(entry.name);
if (parsedVersion === null || !entry.isDirectory()) {
await removeVersionDir(versionPath);
@@ -92259,7 +92343,7 @@ function parseVersionEntry(entryName) {
return LEGACY_VERSION_PATTERN.test(version) ? version : null;
}
async function readLegacyMetadata(input) {
- const pidText = await readRegularTrimmedFile(join45(input.versionPath, "daemon.pid"));
+ const pidText = await readRegularTrimmedFile(join46(input.versionPath, "daemon.pid"));
if (pidText === "non_regular")
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
if (pidText === null)
@@ -92267,7 +92351,7 @@ async function readLegacyMetadata(input) {
const pid = Number.parseInt(pidText, 10);
if (!Number.isInteger(pid) || pid <= 0)
return { kind: "remove", reason: "removed malformed legacy daemon metadata" };
- const endpointText = await readRegularTrimmedFile(join45(input.versionPath, "daemon.endpoint"));
+ const endpointText = await readRegularTrimmedFile(join46(input.versionPath, "daemon.endpoint"));
if (endpointText === "non_regular")
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
if (endpointText === null)
@@ -92294,19 +92378,19 @@ function legacyEndpointCandidates(input) {
return [natural, hashed];
}
async function readRegularTrimmedFile(path) {
- const stats = await lstat11(path).catch(() => null);
+ const stats = await lstat12(path).catch(() => null);
if (stats === null)
return null;
if (!stats.isFile())
return "non_regular";
- const content = (await readFile19(path, "utf8")).trim();
+ const content = (await readFile20(path, "utf8")).trim();
return content.length > 0 ? content : null;
}
function shortDigest(value) {
- return createHash3("sha256").update(value).digest("hex").slice(0, 16);
+ return createHash4("sha256").update(value).digest("hex").slice(0, 16);
}
async function removeVersionDir(path) {
- await rm10(path, { recursive: true, force: true });
+ await rm11(path, { recursive: true, force: true });
}
function removed(version, reason) {
return { version, status: "removed", reason };
@@ -92346,7 +92430,7 @@ function processIsRunning(pid) {
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
import { homedir as homedir5 } from "node:os";
-import { join as join46, resolve as resolve11 } from "node:path";
+import { join as join47, resolve as resolve11 } from "node:path";
function resolveCodexInstallerBinDir(input) {
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
@@ -92355,16 +92439,16 @@ function resolveCodexInstallerBinDir(input) {
const defaultCodexHome = resolve11(homeDir, ".codex");
const resolvedCodexHome = resolve11(input.codexHome);
if (resolvedCodexHome !== defaultCodexHome)
- return join46(resolvedCodexHome, "bin");
+ return join47(resolvedCodexHome, "bin");
return resolve11(homeDir, ".local", "bin");
}
// packages/omo-codex/src/install/codex-installed-bin-dir.ts
-import { readFile as readFile20, readdir as readdir11, writeFile as writeFile11 } from "node:fs/promises";
-import { join as join47 } from "node:path";
+import { readFile as readFile21, readdir as readdir11, writeFile as writeFile11 } from "node:fs/promises";
+import { join as join48 } from "node:path";
var INSTALLED_BIN_DIR_MANIFEST = ".installed-bin-dir.json";
async function writeInstalledCodexBinDir(input) {
- await writeFile11(join47(input.pluginRoot, INSTALLED_BIN_DIR_MANIFEST), `${JSON.stringify({ binDir: input.binDir }, null, 2)}
+ await writeFile11(join48(input.pluginRoot, INSTALLED_BIN_DIR_MANIFEST), `${JSON.stringify({ binDir: input.binDir }, null, 2)}
`);
}
async function readInstalledCodexBinDir(codexHome) {
@@ -92377,20 +92461,20 @@ async function readInstalledCodexBinDir(codexHome) {
}
async function installedBinDirManifestPaths(codexHome) {
const paths = [
- join47(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_BIN_DIR_MANIFEST)
+ join48(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_BIN_DIR_MANIFEST)
];
- const versionRoot = join47(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
+ const versionRoot = join48(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
const entries = await readdir11(versionRoot, { withFileTypes: true }).catch(() => null);
if (entries !== null) {
for (const entry of entries) {
if (entry.isDirectory())
- paths.push(join47(versionRoot, entry.name, INSTALLED_BIN_DIR_MANIFEST));
+ paths.push(join48(versionRoot, entry.name, INSTALLED_BIN_DIR_MANIFEST));
}
}
return paths;
}
async function readBinDirFromManifest(manifestPath) {
- const raw = await readFile20(manifestPath, "utf8").catch(() => null);
+ const raw = await readFile21(manifestPath, "utf8").catch(() => null);
if (raw === null)
return null;
let parsed;
@@ -92408,8 +92492,8 @@ async function readBinDirFromManifest(manifestPath) {
}
// packages/omo-codex/src/install/codex-git-bash-hooks.ts
-import { readFile as readFile21, writeFile as writeFile12 } from "node:fs/promises";
-import { join as join48 } from "node:path";
+import { readFile as readFile22, writeFile as writeFile12 } from "node:fs/promises";
+import { join as join49 } from "node:path";
var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
"./hooks/pre-tool-use-recommending-git-bash-mcp.json",
"./hooks/post-compact-resetting-git-bash-mcp-reminder.json"
@@ -92417,8 +92501,8 @@ var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
async function removeGitBashHooksOffWindows(input) {
if (input.platform === "win32")
return;
- const manifestPath = join48(input.pluginRoot, ".codex-plugin", "plugin.json");
- const parsed = JSON.parse(await readFile21(manifestPath, "utf8"));
+ const manifestPath = join49(input.pluginRoot, ".codex-plugin", "plugin.json");
+ const parsed = JSON.parse(await readFile22(manifestPath, "utf8"));
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.hooks))
return;
const hooks = parsed.hooks.filter((hook) => typeof hook !== "string" || !WINDOWS_ONLY_GIT_BASH_HOOKS.has(hook));
@@ -92430,7 +92514,7 @@ async function removeGitBashHooksOffWindows(input) {
// packages/omo-codex/src/install/install-ast-grep-sg.ts
init_src();
-import { join as join49 } from "node:path";
+import { join as join50 } from "node:path";
function describeResult(result) {
if (result.kind === "succeeded")
return null;
@@ -92444,7 +92528,7 @@ async function installAstGrepForCodex(options) {
return;
const platform = options.platform ?? process.platform;
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
- const skillDir = join49(plugin.path, "skills", "ast-grep");
+ const skillDir = join50(plugin.path, "skills", "ast-grep");
const installer = options.installer ?? runAstGrepSkillInstall;
try {
const result = await installer({ platform, skillDir, targetDir });
@@ -92477,7 +92561,7 @@ async function runCodexInstaller(options = {}) {
const env = options.env ?? process.env;
const platform = options.platform ?? process.platform;
const repoRoot = resolve12(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env }));
- const codexHome = resolve12(options.codexHome ?? env.CODEX_HOME ?? join52(homedir6(), ".codex"));
+ const codexHome = resolve12(options.codexHome ?? env.CODEX_HOME ?? join53(homedir6(), ".codex"));
const projectDirectory = resolve12(options.projectDirectory ?? env.OMO_CODEX_PROJECT ?? process.cwd());
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env });
const runCommand = options.runCommand ?? defaultRunCommand;
@@ -92494,9 +92578,9 @@ async function runCodexInstaller(options = {}) {
if (!gitBashResolution.found) {
throw new Error(gitBashResolution.installHint);
}
- const codexPackageRoot = join52(repoRoot, "packages", "omo-codex");
+ const codexPackageRoot = join53(repoRoot, "packages", "omo-codex");
const marketplace = await readMarketplace(repoRoot, {
- marketplacePath: join52(codexPackageRoot, "marketplace.json")
+ marketplacePath: join53(codexPackageRoot, "marketplace.json")
});
const distributionManifest = await readDistributionManifest(repoRoot);
const installed = [];
@@ -92542,7 +92626,7 @@ async function runCodexInstaller(options = {}) {
if (runtimeLink !== null)
log(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
else
- log(`Warning: skipped the omo-agent-toolkit runtime wrapper because ${join52(repoRoot, "dist", "cli", "index.js")} is missing; omo-agent-toolkit ulw-loop commands will be unavailable until a package shipping dist/cli is installed`);
+ log(`Warning: skipped the omo-agent-toolkit runtime wrapper because ${join53(repoRoot, "dist", "cli", "index.js")} is missing; omo-agent-toolkit ulw-loop commands will be unavailable until a package shipping dist/cli is installed`);
}
pluginSources.push({ name: entry.name, sourcePath });
installed.push(plugin);
@@ -92562,6 +92646,9 @@ async function runCodexInstaller(options = {}) {
installed,
pluginSources
});
+ const omoConfig = readDefaultRoleConfig({ cwd: projectDirectory, env });
+ for (const warning of omoConfig.warnings)
+ log(`Warning: ${warning}`);
for (const plugin of installed) {
const pluginRoot = agentSourceRoots.get(plugin.name) ?? plugin.path;
const agentLinks = await linkCachedPluginAgents({
@@ -92569,7 +92656,8 @@ async function runCodexInstaller(options = {}) {
pluginRoot,
platform,
preservedReasoning,
- preservedServiceTier
+ preservedServiceTier,
+ defaultRoleEnabled: omoConfig.enabled
});
for (const link of agentLinks) {
log(`Linked agent ${link.name} -> ${link.target}`);
@@ -92605,13 +92693,13 @@ async function runCodexInstaller(options = {}) {
continue;
log(`Warning: deferred legacy Codex LSP daemon cleanup for v${cleanup.version}: ${cleanup.reason}`);
}
- const marketplaceRoot = join52(codexHome, "plugins", "cache", marketplace.name);
+ const marketplaceRoot = join53(codexHome, "plugins", "cache", marketplace.name);
await writeCachedMarketplaceManifest({
marketplaceName: marketplace.name,
marketplaceRoot,
plugins: installed
});
- const configPath = join52(codexHome, "config.toml");
+ const configPath = join53(codexHome, "config.toml");
await updateCodexConfig({
configPath,
repoRoot: codexPackageRoot,
@@ -92670,7 +92758,7 @@ function findRepoRootFromImporter(importerDir) {
for (let depth = 0;depth <= 7; depth += 1) {
if (isRepoRootWithCodexPlugin(current))
return current;
- for (const wrapperPackageRoot of [join52(current, "node_modules", "oh-my-openagent"), join52(current, "oh-my-openagent")]) {
+ for (const wrapperPackageRoot of [join53(current, "node_modules", "oh-my-openagent"), join53(current, "oh-my-openagent")]) {
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
return wrapperPackageRoot;
}
@@ -92688,7 +92776,7 @@ function findRepoRoot(input) {
return findRepoRootFromImporter(input.importerDir);
}
function isRepoRootWithCodexPlugin(repoRoot) {
- return existsSync26(join52(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
+ return existsSync26(join53(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
}
function codexMarketplaceSource(marketplaceRoot) {
return { sourceType: "local", source: marketplaceRoot };
@@ -92823,13 +92911,13 @@ function defaultRunCommand2(command, args) {
});
}
// packages/omo-codex/src/install/codex-cleanup.ts
-import { lstat as lstat14, readFile as readFile24, readdir as readdir13, rm as rm12, rmdir } from "node:fs/promises";
+import { lstat as lstat15, readFile as readFile25, readdir as readdir13, rm as rm13, rmdir } from "node:fs/promises";
import { homedir as homedir8 } from "node:os";
-import { isAbsolute as isAbsolute11, join as join55, relative as relative6, resolve as resolve15 } from "node:path";
+import { isAbsolute as isAbsolute11, join as join56, relative as relative6, resolve as resolve15 } from "node:path";
// packages/omo-codex/src/install/codex-cleanup-bins.ts
-import { lstat as lstat12, readFile as readFile22, readdir as readdir12, readlink as readlink6, rm as rm11 } from "node:fs/promises";
-import { dirname as dirname18, isAbsolute as isAbsolute9, join as join53, resolve as resolve13 } from "node:path";
+import { lstat as lstat13, readFile as readFile23, readdir as readdir12, readlink as readlink6, rm as rm12 } from "node:fs/promises";
+import { dirname as dirname18, isAbsolute as isAbsolute9, join as join54, resolve as resolve13 } from "node:path";
var ROOT_RUNTIME_BIN_NAME = "omo";
var MANAGED_CODEX_BIN_NAMES = new Set([
ROOT_RUNTIME_BIN_NAME,
@@ -92859,9 +92947,9 @@ async function removeManagedCodexBins(binDir, platform) {
const binName = managedBinNameForEntry2(entry.name, platform);
if (binName === null || !MANAGED_CODEX_BIN_NAMES.has(binName))
continue;
- const linkPath = join53(binDir, entry.name);
+ const linkPath = join54(binDir, entry.name);
if (await isManagedCodexBin(linkPath, platform, binName)) {
- await rm11(linkPath, { force: true });
+ await rm12(linkPath, { force: true });
removed.push(linkPath);
}
}
@@ -92874,7 +92962,7 @@ function managedBinNameForEntry2(entryName, platform) {
return normalizedEntryName.endsWith(".cmd") ? normalizedEntryName.slice(0, -".cmd".length) : null;
}
async function isManagedCodexBin(linkPath, platform, binName) {
- const entryStat = await lstat12(linkPath).catch((error) => {
+ const entryStat = await lstat13(linkPath).catch((error) => {
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
return null;
throw error;
@@ -92890,12 +92978,12 @@ async function isManagedCodexBin(linkPath, platform, binName) {
}
if (!entryStat.isFile())
return false;
- const content = await readFile22(linkPath, "utf8");
+ const content = await readFile23(linkPath, "utf8");
return content.includes(RUNTIME_WRAPPER_MARKER) || content.includes(COMMAND_SHIM_MARKER);
}
// packages/omo-codex/src/install/codex-cleanup-config.ts
-import { lstat as lstat13, mkdir as mkdir8, readFile as readFile23, writeFile as writeFile13 } from "node:fs/promises";
+import { lstat as lstat14, mkdir as mkdir8, readFile as readFile24, writeFile as writeFile13 } from "node:fs/promises";
import { dirname as dirname19 } from "node:path";
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
@@ -92928,7 +93016,7 @@ function cleanupCodexLightConfigText(config) {
async function cleanupCodexConfig(configPath, now) {
if (!await configExists(configPath))
return { changed: false };
- const original = await readFile23(configPath, "utf8");
+ const original = await readFile24(configPath, "utf8");
const next = cleanupCodexLightConfigText(original);
if (next === original)
return { changed: false };
@@ -92997,7 +93085,7 @@ function formatBackupTimestamp2(date) {
}
async function configExists(path) {
try {
- await lstat13(path);
+ await lstat14(path);
return true;
} catch (error) {
if (nodeErrorCode5(error) === "ENOENT")
@@ -93012,7 +93100,7 @@ function nodeErrorCode5(error) {
}
// packages/omo-codex/src/install/codex-cleanup-safety.ts
-import { dirname as dirname20, isAbsolute as isAbsolute10, join as join54, relative as relative5, resolve as resolve14 } from "node:path";
+import { dirname as dirname20, isAbsolute as isAbsolute10, join as join55, relative as relative5, resolve as resolve14 } from "node:path";
function codexHomeResolvesToFilesystemRoot(codexHome) {
const resolved = resolve14(codexHome);
return dirname20(resolved) === resolved;
@@ -93029,11 +93117,11 @@ function validateManagedCleanupTarget(input) {
if (target === codexHome)
return skipped(input.path, "outside managed Codex cleanup scope");
const exactManagedRoots = new Set([
- resolve14(join54(codexHome, "plugins", "cache", "sisyphuslabs")),
- resolve14(join54(codexHome, ".tmp", "marketplaces", "sisyphuslabs")),
- resolve14(join54(codexHome, "runtime", "ast-grep")),
- resolve14(join54(codexHome, "runtime", "node")),
- resolve14(join54(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap"))
+ resolve14(join55(codexHome, "plugins", "cache", "sisyphuslabs")),
+ resolve14(join55(codexHome, ".tmp", "marketplaces", "sisyphuslabs")),
+ resolve14(join55(codexHome, "runtime", "ast-grep")),
+ resolve14(join55(codexHome, "runtime", "node")),
+ resolve14(join55(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap"))
]);
if (exactManagedRoots.has(target))
return null;
@@ -93063,8 +93151,8 @@ function skipped(path, reason) {
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
async function cleanupCodexLight(input = {}) {
const env = input.env ?? process.env;
- const codexHome = resolve15(input.codexHome ?? env.CODEX_HOME ?? join55(homedir8(), ".codex"));
- const configPath = join55(codexHome, "config.toml");
+ const codexHome = resolve15(input.codexHome ?? env.CODEX_HOME ?? join56(homedir8(), ".codex"));
+ const configPath = join56(codexHome, "config.toml");
const installedBinDir = await readInstalledCodexBinDir(codexHome);
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
const configCleanup = await cleanupCodexConfig(configPath, input.now);
@@ -93118,17 +93206,17 @@ function firstConfiguredPath(...values) {
}
function managedGlobalStatePaths(codexHome) {
return [
- join55(codexHome, "plugins", "cache", "sisyphuslabs"),
- join55(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
- join55(codexHome, "runtime", "ast-grep"),
- join55(codexHome, "runtime", "node"),
- join55(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
+ join56(codexHome, "plugins", "cache", "sisyphuslabs"),
+ join56(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
+ join56(codexHome, "runtime", "ast-grep"),
+ join56(codexHome, "runtime", "node"),
+ join56(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
];
}
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
async function collectBootstrapDataDirsByGlob(codexHome) {
const results = [];
- await walkForManagedBootstrapDirs(join55(codexHome, "plugins"), 0, results);
+ await walkForManagedBootstrapDirs(join56(codexHome, "plugins"), 0, results);
return results;
}
async function walkForManagedBootstrapDirs(directory, depth, results) {
@@ -93140,9 +93228,9 @@ async function walkForManagedBootstrapDirs(directory, depth, results) {
for (const entry of entries) {
if (!entry.isDirectory())
continue;
- const childPath = join55(directory, entry.name);
+ const childPath = join56(directory, entry.name);
if (isManagedBootstrapOwnerName(entry.name)) {
- const bootstrapDir = join55(childPath, "bootstrap");
+ const bootstrapDir = join56(childPath, "bootstrap");
if (await exists6(bootstrapDir))
results.push(bootstrapDir);
continue;
@@ -93166,9 +93254,9 @@ async function removeManagedPathBestEffort(path, seams) {
}
async function attemptRemove(path) {
try {
- if (await lstat14(path).catch(() => null) === null)
+ if (await lstat15(path).catch(() => null) === null)
return false;
- await rm12(path, { recursive: true, force: true });
+ await rm13(path, { recursive: true, force: true });
return true;
} catch {
return false;
@@ -93176,7 +93264,7 @@ async function attemptRemove(path) {
}
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
try {
- await rmdir(join55(codexHome, "runtime"));
+ await rmdir(join56(codexHome, "runtime"));
} catch (error) {
if (isExpectedRuntimePruneFailure(error))
return;
@@ -93188,14 +93276,14 @@ function isExpectedRuntimePruneFailure(error) {
}
async function collectInstalledAgentPaths(codexHome, configPath) {
const manifestPaths = [
- join55(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
+ join56(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
];
- const versionRoot = join55(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
+ const versionRoot = join56(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
if (await exists6(versionRoot)) {
const entries = await readdir13(versionRoot, { withFileTypes: true });
for (const entry of entries) {
if (entry.isDirectory())
- manifestPaths.push(join55(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
+ manifestPaths.push(join56(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
}
}
const paths = new Set;
@@ -93212,19 +93300,19 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
async function readManagedAgentPathsFromConfig(codexHome, configPath) {
if (!await exists6(configPath))
return [];
- const config = await readFile24(configPath, "utf8");
- return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join55(codexHome, "agents", `${agentName}.toml`));
+ const config = await readFile25(configPath, "utf8");
+ return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join56(codexHome, "agents", `${agentName}.toml`));
}
async function readInstalledAgentManifest(manifestPath) {
if (!await exists6(manifestPath))
return [];
- const parsed = JSON.parse(await readFile24(manifestPath, "utf8"));
+ const parsed = JSON.parse(await readFile25(manifestPath, "utf8"));
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.agents))
return [];
return parsed.agents.filter((path) => typeof path === "string");
}
async function removeManifestListedAgentLinks(codexHome, paths) {
- const agentsDir = join55(codexHome, "agents");
+ const agentsDir = join56(codexHome, "agents");
const removed = [];
const skipped = [];
for (const path of paths) {
@@ -93239,7 +93327,7 @@ async function removeManifestListedAgentLinks(codexHome, paths) {
skipped.push(path);
continue;
}
- await rm12(path, { force: true });
+ await rm13(path, { force: true });
removed.push(path);
}
return { removed, skipped };
@@ -93260,7 +93348,7 @@ async function exists6(path) {
}
async function maybeLstat2(path) {
try {
- return await lstat14(path);
+ return await lstat15(path);
} catch (error) {
if (nodeErrorCode6(error) === "ENOENT")
return null;
@@ -93276,14 +93364,14 @@ function nodeErrorCode6(error) {
import { execFile as execFile3 } from "node:child_process";
import { existsSync as existsSync30 } from "node:fs";
import { homedir as homedir11 } from "node:os";
-import { dirname as dirname24, join as join60, resolve as resolve19 } from "node:path";
+import { dirname as dirname24, join as join61, resolve as resolve19 } from "node:path";
import { fileURLToPath } from "node:url";
import { promisify as promisify2 } from "node:util";
// packages/omo-senpi/src/components/agent-home/resolve-agent-home.ts
import { existsSync as existsSync28 } from "node:fs";
import { homedir as homedir9 } from "node:os";
-import { join as join56, resolve as resolve16 } from "node:path";
+import { join as join57, resolve as resolve16 } from "node:path";
var AGENT_DIR_ENV_NAMES = [
"OMO_CODING_AGENT_DIR",
"SENPI_CODING_AGENT_DIR",
@@ -93297,25 +93385,25 @@ function resolveAgentHome(options) {
if (configured)
return resolve16(configured);
}
- const brandedHome = join56(homeDir, ".omo");
- const canonical = join56(brandedHome, "agent");
- if (exists(join56(canonical, AGENT_HOME_SENTINEL)))
+ const brandedHome = join57(homeDir, ".omo");
+ const canonical = join57(brandedHome, "agent");
+ if (exists(join57(canonical, AGENT_HOME_SENTINEL)))
return canonical;
- if (exists(join56(brandedHome, AGENT_HOME_SENTINEL)))
+ if (exists(join57(brandedHome, AGENT_HOME_SENTINEL)))
return brandedHome;
- return join56(homeDir, ".senpi", "agent");
+ return join57(homeDir, ".senpi", "agent");
}
// packages/omo-senpi/src/install/local-launcher.ts
import { chmodSync as chmodSync3, existsSync as existsSync29, mkdirSync as mkdirSync10, readFileSync as readFileSync13, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "node:fs";
import { homedir as homedir10 } from "node:os";
-import { dirname as dirname21, join as join57, resolve as resolve17 } from "node:path";
+import { dirname as dirname21, join as join58, resolve as resolve17 } from "node:path";
var MARKER = "omo-local-launcher";
function localLauncherPath(homeDir = homedir10()) {
- return join57(homeDir, ".local", "bin", "omo");
+ return join58(homeDir, ".local", "bin", "omo");
}
function localLauncherCmdPath(homeDir = homedir10()) {
- return join57(homeDir, ".local", "bin", "omo.cmd");
+ return join58(homeDir, ".local", "bin", "omo.cmd");
}
function renderLocalLauncher(options) {
const brand = {
@@ -93328,7 +93416,7 @@ function renderLocalLauncher(options) {
userAgent: "omo",
originator: "omo",
changelog: {
- path: join57(options.pluginPath, "CHANGELOG.md").replaceAll("\\", "/")
+ path: join58(options.pluginPath, "CHANGELOG.md").replaceAll("\\", "/")
},
update: {
packageName: "omo-ai",
@@ -93395,10 +93483,10 @@ node "%~dp0omo" %*\r
}
// packages/omo-senpi/src/install/plugin-artifacts.ts
-import { createHash as createHash5 } from "node:crypto";
+import { createHash as createHash6 } from "node:crypto";
import { constants as constants9 } from "node:fs";
-import { access as access2, readFile as readFile26, stat as stat6 } from "node:fs/promises";
-import { dirname as dirname23, join as join59 } from "node:path";
+import { access as access2, readFile as readFile27, stat as stat6 } from "node:fs/promises";
+import { dirname as dirname23, join as join60 } from "node:path";
// packages/memory-core/src/personas/manifest.ts
var PERSONA_ASSET_FILENAMES = {
@@ -93416,18 +93504,18 @@ var PERSONA_ASSET_FILES = [
// packages/omo-senpi/src/install/senpi-settings.ts
import { constants as constants8 } from "node:fs";
-import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile25, rename as rename5, writeFile as writeFile14 } from "node:fs/promises";
-import { basename as basename9, dirname as dirname22, join as join58, resolve as resolve18 } from "node:path";
+import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile26, rename as rename5, writeFile as writeFile14 } from "node:fs/promises";
+import { basename as basename9, dirname as dirname22, join as join59, resolve as resolve18 } from "node:path";
var OMO_SENPI_PACKAGE_NAME = "@code-yeongyu/omo-senpi";
var GENERATED_PLUGIN_BASENAME = /^omo-senpi-cli-plugin-[A-Za-z0-9]{6}$/;
var LEGACY_BUILTIN_SHADOW_PACKAGES = [
- join58("packages", "pi-goal"),
- join58("packages", "pi-webfetch")
+ join59("packages", "pi-goal"),
+ join59("packages", "pi-webfetch")
];
async function readSettings(settingsPath) {
let raw;
try {
- raw = await readFile25(settingsPath, "utf8");
+ raw = await readFile26(settingsPath, "utf8");
} catch (error) {
if (isErrno(error, "ENOENT"))
return {};
@@ -93501,7 +93589,7 @@ function isRecord13(value) {
async function readPackageName(packagePath) {
let raw;
try {
- raw = await readFile25(join58(packagePath, "package.json"), "utf8");
+ raw = await readFile26(join59(packagePath, "package.json"), "utf8");
} catch (error) {
if (isErrno(error, "ENOENT") || isErrno(error, "ENOTDIR"))
return;
@@ -93533,50 +93621,50 @@ function isErrno(error, code) {
// packages/omo-senpi/src/install/plugin-artifacts.ts
var REQUIRED_PLUGIN_ARTIFACTS = [
- join59("extensions", "omo.js"),
- join59("extensions", "omo-task.js"),
- join59("extensions", "omo-member.js"),
- join59("extensions", "omo-agent-toolkit.js"),
- join59("extensions", "memory-run-supervisor.mjs"),
- ...PERSONA_ASSET_FILES.map((filename) => join59("extensions", filename)),
- join59("skills", "ast-grep", "SKILL.md"),
- join59("skills", "coding-agent-sessions", "SKILL.md"),
- join59("skills", "debugging", "SKILL.md"),
- join59("skills", "frontend", "SKILL.md"),
- join59("skills", "git-master", "SKILL.md"),
- join59("skills", "init-deep", "SKILL.md"),
- join59("skills", "lsp-setup", "SKILL.md"),
- join59("skills", "programming", "SKILL.md"),
- join59("skills", "refactor", "SKILL.md"),
- join59("skills", "remove-ai-slops", "SKILL.md"),
- join59("skills", "review-work", "SKILL.md"),
- join59("skills", "ultimate-browsing", "SKILL.md"),
- join59("skills", "ultrawork", "SKILL.md"),
- join59("skills", "ulw-execute", "SKILL.md"),
- join59("skills", "ulw-loop", "SKILL.md"),
- join59("skills", "ulw-plan", "SKILL.md"),
- join59("skills", "ulw-research", "SKILL.md"),
- join59("skills", "visual-qa", "SKILL.md"),
- join59("skills-conditional", "x-search", "SKILL.md"),
- join59("runtime", "ast-grep-mcp", "cli.js"),
- join59("runtime", "lsp-daemon", "dist", "cli.js"),
- join59("runtime", "lsp-daemon", "dist", "index.js"),
- join59("runtime", "lsp-daemon", "dist", "index.d.ts"),
- join59("runtime", "lsp-daemon", "dist", "daemon-client.js"),
- join59("runtime", "lsp-daemon", "dist", "daemon-client.d.ts"),
- join59("runtime", "lsp-daemon", "dist", "package.json"),
- join59("runtime", "lsp-daemon", "dist", ".omo-runtime-manifest.json"),
- join59("scripts", "install.mjs")
+ join60("extensions", "omo.js"),
+ join60("extensions", "omo-task.js"),
+ join60("extensions", "omo-member.js"),
+ join60("extensions", "omo-agent-toolkit.js"),
+ join60("extensions", "memory-run-supervisor.mjs"),
+ ...PERSONA_ASSET_FILES.map((filename) => join60("extensions", filename)),
+ join60("skills", "ast-grep", "SKILL.md"),
+ join60("skills", "coding-agent-sessions", "SKILL.md"),
+ join60("skills", "debugging", "SKILL.md"),
+ join60("skills", "frontend", "SKILL.md"),
+ join60("skills", "git-master", "SKILL.md"),
+ join60("skills", "init-deep", "SKILL.md"),
+ join60("skills", "lsp-setup", "SKILL.md"),
+ join60("skills", "programming", "SKILL.md"),
+ join60("skills", "refactor", "SKILL.md"),
+ join60("skills", "remove-ai-slops", "SKILL.md"),
+ join60("skills", "review-work", "SKILL.md"),
+ join60("skills", "ultimate-browsing", "SKILL.md"),
+ join60("skills", "ultrawork", "SKILL.md"),
+ join60("skills", "ulw-execute", "SKILL.md"),
+ join60("skills", "ulw-loop", "SKILL.md"),
+ join60("skills", "ulw-plan", "SKILL.md"),
+ join60("skills", "ulw-research", "SKILL.md"),
+ join60("skills", "visual-qa", "SKILL.md"),
+ join60("skills-conditional", "x-search", "SKILL.md"),
+ join60("runtime", "ast-grep-mcp", "cli.js"),
+ join60("runtime", "lsp-daemon", "dist", "cli.js"),
+ join60("runtime", "lsp-daemon", "dist", "index.js"),
+ join60("runtime", "lsp-daemon", "dist", "index.d.ts"),
+ join60("runtime", "lsp-daemon", "dist", "daemon-client.js"),
+ join60("runtime", "lsp-daemon", "dist", "daemon-client.d.ts"),
+ join60("runtime", "lsp-daemon", "dist", "package.json"),
+ join60("runtime", "lsp-daemon", "dist", ".omo-runtime-manifest.json"),
+ join60("scripts", "install.mjs")
];
async function ensurePluginArtifacts(context) {
if (context.allowBuild) {
- await context.runCommand("node", [join59(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
- await context.runCommand("node", [join59("packages", "omo-codex", "plugin", "scripts", "materialize-shared-upstreams.mjs")], { cwd: context.repoRoot });
- await context.runCommand("node", [join59(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
- await context.runCommand("node", [join59(context.pluginPath, "scripts", "build-install.mjs")], { cwd: context.repoRoot });
- await context.runCommand("node", [join59(context.pluginPath, "scripts", "stage-lsp-daemon-runtime.mjs")], { cwd: context.repoRoot });
- await context.runCommand("node", [join59(context.pluginPath, "scripts", "stage-ast-grep-mcp-runtime.mjs")], { cwd: context.repoRoot });
- await context.runCommand("node", [join59(context.pluginPath, "scripts", "stage-x-search-skill.mjs")], { cwd: context.repoRoot });
+ await context.runCommand("node", [join60(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
+ await context.runCommand("node", [join60("packages", "omo-codex", "plugin", "scripts", "materialize-shared-upstreams.mjs")], { cwd: context.repoRoot });
+ await context.runCommand("node", [join60(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
+ await context.runCommand("node", [join60(context.pluginPath, "scripts", "build-install.mjs")], { cwd: context.repoRoot });
+ await context.runCommand("node", [join60(context.pluginPath, "scripts", "stage-lsp-daemon-runtime.mjs")], { cwd: context.repoRoot });
+ await context.runCommand("node", [join60(context.pluginPath, "scripts", "stage-ast-grep-mcp-runtime.mjs")], { cwd: context.repoRoot });
+ await context.runCommand("node", [join60(context.pluginPath, "scripts", "stage-x-search-skill.mjs")], { cwd: context.repoRoot });
}
if (await hasMissingPluginArtifact(context.pluginPath)) {
throw new Error(`Packed omo-senpi plugin is missing required runtime artifacts at ${context.pluginPath}`);
@@ -93585,14 +93673,14 @@ async function ensurePluginArtifacts(context) {
}
async function hasMissingPluginArtifact(pluginPath) {
for (const artifact of REQUIRED_PLUGIN_ARTIFACTS) {
- if (!await fileExists2(join59(pluginPath, artifact)))
+ if (!await fileExists2(join60(pluginPath, artifact)))
return true;
}
return false;
}
async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
- const runtimeEntry = join59(pluginPath, "runtime", "ast-grep-mcp", "cli.js");
- const manifestPath = join59(dirname23(runtimeEntry), "manifest.json");
+ const runtimeEntry = join60(pluginPath, "runtime", "ast-grep-mcp", "cli.js");
+ const manifestPath = join60(dirname23(runtimeEntry), "manifest.json");
let runtimeStat;
try {
runtimeStat = await stat6(runtimeEntry);
@@ -93607,7 +93695,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
}
let manifest;
try {
- manifest = JSON.parse(await readFile26(manifestPath, "utf8"));
+ manifest = JSON.parse(await readFile27(manifestPath, "utf8"));
} catch (error) {
throw astGrepIntegrityError(runtimeEntry, `manifest is unreadable or invalid JSON: ${messageOf(error)}`);
}
@@ -93616,7 +93704,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
}
let actualSha256;
try {
- actualSha256 = createHash5("sha256").update(await readFile26(runtimeEntry)).digest("hex");
+ actualSha256 = createHash6("sha256").update(await readFile27(runtimeEntry)).digest("hex");
} catch (error) {
throw astGrepIntegrityError(runtimeEntry, `runtime hash could not be computed: ${messageOf(error)}`);
}
@@ -93667,7 +93755,7 @@ async function runSenpiInstaller(options = {}) {
const backupPath = await writeSettingsAtomically(context.settingsPath, settings);
const launcherPath = installLocalLauncher({
pluginPath: context.pluginPath,
- senpiCliPath: join60(context.repoRoot, "packages", "coding-agent", "dist", "cli.js"),
+ senpiCliPath: join61(context.repoRoot, "packages", "coding-agent", "dist", "cli.js"),
homeDir: context.homeDir
});
return {
@@ -93687,13 +93775,13 @@ function resolveInstallContext(options) {
const repoRoot = resolve19(options.repoRoot ?? (allowBuild ? findRepoRoot2(dirname24(fileURLToPath(import.meta.url))) : dirname24(resolve19(options.pluginPath))));
const homeDir = options.homeDir ?? env.HOME ?? homedir11();
const agentDir = resolve19(options.agentDir ?? resolveAgentHome({ env, homeDir }));
- const pluginPath = resolve19(options.pluginPath ?? join60(repoRoot, "packages", "omo-senpi", "plugin"));
+ const pluginPath = resolve19(options.pluginPath ?? join61(repoRoot, "packages", "omo-senpi", "plugin"));
return {
env,
repoRoot,
agentDir,
homeDir,
- settingsPath: join60(agentDir, "settings.json"),
+ settingsPath: join61(agentDir, "settings.json"),
pluginPath,
platform: options.platform ?? process.platform,
allowBuild,
@@ -93710,7 +93798,7 @@ async function defaultRunCommand3(command, args, options) {
function findRepoRoot2(importerDir) {
let current = importerDir;
for (let depth = 0;depth <= 7; depth += 1) {
- if (fileExistsSync(join60(current, "packages", "omo-senpi", "plugin", "package.json")))
+ if (fileExistsSync(join61(current, "packages", "omo-senpi", "plugin", "package.json")))
return current;
current = resolve19(current, "..");
}
@@ -93754,19 +93842,19 @@ init_provider_availability();
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
import { existsSync as existsSync32, mkdirSync as mkdirSync11, readFileSync as readFileSync15 } from "node:fs";
-import { join as join62 } from "node:path";
+import { join as join63 } from "node:path";
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
init_shared();
import { existsSync as existsSync31, readFileSync as readFileSync14 } from "node:fs";
-import { join as join61 } from "node:path";
+import { join as join62 } from "node:path";
var TUI_SUBPATH = "tui";
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
function fileEntryPackageJsonPath(entry) {
let path = entry.slice("file:".length);
if (path.startsWith("//"))
path = path.slice(2);
- return join61(path, "package.json");
+ return join62(path, "package.json");
}
function packageJsonExportsTui(pkgJsonPath) {
if (!existsSync31(pkgJsonPath))
@@ -93804,7 +93892,7 @@ function packageExportsTuiForServerEntry(entry) {
const packageName = packageNameFromServerEntry(entry);
if (packageName === null)
return null;
- return packageJsonExportsTui(join61(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
+ return packageJsonExportsTui(join62(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
}
function isOurFilePluginEntry(entry) {
if (typeof entry !== "string" || !entry.startsWith("file:"))
@@ -93869,7 +93957,7 @@ function detectServerPluginRegistration() {
}
}
function detectTuiPluginRegistration() {
- const tuiJsonPath = join61(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
+ const tuiJsonPath = join62(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
if (!existsSync31(tuiJsonPath)) {
return {
registered: false,
@@ -94025,10 +94113,10 @@ function readConfig(path) {
return null;
}
function readServerConfig(configDir) {
- const jsoncPath = join62(configDir, "opencode.jsonc");
+ const jsoncPath = join63(configDir, "opencode.jsonc");
if (existsSync32(jsoncPath))
return readConfig(jsoncPath);
- const jsonPath = join62(configDir, "opencode.json");
+ const jsonPath = join63(configDir, "opencode.json");
if (existsSync32(jsonPath))
return readConfig(jsonPath);
return null;
@@ -94070,7 +94158,7 @@ function ensureTuiPluginEntry(opts = {}) {
if (!desiredEntry) {
return { changed: false, reason: "no-server-entry" };
}
- const tuiJsonPath = join62(configDir, "tui.json");
+ const tuiJsonPath = join63(configDir, "tui.json");
const { config, malformed } = readTuiConfig(tuiJsonPath);
if (malformed) {
return { changed: false, reason: "malformed" };
@@ -94086,7 +94174,7 @@ function ensureTuiPluginEntry(opts = {}) {
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
import { homedir as homedir12 } from "node:os";
-import { join as join63 } from "node:path";
+import { join as join64 } from "node:path";
// packages/shared-skills/index.mjs
import { existsSync as existsSync33 } from "node:fs";
@@ -94108,9 +94196,9 @@ function describeResult2(result) {
}
async function installAstGrepForOpenCode(options = {}) {
const platform = options.platform ?? process.platform;
- const baseDir = join63(options.homeDir ?? homedir12(), ".omo");
+ const baseDir = join64(options.homeDir ?? homedir12(), ".omo");
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
- const skillDir = join63(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
+ const skillDir = join64(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
const installer = options.installer ?? runAstGrepSkillInstall;
try {
const result = await installer({ platform, skillDir, targetDir });
@@ -98331,9 +98419,9 @@ function readCurrentTopLevelTask(planPath) {
}
// packages/boulder-state/src/storage/path.ts
import { existsSync as existsSync35 } from "node:fs";
-import { isAbsolute as isAbsolute12, join as join64, relative as relative8, resolve as resolve20 } from "node:path";
+import { isAbsolute as isAbsolute12, join as join65, relative as relative8, resolve as resolve20 } from "node:path";
function getBoulderFilePath(directory) {
- return join64(directory, BOULDER_DIR, BOULDER_FILE);
+ return join65(directory, BOULDER_DIR, BOULDER_FILE);
}
function resolveTrackedPath(baseDirectory, trackedPath) {
return isAbsolute12(trackedPath) ? resolve20(trackedPath) : resolve20(baseDirectory, trackedPath);
@@ -98516,9 +98604,9 @@ init_state();
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
import { existsSync as existsSync38, mkdirSync as mkdirSync12, readFileSync as readFileSync19, rmSync as rmSync3, writeFileSync as writeFileSync7 } from "node:fs";
-import { join as join65 } from "node:path";
+import { join as join66 } from "node:path";
function getMarkerPath(directory, sessionID) {
- return join65(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
+ return join66(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
}
function readContinuationMarker(directory, sessionID) {
const markerPath = getMarkerPath(directory, sessionID);
@@ -98591,7 +98679,7 @@ async function isSessionInBoulderLineage(input) {
init_shared();
init_compaction_marker();
import { readFileSync as readFileSync20, readdirSync as readdirSync8 } from "node:fs";
-import { join as join66 } from "node:path";
+import { join as join67 } from "node:path";
var defaultSessionLastAgentDeps = {
getMessageDir,
isSqliteBackend,
@@ -98651,7 +98739,7 @@ async function getLastAgentFromSession(sessionID, client, deps = {}) {
try {
const messages = readdirSync8(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
try {
- const content = readFileSync20(join66(messageDir, fileName), "utf-8");
+ const content = readFileSync20(join67(messageDir, fileName), "utf-8");
const parsed = JSON.parse(content);
return {
fileName,
@@ -98695,7 +98783,7 @@ init_agent_display_names();
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
init_frontmatter2();
import { existsSync as existsSync39, readFileSync as readFileSync21, writeFileSync as writeFileSync8, unlinkSync as unlinkSync6, mkdirSync as mkdirSync13 } from "node:fs";
-import { dirname as dirname26, join as join67 } from "node:path";
+import { dirname as dirname26, join as join68 } from "node:path";
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
@@ -98704,7 +98792,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
function getStateFilePath(directory, customPath) {
- return customPath ? join67(directory, customPath) : join67(directory, DEFAULT_STATE_FILE);
+ return customPath ? join68(directory, customPath) : join68(directory, DEFAULT_STATE_FILE);
}
function readState(directory, customPath) {
const filePath = getStateFilePath(directory, customPath);
@@ -99811,7 +99899,7 @@ init_extract_semver();
init_bun_which_shim();
import { existsSync as existsSync47, accessSync as accessSync4, constants as constants12 } from "node:fs";
import { homedir as homedir15 } from "node:os";
-import { join as join74 } from "node:path";
+import { join as join75 } from "node:path";
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
init_spawn_with_windows_hide();
@@ -99903,17 +99991,17 @@ function getDesktopAppPaths(platform) {
case "darwin":
return [
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
- join74(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
+ join75(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
];
case "win32": {
const programFiles = process.env.ProgramFiles;
const localAppData = process.env.LOCALAPPDATA;
const paths = [];
if (programFiles) {
- paths.push(join74(programFiles, "OpenCode", "OpenCode.exe"));
+ paths.push(join75(programFiles, "OpenCode", "OpenCode.exe"));
}
if (localAppData) {
- paths.push(join74(localAppData, "OpenCode", "OpenCode.exe"));
+ paths.push(join75(localAppData, "OpenCode", "OpenCode.exe"));
}
return paths;
}
@@ -99921,8 +100009,8 @@ function getDesktopAppPaths(platform) {
return [
"/usr/bin/opencode",
"/usr/lib/opencode/opencode",
- join74(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
- join74(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
+ join75(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
+ join75(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
];
default:
return [];
@@ -99954,7 +100042,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
const candidates = getCommandCandidates2(platform);
for (const entry of pathEnv.split(delimiter).filter(Boolean)) {
for (const command of candidates) {
- const fullPath = join74(entry, command);
+ const fullPath = join75(entry, command);
if (checkExists(fullPath) && isExecutable2(fullPath)) {
return { binary: command, path: fullPath };
}
@@ -100098,22 +100186,22 @@ init_package_json_locator();
import { existsSync as existsSync49, readFileSync as readFileSync30, readdirSync as readdirSync10 } from "node:fs";
import { createRequire as createRequire2 } from "node:module";
import { homedir as homedir16 } from "node:os";
-import { join as join75 } from "node:path";
+import { join as join76 } from "node:path";
import { fileURLToPath as fileURLToPath6 } from "node:url";
init_shared();
function getPlatformDefaultCacheDir(platform = process.platform) {
if (platform === "darwin")
- return join75(homedir16(), "Library", "Caches");
+ return join76(homedir16(), "Library", "Caches");
if (platform === "win32")
- return process.env.LOCALAPPDATA ?? join75(homedir16(), "AppData", "Local");
- return join75(homedir16(), ".cache");
+ return process.env.LOCALAPPDATA ?? join76(homedir16(), "AppData", "Local");
+ return join76(homedir16(), ".cache");
}
function resolveOpenCodeCacheDir() {
const xdgCacheHome = process.env.XDG_CACHE_HOME;
if (xdgCacheHome)
- return join75(xdgCacheHome, "opencode");
+ return join76(xdgCacheHome, "opencode");
const fromShared = getOpenCodeCacheDir();
- const platformDefault = join75(getPlatformDefaultCacheDir(), "opencode");
+ const platformDefault = join76(getPlatformDefaultCacheDir(), "opencode");
if (existsSync49(fromShared) || !existsSync49(platformDefault))
return fromShared;
return platformDefault;
@@ -100145,11 +100233,11 @@ function normalizeVersion(value) {
function createPackageCandidates(rootDir) {
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
packageName,
- installedPackagePath: join75(rootDir, "node_modules", packageName, "package.json")
+ installedPackagePath: join76(rootDir, "node_modules", packageName, "package.json")
}));
}
function createTaggedInstallCandidates(rootDir) {
- const packagesDir = join75(rootDir, "packages");
+ const packagesDir = join76(rootDir, "packages");
if (!existsSync49(packagesDir))
return [];
const candidates = [];
@@ -100157,14 +100245,14 @@ function createTaggedInstallCandidates(rootDir) {
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
if (packageName === undefined)
continue;
- const installDir = join75(packagesDir, entryName);
+ const installDir = join76(packagesDir, entryName);
candidates.push({
cacheDir: installDir,
- cachePackagePath: join75(installDir, "package.json"),
+ cachePackagePath: join76(installDir, "package.json"),
packageCandidates: [
{
packageName,
- installedPackagePath: join75(installDir, "node_modules", packageName, "package.json")
+ installedPackagePath: join76(installDir, "node_modules", packageName, "package.json")
}
]
});
@@ -100209,13 +100297,13 @@ function getLoadedPluginVersion() {
const candidates = [
{
cacheDir: configDir,
- cachePackagePath: join75(configDir, "package.json"),
+ cachePackagePath: join76(configDir, "package.json"),
packageCandidates: createPackageCandidates(configDir)
},
...createTaggedInstallCandidates(configDir),
{
cacheDir,
- cachePackagePath: join75(cacheDir, "package.json"),
+ cachePackagePath: join76(cacheDir, "package.json"),
packageCandidates: createPackageCandidates(cacheDir)
},
...createTaggedInstallCandidates(cacheDir)
@@ -100409,18 +100497,18 @@ async function checkSystem(deps = defaultDeps5) {
init_shared();
import { existsSync as existsSync51, readFileSync as readFileSync32 } from "node:fs";
import { homedir as homedir17 } from "node:os";
-import { join as join76 } from "node:path";
+import { join as join77 } from "node:path";
function getUserConfigDir2() {
const xdgConfig = process.env.XDG_CONFIG_HOME;
if (xdgConfig)
- return join76(xdgConfig, "opencode");
- return join76(homedir17(), ".config", "opencode");
+ return join77(xdgConfig, "opencode");
+ return join77(homedir17(), ".config", "opencode");
}
function loadCustomProviderNames() {
const configDir = getUserConfigDir2();
const candidatePaths = [
- join76(configDir, "opencode.json"),
- join76(configDir, "opencode.jsonc")
+ join77(configDir, "opencode.json"),
+ join77(configDir, "opencode.jsonc")
];
for (const configPath of candidatePaths) {
if (!existsSync51(configPath))
@@ -100441,7 +100529,7 @@ function loadCustomProviderNames() {
return [];
}
function loadAvailableModelsFromCache() {
- const cacheFile = join76(getOpenCodeCacheDir(), "models.json");
+ const cacheFile = join77(getOpenCodeCacheDir(), "models.json");
const customProviders = loadCustomProviderNames();
if (!existsSync51(cacheFile)) {
if (customProviders.length > 0) {
@@ -100503,7 +100591,7 @@ function loadOmoConfig2() {
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
init_shared();
-import { join as join77 } from "node:path";
+import { join as join78 } from "node:path";
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
function formatModelWithVariant(model, variant) {
@@ -100545,7 +100633,7 @@ function formatCapabilityResolutionLabel(mode) {
}
function buildModelResolutionDetails(options) {
const details = [];
- const cacheFile = join77(getOpenCodeCacheDir(), "models.json");
+ const cacheFile = join78(getOpenCodeCacheDir(), "models.json");
details.push("═══ Available Models (from cache) ═══");
details.push("");
if (options.available.cacheExists) {
@@ -100857,7 +100945,7 @@ init_src4();
init_main();
init_config_migration();
import { existsSync as existsSync52, readFileSync as readFileSync33 } from "node:fs";
-import { join as join78 } from "node:path";
+import { join as join79 } from "node:path";
var CANONICAL_REPLACEMENT = new Map([
["variant", "reasoning"],
["reasoningEffort", "reasoning"],
@@ -100918,7 +101006,7 @@ function userConfigPaths() {
const home = process.env.HOME ?? process.env.USERPROFILE;
if (home === undefined || home.length === 0)
return [];
- return [join78(home, ".omo", "omo.jsonc"), join78(home, ".omo", "omo.json")];
+ return [join79(home, ".omo", "omo.jsonc"), join79(home, ".omo", "omo.json")];
}
async function checkDeprecatedReasoningKeys() {
const issues = [];
@@ -100944,25 +101032,25 @@ init_src();
import { existsSync as existsSync53 } from "node:fs";
import { createRequire as createRequire3 } from "node:module";
import { homedir as homedir19 } from "node:os";
-import { dirname as dirname31, join as join80 } from "node:path";
+import { dirname as dirname31, join as join81 } from "node:path";
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
-import { join as join79 } from "path";
+import { join as join80 } from "path";
import { homedir as homedir18, tmpdir as tmpdir4 } from "os";
init_binary_downloader();
init_logger2();
init_plugin_identity();
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
-var DEBUG_FILE = join79(tmpdir4(), "comment-checker-debug.log");
+var DEBUG_FILE = join80(tmpdir4(), "comment-checker-debug.log");
function getCacheDir2() {
if (process.platform === "win32") {
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
- const base = localAppData || join79(homedir18(), "AppData", "Local");
- return join79(base, CACHE_DIR_NAME, "bin");
+ const base = localAppData || join80(homedir18(), "AppData", "Local");
+ return join80(base, CACHE_DIR_NAME, "bin");
}
const xdgCache = process.env.XDG_CACHE_HOME;
- const base = xdgCache || join79(homedir18(), ".cache");
- return join79(base, CACHE_DIR_NAME, "bin");
+ const base = xdgCache || join80(homedir18(), ".cache");
+ return join80(base, CACHE_DIR_NAME, "bin");
}
function getBinaryName() {
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
@@ -101012,7 +101100,7 @@ async function getBinaryVersion(binary) {
}
}
async function checkAstGrepCli() {
- const runtimeDir = astGrepRuntimeDir(join80(homedir19(), ".omo"));
+ const runtimeDir = astGrepRuntimeDir(join81(homedir19(), ".omo"));
const sgPath = findSgBinarySync({ runtimeDir });
if (sgPath === null) {
return {
@@ -101042,10 +101130,10 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
try {
const packageDir = baseDirOverride ?? dirname31(resolvePackageJsonPath());
- const vendorPath = join80(packageDir, "vendor", platformKey, binaryName);
+ const vendorPath = join81(packageDir, "vendor", platformKey, binaryName);
if (existsSync53(vendorPath))
return vendorPath;
- const binPath = join80(packageDir, "bin", binaryName);
+ const binPath = join81(packageDir, "bin", binaryName);
if (existsSync53(binPath))
return binPath;
} catch (error) {
@@ -101421,13 +101509,13 @@ function getInstalledLspServers(options = {}) {
init_shared();
import { existsSync as existsSync55, readFileSync as readFileSync35 } from "node:fs";
import { homedir as homedir20 } from "node:os";
-import { join as join81 } from "node:path";
+import { join as join82 } from "node:path";
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
function getMcpConfigPaths() {
return [
- join81(homedir20(), ".claude", ".mcp.json"),
- join81(process.cwd(), ".mcp.json"),
- join81(process.cwd(), ".claude", ".mcp.json")
+ join82(homedir20(), ".claude", ".mcp.json"),
+ join82(process.cwd(), ".mcp.json"),
+ join82(process.cwd(), ".claude", ".mcp.json")
];
}
function loadUserMcpConfig() {
@@ -101707,9 +101795,9 @@ async function pathExists(dir) {
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
init_src();
import { existsSync as existsSync57 } from "node:fs";
-import { lstat as lstat15, readdir as readdir14, readFile as readFile27 } from "node:fs/promises";
+import { lstat as lstat16, readdir as readdir14, readFile as readFile28 } from "node:fs/promises";
import { homedir as homedir22 } from "node:os";
-import { basename as basename11, join as join82, resolve as resolve23 } from "node:path";
+import { basename as basename11, join as join83, resolve as resolve23 } from "node:path";
// packages/omo-opencode/package.json
var package_default3 = {
name: "@oh-my-opencode/omo-opencode",
@@ -101775,13 +101863,13 @@ var CODEX_BIN_NAMES = [
"omo-git-bash-hook"
];
async function gatherCodexSummary(deps = {}) {
- const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ?? join82(homedir22(), ".codex"));
+ const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ?? join83(homedir22(), ".codex"));
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
- const manifest = pluginRoot === null ? null : await readJson(join82(pluginRoot, ".codex-plugin", "plugin.json"));
- const installSnapshot = pluginRoot === null ? null : await readJson(join82(pluginRoot, "lazycodex-install.json"));
- const configPath = join82(codexHome, "config.toml");
+ const manifest = pluginRoot === null ? null : await readJson(join83(pluginRoot, ".codex-plugin", "plugin.json"));
+ const installSnapshot = pluginRoot === null ? null : await readJson(join83(pluginRoot, "lazycodex-install.json"));
+ const configPath = join83(codexHome, "config.toml");
const pluginVersion = stringField(manifest, "version");
return {
codexPath: detection.found && "path" in detection ? detection.path : null,
@@ -101838,7 +101926,7 @@ function buildCodexIssues(summary) {
if (summary.pluginRoot === null) {
issues.push({
title: "OMO Codex plugin is not installed",
- description: `Expected cached plugin at ${join82("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
+ description: `Expected cached plugin at ${join83("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
fix: "Run: npx lazycodex-ai install",
severity: "error",
affects: ["plugin loading"]
@@ -101903,12 +101991,12 @@ function buildCodexIssues(summary) {
return issues;
}
async function resolveInstalledPluginRoot(codexHome) {
- const pluginRoot = join82(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
+ const pluginRoot = join83(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
if (!existsSync57(pluginRoot))
return null;
const versions = await readdir14(pluginRoot, { withFileTypes: true });
const candidates = versions.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
- return candidates.length === 0 ? null : join82(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
+ return candidates.length === 0 ? null : join83(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
}
async function readCodexConfigSummary(configPath) {
if (!existsSync57(configPath)) {
@@ -101922,7 +102010,7 @@ async function readCodexConfigSummary(configPath) {
companionLifecycleHookStateEvents: []
};
}
- const content = await readFile27(configPath, "utf8");
+ const content = await readFile28(configPath, "utf8");
return {
exists: true,
marketplaceConfigured: content.includes("[marketplaces.sisyphuslabs]"),
@@ -101936,13 +102024,13 @@ async function readCodexConfigSummary(configPath) {
async function readLinkedBins(binDir) {
const linked = [];
for (const name of CODEX_BIN_NAMES) {
- if (await pathExists2(join82(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
+ if (await pathExists2(join83(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
linked.push(name);
}
return linked;
}
async function readLinkedAgents(codexHome) {
- const agentsDir = join82(codexHome, "agents");
+ const agentsDir = join83(codexHome, "agents");
if (!existsSync57(agentsDir))
return [];
const entries = await readdir14(agentsDir, { withFileTypes: true });
@@ -101950,7 +102038,7 @@ async function readLinkedAgents(codexHome) {
}
async function readJson(path) {
try {
- const parsed = JSON.parse(await readFile27(path, "utf8"));
+ const parsed = JSON.parse(await readFile28(path, "utf8"));
return isPlainRecord(parsed) ? parsed : null;
} catch (error) {
if (error instanceof Error)
@@ -102045,7 +102133,7 @@ function compareVersionsDescending(left, right) {
}
async function pathExists2(path) {
try {
- await lstat15(path);
+ await lstat16(path);
return true;
} catch (error) {
if (error instanceof Error)
@@ -102074,9 +102162,9 @@ function resolveLatestVersion(input) {
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
init_src();
-import { readdir as readdir15, readFile as readFile28, stat as stat7 } from "node:fs/promises";
+import { readdir as readdir15, readFile as readFile29, stat as stat7 } from "node:fs/promises";
import { homedir as homedir23 } from "node:os";
-import { dirname as dirname33, isAbsolute as isAbsolute13, join as join83, relative as relative9, resolve as resolve24, sep as sep9 } from "node:path";
+import { dirname as dirname33, isAbsolute as isAbsolute13, join as join84, relative as relative9, resolve as resolve24, sep as sep9 } from "node:path";
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
@@ -102086,7 +102174,7 @@ async function checkCodexComponents(deps = {}) {
const env = deps.env ?? process.env;
const platform = deps.platform ?? process.platform;
const arch = deps.arch ?? process.arch;
- const codexHome = resolve24(deps.codexHome ?? env["CODEX_HOME"] ?? join83(homedir23(), ".codex"));
+ const codexHome = resolve24(deps.codexHome ?? env["CODEX_HOME"] ?? join84(homedir23(), ".codex"));
const summary = await gatherCodexSummary({ ...deps, codexHome });
if (summary.pluginRoot === null) {
return {
@@ -102111,7 +102199,7 @@ async function checkCodexComponents(deps = {}) {
});
}
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
- const runtimeSgPath = join83(runtimeSgDir, sgBinaryName(platform));
+ const runtimeSgPath = join84(runtimeSgDir, sgBinaryName(platform));
const sg = findSgBinarySync({
arch,
env,
@@ -102223,7 +102311,7 @@ async function findManifestPaths(root, manifestName) {
for (const entry of entries) {
if (entry.name === "node_modules" || entry.name === ".git")
continue;
- const entryPath = join83(root, entry.name);
+ const entryPath = join84(root, entry.name);
if (entry.isDirectory()) {
paths.push(...await findManifestPaths(entryPath, manifestName));
continue;
@@ -102267,18 +102355,18 @@ function isPluginRuntimePathArg(arg) {
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute13(arg));
}
function runtimeSgDirectory(codexHome, platform, arch) {
- return join83(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
+ return join84(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
}
function describeSgSource(sgPath, env, runtimeSgDir, platform) {
const override = env[SG_PATH_ENV_KEY]?.trim();
if (override !== undefined && override.length > 0 && sgPath === override)
return `env override ${SG_PATH_ENV_KEY}`;
- if (sgPath === join83(runtimeSgDir, sgBinaryName(platform)))
+ if (sgPath === join84(runtimeSgDir, sgBinaryName(platform)))
return "runtime dir";
return "PATH";
}
async function readBootstrapStateSummary(codexHome) {
- const statePath = join83(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
+ const statePath = join84(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
const raw = await readJson2(statePath);
if (raw === null)
return null;
@@ -102327,7 +102415,7 @@ function degradedDetailLines(entries) {
}
async function readJson2(path) {
try {
- const parsed = JSON.parse(await readFile28(path, "utf8"));
+ const parsed = JSON.parse(await readFile29(path, "utf8"));
return isRecord15(parsed) ? parsed : null;
} catch (error) {
if (error instanceof Error)
@@ -102355,18 +102443,18 @@ function isRecord15(value) {
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
import { existsSync as existsSync58 } from "node:fs";
-import { readFile as readFile29 } from "node:fs/promises";
+import { readFile as readFile30 } from "node:fs/promises";
import { homedir as homedir24 } from "node:os";
-import { join as join84, resolve as resolve25 } from "node:path";
+import { join as join85, resolve as resolve25 } from "node:path";
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
var CHECK_NAME = "codex-runtime-wrapper";
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
async function checkCodexRuntimeWrapper(deps = {}) {
- const codexHome = resolve25(deps.codexHome ?? process.env.CODEX_HOME ?? join84(homedir24(), ".codex"));
+ const codexHome = resolve25(deps.codexHome ?? process.env.CODEX_HOME ?? join85(homedir24(), ".codex"));
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
const platform = deps.platform ?? process.platform;
- const wrapperPath = join84(binDir, platform === "win32" ? "omo-agent-toolkit.cmd" : "omo-agent-toolkit");
- const legacyWrapperPath = join84(binDir, platform === "win32" ? "omo.cmd" : "omo");
+ const wrapperPath = join85(binDir, platform === "win32" ? "omo-agent-toolkit.cmd" : "omo-agent-toolkit");
+ const legacyWrapperPath = join85(binDir, platform === "win32" ? "omo.cmd" : "omo");
const [wrapper, legacyWrapper] = await Promise.all([readRuntimeWrapper(wrapperPath), readRuntimeWrapper(legacyWrapperPath)]);
const issues = [];
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
@@ -102400,7 +102488,7 @@ async function checkCodexRuntimeWrapper(deps = {}) {
}
async function readRuntimeWrapper(path) {
try {
- return await readFile29(path, "utf8");
+ return await readFile30(path, "utf8");
} catch (error) {
if (error instanceof Error)
return null;
@@ -102890,7 +102978,7 @@ Doctor failed unexpectedly: ${message}`];
}
// packages/mcp-client-core/src/mcp-oauth/storage.ts
-import { createHash as createHash6 } from "node:crypto";
+import { createHash as createHash7 } from "node:crypto";
import {
chmodSync as chmodSync5,
existsSync as existsSync61,
@@ -102901,12 +102989,12 @@ import {
unlinkSync as unlinkSync9,
writeFileSync as writeFileSync12
} from "node:fs";
-import { basename as basename12, dirname as dirname34, join as join87 } from "node:path";
+import { basename as basename12, dirname as dirname34, join as join88 } from "node:path";
// packages/mcp-client-core/src/config-dir.ts
import { existsSync as existsSync59, realpathSync as realpathSync8 } from "node:fs";
import { homedir as homedir25 } from "node:os";
-import { join as join85, resolve as resolve26 } from "node:path";
+import { join as join86, resolve as resolve26 } from "node:path";
function resolveConfigPath2(pathValue) {
const resolvedPath = resolve26(pathValue);
if (!existsSync59(resolvedPath))
@@ -102924,13 +103012,13 @@ function getOpenCodeCliConfigDir(env = process.env) {
if (customConfigDir) {
return resolveConfigPath2(customConfigDir);
}
- const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() || join85(homedir25(), ".config");
- return resolveConfigPath2(join85(xdgConfigDir, "opencode"));
+ const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() || join86(homedir25(), ".config");
+ return resolveConfigPath2(join86(xdgConfigDir, "opencode"));
}
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
import { chmodSync as chmodSync4, existsSync as existsSync60, readFileSync as readFileSync37, renameSync as renameSync6, writeFileSync as writeFileSync11 } from "node:fs";
-import { join as join86 } from "node:path";
+import { join as join87 } from "node:path";
var INDEX_FILE_NAME = "index.json";
function isTokenIndex(value) {
if (typeof value !== "object" || value === null || Array.isArray(value))
@@ -102938,7 +103026,7 @@ function isTokenIndex(value) {
return Object.values(value).every((entry) => typeof entry === "string");
}
function getIndexPath(storageDir) {
- return join86(storageDir, INDEX_FILE_NAME);
+ return join87(storageDir, INDEX_FILE_NAME);
}
function readTokenIndex(storageDir) {
const indexPath = getIndexPath(storageDir);
@@ -102982,16 +103070,16 @@ function deleteTokenIndexEntry(storageDir, hash) {
var STORAGE_DIR_NAME = "mcp-oauth";
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
function getMcpOauthStorageDir() {
- return join87(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
+ return join88(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
}
function getMcpOauthServerHash(serverHost, resource) {
- return createHash6("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
+ return createHash7("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
}
function getMcpOauthStoragePath(serverHost, resource) {
- return join87(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
+ return join88(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
}
function getLegacyStoragePath() {
- return join87(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
+ return join88(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
}
function normalizeHost2(serverHost) {
let host = serverHost.trim();
@@ -103170,7 +103258,7 @@ function listTokensByHost(serverHost) {
for (const [hash, indexedKey] of Object.entries(index)) {
if (!indexedKey.startsWith(prefix))
continue;
- const indexedToken = readTokenFile(join87(getMcpOauthStorageDir(), `${hash}.json`));
+ const indexedToken = readTokenFile(join88(getMcpOauthStorageDir(), `${hash}.json`));
if (indexedToken)
result[indexedKey] = indexedToken;
}
@@ -103185,7 +103273,7 @@ function listAllTokens() {
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
continue;
- const token = readTokenFile(join87(dir, entry.name));
+ const token = readTokenFile(join88(dir, entry.name));
const hash = basename12(entry.name, ".json");
if (token)
result[index[hash] ?? hash] = token;
@@ -103359,13 +103447,13 @@ async function findAvailablePort2(startPort = DEFAULT_PORT) {
// packages/mcp-client-core/src/mcp-oauth/oauth-authorization-flow.ts
import { spawn as spawn4 } from "node:child_process";
-import { createHash as createHash7, randomBytes as randomBytes2 } from "node:crypto";
+import { createHash as createHash8, randomBytes as randomBytes2 } from "node:crypto";
import { createServer as createServer2 } from "node:http";
function generateCodeVerifier() {
return randomBytes2(32).toString("base64url");
}
function generateCodeChallenge(verifier) {
- return createHash7("sha256").update(verifier).digest("base64url");
+ return createHash8("sha256").update(verifier).digest("base64url");
}
function buildAuthorizationUrl(authorizationEndpoint, options) {
const url = new URL(authorizationEndpoint);
diff --git a/plugins/omo/dist/cli/index.js b/plugins/omo/dist/cli/index.js
index 05242444..c155d2b1 100755
--- a/plugins/omo/dist/cli/index.js
+++ b/plugins/omo/dist/cli/index.js
@@ -64,7 +64,7 @@ var package_default;
var init_package = __esm(() => {
package_default = {
name: "oh-my-opencode",
- version: "5.0.0-beta.60",
+ version: "5.0.0-beta.62",
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
main: "./dist/index.js",
types: "dist/index.d.ts",
@@ -249,7 +249,7 @@ var init_package = __esm(() => {
zod: "^4.4.3"
},
devDependencies: {
- "@code-yeongyu/senpi": "2026.9.12-2",
+ "@code-yeongyu/senpi": "2026.9.13",
"@oh-my-opencode/agents-md-core": "workspace:*",
"@oh-my-opencode/ast-grep-mcp": "workspace:*",
"@oh-my-opencode/boulder-state": "workspace:*",
@@ -290,18 +290,18 @@ var init_package = __esm(() => {
typescript: "^7.0.2"
},
optionalDependencies: {
- "oh-my-opencode-darwin-arm64": "5.0.0-beta.60",
- "oh-my-opencode-darwin-x64": "5.0.0-beta.60",
- "oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.60",
- "oh-my-opencode-linux-arm64": "5.0.0-beta.60",
- "oh-my-opencode-linux-arm64-musl": "5.0.0-beta.60",
- "oh-my-opencode-linux-x64": "5.0.0-beta.60",
- "oh-my-opencode-linux-x64-baseline": "5.0.0-beta.60",
- "oh-my-opencode-linux-x64-musl": "5.0.0-beta.60",
- "oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.60",
- "oh-my-opencode-windows-arm64": "5.0.0-beta.60",
- "oh-my-opencode-windows-x64": "5.0.0-beta.60",
- "oh-my-opencode-windows-x64-baseline": "5.0.0-beta.60"
+ "oh-my-opencode-darwin-arm64": "5.0.0-beta.62",
+ "oh-my-opencode-darwin-x64": "5.0.0-beta.62",
+ "oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.62",
+ "oh-my-opencode-linux-arm64": "5.0.0-beta.62",
+ "oh-my-opencode-linux-arm64-musl": "5.0.0-beta.62",
+ "oh-my-opencode-linux-x64": "5.0.0-beta.62",
+ "oh-my-opencode-linux-x64-baseline": "5.0.0-beta.62",
+ "oh-my-opencode-linux-x64-musl": "5.0.0-beta.62",
+ "oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.62",
+ "oh-my-opencode-windows-arm64": "5.0.0-beta.62",
+ "oh-my-opencode-windows-x64": "5.0.0-beta.62",
+ "oh-my-opencode-windows-x64-baseline": "5.0.0-beta.62"
},
overrides: {
"@earendil-works/pi-agent-core": "0.84.2",
@@ -76944,20 +76944,20 @@ var init_config_manager = __esm(() => {
// packages/telemetry-core/src/activity-state.ts
import { existsSync as existsSync24, mkdirSync as mkdirSync8, readFileSync as readFileSync11 } from "fs";
-import { basename as basename8, join as join50 } from "path";
+import { basename as basename8, join as join51 } from "path";
function resolveTelemetryStateDir(product, options = {}) {
const dataDir = resolveXdgDataDir(product.cacheDirName, {
env: options.env,
osProvider: options.osProvider
});
- const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join50(options.env.XDG_DATA_HOME, product.cacheDirName);
+ const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join51(options.env.XDG_DATA_HOME, product.cacheDirName);
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename8(dataDir) === product.cacheDirName) {
return dataDir;
}
- return join50(dataDir, product.cacheDirName);
+ return join51(dataDir, product.cacheDirName);
}
function getTelemetryActivityStateFilePath(stateDir) {
- return join50(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
+ return join51(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
}
function getDailyActiveCaptureState(input) {
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
@@ -77028,9 +77028,9 @@ var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY =
// packages/telemetry-core/src/diagnostics.ts
import { appendFileSync as appendFileSync2, existsSync as existsSync25, mkdirSync as mkdirSync9, readFileSync as readFileSync12 } from "fs";
-import { join as join51 } from "path";
+import { join as join52 } from "path";
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
- return join51(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
+ return join52(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
}
function writeTelemetryDiagnostic(input, options) {
const now = options.now ?? new Date;
@@ -84337,13 +84337,13 @@ var init_index_node = __esm(() => {
});
// packages/telemetry-core/src/machine-id.ts
-import { createHash as createHash4 } from "crypto";
+import { createHash as createHash5 } from "crypto";
import os4 from "os";
function getDefaultTelemetryOsProvider() {
return os4;
}
function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetryOsProvider()) {
- return createHash4("sha256").update(`${machineIdPrefix}${osProvider.hostname()}`).digest("hex");
+ return createHash5("sha256").update(`${machineIdPrefix}${osProvider.hostname()}`).digest("hex");
}
var init_machine_id = () => {};
@@ -84542,7 +84542,7 @@ var package_default2;
var init_package2 = __esm(() => {
package_default2 = {
name: "@oh-my-opencode/omo-codex",
- version: "5.0.0-beta.60",
+ version: "5.0.0-beta.62",
type: "module",
private: true,
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
@@ -85414,7 +85414,7 @@ var init_update_toasts = __esm(() => {
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
import { existsSync as existsSync46 } from "fs";
-import { dirname as dirname30, join as join73 } from "path";
+import { dirname as dirname30, join as join74 } from "path";
import { fileURLToPath as fileURLToPath5 } from "url";
function defaultGetModuleHostingWorkspace() {
try {
@@ -85568,7 +85568,7 @@ var init_background_update_check = __esm(() => {
init_update_toasts();
defaultDeps4 = {
existsSync: existsSync46,
- join: join73,
+ join: join74,
runBunInstallWithDetails,
log: log2,
getOpenCodeCacheDir,
@@ -87990,7 +87990,19 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
}
// packages/omo-codex/src/install/install-codex.ts
-import { join as join52, resolve as resolve12 } from "path";
+import { join as join53, resolve as resolve12 } from "path";
+
+// packages/omo-codex/src/install/codex-default-role-config.ts
+init_src4();
+function readDefaultRoleConfig(options = {}) {
+ const result = loadOmoConfig({ ...options, harness: "codex" });
+ return {
+ enabled: result.config.agents?.default?.disable !== true,
+ warnings: result.diagnostics.map((diagnostic) => diagnostic.message)
+ };
+}
+
+// packages/omo-codex/src/install/install-codex.ts
import { existsSync as existsSync26 } from "fs";
import { homedir as homedir6 } from "os";
@@ -89917,6 +89929,12 @@ function removeStaleManagedAgentBlocks(config, keepAgentNames) {
`);
}
+function hasForeignAgentRegistration(config, agentConfig) {
+ const section = findTomlSection(config, `agents.${tomlKeySegment(agentConfig.name)}`);
+ if (!section)
+ return false;
+ return !section.text.includes(`config_file = ${JSON.stringify(agentConfig.configFile)}`);
+}
function ensureAgentConfig(config, agentConfig) {
const header = `agents.${tomlKeySegment(agentConfig.name)}`;
const section = findTomlSection(config, header);
@@ -90886,8 +90904,8 @@ function toCodexResolution(resolution) {
}
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
-import { copyFile, lstat as lstat9, mkdir as mkdir6, readdir as readdir7, rm as rm8, writeFile as writeFile7 } from "fs/promises";
-import { basename as basename6, join as join40 } from "path";
+import { copyFile, lstat as lstat10, mkdir as mkdir6, readdir as readdir7, rm as rm9, writeFile as writeFile7 } from "fs/promises";
+import { basename as basename6, join as join41 } from "path";
// packages/omo-codex/src/install/preserved-agent-settings.ts
import { lstat as lstat7, readFile as readFile13, readdir as readdir6, writeFile as writeFile6 } from "fs/promises";
@@ -91304,6 +91322,66 @@ function nodeErrorCode2(error) {
return typeof error.code === "string" ? error.code : null;
}
+// packages/omo-codex/src/install/default-agent-role.ts
+import { createHash as createHash3 } from "crypto";
+import { lstat as lstat9, readFile as readFile15, rm as rm8 } from "fs/promises";
+import { join as join40 } from "path";
+var REGISTRATION = { name: "default", configFile: "./agents/default.toml" };
+async function installDefaultAgentRole(input) {
+ const target = join40(input.codexHome, "agents", "default.toml");
+ const receipt = join40(input.codexHome, "agents", ".lazycodex-default.sha256");
+ const configPath = join40(input.codexHome, "config.toml");
+ const config = await readIfPresent(configPath);
+ const entry = await lstat9(target).catch((error) => {
+ if (error instanceof Error && "code" in error && error.code === "ENOENT")
+ return null;
+ throw error;
+ });
+ if (entry !== null && !entry.isFile()) {
+ if (!input.enabled)
+ return null;
+ throw new Error("Preserved user-owned agents/default.toml: refusing to replace a symlink or directory");
+ }
+ const existing = await readIfPresent(target);
+ const digest = await readIfPresent(receipt);
+ const owned = existing !== null && digest === hash(existing);
+ const foreign = hasForeignAgentRegistration(config ?? "", REGISTRATION);
+ if (!input.enabled) {
+ if (owned) {
+ if (!foreign && config !== null) {
+ const next = splitTomlSections(config).filter((section) => section.header === null || parseAgentHeaderName(section.header) !== "default").map((section) => section.text).join("");
+ if (next !== config)
+ await writeFileAtomic(configPath, next);
+ }
+ await rm8(target);
+ await rm8(receipt);
+ }
+ return null;
+ }
+ if (foreign || existing !== null && !owned) {
+ throw new Error("Preserved user-owned agents.default / agents/default.toml. Move it aside to install the LazyCodex fallback, or set [codex].agents.default.disable = true in omo.jsonc. Explicit LazyCodex roles remain required.");
+ }
+ const worker = await readFile15(input.worker.path, "utf8");
+ const content = worker.replace(/^name\s*=\s*["']lazycodex-worker-medium["']\s*$/m, 'name = "default"');
+ if (content === worker)
+ throw new Error("Cannot derive default: medium worker has no matching internal name");
+ await writeFileAtomic(target, content);
+ await writeFileAtomic(receipt, hash(content));
+ return { name: "default.toml", path: target, target: input.worker.target };
+}
+async function readIfPresent(path) {
+ try {
+ return await readFile15(path, "utf8");
+ } catch (error) {
+ if (error instanceof Error && "code" in error && error.code === "ENOENT")
+ return null;
+ throw error;
+ }
+}
+function hash(content) {
+ return createHash3("sha256").update(content).digest("hex");
+}
+
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
var MANIFEST_FILE = ".installed-agents.json";
async function linkCachedPluginAgents(input) {
@@ -91313,13 +91391,13 @@ async function linkCachedPluginAgents(input) {
await writeManifest(input.pluginRoot, []);
return [];
}
- const agentsDir = join40(input.codexHome, "agents");
+ const agentsDir = join41(input.codexHome, "agents");
await mkdir6(agentsDir, { recursive: true });
const linked = [];
for (const agentPath of bundledAgents) {
const agentFileName = basename6(agentPath);
const agentName = agentNameFromToml2(agentFileName);
- const linkPath = join40(agentsDir, agentFileName);
+ const linkPath = join41(agentsDir, agentFileName);
await replaceWithCopy(linkPath, agentPath);
await restorePreservedReasoning({
agentName,
@@ -91334,11 +91412,17 @@ async function linkCachedPluginAgents(input) {
});
linked.push({ name: agentFileName, path: linkPath, target: agentPath });
}
+ const worker = linked.find((entry) => entry.name === "lazycodex-worker-medium.toml");
+ if (worker !== undefined) {
+ const fallback = await installDefaultAgentRole({ codexHome: input.codexHome, worker, enabled: input.defaultRoleEnabled !== false });
+ if (fallback !== null)
+ linked.push(fallback);
+ }
await writeManifest(input.pluginRoot, linked.map((entry) => entry.path));
return linked;
}
async function discoverBundledAgents(pluginRoot) {
- const componentsRoot = join40(pluginRoot, "components");
+ const componentsRoot = join41(pluginRoot, "components");
if (!await exists4(componentsRoot))
return [];
const componentEntries = await readdir7(componentsRoot, { withFileTypes: true });
@@ -91346,14 +91430,14 @@ async function discoverBundledAgents(pluginRoot) {
for (const entry of componentEntries) {
if (!entry.isDirectory())
continue;
- const agentsRoot = join40(componentsRoot, entry.name, "agents");
+ const agentsRoot = join41(componentsRoot, entry.name, "agents");
if (!await exists4(agentsRoot))
continue;
const agentEntries = await readdir7(agentsRoot, { withFileTypes: true });
for (const file of agentEntries) {
if (!file.isFile() || !file.name.endsWith(".toml"))
continue;
- agents.push(join40(agentsRoot, file.name));
+ agents.push(join41(agentsRoot, file.name));
}
}
agents.sort();
@@ -91366,14 +91450,14 @@ async function replaceWithCopy(linkPath, target) {
async function prepareReplacement(linkPath) {
if (!await exists4(linkPath))
return;
- const entryStat = await lstat9(linkPath);
+ const entryStat = await lstat10(linkPath);
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
}
- await rm8(linkPath, { force: true });
+ await rm9(linkPath, { force: true });
}
async function writeManifest(pluginRoot, agentPaths) {
- const manifestPath = join40(pluginRoot, MANIFEST_FILE);
+ const manifestPath = join41(pluginRoot, MANIFEST_FILE);
const payload = { agents: [...agentPaths].sort() };
await writeFile7(manifestPath, `${JSON.stringify(payload, null, "\t")}
`);
@@ -91383,7 +91467,7 @@ function agentNameFromToml2(fileName) {
}
async function exists4(path) {
try {
- await lstat9(path);
+ await lstat10(path);
return true;
} catch (error) {
if (nodeErrorCode3(error) !== "ENOENT")
@@ -91398,12 +91482,12 @@ function nodeErrorCode3(error) {
}
// packages/omo-codex/src/install/codex-marketplace.ts
-import { readFile as readFile15 } from "fs/promises";
-import { join as join41 } from "path";
+import { readFile as readFile16 } from "fs/promises";
+import { join as join42 } from "path";
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
async function readMarketplace(repoRoot, options) {
- const marketplacePath = options?.marketplacePath ?? join41(repoRoot, DEFAULT_MARKETPLACE_PATH);
- const raw = await readFile15(marketplacePath, "utf8");
+ const marketplacePath = options?.marketplacePath ?? join42(repoRoot, DEFAULT_MARKETPLACE_PATH);
+ const raw = await readFile16(marketplacePath, "utf8");
const parsed = JSON.parse(raw);
if (!isPlainRecord4(parsed))
throw new Error("marketplace.json must be an object");
@@ -91421,10 +91505,10 @@ async function readMarketplace(repoRoot, options) {
function resolvePluginSource(repoRoot, plugin, options) {
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
const relativePath = sourcePath.slice(2);
- return join41(repoRoot, ...relativePath.split(/[\\/]/));
+ return join42(repoRoot, ...relativePath.split(/[\\/]/));
}
async function readPluginManifest(pluginRoot) {
- const raw = await readFile15(join41(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
+ const raw = await readFile16(join42(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
const parsed = JSON.parse(raw);
if (!isPlainRecord4(parsed))
throw new Error(`${pluginRoot} plugin.json must be an object`);
@@ -91505,8 +91589,8 @@ function validateLocalSourcePath(path) {
}
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
-import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm9, writeFile as writeFile8 } from "fs/promises";
-import { join as join42, sep as sep6 } from "path";
+import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm10, writeFile as writeFile8 } from "fs/promises";
+import { join as join43, sep as sep6 } from "path";
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
async function writeInstalledMarketplaceSnapshot(input) {
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
@@ -91519,28 +91603,28 @@ async function writeInstalledMarketplaceSnapshot(input) {
return snapshotPlugins;
}
function installedMarketplaceRoot(codexHome, marketplaceName) {
- return join42(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
+ return join43(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
}
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
- const manifestDir = join42(marketplaceRoot, ".agents", "plugins");
+ const manifestDir = join43(marketplaceRoot, ".agents", "plugins");
await mkdir7(manifestDir, { recursive: true });
- const tempPath = join42(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
+ const tempPath = join43(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
await writeFile8(tempPath, `${JSON.stringify(marketplace, null, "\t")}
`);
- await rename4(tempPath, join42(manifestDir, "marketplace.json"));
+ await rename4(tempPath, join43(manifestDir, "marketplace.json"));
}
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
- const pluginsDir = join42(marketplaceRoot, "plugins");
+ const pluginsDir = join43(marketplaceRoot, "plugins");
await mkdir7(pluginsDir, { recursive: true });
- const targetPath = join42(pluginsDir, plugin.name);
- const tempPath = join42(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
- await rm9(tempPath, { recursive: true, force: true });
+ const targetPath = join43(pluginsDir, plugin.name);
+ const tempPath = join43(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
+ await rm10(tempPath, { recursive: true, force: true });
await cp3(plugin.sourcePath, tempPath, {
recursive: true,
filter: (source) => shouldCopyMarketplaceSourcePath(source, plugin.sourcePath)
});
await copyBundledMcpRuntimeDists({ pluginRoot: tempPath, sourceRoot: plugin.sourcePath });
- await rm9(targetPath, { recursive: true, force: true });
+ await rm10(targetPath, { recursive: true, force: true });
await rename4(tempPath, targetPath);
await rewriteCachedMcpManifest(targetPath, plugin.sourcePath);
return { name: plugin.name, path: targetPath };
@@ -91554,11 +91638,11 @@ function shouldCopyMarketplaceSourcePath(path, root) {
}
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
-import { readdir as readdir8, readFile as readFile16, writeFile as writeFile9 } from "fs/promises";
-import { join as join43 } from "path";
+import { readdir as readdir8, readFile as readFile17, writeFile as writeFile9 } from "fs/promises";
+import { join as join44 } from "path";
async function readDistributionManifest(repoRoot) {
try {
- const parsed = JSON.parse(await readFile16(join43(repoRoot, "package.json"), "utf8"));
+ const parsed = JSON.parse(await readFile17(join44(repoRoot, "package.json"), "utf8"));
if (!isPlainRecord4(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
return;
return {
@@ -91582,19 +91666,19 @@ function resolveLazyCodexPluginVersion(input) {
return input.manifestVersion ?? "local";
}
async function stampLazyCodexPluginVersion(input) {
- const manifestPath = join43(input.pluginRoot, ".codex-plugin", "plugin.json");
+ const manifestPath = join44(input.pluginRoot, ".codex-plugin", "plugin.json");
const hookPaths = await readPluginHookPaths(manifestPath);
await stampJsonVersion(manifestPath, input.version);
- await stampJsonVersion(join43(input.pluginRoot, "package.json"), input.version);
+ await stampJsonVersion(join44(input.pluginRoot, "package.json"), input.version);
for (const hookPath of hookPaths) {
- await stampHookStatusMessages(join43(input.pluginRoot, hookPath), input.version);
+ await stampHookStatusMessages(join44(input.pluginRoot, hookPath), input.version);
}
await stampComponentVersions(input);
}
async function writeLazyCodexInstallSnapshot(input) {
if (input.distributionManifest === undefined)
return;
- await writeFile9(join43(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
+ await writeFile9(join44(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
packageName: input.distributionManifest.name,
version: input.distributionManifest.version
}, null, "\t")}
@@ -91602,7 +91686,7 @@ async function writeLazyCodexInstallSnapshot(input) {
}
async function stampJsonVersion(path, version) {
try {
- const parsed = JSON.parse(await readFile16(path, "utf8"));
+ const parsed = JSON.parse(await readFile17(path, "utf8"));
if (!isPlainRecord4(parsed))
return;
parsed.version = version;
@@ -91616,7 +91700,7 @@ async function stampJsonVersion(path, version) {
}
async function readPluginHookPaths(manifestPath) {
try {
- const parsed = JSON.parse(await readFile16(manifestPath, "utf8"));
+ const parsed = JSON.parse(await readFile17(manifestPath, "utf8"));
if (!isPlainRecord4(parsed))
return [];
if (typeof parsed.hooks === "string" && parsed.hooks.trim().length > 0)
@@ -91636,7 +91720,7 @@ function stripDotSlash3(path) {
}
async function stampHookStatusMessages(path, version) {
try {
- const parsed = JSON.parse(await readFile16(path, "utf8"));
+ const parsed = JSON.parse(await readFile17(path, "utf8"));
if (!isPlainRecord4(parsed))
return;
stampHookGroups(parsed.hooks, version);
@@ -91651,16 +91735,16 @@ async function stampHookStatusMessages(path, version) {
async function stampComponentVersions(input) {
let entries;
try {
- entries = await readdir8(join43(input.pluginRoot, "components"));
+ entries = await readdir8(join44(input.pluginRoot, "components"));
} catch (error) {
if (error instanceof Error)
return;
throw error;
}
for (const entry of entries) {
- const componentRoot = join43(input.pluginRoot, "components", entry);
- await stampJsonVersion(join43(componentRoot, "package.json"), input.version);
- await stampHookStatusMessages(join43(componentRoot, "hooks", "hooks.json"), input.version);
+ const componentRoot = join44(input.pluginRoot, "components", entry);
+ await stampJsonVersion(join44(componentRoot, "package.json"), input.version);
+ await stampHookStatusMessages(join44(componentRoot, "hooks", "hooks.json"), input.version);
}
}
function stampHookGroups(hooks, version) {
@@ -91717,8 +91801,8 @@ var defaultRunCommand = async (command, args, options) => {
};
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
-import { copyFile as copyFile2, lstat as lstat10, readFile as readFile17, writeFile as writeFile10 } from "fs/promises";
-import { dirname as dirname16, join as join44, resolve as resolve10 } from "path";
+import { copyFile as copyFile2, lstat as lstat11, readFile as readFile18, writeFile as writeFile10 } from "fs/promises";
+import { dirname as dirname16, join as join45, resolve as resolve10 } from "path";
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
var PROJECT_LOCAL_ARTIFACT_PATHS = [
".codex/hooks.json",
@@ -91737,7 +91821,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
const artifacts = await collectProjectLocalArtifacts(project.artifactRoots);
const configs = [];
for (const configPath of project.configPaths) {
- const original = await readFile17(configPath, "utf8");
+ const original = await readFile18(configPath, "utf8");
const repair = repairProjectLocalCodexConfigText(original);
if (!repair.changed) {
configs.push({
@@ -91821,17 +91905,17 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
}
- const codexHomeConfigPath = codexHome === undefined ? null : join44(resolve10(codexHome), "config.toml");
+ const codexHomeConfigPath = codexHome === undefined ? null : join45(resolve10(codexHome), "config.toml");
let current = resolve10(startDirectory);
const configPathsFromCwd = [];
while (true) {
- const configPath = join44(current, ".codex", "config.toml");
+ const configPath = join45(current, ".codex", "config.toml");
if (await isRegularProjectLocalConfig(current, configPath)) {
if (codexHomeConfigPath === null || resolve10(configPath) !== codexHomeConfigPath) {
configPathsFromCwd.push(configPath);
}
}
- if (await exists5(join44(current, ".git"))) {
+ if (await exists5(join45(current, ".git"))) {
return configPathsFromCwd.length === 0 ? null : {
projectRoot: current,
configPaths: [...configPathsFromCwd].reverse(),
@@ -91851,7 +91935,7 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
}
}
async function isRegularProjectLocalConfig(directory, configPath) {
- const codexDirStat = await maybeLstat(join44(directory, ".codex"));
+ const codexDirStat = await maybeLstat(join45(directory, ".codex"));
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
return false;
const configStat = await maybeLstat(configPath);
@@ -91871,7 +91955,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
const seenPaths = new Set;
for (const projectRoot of projectRoots) {
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
- const artifactPath = join44(projectRoot, relativePath);
+ const artifactPath = join45(projectRoot, relativePath);
if (seenPaths.has(artifactPath))
continue;
const entryStat = await maybeLstat(artifactPath);
@@ -91905,7 +91989,7 @@ function formatBackupTimestamp(date) {
}
async function maybeLstat(path) {
try {
- return await lstat10(path);
+ return await lstat11(path);
} catch (error) {
if (nodeErrorCode4(error) === "ENOENT")
return null;
@@ -91946,14 +92030,14 @@ function formatUnknownError(error) {
}
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
-import { createHash as createHash3 } from "crypto";
-import { lstat as lstat11, readFile as readFile19, readdir as readdir10, rm as rm10 } from "fs/promises";
+import { createHash as createHash4 } from "crypto";
+import { lstat as lstat12, readFile as readFile20, readdir as readdir10, rm as rm11 } from "fs/promises";
import { tmpdir as tmpdir3 } from "os";
-import { join as join45, posix as posix6 } from "path";
+import { join as join46, posix as posix6 } from "path";
// packages/omo-codex/src/install/lsp-daemon-reaper-attestation.ts
import { execFile } from "child_process";
-import { readFile as readFile18, readdir as readdir9, readlink as readlink5 } from "fs/promises";
+import { readFile as readFile19, readdir as readdir9, readlink as readlink5 } from "fs/promises";
import { connect } from "net";
import { basename as basename7 } from "path";
var PROBE_TIMEOUT_MS = 500;
@@ -91995,7 +92079,7 @@ async function attestLegacyDaemonOwnership(input, deps = {}) {
return false;
}
async function attestLinuxOwnership(input, deps) {
- const readFileImpl = deps.readFile ?? readFile18;
+ const readFileImpl = deps.readFile ?? readFile19;
const readDirImpl = deps.readDir ?? readdir9;
const readLinkImpl = deps.readLink ?? readlink5;
const procNetUnix = await readText(readFileImpl, "/proc/net/unix");
@@ -92122,7 +92206,7 @@ async function readBinary(readFileImpl, path) {
var LEGACY_EXIT_WAIT_TIMEOUT_MS = 5000;
var LEGACY_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
async function reapLspDaemons(codexHome, deps = {}) {
- const daemonRoot = join45(codexHome, "codex-lsp", "daemon");
+ const daemonRoot = join46(codexHome, "codex-lsp", "daemon");
const platform = deps.platform ?? process.platform;
const tmpDir = deps.tmpDir ?? tmpdir3();
const probe = deps.probeLegacyJsonRpc ?? probeLegacyJsonRpcEndpoint;
@@ -92132,7 +92216,7 @@ async function reapLspDaemons(codexHome, deps = {}) {
const entries = await readdir10(daemonRoot, { withFileTypes: true }).catch(() => []);
const results = [];
for (const entry of [...entries].sort((left, right) => left.name.localeCompare(right.name))) {
- const versionPath = join45(daemonRoot, entry.name);
+ const versionPath = join46(daemonRoot, entry.name);
const parsedVersion = parseVersionEntry(entry.name);
if (parsedVersion === null || !entry.isDirectory()) {
await removeVersionDir(versionPath);
@@ -92180,7 +92264,7 @@ function parseVersionEntry(entryName) {
return LEGACY_VERSION_PATTERN.test(version) ? version : null;
}
async function readLegacyMetadata(input) {
- const pidText = await readRegularTrimmedFile(join45(input.versionPath, "daemon.pid"));
+ const pidText = await readRegularTrimmedFile(join46(input.versionPath, "daemon.pid"));
if (pidText === "non_regular")
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
if (pidText === null)
@@ -92188,7 +92272,7 @@ async function readLegacyMetadata(input) {
const pid = Number.parseInt(pidText, 10);
if (!Number.isInteger(pid) || pid <= 0)
return { kind: "remove", reason: "removed malformed legacy daemon metadata" };
- const endpointText = await readRegularTrimmedFile(join45(input.versionPath, "daemon.endpoint"));
+ const endpointText = await readRegularTrimmedFile(join46(input.versionPath, "daemon.endpoint"));
if (endpointText === "non_regular")
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
if (endpointText === null)
@@ -92215,19 +92299,19 @@ function legacyEndpointCandidates(input) {
return [natural, hashed];
}
async function readRegularTrimmedFile(path) {
- const stats = await lstat11(path).catch(() => null);
+ const stats = await lstat12(path).catch(() => null);
if (stats === null)
return null;
if (!stats.isFile())
return "non_regular";
- const content = (await readFile19(path, "utf8")).trim();
+ const content = (await readFile20(path, "utf8")).trim();
return content.length > 0 ? content : null;
}
function shortDigest(value) {
- return createHash3("sha256").update(value).digest("hex").slice(0, 16);
+ return createHash4("sha256").update(value).digest("hex").slice(0, 16);
}
async function removeVersionDir(path) {
- await rm10(path, { recursive: true, force: true });
+ await rm11(path, { recursive: true, force: true });
}
function removed(version, reason) {
return { version, status: "removed", reason };
@@ -92267,7 +92351,7 @@ function processIsRunning(pid) {
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
import { homedir as homedir5 } from "os";
-import { join as join46, resolve as resolve11 } from "path";
+import { join as join47, resolve as resolve11 } from "path";
function resolveCodexInstallerBinDir(input) {
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
@@ -92276,16 +92360,16 @@ function resolveCodexInstallerBinDir(input) {
const defaultCodexHome = resolve11(homeDir, ".codex");
const resolvedCodexHome = resolve11(input.codexHome);
if (resolvedCodexHome !== defaultCodexHome)
- return join46(resolvedCodexHome, "bin");
+ return join47(resolvedCodexHome, "bin");
return resolve11(homeDir, ".local", "bin");
}
// packages/omo-codex/src/install/codex-installed-bin-dir.ts
-import { readFile as readFile20, readdir as readdir11, writeFile as writeFile11 } from "fs/promises";
-import { join as join47 } from "path";
+import { readFile as readFile21, readdir as readdir11, writeFile as writeFile11 } from "fs/promises";
+import { join as join48 } from "path";
var INSTALLED_BIN_DIR_MANIFEST = ".installed-bin-dir.json";
async function writeInstalledCodexBinDir(input) {
- await writeFile11(join47(input.pluginRoot, INSTALLED_BIN_DIR_MANIFEST), `${JSON.stringify({ binDir: input.binDir }, null, 2)}
+ await writeFile11(join48(input.pluginRoot, INSTALLED_BIN_DIR_MANIFEST), `${JSON.stringify({ binDir: input.binDir }, null, 2)}
`);
}
async function readInstalledCodexBinDir(codexHome) {
@@ -92298,20 +92382,20 @@ async function readInstalledCodexBinDir(codexHome) {
}
async function installedBinDirManifestPaths(codexHome) {
const paths = [
- join47(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_BIN_DIR_MANIFEST)
+ join48(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_BIN_DIR_MANIFEST)
];
- const versionRoot = join47(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
+ const versionRoot = join48(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
const entries = await readdir11(versionRoot, { withFileTypes: true }).catch(() => null);
if (entries !== null) {
for (const entry of entries) {
if (entry.isDirectory())
- paths.push(join47(versionRoot, entry.name, INSTALLED_BIN_DIR_MANIFEST));
+ paths.push(join48(versionRoot, entry.name, INSTALLED_BIN_DIR_MANIFEST));
}
}
return paths;
}
async function readBinDirFromManifest(manifestPath) {
- const raw = await readFile20(manifestPath, "utf8").catch(() => null);
+ const raw = await readFile21(manifestPath, "utf8").catch(() => null);
if (raw === null)
return null;
let parsed;
@@ -92329,8 +92413,8 @@ async function readBinDirFromManifest(manifestPath) {
}
// packages/omo-codex/src/install/codex-git-bash-hooks.ts
-import { readFile as readFile21, writeFile as writeFile12 } from "fs/promises";
-import { join as join48 } from "path";
+import { readFile as readFile22, writeFile as writeFile12 } from "fs/promises";
+import { join as join49 } from "path";
var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
"./hooks/pre-tool-use-recommending-git-bash-mcp.json",
"./hooks/post-compact-resetting-git-bash-mcp-reminder.json"
@@ -92338,8 +92422,8 @@ var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
async function removeGitBashHooksOffWindows(input) {
if (input.platform === "win32")
return;
- const manifestPath = join48(input.pluginRoot, ".codex-plugin", "plugin.json");
- const parsed = JSON.parse(await readFile21(manifestPath, "utf8"));
+ const manifestPath = join49(input.pluginRoot, ".codex-plugin", "plugin.json");
+ const parsed = JSON.parse(await readFile22(manifestPath, "utf8"));
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.hooks))
return;
const hooks = parsed.hooks.filter((hook) => typeof hook !== "string" || !WINDOWS_ONLY_GIT_BASH_HOOKS.has(hook));
@@ -92351,7 +92435,7 @@ async function removeGitBashHooksOffWindows(input) {
// packages/omo-codex/src/install/install-ast-grep-sg.ts
init_src();
-import { join as join49 } from "path";
+import { join as join50 } from "path";
function describeResult(result) {
if (result.kind === "succeeded")
return null;
@@ -92365,7 +92449,7 @@ async function installAstGrepForCodex(options) {
return;
const platform = options.platform ?? process.platform;
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
- const skillDir = join49(plugin.path, "skills", "ast-grep");
+ const skillDir = join50(plugin.path, "skills", "ast-grep");
const installer = options.installer ?? runAstGrepSkillInstall;
try {
const result = await installer({ platform, skillDir, targetDir });
@@ -92398,7 +92482,7 @@ async function runCodexInstaller(options = {}) {
const env = options.env ?? process.env;
const platform = options.platform ?? process.platform;
const repoRoot = resolve12(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env }));
- const codexHome = resolve12(options.codexHome ?? env.CODEX_HOME ?? join52(homedir6(), ".codex"));
+ const codexHome = resolve12(options.codexHome ?? env.CODEX_HOME ?? join53(homedir6(), ".codex"));
const projectDirectory = resolve12(options.projectDirectory ?? env.OMO_CODEX_PROJECT ?? process.cwd());
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env });
const runCommand = options.runCommand ?? defaultRunCommand;
@@ -92415,9 +92499,9 @@ async function runCodexInstaller(options = {}) {
if (!gitBashResolution.found) {
throw new Error(gitBashResolution.installHint);
}
- const codexPackageRoot = join52(repoRoot, "packages", "omo-codex");
+ const codexPackageRoot = join53(repoRoot, "packages", "omo-codex");
const marketplace = await readMarketplace(repoRoot, {
- marketplacePath: join52(codexPackageRoot, "marketplace.json")
+ marketplacePath: join53(codexPackageRoot, "marketplace.json")
});
const distributionManifest = await readDistributionManifest(repoRoot);
const installed = [];
@@ -92463,7 +92547,7 @@ async function runCodexInstaller(options = {}) {
if (runtimeLink !== null)
log(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
else
- log(`Warning: skipped the omo-agent-toolkit runtime wrapper because ${join52(repoRoot, "dist", "cli", "index.js")} is missing; omo-agent-toolkit ulw-loop commands will be unavailable until a package shipping dist/cli is installed`);
+ log(`Warning: skipped the omo-agent-toolkit runtime wrapper because ${join53(repoRoot, "dist", "cli", "index.js")} is missing; omo-agent-toolkit ulw-loop commands will be unavailable until a package shipping dist/cli is installed`);
}
pluginSources.push({ name: entry.name, sourcePath });
installed.push(plugin);
@@ -92483,6 +92567,9 @@ async function runCodexInstaller(options = {}) {
installed,
pluginSources
});
+ const omoConfig = readDefaultRoleConfig({ cwd: projectDirectory, env });
+ for (const warning of omoConfig.warnings)
+ log(`Warning: ${warning}`);
for (const plugin of installed) {
const pluginRoot = agentSourceRoots.get(plugin.name) ?? plugin.path;
const agentLinks = await linkCachedPluginAgents({
@@ -92490,7 +92577,8 @@ async function runCodexInstaller(options = {}) {
pluginRoot,
platform,
preservedReasoning,
- preservedServiceTier
+ preservedServiceTier,
+ defaultRoleEnabled: omoConfig.enabled
});
for (const link of agentLinks) {
log(`Linked agent ${link.name} -> ${link.target}`);
@@ -92526,13 +92614,13 @@ async function runCodexInstaller(options = {}) {
continue;
log(`Warning: deferred legacy Codex LSP daemon cleanup for v${cleanup.version}: ${cleanup.reason}`);
}
- const marketplaceRoot = join52(codexHome, "plugins", "cache", marketplace.name);
+ const marketplaceRoot = join53(codexHome, "plugins", "cache", marketplace.name);
await writeCachedMarketplaceManifest({
marketplaceName: marketplace.name,
marketplaceRoot,
plugins: installed
});
- const configPath = join52(codexHome, "config.toml");
+ const configPath = join53(codexHome, "config.toml");
await updateCodexConfig({
configPath,
repoRoot: codexPackageRoot,
@@ -92591,7 +92679,7 @@ function findRepoRootFromImporter(importerDir) {
for (let depth = 0;depth <= 7; depth += 1) {
if (isRepoRootWithCodexPlugin(current))
return current;
- for (const wrapperPackageRoot of [join52(current, "node_modules", "oh-my-openagent"), join52(current, "oh-my-openagent")]) {
+ for (const wrapperPackageRoot of [join53(current, "node_modules", "oh-my-openagent"), join53(current, "oh-my-openagent")]) {
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
return wrapperPackageRoot;
}
@@ -92609,7 +92697,7 @@ function findRepoRoot(input) {
return findRepoRootFromImporter(input.importerDir);
}
function isRepoRootWithCodexPlugin(repoRoot) {
- return existsSync26(join52(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
+ return existsSync26(join53(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
}
function codexMarketplaceSource(marketplaceRoot) {
return { sourceType: "local", source: marketplaceRoot };
@@ -92744,13 +92832,13 @@ function defaultRunCommand2(command, args) {
});
}
// packages/omo-codex/src/install/codex-cleanup.ts
-import { lstat as lstat14, readFile as readFile24, readdir as readdir13, rm as rm12, rmdir } from "fs/promises";
+import { lstat as lstat15, readFile as readFile25, readdir as readdir13, rm as rm13, rmdir } from "fs/promises";
import { homedir as homedir8 } from "os";
-import { isAbsolute as isAbsolute11, join as join55, relative as relative6, resolve as resolve15 } from "path";
+import { isAbsolute as isAbsolute11, join as join56, relative as relative6, resolve as resolve15 } from "path";
// packages/omo-codex/src/install/codex-cleanup-bins.ts
-import { lstat as lstat12, readFile as readFile22, readdir as readdir12, readlink as readlink6, rm as rm11 } from "fs/promises";
-import { dirname as dirname18, isAbsolute as isAbsolute9, join as join53, resolve as resolve13 } from "path";
+import { lstat as lstat13, readFile as readFile23, readdir as readdir12, readlink as readlink6, rm as rm12 } from "fs/promises";
+import { dirname as dirname18, isAbsolute as isAbsolute9, join as join54, resolve as resolve13 } from "path";
var ROOT_RUNTIME_BIN_NAME = "omo";
var MANAGED_CODEX_BIN_NAMES = new Set([
ROOT_RUNTIME_BIN_NAME,
@@ -92780,9 +92868,9 @@ async function removeManagedCodexBins(binDir, platform) {
const binName = managedBinNameForEntry2(entry.name, platform);
if (binName === null || !MANAGED_CODEX_BIN_NAMES.has(binName))
continue;
- const linkPath = join53(binDir, entry.name);
+ const linkPath = join54(binDir, entry.name);
if (await isManagedCodexBin(linkPath, platform, binName)) {
- await rm11(linkPath, { force: true });
+ await rm12(linkPath, { force: true });
removed.push(linkPath);
}
}
@@ -92795,7 +92883,7 @@ function managedBinNameForEntry2(entryName, platform) {
return normalizedEntryName.endsWith(".cmd") ? normalizedEntryName.slice(0, -".cmd".length) : null;
}
async function isManagedCodexBin(linkPath, platform, binName) {
- const entryStat = await lstat12(linkPath).catch((error) => {
+ const entryStat = await lstat13(linkPath).catch((error) => {
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
return null;
throw error;
@@ -92811,12 +92899,12 @@ async function isManagedCodexBin(linkPath, platform, binName) {
}
if (!entryStat.isFile())
return false;
- const content = await readFile22(linkPath, "utf8");
+ const content = await readFile23(linkPath, "utf8");
return content.includes(RUNTIME_WRAPPER_MARKER) || content.includes(COMMAND_SHIM_MARKER);
}
// packages/omo-codex/src/install/codex-cleanup-config.ts
-import { lstat as lstat13, mkdir as mkdir8, readFile as readFile23, writeFile as writeFile13 } from "fs/promises";
+import { lstat as lstat14, mkdir as mkdir8, readFile as readFile24, writeFile as writeFile13 } from "fs/promises";
import { dirname as dirname19 } from "path";
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
@@ -92849,7 +92937,7 @@ function cleanupCodexLightConfigText(config) {
async function cleanupCodexConfig(configPath, now) {
if (!await configExists(configPath))
return { changed: false };
- const original = await readFile23(configPath, "utf8");
+ const original = await readFile24(configPath, "utf8");
const next = cleanupCodexLightConfigText(original);
if (next === original)
return { changed: false };
@@ -92918,7 +93006,7 @@ function formatBackupTimestamp2(date) {
}
async function configExists(path) {
try {
- await lstat13(path);
+ await lstat14(path);
return true;
} catch (error) {
if (nodeErrorCode5(error) === "ENOENT")
@@ -92933,7 +93021,7 @@ function nodeErrorCode5(error) {
}
// packages/omo-codex/src/install/codex-cleanup-safety.ts
-import { dirname as dirname20, isAbsolute as isAbsolute10, join as join54, relative as relative5, resolve as resolve14 } from "path";
+import { dirname as dirname20, isAbsolute as isAbsolute10, join as join55, relative as relative5, resolve as resolve14 } from "path";
function codexHomeResolvesToFilesystemRoot(codexHome) {
const resolved = resolve14(codexHome);
return dirname20(resolved) === resolved;
@@ -92950,11 +93038,11 @@ function validateManagedCleanupTarget(input) {
if (target === codexHome)
return skipped(input.path, "outside managed Codex cleanup scope");
const exactManagedRoots = new Set([
- resolve14(join54(codexHome, "plugins", "cache", "sisyphuslabs")),
- resolve14(join54(codexHome, ".tmp", "marketplaces", "sisyphuslabs")),
- resolve14(join54(codexHome, "runtime", "ast-grep")),
- resolve14(join54(codexHome, "runtime", "node")),
- resolve14(join54(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap"))
+ resolve14(join55(codexHome, "plugins", "cache", "sisyphuslabs")),
+ resolve14(join55(codexHome, ".tmp", "marketplaces", "sisyphuslabs")),
+ resolve14(join55(codexHome, "runtime", "ast-grep")),
+ resolve14(join55(codexHome, "runtime", "node")),
+ resolve14(join55(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap"))
]);
if (exactManagedRoots.has(target))
return null;
@@ -92984,8 +93072,8 @@ function skipped(path, reason) {
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
async function cleanupCodexLight(input = {}) {
const env = input.env ?? process.env;
- const codexHome = resolve15(input.codexHome ?? env.CODEX_HOME ?? join55(homedir8(), ".codex"));
- const configPath = join55(codexHome, "config.toml");
+ const codexHome = resolve15(input.codexHome ?? env.CODEX_HOME ?? join56(homedir8(), ".codex"));
+ const configPath = join56(codexHome, "config.toml");
const installedBinDir = await readInstalledCodexBinDir(codexHome);
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
const configCleanup = await cleanupCodexConfig(configPath, input.now);
@@ -93039,17 +93127,17 @@ function firstConfiguredPath(...values) {
}
function managedGlobalStatePaths(codexHome) {
return [
- join55(codexHome, "plugins", "cache", "sisyphuslabs"),
- join55(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
- join55(codexHome, "runtime", "ast-grep"),
- join55(codexHome, "runtime", "node"),
- join55(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
+ join56(codexHome, "plugins", "cache", "sisyphuslabs"),
+ join56(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
+ join56(codexHome, "runtime", "ast-grep"),
+ join56(codexHome, "runtime", "node"),
+ join56(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
];
}
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
async function collectBootstrapDataDirsByGlob(codexHome) {
const results = [];
- await walkForManagedBootstrapDirs(join55(codexHome, "plugins"), 0, results);
+ await walkForManagedBootstrapDirs(join56(codexHome, "plugins"), 0, results);
return results;
}
async function walkForManagedBootstrapDirs(directory, depth, results) {
@@ -93061,9 +93149,9 @@ async function walkForManagedBootstrapDirs(directory, depth, results) {
for (const entry of entries) {
if (!entry.isDirectory())
continue;
- const childPath = join55(directory, entry.name);
+ const childPath = join56(directory, entry.name);
if (isManagedBootstrapOwnerName(entry.name)) {
- const bootstrapDir = join55(childPath, "bootstrap");
+ const bootstrapDir = join56(childPath, "bootstrap");
if (await exists6(bootstrapDir))
results.push(bootstrapDir);
continue;
@@ -93087,9 +93175,9 @@ async function removeManagedPathBestEffort(path, seams) {
}
async function attemptRemove(path) {
try {
- if (await lstat14(path).catch(() => null) === null)
+ if (await lstat15(path).catch(() => null) === null)
return false;
- await rm12(path, { recursive: true, force: true });
+ await rm13(path, { recursive: true, force: true });
return true;
} catch {
return false;
@@ -93097,7 +93185,7 @@ async function attemptRemove(path) {
}
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
try {
- await rmdir(join55(codexHome, "runtime"));
+ await rmdir(join56(codexHome, "runtime"));
} catch (error) {
if (isExpectedRuntimePruneFailure(error))
return;
@@ -93109,14 +93197,14 @@ function isExpectedRuntimePruneFailure(error) {
}
async function collectInstalledAgentPaths(codexHome, configPath) {
const manifestPaths = [
- join55(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
+ join56(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
];
- const versionRoot = join55(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
+ const versionRoot = join56(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
if (await exists6(versionRoot)) {
const entries = await readdir13(versionRoot, { withFileTypes: true });
for (const entry of entries) {
if (entry.isDirectory())
- manifestPaths.push(join55(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
+ manifestPaths.push(join56(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
}
}
const paths = new Set;
@@ -93133,19 +93221,19 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
async function readManagedAgentPathsFromConfig(codexHome, configPath) {
if (!await exists6(configPath))
return [];
- const config = await readFile24(configPath, "utf8");
- return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join55(codexHome, "agents", `${agentName}.toml`));
+ const config = await readFile25(configPath, "utf8");
+ return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join56(codexHome, "agents", `${agentName}.toml`));
}
async function readInstalledAgentManifest(manifestPath) {
if (!await exists6(manifestPath))
return [];
- const parsed = JSON.parse(await readFile24(manifestPath, "utf8"));
+ const parsed = JSON.parse(await readFile25(manifestPath, "utf8"));
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.agents))
return [];
return parsed.agents.filter((path) => typeof path === "string");
}
async function removeManifestListedAgentLinks(codexHome, paths) {
- const agentsDir = join55(codexHome, "agents");
+ const agentsDir = join56(codexHome, "agents");
const removed = [];
const skipped = [];
for (const path of paths) {
@@ -93160,7 +93248,7 @@ async function removeManifestListedAgentLinks(codexHome, paths) {
skipped.push(path);
continue;
}
- await rm12(path, { force: true });
+ await rm13(path, { force: true });
removed.push(path);
}
return { removed, skipped };
@@ -93181,7 +93269,7 @@ async function exists6(path) {
}
async function maybeLstat2(path) {
try {
- return await lstat14(path);
+ return await lstat15(path);
} catch (error) {
if (nodeErrorCode6(error) === "ENOENT")
return null;
@@ -93197,14 +93285,14 @@ function nodeErrorCode6(error) {
import { execFile as execFile3 } from "child_process";
import { existsSync as existsSync30 } from "fs";
import { homedir as homedir11 } from "os";
-import { dirname as dirname24, join as join60, resolve as resolve19 } from "path";
+import { dirname as dirname24, join as join61, resolve as resolve19 } from "path";
import { fileURLToPath } from "url";
import { promisify as promisify2 } from "util";
// packages/omo-senpi/src/components/agent-home/resolve-agent-home.ts
import { existsSync as existsSync28 } from "fs";
import { homedir as homedir9 } from "os";
-import { join as join56, resolve as resolve16 } from "path";
+import { join as join57, resolve as resolve16 } from "path";
var AGENT_DIR_ENV_NAMES = [
"OMO_CODING_AGENT_DIR",
"SENPI_CODING_AGENT_DIR",
@@ -93218,25 +93306,25 @@ function resolveAgentHome(options) {
if (configured)
return resolve16(configured);
}
- const brandedHome = join56(homeDir, ".omo");
- const canonical = join56(brandedHome, "agent");
- if (exists(join56(canonical, AGENT_HOME_SENTINEL)))
+ const brandedHome = join57(homeDir, ".omo");
+ const canonical = join57(brandedHome, "agent");
+ if (exists(join57(canonical, AGENT_HOME_SENTINEL)))
return canonical;
- if (exists(join56(brandedHome, AGENT_HOME_SENTINEL)))
+ if (exists(join57(brandedHome, AGENT_HOME_SENTINEL)))
return brandedHome;
- return join56(homeDir, ".senpi", "agent");
+ return join57(homeDir, ".senpi", "agent");
}
// packages/omo-senpi/src/install/local-launcher.ts
import { chmodSync as chmodSync3, existsSync as existsSync29, mkdirSync as mkdirSync10, readFileSync as readFileSync13, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "fs";
import { homedir as homedir10 } from "os";
-import { dirname as dirname21, join as join57, resolve as resolve17 } from "path";
+import { dirname as dirname21, join as join58, resolve as resolve17 } from "path";
var MARKER = "omo-local-launcher";
function localLauncherPath(homeDir = homedir10()) {
- return join57(homeDir, ".local", "bin", "omo");
+ return join58(homeDir, ".local", "bin", "omo");
}
function localLauncherCmdPath(homeDir = homedir10()) {
- return join57(homeDir, ".local", "bin", "omo.cmd");
+ return join58(homeDir, ".local", "bin", "omo.cmd");
}
function renderLocalLauncher(options) {
const brand = {
@@ -93249,7 +93337,7 @@ function renderLocalLauncher(options) {
userAgent: "omo",
originator: "omo",
changelog: {
- path: join57(options.pluginPath, "CHANGELOG.md").replaceAll("\\", "/")
+ path: join58(options.pluginPath, "CHANGELOG.md").replaceAll("\\", "/")
},
update: {
packageName: "omo-ai",
@@ -93316,10 +93404,10 @@ node "%~dp0omo" %*\r
}
// packages/omo-senpi/src/install/plugin-artifacts.ts
-import { createHash as createHash5 } from "crypto";
+import { createHash as createHash6 } from "crypto";
import { constants as constants9 } from "fs";
-import { access as access2, readFile as readFile26, stat as stat6 } from "fs/promises";
-import { dirname as dirname23, join as join59 } from "path";
+import { access as access2, readFile as readFile27, stat as stat6 } from "fs/promises";
+import { dirname as dirname23, join as join60 } from "path";
// packages/memory-core/src/personas/manifest.ts
var PERSONA_ASSET_FILENAMES = {
@@ -93337,18 +93425,18 @@ var PERSONA_ASSET_FILES = [
// packages/omo-senpi/src/install/senpi-settings.ts
import { constants as constants8 } from "fs";
-import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile25, rename as rename5, writeFile as writeFile14 } from "fs/promises";
-import { basename as basename9, dirname as dirname22, join as join58, resolve as resolve18 } from "path";
+import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile26, rename as rename5, writeFile as writeFile14 } from "fs/promises";
+import { basename as basename9, dirname as dirname22, join as join59, resolve as resolve18 } from "path";
var OMO_SENPI_PACKAGE_NAME = "@code-yeongyu/omo-senpi";
var GENERATED_PLUGIN_BASENAME = /^omo-senpi-cli-plugin-[A-Za-z0-9]{6}$/;
var LEGACY_BUILTIN_SHADOW_PACKAGES = [
- join58("packages", "pi-goal"),
- join58("packages", "pi-webfetch")
+ join59("packages", "pi-goal"),
+ join59("packages", "pi-webfetch")
];
async function readSettings(settingsPath) {
let raw;
try {
- raw = await readFile25(settingsPath, "utf8");
+ raw = await readFile26(settingsPath, "utf8");
} catch (error) {
if (isErrno(error, "ENOENT"))
return {};
@@ -93422,7 +93510,7 @@ function isRecord13(value) {
async function readPackageName(packagePath) {
let raw;
try {
- raw = await readFile25(join58(packagePath, "package.json"), "utf8");
+ raw = await readFile26(join59(packagePath, "package.json"), "utf8");
} catch (error) {
if (isErrno(error, "ENOENT") || isErrno(error, "ENOTDIR"))
return;
@@ -93454,50 +93542,50 @@ function isErrno(error, code) {
// packages/omo-senpi/src/install/plugin-artifacts.ts
var REQUIRED_PLUGIN_ARTIFACTS = [
- join59("extensions", "omo.js"),
- join59("extensions", "omo-task.js"),
- join59("extensions", "omo-member.js"),
- join59("extensions", "omo-agent-toolkit.js"),
- join59("extensions", "memory-run-supervisor.mjs"),
- ...PERSONA_ASSET_FILES.map((filename) => join59("extensions", filename)),
- join59("skills", "ast-grep", "SKILL.md"),
- join59("skills", "coding-agent-sessions", "SKILL.md"),
- join59("skills", "debugging", "SKILL.md"),
- join59("skills", "frontend", "SKILL.md"),
- join59("skills", "git-master", "SKILL.md"),
- join59("skills", "init-deep", "SKILL.md"),
- join59("skills", "lsp-setup", "SKILL.md"),
- join59("skills", "programming", "SKILL.md"),
- join59("skills", "refactor", "SKILL.md"),
- join59("skills", "remove-ai-slops", "SKILL.md"),
- join59("skills", "review-work", "SKILL.md"),
- join59("skills", "ultimate-browsing", "SKILL.md"),
- join59("skills", "ultrawork", "SKILL.md"),
- join59("skills", "ulw-execute", "SKILL.md"),
- join59("skills", "ulw-loop", "SKILL.md"),
- join59("skills", "ulw-plan", "SKILL.md"),
- join59("skills", "ulw-research", "SKILL.md"),
- join59("skills", "visual-qa", "SKILL.md"),
- join59("skills-conditional", "x-search", "SKILL.md"),
- join59("runtime", "ast-grep-mcp", "cli.js"),
- join59("runtime", "lsp-daemon", "dist", "cli.js"),
- join59("runtime", "lsp-daemon", "dist", "index.js"),
- join59("runtime", "lsp-daemon", "dist", "index.d.ts"),
- join59("runtime", "lsp-daemon", "dist", "daemon-client.js"),
- join59("runtime", "lsp-daemon", "dist", "daemon-client.d.ts"),
- join59("runtime", "lsp-daemon", "dist", "package.json"),
- join59("runtime", "lsp-daemon", "dist", ".omo-runtime-manifest.json"),
- join59("scripts", "install.mjs")
+ join60("extensions", "omo.js"),
+ join60("extensions", "omo-task.js"),
+ join60("extensions", "omo-member.js"),
+ join60("extensions", "omo-agent-toolkit.js"),
+ join60("extensions", "memory-run-supervisor.mjs"),
+ ...PERSONA_ASSET_FILES.map((filename) => join60("extensions", filename)),
+ join60("skills", "ast-grep", "SKILL.md"),
+ join60("skills", "coding-agent-sessions", "SKILL.md"),
+ join60("skills", "debugging", "SKILL.md"),
+ join60("skills", "frontend", "SKILL.md"),
+ join60("skills", "git-master", "SKILL.md"),
+ join60("skills", "init-deep", "SKILL.md"),
+ join60("skills", "lsp-setup", "SKILL.md"),
+ join60("skills", "programming", "SKILL.md"),
+ join60("skills", "refactor", "SKILL.md"),
+ join60("skills", "remove-ai-slops", "SKILL.md"),
+ join60("skills", "review-work", "SKILL.md"),
+ join60("skills", "ultimate-browsing", "SKILL.md"),
+ join60("skills", "ultrawork", "SKILL.md"),
+ join60("skills", "ulw-execute", "SKILL.md"),
+ join60("skills", "ulw-loop", "SKILL.md"),
+ join60("skills", "ulw-plan", "SKILL.md"),
+ join60("skills", "ulw-research", "SKILL.md"),
+ join60("skills", "visual-qa", "SKILL.md"),
+ join60("skills-conditional", "x-search", "SKILL.md"),
+ join60("runtime", "ast-grep-mcp", "cli.js"),
+ join60("runtime", "lsp-daemon", "dist", "cli.js"),
+ join60("runtime", "lsp-daemon", "dist", "index.js"),
+ join60("runtime", "lsp-daemon", "dist", "index.d.ts"),
+ join60("runtime", "lsp-daemon", "dist", "daemon-client.js"),
+ join60("runtime", "lsp-daemon", "dist", "daemon-client.d.ts"),
+ join60("runtime", "lsp-daemon", "dist", "package.json"),
+ join60("runtime", "lsp-daemon", "dist", ".omo-runtime-manifest.json"),
+ join60("scripts", "install.mjs")
];
async function ensurePluginArtifacts(context) {
if (context.allowBuild) {
- await context.runCommand("node", [join59(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
- await context.runCommand("node", [join59("packages", "omo-codex", "plugin", "scripts", "materialize-shared-upstreams.mjs")], { cwd: context.repoRoot });
- await context.runCommand("node", [join59(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
- await context.runCommand("node", [join59(context.pluginPath, "scripts", "build-install.mjs")], { cwd: context.repoRoot });
- await context.runCommand("node", [join59(context.pluginPath, "scripts", "stage-lsp-daemon-runtime.mjs")], { cwd: context.repoRoot });
- await context.runCommand("node", [join59(context.pluginPath, "scripts", "stage-ast-grep-mcp-runtime.mjs")], { cwd: context.repoRoot });
- await context.runCommand("node", [join59(context.pluginPath, "scripts", "stage-x-search-skill.mjs")], { cwd: context.repoRoot });
+ await context.runCommand("node", [join60(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
+ await context.runCommand("node", [join60("packages", "omo-codex", "plugin", "scripts", "materialize-shared-upstreams.mjs")], { cwd: context.repoRoot });
+ await context.runCommand("node", [join60(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
+ await context.runCommand("node", [join60(context.pluginPath, "scripts", "build-install.mjs")], { cwd: context.repoRoot });
+ await context.runCommand("node", [join60(context.pluginPath, "scripts", "stage-lsp-daemon-runtime.mjs")], { cwd: context.repoRoot });
+ await context.runCommand("node", [join60(context.pluginPath, "scripts", "stage-ast-grep-mcp-runtime.mjs")], { cwd: context.repoRoot });
+ await context.runCommand("node", [join60(context.pluginPath, "scripts", "stage-x-search-skill.mjs")], { cwd: context.repoRoot });
}
if (await hasMissingPluginArtifact(context.pluginPath)) {
throw new Error(`Packed omo-senpi plugin is missing required runtime artifacts at ${context.pluginPath}`);
@@ -93506,14 +93594,14 @@ async function ensurePluginArtifacts(context) {
}
async function hasMissingPluginArtifact(pluginPath) {
for (const artifact of REQUIRED_PLUGIN_ARTIFACTS) {
- if (!await fileExists2(join59(pluginPath, artifact)))
+ if (!await fileExists2(join60(pluginPath, artifact)))
return true;
}
return false;
}
async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
- const runtimeEntry = join59(pluginPath, "runtime", "ast-grep-mcp", "cli.js");
- const manifestPath = join59(dirname23(runtimeEntry), "manifest.json");
+ const runtimeEntry = join60(pluginPath, "runtime", "ast-grep-mcp", "cli.js");
+ const manifestPath = join60(dirname23(runtimeEntry), "manifest.json");
let runtimeStat;
try {
runtimeStat = await stat6(runtimeEntry);
@@ -93528,7 +93616,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
}
let manifest;
try {
- manifest = JSON.parse(await readFile26(manifestPath, "utf8"));
+ manifest = JSON.parse(await readFile27(manifestPath, "utf8"));
} catch (error) {
throw astGrepIntegrityError(runtimeEntry, `manifest is unreadable or invalid JSON: ${messageOf(error)}`);
}
@@ -93537,7 +93625,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
}
let actualSha256;
try {
- actualSha256 = createHash5("sha256").update(await readFile26(runtimeEntry)).digest("hex");
+ actualSha256 = createHash6("sha256").update(await readFile27(runtimeEntry)).digest("hex");
} catch (error) {
throw astGrepIntegrityError(runtimeEntry, `runtime hash could not be computed: ${messageOf(error)}`);
}
@@ -93588,7 +93676,7 @@ async function runSenpiInstaller(options = {}) {
const backupPath = await writeSettingsAtomically(context.settingsPath, settings);
const launcherPath = installLocalLauncher({
pluginPath: context.pluginPath,
- senpiCliPath: join60(context.repoRoot, "packages", "coding-agent", "dist", "cli.js"),
+ senpiCliPath: join61(context.repoRoot, "packages", "coding-agent", "dist", "cli.js"),
homeDir: context.homeDir
});
return {
@@ -93608,13 +93696,13 @@ function resolveInstallContext(options) {
const repoRoot = resolve19(options.repoRoot ?? (allowBuild ? findRepoRoot2(dirname24(fileURLToPath(import.meta.url))) : dirname24(resolve19(options.pluginPath))));
const homeDir = options.homeDir ?? env.HOME ?? homedir11();
const agentDir = resolve19(options.agentDir ?? resolveAgentHome({ env, homeDir }));
- const pluginPath = resolve19(options.pluginPath ?? join60(repoRoot, "packages", "omo-senpi", "plugin"));
+ const pluginPath = resolve19(options.pluginPath ?? join61(repoRoot, "packages", "omo-senpi", "plugin"));
return {
env,
repoRoot,
agentDir,
homeDir,
- settingsPath: join60(agentDir, "settings.json"),
+ settingsPath: join61(agentDir, "settings.json"),
pluginPath,
platform: options.platform ?? process.platform,
allowBuild,
@@ -93631,7 +93719,7 @@ async function defaultRunCommand3(command, args, options) {
function findRepoRoot2(importerDir) {
let current = importerDir;
for (let depth = 0;depth <= 7; depth += 1) {
- if (fileExistsSync(join60(current, "packages", "omo-senpi", "plugin", "package.json")))
+ if (fileExistsSync(join61(current, "packages", "omo-senpi", "plugin", "package.json")))
return current;
current = resolve19(current, "..");
}
@@ -93675,19 +93763,19 @@ init_provider_availability();
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
import { existsSync as existsSync32, mkdirSync as mkdirSync11, readFileSync as readFileSync15 } from "fs";
-import { join as join62 } from "path";
+import { join as join63 } from "path";
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
init_shared();
import { existsSync as existsSync31, readFileSync as readFileSync14 } from "fs";
-import { join as join61 } from "path";
+import { join as join62 } from "path";
var TUI_SUBPATH = "tui";
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
function fileEntryPackageJsonPath(entry) {
let path = entry.slice("file:".length);
if (path.startsWith("//"))
path = path.slice(2);
- return join61(path, "package.json");
+ return join62(path, "package.json");
}
function packageJsonExportsTui(pkgJsonPath) {
if (!existsSync31(pkgJsonPath))
@@ -93725,7 +93813,7 @@ function packageExportsTuiForServerEntry(entry) {
const packageName = packageNameFromServerEntry(entry);
if (packageName === null)
return null;
- return packageJsonExportsTui(join61(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
+ return packageJsonExportsTui(join62(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
}
function isOurFilePluginEntry(entry) {
if (typeof entry !== "string" || !entry.startsWith("file:"))
@@ -93790,7 +93878,7 @@ function detectServerPluginRegistration() {
}
}
function detectTuiPluginRegistration() {
- const tuiJsonPath = join61(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
+ const tuiJsonPath = join62(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
if (!existsSync31(tuiJsonPath)) {
return {
registered: false,
@@ -93946,10 +94034,10 @@ function readConfig(path) {
return null;
}
function readServerConfig(configDir) {
- const jsoncPath = join62(configDir, "opencode.jsonc");
+ const jsoncPath = join63(configDir, "opencode.jsonc");
if (existsSync32(jsoncPath))
return readConfig(jsoncPath);
- const jsonPath = join62(configDir, "opencode.json");
+ const jsonPath = join63(configDir, "opencode.json");
if (existsSync32(jsonPath))
return readConfig(jsonPath);
return null;
@@ -93991,7 +94079,7 @@ function ensureTuiPluginEntry(opts = {}) {
if (!desiredEntry) {
return { changed: false, reason: "no-server-entry" };
}
- const tuiJsonPath = join62(configDir, "tui.json");
+ const tuiJsonPath = join63(configDir, "tui.json");
const { config, malformed } = readTuiConfig(tuiJsonPath);
if (malformed) {
return { changed: false, reason: "malformed" };
@@ -94007,7 +94095,7 @@ function ensureTuiPluginEntry(opts = {}) {
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
import { homedir as homedir12 } from "os";
-import { join as join63 } from "path";
+import { join as join64 } from "path";
// packages/shared-skills/index.mjs
import { existsSync as existsSync33 } from "fs";
@@ -94029,9 +94117,9 @@ function describeResult2(result) {
}
async function installAstGrepForOpenCode(options = {}) {
const platform = options.platform ?? process.platform;
- const baseDir = join63(options.homeDir ?? homedir12(), ".omo");
+ const baseDir = join64(options.homeDir ?? homedir12(), ".omo");
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
- const skillDir = join63(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
+ const skillDir = join64(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
const installer = options.installer ?? runAstGrepSkillInstall;
try {
const result = await installer({ platform, skillDir, targetDir });
@@ -98252,9 +98340,9 @@ function readCurrentTopLevelTask(planPath) {
}
// packages/boulder-state/src/storage/path.ts
import { existsSync as existsSync35 } from "fs";
-import { isAbsolute as isAbsolute12, join as join64, relative as relative8, resolve as resolve20 } from "path";
+import { isAbsolute as isAbsolute12, join as join65, relative as relative8, resolve as resolve20 } from "path";
function getBoulderFilePath(directory) {
- return join64(directory, BOULDER_DIR, BOULDER_FILE);
+ return join65(directory, BOULDER_DIR, BOULDER_FILE);
}
function resolveTrackedPath(baseDirectory, trackedPath) {
return isAbsolute12(trackedPath) ? resolve20(trackedPath) : resolve20(baseDirectory, trackedPath);
@@ -98437,9 +98525,9 @@ init_state();
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
import { existsSync as existsSync38, mkdirSync as mkdirSync12, readFileSync as readFileSync19, rmSync as rmSync3, writeFileSync as writeFileSync7 } from "fs";
-import { join as join65 } from "path";
+import { join as join66 } from "path";
function getMarkerPath(directory, sessionID) {
- return join65(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
+ return join66(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
}
function readContinuationMarker(directory, sessionID) {
const markerPath = getMarkerPath(directory, sessionID);
@@ -98512,7 +98600,7 @@ async function isSessionInBoulderLineage(input) {
init_shared();
init_compaction_marker();
import { readFileSync as readFileSync20, readdirSync as readdirSync8 } from "fs";
-import { join as join66 } from "path";
+import { join as join67 } from "path";
var defaultSessionLastAgentDeps = {
getMessageDir,
isSqliteBackend,
@@ -98572,7 +98660,7 @@ async function getLastAgentFromSession(sessionID, client, deps = {}) {
try {
const messages = readdirSync8(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
try {
- const content = readFileSync20(join66(messageDir, fileName), "utf-8");
+ const content = readFileSync20(join67(messageDir, fileName), "utf-8");
const parsed = JSON.parse(content);
return {
fileName,
@@ -98616,7 +98704,7 @@ init_agent_display_names();
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
init_frontmatter2();
import { existsSync as existsSync39, readFileSync as readFileSync21, writeFileSync as writeFileSync8, unlinkSync as unlinkSync6, mkdirSync as mkdirSync13 } from "fs";
-import { dirname as dirname26, join as join67 } from "path";
+import { dirname as dirname26, join as join68 } from "path";
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
@@ -98625,7 +98713,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
function getStateFilePath(directory, customPath) {
- return customPath ? join67(directory, customPath) : join67(directory, DEFAULT_STATE_FILE);
+ return customPath ? join68(directory, customPath) : join68(directory, DEFAULT_STATE_FILE);
}
function readState(directory, customPath) {
const filePath = getStateFilePath(directory, customPath);
@@ -99732,7 +99820,7 @@ init_extract_semver();
init_bun_which_shim();
import { existsSync as existsSync47, accessSync as accessSync4, constants as constants12 } from "fs";
import { homedir as homedir15 } from "os";
-import { join as join74 } from "path";
+import { join as join75 } from "path";
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
init_spawn_with_windows_hide();
@@ -99824,17 +99912,17 @@ function getDesktopAppPaths(platform) {
case "darwin":
return [
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
- join74(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
+ join75(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
];
case "win32": {
const programFiles = process.env.ProgramFiles;
const localAppData = process.env.LOCALAPPDATA;
const paths = [];
if (programFiles) {
- paths.push(join74(programFiles, "OpenCode", "OpenCode.exe"));
+ paths.push(join75(programFiles, "OpenCode", "OpenCode.exe"));
}
if (localAppData) {
- paths.push(join74(localAppData, "OpenCode", "OpenCode.exe"));
+ paths.push(join75(localAppData, "OpenCode", "OpenCode.exe"));
}
return paths;
}
@@ -99842,8 +99930,8 @@ function getDesktopAppPaths(platform) {
return [
"/usr/bin/opencode",
"/usr/lib/opencode/opencode",
- join74(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
- join74(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
+ join75(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
+ join75(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
];
default:
return [];
@@ -99875,7 +99963,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
const candidates = getCommandCandidates2(platform);
for (const entry of pathEnv.split(delimiter).filter(Boolean)) {
for (const command of candidates) {
- const fullPath = join74(entry, command);
+ const fullPath = join75(entry, command);
if (checkExists(fullPath) && isExecutable2(fullPath)) {
return { binary: command, path: fullPath };
}
@@ -100019,22 +100107,22 @@ init_package_json_locator();
import { existsSync as existsSync49, readFileSync as readFileSync30, readdirSync as readdirSync10 } from "fs";
import { createRequire } from "module";
import { homedir as homedir16 } from "os";
-import { join as join75 } from "path";
+import { join as join76 } from "path";
import { fileURLToPath as fileURLToPath6 } from "url";
init_shared();
function getPlatformDefaultCacheDir(platform = process.platform) {
if (platform === "darwin")
- return join75(homedir16(), "Library", "Caches");
+ return join76(homedir16(), "Library", "Caches");
if (platform === "win32")
- return process.env.LOCALAPPDATA ?? join75(homedir16(), "AppData", "Local");
- return join75(homedir16(), ".cache");
+ return process.env.LOCALAPPDATA ?? join76(homedir16(), "AppData", "Local");
+ return join76(homedir16(), ".cache");
}
function resolveOpenCodeCacheDir() {
const xdgCacheHome = process.env.XDG_CACHE_HOME;
if (xdgCacheHome)
- return join75(xdgCacheHome, "opencode");
+ return join76(xdgCacheHome, "opencode");
const fromShared = getOpenCodeCacheDir();
- const platformDefault = join75(getPlatformDefaultCacheDir(), "opencode");
+ const platformDefault = join76(getPlatformDefaultCacheDir(), "opencode");
if (existsSync49(fromShared) || !existsSync49(platformDefault))
return fromShared;
return platformDefault;
@@ -100066,11 +100154,11 @@ function normalizeVersion(value) {
function createPackageCandidates(rootDir) {
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
packageName,
- installedPackagePath: join75(rootDir, "node_modules", packageName, "package.json")
+ installedPackagePath: join76(rootDir, "node_modules", packageName, "package.json")
}));
}
function createTaggedInstallCandidates(rootDir) {
- const packagesDir = join75(rootDir, "packages");
+ const packagesDir = join76(rootDir, "packages");
if (!existsSync49(packagesDir))
return [];
const candidates = [];
@@ -100078,14 +100166,14 @@ function createTaggedInstallCandidates(rootDir) {
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
if (packageName === undefined)
continue;
- const installDir = join75(packagesDir, entryName);
+ const installDir = join76(packagesDir, entryName);
candidates.push({
cacheDir: installDir,
- cachePackagePath: join75(installDir, "package.json"),
+ cachePackagePath: join76(installDir, "package.json"),
packageCandidates: [
{
packageName,
- installedPackagePath: join75(installDir, "node_modules", packageName, "package.json")
+ installedPackagePath: join76(installDir, "node_modules", packageName, "package.json")
}
]
});
@@ -100130,13 +100218,13 @@ function getLoadedPluginVersion() {
const candidates = [
{
cacheDir: configDir,
- cachePackagePath: join75(configDir, "package.json"),
+ cachePackagePath: join76(configDir, "package.json"),
packageCandidates: createPackageCandidates(configDir)
},
...createTaggedInstallCandidates(configDir),
{
cacheDir,
- cachePackagePath: join75(cacheDir, "package.json"),
+ cachePackagePath: join76(cacheDir, "package.json"),
packageCandidates: createPackageCandidates(cacheDir)
},
...createTaggedInstallCandidates(cacheDir)
@@ -100330,18 +100418,18 @@ async function checkSystem(deps = defaultDeps5) {
init_shared();
import { existsSync as existsSync51, readFileSync as readFileSync32 } from "fs";
import { homedir as homedir17 } from "os";
-import { join as join76 } from "path";
+import { join as join77 } from "path";
function getUserConfigDir2() {
const xdgConfig = process.env.XDG_CONFIG_HOME;
if (xdgConfig)
- return join76(xdgConfig, "opencode");
- return join76(homedir17(), ".config", "opencode");
+ return join77(xdgConfig, "opencode");
+ return join77(homedir17(), ".config", "opencode");
}
function loadCustomProviderNames() {
const configDir = getUserConfigDir2();
const candidatePaths = [
- join76(configDir, "opencode.json"),
- join76(configDir, "opencode.jsonc")
+ join77(configDir, "opencode.json"),
+ join77(configDir, "opencode.jsonc")
];
for (const configPath of candidatePaths) {
if (!existsSync51(configPath))
@@ -100362,7 +100450,7 @@ function loadCustomProviderNames() {
return [];
}
function loadAvailableModelsFromCache() {
- const cacheFile = join76(getOpenCodeCacheDir(), "models.json");
+ const cacheFile = join77(getOpenCodeCacheDir(), "models.json");
const customProviders = loadCustomProviderNames();
if (!existsSync51(cacheFile)) {
if (customProviders.length > 0) {
@@ -100424,7 +100512,7 @@ function loadOmoConfig2() {
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
init_shared();
-import { join as join77 } from "path";
+import { join as join78 } from "path";
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
function formatModelWithVariant(model, variant) {
@@ -100466,7 +100554,7 @@ function formatCapabilityResolutionLabel(mode) {
}
function buildModelResolutionDetails(options) {
const details = [];
- const cacheFile = join77(getOpenCodeCacheDir(), "models.json");
+ const cacheFile = join78(getOpenCodeCacheDir(), "models.json");
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
details.push("");
if (options.available.cacheExists) {
@@ -100778,7 +100866,7 @@ init_src4();
init_main();
init_config_migration();
import { existsSync as existsSync52, readFileSync as readFileSync33 } from "fs";
-import { join as join78 } from "path";
+import { join as join79 } from "path";
var CANONICAL_REPLACEMENT = new Map([
["variant", "reasoning"],
["reasoningEffort", "reasoning"],
@@ -100839,7 +100927,7 @@ function userConfigPaths() {
const home = process.env.HOME ?? process.env.USERPROFILE;
if (home === undefined || home.length === 0)
return [];
- return [join78(home, ".omo", "omo.jsonc"), join78(home, ".omo", "omo.json")];
+ return [join79(home, ".omo", "omo.jsonc"), join79(home, ".omo", "omo.json")];
}
async function checkDeprecatedReasoningKeys() {
const issues = [];
@@ -100865,25 +100953,25 @@ init_src();
import { existsSync as existsSync53 } from "fs";
import { createRequire as createRequire2 } from "module";
import { homedir as homedir19 } from "os";
-import { dirname as dirname31, join as join80 } from "path";
+import { dirname as dirname31, join as join81 } from "path";
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
-import { join as join79 } from "path";
+import { join as join80 } from "path";
import { homedir as homedir18, tmpdir as tmpdir4 } from "os";
init_binary_downloader();
init_logger2();
init_plugin_identity();
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
-var DEBUG_FILE = join79(tmpdir4(), "comment-checker-debug.log");
+var DEBUG_FILE = join80(tmpdir4(), "comment-checker-debug.log");
function getCacheDir2() {
if (process.platform === "win32") {
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
- const base = localAppData || join79(homedir18(), "AppData", "Local");
- return join79(base, CACHE_DIR_NAME, "bin");
+ const base = localAppData || join80(homedir18(), "AppData", "Local");
+ return join80(base, CACHE_DIR_NAME, "bin");
}
const xdgCache = process.env.XDG_CACHE_HOME;
- const base = xdgCache || join79(homedir18(), ".cache");
- return join79(base, CACHE_DIR_NAME, "bin");
+ const base = xdgCache || join80(homedir18(), ".cache");
+ return join80(base, CACHE_DIR_NAME, "bin");
}
function getBinaryName() {
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
@@ -100933,7 +101021,7 @@ async function getBinaryVersion(binary) {
}
}
async function checkAstGrepCli() {
- const runtimeDir = astGrepRuntimeDir(join80(homedir19(), ".omo"));
+ const runtimeDir = astGrepRuntimeDir(join81(homedir19(), ".omo"));
const sgPath = findSgBinarySync({ runtimeDir });
if (sgPath === null) {
return {
@@ -100963,10 +101051,10 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
try {
const packageDir = baseDirOverride ?? dirname31(resolvePackageJsonPath());
- const vendorPath = join80(packageDir, "vendor", platformKey, binaryName);
+ const vendorPath = join81(packageDir, "vendor", platformKey, binaryName);
if (existsSync53(vendorPath))
return vendorPath;
- const binPath = join80(packageDir, "bin", binaryName);
+ const binPath = join81(packageDir, "bin", binaryName);
if (existsSync53(binPath))
return binPath;
} catch (error) {
@@ -101342,13 +101430,13 @@ function getInstalledLspServers(options = {}) {
init_shared();
import { existsSync as existsSync55, readFileSync as readFileSync35 } from "fs";
import { homedir as homedir20 } from "os";
-import { join as join81 } from "path";
+import { join as join82 } from "path";
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
function getMcpConfigPaths() {
return [
- join81(homedir20(), ".claude", ".mcp.json"),
- join81(process.cwd(), ".mcp.json"),
- join81(process.cwd(), ".claude", ".mcp.json")
+ join82(homedir20(), ".claude", ".mcp.json"),
+ join82(process.cwd(), ".mcp.json"),
+ join82(process.cwd(), ".claude", ".mcp.json")
];
}
function loadUserMcpConfig() {
@@ -101628,9 +101716,9 @@ async function pathExists(dir) {
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
init_src();
import { existsSync as existsSync57 } from "fs";
-import { lstat as lstat15, readdir as readdir14, readFile as readFile27 } from "fs/promises";
+import { lstat as lstat16, readdir as readdir14, readFile as readFile28 } from "fs/promises";
import { homedir as homedir22 } from "os";
-import { basename as basename11, join as join82, resolve as resolve23 } from "path";
+import { basename as basename11, join as join83, resolve as resolve23 } from "path";
// packages/omo-opencode/package.json
var package_default3 = {
name: "@oh-my-opencode/omo-opencode",
@@ -101696,13 +101784,13 @@ var CODEX_BIN_NAMES = [
"omo-git-bash-hook"
];
async function gatherCodexSummary(deps = {}) {
- const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ?? join82(homedir22(), ".codex"));
+ const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ?? join83(homedir22(), ".codex"));
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
- const manifest = pluginRoot === null ? null : await readJson(join82(pluginRoot, ".codex-plugin", "plugin.json"));
- const installSnapshot = pluginRoot === null ? null : await readJson(join82(pluginRoot, "lazycodex-install.json"));
- const configPath = join82(codexHome, "config.toml");
+ const manifest = pluginRoot === null ? null : await readJson(join83(pluginRoot, ".codex-plugin", "plugin.json"));
+ const installSnapshot = pluginRoot === null ? null : await readJson(join83(pluginRoot, "lazycodex-install.json"));
+ const configPath = join83(codexHome, "config.toml");
const pluginVersion = stringField(manifest, "version");
return {
codexPath: detection.found && "path" in detection ? detection.path : null,
@@ -101759,7 +101847,7 @@ function buildCodexIssues(summary) {
if (summary.pluginRoot === null) {
issues.push({
title: "OMO Codex plugin is not installed",
- description: `Expected cached plugin at ${join82("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
+ description: `Expected cached plugin at ${join83("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
fix: "Run: npx lazycodex-ai install",
severity: "error",
affects: ["plugin loading"]
@@ -101824,12 +101912,12 @@ function buildCodexIssues(summary) {
return issues;
}
async function resolveInstalledPluginRoot(codexHome) {
- const pluginRoot = join82(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
+ const pluginRoot = join83(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
if (!existsSync57(pluginRoot))
return null;
const versions = await readdir14(pluginRoot, { withFileTypes: true });
const candidates = versions.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
- return candidates.length === 0 ? null : join82(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
+ return candidates.length === 0 ? null : join83(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
}
async function readCodexConfigSummary(configPath) {
if (!existsSync57(configPath)) {
@@ -101843,7 +101931,7 @@ async function readCodexConfigSummary(configPath) {
companionLifecycleHookStateEvents: []
};
}
- const content = await readFile27(configPath, "utf8");
+ const content = await readFile28(configPath, "utf8");
return {
exists: true,
marketplaceConfigured: content.includes("[marketplaces.sisyphuslabs]"),
@@ -101857,13 +101945,13 @@ async function readCodexConfigSummary(configPath) {
async function readLinkedBins(binDir) {
const linked = [];
for (const name of CODEX_BIN_NAMES) {
- if (await pathExists2(join82(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
+ if (await pathExists2(join83(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
linked.push(name);
}
return linked;
}
async function readLinkedAgents(codexHome) {
- const agentsDir = join82(codexHome, "agents");
+ const agentsDir = join83(codexHome, "agents");
if (!existsSync57(agentsDir))
return [];
const entries = await readdir14(agentsDir, { withFileTypes: true });
@@ -101871,7 +101959,7 @@ async function readLinkedAgents(codexHome) {
}
async function readJson(path) {
try {
- const parsed = JSON.parse(await readFile27(path, "utf8"));
+ const parsed = JSON.parse(await readFile28(path, "utf8"));
return isPlainRecord(parsed) ? parsed : null;
} catch (error) {
if (error instanceof Error)
@@ -101966,7 +102054,7 @@ function compareVersionsDescending(left, right) {
}
async function pathExists2(path) {
try {
- await lstat15(path);
+ await lstat16(path);
return true;
} catch (error) {
if (error instanceof Error)
@@ -101995,9 +102083,9 @@ function resolveLatestVersion(input) {
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
init_src();
-import { readdir as readdir15, readFile as readFile28, stat as stat7 } from "fs/promises";
+import { readdir as readdir15, readFile as readFile29, stat as stat7 } from "fs/promises";
import { homedir as homedir23 } from "os";
-import { dirname as dirname33, isAbsolute as isAbsolute13, join as join83, relative as relative9, resolve as resolve24, sep as sep9 } from "path";
+import { dirname as dirname33, isAbsolute as isAbsolute13, join as join84, relative as relative9, resolve as resolve24, sep as sep9 } from "path";
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
@@ -102007,7 +102095,7 @@ async function checkCodexComponents(deps = {}) {
const env = deps.env ?? process.env;
const platform = deps.platform ?? process.platform;
const arch = deps.arch ?? process.arch;
- const codexHome = resolve24(deps.codexHome ?? env["CODEX_HOME"] ?? join83(homedir23(), ".codex"));
+ const codexHome = resolve24(deps.codexHome ?? env["CODEX_HOME"] ?? join84(homedir23(), ".codex"));
const summary = await gatherCodexSummary({ ...deps, codexHome });
if (summary.pluginRoot === null) {
return {
@@ -102032,7 +102120,7 @@ async function checkCodexComponents(deps = {}) {
});
}
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
- const runtimeSgPath = join83(runtimeSgDir, sgBinaryName(platform));
+ const runtimeSgPath = join84(runtimeSgDir, sgBinaryName(platform));
const sg = findSgBinarySync({
arch,
env,
@@ -102144,7 +102232,7 @@ async function findManifestPaths(root, manifestName) {
for (const entry of entries) {
if (entry.name === "node_modules" || entry.name === ".git")
continue;
- const entryPath = join83(root, entry.name);
+ const entryPath = join84(root, entry.name);
if (entry.isDirectory()) {
paths.push(...await findManifestPaths(entryPath, manifestName));
continue;
@@ -102188,18 +102276,18 @@ function isPluginRuntimePathArg(arg) {
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute13(arg));
}
function runtimeSgDirectory(codexHome, platform, arch) {
- return join83(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
+ return join84(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
}
function describeSgSource(sgPath, env, runtimeSgDir, platform) {
const override = env[SG_PATH_ENV_KEY]?.trim();
if (override !== undefined && override.length > 0 && sgPath === override)
return `env override ${SG_PATH_ENV_KEY}`;
- if (sgPath === join83(runtimeSgDir, sgBinaryName(platform)))
+ if (sgPath === join84(runtimeSgDir, sgBinaryName(platform)))
return "runtime dir";
return "PATH";
}
async function readBootstrapStateSummary(codexHome) {
- const statePath = join83(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
+ const statePath = join84(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
const raw = await readJson2(statePath);
if (raw === null)
return null;
@@ -102248,7 +102336,7 @@ function degradedDetailLines(entries) {
}
async function readJson2(path) {
try {
- const parsed = JSON.parse(await readFile28(path, "utf8"));
+ const parsed = JSON.parse(await readFile29(path, "utf8"));
return isRecord15(parsed) ? parsed : null;
} catch (error) {
if (error instanceof Error)
@@ -102276,18 +102364,18 @@ function isRecord15(value) {
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
import { existsSync as existsSync58 } from "fs";
-import { readFile as readFile29 } from "fs/promises";
+import { readFile as readFile30 } from "fs/promises";
import { homedir as homedir24 } from "os";
-import { join as join84, resolve as resolve25 } from "path";
+import { join as join85, resolve as resolve25 } from "path";
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
var CHECK_NAME = "codex-runtime-wrapper";
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
async function checkCodexRuntimeWrapper(deps = {}) {
- const codexHome = resolve25(deps.codexHome ?? process.env.CODEX_HOME ?? join84(homedir24(), ".codex"));
+ const codexHome = resolve25(deps.codexHome ?? process.env.CODEX_HOME ?? join85(homedir24(), ".codex"));
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
const platform = deps.platform ?? process.platform;
- const wrapperPath = join84(binDir, platform === "win32" ? "omo-agent-toolkit.cmd" : "omo-agent-toolkit");
- const legacyWrapperPath = join84(binDir, platform === "win32" ? "omo.cmd" : "omo");
+ const wrapperPath = join85(binDir, platform === "win32" ? "omo-agent-toolkit.cmd" : "omo-agent-toolkit");
+ const legacyWrapperPath = join85(binDir, platform === "win32" ? "omo.cmd" : "omo");
const [wrapper, legacyWrapper] = await Promise.all([readRuntimeWrapper(wrapperPath), readRuntimeWrapper(legacyWrapperPath)]);
const issues = [];
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
@@ -102321,7 +102409,7 @@ async function checkCodexRuntimeWrapper(deps = {}) {
}
async function readRuntimeWrapper(path) {
try {
- return await readFile29(path, "utf8");
+ return await readFile30(path, "utf8");
} catch (error) {
if (error instanceof Error)
return null;
@@ -102811,7 +102899,7 @@ Doctor failed unexpectedly: ${message}`];
}
// packages/mcp-client-core/src/mcp-oauth/storage.ts
-import { createHash as createHash6 } from "crypto";
+import { createHash as createHash7 } from "crypto";
import {
chmodSync as chmodSync5,
existsSync as existsSync61,
@@ -102822,12 +102910,12 @@ import {
unlinkSync as unlinkSync9,
writeFileSync as writeFileSync12
} from "fs";
-import { basename as basename12, dirname as dirname34, join as join87 } from "path";
+import { basename as basename12, dirname as dirname34, join as join88 } from "path";
// packages/mcp-client-core/src/config-dir.ts
import { existsSync as existsSync59, realpathSync as realpathSync8 } from "fs";
import { homedir as homedir25 } from "os";
-import { join as join85, resolve as resolve26 } from "path";
+import { join as join86, resolve as resolve26 } from "path";
function resolveConfigPath2(pathValue) {
const resolvedPath = resolve26(pathValue);
if (!existsSync59(resolvedPath))
@@ -102845,13 +102933,13 @@ function getOpenCodeCliConfigDir(env = process.env) {
if (customConfigDir) {
return resolveConfigPath2(customConfigDir);
}
- const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() || join85(homedir25(), ".config");
- return resolveConfigPath2(join85(xdgConfigDir, "opencode"));
+ const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() || join86(homedir25(), ".config");
+ return resolveConfigPath2(join86(xdgConfigDir, "opencode"));
}
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
import { chmodSync as chmodSync4, existsSync as existsSync60, readFileSync as readFileSync37, renameSync as renameSync6, writeFileSync as writeFileSync11 } from "fs";
-import { join as join86 } from "path";
+import { join as join87 } from "path";
var INDEX_FILE_NAME = "index.json";
function isTokenIndex(value) {
if (typeof value !== "object" || value === null || Array.isArray(value))
@@ -102859,7 +102947,7 @@ function isTokenIndex(value) {
return Object.values(value).every((entry) => typeof entry === "string");
}
function getIndexPath(storageDir) {
- return join86(storageDir, INDEX_FILE_NAME);
+ return join87(storageDir, INDEX_FILE_NAME);
}
function readTokenIndex(storageDir) {
const indexPath = getIndexPath(storageDir);
@@ -102903,16 +102991,16 @@ function deleteTokenIndexEntry(storageDir, hash) {
var STORAGE_DIR_NAME = "mcp-oauth";
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
function getMcpOauthStorageDir() {
- return join87(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
+ return join88(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
}
function getMcpOauthServerHash(serverHost, resource) {
- return createHash6("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
+ return createHash7("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
}
function getMcpOauthStoragePath(serverHost, resource) {
- return join87(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
+ return join88(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
}
function getLegacyStoragePath() {
- return join87(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
+ return join88(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
}
function normalizeHost2(serverHost) {
let host = serverHost.trim();
@@ -103091,7 +103179,7 @@ function listTokensByHost(serverHost) {
for (const [hash, indexedKey] of Object.entries(index)) {
if (!indexedKey.startsWith(prefix))
continue;
- const indexedToken = readTokenFile(join87(getMcpOauthStorageDir(), `${hash}.json`));
+ const indexedToken = readTokenFile(join88(getMcpOauthStorageDir(), `${hash}.json`));
if (indexedToken)
result[indexedKey] = indexedToken;
}
@@ -103106,7 +103194,7 @@ function listAllTokens() {
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
continue;
- const token = readTokenFile(join87(dir, entry.name));
+ const token = readTokenFile(join88(dir, entry.name));
const hash = basename12(entry.name, ".json");
if (token)
result[index[hash] ?? hash] = token;
@@ -103280,13 +103368,13 @@ async function findAvailablePort2(startPort = DEFAULT_PORT) {
// packages/mcp-client-core/src/mcp-oauth/oauth-authorization-flow.ts
import { spawn as spawn4 } from "child_process";
-import { createHash as createHash7, randomBytes as randomBytes2 } from "crypto";
+import { createHash as createHash8, randomBytes as randomBytes2 } from "crypto";
import { createServer as createServer2 } from "http";
function generateCodeVerifier() {
return randomBytes2(32).toString("base64url");
}
function generateCodeChallenge(verifier) {
- return createHash7("sha256").update(verifier).digest("base64url");
+ return createHash8("sha256").update(verifier).digest("base64url");
}
function buildAuthorizationUrl(authorizationEndpoint, options) {
const url = new URL(authorizationEndpoint);
diff --git a/plugins/omo/hooks/post-compact-resetting-git-bash-mcp-reminder.json b/plugins/omo/hooks/post-compact-resetting-git-bash-mcp-reminder.json
index cb46114a..a644c04a 100644
--- a/plugins/omo/hooks/post-compact-resetting-git-bash-mcp-reminder.json
+++ b/plugins/omo/hooks/post-compact-resetting-git-bash-mcp-reminder.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/git-bash/dist/cli.js\" hook post-compact",
"timeout": 5,
- "statusMessage": "(OmO 5.0.0-beta.60) Resetting Git Bash MCP Reminder",
+ "statusMessage": "(OmO 5.0.0-beta.62) Resetting Git Bash MCP Reminder",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\git-bash\\dist\\cli.js\" hook post-compact"
}
],
diff --git a/plugins/omo/hooks/post-compact-resetting-lsp-diagnostics-cache.json b/plugins/omo/hooks/post-compact-resetting-lsp-diagnostics-cache.json
index c6069c1e..4514e12f 100644
--- a/plugins/omo/hooks/post-compact-resetting-lsp-diagnostics-cache.json
+++ b/plugins/omo/hooks/post-compact-resetting-lsp-diagnostics-cache.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/lsp/dist/cli.js\" hook post-compact",
"timeout": 5,
- "statusMessage": "(OmO 5.0.0-beta.60) Resetting LSP Diagnostics Cache",
+ "statusMessage": "(OmO 5.0.0-beta.62) Resetting LSP Diagnostics Cache",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\lsp\\dist\\cli.js\" hook post-compact"
}
],
diff --git a/plugins/omo/hooks/post-compact-resetting-project-rule-cache.json b/plugins/omo/hooks/post-compact-resetting-project-rule-cache.json
index 51dcb50b..33104403 100644
--- a/plugins/omo/hooks/post-compact-resetting-project-rule-cache.json
+++ b/plugins/omo/hooks/post-compact-resetting-project-rule-cache.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/rules/dist/cli.js\" hook post-compact",
"timeout": 10,
- "statusMessage": "(OmO 5.0.0-beta.60) Resetting Project Rule Cache",
+ "statusMessage": "(OmO 5.0.0-beta.62) Resetting Project Rule Cache",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\rules\\dist\\cli.js\" hook post-compact"
}
],
diff --git a/plugins/omo/hooks/post-tool-use-checking-comments.json b/plugins/omo/hooks/post-tool-use-checking-comments.json
index dfbd1019..91bd8b90 100644
--- a/plugins/omo/hooks/post-tool-use-checking-comments.json
+++ b/plugins/omo/hooks/post-tool-use-checking-comments.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/comment-checker/dist/cli.js\" hook post-tool-use",
"timeout": 30,
- "statusMessage": "(OmO 5.0.0-beta.60) Checking Comments",
+ "statusMessage": "(OmO 5.0.0-beta.62) Checking Comments",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\comment-checker\\dist\\cli.js\" hook post-tool-use"
}
],
diff --git a/plugins/omo/hooks/post-tool-use-checking-lsp-diagnostics.json b/plugins/omo/hooks/post-tool-use-checking-lsp-diagnostics.json
index 1768ad01..534ea792 100644
--- a/plugins/omo/hooks/post-tool-use-checking-lsp-diagnostics.json
+++ b/plugins/omo/hooks/post-tool-use-checking-lsp-diagnostics.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/lsp/dist/cli.js\" hook post-tool-use",
"timeout": 60,
- "statusMessage": "(OmO 5.0.0-beta.60) Checking LSP Diagnostics",
+ "statusMessage": "(OmO 5.0.0-beta.62) Checking LSP Diagnostics",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\lsp\\dist\\cli.js\" hook post-tool-use"
}
],
diff --git a/plugins/omo/hooks/post-tool-use-checking-thread-title-hygiene.json b/plugins/omo/hooks/post-tool-use-checking-thread-title-hygiene.json
index a16ecc06..abff39a9 100644
--- a/plugins/omo/hooks/post-tool-use-checking-thread-title-hygiene.json
+++ b/plugins/omo/hooks/post-tool-use-checking-thread-title-hygiene.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/teammode/dist/cli.js\" hook post-tool-use",
"timeout": 10,
- "statusMessage": "(OmO 5.0.0-beta.60) Checking Thread Title Hygiene",
+ "statusMessage": "(OmO 5.0.0-beta.62) Checking Thread Title Hygiene",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\teammode\\dist\\cli.js\" hook post-tool-use"
}
]
diff --git a/plugins/omo/hooks/post-tool-use-matching-project-rules.json b/plugins/omo/hooks/post-tool-use-matching-project-rules.json
index 1ad29c25..a97cff24 100644
--- a/plugins/omo/hooks/post-tool-use-matching-project-rules.json
+++ b/plugins/omo/hooks/post-tool-use-matching-project-rules.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/rules/dist/cli.js\" hook post-tool-use",
"timeout": 10,
- "statusMessage": "(OmO 5.0.0-beta.60) Matching Project Rules",
+ "statusMessage": "(OmO 5.0.0-beta.62) Matching Project Rules",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\rules\\dist\\cli.js\" hook post-tool-use"
}
],
diff --git a/plugins/omo/hooks/post-tool-use-recording-spawn-admission.json b/plugins/omo/hooks/post-tool-use-recording-spawn-admission.json
index 2f1121de..67e94de9 100644
--- a/plugins/omo/hooks/post-tool-use-recording-spawn-admission.json
+++ b/plugins/omo/hooks/post-tool-use-recording-spawn-admission.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ulw-loop/dist/cli.js\" hook post-tool-use-spawn",
"timeout": 5,
- "statusMessage": "(OmO 5.0.0-beta.60) Recording Spawn Admission",
+ "statusMessage": "(OmO 5.0.0-beta.62) Recording Spawn Admission",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ulw-loop\\dist\\cli.js\" hook post-tool-use-spawn"
}
]
diff --git a/plugins/omo/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json b/plugins/omo/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json
index 54ea1983..2e247b2f 100644
--- a/plugins/omo/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json
+++ b/plugins/omo/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ulw-loop/dist/cli.js\" hook pre-tool-use",
"timeout": 5,
- "statusMessage": "(OmO 5.0.0-beta.60) Enforcing Unlimited Goal Budget",
+ "statusMessage": "(OmO 5.0.0-beta.62) Enforcing Unlimited Goal Budget",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ulw-loop\\dist\\cli.js\" hook pre-tool-use"
}
],
diff --git a/plugins/omo/hooks/pre-tool-use-guarding-ulw-loop-spawns.json b/plugins/omo/hooks/pre-tool-use-guarding-ulw-loop-spawns.json
index 1b432863..c26eba4b 100644
--- a/plugins/omo/hooks/pre-tool-use-guarding-ulw-loop-spawns.json
+++ b/plugins/omo/hooks/pre-tool-use-guarding-ulw-loop-spawns.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ulw-loop/dist/cli.js\" hook pre-tool-use-spawn",
"timeout": 5,
- "statusMessage": "(OmO 5.0.0-beta.60) Guarding Ulw-Loop Spawns",
+ "statusMessage": "(OmO 5.0.0-beta.62) Guarding Ulw-Loop Spawns",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ulw-loop\\dist\\cli.js\" hook pre-tool-use-spawn"
}
]
diff --git a/plugins/omo/hooks/pre-tool-use-recommending-git-bash-mcp.json b/plugins/omo/hooks/pre-tool-use-recommending-git-bash-mcp.json
index 8aa6e8ba..850d2034 100644
--- a/plugins/omo/hooks/pre-tool-use-recommending-git-bash-mcp.json
+++ b/plugins/omo/hooks/pre-tool-use-recommending-git-bash-mcp.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/git-bash/dist/cli.js\" hook pre-tool-use",
"timeout": 5,
- "statusMessage": "(OmO 5.0.0-beta.60) Recommending Git Bash MCP",
+ "statusMessage": "(OmO 5.0.0-beta.62) Recommending Git Bash MCP",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\git-bash\\dist\\cli.js\" hook pre-tool-use"
}
],
diff --git a/plugins/omo/hooks/session-start-checking-auto-update.json b/plugins/omo/hooks/session-start-checking-auto-update.json
index d2a5682f..0089721b 100644
--- a/plugins/omo/hooks/session-start-checking-auto-update.json
+++ b/plugins/omo/hooks/session-start-checking-auto-update.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/scripts/auto-update.mjs\" hook session-start",
"timeout": 15,
- "statusMessage": "(OmO 5.0.0-beta.60) Checking Auto Update",
+ "statusMessage": "(OmO 5.0.0-beta.62) Checking Auto Update",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\scripts\\auto-update.mjs\" hook session-start"
}
],
diff --git a/plugins/omo/hooks/session-start-checking-bootstrap-provisioning.json b/plugins/omo/hooks/session-start-checking-bootstrap-provisioning.json
index c17f5999..1f87fda6 100644
--- a/plugins/omo/hooks/session-start-checking-bootstrap-provisioning.json
+++ b/plugins/omo/hooks/session-start-checking-bootstrap-provisioning.json
@@ -8,7 +8,7 @@
"command": "node \"${PLUGIN_ROOT}/components/bootstrap/dist/cli.js\" hook session-start",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\bootstrap.ps1\"",
"timeout": 30,
- "statusMessage": "(OmO 5.0.0-beta.60) Checking Bootstrap Provisioning"
+ "statusMessage": "(OmO 5.0.0-beta.62) Checking Bootstrap Provisioning"
}
]
}
diff --git a/plugins/omo/hooks/session-start-loading-project-rules.json b/plugins/omo/hooks/session-start-loading-project-rules.json
index 7746d90b..c0328fc0 100644
--- a/plugins/omo/hooks/session-start-loading-project-rules.json
+++ b/plugins/omo/hooks/session-start-loading-project-rules.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/rules/dist/cli.js\" hook session-start",
"timeout": 10,
- "statusMessage": "(OmO 5.0.0-beta.60) Loading Project Rules",
+ "statusMessage": "(OmO 5.0.0-beta.62) Loading Project Rules",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\rules\\dist\\cli.js\" hook session-start"
}
]
diff --git a/plugins/omo/hooks/session-start-recording-session-telemetry.json b/plugins/omo/hooks/session-start-recording-session-telemetry.json
index 5c8ffa31..d1071e7a 100644
--- a/plugins/omo/hooks/session-start-recording-session-telemetry.json
+++ b/plugins/omo/hooks/session-start-recording-session-telemetry.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/telemetry/dist/cli.js\" hook session-start",
"timeout": 15,
- "statusMessage": "(OmO 5.0.0-beta.60) Recording Session Telemetry",
+ "statusMessage": "(OmO 5.0.0-beta.62) Recording Session Telemetry",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\telemetry\\dist\\cli.js\" hook session-start"
}
]
diff --git a/plugins/omo/hooks/stop-checking-ulw-execute-continuation.json b/plugins/omo/hooks/stop-checking-ulw-execute-continuation.json
index 983c5f96..6ede9e7d 100644
--- a/plugins/omo/hooks/stop-checking-ulw-execute-continuation.json
+++ b/plugins/omo/hooks/stop-checking-ulw-execute-continuation.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ulw-execute-continuation/dist/cli.js\" hook stop",
"timeout": 10,
- "statusMessage": "(OmO 5.0.0-beta.60) Checking Ulw-Execute Continuation",
+ "statusMessage": "(OmO 5.0.0-beta.62) Checking Ulw-Execute Continuation",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ulw-execute-continuation\\dist\\cli.js\" hook stop"
}
]
diff --git a/plugins/omo/hooks/stop-checking-ulw-loop-resume.json b/plugins/omo/hooks/stop-checking-ulw-loop-resume.json
index 70e77692..34479f4d 100644
--- a/plugins/omo/hooks/stop-checking-ulw-loop-resume.json
+++ b/plugins/omo/hooks/stop-checking-ulw-loop-resume.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ulw-loop/dist/cli.js\" hook stop",
"timeout": 10,
- "statusMessage": "(OmO 5.0.0-beta.60) Checking Ulw-Loop Resume",
+ "statusMessage": "(OmO 5.0.0-beta.62) Checking Ulw-Loop Resume",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ulw-loop\\dist\\cli.js\" hook stop"
}
]
diff --git a/plugins/omo/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json b/plugins/omo/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json
index dba62ba1..64024e32 100644
--- a/plugins/omo/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json
+++ b/plugins/omo/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/lazycodex-executor-verify/dist/cli.js\" hook subagent-stop",
"timeout": 10,
- "statusMessage": "(OmO 5.0.0-beta.60) Verifying LazyCodex Executor Evidence",
+ "statusMessage": "(OmO 5.0.0-beta.62) Verifying LazyCodex Executor Evidence",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\lazycodex-executor-verify\\dist\\cli.js\" hook subagent-stop"
}
],
diff --git a/plugins/omo/hooks/user-prompt-submit-checking-ultrawork-trigger.json b/plugins/omo/hooks/user-prompt-submit-checking-ultrawork-trigger.json
index 77b3a11f..2c59c568 100644
--- a/plugins/omo/hooks/user-prompt-submit-checking-ultrawork-trigger.json
+++ b/plugins/omo/hooks/user-prompt-submit-checking-ultrawork-trigger.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ultrawork/dist/cli.js\" hook user-prompt-submit",
"timeout": 5,
- "statusMessage": "(OmO 5.0.0-beta.60) Checking Ultrawork Trigger",
+ "statusMessage": "(OmO 5.0.0-beta.62) Checking Ultrawork Trigger",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ultrawork\\dist\\cli.js\" hook user-prompt-submit"
}
]
diff --git a/plugins/omo/hooks/user-prompt-submit-checking-ulw-loop-steering.json b/plugins/omo/hooks/user-prompt-submit-checking-ulw-loop-steering.json
index c75ab734..2c8fb922 100644
--- a/plugins/omo/hooks/user-prompt-submit-checking-ulw-loop-steering.json
+++ b/plugins/omo/hooks/user-prompt-submit-checking-ulw-loop-steering.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ulw-loop/dist/cli.js\" hook user-prompt-submit",
"timeout": 10,
- "statusMessage": "(OmO 5.0.0-beta.60) Checking Ulw-Loop Steering",
+ "statusMessage": "(OmO 5.0.0-beta.62) Checking Ulw-Loop Steering",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ulw-loop\\dist\\cli.js\" hook user-prompt-submit"
}
]
diff --git a/plugins/omo/hooks/user-prompt-submit-loading-project-rules.json b/plugins/omo/hooks/user-prompt-submit-loading-project-rules.json
index f010acc9..e1128d51 100644
--- a/plugins/omo/hooks/user-prompt-submit-loading-project-rules.json
+++ b/plugins/omo/hooks/user-prompt-submit-loading-project-rules.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/rules/dist/cli.js\" hook user-prompt-submit",
"timeout": 10,
- "statusMessage": "(OmO 5.0.0-beta.60) Loading Project Rules",
+ "statusMessage": "(OmO 5.0.0-beta.62) Loading Project Rules",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\rules\\dist\\cli.js\" hook user-prompt-submit"
}
]
diff --git a/plugins/omo/package-lock.json b/plugins/omo/package-lock.json
index b9bf11a4..ed04646d 100644
--- a/plugins/omo/package-lock.json
+++ b/plugins/omo/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@sisyphuslabs/omo-codex-plugin",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@sisyphuslabs/omo-codex-plugin",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"workspaces": [
"components/comment-checker",
"components/git-bash",
@@ -90,7 +90,7 @@
},
"components/comment-checker": {
"name": "@code-yeongyu/codex-comment-checker",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"license": "MIT",
"bin": {
"omo-comment-checker": "dist/cli.js"
@@ -111,7 +111,7 @@
},
"components/git-bash": {
"name": "@sisyphuslabs/codex-git-bash-hook",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"bin": {
"omo-git-bash-hook": "dist/cli.js"
},
@@ -125,7 +125,7 @@
},
"components/lazycodex-executor-verify": {
"name": "@code-yeongyu/codex-lazycodex-executor-verify",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"license": "MIT",
"bin": {
"lazycodex-executor-verify": "dist/cli.js"
@@ -142,7 +142,7 @@
},
"components/lsp": {
"name": "@code-yeongyu/codex-lsp",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"license": "MIT",
"dependencies": {
"@code-yeongyu/lsp-daemon": "file:../../../../lsp-daemon",
@@ -163,7 +163,7 @@
},
"components/rules": {
"name": "@code-yeongyu/codex-rules",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"license": "MIT",
"dependencies": {
"picomatch": "^4.0.7"
@@ -185,7 +185,7 @@
},
"components/teammode": {
"name": "@sisyphuslabs/codex-teammode",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"devDependencies": {
"@types/node": "^26.2.0",
"bun-types": "^1.4.2",
@@ -198,7 +198,7 @@
},
"components/telemetry": {
"name": "@code-yeongyu/codex-telemetry",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"license": "MIT",
"bin": {
"omo-telemetry": "dist/cli.js"
@@ -216,7 +216,7 @@
},
"components/ultrawork": {
"name": "@code-yeongyu/codex-ultrawork",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"license": "MIT",
"bin": {
"omo-ultrawork": "dist/cli.js"
@@ -234,7 +234,7 @@
},
"components/ulw-execute-continuation": {
"name": "@code-yeongyu/codex-ulw-execute-continuation",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"license": "MIT",
"bin": {
"omo-ulw-execute-continuation": "dist/cli.js"
@@ -251,7 +251,7 @@
},
"components/ulw-loop": {
"name": "@code-yeongyu/codex-ulw-loop",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"license": "MIT",
"bin": {
"omo-ulw-loop": "dist/cli.js",
diff --git a/plugins/omo/package.json b/plugins/omo/package.json
index b98d9c04..a42fa1e8 100644
--- a/plugins/omo/package.json
+++ b/plugins/omo/package.json
@@ -1,6 +1,6 @@
{
"name": "@sisyphuslabs/omo-codex-plugin",
- "version": "5.0.0-beta.60",
+ "version": "5.0.0-beta.62",
"description": "Aggregate Codex plugin root for OMO components.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/scripts/sync-skills.mjs b/plugins/omo/scripts/sync-skills.mjs
index d9e7b525..8ca1362f 100644
--- a/plugins/omo/scripts/sync-skills.mjs
+++ b/plugins/omo/scripts/sync-skills.mjs
@@ -51,13 +51,13 @@ This skill may include examples copied from the OpenCode harness. In Codex, do n
| \`call_omo_agent(subagent_type="librarian", ...)\` | \`multi_agent_v1.spawn_agent({"message":"TASK: act as a librarian. ...","agent_type":"librarian","fork_context":false})\` |
| \`task(subagent_type="plan", ...)\` | \`multi_agent_v1.spawn_agent({"message":"TASK: act as a planning agent. ...","agent_type":"plan","fork_context":false})\` |
| \`task(subagent_type="oracle", ...)\` for final verification | By default, record a self-review in the notepad: re-read the diff, run diagnostics, and capture evidence for every acceptance criterion. Only when the user demanded strict, rigorous, or high-accuracy review, use \`multi_agent_v1.spawn_agent({"message":"TASK: act as a rigorous reviewer. ...","agent_type":"lazycodex-gate-reviewer","fork_context":false})\`; include \`fork_context: false\`. |
-| \`task(category="...", ...)\` for implementation or QA | \`multi_agent_v1.spawn_agent({"message":"TASK: act as an implementation or QA worker. ...","fork_context":false})\` |
+| \`task(category="...", ...)\` for implementation or QA | \`multi_agent_v1.spawn_agent({"message":"TASK: act as an implementation or QA worker. ...","agent_type":"lazycodex-worker-medium","fork_context":false})\` |
| \`background_output(task_id="...")\` | \`multi_agent_v1.wait_agent(...)\` for mailbox signals |
| \`team_*(...)\` | Use Codex native subagents via \`multi_agent_v1.spawn_agent\` and \`multi_agent_v1.wait_agent\`; use \`multi_agent_v1.send_input\` and \`multi_agent_v1.close_agent\` only when exposed in the active tools list |
-Role-specific behavior must be described in a self-contained \`message\`. Use \`fork_context: false\` to start the child with only the initial prompt (no parent history); use \`fork_context: true\` only when full parent history is truly required. Include any required conversation context, files, diffs, constraints, and requested skill names directly in the spawned agent's \`message\`. OMO installs these selectable agent roles into \`~/.codex/agents/\`: \`explorer\`, \`librarian\`, \`plan\`, \`momus\`, \`metis\`, \`lazycodex-code-reviewer\`, \`lazycodex-qa-executor\`, and \`lazycodex-gate-reviewer\` - pass the matching name as \`agent_type\` so the child gets that role's model and instructions. If the spawn tool exposes no \`agent_type\` parameter, omit it and describe the role inside \`message\`. If a code block below conflicts with this section, this section wins.
+Role-specific behavior must be described in a self-contained \`message\`. Use \`fork_context: false\` to start the child with only the initial prompt (no parent history); use \`fork_context: true\` only when full parent history is truly required. Include any required conversation context, files, diffs, constraints, and requested skill names directly in the spawned agent's \`message\`. OMO installs these selectable agent roles into \`~/.codex/agents/\`: \`explorer\`, \`librarian\`, \`plan\`, \`momus\`, \`metis\`, \`lazycodex-code-reviewer\`, \`lazycodex-qa-executor\`, and \`lazycodex-gate-reviewer\` - pass the matching name as \`agent_type\` so the child gets that role's model and instructions. Inspect the actual spawn schema: whenever \`agent_type\` is exposed, EVERY spawn MUST select an exact LazyCodex role, on V1 or V2. Implementation difficulty selects \`lazycodex-worker-low\`, \`lazycodex-worker-medium\`, or \`lazycodex-worker-high\`; clone QA can select \`lazycodex-clone-fidelity-reviewer\`. Never select generic \`worker\` or \`default\`. If a code block below conflicts with this section, this section wins.
-Codex exposes ONE of two subagent tool surfaces per session; check your own tool list and route accordingly. If \`multi_agent_v1.*\` tools exist, use the table above as written. If instead a flat \`spawn_agent\` with a required \`task_name\` exists (\`multi_agent_v2\`), rewrite every \`multi_agent_v1.*\` example: \`multi_agent_v1.spawn_agent({...,"fork_context":false})\` becomes \`spawn_agent({"task_name":"<lowercase_digits_underscores>","message":...,"agent_type":...,"fork_turns":"none"})\` (\`"all"\` only when full parent history is truly required); \`send_input\` becomes \`send_message\`; do not call \`close_agent\`/\`resume_agent\` (finished agents end on their own; \`followup_task\` re-tasks one, \`interrupt_agent\` stops one); \`wait_agent\` takes only \`timeout_ms\` and returns on any child mailbox activity. On the v2 surface \`agent_type\` may be ABSENT from the spawn schema (verified 2026-07-11: only \`fork_turns\`/\`message\`/\`task_name\`) — when absent, omit it and describe the role inside \`message\`; installed role TOMLs cannot be selected on that surface. If a code block below conflicts with this section, this section wins. \`fork_context\` is rejected on \`multi_agent_v2\` (\`fork_context is not supported in MultiAgentV2; use fork_turns instead\`).
+Codex exposes ONE of two subagent tool surfaces per session; check your own tool list and route accordingly. If \`multi_agent_v1.*\` tools exist, use the table above as written. If instead a flat \`spawn_agent\` with a required \`task_name\` exists (\`multi_agent_v2\`), rewrite every \`multi_agent_v1.*\` example: \`multi_agent_v1.spawn_agent({...,"fork_context":false})\` becomes \`spawn_agent({"task_name":"<lowercase_digits_underscores>","message":...,"agent_type":...,"fork_turns":"none"})\` (\`"all"\` only when full parent history is truly required); \`send_input\` becomes \`send_message\`; do not call \`close_agent\`/\`resume_agent\` (finished agents end on their own; \`followup_task\` re-tasks one, \`interrupt_agent\` stops one); \`wait_agent\` takes only \`timeout_ms\` and returns on any child mailbox activity. Do not infer role support from V1/V2 or a model version. Legacy-schema exception: only if the actual schema lacks \`agent_type\`, omit that unsupported field and carry the complete role instructions in \`message\`, with history explicitly disabled. This cannot select a specialized TOML; an installed managed default supplies the medium worker for unnamed non-forks. The guard has no schema metadata and rejects unnamed calls, so report incompatible routing instead of retrying generically. Every deliberate full-history fork must still name its role: Codex skips role application on unnamed full-history forks, an upstream gap no LazyCodex default can repair. If a code block below conflicts with this section, this section wins. \`fork_context\` is rejected on \`multi_agent_v2\` (\`fork_context is not supported in MultiAgentV2; use fork_turns instead\`).
When translating \`load_skills=[...]\`, include the requested skill names in the spawned agent's \`message\`. If a code block below conflicts with this section, this section wins.
diff --git a/plugins/omo/skills/init-deep/SKILL.md b/plugins/omo/skills/init-deep/SKILL.md
index 23c84bd3..eee058a6 100644
--- a/plugins/omo/skills/init-deep/SKILL.md
+++ b/plugins/omo/skills/init-deep/SKILL.md
@@ -12,13 +12,13 @@ This skill may include examples copied from the OpenCode harness. In Codex, do n
| `call_omo_agent(subagent_type="librarian", ...)` | `multi_agent_v1.spawn_agent({"message":"TASK: act as a librarian. ...","agent_type":"librarian","fork_context":false})` |
| `task(subagent_type="plan", ...)` | `multi_agent_v1.spawn_agent({"message":"TASK: act as a planning agent. ...","agent_type":"plan","fork_context":false})` |
| `task(subagent_type="oracle", ...)` for final verification | By default, record a self-review in the notepad: re-read the diff, run diagnostics, and capture evidence for every acceptance criterion. Only when the user demanded strict, rigorous, or high-accuracy review, use `multi_agent_v1.spawn_agent({"message":"TASK: act as a rigorous reviewer. ...","agent_type":"lazycodex-gate-reviewer","fork_context":false})`; include `fork_context: false`. |
-| `task(category="...", ...)` for implementation or QA | `multi_agent_v1.spawn_agent({"message":"TASK: act as an implementation or QA worker. ...","fork_context":false})` |
+| `task(category="...", ...)` for implementation or QA | `multi_agent_v1.spawn_agent({"message":"TASK: act as an implementation or QA worker. ...","agent_type":"lazycodex-worker-medium","fork_context":false})` |
| `background_output(task_id="...")` | `multi_agent_v1.wait_agent(...)` for mailbox signals |
| `team_*(...)` | Use Codex native subagents via `multi_agent_v1.spawn_agent` and `multi_agent_v1.wait_agent`; use `multi_agent_v1.send_input` and `multi_agent_v1.close_agent` only when exposed in the active tools list |
-Role-specific behavior must be described in a self-contained `message`. Use `fork_context: false` to start the child with only the initial prompt (no parent history); use `fork_context: true` only when full parent history is truly required. Include any required conversation context, files, diffs, constraints, and requested skill names directly in the spawned agent's `message`. OMO installs these selectable agent roles into `~/.codex/agents/`: `explorer`, `librarian`, `plan`, `momus`, `metis`, `lazycodex-code-reviewer`, `lazycodex-qa-executor`, and `lazycodex-gate-reviewer` - pass the matching name as `agent_type` so the child gets that role's model and instructions. If the spawn tool exposes no `agent_type` parameter, omit it and describe the role inside `message`. If a code block below conflicts with this section, this section wins.
+Role-specific behavior must be described in a self-contained `message`. Use `fork_context: false` to start the child with only the initial prompt (no parent history); use `fork_context: true` only when full parent history is truly required. Include any required conversation context, files, diffs, constraints, and requested skill names directly in the spawned agent's `message`. OMO installs these selectable agent roles into `~/.codex/agents/`: `explorer`, `librarian`, `plan`, `momus`, `metis`, `lazycodex-code-reviewer`, `lazycodex-qa-executor`, and `lazycodex-gate-reviewer` - pass the matching name as `agent_type` so the child gets that role's model and instructions. Inspect the actual spawn schema: whenever `agent_type` is exposed, EVERY spawn MUST select an exact LazyCodex role, on V1 or V2. Implementation difficulty selects `lazycodex-worker-low`, `lazycodex-worker-medium`, or `lazycodex-worker-high`; clone QA can select `lazycodex-clone-fidelity-reviewer`. Never select generic `worker` or `default`. If a code block below conflicts with this section, this section wins.
-Codex exposes ONE of two subagent tool surfaces per session; check your own tool list and route accordingly. If `multi_agent_v1.*` tools exist, use the table above as written. If instead a flat `spawn_agent` with a required `task_name` exists (`multi_agent_v2`), rewrite every `multi_agent_v1.*` example: `multi_agent_v1.spawn_agent({...,"fork_context":false})` becomes `spawn_agent({"task_name":"<lowercase_digits_underscores>","message":...,"agent_type":...,"fork_turns":"none"})` (`"all"` only when full parent history is truly required); `send_input` becomes `send_message`; do not call `close_agent`/`resume_agent` (finished agents end on their own; `followup_task` re-tasks one, `interrupt_agent` stops one); `wait_agent` takes only `timeout_ms` and returns on any child mailbox activity. On the v2 surface `agent_type` may be ABSENT from the spawn schema (verified 2026-07-11: only `fork_turns`/`message`/`task_name`) — when absent, omit it and describe the role inside `message`; installed role TOMLs cannot be selected on that surface. If a code block below conflicts with this section, this section wins. `fork_context` is rejected on `multi_agent_v2` (`fork_context is not supported in MultiAgentV2; use fork_turns instead`).
+Codex exposes ONE of two subagent tool surfaces per session; check your own tool list and route accordingly. If `multi_agent_v1.*` tools exist, use the table above as written. If instead a flat `spawn_agent` with a required `task_name` exists (`multi_agent_v2`), rewrite every `multi_agent_v1.*` example: `multi_agent_v1.spawn_agent({...,"fork_context":false})` becomes `spawn_agent({"task_name":"<lowercase_digits_underscores>","message":...,"agent_type":...,"fork_turns":"none"})` (`"all"` only when full parent history is truly required); `send_input` becomes `send_message`; do not call `close_agent`/`resume_agent` (finished agents end on their own; `followup_task` re-tasks one, `interrupt_agent` stops one); `wait_agent` takes only `timeout_ms` and returns on any child mailbox activity. Do not infer role support from V1/V2 or a model version. Legacy-schema exception: only if the actual schema lacks `agent_type`, omit that unsupported field and carry the complete role instructions in `message`, with history explicitly disabled. This cannot select a specialized TOML; an installed managed default supplies the medium worker for unnamed non-forks. The guard has no schema metadata and rejects unnamed calls, so report incompatible routing instead of retrying generically. Every deliberate full-history fork must still name its role: Codex skips role application on unnamed full-history forks, an upstream gap no LazyCodex default can repair. If a code block below conflicts with this section, this section wins. `fork_context` is rejected on `multi_agent_v2` (`fork_context is not supported in MultiAgentV2; use fork_turns instead`).
When translating `load_skills=[...]`, include the requested skill names in the spawned agent's `message`. If a code block below conflicts with this section, this section wins.
diff --git a/plugins/omo/skills/refactor/SKILL.md b/plugins/omo/skills/refactor/SKILL.md
index b34c9da4..9f876e63 100644
--- a/plugins/omo/skills/refactor/SKILL.md
+++ b/plugins/omo/skills/refactor/SKILL.md
@@ -13,13 +13,13 @@ This skill may include examples copied from the OpenCode harness. In Codex, do n
| `call_omo_agent(subagent_type="librarian", ...)` | `multi_agent_v1.spawn_agent({"message":"TASK: act as a librarian. ...","agent_type":"librarian","fork_context":false})` |
| `task(subagent_type="plan", ...)` | `multi_agent_v1.spawn_agent({"message":"TASK: act as a planning agent. ...","agent_type":"plan","fork_context":false})` |
| `task(subagent_type="oracle", ...)` for final verification | By default, record a self-review in the notepad: re-read the diff, run diagnostics, and capture evidence for every acceptance criterion. Only when the user demanded strict, rigorous, or high-accuracy review, use `multi_agent_v1.spawn_agent({"message":"TASK: act as a rigorous reviewer. ...","agent_type":"lazycodex-gate-reviewer","fork_context":false})`; include `fork_context: false`. |
-| `task(category="...", ...)` for implementation or QA | `multi_agent_v1.spawn_agent({"message":"TASK: act as an implementation or QA worker. ...","fork_context":false})` |
+| `task(category="...", ...)` for implementation or QA | `multi_agent_v1.spawn_agent({"message":"TASK: act as an implementation or QA worker. ...","agent_type":"lazycodex-worker-medium","fork_context":false})` |
| `background_output(task_id="...")` | `multi_agent_v1.wait_agent(...)` for mailbox signals |
| `team_*(...)` | Use Codex native subagents via `multi_agent_v1.spawn_agent` and `multi_agent_v1.wait_agent`; use `multi_agent_v1.send_input` and `multi_agent_v1.close_agent` only when exposed in the active tools list |
-Role-specific behavior must be described in a self-contained `message`. Use `fork_context: false` to start the child with only the initial prompt (no parent history); use `fork_context: true` only when full parent history is truly required. Include any required conversation context, files, diffs, constraints, and requested skill names directly in the spawned agent's `message`. OMO installs these selectable agent roles into `~/.codex/agents/`: `explorer`, `librarian`, `plan`, `momus`, `metis`, `lazycodex-code-reviewer`, `lazycodex-qa-executor`, and `lazycodex-gate-reviewer` - pass the matching name as `agent_type` so the child gets that role's model and instructions. If the spawn tool exposes no `agent_type` parameter, omit it and describe the role inside `message`. If a code block below conflicts with this section, this section wins.
+Role-specific behavior must be described in a self-contained `message`. Use `fork_context: false` to start the child with only the initial prompt (no parent history); use `fork_context: true` only when full parent history is truly required. Include any required conversation context, files, diffs, constraints, and requested skill names directly in the spawned agent's `message`. OMO installs these selectable agent roles into `~/.codex/agents/`: `explorer`, `librarian`, `plan`, `momus`, `metis`, `lazycodex-code-reviewer`, `lazycodex-qa-executor`, and `lazycodex-gate-reviewer` - pass the matching name as `agent_type` so the child gets that role's model and instructions. Inspect the actual spawn schema: whenever `agent_type` is exposed, EVERY spawn MUST select an exact LazyCodex role, on V1 or V2. Implementation difficulty selects `lazycodex-worker-low`, `lazycodex-worker-medium`, or `lazycodex-worker-high`; clone QA can select `lazycodex-clone-fidelity-reviewer`. Never select generic `worker` or `default`. If a code block below conflicts with this section, this section wins.
-Codex exposes ONE of two subagent tool surfaces per session; check your own tool list and route accordingly. If `multi_agent_v1.*` tools exist, use the table above as written. If instead a flat `spawn_agent` with a required `task_name` exists (`multi_agent_v2`), rewrite every `multi_agent_v1.*` example: `multi_agent_v1.spawn_agent({...,"fork_context":false})` becomes `spawn_agent({"task_name":"<lowercase_digits_underscores>","message":...,"agent_type":...,"fork_turns":"none"})` (`"all"` only when full parent history is truly required); `send_input` becomes `send_message`; do not call `close_agent`/`resume_agent` (finished agents end on their own; `followup_task` re-tasks one, `interrupt_agent` stops one); `wait_agent` takes only `timeout_ms` and returns on any child mailbox activity. On the v2 surface `agent_type` may be ABSENT from the spawn schema (verified 2026-07-11: only `fork_turns`/`message`/`task_name`) — when absent, omit it and describe the role inside `message`; installed role TOMLs cannot be selected on that surface. If a code block below conflicts with this section, this section wins. `fork_context` is rejected on `multi_agent_v2` (`fork_context is not supported in MultiAgentV2; use fork_turns instead`).
+Codex exposes ONE of two subagent tool surfaces per session; check your own tool list and route accordingly. If `multi_agent_v1.*` tools exist, use the table above as written. If instead a flat `spawn_agent` with a required `task_name` exists (`multi_agent_v2`), rewrite every `multi_agent_v1.*` example: `multi_agent_v1.spawn_agent({...,"fork_context":false})` becomes `spawn_agent({"task_name":"<lowercase_digits_underscores>","message":...,"agent_type":...,"fork_turns":"none"})` (`"all"` only when full parent history is truly required); `send_input` becomes `send_message`; do not call `close_agent`/`resume_agent` (finished agents end on their own; `followup_task` re-tasks one, `interrupt_agent` stops one); `wait_agent` takes only `timeout_ms` and returns on any child mailbox activity. Do not infer role support from V1/V2 or a model version. Legacy-schema exception: only if the actual schema lacks `agent_type`, omit that unsupported field and carry the complete role instructions in `message`, with history explicitly disabled. This cannot select a specialized TOML; an installed managed default supplies the medium worker for unnamed non-forks. The guard has no schema metadata and rejects unnamed calls, so report incompatible routing instead of retrying generically. Every deliberate full-history fork must still name its role: Codex skips role application on unnamed full-history forks, an upstream gap no LazyCodex default can repair. If a code block below conflicts with this section, this section wins. `fork_context` is rejected on `multi_agent_v2` (`fork_context is not supported in MultiAgentV2; use fork_turns instead`).
When translating `load_skills=[...]`, include the requested skill names in the spawned agent's `message`. If a code block below conflicts with this section, this section wins.
diff --git a/plugins/omo/skills/remove-ai-slops/SKILL.md b/plugins/omo/skills/remove-ai-slops/SKILL.md
index e008ac6a..659be6ff 100644
--- a/plugins/omo/skills/remove-ai-slops/SKILL.md
+++ b/plugins/omo/skills/remove-ai-slops/SKILL.md
@@ -13,13 +13,13 @@ This skill may include examples copied from the OpenCode harness. In Codex, do n
| `call_omo_agent(subagent_type="librarian", ...)` | `multi_agent_v1.spawn_agent({"message":"TASK: act as a librarian. ...","agent_type":"librarian","fork_context":false})` |
| `task(subagent_type="plan", ...)` | `multi_agent_v1.spawn_agent({"message":"TASK: act as a planning agent. ...","agent_type":"plan","fork_context":false})` |
| `task(subagent_type="oracle", ...)` for final verification | By default, record a self-review in the notepad: re-read the diff, run diagnostics, and capture evidence for every acceptance criterion. Only when the user demanded strict, rigorous, or high-accuracy review, use `multi_agent_v1.spawn_agent({"message":"TASK: act as a rigorous reviewer. ...","agent_type":"lazycodex-gate-reviewer","fork_context":false})`; include `fork_context: false`. |
-| `task(category="...", ...)` for implementation or QA | `multi_agent_v1.spawn_agent({"message":"TASK: act as an implementation or QA worker. ...","fork_context":false})` |
+| `task(category="...", ...)` for implementation or QA | `multi_agent_v1.spawn_agent({"message":"TASK: act as an implementation or QA worker. ...","agent_type":"lazycodex-worker-medium","fork_context":false})` |
| `background_output(task_id="...")` | `multi_agent_v1.wait_agent(...)` for mailbox signals |
| `team_*(...)` | Use Codex native subagents via `multi_agent_v1.spawn_agent` and `multi_agent_v1.wait_agent`; use `multi_agent_v1.send_input` and `multi_agent_v1.close_agent` only when exposed in the active tools list |
-Role-specific behavior must be described in a self-contained `message`. Use `fork_context: false` to start the child with only the initial prompt (no parent history); use `fork_context: true` only when full parent history is truly required. Include any required conversation context, files, diffs, constraints, and requested skill names directly in the spawned agent's `message`. OMO installs these selectable agent roles into `~/.codex/agents/`: `explorer`, `librarian`, `plan`, `momus`, `metis`, `lazycodex-code-reviewer`, `lazycodex-qa-executor`, and `lazycodex-gate-reviewer` - pass the matching name as `agent_type` so the child gets that role's model and instructions. If the spawn tool exposes no `agent_type` parameter, omit it and describe the role inside `message`. If a code block below conflicts with this section, this section wins.
+Role-specific behavior must be described in a self-contained `message`. Use `fork_context: false` to start the child with only the initial prompt (no parent history); use `fork_context: true` only when full parent history is truly required. Include any required conversation context, files, diffs, constraints, and requested skill names directly in the spawned agent's `message`. OMO installs these selectable agent roles into `~/.codex/agents/`: `explorer`, `librarian`, `plan`, `momus`, `metis`, `lazycodex-code-reviewer`, `lazycodex-qa-executor`, and `lazycodex-gate-reviewer` - pass the matching name as `agent_type` so the child gets that role's model and instructions. Inspect the actual spawn schema: whenever `agent_type` is exposed, EVERY spawn MUST select an exact LazyCodex role, on V1 or V2. Implementation difficulty selects `lazycodex-worker-low`, `lazycodex-worker-medium`, or `lazycodex-worker-high`; clone QA can select `lazycodex-clone-fidelity-reviewer`. Never select generic `worker` or `default`. If a code block below conflicts with this section, this section wins.
-Codex exposes ONE of two subagent tool surfaces per session; check your own tool list and route accordingly. If `multi_agent_v1.*` tools exist, use the table above as written. If instead a flat `spawn_agent` with a required `task_name` exists (`multi_agent_v2`), rewrite every `multi_agent_v1.*` example: `multi_agent_v1.spawn_agent({...,"fork_context":false})` becomes `spawn_agent({"task_name":"<lowercase_digits_underscores>","message":...,"agent_type":...,"fork_turns":"none"})` (`"all"` only when full parent history is truly required); `send_input` becomes `send_message`; do not call `close_agent`/`resume_agent` (finished agents end on their own; `followup_task` re-tasks one, `interrupt_agent` stops one); `wait_agent` takes only `timeout_ms` and returns on any child mailbox activity. On the v2 surface `agent_type` may be ABSENT from the spawn schema (verified 2026-07-11: only `fork_turns`/`message`/`task_name`) — when absent, omit it and describe the role inside `message`; installed role TOMLs cannot be selected on that surface. If a code block below conflicts with this section, this section wins. `fork_context` is rejected on `multi_agent_v2` (`fork_context is not supported in MultiAgentV2; use fork_turns instead`).
+Codex exposes ONE of two subagent tool surfaces per session; check your own tool list and route accordingly. If `multi_agent_v1.*` tools exist, use the table above as written. If instead a flat `spawn_agent` with a required `task_name` exists (`multi_agent_v2`), rewrite every `multi_agent_v1.*` example: `multi_agent_v1.spawn_agent({...,"fork_context":false})` becomes `spawn_agent({"task_name":"<lowercase_digits_underscores>","message":...,"agent_type":...,"fork_turns":"none"})` (`"all"` only when full parent history is truly required); `send_input` becomes `send_message`; do not call `close_agent`/`resume_agent` (finished agents end on their own; `followup_task` re-tasks one, `interrupt_agent` stops one); `wait_agent` takes only `timeout_ms` and returns on any child mailbox activity. Do not infer role support from V1/V2 or a model version. Legacy-schema exception: only if the actual schema lacks `agent_type`, omit that unsupported field and carry the complete role instructions in `message`, with history explicitly disabled. This cannot select a specialized TOML; an installed managed default supplies the medium worker for unnamed non-forks. The guard has no schema metadata and rejects unnamed calls, so report incompatible routing instead of retrying generically. Every deliberate full-history fork must still name its role: Codex skips role application on unnamed full-history forks, an upstream gap no LazyCodex default can repair. If a code block below conflicts with this section, this section wins. `fork_context` is rejected on `multi_agent_v2` (`fork_context is not supported in MultiAgentV2; use fork_turns instead`).
When translating `load_skills=[...]`, include the requested skill names in the spawned agent's `message`. If a code block below conflicts with this section, this section wins.
diff --git a/plugins/omo/skills/review-work/SKILL.md b/plugins/omo/skills/review-work/SKILL.md
index 3b905600..18c42dba 100644
--- a/plugins/omo/skills/review-work/SKILL.md
+++ b/plugins/omo/skills/review-work/SKILL.md
@@ -12,13 +12,13 @@ This skill may include examples copied from the OpenCode harness. In Codex, do n
| `call_omo_agent(subagent_type="librarian", ...)` | `multi_agent_v1.spawn_agent({"message":"TASK: act as a librarian. ...","agent_type":"librarian","fork_context":false})` |
| `task(subagent_type="plan", ...)` | `multi_agent_v1.spawn_agent({"message":"TASK: act as a planning agent. ...","agent_type":"plan","fork_context":false})` |
| `task(subagent_type="oracle", ...)` for final verification | By default, record a self-review in the notepad: re-read the diff, run diagnostics, and capture evidence for every acceptance criterion. Only when the user demanded strict, rigorous, or high-accuracy review, use `multi_agent_v1.spawn_agent({"message":"TASK: act as a rigorous reviewer. ...","agent_type":"lazycodex-gate-reviewer","fork_context":false})`; include `fork_context: false`. |
-| `task(category="...", ...)` for implementation or QA | `multi_agent_v1.spawn_agent({"message":"TASK: act as an implementation or QA worker. ...","fork_context":false})` |
+| `task(category="...", ...)` for implementation or QA | `multi_agent_v1.spawn_agent({"message":"TASK: act as an implementation or QA worker. ...","agent_type":"lazycodex-worker-medium","fork_context":false})` |
| `background_output(task_id="...")` | `multi_agent_v1.wait_agent(...)` for mailbox signals |
| `team_*(...)` | Use Codex native subagents via `multi_agent_v1.spawn_agent` and `multi_agent_v1.wait_agent`; use `multi_agent_v1.send_input` and `multi_agent_v1.close_agent` only when exposed in the active tools list |
-Role-specific behavior must be described in a self-contained `message`. Use `fork_context: false` to start the child with only the initial prompt (no parent history); use `fork_context: true` only when full parent history is truly required. Include any required conversation context, files, diffs, constraints, and requested skill names directly in the spawned agent's `message`. OMO installs these selectable agent roles into `~/.codex/agents/`: `explorer`, `librarian`, `plan`, `momus`, `metis`, `lazycodex-code-reviewer`, `lazycodex-qa-executor`, and `lazycodex-gate-reviewer` - pass the matching name as `agent_type` so the child gets that role's model and instructions. If the spawn tool exposes no `agent_type` parameter, omit it and describe the role inside `message`. If a code block below conflicts with this section, this section wins.
+Role-specific behavior must be described in a self-contained `message`. Use `fork_context: false` to start the child with only the initial prompt (no parent history); use `fork_context: true` only when full parent history is truly required. Include any required conversation context, files, diffs, constraints, and requested skill names directly in the spawned agent's `message`. OMO installs these selectable agent roles into `~/.codex/agents/`: `explorer`, `librarian`, `plan`, `momus`, `metis`, `lazycodex-code-reviewer`, `lazycodex-qa-executor`, and `lazycodex-gate-reviewer` - pass the matching name as `agent_type` so the child gets that role's model and instructions. Inspect the actual spawn schema: whenever `agent_type` is exposed, EVERY spawn MUST select an exact LazyCodex role, on V1 or V2. Implementation difficulty selects `lazycodex-worker-low`, `lazycodex-worker-medium`, or `lazycodex-worker-high`; clone QA can select `lazycodex-clone-fidelity-reviewer`. Never select generic `worker` or `default`. If a code block below conflicts with this section, this section wins.
-Codex exposes ONE of two subagent tool surfaces per session; check your own tool list and route accordingly. If `multi_agent_v1.*` tools exist, use the table above as written. If instead a flat `spawn_agent` with a required `task_name` exists (`multi_agent_v2`), rewrite every `multi_agent_v1.*` example: `multi_agent_v1.spawn_agent({...,"fork_context":false})` becomes `spawn_agent({"task_name":"<lowercase_digits_underscores>","message":...,"agent_type":...,"fork_turns":"none"})` (`"all"` only when full parent history is truly required); `send_input` becomes `send_message`; do not call `close_agent`/`resume_agent` (finished agents end on their own; `followup_task` re-tasks one, `interrupt_agent` stops one); `wait_agent` takes only `timeout_ms` and returns on any child mailbox activity. On the v2 surface `agent_type` may be ABSENT from the spawn schema (verified 2026-07-11: only `fork_turns`/`message`/`task_name`) — when absent, omit it and describe the role inside `message`; installed role TOMLs cannot be selected on that surface. If a code block below conflicts with this section, this section wins. `fork_context` is rejected on `multi_agent_v2` (`fork_context is not supported in MultiAgentV2; use fork_turns instead`).
+Codex exposes ONE of two subagent tool surfaces per session; check your own tool list and route accordingly. If `multi_agent_v1.*` tools exist, use the table above as written. If instead a flat `spawn_agent` with a required `task_name` exists (`multi_agent_v2`), rewrite every `multi_agent_v1.*` example: `multi_agent_v1.spawn_agent({...,"fork_context":false})` becomes `spawn_agent({"task_name":"<lowercase_digits_underscores>","message":...,"agent_type":...,"fork_turns":"none"})` (`"all"` only when full parent history is truly required); `send_input` becomes `send_message`; do not call `close_agent`/`resume_agent` (finished agents end on their own; `followup_task` re-tasks one, `interrupt_agent` stops one); `wait_agent` takes only `timeout_ms` and returns on any child mailbox activity. Do not infer role support from V1/V2 or a model version. Legacy-schema exception: only if the actual schema lacks `agent_type`, omit that unsupported field and carry the complete role instructions in `message`, with history explicitly disabled. This cannot select a specialized TOML; an installed managed default supplies the medium worker for unnamed non-forks. The guard has no schema metadata and rejects unnamed calls, so report incompatible routing instead of retrying generically. Every deliberate full-history fork must still name its role: Codex skips role application on unnamed full-history forks, an upstream gap no LazyCodex default can repair. If a code block below conflicts with this section, this section wins. `fork_context` is rejected on `multi_agent_v2` (`fork_context is not supported in MultiAgentV2; use fork_turns instead`).
When translating `load_skills=[...]`, include the requested skill names in the spawned agent's `message`. If a code block below conflicts with this section, this section wins.
diff --git a/plugins/omo/skills/ultrawork/SKILL.md b/plugins/omo/skills/ultrawork/SKILL.md
index a2febb21..17daf277 100644
--- a/plugins/omo/skills/ultrawork/SKILL.md
+++ b/plugins/omo/skills/ultrawork/SKILL.md
@@ -347,17 +347,26 @@ make the child continue old parent context instead of the delegated task.
If your tool list has a flat `spawn_agent` with a required `task_name` instead of `multi_agent_v1.*` (`multi_agent_v2`), rewrite: `fork_context: false` becomes `fork_turns: "none"`, `send_input` becomes `send_message`, finished agents end on their own (no `close_agent`; `followup_task` re-tasks, `interrupt_agent` stops), and `wait_agent` takes only `timeout_ms`, returning on any child mailbox activity.
# TOML-backed subagent routing compatibility
-Installed role TOMLs (`~/.codex/agents/`) bind ONLY via `agent_type`.
-`multi_agent_v1.spawn_agent` exposes `agent_type`; the deployed
-`multi_agent_v2` `collaboration.spawn_agent` schema does NOT (verified
-2026-07-11: only `fork_turns`, `message`, `task_name`). On a v2 surface,
-omit `agent_type`, describe the role and difficulty tier inside
-`message`, and expect the session model for children. Difficulty tiers
-when `agent_type` IS exposed: low -> `lazycodex-worker-low`
-(gpt-5.6-luna/high), medium -> `lazycodex-worker-medium`
-(gpt-5.6-luna/max), high -> `lazycodex-worker-high` (gpt-5.6-sol/max);
-explorer/librarian carry their own TOMLs (gpt-5.6-luna/low). Difficulty
-(model power) is orthogonal to LIGHT/HEAVY rigor (process size).
+Inspect the ACTUAL spawn tool schema, not a version or namespace assumption.
+When `agent_type` is exposed (V1 or V2), EVERY spawn MUST pass an exact
+LazyCodex role: `explorer`, `librarian`, `plan`, `metis`, `momus`,
+`lazycodex-worker-low`, `lazycodex-worker-medium`, `lazycodex-worker-high`,
+`lazycodex-code-reviewer`, `lazycodex-qa-executor`, `lazycodex-gate-reviewer`,
+or `lazycodex-clone-fidelity-reviewer`. Map implementation difficulty to
+worker low/medium/high; their installed TOMLs supply model and instructions.
+Never select generic `worker`/`default` or describe a role instead of selecting it.
+Use `fork_turns: "none"` on V2 or `fork_context: false` on V1 unless full
+history is deliberately required; even a deliberate fork MUST name its role.
+
+Legacy-schema exception: ONLY when `agent_type` is absent, omit that unsupported
+field and carry the role, difficulty, and complete instructions in `message`;
+explicitly disable history. This cannot select a specialized TOML. The managed
+`default` supplies the medium worker for unnamed non-forks, unless opted out or
+blocked by a preserved user default. The spawn guard cannot see the schema and
+rejects unnamed requests: report incompatible routing, do not retry generically.
+An unnamed full-history fork skips role application inside Codex; no LazyCodex
+config can fix that upstream gap. Never claim this path has been repaired.
+Difficulty (model power) is orthogonal to LIGHT/HEAVY rigor (process size).
Treat child status as a progress signal, not a timeout counter. For
work likely to exceed one wait cycle, tell the child to send
diff --git a/plugins/omo/skills/ulw-execute/SKILL.md b/plugins/omo/skills/ulw-execute/SKILL.md
index 51dd842a..a30ee23c 100644
--- a/plugins/omo/skills/ulw-execute/SKILL.md
+++ b/plugins/omo/skills/ulw-execute/SKILL.md
@@ -13,13 +13,13 @@ This skill may include examples copied from the OpenCode harness. In Codex, do n
| `call_omo_agent(subagent_type="librarian", ...)` | `multi_agent_v1.spawn_agent({"message":"TASK: act as a librarian. ...","agent_type":"librarian","fork_context":false})` |
| `task(subagent_type="plan", ...)` | `multi_agent_v1.spawn_agent({"message":"TASK: act as a planning agent. ...","agent_type":"plan","fork_context":false})` |
| `task(subagent_type="oracle", ...)` for final verification | By default, record a self-review in the notepad: re-read the diff, run diagnostics, and capture evidence for every acceptance criterion. Only when the user demanded strict, rigorous, or high-accuracy review, use `multi_agent_v1.spawn_agent({"message":"TASK: act as a rigorous reviewer. ...","agent_type":"lazycodex-gate-reviewer","fork_context":false})`; include `fork_context: false`. |
-| `task(category="...", ...)` for implementation or QA | `multi_agent_v1.spawn_agent({"message":"TASK: act as an implementation or QA worker. ...","fork_context":false})` |
+| `task(category="...", ...)` for implementation or QA | `multi_agent_v1.spawn_agent({"message":"TASK: act as an implementation or QA worker. ...","agent_type":"lazycodex-worker-medium","fork_context":false})` |
| `background_output(task_id="...")` | `multi_agent_v1.wait_agent(...)` for mailbox signals |
| `team_*(...)` | Use Codex native subagents via `multi_agent_v1.spawn_agent` and `multi_agent_v1.wait_agent`; use `multi_agent_v1.send_input` and `multi_agent_v1.close_agent` only when exposed in the active tools list |
-Role-specific behavior must be described in a self-contained `message`. Use `fork_context: false` to start the child with only the initial prompt (no parent history); use `fork_context: true` only when full parent history is truly required. Include any required conversation context, files, diffs, constraints, and requested skill names directly in the spawned agent's `message`. OMO installs these selectable agent roles into `~/.codex/agents/`: `explorer`, `librarian`, `plan`, `momus`, `metis`, `lazycodex-code-reviewer`, `lazycodex-qa-executor`, and `lazycodex-gate-reviewer` - pass the matching name as `agent_type` so the child gets that role's model and instructions. If the spawn tool exposes no `agent_type` parameter, omit it and describe the role inside `message`. If a code block below conflicts with this section, this section wins.
+Role-specific behavior must be described in a self-contained `message`. Use `fork_context: false` to start the child with only the initial prompt (no parent history); use `fork_context: true` only when full parent history is truly required. Include any required conversation context, files, diffs, constraints, and requested skill names directly in the spawned agent's `message`. OMO installs these selectable agent roles into `~/.codex/agents/`: `explorer`, `librarian`, `plan`, `momus`, `metis`, `lazycodex-code-reviewer`, `lazycodex-qa-executor`, and `lazycodex-gate-reviewer` - pass the matching name as `agent_type` so the child gets that role's model and instructions. Inspect the actual spawn schema: whenever `agent_type` is exposed, EVERY spawn MUST select an exact LazyCodex role, on V1 or V2. Implementation difficulty selects `lazycodex-worker-low`, `lazycodex-worker-medium`, or `lazycodex-worker-high`; clone QA can select `lazycodex-clone-fidelity-reviewer`. Never select generic `worker` or `default`. If a code block below conflicts with this section, this section wins.
-Codex exposes ONE of two subagent tool surfaces per session; check your own tool list and route accordingly. If `multi_agent_v1.*` tools exist, use the table above as written. If instead a flat `spawn_agent` with a required `task_name` exists (`multi_agent_v2`), rewrite every `multi_agent_v1.*` example: `multi_agent_v1.spawn_agent({...,"fork_context":false})` becomes `spawn_agent({"task_name":"<lowercase_digits_underscores>","message":...,"agent_type":...,"fork_turns":"none"})` (`"all"` only when full parent history is truly required); `send_input` becomes `send_message`; do not call `close_agent`/`resume_agent` (finished agents end on their own; `followup_task` re-tasks one, `interrupt_agent` stops one); `wait_agent` takes only `timeout_ms` and returns on any child mailbox activity. On the v2 surface `agent_type` may be ABSENT from the spawn schema (verified 2026-07-11: only `fork_turns`/`message`/`task_name`) — when absent, omit it and describe the role inside `message`; installed role TOMLs cannot be selected on that surface. If a code block below conflicts with this section, this section wins. `fork_context` is rejected on `multi_agent_v2` (`fork_context is not supported in MultiAgentV2; use fork_turns instead`).
+Codex exposes ONE of two subagent tool surfaces per session; check your own tool list and route accordingly. If `multi_agent_v1.*` tools exist, use the table above as written. If instead a flat `spawn_agent` with a required `task_name` exists (`multi_agent_v2`), rewrite every `multi_agent_v1.*` example: `multi_agent_v1.spawn_agent({...,"fork_context":false})` becomes `spawn_agent({"task_name":"<lowercase_digits_underscores>","message":...,"agent_type":...,"fork_turns":"none"})` (`"all"` only when full parent history is truly required); `send_input` becomes `send_message`; do not call `close_agent`/`resume_agent` (finished agents end on their own; `followup_task` re-tasks one, `interrupt_agent` stops one); `wait_agent` takes only `timeout_ms` and returns on any child mailbox activity. Do not infer role support from V1/V2 or a model version. Legacy-schema exception: only if the actual schema lacks `agent_type`, omit that unsupported field and carry the complete role instructions in `message`, with history explicitly disabled. This cannot select a specialized TOML; an installed managed default supplies the medium worker for unnamed non-forks. The guard has no schema metadata and rejects unnamed calls, so report incompatible routing instead of retrying generically. Every deliberate full-history fork must still name its role: Codex skips role application on unnamed full-history forks, an upstream gap no LazyCodex default can repair. If a code block below conflicts with this section, this section wins. `fork_context` is rejected on `multi_agent_v2` (`fork_context is not supported in MultiAgentV2; use fork_turns instead`).
When translating `load_skills=[...]`, include the requested skill names in the spawned agent's `message`. If a code block below conflicts with this section, this section wins.
diff --git a/plugins/omo/skills/ulw-loop/SKILL.md b/plugins/omo/skills/ulw-loop/SKILL.md
index a38acdc8..76508895 100644
--- a/plugins/omo/skills/ulw-loop/SKILL.md
+++ b/plugins/omo/skills/ulw-loop/SKILL.md
@@ -15,13 +15,13 @@ This skill may include examples copied from the OpenCode harness. In Codex, do n
| `call_omo_agent(subagent_type="librarian", ...)` | `multi_agent_v1.spawn_agent({"message":"TASK: act as a librarian. ...","agent_type":"librarian","fork_context":false})` |
| `task(subagent_type="plan", ...)` | `multi_agent_v1.spawn_agent({"message":"TASK: act as a planning agent. ...","agent_type":"plan","fork_context":false})` |
| `task(subagent_type="oracle", ...)` for final verification | By default, record a self-review in the notepad: re-read the diff, run diagnostics, and capture evidence for every acceptance criterion. Only when the user demanded strict, rigorous, or high-accuracy review, use `multi_agent_v1.spawn_agent({"message":"TASK: act as a rigorous reviewer. ...","agent_type":"lazycodex-gate-reviewer","fork_context":false})`; include `fork_context: false`. |
-| `task(category="...", ...)` for implementation or QA | `multi_agent_v1.spawn_agent({"message":"TASK: act as an implementation or QA worker. ...","fork_context":false})` |
+| `task(category="...", ...)` for implementation or QA | `multi_agent_v1.spawn_agent({"message":"TASK: act as an implementation or QA worker. ...","agent_type":"lazycodex-worker-medium","fork_context":false})` |
| `background_output(task_id="...")` | `multi_agent_v1.wait_agent(...)` for mailbox signals |
| `team_*(...)` | Use Codex native subagents via `multi_agent_v1.spawn_agent` and `multi_agent_v1.wait_agent`; use `multi_agent_v1.send_input` and `multi_agent_v1.close_agent` only when exposed in the active tools list |
-Role-specific behavior must be described in a self-contained `message`. Use `fork_context: false` to start the child with only the initial prompt (no parent history); use `fork_context: true` only when full parent history is truly required. Include any required conversation context, files, diffs, constraints, and requested skill names directly in the spawned agent's `message`. OMO installs these selectable agent roles into `~/.codex/agents/`: `explorer`, `librarian`, `plan`, `momus`, `metis`, `lazycodex-code-reviewer`, `lazycodex-qa-executor`, and `lazycodex-gate-reviewer` - pass the matching name as `agent_type` so the child gets that role's model and instructions. If the spawn tool exposes no `agent_type` parameter, omit it and describe the role inside `message`. If a code block below conflicts with this section, this section wins.
+Role-specific behavior must be described in a self-contained `message`. Use `fork_context: false` to start the child with only the initial prompt (no parent history); use `fork_context: true` only when full parent history is truly required. Include any required conversation context, files, diffs, constraints, and requested skill names directly in the spawned agent's `message`. OMO installs these selectable agent roles into `~/.codex/agents/`: `explorer`, `librarian`, `plan`, `momus`, `metis`, `lazycodex-code-reviewer`, `lazycodex-qa-executor`, and `lazycodex-gate-reviewer` - pass the matching name as `agent_type` so the child gets that role's model and instructions. Inspect the actual spawn schema: whenever `agent_type` is exposed, EVERY spawn MUST select an exact LazyCodex role, on V1 or V2. Implementation difficulty selects `lazycodex-worker-low`, `lazycodex-worker-medium`, or `lazycodex-worker-high`; clone QA can select `lazycodex-clone-fidelity-reviewer`. Never select generic `worker` or `default`. If a code block below conflicts with this section, this section wins.
-Codex exposes ONE of two subagent tool surfaces per session; check your own tool list and route accordingly. If `multi_agent_v1.*` tools exist, use the table above as written. If instead a flat `spawn_agent` with a required `task_name` exists (`multi_agent_v2`), rewrite every `multi_agent_v1.*` example: `multi_agent_v1.spawn_agent({...,"fork_context":false})` becomes `spawn_agent({"task_name":"<lowercase_digits_underscores>","message":...,"agent_type":...,"fork_turns":"none"})` (`"all"` only when full parent history is truly required); `send_input` becomes `send_message`; do not call `close_agent`/`resume_agent` (finished agents end on their own; `followup_task` re-tasks one, `interrupt_agent` stops one); `wait_agent` takes only `timeout_ms` and returns on any child mailbox activity. On the v2 surface `agent_type` may be ABSENT from the spawn schema (verified 2026-07-11: only `fork_turns`/`message`/`task_name`) — when absent, omit it and describe the role inside `message`; installed role TOMLs cannot be selected on that surface. If a code block below conflicts with this section, this section wins. `fork_context` is rejected on `multi_agent_v2` (`fork_context is not supported in MultiAgentV2; use fork_turns instead`).
+Codex exposes ONE of two subagent tool surfaces per session; check your own tool list and route accordingly. If `multi_agent_v1.*` tools exist, use the table above as written. If instead a flat `spawn_agent` with a required `task_name` exists (`multi_agent_v2`), rewrite every `multi_agent_v1.*` example: `multi_agent_v1.spawn_agent({...,"fork_context":false})` becomes `spawn_agent({"task_name":"<lowercase_digits_underscores>","message":...,"agent_type":...,"fork_turns":"none"})` (`"all"` only when full parent history is truly required); `send_input` becomes `send_message`; do not call `close_agent`/`resume_agent` (finished agents end on their own; `followup_task` re-tasks one, `interrupt_agent` stops one); `wait_agent` takes only `timeout_ms` and returns on any child mailbox activity. Do not infer role support from V1/V2 or a model version. Legacy-schema exception: only if the actual schema lacks `agent_type`, omit that unsupported field and carry the complete role instructions in `message`, with history explicitly disabled. This cannot select a specialized TOML; an installed managed default supplies the medium worker for unnamed non-forks. The guard has no schema metadata and rejects unnamed calls, so report incompatible routing instead of retrying generically. Every deliberate full-history fork must still name its role: Codex skips role application on unnamed full-history forks, an upstream gap no LazyCodex default can repair. If a code block below conflicts with this section, this section wins. `fork_context` is rejected on `multi_agent_v2` (`fork_context is not supported in MultiAgentV2; use fork_turns instead`).
When translating `load_skills=[...]`, include the requested skill names in the spawned agent's `message`. If a code block below conflicts with this section, this section wins.
diff --git a/plugins/omo/skills/ulw-research/SKILL.md b/plugins/omo/skills/ulw-research/SKILL.md
index c21670ac..b36d6934 100644
--- a/plugins/omo/skills/ulw-research/SKILL.md
+++ b/plugins/omo/skills/ulw-research/SKILL.md
@@ -13,13 +13,13 @@ This skill may include examples copied from the OpenCode harness. In Codex, do n
| `call_omo_agent(subagent_type="librarian", ...)` | `multi_agent_v1.spawn_agent({"message":"TASK: act as a librarian. ...","agent_type":"librarian","fork_context":false})` |
| `task(subagent_type="plan", ...)` | `multi_agent_v1.spawn_agent({"message":"TASK: act as a planning agent. ...","agent_type":"plan","fork_context":false})` |
| `task(subagent_type="oracle", ...)` for final verification | By default, record a self-review in the notepad: re-read the diff, run diagnostics, and capture evidence for every acceptance criterion. Only when the user demanded strict, rigorous, or high-accuracy review, use `multi_agent_v1.spawn_agent({"message":"TASK: act as a rigorous reviewer. ...","agent_type":"lazycodex-gate-reviewer","fork_context":false})`; include `fork_context: false`. |
-| `task(category="...", ...)` for implementation or QA | `multi_agent_v1.spawn_agent({"message":"TASK: act as an implementation or QA worker. ...","fork_context":false})` |
+| `task(category="...", ...)` for implementation or QA | `multi_agent_v1.spawn_agent({"message":"TASK: act as an implementation or QA worker. ...","agent_type":"lazycodex-worker-medium","fork_context":false})` |
| `background_output(task_id="...")` | `multi_agent_v1.wait_agent(...)` for mailbox signals |
| `team_*(...)` | Use Codex native subagents via `multi_agent_v1.spawn_agent` and `multi_agent_v1.wait_agent`; use `multi_agent_v1.send_input` and `multi_agent_v1.close_agent` only when exposed in the active tools list |
-Role-specific behavior must be described in a self-contained `message`. Use `fork_context: false` to start the child with only the initial prompt (no parent history); use `fork_context: true` only when full parent history is truly required. Include any required conversation context, files, diffs, constraints, and requested skill names directly in the spawned agent's `message`. OMO installs these selectable agent roles into `~/.codex/agents/`: `explorer`, `librarian`, `plan`, `momus`, `metis`, `lazycodex-code-reviewer`, `lazycodex-qa-executor`, and `lazycodex-gate-reviewer` - pass the matching name as `agent_type` so the child gets that role's model and instructions. If the spawn tool exposes no `agent_type` parameter, omit it and describe the role inside `message`. If a code block below conflicts with this section, this section wins.
+Role-specific behavior must be described in a self-contained `message`. Use `fork_context: false` to start the child with only the initial prompt (no parent history); use `fork_context: true` only when full parent history is truly required. Include any required conversation context, files, diffs, constraints, and requested skill names directly in the spawned agent's `message`. OMO installs these selectable agent roles into `~/.codex/agents/`: `explorer`, `librarian`, `plan`, `momus`, `metis`, `lazycodex-code-reviewer`, `lazycodex-qa-executor`, and `lazycodex-gate-reviewer` - pass the matching name as `agent_type` so the child gets that role's model and instructions. Inspect the actual spawn schema: whenever `agent_type` is exposed, EVERY spawn MUST select an exact LazyCodex role, on V1 or V2. Implementation difficulty selects `lazycodex-worker-low`, `lazycodex-worker-medium`, or `lazycodex-worker-high`; clone QA can select `lazycodex-clone-fidelity-reviewer`. Never select generic `worker` or `default`. If a code block below conflicts with this section, this section wins.
-Codex exposes ONE of two subagent tool surfaces per session; check your own tool list and route accordingly. If `multi_agent_v1.*` tools exist, use the table above as written. If instead a flat `spawn_agent` with a required `task_name` exists (`multi_agent_v2`), rewrite every `multi_agent_v1.*` example: `multi_agent_v1.spawn_agent({...,"fork_context":false})` becomes `spawn_agent({"task_name":"<lowercase_digits_underscores>","message":...,"agent_type":...,"fork_turns":"none"})` (`"all"` only when full parent history is truly required); `send_input` becomes `send_message`; do not call `close_agent`/`resume_agent` (finished agents end on their own; `followup_task` re-tasks one, `interrupt_agent` stops one); `wait_agent` takes only `timeout_ms` and returns on any child mailbox activity. On the v2 surface `agent_type` may be ABSENT from the spawn schema (verified 2026-07-11: only `fork_turns`/`message`/`task_name`) — when absent, omit it and describe the role inside `message`; installed role TOMLs cannot be selected on that surface. If a code block below conflicts with this section, this section wins. `fork_context` is rejected on `multi_agent_v2` (`fork_context is not supported in MultiAgentV2; use fork_turns instead`).
+Codex exposes ONE of two subagent tool surfaces per session; check your own tool list and route accordingly. If `multi_agent_v1.*` tools exist, use the table above as written. If instead a flat `spawn_agent` with a required `task_name` exists (`multi_agent_v2`), rewrite every `multi_agent_v1.*` example: `multi_agent_v1.spawn_agent({...,"fork_context":false})` becomes `spawn_agent({"task_name":"<lowercase_digits_underscores>","message":...,"agent_type":...,"fork_turns":"none"})` (`"all"` only when full parent history is truly required); `send_input` becomes `send_message`; do not call `close_agent`/`resume_agent` (finished agents end on their own; `followup_task` re-tasks one, `interrupt_agent` stops one); `wait_agent` takes only `timeout_ms` and returns on any child mailbox activity. Do not infer role support from V1/V2 or a model version. Legacy-schema exception: only if the actual schema lacks `agent_type`, omit that unsupported field and carry the complete role instructions in `message`, with history explicitly disabled. This cannot select a specialized TOML; an installed managed default supplies the medium worker for unnamed non-forks. The guard has no schema metadata and rejects unnamed calls, so report incompatible routing instead of retrying generically. Every deliberate full-history fork must still name its role: Codex skips role application on unnamed full-history forks, an upstream gap no LazyCodex default can repair. If a code block below conflicts with this section, this section wins. `fork_context` is rejected on `multi_agent_v2` (`fork_context is not supported in MultiAgentV2; use fork_turns instead`).
When translating `load_skills=[...]`, include the requested skill names in the spawned agent's `message`. If a code block below conflicts with this section, this section wins.
diff --git a/plugins/omo/skills/visual-qa/SKILL.md b/plugins/omo/skills/visual-qa/SKILL.md
index d5f47a3c..1adb2ef3 100644
--- a/plugins/omo/skills/visual-qa/SKILL.md
+++ b/plugins/omo/skills/visual-qa/SKILL.md
@@ -13,13 +13,13 @@ This skill may include examples copied from the OpenCode harness. In Codex, do n
| `call_omo_agent(subagent_type="librarian", ...)` | `multi_agent_v1.spawn_agent({"message":"TASK: act as a librarian. ...","agent_type":"librarian","fork_context":false})` |
| `task(subagent_type="plan", ...)` | `multi_agent_v1.spawn_agent({"message":"TASK: act as a planning agent. ...","agent_type":"plan","fork_context":false})` |
| `task(subagent_type="oracle", ...)` for final verification | By default, record a self-review in the notepad: re-read the diff, run diagnostics, and capture evidence for every acceptance criterion. Only when the user demanded strict, rigorous, or high-accuracy review, use `multi_agent_v1.spawn_agent({"message":"TASK: act as a rigorous reviewer. ...","agent_type":"lazycodex-gate-reviewer","fork_context":false})`; include `fork_context: false`. |
-| `task(category="...", ...)` for implementation or QA | `multi_agent_v1.spawn_agent({"message":"TASK: act as an implementation or QA worker. ...","fork_context":false})` |
+| `task(category="...", ...)` for implementation or QA | `multi_agent_v1.spawn_agent({"message":"TASK: act as an implementation or QA worker. ...","agent_type":"lazycodex-worker-medium","fork_context":false})` |
| `background_output(task_id="...")` | `multi_agent_v1.wait_agent(...)` for mailbox signals |
| `team_*(...)` | Use Codex native subagents via `multi_agent_v1.spawn_agent` and `multi_agent_v1.wait_agent`; use `multi_agent_v1.send_input` and `multi_agent_v1.close_agent` only when exposed in the active tools list |
-Role-specific behavior must be described in a self-contained `message`. Use `fork_context: false` to start the child with only the initial prompt (no parent history); use `fork_context: true` only when full parent history is truly required. Include any required conversation context, files, diffs, constraints, and requested skill names directly in the spawned agent's `message`. OMO installs these selectable agent roles into `~/.codex/agents/`: `explorer`, `librarian`, `plan`, `momus`, `metis`, `lazycodex-code-reviewer`, `lazycodex-qa-executor`, and `lazycodex-gate-reviewer` - pass the matching name as `agent_type` so the child gets that role's model and instructions. If the spawn tool exposes no `agent_type` parameter, omit it and describe the role inside `message`. If a code block below conflicts with this section, this section wins.
+Role-specific behavior must be described in a self-contained `message`. Use `fork_context: false` to start the child with only the initial prompt (no parent history); use `fork_context: true` only when full parent history is truly required. Include any required conversation context, files, diffs, constraints, and requested skill names directly in the spawned agent's `message`. OMO installs these selectable agent roles into `~/.codex/agents/`: `explorer`, `librarian`, `plan`, `momus`, `metis`, `lazycodex-code-reviewer`, `lazycodex-qa-executor`, and `lazycodex-gate-reviewer` - pass the matching name as `agent_type` so the child gets that role's model and instructions. Inspect the actual spawn schema: whenever `agent_type` is exposed, EVERY spawn MUST select an exact LazyCodex role, on V1 or V2. Implementation difficulty selects `lazycodex-worker-low`, `lazycodex-worker-medium`, or `lazycodex-worker-high`; clone QA can select `lazycodex-clone-fidelity-reviewer`. Never select generic `worker` or `default`. If a code block below conflicts with this section, this section wins.
-Codex exposes ONE of two subagent tool surfaces per session; check your own tool list and route accordingly. If `multi_agent_v1.*` tools exist, use the table above as written. If instead a flat `spawn_agent` with a required `task_name` exists (`multi_agent_v2`), rewrite every `multi_agent_v1.*` example: `multi_agent_v1.spawn_agent({...,"fork_context":false})` becomes `spawn_agent({"task_name":"<lowercase_digits_underscores>","message":...,"agent_type":...,"fork_turns":"none"})` (`"all"` only when full parent history is truly required); `send_input` becomes `send_message`; do not call `close_agent`/`resume_agent` (finished agents end on their own; `followup_task` re-tasks one, `interrupt_agent` stops one); `wait_agent` takes only `timeout_ms` and returns on any child mailbox activity. On the v2 surface `agent_type` may be ABSENT from the spawn schema (verified 2026-07-11: only `fork_turns`/`message`/`task_name`) — when absent, omit it and describe the role inside `message`; installed role TOMLs cannot be selected on that surface. If a code block below conflicts with this section, this section wins. `fork_context` is rejected on `multi_agent_v2` (`fork_context is not supported in MultiAgentV2; use fork_turns instead`).
+Codex exposes ONE of two subagent tool surfaces per session; check your own tool list and route accordingly. If `multi_agent_v1.*` tools exist, use the table above as written. If instead a flat `spawn_agent` with a required `task_name` exists (`multi_agent_v2`), rewrite every `multi_agent_v1.*` example: `multi_agent_v1.spawn_agent({...,"fork_context":false})` becomes `spawn_agent({"task_name":"<lowercase_digits_underscores>","message":...,"agent_type":...,"fork_turns":"none"})` (`"all"` only when full parent history is truly required); `send_input` becomes `send_message`; do not call `close_agent`/`resume_agent` (finished agents end on their own; `followup_task` re-tasks one, `interrupt_agent` stops one); `wait_agent` takes only `timeout_ms` and returns on any child mailbox activity. Do not infer role support from V1/V2 or a model version. Legacy-schema exception: only if the actual schema lacks `agent_type`, omit that unsupported field and carry the complete role instructions in `message`, with history explicitly disabled. This cannot select a specialized TOML; an installed managed default supplies the medium worker for unnamed non-forks. The guard has no schema metadata and rejects unnamed calls, so report incompatible routing instead of retrying generically. Every deliberate full-history fork must still name its role: Codex skips role application on unnamed full-history forks, an upstream gap no LazyCodex default can repair. If a code block below conflicts with this section, this section wins. `fork_context` is rejected on `multi_agent_v2` (`fork_context is not supported in MultiAgentV2; use fork_turns instead`).
When translating `load_skills=[...]`, include the requested skill names in the spawned agent's `message`. If a code block below conflicts with this section, this section wins.
diff --git a/plugins/omo/test/bootstrap-default-role.test.mjs b/plugins/omo/test/bootstrap-default-role.test.mjs
new file mode 100644
index 00000000..8009f96d
--- /dev/null
+++ b/plugins/omo/test/bootstrap-default-role.test.mjs
@@ -0,0 +1,66 @@
+import assert from "node:assert/strict";
+import { mkdtemp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import test from "node:test";
+import { runWorkerSetup } from "../components/bootstrap/dist/cli.js";
+
+async function fixture(run) {
+ const root = await mkdtemp(join(tmpdir(), "bootstrap-default-"));
+ try {
+ const pluginRoot = join(root, "plugin");
+ const codexHome = join(root, "codex");
+ const pluginData = join(root, "data");
+ const agents = join(pluginRoot, "components", "ultrawork", "agents");
+ await mkdir(agents, { recursive: true });
+ await mkdir(join(pluginRoot, "dist", "cli"), { recursive: true });
+ await mkdir(join(root, ".omo"), { recursive: true });
+ await mkdir(join(codexHome, "agents"), { recursive: true });
+ await writeFile(join(pluginRoot, "dist", "cli", "index.js"), "");
+ await writeFile(join(agents, "lazycodex-worker-medium.toml"), 'name = "lazycodex-worker-medium"\nmodel = "qa-model"\ndeveloper_instructions = "qa worker"\n');
+ await run({ root, codexHome, pluginRoot, pluginData, platform: "darwin", env: { HOME: root, USERPROFILE: root }, target: join(codexHome, "agents", "default.toml") });
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+}
+
+test("#given a bundled worker #when bootstrap repeats #then default registration and bytes are stable", async () => {
+ await fixture(async (input) => {
+ await runWorkerSetup(input);
+ const content = await readFile(input.target, "utf8");
+ assert.match(content, /^name = "default"$/m);
+ assert.match(content, /^model = "qa-model"$/m);
+ const config = await readFile(join(input.codexHome, "config.toml"), "utf8");
+ assert.match(config, /\[agents\.default\]\nconfig_file = "\.\/agents\/default\.toml"/);
+ await runWorkerSetup(input);
+ assert.equal(await readFile(input.target, "utf8"), content);
+ assert.equal(await readFile(join(input.codexHome, "config.toml"), "utf8"), config);
+ });
+});
+
+test("#given unified default.disable #when bootstrap runs #then fresh and previously managed defaults are absent", async () => {
+ await fixture(async (input) => {
+ const configPath = join(input.root, ".omo", "omo.jsonc");
+ const disabled = JSON.stringify({ "[codex]": { agents: { default: { disable: true } } } });
+ await writeFile(configPath, disabled);
+ await runWorkerSetup(input);
+ await assert.rejects(readFile(input.target), { code: "ENOENT" });
+ await writeFile(configPath, "{}");
+ await runWorkerSetup(input);
+ assert.match(await readFile(input.target, "utf8"), /^name = "default"$/m);
+ await writeFile(configPath, disabled);
+ await runWorkerSetup(input);
+ await assert.rejects(readFile(input.target), { code: "ENOENT" });
+ assert.doesNotMatch(await readFile(join(input.codexHome, "config.toml"), "utf8"), /\[agents\.default\]/);
+ });
+});
+
+test("#given a user default #when bootstrap runs #then it is preserved and degradation is visible", async () => {
+ await fixture(async (input) => {
+ const custom = 'name = "default"\nmodel = "custom"\n';
+ await writeFile(input.target, custom);
+ const outcome = await runWorkerSetup(input);
+ assert.ok(outcome.degraded.some((entry) => entry.component === "agents"));
+ assert.equal(await readFile(input.target, "utf8"), custom);
+ });
+});
diff --git a/plugins/omo/test/component-hook-contract-cases.mjs b/plugins/omo/test/component-hook-contract-cases.mjs
index d97c7e0f..f2fc7e49 100644
--- a/plugins/omo/test/component-hook-contract-cases.mjs
+++ b/plugins/omo/test/component-hook-contract-cases.mjs
@@ -7,7 +7,7 @@ export function componentHookContractCases(tempRoot) {
writeFileSync(join(tempRoot, ".omo", "evidence", "receipt.txt"), "command output PASS\n".repeat(10));
const spawnPayload = {
cwd: tempRoot, hook_event_name: "PreToolUse", model: "gpt-6-astra",
- permission_mode: "default", session_id: "s-spawn-admission", tool_input: { message: "scan" },
+ permission_mode: "default", session_id: "s-spawn-admission", tool_input: { message: "scan", agent_type: "explorer", fork_context: false },
tool_name: "spawn_agent", tool_use_id: "spawn-1", transcript_path: null, turn_id: "t-spawn",
};
const marker = join(tempRoot, "plugin-data", "spawn-breaker", "s-spawn-admission.json");
@@ -45,6 +45,18 @@ export function componentHookContractCases(tempRoot) {
payload: { ...spawnPayload, session_id: "s-spawn-clean" },
assertOutput(stdout) { assert.equal(stdout, ""); },
},
+ ...[
+ { message: "scan", fork_context: false },
+ { message: "scan", agent_type: "worker", fork_context: false },
+ { message: "scan", fork_turns: "all", task_name: "scan" },
+ ].map((tool_input, index) => ({
+ name: `ulw-loop rejects generic or unnamed role ${index}`,
+ component: "ulw-loop", event: "pre-tool-use-spawn",
+ payload: { ...spawnPayload, session_id: "s-spawn-clean", tool_input },
+ assertOutput(stdout) {
+ assert.equal(JSON.parse(stdout).hookSpecificOutput.permissionDecision, "deny");
+ },
+ })),
{
name: "rules session-start",
component: "rules",