oh-my-opencode 4.19.3 → 4.19.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/command/get-unpublished-changes.md +2 -0
- package/.agents/command/omomomo.md +1 -1
- package/.agents/command/publish.md +7 -0
- package/.agents/skills/get-unpublished-changes/SKILL.md +2 -0
- package/.agents/skills/hyperplan/SKILL.md +3 -3
- package/.agents/skills/omomomo/SKILL.md +1 -1
- package/.agents/skills/publish/SKILL.md +7 -0
- package/.opencode/command/get-unpublished-changes.md +2 -0
- package/.opencode/command/omomomo.md +1 -1
- package/.opencode/command/publish.md +7 -0
- package/.opencode/skills/hyperplan/SKILL.md +3 -3
- package/dist/agents/sisyphus-junior/agent.d.ts +1 -1
- package/dist/cli/doctor/checks/deprecated-reasoning-keys.d.ts +2 -0
- package/dist/cli/index.js +1625 -1368
- package/dist/cli-node/index.js +1625 -1368
- package/dist/config/schema/agent-overrides.d.ts +800 -0
- package/dist/config/schema/categories.d.ts +132 -0
- package/dist/config/schema/fallback-models.d.ts +50 -0
- package/dist/config/schema/oh-my-opencode-config.d.ts +818 -2
- package/dist/config-migration/index.d.ts +1 -0
- package/dist/config-migration/migration-plans.d.ts +1 -0
- package/dist/config-migration/reasoning-unification.d.ts +3 -0
- package/dist/features/team-mode/tools/lifecycle-test-fixture.d.ts +2 -0
- package/dist/hooks/codegraph-bootstrap/command-runner.d.ts +1 -0
- package/dist/hooks/model-fallback/next-fallback.d.ts +1 -0
- package/dist/hooks/runtime-fallback/constants.d.ts +1 -1
- package/dist/index.js +3558 -3241
- package/dist/oh-my-opencode.schema.json +1672 -8
- package/dist/plugin-handlers/prometheus-agent-config-builder.d.ts +1 -0
- package/dist/shared/agent-variant.d.ts +11 -0
- package/dist/shared/session-prompt-params-helpers.d.ts +6 -1
- package/dist/skills/coding-agent-sessions/SKILL.md +4 -3
- package/dist/skills/coding-agent-sessions/references/all-platforms.md +3 -1
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/aside_scanner.py +140 -0
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/scanners.py +3 -0
- package/dist/skills/data-scientist/SKILL.md +243 -0
- package/dist/skills/data-scientist/references/common-scenarios.md +176 -0
- package/dist/skills/data-scientist/references/execution-templates.md +197 -0
- package/dist/skills/data-scientist/references/integration-patterns.md +153 -0
- package/dist/skills/data-scientist/references/performance-benchmarks.md +37 -0
- package/dist/skills/data-scientist/references/uv-setup.md +78 -0
- package/dist/skills/data-scientist/scripts/quick-query.py +111 -0
- package/dist/skills/data-scientist/scripts/setup-uv.ps1 +53 -0
- package/dist/skills/data-scientist/scripts/setup-uv.sh +60 -0
- package/dist/skills/debugging/SKILL.md +1 -1
- package/dist/skills/programming/SKILL.md +1 -2
- package/dist/skills/ulw-plan/SKILL.md +1 -1
- package/dist/skills/ulw-research/SKILL.md +122 -11
- package/dist/tools/delegate-task/builtin-categories.d.ts +1 -0
- package/dist/tools/delegate-task/builtin-category-definition.d.ts +1 -0
- package/dist/tools/delegate-task/constants.d.ts +1 -1
- package/dist/tui.js +974 -1090
- package/package.json +13 -13
- package/packages/lsp-core/src/lsp/client-diagnostics-freshness.integration.test.ts +2 -2
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +21 -3
- package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +279 -58
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +230 -41
- package/packages/omo-codex/plugin/components/codegraph/package.json +1 -1
- package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +6 -0
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/dist/cli.js +1 -1
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/src/post-compact-budget.ts +1 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/SKILL.md +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-codegraph-init-guidance.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-start-work-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-checking-start-work-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/package-lock.json +13 -13
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/scripts/sync-skills.mjs +6 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/SKILL.md +4 -3
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/all-platforms.md +3 -1
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/aside_scanner.py +140 -0
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/scanners.py +3 -0
- package/packages/omo-codex/plugin/skills/data-scientist/SKILL.md +243 -0
- package/packages/omo-codex/plugin/skills/data-scientist/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/data-scientist/references/common-scenarios.md +176 -0
- package/packages/omo-codex/plugin/skills/data-scientist/references/execution-templates.md +197 -0
- package/packages/omo-codex/plugin/skills/data-scientist/references/integration-patterns.md +153 -0
- package/packages/omo-codex/plugin/skills/data-scientist/references/performance-benchmarks.md +37 -0
- package/packages/omo-codex/plugin/skills/data-scientist/references/uv-setup.md +78 -0
- package/packages/omo-codex/plugin/skills/data-scientist/scripts/quick-query.py +111 -0
- package/packages/omo-codex/plugin/skills/data-scientist/scripts/setup-uv.ps1 +53 -0
- package/packages/omo-codex/plugin/skills/data-scientist/scripts/setup-uv.sh +60 -0
- package/packages/omo-codex/plugin/skills/debugging/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/programming/SKILL.md +1 -2
- package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-research/SKILL.md +121 -11
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +7 -0
- package/packages/omo-codex/plugin/test/sync-skills.test.mjs +12 -0
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +24 -5
- package/packages/shared-skills/skills/coding-agent-sessions/SKILL.md +4 -3
- package/packages/shared-skills/skills/coding-agent-sessions/references/all-platforms.md +3 -1
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/aside_scanner.py +140 -0
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/scanners.py +3 -0
- package/packages/shared-skills/skills/data-scientist/SKILL.md +243 -0
- package/packages/shared-skills/skills/data-scientist/references/common-scenarios.md +176 -0
- package/packages/shared-skills/skills/data-scientist/references/execution-templates.md +197 -0
- package/packages/shared-skills/skills/data-scientist/references/integration-patterns.md +153 -0
- package/packages/shared-skills/skills/data-scientist/references/performance-benchmarks.md +37 -0
- package/packages/shared-skills/skills/data-scientist/references/uv-setup.md +78 -0
- package/packages/shared-skills/skills/data-scientist/scripts/quick-query.py +111 -0
- package/packages/shared-skills/skills/data-scientist/scripts/setup-uv.ps1 +53 -0
- package/packages/shared-skills/skills/data-scientist/scripts/setup-uv.sh +60 -0
- package/packages/shared-skills/skills/debugging/SKILL.md +1 -1
- package/packages/shared-skills/skills/programming/SKILL.md +1 -2
- package/packages/shared-skills/skills/ulw-plan/SKILL.md +1 -1
- package/packages/shared-skills/skills/ulw-research/SKILL.md +122 -11
|
@@ -3211,6 +3211,9 @@ function handlePipeResult(left, next, ctx) {
|
|
|
3211
3211
|
}
|
|
3212
3212
|
return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);
|
|
3213
3213
|
}
|
|
3214
|
+
var $ZodPreprocess = /* @__PURE__ */ $constructor("$ZodPreprocess", (inst, def) => {
|
|
3215
|
+
$ZodPipe.init(inst, def);
|
|
3216
|
+
});
|
|
3214
3217
|
var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
3215
3218
|
$ZodType.init(inst, def);
|
|
3216
3219
|
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
@@ -5297,6 +5300,10 @@ function pipe(in_, out) {
|
|
|
5297
5300
|
out
|
|
5298
5301
|
});
|
|
5299
5302
|
}
|
|
5303
|
+
var ZodPreprocess = /* @__PURE__ */ $constructor("ZodPreprocess", (inst, def) => {
|
|
5304
|
+
ZodPipe.init(inst, def);
|
|
5305
|
+
$ZodPreprocess.init(inst, def);
|
|
5306
|
+
});
|
|
5300
5307
|
var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
5301
5308
|
$ZodReadonly.init(inst, def);
|
|
5302
5309
|
ZodType.init(inst, def);
|
|
@@ -5320,22 +5327,142 @@ function refine(fn, _params = {}) {
|
|
|
5320
5327
|
function superRefine(fn, params) {
|
|
5321
5328
|
return _superRefine(fn, params);
|
|
5322
5329
|
}
|
|
5330
|
+
function preprocess(fn, schema) {
|
|
5331
|
+
return new ZodPreprocess({
|
|
5332
|
+
type: "pipe",
|
|
5333
|
+
in: transform(fn),
|
|
5334
|
+
out: schema
|
|
5335
|
+
});
|
|
5336
|
+
}
|
|
5337
|
+
|
|
5338
|
+
// ../../omo-config-core/src/schema/reasoning-vocabulary.ts
|
|
5339
|
+
var REASONING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
5340
|
+
var REASONING_AUTO = "auto";
|
|
5341
|
+
var REASONING_LEVEL_SET = new Set(REASONING_LEVELS);
|
|
5342
|
+
var REASONING_LEVEL_OR_AUTO_SET = new Set([...REASONING_LEVELS, REASONING_AUTO]);
|
|
5343
|
+
function isReasoningLevel(value) {
|
|
5344
|
+
return REASONING_LEVEL_SET.has(value);
|
|
5345
|
+
}
|
|
5346
|
+
function normalizeReasoning(input) {
|
|
5347
|
+
const normalized = input.trim().toLowerCase();
|
|
5348
|
+
if (!normalized)
|
|
5349
|
+
return {};
|
|
5350
|
+
if (normalized === "none")
|
|
5351
|
+
return { level: "off" };
|
|
5352
|
+
if (normalized === REASONING_AUTO)
|
|
5353
|
+
return { level: REASONING_AUTO };
|
|
5354
|
+
if (isReasoningLevel(normalized))
|
|
5355
|
+
return { level: normalized };
|
|
5356
|
+
return { passthrough: normalized };
|
|
5357
|
+
}
|
|
5358
|
+
function splitReasoningSuffix(model, options) {
|
|
5359
|
+
if (typeof model !== "string")
|
|
5360
|
+
return { base: "" };
|
|
5361
|
+
const trimmed = model.trim();
|
|
5362
|
+
if (!trimmed)
|
|
5363
|
+
return { base: "" };
|
|
5364
|
+
const separatorIndex = trimmed.lastIndexOf(":");
|
|
5365
|
+
if (separatorIndex === -1)
|
|
5366
|
+
return { base: trimmed };
|
|
5367
|
+
const base = trimmed.slice(0, separatorIndex).trim();
|
|
5368
|
+
const token = trimmed.slice(separatorIndex + 1).trim().toLowerCase();
|
|
5369
|
+
if (!base || !REASONING_LEVEL_OR_AUTO_SET.has(token))
|
|
5370
|
+
return { base: trimmed };
|
|
5371
|
+
if (token === "max" && !(options?.allowMaxSuffix ?? base.includes("/")))
|
|
5372
|
+
return { base: trimmed };
|
|
5373
|
+
return { base, level: token };
|
|
5374
|
+
}
|
|
5375
|
+
|
|
5376
|
+
// ../../omo-config-core/src/schema/model-ref.ts
|
|
5377
|
+
var REASONING_LEVELS_OR_AUTO = [...REASONING_LEVELS, "auto"];
|
|
5378
|
+
var OmoReasoningSchema = union([
|
|
5379
|
+
_enum(REASONING_LEVELS_OR_AUTO),
|
|
5380
|
+
string2()
|
|
5381
|
+
]);
|
|
5382
|
+
var OmoModelRefObjectSchema = object({
|
|
5383
|
+
model: string2(),
|
|
5384
|
+
reasoning: OmoReasoningSchema.optional(),
|
|
5385
|
+
temperature: number2().min(0).max(2).optional(),
|
|
5386
|
+
top_p: number2().min(0).max(1).optional(),
|
|
5387
|
+
max_tokens: number2().int().positive().optional(),
|
|
5388
|
+
provider_options: record(string2(), unknown()).optional()
|
|
5389
|
+
}).strict();
|
|
5390
|
+
var OmoModelRefSchema = union([string2(), OmoModelRefObjectSchema]);
|
|
5323
5391
|
|
|
5324
5392
|
// ../../omo-config-core/src/schema/fallback-models.ts
|
|
5325
5393
|
var OmoThinkingConfigSchema = object({
|
|
5326
5394
|
type: _enum(["enabled", "disabled"]),
|
|
5327
5395
|
budgetTokens: number2().optional()
|
|
5328
5396
|
}).strict();
|
|
5329
|
-
var OmoReasoningEffortSchema =
|
|
5330
|
-
|
|
5397
|
+
var OmoReasoningEffortSchema = OmoReasoningSchema;
|
|
5398
|
+
function isRecord(value) {
|
|
5399
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5400
|
+
}
|
|
5401
|
+
function canonicalReasoning(value) {
|
|
5402
|
+
if (typeof value !== "string")
|
|
5403
|
+
return;
|
|
5404
|
+
const normalized = normalizeReasoning(value);
|
|
5405
|
+
return normalized.level ?? normalized.passthrough;
|
|
5406
|
+
}
|
|
5407
|
+
function canonicalModelString(model) {
|
|
5408
|
+
const colon = splitReasoningSuffix(model, { allowMaxSuffix: true });
|
|
5409
|
+
if (colon.level !== undefined)
|
|
5410
|
+
return `${colon.base}:${colon.level}`;
|
|
5411
|
+
const trimmed = model.trim();
|
|
5412
|
+
const parenthesized = trimmed.match(/^(.*)\(([^()]+)\)\s*$/);
|
|
5413
|
+
const spaced = parenthesized === null ? trimmed.match(/^(.*\S)\s+([a-z][a-z0-9_-]*)$/i) : null;
|
|
5414
|
+
const base = (parenthesized?.[1] ?? spaced?.[1])?.trim();
|
|
5415
|
+
const token = (parenthesized?.[2] ?? spaced?.[2])?.trim();
|
|
5416
|
+
if (base === undefined || token === undefined)
|
|
5417
|
+
return trimmed;
|
|
5418
|
+
const normalized = normalizeReasoning(token);
|
|
5419
|
+
return normalized.level === undefined ? trimmed : `${base}:${normalized.level}`;
|
|
5420
|
+
}
|
|
5421
|
+
function normalizeLegacyModelFields(entry) {
|
|
5422
|
+
const normalized = { ...entry };
|
|
5423
|
+
delete normalized["variant"];
|
|
5424
|
+
delete normalized["reasoningEffort"];
|
|
5425
|
+
delete normalized["thinking"];
|
|
5426
|
+
delete normalized["textVerbosity"];
|
|
5427
|
+
delete normalized["maxTokens"];
|
|
5428
|
+
delete normalized["providerOptions"];
|
|
5429
|
+
if (typeof entry["model"] === "string")
|
|
5430
|
+
normalized["model"] = canonicalModelString(entry["model"]);
|
|
5431
|
+
const explicitReasoning = canonicalReasoning(entry["reasoning"]);
|
|
5432
|
+
const variant = canonicalReasoning(entry["variant"]);
|
|
5433
|
+
const reasoningEffort = canonicalReasoning(entry["reasoningEffort"]);
|
|
5434
|
+
const thinking = isRecord(entry["thinking"]) ? entry["thinking"] : undefined;
|
|
5435
|
+
const reasoning = explicitReasoning ?? reasoningEffort ?? variant ?? (thinking?.["type"] === "disabled" ? "off" : undefined);
|
|
5436
|
+
if (reasoning !== undefined)
|
|
5437
|
+
normalized["reasoning"] = reasoning;
|
|
5438
|
+
const providerOptions = isRecord(entry["provider_options"]) ? { ...entry["provider_options"] } : isRecord(entry["providerOptions"]) ? { ...entry["providerOptions"] } : {};
|
|
5439
|
+
if (thinking?.["type"] === "enabled")
|
|
5440
|
+
providerOptions["thinking"] = { ...thinking };
|
|
5441
|
+
if (entry["textVerbosity"] !== undefined)
|
|
5442
|
+
providerOptions["textVerbosity"] = entry["textVerbosity"];
|
|
5443
|
+
if (Object.keys(providerOptions).length > 0)
|
|
5444
|
+
normalized["provider_options"] = providerOptions;
|
|
5445
|
+
if (entry["max_tokens"] !== undefined)
|
|
5446
|
+
normalized["max_tokens"] = entry["max_tokens"];
|
|
5447
|
+
else if (entry["maxTokens"] !== undefined)
|
|
5448
|
+
normalized["max_tokens"] = entry["maxTokens"];
|
|
5449
|
+
return normalized;
|
|
5450
|
+
}
|
|
5451
|
+
var OmoLegacyFallbackModelObjectInputSchema = object({
|
|
5331
5452
|
model: string2(),
|
|
5332
|
-
|
|
5333
|
-
reasoningEffort: OmoReasoningEffortSchema.optional(),
|
|
5453
|
+
reasoning: OmoReasoningSchema.optional(),
|
|
5334
5454
|
temperature: number2().min(0).max(2).optional(),
|
|
5335
5455
|
top_p: number2().min(0).max(1).optional(),
|
|
5456
|
+
max_tokens: number2().int().positive().optional(),
|
|
5457
|
+
provider_options: record(string2(), unknown()).optional(),
|
|
5458
|
+
variant: string2().optional(),
|
|
5459
|
+
reasoningEffort: OmoReasoningEffortSchema.optional(),
|
|
5460
|
+
thinking: OmoThinkingConfigSchema.optional(),
|
|
5461
|
+
textVerbosity: _enum(["low", "medium", "high"]).optional(),
|
|
5336
5462
|
maxTokens: number2().optional(),
|
|
5337
|
-
|
|
5463
|
+
providerOptions: record(string2(), unknown()).optional()
|
|
5338
5464
|
}).strict();
|
|
5465
|
+
var OmoFallbackModelObjectSchema = preprocess((value) => isRecord(value) ? normalizeLegacyModelFields(value) : value, OmoLegacyFallbackModelObjectInputSchema);
|
|
5339
5466
|
var OmoFallbackModelsSchema = union([
|
|
5340
5467
|
string2(),
|
|
5341
5468
|
array(string2()),
|
|
@@ -5344,19 +5471,16 @@ var OmoFallbackModelsSchema = union([
|
|
|
5344
5471
|
]);
|
|
5345
5472
|
|
|
5346
5473
|
// ../../omo-config-core/src/schema/agent.ts
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
reasoningEffort: OmoReasoningEffortSchema.optional()
|
|
5353
|
-
}).strict()
|
|
5354
|
-
]);
|
|
5355
|
-
var OmoAgentDefSchema = object({
|
|
5474
|
+
function isRecord2(value) {
|
|
5475
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5476
|
+
}
|
|
5477
|
+
var OmoAgentModelEntrySchema = union([string2(), OmoFallbackModelObjectSchema]);
|
|
5478
|
+
var OmoAgentDefInputSchema = object({
|
|
5356
5479
|
description: string2().optional(),
|
|
5357
5480
|
prompt: string2().optional(),
|
|
5358
5481
|
model: string2().optional(),
|
|
5359
5482
|
models: array(OmoAgentModelEntrySchema).optional(),
|
|
5483
|
+
reasoning: OmoReasoningSchema.optional(),
|
|
5360
5484
|
variant: string2().optional(),
|
|
5361
5485
|
reasoningEffort: OmoReasoningEffortSchema.optional(),
|
|
5362
5486
|
tools: record(string2(), boolean2()).optional(),
|
|
@@ -5369,16 +5493,24 @@ var OmoAgentDefSchema = object({
|
|
|
5369
5493
|
temperature: number2().min(0).max(2).optional(),
|
|
5370
5494
|
disable: boolean2().optional()
|
|
5371
5495
|
}).strict();
|
|
5496
|
+
var OmoAgentDefSchema = preprocess((value) => isRecord2(value) ? normalizeLegacyModelFields(value) : value, OmoAgentDefInputSchema);
|
|
5372
5497
|
var OmoAgentsConfigSchema = record(string2(), OmoAgentDefSchema);
|
|
5373
5498
|
|
|
5374
5499
|
// ../../omo-config-core/src/schema/category.ts
|
|
5375
|
-
|
|
5500
|
+
function isRecord3(value) {
|
|
5501
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5502
|
+
}
|
|
5503
|
+
var OmoCategoryConfigObjectSchema = object({
|
|
5376
5504
|
description: string2().optional(),
|
|
5377
5505
|
model: string2().optional(),
|
|
5378
|
-
|
|
5379
|
-
|
|
5506
|
+
models: array(union([string2(), OmoFallbackModelObjectSchema])).optional(),
|
|
5507
|
+
reasoning: OmoReasoningSchema.optional(),
|
|
5380
5508
|
temperature: number2().min(0).max(2).optional(),
|
|
5381
5509
|
top_p: number2().min(0).max(1).optional(),
|
|
5510
|
+
max_tokens: number2().int().positive().optional(),
|
|
5511
|
+
provider_options: record(string2(), unknown()).optional(),
|
|
5512
|
+
fallback_models: OmoFallbackModelsSchema.optional(),
|
|
5513
|
+
variant: string2().optional(),
|
|
5382
5514
|
maxTokens: number2().optional(),
|
|
5383
5515
|
thinking: OmoThinkingConfigSchema.optional(),
|
|
5384
5516
|
reasoningEffort: OmoReasoningEffortSchema.optional(),
|
|
@@ -5387,8 +5519,10 @@ var OmoCategoryConfigSchema = object({
|
|
|
5387
5519
|
prompt_append: string2().optional(),
|
|
5388
5520
|
max_prompt_tokens: number2().int().positive().optional(),
|
|
5389
5521
|
is_unstable_agent: boolean2().optional(),
|
|
5390
|
-
disable: boolean2().optional()
|
|
5522
|
+
disable: boolean2().optional(),
|
|
5523
|
+
warn_unavailable: boolean2().optional()
|
|
5391
5524
|
}).strict();
|
|
5525
|
+
var OmoCategoryConfigSchema = preprocess((value) => isRecord3(value) ? normalizeLegacyModelFields(value) : value, OmoCategoryConfigObjectSchema);
|
|
5392
5526
|
var OmoCategoriesConfigSchema = record(string2(), OmoCategoryConfigSchema);
|
|
5393
5527
|
|
|
5394
5528
|
// ../../omo-config-core/src/schema/harness.ts
|
|
@@ -5416,13 +5550,19 @@ var OmoCodegraphSettingsSchema = OmoCodegraphSettingsLayerSchema.extend({
|
|
|
5416
5550
|
}).strict();
|
|
5417
5551
|
|
|
5418
5552
|
// ../../omo-config-core/src/schema/model-catalog.ts
|
|
5419
|
-
|
|
5553
|
+
function isRecord4(value) {
|
|
5554
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5555
|
+
}
|
|
5556
|
+
var OmoModelCatalogEntryInputSchema = object({
|
|
5420
5557
|
model: string2(),
|
|
5558
|
+
reasoning: OmoReasoningSchema.optional(),
|
|
5421
5559
|
variant: string2().optional(),
|
|
5422
5560
|
reasoningEffort: OmoReasoningEffortSchema.optional()
|
|
5423
5561
|
}).strict();
|
|
5562
|
+
var OmoModelCatalogEntrySchema = preprocess((value) => isRecord4(value) ? normalizeLegacyModelFields(value) : value, OmoModelCatalogEntryInputSchema);
|
|
5424
5563
|
var OmoModelCatalogSchema = record(string2(), OmoModelCatalogEntrySchema);
|
|
5425
|
-
var
|
|
5564
|
+
var OmoModelCatalogEntryLayerInputSchema = OmoModelCatalogEntryInputSchema.partial();
|
|
5565
|
+
var OmoModelCatalogEntryLayerSchema = preprocess((value) => isRecord4(value) ? normalizeLegacyModelFields(value) : value, OmoModelCatalogEntryLayerInputSchema);
|
|
5426
5566
|
var OmoModelCatalogLayerSchema = record(string2(), OmoModelCatalogEntryLayerSchema);
|
|
5427
5567
|
|
|
5428
5568
|
// ../../omo-config-core/src/schema/task.ts
|
|
@@ -5436,6 +5576,9 @@ var OmoTaskTeamSettingsSchema = object({
|
|
|
5436
5576
|
max_parallel_members: number2().int().min(1).max(8).default(4),
|
|
5437
5577
|
max_wall_clock_minutes: number2().int().positive().default(120)
|
|
5438
5578
|
}).strict();
|
|
5579
|
+
var OmoTaskWarningsSchema = object({
|
|
5580
|
+
unavailable_categories: boolean2().default(true)
|
|
5581
|
+
}).strict();
|
|
5439
5582
|
var OmoTaskSettingsSchema = object({
|
|
5440
5583
|
default_execution_mode: _enum(["in-process", "process"]).default("in-process"),
|
|
5441
5584
|
default_concurrency: number2().int().positive().default(5),
|
|
@@ -5446,6 +5589,7 @@ var OmoTaskSettingsSchema = object({
|
|
|
5446
5589
|
ttl_ms: number2().int().positive().default(86400000),
|
|
5447
5590
|
state_dir: string2().optional(),
|
|
5448
5591
|
reattach_on_reconcile: boolean2().optional(),
|
|
5592
|
+
warnings: OmoTaskWarningsSchema.default({ unavailable_categories: true }),
|
|
5449
5593
|
wait: OmoTaskWaitSchema.default({ min_ms: 5000, default_ms: 60000, max_ms: 600000 }),
|
|
5450
5594
|
team: OmoTaskTeamSettingsSchema.default({
|
|
5451
5595
|
max_members: 8,
|
|
@@ -5463,6 +5607,9 @@ var OmoTaskTeamSettingsLayerSchema = object({
|
|
|
5463
5607
|
max_parallel_members: number2().int().min(1).max(8).optional(),
|
|
5464
5608
|
max_wall_clock_minutes: number2().int().positive().optional()
|
|
5465
5609
|
}).strict();
|
|
5610
|
+
var OmoTaskWarningsLayerSchema = object({
|
|
5611
|
+
unavailable_categories: boolean2().optional()
|
|
5612
|
+
}).strict();
|
|
5466
5613
|
var OmoTaskSettingsLayerSchema = object({
|
|
5467
5614
|
default_execution_mode: _enum(["in-process", "process"]).optional(),
|
|
5468
5615
|
default_concurrency: number2().int().positive().optional(),
|
|
@@ -5473,6 +5620,7 @@ var OmoTaskSettingsLayerSchema = object({
|
|
|
5473
5620
|
ttl_ms: number2().int().positive().optional(),
|
|
5474
5621
|
state_dir: string2().optional(),
|
|
5475
5622
|
reattach_on_reconcile: boolean2().optional(),
|
|
5623
|
+
warnings: OmoTaskWarningsLayerSchema.optional(),
|
|
5476
5624
|
wait: OmoTaskWaitLayerSchema.optional(),
|
|
5477
5625
|
team: OmoTaskTeamSettingsLayerSchema.optional()
|
|
5478
5626
|
}).strict();
|
|
@@ -6973,7 +7121,8 @@ function mergeOmoConfigRecords(base, override, parentKey) {
|
|
|
6973
7121
|
}
|
|
6974
7122
|
|
|
6975
7123
|
// ../../omo-config-core/src/loader/paths.ts
|
|
6976
|
-
import {
|
|
7124
|
+
import { userInfo } from "node:os";
|
|
7125
|
+
import { dirname as dirname2, join as join6, posix, resolve as resolve4 } from "node:path";
|
|
6977
7126
|
|
|
6978
7127
|
// ../../omo-config-core/src/internal/posix-path.ts
|
|
6979
7128
|
function toPosixPath(path) {
|
|
@@ -6991,10 +7140,7 @@ var DEFAULT_READ_FILE_SYSTEM = {
|
|
|
6991
7140
|
|
|
6992
7141
|
// ../../omo-config-core/src/loader/paths.ts
|
|
6993
7142
|
var MAX_PROJECT_CONFIG_DIRECTORY_DEPTH = 256;
|
|
6994
|
-
|
|
6995
|
-
const pathToChild = relative(parent, child);
|
|
6996
|
-
return pathToChild === "" || !pathToChild.startsWith("..") && !isAbsolute2(pathToChild);
|
|
6997
|
-
}
|
|
7143
|
+
var ACCOUNT_HOME_DIR = userInfo().homedir;
|
|
6998
7144
|
function resolveHomeDir(env = process.env) {
|
|
6999
7145
|
const homeDir = env.HOME ?? env.USERPROFILE ?? process.cwd();
|
|
7000
7146
|
return homeDir.startsWith("/") ? posix.resolve(homeDir) : toPosixPath(resolve4(homeDir));
|
|
@@ -7046,15 +7192,14 @@ function realpathOrSelf(path, fileSystem) {
|
|
|
7046
7192
|
return path;
|
|
7047
7193
|
}
|
|
7048
7194
|
}
|
|
7049
|
-
function findProjectConfigPathsFarthestFirst(cwd, homeDir, fileSystem) {
|
|
7195
|
+
function findProjectConfigPathsFarthestFirst(cwd, homeDir, fileSystem, accountHomeDir = homeDir) {
|
|
7050
7196
|
const startDir = resolve4(cwd);
|
|
7051
|
-
const
|
|
7052
|
-
const
|
|
7053
|
-
const stopDir = containsPath(realHomeDir, realpathOrSelf(startDir, fileSystem)) ? realHomeDir : null;
|
|
7197
|
+
const boundaryDirs = [...new Set([resolve4(homeDir), resolve4(accountHomeDir)])];
|
|
7198
|
+
const realBoundaryDirs = new Set(boundaryDirs.map((path) => realpathOrSelf(path, fileSystem)));
|
|
7054
7199
|
const nearestFirst = [];
|
|
7055
7200
|
let currentDir = startDir;
|
|
7056
7201
|
for (let depth = 0;depth < MAX_PROJECT_CONFIG_DIRECTORY_DEPTH; depth += 1) {
|
|
7057
|
-
const isHomeDir = currentDir
|
|
7202
|
+
const isHomeDir = boundaryDirs.includes(currentDir) || realBoundaryDirs.has(realpathOrSelf(currentDir, fileSystem));
|
|
7058
7203
|
const configPath = isHomeDir ? null : detectOmoJsonPath(currentDir, fileSystem);
|
|
7059
7204
|
if (configPath !== null)
|
|
7060
7205
|
nearestFirst.push(configPath);
|
|
@@ -7071,7 +7216,7 @@ function resolveOmoConfigPaths(options) {
|
|
|
7071
7216
|
const fileSystem = options.fileSystem ?? DEFAULT_READ_FILE_SYSTEM;
|
|
7072
7217
|
const env = options.env ?? process.env;
|
|
7073
7218
|
const userPath = detectUserOmoJsonPath(env, fileSystem);
|
|
7074
|
-
const projectPaths = findProjectConfigPathsFarthestFirst(options.cwd, resolveHomeDir(env), fileSystem);
|
|
7219
|
+
const projectPaths = findProjectConfigPathsFarthestFirst(options.cwd, resolveHomeDir(env), fileSystem, ACCOUNT_HOME_DIR);
|
|
7075
7220
|
return [
|
|
7076
7221
|
{ path: userPath, scope: "user" },
|
|
7077
7222
|
...projectPaths.map((path) => ({ path, scope: "project" }))
|
|
@@ -7706,6 +7851,23 @@ function prepareTargetWrite(input) {
|
|
|
7706
7851
|
const edits = [...collectMigrationEdits(merged.additions), { path: ["_migrations"], value: marker }];
|
|
7707
7852
|
return { diagnostics: merged.diagnostics, document, edits };
|
|
7708
7853
|
}
|
|
7854
|
+
function prepareTargetReplacement(input) {
|
|
7855
|
+
const marker = markerValue(input.target, input.migrationId, input.targetPath);
|
|
7856
|
+
const document = { ...input.document, _migrations: marker };
|
|
7857
|
+
validateTarget(input.targetPath, document);
|
|
7858
|
+
const edits = [];
|
|
7859
|
+
for (const key of Object.keys(input.target)) {
|
|
7860
|
+
if (key !== "_migrations" && !Object.prototype.hasOwnProperty.call(input.document, key)) {
|
|
7861
|
+
edits.push({ path: [key], value: undefined });
|
|
7862
|
+
}
|
|
7863
|
+
}
|
|
7864
|
+
for (const [key, value] of Object.entries(input.document)) {
|
|
7865
|
+
if (key !== "_migrations")
|
|
7866
|
+
edits.push({ path: [key], value });
|
|
7867
|
+
}
|
|
7868
|
+
edits.push({ path: ["_migrations"], value: marker });
|
|
7869
|
+
return { diagnostics: [], document, edits };
|
|
7870
|
+
}
|
|
7709
7871
|
function writePreparedTarget(input) {
|
|
7710
7872
|
input.writeTarget({
|
|
7711
7873
|
edits: input.prepared.edits,
|
|
@@ -7738,9 +7900,17 @@ function parseJournal(value) {
|
|
|
7738
7900
|
if (!isPlainObject3(value["targetWrite"]) || !isPlainObject3(value["targetWrite"]["additions"])) {
|
|
7739
7901
|
throw new Error("Migration journal target write is invalid");
|
|
7740
7902
|
}
|
|
7903
|
+
const targetWriteMode = value["targetWrite"]["mode"];
|
|
7904
|
+
if (targetWriteMode !== undefined && targetWriteMode !== "replace-target") {
|
|
7905
|
+
throw new Error("Migration journal target write mode is invalid");
|
|
7906
|
+
}
|
|
7741
7907
|
if (typeof value["targetWritten"] !== "boolean" || !Array.isArray(value["completedMoves"])) {
|
|
7742
7908
|
throw new Error("Migration journal completion state is invalid");
|
|
7743
7909
|
}
|
|
7910
|
+
const diagnostics = value["diagnostics"];
|
|
7911
|
+
if (diagnostics !== undefined && (!Array.isArray(diagnostics) || !diagnostics.every((entry) => typeof entry === "string"))) {
|
|
7912
|
+
throw new Error("Migration journal diagnostics are invalid");
|
|
7913
|
+
}
|
|
7744
7914
|
if (!value["completedMoves"].every((path) => typeof path === "string")) {
|
|
7745
7915
|
throw new Error("Migration journal completed moves are invalid");
|
|
7746
7916
|
}
|
|
@@ -7756,9 +7926,13 @@ function parseJournal(value) {
|
|
|
7756
7926
|
return {
|
|
7757
7927
|
backupMoves,
|
|
7758
7928
|
completedMoves: [...value["completedMoves"]],
|
|
7929
|
+
diagnostics: diagnostics === undefined ? [] : [...diagnostics],
|
|
7759
7930
|
migrationId: value["migrationId"],
|
|
7760
7931
|
targetPath: value["targetPath"],
|
|
7761
|
-
targetWrite: {
|
|
7932
|
+
targetWrite: {
|
|
7933
|
+
additions: { ...value["targetWrite"]["additions"] },
|
|
7934
|
+
...targetWriteMode === undefined ? {} : { mode: targetWriteMode }
|
|
7935
|
+
},
|
|
7762
7936
|
targetWritten: value["targetWritten"],
|
|
7763
7937
|
version: 1
|
|
7764
7938
|
};
|
|
@@ -7949,7 +8123,12 @@ function resumeMigrationJournal(input) {
|
|
|
7949
8123
|
input.renewLock();
|
|
7950
8124
|
const target = targetDocument(journal.targetPath, input.fileSystem);
|
|
7951
8125
|
if (!hasMigrationMarker(target, journal.migrationId)) {
|
|
7952
|
-
const prepared =
|
|
8126
|
+
const prepared = journal.targetWrite.mode === "replace-target" ? prepareTargetReplacement({
|
|
8127
|
+
document: journal.targetWrite.additions,
|
|
8128
|
+
migrationId: journal.migrationId,
|
|
8129
|
+
target,
|
|
8130
|
+
targetPath: journal.targetPath
|
|
8131
|
+
}) : prepareTargetWrite({
|
|
7953
8132
|
additions: journal.targetWrite.additions,
|
|
7954
8133
|
migrationId: journal.migrationId,
|
|
7955
8134
|
target,
|
|
@@ -8053,11 +8232,17 @@ function executePlan(input) {
|
|
|
8053
8232
|
assertSafeSourcePaths(plan.sources, protectedPaths);
|
|
8054
8233
|
const existingSources = plan.sources.filter((source) => fileSystem.existsSync(source.path));
|
|
8055
8234
|
const target = targetDocument(plan.targetPath, fileSystem);
|
|
8056
|
-
|
|
8235
|
+
const replaceTarget = plan.mode === "replace-target";
|
|
8236
|
+
if (!shouldRunMigration({
|
|
8237
|
+
legacySourcesExist: replaceTarget ? fileSystem.existsSync(plan.targetPath) : existingSources.length > 0,
|
|
8238
|
+
migrationId: plan.id,
|
|
8239
|
+
target
|
|
8240
|
+
})) {
|
|
8057
8241
|
return { diagnostics: [], journalResumed, status: "skipped" };
|
|
8058
8242
|
}
|
|
8059
|
-
const
|
|
8060
|
-
const
|
|
8243
|
+
const loaded = replaceTarget ? [{ path: plan.targetPath, value: target }] : loadSources(existingSources, fileSystem);
|
|
8244
|
+
const transformed = transformResult(plan.transform(loaded));
|
|
8245
|
+
const prepared = replaceTarget ? prepareTargetReplacement({ document: transformed.document, migrationId: plan.id, target, targetPath: plan.targetPath }) : prepareTargetWrite({ additions: transformed.document, migrationId: plan.id, target, targetPath: plan.targetPath });
|
|
8061
8246
|
const diagnostics = [...transformed.diagnostics, ...prepared.diagnostics];
|
|
8062
8247
|
const moves = backupMoves(existingSources, plan.id, fileSystem, protectedPaths);
|
|
8063
8248
|
const preview = { backupMoves: moves, targetPath: plan.targetPath, transform: transformed.document };
|
|
@@ -8067,9 +8252,13 @@ function executePlan(input) {
|
|
|
8067
8252
|
const journal = {
|
|
8068
8253
|
backupMoves: moves,
|
|
8069
8254
|
completedMoves: [],
|
|
8255
|
+
diagnostics,
|
|
8070
8256
|
migrationId: plan.id,
|
|
8071
8257
|
targetPath: plan.targetPath,
|
|
8072
|
-
targetWrite: {
|
|
8258
|
+
targetWrite: {
|
|
8259
|
+
additions: transformed.document,
|
|
8260
|
+
...replaceTarget ? { mode: "replace-target" } : {}
|
|
8261
|
+
},
|
|
8073
8262
|
targetWritten: false,
|
|
8074
8263
|
version: 1
|
|
8075
8264
|
};
|
|
@@ -8133,17 +8322,17 @@ import { existsSync as existsSync5 } from "node:fs";
|
|
|
8133
8322
|
import { posix as posix4, win32 } from "node:path";
|
|
8134
8323
|
var MIGRATION_ID = "2026-07-codex-config-jsonc";
|
|
8135
8324
|
var OMO_SCHEMA_URL = "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/omo.schema.json";
|
|
8136
|
-
function
|
|
8325
|
+
function isRecord5(value) {
|
|
8137
8326
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8138
8327
|
}
|
|
8139
8328
|
function recordAt(value, key) {
|
|
8140
8329
|
const candidate = value[key];
|
|
8141
|
-
return
|
|
8330
|
+
return isRecord5(candidate) ? candidate : undefined;
|
|
8142
8331
|
}
|
|
8143
8332
|
function migrationHistory(sources, configPath) {
|
|
8144
8333
|
const history = [];
|
|
8145
8334
|
for (const source of sources) {
|
|
8146
|
-
if (!
|
|
8335
|
+
if (!isRecord5(source.value))
|
|
8147
8336
|
continue;
|
|
8148
8337
|
for (const key of ["_migrations", "appliedMigrations"]) {
|
|
8149
8338
|
const values = source.value[key];
|
|
@@ -8159,7 +8348,7 @@ function migrationHistory(sources, configPath) {
|
|
|
8159
8348
|
}
|
|
8160
8349
|
function transformConfigJsonc(configPath, sources) {
|
|
8161
8350
|
const config2 = sources.find((source) => source.path === configPath);
|
|
8162
|
-
const legacy = config2 === undefined || !
|
|
8351
|
+
const legacy = config2 === undefined || !isRecord5(config2.value) ? {} : config2.value;
|
|
8163
8352
|
const omo = recordAt(legacy, "[omo]");
|
|
8164
8353
|
const senpi = recordAt(legacy, "[senpi]");
|
|
8165
8354
|
const history = migrationHistory(sources, configPath);
|
|
@@ -8407,7 +8596,7 @@ function resolveHomeDir3(env) {
|
|
|
8407
8596
|
return env["HOME"] ?? env["USERPROFILE"] ?? homedir6();
|
|
8408
8597
|
}
|
|
8409
8598
|
function resolveHookProjectRoot(input, fallback) {
|
|
8410
|
-
if (!
|
|
8599
|
+
if (!isRecord6(input))
|
|
8411
8600
|
return fallback;
|
|
8412
8601
|
const cwd = input["cwd"];
|
|
8413
8602
|
return typeof cwd === "string" && cwd.trim().length > 0 ? cwd : fallback;
|
|
@@ -8422,7 +8611,7 @@ async function readHookInput(stdin) {
|
|
|
8422
8611
|
return;
|
|
8423
8612
|
return parseJson(text);
|
|
8424
8613
|
}
|
|
8425
|
-
function
|
|
8614
|
+
function isRecord6(value) {
|
|
8426
8615
|
return typeof value === "object" && value !== null;
|
|
8427
8616
|
}
|
|
8428
8617
|
function parseJson(text) {
|
|
@@ -8465,7 +8654,7 @@ function parseWindowsProcessTable(output) {
|
|
|
8465
8654
|
const entries = Array.isArray(parsed) ? parsed : parsed === undefined ? [] : [parsed];
|
|
8466
8655
|
const processes = [];
|
|
8467
8656
|
for (const entry of entries) {
|
|
8468
|
-
if (!
|
|
8657
|
+
if (!isRecord7(entry))
|
|
8469
8658
|
continue;
|
|
8470
8659
|
const pid = numberField(entry, "ProcessId");
|
|
8471
8660
|
const ppid = numberField(entry, "ParentProcessId");
|
|
@@ -8499,7 +8688,7 @@ function stringField(record2, key) {
|
|
|
8499
8688
|
const value = record2[key];
|
|
8500
8689
|
return typeof value === "string" ? value : undefined;
|
|
8501
8690
|
}
|
|
8502
|
-
function
|
|
8691
|
+
function isRecord7(value) {
|
|
8503
8692
|
return typeof value === "object" && value !== null;
|
|
8504
8693
|
}
|
|
8505
8694
|
|
|
@@ -8587,7 +8776,7 @@ async function runProcessFamilySweep(config2, options) {
|
|
|
8587
8776
|
}
|
|
8588
8777
|
try {
|
|
8589
8778
|
const plan = await config2.collect();
|
|
8590
|
-
const { failed, killed } = dryRun ? { failed: [], killed: [] } : await killTargets(plan.killList, options, config2
|
|
8779
|
+
const { failed, killed } = dryRun ? { failed: [], killed: [] } : await killTargets(plan.killList, options, config2);
|
|
8591
8780
|
if (!dryRun)
|
|
8592
8781
|
writeSweepStamp(config2.stampFile, nowMs);
|
|
8593
8782
|
return {
|
|
@@ -8604,16 +8793,18 @@ async function runProcessFamilySweep(config2, options) {
|
|
|
8604
8793
|
return { action: "failed", candidates: [], dryRun, failed: [], killed: [], spared: [], stampFile: config2.stampFile };
|
|
8605
8794
|
}
|
|
8606
8795
|
}
|
|
8607
|
-
async function killTargets(targets, options,
|
|
8796
|
+
async function killTargets(targets, options, config2) {
|
|
8608
8797
|
const failed = [];
|
|
8609
8798
|
const killed = [];
|
|
8610
8799
|
const context = {
|
|
8611
8800
|
failed,
|
|
8612
|
-
familyLabel,
|
|
8801
|
+
familyLabel: config2.familyLabel,
|
|
8613
8802
|
killer: options.killer ?? createDefaultProcessKiller(options.platform),
|
|
8614
8803
|
log: options.log
|
|
8615
8804
|
};
|
|
8616
8805
|
for (const target of targets) {
|
|
8806
|
+
if (!await passesSignalAttestation(target, config2.attestBeforeSignal, options.log, "SIGTERM"))
|
|
8807
|
+
continue;
|
|
8617
8808
|
const terminated = await safelyTerminate(target.pid, context);
|
|
8618
8809
|
if (!terminated)
|
|
8619
8810
|
continue;
|
|
@@ -8622,11 +8813,26 @@ async function killTargets(targets, options, familyLabel) {
|
|
|
8622
8813
|
killed.push(target);
|
|
8623
8814
|
continue;
|
|
8624
8815
|
}
|
|
8816
|
+
if (!await passesSignalAttestation(target, config2.attestBeforeSignal, options.log, "SIGKILL"))
|
|
8817
|
+
continue;
|
|
8625
8818
|
if (await safelyKill(target.pid, context))
|
|
8626
8819
|
killed.push(target);
|
|
8627
8820
|
}
|
|
8628
8821
|
return { failed, killed };
|
|
8629
8822
|
}
|
|
8823
|
+
async function passesSignalAttestation(target, attest, log, signal) {
|
|
8824
|
+
if (attest === undefined)
|
|
8825
|
+
return true;
|
|
8826
|
+
try {
|
|
8827
|
+
const attested = await attest(target);
|
|
8828
|
+
if (!attested)
|
|
8829
|
+
log?.(`process sweep sparing pid ${target.pid}: identity changed before ${signal}`);
|
|
8830
|
+
return attested;
|
|
8831
|
+
} catch (error) {
|
|
8832
|
+
log?.(`process sweep sparing pid ${target.pid}: identity attestation failed before ${signal}: ${String(error)}`);
|
|
8833
|
+
return false;
|
|
8834
|
+
}
|
|
8835
|
+
}
|
|
8630
8836
|
async function safelyTerminate(pid, context) {
|
|
8631
8837
|
try {
|
|
8632
8838
|
await context.killer.terminate(pid);
|
|
@@ -10271,21 +10477,36 @@ function runProcessWithTreeTimeout(options) {
|
|
|
10271
10477
|
};
|
|
10272
10478
|
child.stdout.on("data", (chunk) => capture("stdout", chunk));
|
|
10273
10479
|
child.stderr.on("data", (chunk) => capture("stderr", chunk));
|
|
10274
|
-
|
|
10275
|
-
|
|
10276
|
-
|
|
10277
|
-
|
|
10278
|
-
timeout.unref();
|
|
10480
|
+
let removeTimeoutSignal = () => {
|
|
10481
|
+
return;
|
|
10482
|
+
};
|
|
10483
|
+
let timeout;
|
|
10279
10484
|
const settle = async (exitCode, signal) => {
|
|
10280
10485
|
if (settled)
|
|
10281
10486
|
return;
|
|
10282
10487
|
settled = true;
|
|
10283
10488
|
clearTimeout(timeout);
|
|
10489
|
+
removeTimeoutSignal();
|
|
10284
10490
|
const termination = treeTermination === undefined ? null : await treeTermination;
|
|
10285
10491
|
stderr += stderrDecoder.end();
|
|
10286
10492
|
stdout += stdoutDecoder.end();
|
|
10287
10493
|
resolvePromise({ exitCode, signal, stderr, stdout, termination, timedOut });
|
|
10288
10494
|
};
|
|
10495
|
+
const triggerTimeout = () => {
|
|
10496
|
+
if (settled)
|
|
10497
|
+
return;
|
|
10498
|
+
timedOut = true;
|
|
10499
|
+
startTermination().then(() => settle(124, child.signalCode));
|
|
10500
|
+
};
|
|
10501
|
+
timeout = setTimeout(triggerTimeout, options.timeoutMs);
|
|
10502
|
+
timeout.unref();
|
|
10503
|
+
if (options.timeoutSignal?.aborted === true) {
|
|
10504
|
+
triggerTimeout();
|
|
10505
|
+
} else if (options.timeoutSignal !== undefined) {
|
|
10506
|
+
const timeoutSignal = options.timeoutSignal;
|
|
10507
|
+
timeoutSignal.addEventListener("abort", triggerTimeout, { once: true });
|
|
10508
|
+
removeTimeoutSignal = () => timeoutSignal.removeEventListener("abort", triggerTimeout);
|
|
10509
|
+
}
|
|
10289
10510
|
child.once("error", () => {
|
|
10290
10511
|
resolveChildClosed();
|
|
10291
10512
|
settle(1, null);
|
|
@@ -10699,12 +10920,12 @@ function textFromUnknown(value) {
|
|
|
10699
10920
|
if (Array.isArray(value))
|
|
10700
10921
|
return value.map(textFromUnknown).filter(Boolean).join(`
|
|
10701
10922
|
`);
|
|
10702
|
-
if (!
|
|
10923
|
+
if (!isRecord8(value))
|
|
10703
10924
|
return "";
|
|
10704
10925
|
return Object.entries(value).map(([key, nested]) => `${key}: ${textFromUnknown(nested)}`).filter((line) => line.trim().length > 0).join(`
|
|
10705
10926
|
`);
|
|
10706
10927
|
}
|
|
10707
|
-
function
|
|
10928
|
+
function isRecord8(value) {
|
|
10708
10929
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10709
10930
|
}
|
|
10710
10931
|
|
|
@@ -10722,9 +10943,9 @@ async function executeCodegraphPostToolUseHook(options = {}) {
|
|
|
10722
10943
|
return { action: "emitted-guidance", exitCode: 0 };
|
|
10723
10944
|
}
|
|
10724
10945
|
function runCodegraphPostToolUseHook(input, options = {}) {
|
|
10725
|
-
const toolName =
|
|
10726
|
-
const cwd =
|
|
10727
|
-
const toolOutput =
|
|
10946
|
+
const toolName = isRecord6(input) ? input["tool_name"] : undefined;
|
|
10947
|
+
const cwd = isRecord6(input) ? input["cwd"] : undefined;
|
|
10948
|
+
const toolOutput = isRecord6(input) ? input["tool_response"] ?? input["tool_output"] ?? input["response"] : input;
|
|
10728
10949
|
const guidance = buildCodegraphInitGuidanceForToolResult({ cwd, toolName, toolOutput }, options);
|
|
10729
10950
|
if (guidance === null)
|
|
10730
10951
|
return "";
|