oh-my-opencode 4.11.0 → 4.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/.agents/skills/codex-qa/scripts/lib/app-server-client.mjs +132 -82
  2. package/.agents/skills/codex-qa/scripts/lib/app-server-client.test.js +48 -0
  3. package/.agents/skills/opencode-qa/scripts/serve-wake-split-probe.sh +361 -84
  4. package/.agents/skills/work-with-pr/SKILL.md +19 -5
  5. package/.opencode/skills/work-with-pr/SKILL.md +19 -5
  6. package/dist/agents/atlas/agent.d.ts +3 -2
  7. package/dist/agents/sisyphus/glm-5-2.d.ts +4 -0
  8. package/dist/agents/sisyphus/index.d.ts +1 -0
  9. package/dist/agents/sisyphus-agent-config.d.ts +1 -0
  10. package/dist/agents/sisyphus-junior/agent.d.ts +1 -1
  11. package/dist/agents/sisyphus-junior/glm-5-2.d.ts +1 -0
  12. package/dist/agents/sisyphus-junior/index.d.ts +1 -0
  13. package/dist/agents/types.d.ts +7 -6
  14. package/dist/cli/index.js +449 -318
  15. package/dist/cli-node/index.js +449 -318
  16. package/dist/features/background-agent/parent-wake-flush-runner.d.ts +1 -0
  17. package/dist/features/background-agent/parent-wake-history-state.d.ts +1 -0
  18. package/dist/features/background-agent/parent-wake-session-history.d.ts +1 -47
  19. package/dist/features/background-agent/parent-wake-session-message.d.ts +47 -0
  20. package/dist/hooks/keyword-detector/ultrawork/glm.d.ts +2 -0
  21. package/dist/hooks/keyword-detector/ultrawork/index.d.ts +4 -2
  22. package/dist/hooks/keyword-detector/ultrawork/source-detector.d.ts +5 -4
  23. package/dist/index.js +1185 -87
  24. package/dist/plugin/tool-execute-before.d.ts +2 -0
  25. package/dist/plugin-handlers/plugin-components-loader.d.ts +1 -0
  26. package/dist/skills/init-deep/SKILL.md +21 -26
  27. package/dist/skills/programming/SKILL.md +25 -121
  28. package/dist/skills/programming/references/code-smells.md +390 -0
  29. package/dist/skills/ulw-plan/SKILL.md +2 -1
  30. package/dist/skills/ulw-plan/references/full-workflow.md +1 -1
  31. package/dist/skills/ulw-plan/references/intent-clear.md +2 -2
  32. package/dist/tools/delegate-task/sync-session-poller.d.ts +1 -2
  33. package/dist/tools/delegate-task/sync-session-turns.d.ts +3 -0
  34. package/dist/tui.js +16 -7
  35. package/package.json +13 -13
  36. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +22 -2
  37. package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +51 -21
  38. package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
  39. package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
  40. package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +18 -7
  41. package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +9 -2
  42. package/packages/omo-codex/plugin/components/codegraph/package.json +1 -1
  43. package/packages/omo-codex/plugin/components/codegraph/src/hook.ts +8 -7
  44. package/packages/omo-codex/plugin/components/codegraph/src/serve.ts +7 -2
  45. package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker.ts +2 -1
  46. package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +20 -19
  47. package/packages/omo-codex/plugin/components/codegraph/test/provisioned-node-guard.test.ts +94 -0
  48. package/packages/omo-codex/plugin/components/codegraph/test/serve-node-support.test.ts +33 -0
  49. package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
  50. package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
  51. package/packages/omo-codex/plugin/components/comment-checker/test/package-smoke.test.ts +2 -71
  52. package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
  53. package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
  54. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
  55. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
  56. package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
  57. package/packages/omo-codex/plugin/components/lsp/package.json +2 -2
  58. package/packages/omo-codex/plugin/components/lsp/test/package-smoke.test.ts +26 -104
  59. package/packages/omo-codex/plugin/components/rules/dist/cli.js +2 -2
  60. package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
  61. package/packages/omo-codex/plugin/components/rules/package.json +1 -1
  62. package/packages/omo-codex/plugin/components/rules/src/sparkshell-awareness.ts +2 -2
  63. package/packages/omo-codex/plugin/components/rules/test/package-smoke.test.ts +12 -92
  64. package/packages/omo-codex/plugin/components/rules/test/sparkshell-awareness.test.ts +3 -0
  65. package/packages/omo-codex/plugin/components/start-work-continuation/dist/cli.js +157 -234
  66. package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +2 -2
  67. package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -2
  68. package/packages/omo-codex/plugin/components/start-work-continuation/src/boulder-reader.ts +227 -15
  69. package/packages/omo-codex/plugin/components/start-work-continuation/test/boulder-reader.test.ts +62 -2
  70. package/packages/omo-codex/plugin/components/start-work-continuation/test/cli.test.ts +34 -3
  71. package/packages/omo-codex/plugin/components/teammode/skills/teammode/SKILL.md +139 -0
  72. package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-guide.mjs +111 -0
  73. package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-state.mjs +250 -0
  74. package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team.mjs +220 -0
  75. package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
  76. package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
  77. package/packages/omo-codex/plugin/components/test-support/package-smoke-fixture.ts +158 -0
  78. package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
  79. package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
  80. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/SKILL.md +2 -1
  81. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/agents/openai.yaml +1 -1
  82. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +1 -1
  83. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-clear.md +2 -2
  84. package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +76 -49
  85. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +2 -2
  86. package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
  87. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/agents/openai.yaml +1 -1
  88. package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +1 -1
  89. package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +17 -0
  90. package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +17 -0
  91. package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +17 -0
  92. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +17 -0
  93. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +17 -0
  94. package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +17 -0
  95. package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +17 -0
  96. package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +17 -0
  97. package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +17 -0
  98. package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +17 -0
  99. package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +16 -0
  100. package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +16 -0
  101. package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +16 -0
  102. package/packages/omo-codex/plugin/hooks/stop-checking-start-work-continuation.json +16 -0
  103. package/packages/omo-codex/plugin/hooks/subagent-stop-checking-start-work-continuation.json +16 -0
  104. package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +17 -0
  105. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +16 -0
  106. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +16 -0
  107. package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +16 -0
  108. package/packages/omo-codex/plugin/package-lock.json +12 -22
  109. package/packages/omo-codex/plugin/package.json +1 -1
  110. package/packages/omo-codex/plugin/scripts/auto-update.mjs +1 -1
  111. package/packages/omo-codex/plugin/scripts/hook-status-message.mjs +14 -11
  112. package/packages/omo-codex/plugin/scripts/sync-hook-status-messages.mjs +15 -4
  113. package/packages/omo-codex/plugin/scripts/sync-skills.mjs +37 -0
  114. package/packages/omo-codex/plugin/skills/ast-grep/agents/openai.yaml +2 -0
  115. package/packages/omo-codex/plugin/skills/comment-checker/agents/openai.yaml +2 -0
  116. package/packages/omo-codex/plugin/skills/debugging/agents/openai.yaml +2 -0
  117. package/packages/omo-codex/plugin/skills/frontend/agents/openai.yaml +2 -0
  118. package/packages/omo-codex/plugin/skills/git-master/agents/openai.yaml +1 -1
  119. package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +21 -26
  120. package/packages/omo-codex/plugin/skills/init-deep/agents/openai.yaml +2 -0
  121. package/packages/omo-codex/plugin/skills/lcx-contribute-bug-fix/agents/openai.yaml +1 -1
  122. package/packages/omo-codex/plugin/skills/lcx-doctor/agents/openai.yaml +1 -1
  123. package/packages/omo-codex/plugin/skills/lcx-report-bug/agents/openai.yaml +1 -1
  124. package/packages/omo-codex/plugin/skills/lsp/agents/openai.yaml +2 -0
  125. package/packages/omo-codex/plugin/skills/lsp-setup/agents/openai.yaml +2 -0
  126. package/packages/omo-codex/plugin/skills/programming/SKILL.md +25 -121
  127. package/packages/omo-codex/plugin/skills/programming/agents/openai.yaml +2 -0
  128. package/packages/omo-codex/plugin/skills/programming/references/code-smells.md +390 -0
  129. package/packages/omo-codex/plugin/skills/refactor/agents/openai.yaml +2 -0
  130. package/packages/omo-codex/plugin/skills/remove-ai-slops/agents/openai.yaml +2 -0
  131. package/packages/omo-codex/plugin/skills/review-work/agents/openai.yaml +2 -0
  132. package/packages/omo-codex/plugin/skills/rules/agents/openai.yaml +2 -0
  133. package/packages/omo-codex/plugin/skills/start-work/agents/openai.yaml +2 -0
  134. package/packages/omo-codex/plugin/skills/teammode/SKILL.md +139 -0
  135. package/packages/omo-codex/plugin/skills/teammode/agents/openai.yaml +2 -0
  136. package/packages/omo-codex/plugin/skills/teammode/scripts/team-guide.mjs +111 -0
  137. package/packages/omo-codex/plugin/skills/teammode/scripts/team-state.mjs +250 -0
  138. package/packages/omo-codex/plugin/skills/teammode/scripts/team.mjs +220 -0
  139. package/packages/omo-codex/plugin/skills/ultraresearch/agents/openai.yaml +2 -0
  140. package/packages/omo-codex/plugin/skills/ulw-loop/agents/openai.yaml +1 -1
  141. package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +2 -1
  142. package/packages/omo-codex/plugin/skills/ulw-plan/agents/openai.yaml +1 -1
  143. package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +1 -1
  144. package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-clear.md +2 -2
  145. package/packages/omo-codex/plugin/skills/visual-qa/agents/openai.yaml +2 -0
  146. package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +34 -33
  147. package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +5 -2
  148. package/packages/omo-codex/plugin/test/aggregate-plugin-fixture.mjs +13 -0
  149. package/packages/omo-codex/plugin/test/auto-update.test.mjs +1 -1
  150. package/packages/omo-codex/plugin/test/bootstrap-binlinks.test.mjs +1 -1
  151. package/packages/omo-codex/plugin/test/bootstrap-hooks.test.mjs +14 -6
  152. package/packages/omo-codex/plugin/test/bootstrap-ps-guard.test.mjs +7 -3
  153. package/packages/omo-codex/plugin/test/bootstrap-setup.test.mjs +31 -0
  154. package/packages/omo-codex/plugin/test/component-bundled-cli.test.mjs +3 -3
  155. package/packages/omo-codex/plugin/test/display-metadata.test.mjs +83 -0
  156. package/packages/omo-codex/plugin/test/hook-status-message.test.mjs +30 -19
  157. package/packages/omo-codex/plugin/test/lcx-bug-skills.test.mjs +3 -3
  158. package/packages/omo-codex/plugin/test/sync-hook-status-messages.test.mjs +6 -6
  159. package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +2 -0
  160. package/packages/omo-codex/plugin/test/sync-skills.test.mjs +9 -4
  161. package/packages/omo-codex/plugin/test/teammode-safety-fixture.mjs +88 -0
  162. package/packages/omo-codex/plugin/test/teammode-safety.test.mjs +240 -0
  163. package/packages/omo-codex/scripts/install-dist/install-local.mjs +412 -216
  164. package/packages/omo-codex/scripts/install-git-bash-mcp-env.test.mjs +24 -0
  165. package/packages/omo-codex/scripts/install-hook-targets.test.mjs +93 -0
  166. package/packages/omo-codex/scripts/install-lazycodex-version-stamp.test.mjs +2 -2
  167. package/packages/omo-codex/scripts/install-local-bun-global-update.test.mjs +63 -0
  168. package/packages/omo-codex/scripts/install-local-entrypoint.test.mjs +109 -1
  169. package/packages/omo-codex/scripts/install-local.mjs +1 -0
  170. package/packages/omo-codex/scripts/install-mcp-runtime.test.mjs +36 -0
  171. package/packages/shared-skills/skills/init-deep/SKILL.md +21 -26
  172. package/packages/shared-skills/skills/programming/SKILL.md +25 -121
  173. package/packages/shared-skills/skills/programming/references/code-smells.md +390 -0
  174. package/packages/shared-skills/skills/ulw-plan/SKILL.md +2 -1
  175. package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +1 -1
  176. package/packages/shared-skills/skills/ulw-plan/references/intent-clear.md +2 -2
  177. package/packages/omo-codex/plugin/hooks/hooks.json +0 -214
package/dist/index.js CHANGED
@@ -20989,6 +20989,11 @@ function isClaudeOpus47OrLaterModel(model) {
20989
20989
  return false;
20990
20990
  return major > 4 || major === 4 && minor >= 7;
20991
20991
  }
20992
+ var CLAUDE_FABLE_OR_MYTHOS_RE = /claude-(?:fable|mythos)-(?:\d+|preview)/;
20993
+ function isClaudeFableOrMythosModel(model) {
20994
+ const modelName = extractModelName(model).toLowerCase().replaceAll(".", "-");
20995
+ return CLAUDE_FABLE_OR_MYTHOS_RE.test(modelName);
20996
+ }
20992
20997
  function isKimiK2Model(model) {
20993
20998
  const modelName = extractModelName(model).toLowerCase();
20994
20999
  if (modelName.includes("kimi"))
@@ -21343,7 +21348,7 @@ function resolveCompatibleModelSettings(input) {
21343
21348
  }
21344
21349
  // packages/model-core/src/model-availability.ts
21345
21350
  function normalizeModelName(name) {
21346
- return name.toLowerCase().replace(/claude-(opus|sonnet|haiku)-(\d+)[.-](\d+)/g, "claude-$1-$2.$3");
21351
+ return name.toLowerCase().replace(/claude-(opus|sonnet|haiku)-(\d+)[.-](\d+)/g, "claude-$1-$2.$3").replace(/kimi-k2[.-](\d+)/g, "kimi-k2.$1").replace(/\b(glm|gpt)-(\d+)[.-](\d+)/g, "$1-$2.$3");
21347
21352
  }
21348
21353
  function fuzzyMatchModel(target, available, providers) {
21349
21354
  if (available.size === 0) {
@@ -22538,7 +22543,7 @@ function getAnthropicActualLimit(modelCacheState) {
22538
22543
  return (modelCacheState?.anthropicContext1MEnabled ?? false) || process2.env.ANTHROPIC_1M_CONTEXT === "true" || process2.env.VERTEX_ANTHROPIC_1M_CONTEXT === "true" ? ANTHROPIC_GA_1M_LIMIT : DEFAULT_ANTHROPIC_ACTUAL_LIMIT;
22539
22544
  }
22540
22545
  function hasGA1MContext(modelID) {
22541
- return /^claude-(opus|sonnet)-4(?:-|\.)(?:6|7|8)(?:-high)?$/.test(modelID);
22546
+ return /^claude-(opus|sonnet)-4(?:-|\.)(?:6|7|8)(?:-high)?$/.test(modelID) || /^claude-(?:fable|mythos)-5$/.test(modelID);
22542
22547
  }
22543
22548
  function resolveActualContextLimit(providerID, modelID, modelCacheState) {
22544
22549
  if (isAnthropicProvider(providerID, modelID)) {
@@ -23386,7 +23391,7 @@ var KIMI_CATEGORIES = [
23386
23391
  // packages/omo-opencode/src/agents/types.ts
23387
23392
  var CLAUDE_THINKING_BUDGET_TOKENS = 32000;
23388
23393
  function buildClaudeThinkingConfig(model) {
23389
- if (isClaudeOpus47OrLaterModel(model)) {
23394
+ if (isClaudeOpus47OrLaterModel(model) || isClaudeFableOrMythosModel(model)) {
23390
23395
  return {};
23391
23396
  }
23392
23397
  return { thinking: { type: "enabled", budgetTokens: CLAUDE_THINKING_BUDGET_TOKENS } };
@@ -23394,7 +23399,7 @@ function buildClaudeThinkingConfig(model) {
23394
23399
  function extractModelName2(model) {
23395
23400
  return model.includes("/") ? model.split("/").pop() ?? model : model;
23396
23401
  }
23397
- var GPT_NATIVE_SISYPHUS_RE = /gpt-5[.-](?:[4-9]|\d{2,})/i;
23402
+ var GPT_NATIVE_SISYPHUS_RE = /gpt-5[.-](?:(?:3[.-])?codex|[4-9]|\d{2,})/i;
23398
23403
  function isGptNativeSisyphusModel(model) {
23399
23404
  const modelName = extractModelName2(model).toLowerCase();
23400
23405
  return GPT_NATIVE_SISYPHUS_RE.test(modelName);
@@ -69992,7 +69997,7 @@ async function probe(registration) {
69992
69997
  registration.available = false;
69993
69998
  return false;
69994
69999
  }
69995
- const probeUrl = new URL("/session", registration.serverUrl);
70000
+ const probeUrl = new URL("/global/health", registration.serverUrl);
69996
70001
  const authHeader = getServerBasicAuthHeader();
69997
70002
  const headers = authHeader ? { Authorization: authHeader } : {};
69998
70003
  try {
@@ -70026,12 +70031,17 @@ async function probe(registration) {
70026
70031
  return false;
70027
70032
  }
70028
70033
  }
70029
- function hasFreshProbe(registration) {
70030
- return registration.available !== undefined && Date.now() - registration.probeTimestamp < PROBE_TTL_MS;
70034
+ function getFreshProbeAvailability(registration) {
70035
+ const available = registration.available;
70036
+ if (available === undefined || Date.now() - registration.probeTimestamp >= PROBE_TTL_MS) {
70037
+ return;
70038
+ }
70039
+ return available;
70031
70040
  }
70032
70041
  async function resolveAvailability(registration) {
70033
- if (hasFreshProbe(registration)) {
70034
- return registration.available;
70042
+ const freshAvailability = getFreshProbeAvailability(registration);
70043
+ if (freshAvailability !== undefined) {
70044
+ return freshAvailability;
70035
70045
  }
70036
70046
  if (!registration.inFlightProbe) {
70037
70047
  registration.inFlightProbe = probe(registration).finally(() => {
@@ -70066,10 +70076,11 @@ function tryResolveDispatchClientSync2(client3, sessionID) {
70066
70076
  if (!registration.serverUrl) {
70067
70077
  return { client: client3, route: "in-process", reason: "unavailable" };
70068
70078
  }
70069
- if (!hasFreshProbe(registration)) {
70079
+ const freshAvailability = getFreshProbeAvailability(registration);
70080
+ if (freshAvailability === undefined) {
70070
70081
  return;
70071
70082
  }
70072
- if (!registration.available) {
70083
+ if (!freshAvailability) {
70073
70084
  return { client: client3, route: "in-process", reason: "unavailable" };
70074
70085
  }
70075
70086
  const resolvedLiveClient = getOrBuildLiveClient(registration);
@@ -70084,6 +70095,9 @@ async function resolveDispatchClient2(client3, sessionID) {
70084
70095
  return syncResult;
70085
70096
  }
70086
70097
  const registration = registrations.get(client3);
70098
+ if (!registration) {
70099
+ return { client: client3, route: "in-process", reason: "identity" };
70100
+ }
70087
70101
  const isAvailable = await resolveAvailability(registration);
70088
70102
  if (!isAvailable) {
70089
70103
  return { client: client3, route: "in-process", reason: "unavailable" };
@@ -80669,7 +80683,7 @@ function getCachedVersion(options = {}) {
80669
80683
  // package.json
80670
80684
  var package_default = {
80671
80685
  name: "oh-my-opencode",
80672
- version: "4.11.0",
80686
+ version: "4.12.0",
80673
80687
  description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
80674
80688
  main: "./dist/index.js",
80675
80689
  types: "dist/index.d.ts",
@@ -80839,18 +80853,18 @@ var package_default = {
80839
80853
  typescript: "^6.0.3"
80840
80854
  },
80841
80855
  optionalDependencies: {
80842
- "oh-my-opencode-darwin-arm64": "4.11.0",
80843
- "oh-my-opencode-darwin-x64": "4.11.0",
80844
- "oh-my-opencode-darwin-x64-baseline": "4.11.0",
80845
- "oh-my-opencode-linux-arm64": "4.11.0",
80846
- "oh-my-opencode-linux-arm64-musl": "4.11.0",
80847
- "oh-my-opencode-linux-x64": "4.11.0",
80848
- "oh-my-opencode-linux-x64-baseline": "4.11.0",
80849
- "oh-my-opencode-linux-x64-musl": "4.11.0",
80850
- "oh-my-opencode-linux-x64-musl-baseline": "4.11.0",
80851
- "oh-my-opencode-windows-arm64": "4.11.0",
80852
- "oh-my-opencode-windows-x64": "4.11.0",
80853
- "oh-my-opencode-windows-x64-baseline": "4.11.0"
80856
+ "oh-my-opencode-darwin-arm64": "4.12.0",
80857
+ "oh-my-opencode-darwin-x64": "4.12.0",
80858
+ "oh-my-opencode-darwin-x64-baseline": "4.12.0",
80859
+ "oh-my-opencode-linux-arm64": "4.12.0",
80860
+ "oh-my-opencode-linux-arm64-musl": "4.12.0",
80861
+ "oh-my-opencode-linux-x64": "4.12.0",
80862
+ "oh-my-opencode-linux-x64-baseline": "4.12.0",
80863
+ "oh-my-opencode-linux-x64-musl": "4.12.0",
80864
+ "oh-my-opencode-linux-x64-musl-baseline": "4.12.0",
80865
+ "oh-my-opencode-windows-arm64": "4.12.0",
80866
+ "oh-my-opencode-windows-x64": "4.12.0",
80867
+ "oh-my-opencode-windows-x64-baseline": "4.12.0"
80854
80868
  },
80855
80869
  overrides: {
80856
80870
  hono: "^4.12.18",
@@ -82353,6 +82367,9 @@ function getUltraworkSource(agentName, modelID) {
82353
82367
  if (modelID && isGeminiModel(modelID)) {
82354
82368
  return "gemini";
82355
82369
  }
82370
+ if (modelID && isGlmModel(modelID)) {
82371
+ return "glm";
82372
+ }
82356
82373
  return "default";
82357
82374
  }
82358
82375
  // packages/prompts-core/prompts/atlas/default.md
@@ -83388,6 +83405,406 @@ The nudge fires at most once per work. If you missed it (compaction, session res
83388
83405
  </boulder_completion_response>
83389
83406
  `;
83390
83407
 
83408
+ // packages/prompts-core/prompts/atlas/glm.md
83409
+ var glm_default = `<role>
83410
+ You are Atlas, the Master Orchestrator from OhMyOpenCode, running on GLM 5.2.
83411
+ Atlas holds the workflow upright. You coordinate agents, preserve state, verify their work, and keep the plan moving until every gate passes.
83412
+ You are a conductor, not a musician. You are a general, not a soldier. You delegate implementation and repairs through \`task()\`. You personally read, verify, mark checkboxes, and decide the next dispatch.
83413
+ You never write application code yourself.
83414
+ </role>
83415
+
83416
+ <mission>
83417
+ Complete the active work plan.
83418
+ Destination: every actionable top-level implementation checkbox is marked \`- [x]\`, and every Final Verification Wave reviewer returns APPROVE.
83419
+ Constraints: parallel fan-out by default, direct verification after each delegation, checkbox marking before the next delegation, and retry through the original \`task_id\` when delegated work fails.
83420
+ Stopping condition: every top-level checkbox is \`- [x]\` AND every Final Wave reviewer says APPROVE.
83421
+ </mission>
83422
+
83423
+ <glm_52_calibration>
83424
+ ## GLM 5.2 Calibration
83425
+
83426
+ GLM 5.2 behaves like Opus 4.6 tuned to think and act like Fable 5, while producing code-oriented work like GPT-5.5. Use Claude-style XML structure for parsing and GPT-style outcome framing for execution.
83427
+
83428
+ ### LITERAL FOLLOWING
83429
+
83430
+ When this prompt says "every", "all", "for each", or "after each", apply the instruction to EVERY matching case. Do not infer "first item only".
83431
+
83432
+ Examples: "after every delegation" means after every single \`task()\` result; "read every changed file" means all files created or modified by the subagent; "fire all independent tasks" means one \`task()\` call per independent task in the same response; "Final Wave reviewers" means every reviewer listed in the plan.
83433
+
83434
+ ### OVER-EXPLORATION COUNTER
83435
+
83436
+ Sufficient context beats complete context. Once you can dispatch correctly, dispatch. Once you can verify correctly, verify. Use exploration only for unknowns that change dispatch or verification decisions.
83437
+
83438
+ ### OVER-ASKING COUNTER
83439
+
83440
+ Do not pause on minor decisions an orchestrator should make. Names, default commands, formatting, batching, and category choice are your responsibility. Pick a reasonable option, record it when useful, and proceed.
83441
+
83442
+ Ask the user only when tools and agents cannot discover information required for safe execution.
83443
+
83444
+ ### CAPABILITY UNDER-REACH COUNTER
83445
+
83446
+ When a Key Trigger, Delegation Table row, category, agent, or skill domain matches the task, use it immediately. Specialist match means action now: load the relevant skills, choose the matching category or subagent, and state the exact expected outcome.
83447
+
83448
+ ### THINKING CALIBRATION
83449
+
83450
+ Use shallow reasoning for mechanical orchestration: parsing checkboxes, grouping independent tasks, batching \`task()\` calls, collecting \`task_id\`s, and marking completed boxes.
83451
+
83452
+ Use deep reasoning for verification and failure diagnosis: reading diffs, explaining changed lines, identifying root causes, judging reviewer rejections, and deciding retry strategy.
83453
+
83454
+ ### FOUR HARD INVARIANTS
83455
+
83456
+ 1. Independent implementation tasks fan out in parallel: one response, multiple \`task()\` calls.
83457
+ 2. After every delegation, verify with your own tools before trusting the result.
83458
+ 3. After every verified completion, mark the plan checkbox before the next implementation delegation.
83459
+ 4. Every retry or repair uses the captured \`task_id\` unless a fresh agent is intentionally chosen for a different angle.
83460
+ </glm_52_calibration>
83461
+
83462
+ <Anti_Duplication>
83463
+ ## Anti-Duplication Rule
83464
+
83465
+ Once you delegate exploration to explore or librarian agents, do not perform the same search yourself.
83466
+ Forbidden:
83467
+
83468
+ Forbidden:
83469
+ - Manual grep/search for the same information after delegating that search.
83470
+ - Re-reading the same target files only to duplicate delegated exploration.
83471
+ - "Quick checks" that overlap with the agent's assigned research.
83472
+
83473
+ Allowed:
83474
+ - Continue non-overlapping work that does not depend on the delegated result.
83475
+ - Prepare prompts, read unrelated plan context, or verify already completed work.
83476
+ - Wait for the completion notification when the delegated result is required.
83477
+
83478
+ When background exploration is not ready: stop dependent work, wait for the completion notification, collect with \`background_output(task_id="bg_...")\`, and do not re-search the delegated scope.
83479
+ </Anti_Duplication>
83480
+
83481
+ <delegation_system>
83482
+ ## Delegation System
83483
+
83484
+ Use \`task()\` with either a category or a specialized agent. They are mutually exclusive.
83485
+
83486
+ \`\`\`typescript
83487
+ task(
83488
+ category="[category-name]",
83489
+ load_skills=["skill-1", "skill-2"],
83490
+ run_in_background=false,
83491
+ prompt="[6-section prompt]"
83492
+ )
83493
+
83494
+ task(
83495
+ subagent_type="[agent-name]",
83496
+ load_skills=[],
83497
+ run_in_background=false,
83498
+ prompt="[6-section prompt]"
83499
+ )
83500
+ \`\`\`
83501
+
83502
+ {CATEGORY_SECTION}
83503
+
83504
+ {AGENT_SECTION}
83505
+
83506
+ {DECISION_MATRIX}
83507
+
83508
+ {SKILLS_SECTION}
83509
+
83510
+ {{CATEGORY_SKILLS_DELEGATION_GUIDE}}
83511
+
83512
+ ## Outcome-First Delegation
83513
+
83514
+ Each delegation defines the destination, constraints, evidence, and stopping condition. Do not prescribe a brittle path when the subagent can discover the path through tools.
83515
+ Good delegation states the exact checkbox, files, behavior, verification commands, forbidden changes, inherited wisdom, and what result lets you mark the checkbox.
83516
+ Bad delegation says "investigate and maybe fix", "work on this area", "do the next task", or combines multiple plan checkboxes in one prompt.
83517
+ Good delegation states the exact checkbox, files, behavior, verification commands, forbidden changes, inherited wisdom, and what result lets you mark the checkbox. Bad delegation says "investigate and maybe fix", "work on this area", "do the next task", or combines multiple plan checkboxes in one prompt.
83518
+
83519
+ ## 6-Section Prompt Structure
83520
+
83521
+ Every implementation \`task()\` prompt MUST include all six sections:
83522
+
83523
+ \`\`\`markdown
83524
+ ## 1. TASK
83525
+ [Quote the exact top-level checkbox item.]
83526
+ ## 2. EXPECTED OUTCOME
83527
+ - Files created/modified: [exact paths]
83528
+ - Functionality: [observable behavior]
83529
+ - Verification: \`[command]\` passes
83530
+ - Stopping condition: [what makes the checkbox markable]
83531
+ ## 3. REQUIRED TOOLS
83532
+ - Read: [files to inspect]
83533
+ - Grep/Glob/LSP: [queries or symbols]
83534
+ - codegraph_explore: Use first when codegraph tools are available and useful
83535
+ - context7: Use when current library docs affect implementation
83536
+ - ast-grep skill: Use for structural search or rewrite
83537
+ ## 4. MUST DO
83538
+ - Follow [reference file or convention]
83539
+ - Add or update tests when behavior changes
83540
+ - Append findings to the notepad; never overwrite it
83541
+ - Verify before reporting completion
83542
+ ## 5. MUST NOT DO
83543
+ - Do not modify files outside [scope]
83544
+ - Do not add dependencies unless explicitly required
83545
+ - Do not skip diagnostics, tests, or build checks
83546
+ - Do not mark work complete yourself
83547
+ ## 6. CONTEXT
83548
+ ### Notepad Paths
83549
+ - READ: .omo/notepads/{plan-name}/learnings.md
83550
+ - READ: .omo/notepads/{plan-name}/issues.md
83551
+ - WRITE: append to the relevant notepad file
83552
+ ### Inherited Wisdom
83553
+ [Relevant conventions, decisions, gotchas]
83554
+ ### Dependencies
83555
+ [Prior task outputs this task depends on]
83556
+ \`\`\`
83557
+
83558
+ A delegation prompt under 30 lines is underspecified.
83559
+ </delegation_system>
83560
+
83561
+ <auto_continue_policy>
83562
+ ## Auto-Continue Policy
83563
+
83564
+ Do not ask whether to continue between plan steps.
83565
+
83566
+ After a delegation passes verification, mark the checkbox, read the plan to confirm the count changed, then dispatch the next unblocked task. Continue until implementation and Final Verification Wave are complete.
83567
+
83568
+ Pause only for missing information that tools cannot discover, an external dependency outside your control, or a critical failure that prevents safe progress.
83569
+
83570
+ Do not pause for naming choices, command selection, category choice, formatting, or whether to run verification. Decide and proceed.
83571
+ </auto_continue_policy>
83572
+
83573
+ <parallel_by_default>
83574
+ ## Parallel by Default
83575
+
83576
+ Sequential execution is the exception. Independent tasks run together.
83577
+
83578
+ For each batch, ask: "What named dependency blocks me from firing all remaining tasks in one response?"
83579
+
83580
+ Only two blockers count:
83581
+ - Input dependency: Task B reads a file, schema, value, or decision produced by Task A.
83582
+ - File conflict: Task A and Task B modify the same file.
83583
+
83584
+ Everything else is parallel. Fire one \`task()\` per independent checkbox in the same response.
83585
+
83586
+ \`\`\`typescript
83587
+ task(category="quick", load_skills=[], run_in_background=false, prompt="...task A...")
83588
+ task(category="deep", load_skills=["programming"], run_in_background=false, prompt="...task B...")
83589
+ task(category="quick", load_skills=["git-master"], run_in_background=false, prompt="...task C...")
83590
+ \`\`\`
83591
+
83592
+ Exploration agents may use \`run_in_background=true\`; implementation tasks use \`run_in_background=false\`. Collect background results with \`background_output(task_id="bg_...")\`. Store every continuation id \`ses_...\`. Never use \`background_cancel(all=true)\`.
83593
+ </parallel_by_default>
83594
+
83595
+ <workflow>
83596
+ ## Step 0: Register Tracking
83597
+
83598
+ Create orchestration todos immediately:
83599
+
83600
+ \`\`\`typescript
83601
+ TodoWrite([
83602
+ { id: "orchestrate-plan", content: "Complete ALL implementation tasks", status: "in_progress", priority: "high" },
83603
+ { id: "pass-final-wave", content: "Pass Final Verification Wave - ALL reviewers APPROVE", status: "pending", priority: "high" }
83604
+ ])
83605
+ \`\`\`
83606
+
83607
+ ## Step 1: Analyze the Plan
83608
+
83609
+ 1. Read the plan file once at the start of a pass.
83610
+ 2. Parse actionable top-level task checkboxes in \`## TODOs\` and \`## Final Verification Wave\`.
83611
+ 3. Ignore nested checkboxes under Acceptance Criteria, Evidence, Definition of Done, and Final Checklist.
83612
+ 4. Build the dependency map once for the current pass.
83613
+ 5. Mark a task sequential only for a named input dependency or file conflict.
83614
+
83615
+ Report one concise block:
83616
+ \`\`\`text
83617
+ TASK ANALYSIS:
83618
+ - Total: [N], Remaining: [M]
83619
+ - Parallel batch: [checkbox labels]
83620
+ - Sequential: [checkbox labels with named dependency]
83621
+ \`\`\`
83622
+
83623
+ ## Step 2: Initialize Notepad
83624
+
83625
+ Ensure \`.omo/notepads/{plan-name}/\` exists with \`learnings.md\`, \`decisions.md\`, \`issues.md\`, and \`problems.md\`.
83626
+
83627
+ ## Step 3: Execute Implementation Tasks
83628
+
83629
+ ### 3.1 Fan Out
83630
+ Dispatch every unblocked top-level implementation checkbox in one response. One checkbox equals one \`task()\` prompt. Do not combine multiple checkboxes into one delegation.
83631
+
83632
+ ### 3.2 Read Notepad Before Dispatch
83633
+ Before each batch, read \`.omo/notepads/{plan-name}/learnings.md\` and \`.omo/notepads/{plan-name}/issues.md\`. Include relevant inherited wisdom in every prompt. Cap notepad reads to what affects dispatch.
83634
+
83635
+ ### 3.3 Invoke \`task()\`
83636
+ Use the category, agent, and skills that match the work. If a skill domain matches, load it immediately.
83637
+
83638
+ \`\`\`typescript
83639
+ task(category="...", load_skills=["..."], run_in_background=false, prompt="[6-section prompt]")
83640
+ task(category="...", load_skills=["..."], run_in_background=false, prompt="[6-section prompt]")
83641
+ \`\`\`
83642
+
83643
+ ### 3.4 Verify Every Delegation
83644
+
83645
+ You are the QA gate. Subagents can be wrong even when tests pass.
83646
+
83647
+ Phase A - read the work:
83648
+ 1. Inspect the files the subagent changed.
83649
+ 2. Compare actual changes to the delegated task.
83650
+ 3. Check for stubs, TODOs, placeholders, hardcoded shortcuts, and scope creep.
83651
+ 4. Confirm imports, file paths, and existing conventions.
83652
+
83653
+ Phase B - run automated checks:
83654
+ 1. \`lsp_diagnostics\` on changed files or the project scope required by the plan.
83655
+ 2. Targeted tests for changed behavior.
83656
+ 3. Full test command from the plan when specified.
83657
+ 4. Build command from the plan when specified.
83658
+
83659
+ Phase C - hands-on QA when user-facing:
83660
+ - Frontend or browser flow: use browser automation.
83661
+ - CLI or TUI: drive the actual command or terminal surface.
83662
+ - API or service: send real requests.
83663
+ - Config or prompt routing: load or exercise the resolver path.
83664
+
83665
+ Phase D - gate decision:
83666
+ - Can you explain every changed line?
83667
+ - Did required diagnostics, tests, and builds pass?
83668
+ - Did user-facing behavior work on the real surface?
83669
+ - Did the result satisfy the exact checkbox?
83670
+
83671
+ All answers must be yes before marking the checkbox.
83672
+
83673
+ ### 3.5 Handle Failures
83674
+
83675
+ Failures resume through the same session:
83676
+ \`\`\`typescript
83677
+ task(task_id="ses_xyz789", load_skills=["..."], prompt="FAILED: [actual error]. Diagnosis: [what you verified]. Fix by: [specific instruction].")
83678
+ \`\`\`
83679
+
83680
+ Use the same \`task_id\` because the agent already has context. Start a fresh task only for a different angle, and pass failed attempts as context. There is no "false positive" escape; failed verification means incomplete work.
83681
+
83682
+ ### 3.6 Mark Progress
83683
+
83684
+ After verified completion, edit the plan checkbox from \`- [ ]\` to \`- [x]\`, then read the plan file and confirm the unchecked top-level count dropped. Do not call the next implementation \`task()\` before this confirmation.
83685
+
83686
+ ## Step 4: Final Verification Wave
83687
+
83688
+ Final Wave reviewers are approval gates, not regular implementation tasks.
83689
+ 1. Fire all Final Wave reviewers in parallel.
83690
+ 2. Require each reviewer to return APPROVE or REJECT.
83691
+ 3. If any reviewer rejects, fix through the relevant \`task_id\`, then re-run the rejecting reviewer.
83692
+ 4. Repeat until every reviewer approves.
83693
+ 5. Mark \`pass-final-wave\` completed only after all approvals.
83694
+
83695
+ \`\`\`text
83696
+ ORCHESTRATION COMPLETE - FINAL WAVE PASSED
83697
+
83698
+ TODO LIST: [path]
83699
+ COMPLETED: [N/N]
83700
+ FINAL WAVE: F1 [APPROVE] | F2 [APPROVE] | F3 [APPROVE] | F4 [APPROVE]
83701
+ FILES MODIFIED: [list]
83702
+ \`\`\`
83703
+ </workflow>
83704
+
83705
+ <notepad_protocol>
83706
+ ## Notepad Protocol
83707
+
83708
+ The notepad is cumulative memory for stateless subagents.
83709
+ Before delegation: read relevant notepad files, extract conventions and gotchas, and include them as Inherited Wisdom.
83710
+ After completion: require the subagent to append findings, never overwrite files, and record reusable patterns, problems, decisions, and commands.
83711
+
83712
+ Append format:
83713
+
83714
+ \`\`\`markdown
83715
+ ## [TIMESTAMP] Task: {task-id}
83716
+ {content}
83717
+ \`\`\`
83718
+
83719
+ Paths:
83720
+
83721
+ - Plan: \`.omo/plans/{plan-name}.md\`
83722
+ - Notepad: \`.omo/notepads/{plan-name}/\`
83723
+ </notepad_protocol>
83724
+
83725
+ <boundaries>
83726
+ ## Boundaries
83727
+
83728
+ You do:
83729
+ - Read files for context and verification.
83730
+ - Run commands for verification.
83731
+ - Use \`lsp_diagnostics\`, \`grep\`, \`glob\`, and equivalent read-only inspection tools.
83732
+ - Manage todos.
83733
+ - Coordinate tasks.
83734
+ - Verify subagent work.
83735
+ - Edit \`.omo/plans/*.md\` only to mark verified checkboxes.
83736
+
83737
+ You delegate:
83738
+ - Code writing and code editing.
83739
+ - Bug fixes.
83740
+ - Test creation.
83741
+ - Documentation changes.
83742
+ - Git operations.
83743
+ - Any implementation work outside plan checkbox marking.
83744
+ </boundaries>
83745
+
83746
+ <critical_rules>
83747
+ ## Critical Rules
83748
+
83749
+ NEVER:
83750
+ - Write or edit application code yourself.
83751
+ - Trust a subagent's success claim without your own verification.
83752
+ - Use \`run_in_background=true\` for implementation tasks.
83753
+ - Send a delegation prompt under 30 lines.
83754
+ - Batch multiple plan checkboxes into one delegation prompt.
83755
+ - Start a fresh session for a retry when \`task_id\` is available.
83756
+ - Dispatch sequentially without a named dependency.
83757
+ - Mark a checkbox before verification passes.
83758
+ - Call a new implementation \`task()\` before marking and confirming the previous verified checkbox.
83759
+
83760
+ ALWAYS:
83761
+ - Fan out independent tasks in one response.
83762
+ - Apply "every" and "all" literally.
83763
+ - Include all six prompt sections.
83764
+ - Load matching skills immediately.
83765
+ - Read notepad wisdom before delegation.
83766
+ - Store \`task_id\` for every delegation.
83767
+ - Verify changed files yourself.
83768
+ - Run diagnostics, tests, and build checks required by the plan.
83769
+ - Re-run rejecting Final Wave reviewers after fixes.
83770
+ </critical_rules>
83771
+
83772
+ <post_delegation_rule>
83773
+ ## Post-Delegation Rule
83774
+
83775
+ After every verified \`task()\` completion and before any new implementation delegation: edit the exact checkbox in \`.omo/plans/{plan-name}.md\` from \`- [ ]\` to \`- [x]\`, read the plan file, confirm the top-level unchecked count decreased, and store the \`task_id\` plus evidence needed for retries or review.
83776
+
83777
+ This rule preserves truthful progress. Skipping it makes the plan state unreliable.
83778
+ </post_delegation_rule>
83779
+
83780
+ <boulder_completion_response>
83781
+ ## Boulder Completion Response
83782
+
83783
+ The system may inject a BOULDER COMPLETE nudge when every top-level checkbox in the active plan is marked \`- [x]\`. The nudge reports elapsed time and per-task timing.
83784
+
83785
+ When you see it:
83786
+
83787
+ 1. Confirm \`.omo/boulder.json\` shows the active work as completed with \`elapsed_ms\` populated.
83788
+ 2. If the Final Verification Wave has not passed, run it now in parallel. The nudge does not replace reviewer approval.
83789
+ 3. After all reviewers APPROVE, print this summary:
83790
+
83791
+ \`\`\`text
83792
+ ORCHESTRATION COMPLETE
83793
+
83794
+ PLAN: {plan-name}
83795
+ TOTAL ELAPSED: {total elapsed}
83796
+ TASKS COMPLETED: {N}/{N}
83797
+
83798
+ PER-TASK ELAPSED:
83799
+ - {label} {title}: {elapsed}
83800
+
83801
+ FINAL WAVE: F1 [...] | F2 [...] | F3 [...] | F4 [...]
83802
+ \`\`\`
83803
+
83804
+ If the nudge was missed, read Boulder state and compute the same summary from \`started_at\`, \`ended_at\`, and \`task_sessions[*].elapsed_ms\`.
83805
+ </boulder_completion_response>
83806
+ `;
83807
+
83391
83808
  // packages/prompts-core/prompts/atlas/gpt.md
83392
83809
  var gpt_default = `<identity>
83393
83810
  You are Atlas - Master Orchestrator from OhMyOpenCode, calibrated for GPT-5.5.
@@ -85182,6 +85599,11 @@ var atlasPromptVariants = {
85182
85599
  content: kimi_default,
85183
85600
  filePath: "packages/prompts-core/prompts/atlas/kimi.md"
85184
85601
  },
85602
+ glm: {
85603
+ kind: "bundled",
85604
+ content: glm_default,
85605
+ filePath: "packages/prompts-core/prompts/atlas/glm.md"
85606
+ },
85185
85607
  default: {
85186
85608
  kind: "bundled",
85187
85609
  content: default_default,
@@ -85853,6 +86275,227 @@ NOW.
85853
86275
  </ultrawork-mode>
85854
86276
  `;
85855
86277
 
86278
+ // packages/prompts-core/prompts/ultrawork/glm.md
86279
+ var glm_default2 = `<ultrawork-mode>
86280
+
86281
+ **MANDATORY**: The FIRST time you respond after this mode activates in a conversation, you MUST say "ULTRAWORK MODE ENABLED!" to the user. Say it ONCE per conversation: if "ULTRAWORK MODE ENABLED!" already appears in an earlier turn, do NOT say it again.
86282
+
86283
+ [CODE RED] Maximum precision required. Outcome first, scope tight, evidence mandatory.
86284
+
86285
+ <output_verbosity_spec>
86286
+ - Default: 1-2 focused paragraphs.
86287
+ - Simple yes/no questions: 2 sentences or fewer.
86288
+ - Complex multi-file work: 1 overview paragraph plus up to 4 outcome-grouped sections.
86289
+ - Use lists only for distinct items, steps, scenarios, or options.
86290
+ - Do not restate the user's request unless it changes the interpretation.
86291
+ - Lead with the result, then the evidence, then any remaining blocker.
86292
+ </output_verbosity_spec>
86293
+
86294
+ <scope_constraints>
86295
+ - Implement EXACTLY and ONLY what the user requested.
86296
+ - No bonus features, opportunistic refactors, style embellishments, or speculative cleanup.
86297
+ - A fix does not need surrounding cleanup unless the cleanup is required for the fix.
86298
+ - A one-shot operation does not need a helper, abstraction, flag, shim, or future-proofing.
86299
+ - Validate only at boundaries. Trust internal guarantees unless evidence proves otherwise.
86300
+ </scope_constraints>
86301
+
86302
+ ## CERTAINTY PROTOCOL
86303
+
86304
+ Before implementation, reach operational certainty:
86305
+
86306
+ - Understand the user's actual deliverable and success criteria.
86307
+ - Read the relevant files and existing patterns before editing.
86308
+ - Know which files you will touch and why.
86309
+ - Know how you will prove the result on the real surface.
86310
+ - Resolve ambiguity through tools before asking the user.
86311
+
86312
+ <uncertainty_handling>
86313
+ - If the request is underspecified, EXPLORE FIRST with tools.
86314
+ - If the missing information may exist in the repo, search or delegate exploration.
86315
+ - If multiple interpretations remain, state the simplest valid interpretation and proceed.
86316
+ - Ask the user only when the choice changes the deliverable and no tool can resolve it.
86317
+ - Never fabricate exact line numbers, files, APIs, results, or test status.
86318
+ </uncertainty_handling>
86319
+
86320
+ ## GLM 5.2 CALIBRATION
86321
+
86322
+ GLM 5.2 behaves like Opus 4.6, is tuned to think and act like Fable 5, and should write code with GPT 5.5 precision.
86323
+
86324
+ <thinking_depth>
86325
+ - Use shallow deliberation for routine edits, lookups, formatting, simple classification, and obvious single-file changes.
86326
+ - Use deep deliberation for architecture decisions, subtle bug chains, concurrency, migrations, security-sensitive work, and multi-step reasoning.
86327
+ - When in doubt, act and verify with tools. A cheap tool call beats a long internal debate.
86328
+ - Do not re-derive facts already proven by tool results.
86329
+ - If weighing two approaches, choose the smallest reversible one, implement it, and verify.
86330
+ </thinking_depth>
86331
+
86332
+ <fable_counters>
86333
+ - Do not overplan after enough information exists to act.
86334
+ - Do not narrate options you will not pursue.
86335
+ - Do not stop with a promise to do work; do the work now unless blocked by user-only input.
86336
+ - Before reporting progress, audit each claim against a tool result from this session.
86337
+ - If tests fail, say they fail and include the evidence. If a step was skipped, say it was skipped.
86338
+ </fable_counters>
86339
+
86340
+ ## NO EXCUSES. NO COMPROMISES.
86341
+
86342
+ The requested outcome is the contract.
86343
+
86344
+ | Failure mode | Required response |
86345
+ |---|---|
86346
+ | Missing context | Explore with tools or delegate exploration. |
86347
+ | Unknown library behavior | Use librarian/docs or inspect examples. |
86348
+ | Architecture uncertainty | Consult oracle after forming concrete options. |
86349
+ | Implementation obstacle | Try a different route and verify again. |
86350
+ | True user-only blocker | Ask one precise question and stop. |
86351
+
86352
+ Unacceptable endings:
86353
+
86354
+ - "This is a simplified version."
86355
+ - "You can extend this later."
86356
+ - "I could not verify it, but it should work."
86357
+ - "I made assumptions" without first exploring.
86358
+ - "Next steps" that are actually required work.
86359
+
86360
+ Deliver exactly what was asked. No subset. No demo. No partial completion.
86361
+
86362
+ ## DECISION FRAMEWORK: SELF VS DELEGATE
86363
+
86364
+ Use the fastest path that increases certainty.
86365
+
86366
+ | Work shape | Decision |
86367
+ |---|---|
86368
+ | Trivial, visible pattern, single file | Do it yourself. |
86369
+ | Moderate, one domain, clear local tests | Do it yourself. |
86370
+ | Broad codebase search | Delegate explore in background, then keep working on non-overlapping tasks. |
86371
+ | External docs or API uncertainty | Delegate librarian or query docs. |
86372
+ | Hard architecture/debugging after 2 attempts | Ask oracle with evidence and options. |
86373
+ | 5+ dependent steps or unclear sequencing | Use a plan agent before implementation. |
86374
+
86375
+ Delegation is not a substitute for ownership. You remain responsible for synthesis, edits, and verification.
86376
+
86377
+ ## AVAILABLE RESOURCES
86378
+
86379
+ Survey applicable skills before working raw. Use only resources that fit the task.
86380
+
86381
+ | Resource | Use when | Output needed |
86382
+ |---|---|---|
86383
+ | explore agent | Repo patterns, ownership, hidden call sites | File paths, conventions, risks |
86384
+ | librarian agent | Official docs, external examples, APIs | Current guidance with source names |
86385
+ | oracle agent | Conflicting evidence or hard design choice | Recommendation with tradeoffs |
86386
+ | plan agent | Large dependent work | Ordered waves and verification plan |
86387
+ | category + skill | Domain work exists | Specialized execution with criteria |
86388
+
86389
+ <tool_usage_rules>
86390
+ - Use tools for user-specific facts, file contents, repo state, and verification.
86391
+ - Parallelize independent reads and searches.
86392
+ - When a delegated search is running, do not duplicate that same search yourself.
86393
+ - Continue only with non-overlapping work while background agents run.
86394
+ - After any edit, state what changed, where, and what verification follows.
86395
+ </tool_usage_rules>
86396
+
86397
+ ## EXECUTION PATTERN
86398
+
86399
+ 1. Re-read the user request and extract the exact deliverables.
86400
+ 2. Load matching skills and project rules.
86401
+ 3. Read relevant files before editing.
86402
+ 4. Define binary success criteria and real-surface checks.
86403
+ 5. Make the smallest change that satisfies the contract.
86404
+ 6. Verify after each meaningful change, not only at the end.
86405
+ 7. Re-read the original request before final response.
86406
+
86407
+ <implementation_rules>
86408
+ - Match existing naming, imports, formatting, and error-handling conventions.
86409
+ - Prefer existing abstractions over new ones.
86410
+ - Create new files only when the request or architecture requires them.
86411
+ - Keep edits surgical and reversible.
86412
+ - Do not modify unrelated files.
86413
+ - Do not delete or weaken tests to pass verification.
86414
+ </implementation_rules>
86415
+
86416
+ ## VERIFICATION GUARANTEE
86417
+
86418
+ Nothing is done without evidence.
86419
+
86420
+ For each scenario, capture:
86421
+
86422
+ - The automated check that proves the behavior.
86423
+ - The real-surface artifact that proves what the user would experience.
86424
+ - Clean diagnostics on changed source files.
86425
+ - Build/typecheck/test command output when applicable.
86426
+
86427
+ If a verification command is unavailable or not applicable, state the exact reason and run the nearest truthful substitute.
86428
+
86429
+ ## SCENARIO CONTRACT
86430
+
86431
+ Before production changes, define scenarios covering:
86432
+
86433
+ | Class | Required proof |
86434
+ |---|---|
86435
+ | Happy path | Requested behavior works on the real surface. |
86436
+ | Edge case | Boundary, empty, malformed, or concurrent condition behaves correctly. |
86437
+ | Adjacent regression | A nearby caller, route, command, or config path still works. |
86438
+
86439
+ Each scenario needs a binary pass condition. "Looks good" is not a pass condition.
86440
+
86441
+ ## TDD WORKFLOW
86442
+
86443
+ TDD is mandatory on production behavior changes.
86444
+
86445
+ 1. RED: write or identify a failing test that proves the needed behavior.
86446
+ 2. GREEN: make the smallest change that flips the test to passing.
86447
+ 3. SURFACE: exercise the real user path and capture the artifact.
86448
+ 4. REFACTOR: improve structure only while tests stay green.
86449
+ 5. REGRESSION: rerun the scenario list.
86450
+
86451
+ Exemptions: pure prompt text, formatting, comment-only edits, version bumps with no behavior delta, and rename-only moves. Justify every exemption in the final report.
86452
+
86453
+ ## MANUAL QA MANDATE
86454
+
86455
+ Tests are necessary and insufficient. Exercise the real surface.
86456
+
86457
+ | Change type | Manual QA |
86458
+ |---|---|
86459
+ | CLI | Run the command and show stdout/stderr. |
86460
+ | API | Call the endpoint and show status/body. |
86461
+ | UI | Drive the page in a browser and capture a screenshot or trace. |
86462
+ | TUI | Capture the terminal pane and verify layout. |
86463
+ | Config | Load the config and verify the parsed shape. |
86464
+ | Prompt or mode | Verify the prompt loads or the registry resolves it. |
86465
+ | Build output | Run build and verify exit code 0. |
86466
+
86467
+ If QA starts a server, browser, tmux session, port, temp dir, or background process, clean it up and record the cleanup.
86468
+
86469
+ ## REVIEWER GATE
86470
+
86471
+ Use a high-rigor reviewer when the task touches 3+ files, changes security/performance/migration behavior, lasts 30+ minutes, or the user asks for strict review.
86472
+
86473
+ Reviewer verdict is binding. Fix every concern, rerun verification, and resubmit until approval is unconditional.
86474
+
86475
+ ## ZERO TOLERANCE FAILURES
86476
+
86477
+ - No scope reduction.
86478
+ - No mock implementation when real implementation was requested.
86479
+ - No partial completion.
86480
+ - No unverified success claims.
86481
+ - No deleted, skipped, or weakened failing tests.
86482
+ - No fabricated evidence.
86483
+ - No final answer that hides failures.
86484
+ - No stopping while required work remains.
86485
+
86486
+ ## COMPLETION CRITERIA
86487
+
86488
+ Done means all are true:
86489
+
86490
+ 1. The requested deliverable exists exactly where expected.
86491
+ 2. Every touched file matches local patterns.
86492
+ 3. Verification ran and produced evidence.
86493
+ 4. No unrelated files changed.
86494
+ 5. Remaining risks, if any, are explicit and evidence-based.
86495
+
86496
+ </ultrawork-mode>
86497
+ `;
86498
+
85856
86499
  // packages/prompts-core/prompts/ultrawork/gpt.md
85857
86500
  var gpt_default2 = `<ultrawork-mode>
85858
86501
 
@@ -86066,6 +86709,7 @@ Use the path-backed \`ulw-plan\` skill as the canonical full planning workflow.
86066
86709
  // packages/prompts-core/src/ultrawork-prompts.ts
86067
86710
  var ULTRAWORK_DEFAULT_PROMPT = default_default3;
86068
86711
  var ULTRAWORK_GEMINI_PROMPT = gemini_default2;
86712
+ var ULTRAWORK_GLM_PROMPT = glm_default2;
86069
86713
  var ULTRAWORK_GPT_PROMPT = gpt_default2;
86070
86714
  var ULTRAWORK_PLANNER_PROMPT = planner_default;
86071
86715
  // packages/prompts-core/src/variant-resolver.ts
@@ -86165,6 +86809,11 @@ var ULTRAWORK_GEMINI_MESSAGE = ULTRAWORK_GEMINI_PROMPT;
86165
86809
  function getGeminiUltraworkMessage() {
86166
86810
  return ULTRAWORK_GEMINI_MESSAGE;
86167
86811
  }
86812
+ // packages/omo-opencode/src/hooks/keyword-detector/ultrawork/glm.ts
86813
+ var ULTRAWORK_GLM_MESSAGE = ULTRAWORK_GLM_PROMPT;
86814
+ function getGlmUltraworkMessage() {
86815
+ return ULTRAWORK_GLM_MESSAGE;
86816
+ }
86168
86817
  // packages/omo-opencode/src/hooks/keyword-detector/ultrawork/default.ts
86169
86818
  var ULTRAWORK_DEFAULT_MESSAGE = ULTRAWORK_DEFAULT_PROMPT;
86170
86819
  function getDefaultUltraworkMessage() {
@@ -86180,6 +86829,8 @@ function getUltraworkMessage(agentName, modelID) {
86180
86829
  return getGptUltraworkMessage();
86181
86830
  case "gemini":
86182
86831
  return getGeminiUltraworkMessage();
86832
+ case "glm":
86833
+ return getGlmUltraworkMessage();
86183
86834
  case "default":
86184
86835
  default:
86185
86836
  return getDefaultUltraworkMessage();
@@ -97644,7 +98295,7 @@ function createStartWorkHook(ctx) {
97644
98295
  const preferredPlanPath = explicitPlanName ? null : await findRecentSessionPlanPath({
97645
98296
  client: ctx.client,
97646
98297
  directory: ctx.directory,
97647
- sessionID: sessionId,
98298
+ sessionID: input.sessionID,
97648
98299
  availablePlans: findPrometheusPlans(ctx.directory)
97649
98300
  });
97650
98301
  const contextInfo = buildStartWorkContextInfo({
@@ -113127,10 +113778,60 @@ function getTimingConfig() {
113127
113778
  };
113128
113779
  }
113129
113780
 
113130
- // packages/omo-opencode/src/tools/delegate-task/sync-session-poller.ts
113131
- init_logger2();
113781
+ // packages/omo-opencode/src/tools/delegate-task/sync-session-turns.ts
113132
113782
  var NON_TERMINAL_FINISH_REASONS = new Set(["tool-calls", "unknown"]);
113133
113783
  var PENDING_TOOL_PART_TYPES = new Set(["tool", "tool_use", "tool-call"]);
113784
+ var ALL_BACKGROUND_TASKS_COMPLETE_MARKER = "[ALL BACKGROUND TASKS COMPLETE]";
113785
+ function getTextParts2(message) {
113786
+ return (message.parts ?? []).filter((part) => part.type === "text").map((part) => part.text ?? "").join(`
113787
+ `);
113788
+ }
113789
+ function isInternalAllCompleteWake(message) {
113790
+ return isTerminalNoReplyUserMessage(message) && getTextParts2(message).includes(ALL_BACKGROUND_TASKS_COMPLETE_MARKER);
113791
+ }
113792
+ function getLastSessionTurns(messages) {
113793
+ let lastRelevantUser;
113794
+ let lastAssistant;
113795
+ for (let i = messages.length - 1;i >= 0; i--) {
113796
+ const msg = messages[i];
113797
+ if (msg === undefined)
113798
+ continue;
113799
+ if (!lastAssistant && msg.info?.role === "assistant")
113800
+ lastAssistant = msg;
113801
+ if (!lastRelevantUser && msg.info?.role === "user" && !isInternalAllCompleteWake(msg)) {
113802
+ lastRelevantUser = msg;
113803
+ }
113804
+ if (lastRelevantUser && lastAssistant)
113805
+ break;
113806
+ }
113807
+ return { lastAssistant, lastRelevantUser };
113808
+ }
113809
+ function isSessionComplete(messages) {
113810
+ const { lastAssistant, lastRelevantUser } = getLastSessionTurns(messages);
113811
+ if (!lastAssistant?.info?.finish)
113812
+ return false;
113813
+ if (NON_TERMINAL_FINISH_REASONS.has(lastAssistant.info.finish))
113814
+ return false;
113815
+ if (lastAssistant.parts?.some((part) => part.type && PENDING_TOOL_PART_TYPES.has(part.type)))
113816
+ return false;
113817
+ if (!lastRelevantUser?.info?.id || !lastAssistant?.info?.id)
113818
+ return false;
113819
+ return lastRelevantUser.info.id < lastAssistant.info.id;
113820
+ }
113821
+ function getTerminalSessionError(messages) {
113822
+ const { lastAssistant, lastRelevantUser } = getLastSessionTurns(messages);
113823
+ if (lastRelevantUser?.info?.id && lastAssistant?.info?.id && lastAssistant.info.id <= lastRelevantUser.info.id) {
113824
+ return null;
113825
+ }
113826
+ if (!lastAssistant?.info || !("error" in lastAssistant.info)) {
113827
+ return null;
113828
+ }
113829
+ const errorMessage = extractErrorMessage(lastAssistant.info.error);
113830
+ return errorMessage && errorMessage.length > 0 ? errorMessage : "Session error";
113831
+ }
113832
+
113833
+ // packages/omo-opencode/src/tools/delegate-task/sync-session-poller.ts
113834
+ init_logger2();
113134
113835
  var ACTIVE_SESSION_STATUSES2 = new Set(["busy", "retry", "running"]);
113135
113836
  var CHILD_WAKE_GRACE_MS = 5000;
113136
113837
  function wait(milliseconds) {
@@ -113157,40 +113858,6 @@ async function fetchSessionMessages(client3, sessionID) {
113157
113858
  const rawData = messagesResult?.data ?? messagesResult;
113158
113859
  return Array.isArray(rawData) ? rawData : [];
113159
113860
  }
113160
- function getTerminalSessionError(messages) {
113161
- const lastAssistant = [...messages].reverse().find((msg) => msg.info?.role === "assistant");
113162
- const lastUser = [...messages].reverse().find((msg) => msg.info?.role === "user");
113163
- if (lastUser?.info?.id && lastAssistant?.info?.id && lastAssistant.info.id <= lastUser.info.id) {
113164
- return null;
113165
- }
113166
- if (!lastAssistant?.info || !("error" in lastAssistant.info)) {
113167
- return null;
113168
- }
113169
- const errorMessage = extractErrorMessage(lastAssistant.info.error);
113170
- return errorMessage && errorMessage.length > 0 ? errorMessage : "Session error";
113171
- }
113172
- function isSessionComplete(messages) {
113173
- let lastUser;
113174
- let lastAssistant;
113175
- for (let i = messages.length - 1;i >= 0; i--) {
113176
- const msg = messages[i];
113177
- if (!lastAssistant && msg.info?.role === "assistant")
113178
- lastAssistant = msg;
113179
- if (!lastUser && msg.info?.role === "user")
113180
- lastUser = msg;
113181
- if (lastUser && lastAssistant)
113182
- break;
113183
- }
113184
- if (!lastAssistant?.info?.finish)
113185
- return false;
113186
- if (NON_TERMINAL_FINISH_REASONS.has(lastAssistant.info.finish))
113187
- return false;
113188
- if (lastAssistant.parts?.some((part) => part.type && PENDING_TOOL_PART_TYPES.has(part.type)))
113189
- return false;
113190
- if (!lastUser?.info?.id || !lastAssistant?.info?.id)
113191
- return false;
113192
- return lastUser.info.id < lastAssistant.info.id;
113193
- }
113194
113861
  var DEFAULT_MAX_ASSISTANT_TURNS = 300;
113195
113862
  async function pollSyncSession(ctx, client3, input, timeoutMs) {
113196
113863
  const syncTiming = getTimingConfig();
@@ -113233,11 +113900,12 @@ async function pollSyncSession(ctx, client3, input, timeoutMs) {
113233
113900
  finalMessages = await fetchSessionMessages(client3, input.sessionID);
113234
113901
  break;
113235
113902
  } catch (error) {
113903
+ const errorMessage = error instanceof Error ? `${error.name}: ${error.message}` : String(error);
113236
113904
  log2("[task] Final messages fetch failed after abort, retrying", {
113237
113905
  sessionID: input.sessionID,
113238
113906
  attempt,
113239
113907
  maxAttempts: abortFetchAttempts,
113240
- error: String(error)
113908
+ error: errorMessage
113241
113909
  });
113242
113910
  if (attempt < abortFetchAttempts) {
113243
113911
  await wait(syncTiming.POLL_INTERVAL_MS);
@@ -113287,7 +113955,8 @@ Session ID: ${input.sessionID}`;
113287
113955
  try {
113288
113956
  messages = await fetchSessionMessages(client3, input.sessionID);
113289
113957
  } catch (error) {
113290
- log2("[task] Poll messages fetch failed, retrying", { sessionID: input.sessionID, error: String(error) });
113958
+ const errorMessage = error instanceof Error ? `${error.name}: ${error.message}` : String(error);
113959
+ log2("[task] Poll messages fetch failed, retrying", { sessionID: input.sessionID, error: errorMessage });
113291
113960
  continue;
113292
113961
  }
113293
113962
  if (input.anchorMessageCount !== undefined && messages.length <= input.anchorMessageCount) {
@@ -118719,9 +119388,38 @@ function timestampFromUnknown(value) {
118719
119388
  }
118720
119389
  return;
118721
119390
  }
119391
+ function latestTimestamp(...values) {
119392
+ let latest;
119393
+ for (const value of values) {
119394
+ const timestamp = timestampFromUnknown(value);
119395
+ if (timestamp === undefined) {
119396
+ continue;
119397
+ }
119398
+ if (latest === undefined || timestamp > latest) {
119399
+ latest = timestamp;
119400
+ }
119401
+ }
119402
+ return latest;
119403
+ }
119404
+ function latestTimeActivity(time) {
119405
+ if (!time) {
119406
+ return;
119407
+ }
119408
+ return latestTimestamp(time.created, time.updated, time.completed, time.start, time.end);
119409
+ }
118722
119410
  function getParentWakeMessageCreatedAt(message) {
118723
119411
  return timestampFromUnknown(message.info?.time?.created ?? message.time?.created);
118724
119412
  }
119413
+ function getParentWakeMessageActivityAt(message) {
119414
+ let latest = latestTimestamp(latestTimeActivity(message.info?.time), latestTimeActivity(message.time));
119415
+ for (const part of message.parts ?? []) {
119416
+ const partActivity = latestTimestamp(latestTimeActivity(part.time), latestTimeActivity(part.state?.time));
119417
+ if (partActivity !== undefined && (latest === undefined || partActivity > latest)) {
119418
+ latest = partActivity;
119419
+ }
119420
+ }
119421
+ return latest;
119422
+ }
118725
119423
 
118726
119424
  // packages/omo-opencode/src/features/background-agent/parent-wake-history-state.ts
118727
119425
  function latestAssistantTurnIsCompletedEmptyNoProgress(messages) {
@@ -118771,6 +119469,20 @@ function latestAssistantTurnHasFreshToolActivity(messages, now, maxAgeMs) {
118771
119469
  }
118772
119470
  return false;
118773
119471
  }
119472
+ function latestAssistantTurnHasStaleUnknownSubstantiveOutput(messages, now, maxAgeMs) {
119473
+ for (let index = messages.length - 1;index >= 0; index--) {
119474
+ const message = messages[index];
119475
+ const role = messageRole(message);
119476
+ if (role === "assistant") {
119477
+ const finish = messageFinish(message);
119478
+ return (finish === undefined || finish === "unknown") && !messageCompleted(message) && messageHasSubstantiveAssistantOutput(message) && !messageHasFreshActivity(message, now, maxAgeMs);
119479
+ }
119480
+ if (role === "user" && !messageIsSyntheticOrInternalUser(message)) {
119481
+ return false;
119482
+ }
119483
+ }
119484
+ return false;
119485
+ }
118774
119486
  function createEmptyAssistantTurnRetryDedupeKey(wake) {
118775
119487
  return [
118776
119488
  "background-agent-parent-wake-empty-retry",
@@ -118785,6 +119497,13 @@ function partHasFreshToolActivity(part, now, maxAgeMs) {
118785
119497
  }
118786
119498
  return timeHasFreshActivity(part.time, now, maxAgeMs) || timeHasFreshActivity(isRecord(part.state) ? part.state.time : undefined, now, maxAgeMs);
118787
119499
  }
119500
+ function messageHasFreshActivity(message, now, maxAgeMs) {
119501
+ if (!isRecord(message)) {
119502
+ return false;
119503
+ }
119504
+ const activityAt = getParentWakeMessageActivityAt(message);
119505
+ return activityAt !== undefined && now - activityAt <= maxAgeMs;
119506
+ }
118788
119507
  function timeHasFreshActivity(time, now, maxAgeMs) {
118789
119508
  if (!isRecord(time)) {
118790
119509
  return false;
@@ -118941,6 +119660,9 @@ class ParentWakeFlushRunner {
118941
119660
  log2("[background-agent] Recorded admit-only parent wake because parent session activity is still fresh:", {
118942
119661
  sessionID
118943
119662
  });
119663
+ if (latestWake.shouldReply) {
119664
+ this.schedulePendingParentWakeFlush(sessionID);
119665
+ }
118944
119666
  return;
118945
119667
  }
118946
119668
  const emptyAssistantTurnRetry = latestWake.allowEmptyAssistantTurnRetry === true;
@@ -118972,6 +119694,22 @@ class ParentWakeFlushRunner {
118972
119694
  });
118973
119695
  return;
118974
119696
  }
119697
+ const finalToolWaitDecision = await this.confirmParentWakeStillSafeForReply(sessionID, latestWake, toolWaitDecision);
119698
+ if (finalToolWaitDecision.defer) {
119699
+ if (this.deferReplyWakeWhileUnsafe(sessionID, latestWake)) {
119700
+ return;
119701
+ }
119702
+ await this.sendParentWakePrompt(sessionID, latestWake, {
119703
+ emptyAssistantTurnRetry,
119704
+ toolWaitDecision: { ...finalToolWaitDecision, skipPromptGateToolStateCheck: true },
119705
+ forceNoReply: true,
119706
+ retainPendingWake: latestWake.shouldReply
119707
+ });
119708
+ log2("[background-agent] Recorded admit-only parent wake because parent session history became unsafe:", {
119709
+ sessionID
119710
+ });
119711
+ return;
119712
+ }
118975
119713
  const dispatchedWake = this.deps.dispatchedTracker.getWake(sessionID);
118976
119714
  if (dispatchedWake && isRedundantParentWake(latestWake, dispatchedWake)) {
118977
119715
  this.deps.pendingQueue.deleteWake(sessionID);
@@ -118980,7 +119718,7 @@ class ParentWakeFlushRunner {
118980
119718
  }
118981
119719
  await this.sendParentWakePrompt(sessionID, latestWake, {
118982
119720
  emptyAssistantTurnRetry,
118983
- toolWaitDecision
119721
+ toolWaitDecision: finalToolWaitDecision
118984
119722
  });
118985
119723
  }
118986
119724
  schedulePendingParentWakeFlush(sessionID, delayMs) {
@@ -119051,6 +119789,12 @@ class ParentWakeFlushRunner {
119051
119789
  async shouldDeferParentWakeForSessionHistory(sessionID, wake) {
119052
119790
  return this.deps.sessionInspector.shouldDeferForHistory(sessionID, wake);
119053
119791
  }
119792
+ async confirmParentWakeStillSafeForReply(sessionID, wake, decision) {
119793
+ if (!decision.skipPromptGateToolStateCheck) {
119794
+ return decision;
119795
+ }
119796
+ return this.deps.sessionInspector.shouldDeferForHistory(sessionID, wake);
119797
+ }
119054
119798
  requeueWake(sessionID, latestWake) {
119055
119799
  this.deps.pendingQueue.requeueWake(sessionID, latestWake);
119056
119800
  }
@@ -119218,6 +119962,12 @@ function getParentWakeSessionHistoryDeferralDecision(input) {
119218
119962
  log2("[background-agent] Holding parent wake during stale tool-call deferral:", { sessionID: input.sessionID });
119219
119963
  return { defer: true, skipPromptGateToolStateCheck: true };
119220
119964
  }
119965
+ if (now - input.wake.toolCallDeferralStartedAt >= input.toolCallDeferMaxMs && latestAssistantTurnHasStaleUnknownSubstantiveOutput(messages, now, input.toolCallDeferMaxMs)) {
119966
+ log2("[background-agent] Retrying parent wake after stale unknown-finish assistant output:", {
119967
+ sessionID: input.sessionID
119968
+ });
119969
+ return { defer: false, skipPromptGateToolStateCheck: true };
119970
+ }
119221
119971
  log2("[background-agent] Deferred parent wake because latest assistant turn blocks internal prompts:", {
119222
119972
  sessionID: input.sessionID
119223
119973
  });
@@ -134488,6 +135238,9 @@ function buildGptSisyphusAgentConfig(mode, model, prompt) {
134488
135238
  reasoningEffort: "medium"
134489
135239
  };
134490
135240
  }
135241
+ function buildGlmSisyphusAgentConfig(mode, model, prompt) {
135242
+ return buildBaseSisyphusAgentConfig(mode, model, prompt);
135243
+ }
134491
135244
  function buildClaudeSisyphusAgentConfig(mode, model, prompt) {
134492
135245
  return {
134493
135246
  ...buildBaseSisyphusAgentConfig(mode, model, prompt),
@@ -136478,6 +137231,171 @@ ${antiPatterns}
136478
137231
  `;
136479
137232
  }
136480
137233
 
137234
+ // packages/omo-opencode/src/agents/sisyphus/glm-5-2.ts
137235
+ function buildGlm52TasksSection(useTaskSystem) {
137236
+ const noun = useTaskSystem ? "tasks" : "todos";
137237
+ const create = useTaskSystem ? "task_create" : "todowrite";
137238
+ const update = useTaskSystem ? "task_update" : "todowrite";
137239
+ const hook = useTaskSystem ? "TASK CONTINUATION" : "TODO CONTINUATION";
137240
+ return `<tasks>
137241
+ Use ${noun} for implementation work with two or more real steps, cross-file edits, delegated work, or uncertain scope. Skip tracking for direct answers, pure exploration, and one-step edits.
137242
+
137243
+ When tracking: call \`${create}\` before implementation, keep exactly one item \`in_progress\`, and call \`${update}\` the moment an item is done. Never batch completions. If scope changes, revise the list before more edits.
137244
+
137245
+ Your ${noun} are tracked by the harness via [SYSTEM REMINDER - ${hook}].
137246
+ </tasks>`;
137247
+ }
137248
+ function buildGlm52SisyphusPrompt(model, availableAgents, availableTools = [], availableSkills = [], availableCategories = [], useTaskSystem = false) {
137249
+ const keyTriggers = buildKeyTriggersSection(availableAgents, availableSkills);
137250
+ const toolSelection = buildToolSelectionTable(availableAgents, availableTools, availableSkills);
137251
+ const exploreSection = buildExploreSection(availableAgents);
137252
+ const librarianSection = buildLibrarianSection(availableAgents);
137253
+ const categorySkillsGuide = buildCategorySkillsDelegationGuide(availableCategories, availableSkills);
137254
+ const delegationTable = buildDelegationTable(availableAgents);
137255
+ const oracleSection = buildOracleSection(availableAgents);
137256
+ const hardBlocks = buildHardBlocksSection();
137257
+ const antiPatterns = buildAntiPatternsSection();
137258
+ const nonClaudePlannerSection = buildNonClaudePlannerSection(model);
137259
+ const tasksSection = buildGlm52TasksSection(useTaskSystem);
137260
+ const agentIdentity = buildAgentIdentitySection("Sisyphus", "Powerful AI Agent with orchestration capabilities from OhMyOpenCode");
137261
+ const roleBlock = `<role>
137262
+ You are Sisyphus, the OhMyOpenCode orchestration lead, running on GLM 5.2.
137263
+
137264
+ You are a senior engineer who scales output through specialists. Your job is to understand the user's destination, pick the right route, delegate when that improves the result, verify with real evidence, and stop only when the requested outcome is complete.
137265
+
137266
+ Implementation starts only when the current user turn explicitly asks for it with concrete scope. Questions get answers, investigations get findings, and implementation requests get shipped work.
137267
+ </role>`;
137268
+ const selfKnowledgeBlock = `<self_knowledge>
137269
+ You are GLM 5.2. Treat yourself as Claude Opus 4.6-style agentic machinery calibrated to think and act like Fable 5, while writing code with GPT-5.5 directness.
137270
+
137271
+ That means: XML tags help you parse the job, but outcomes matter more than rituals. Use the structure to decide faster, not to produce ceremony.
137272
+ </self_knowledge>`;
137273
+ const calibrationBlock = `<glm_52_calibration>
137274
+ Counter these GLM 5.2 failure modes explicitly:
137275
+
137276
+ 1. LITERAL FOLLOWING: when an instruction says "every", "all", or "for each", apply it to EVERY matching case. Do not silently handle only the first one.
137277
+ 2. OVER-EXPLORATION: sufficient context beats complete context. Once you can act correctly, ACT. Do not launch a second search wave to feel safer.
137278
+ 3. OVER-ASKING: minor decisions are yours. Pick names, defaults, and equivalent approaches; note the choice later. Ask only for scope changes, critical missing information, destructive actions, or external side effects.
137279
+ 4. CAPABILITY UNDER-REACH: when a key trigger, skill, category, or delegation table row matches, fire it immediately. The cost of missing a specialist is higher than the cost of loading one.
137280
+ 5. THINKING CALIBRATION: deliberate deeply for genuine multi-step reasoning, architecture, subtle debugging, or risk trade-offs. For routine classification, file edits, lookups, and known-pattern changes, decide directly and verify with tools.
137281
+ </glm_52_calibration>`;
137282
+ const outcomeBlock = `<outcome_first>
137283
+ Before work, identify three things: destination, constraints, and stopping condition.
137284
+
137285
+ - Destination: the user-visible result, not the intermediate task.
137286
+ - Constraints: explicit user requirements, codebase patterns, safety, type-safety, and runtime limits.
137287
+ - Stopping condition: the evidence that proves the destination is reached.
137288
+
137289
+ If the destination is unclear but one simple interpretation is valid, choose it and proceed. If different interpretations change the deliverable, ask one precise question.
137290
+ </outcome_first>`;
137291
+ const intentBlock = `<intent>
137292
+ Classify the CURRENT user message only. Do not carry implementation authorization across turns.
137293
+
137294
+ ${keyTriggers}
137295
+
137296
+ Surface form to routing:
137297
+
137298
+ | User says | True intent | You do |
137299
+ |---|---|---|
137300
+ | "explain", "how does" | understanding | explore enough, then answer |
137301
+ | "implement", "add", "create", "write" | implementation | plan, delegate or execute, verify |
137302
+ | "look into", "check", "investigate" | investigation | inspect, report findings, wait |
137303
+ | "what do you think" | evaluation | judge, propose, wait |
137304
+ | "broken", "error", "fix" | root-cause repair | diagnose, fix minimally, verify |
137305
+ | "refactor", "improve", "clean up" | open-ended change | assess, propose or use the matching skill |
137306
+
137307
+ Say one concise intent line before non-trivial action: "I read this as [type]: [route]." If the answer is already in context, answer instead of re-deriving.
137308
+ </intent>`;
137309
+ const explorationBlock = `<exploration>
137310
+ Use tools for facts. Internal memory is not evidence for file contents, configs, APIs, or current project state.
137311
+
137312
+ ${toolSelection}
137313
+
137314
+ ${exploreSection}
137315
+
137316
+ ${librarianSection}
137317
+
137318
+ Parallelize independent calls: file reads, searches, diagnostics, and background agents go out together. Sequence only when a later call needs an earlier result.
137319
+
137320
+ Search budget: known file or symbol = direct read/search; unfamiliar local pattern = one parallel wave; external package or API = librarian; architectural risk = Oracle. Stop when sources converge, the target file set is known, or the answer is found.
137321
+
137322
+ Fire explore/librarian in the background with [CONTEXT], [GOAL], [DOWNSTREAM], and [REQUEST]. Continue only with non-overlapping work; otherwise end the turn and wait for the completion reminder before calling \`background_output(task_id="bg_...")\`. Use \`task(task_id="ses_...")\` only for follow-ups to the same subagent.
137323
+
137324
+ ${buildAntiDuplicationSection()}
137325
+ </exploration>`;
137326
+ const delegationBlock = `<delegation>
137327
+ Prefer delegation when a specialist fits, the work spans multiple files, the domain is visual/frontend/security/performance, or the module is unfamiliar. Execute directly only for small, local, fully understood changes.
137328
+
137329
+ ${categorySkillsGuide}
137330
+
137331
+ ${nonClaudePlannerSection}
137332
+
137333
+ ${delegationTable}
137334
+
137335
+ Every delegation prompt carries six sections: TASK, EXPECTED OUTCOME, REQUIRED TOOLS, MUST DO, MUST NOT DO, CONTEXT. Make success criteria observable. Vague delegation is rejected work.
137336
+
137337
+ After delegation, verify the files and behavior yourself. A subagent report is a lead, not evidence.
137338
+ ${oracleSection ? `
137339
+ ${oracleSection}
137340
+ ` : ""}</delegation>`;
137341
+ const executionBlock = `<behavior>
137342
+ Implementation loop:
137343
+
137344
+ 1. Plan the smallest path to the destination. Two or more steps need ${useTaskSystem ? "tasks" : "todos"}; one obvious edit does not.
137345
+ 2. Match the repo: read configs and similar files before writing. Do not invent style.
137346
+ 3. Change only what the request requires. Bug fix does not mean refactor. Refactor does not mean feature work.
137347
+ 4. Use type-safe code. No type suppression, no speculative fallbacks, no helpers for one-off operations, no validation away from trust boundaries.
137348
+ 5. On failure, read the error, identify the root cause, try a materially different approach, and re-verify. After three failed approaches, stop editing and consult Oracle or ask if Oracle cannot resolve it.
137349
+
137350
+ Never revert, delete, push, publish, message, or affect shared systems without explicit approval. Reversible local edits and verification commands are allowed.
137351
+ </behavior>`;
137352
+ const verificationBlock = `<verification>
137353
+ Verification defines done.
137354
+
137355
+ - File edit: run \`lsp_diagnostics\` on every changed file.
137356
+ - Behavioral change: run adjacent tests or the smallest relevant suite.
137357
+ - Buildable project: run the build/typecheck path that covers the touched code.
137358
+ - Runnable or user-visible behavior: exercise the real surface: browser for web, interactive_bash for TUI/CLI, curl for HTTP, driver script for libraries.
137359
+ - Delegated work: inspect touched files and rerun checks yourself.
137360
+
137361
+ Report only evidence from this turn. "Should pass" means unverified. Fix failures caused by your change; name unrelated pre-existing failures without widening scope.
137362
+ </verification>`;
137363
+ const communicationBlock = `<communication>
137364
+ Be terse, concrete, and useful. No flattery, no filler, no narration of routine tool calls.
137365
+
137366
+ Progress updates are for meaningful transitions: before exploration, after a load-bearing discovery, before substantial edits, after edits with validation next, or on blockers. Final answers state what changed, where, verification results, and any real residual risk.
137367
+ </communication>`;
137368
+ const constraintsBlock = `<constraints>
137369
+ ${hardBlocks}
137370
+
137371
+ ${antiPatterns}
137372
+ </constraints>`;
137373
+ return `${agentIdentity}
137374
+ ${roleBlock}
137375
+
137376
+ ${selfKnowledgeBlock}
137377
+
137378
+ ${calibrationBlock}
137379
+
137380
+ ${outcomeBlock}
137381
+
137382
+ ${intentBlock}
137383
+
137384
+ ${explorationBlock}
137385
+
137386
+ ${delegationBlock}
137387
+
137388
+ ${executionBlock}
137389
+
137390
+ ${verificationBlock}
137391
+
137392
+ ${tasksSection}
137393
+
137394
+ ${communicationBlock}
137395
+
137396
+ ${constraintsBlock}`;
137397
+ }
137398
+
136481
137399
  // packages/omo-opencode/src/agents/gpt-apply-patch-guard.ts
136482
137400
  var GPT_APPLY_PATCH_GUIDANCE = "Use `apply_patch` for file edits. Keep patches small and match the surrounding lines exactly so verification passes.";
136483
137401
  var GPT_FILE_EDIT_GUIDANCE = "Use whichever file-editing tool is exposed in your toolset (`apply_patch`, or `edit`/`write`). Keep each change small and match the surrounding lines exactly so it applies on the first attempt.";
@@ -137951,6 +138869,9 @@ function createSisyphusAgent(model, availableAgents, availableToolNames, availab
137951
138869
  if (isClaudeOpus47Model(model)) {
137952
138870
  return buildClaudeSisyphusAgentConfig(MODE, model, buildClaudeOpus47SisyphusPrompt(model, agents, tools, skills, categories, useTaskSystem));
137953
138871
  }
138872
+ if (isGlmModel(model)) {
138873
+ return buildGlmSisyphusAgentConfig(MODE, model, buildGlm52SisyphusPrompt(model, agents, tools, skills, categories, useTaskSystem));
138874
+ }
137954
138875
  const prompt = buildFallbackSisyphusPrompt(model, agents, tools, skills, categories, useTaskSystem);
137955
138876
  if (isGptModel(model)) {
137956
138877
  return buildGptSisyphusAgentConfig(MODE, model, prompt);
@@ -141754,6 +142675,125 @@ No tasks on multi-step work = INCOMPLETE WORK. The user tracks your progress thr
141754
142675
 
141755
142676
  No todos on multi-step work = INCOMPLETE WORK. The user tracks your progress through todos.`;
141756
142677
  }
142678
+ // packages/omo-opencode/src/agents/sisyphus-junior/glm-5-2.ts
142679
+ function buildGlm52TrackingSection(useTaskSystem) {
142680
+ if (useTaskSystem) {
142681
+ return `<task_tracking>
142682
+ Use task tracking for any non-trivial work.
142683
+ - 2+ steps: call \`task_create\` before editing.
142684
+ - Start one item at a time with \`task_update(status="in_progress")\`.
142685
+ - Complete it immediately with \`task_update(status="completed")\`.
142686
+ - Never batch completions or leave stale task state.
142687
+ </task_tracking>`;
142688
+ }
142689
+ return `<todo_tracking>
142690
+ Use todo tracking for any non-trivial work.
142691
+ - 2+ steps: call \`todowrite\` before editing.
142692
+ - Keep one item \`in_progress\` at a time.
142693
+ - Mark each item \`completed\` immediately after it lands.
142694
+ - Never batch completions or leave stale todo state.
142695
+ </todo_tracking>`;
142696
+ }
142697
+ function buildGlm52SisyphusJuniorPrompt(useTaskSystem, promptAppend) {
142698
+ const trackingSection = buildGlm52TrackingSection(useTaskSystem);
142699
+ const trackingTool = useTaskSystem ? "task_update" : "todowrite";
142700
+ const prompt = `<identity>
142701
+ You are Sisyphus-Junior, the focused task executor from OhMyOpenCode, running on GLM 5.2.
142702
+
142703
+ You receive one delegated category task from Atlas or Sisyphus and complete it directly. You do not orchestrate, do not delegate implementation, and do not expand the scope. You may use explore or librarian through \`call_omo_agent\` for research only; the implementation, verification, and final handoff are yours.
142704
+ </identity>
142705
+
142706
+ <glm_5_2_calibration>
142707
+ GLM 5.2 is closest to Opus 4.6, tuned to think and act like Fable 5, and writes code best with GPT-5.5-style outcome-first instructions.
142708
+
142709
+ Use that mix deliberately:
142710
+ - Follow instructions literally. Apply a constraint to every relevant part only when the prompt says that scope.
142711
+ - Think enough before risky work, then act. Avoid re-litigating a chosen approach unless tool output contradicts it.
142712
+ - Prefer codebase facts over memory. Read files, inspect patterns, and verify with tools before claiming.
142713
+ - Keep coding goal-shaped: smallest correct diff, no speculative fallback, no unrequested refactor.
142714
+ - Report grounded progress only when useful. No cheerleading, no filler, no theatrical certainty.
142715
+ </glm_5_2_calibration>
142716
+
142717
+ <task_execution>
142718
+ Treat the delegated task as an action request unless it explicitly asks for analysis only.
142719
+
142720
+ Work until the task is complete:
142721
+ - Implement exactly what was asked and nothing extra.
142722
+ - Ask only when a user-only decision blocks progress.
142723
+ - If blocked, try a different approach, decompose the problem, inspect nearby patterns, then continue.
142724
+ - Fix root causes when reachable within the task scope.
142725
+ - Do not stop at a partial patch, green types, or plausible prose.
142726
+
142727
+ Do not ask permission to proceed, run tests, inspect files, or make the obvious next edit. Make the reasonable call, then note any assumption in the final answer.
142728
+ </task_execution>
142729
+
142730
+ <scope_discipline>
142731
+ The orchestrator already chose your category. Stay inside it.
142732
+
142733
+ - No extra features, UX polish, cleanup, or broad refactors unless directly required.
142734
+ - Do not modify unrelated user or agent changes in a dirty worktree.
142735
+ - If several interpretations are plausible, state the simplest valid reading and proceed.
142736
+ - If missing information might exist in the repo, search for it before deciding it is missing.
142737
+ - If the task conflicts with repo instructions or safety constraints, follow the higher-priority rule and report the conflict.
142738
+ </scope_discipline>
142739
+
142740
+ <tool_use>
142741
+ Use tools to know, not to decorate the trace.
142742
+
142743
+ - Read referenced files before editing or making claims about them.
142744
+ - Search for similar patterns before writing code.
142745
+ - Run independent reads, searches, diagnostics, and research agents in parallel when there is no dependency.
142746
+ - Sequence only when the next call needs the prior result.
142747
+ - If a tool result is empty or surprising, retry with a different strategy before concluding.
142748
+ - After editing, say what changed, where, and what verification follows.
142749
+
142750
+ ${buildAntiDuplicationSection()}
142751
+ </tool_use>
142752
+
142753
+ <code_discipline>
142754
+ Match the existing codebase: imports, naming, formatting, error handling, tests, and file boundaries.
142755
+
142756
+ - Default to ASCII. Add comments only for non-obvious logic.
142757
+ - Keep changes small and local. Use the edit mechanism available in the harness.
142758
+ - Do not add defensive code for states the types or framework already rule out.
142759
+ - Do not create one-off helpers, abstractions, compatibility shims, or TODO placeholders.
142760
+ - Never delete or weaken a failing test to get green.
142761
+ </code_discipline>
142762
+
142763
+ <verification>
142764
+ You are not done until the current turn has evidence.
142765
+
142766
+ Required after implementation:
142767
+ - Run \`lsp_diagnostics\` on every changed source file.
142768
+ - Run related tests when they exist.
142769
+ - Run typecheck or build when the package expects it and the scope warrants it.
142770
+ - For runnable or user-visible behavior, exercise the real surface, not just the type system.
142771
+ - Keep ${trackingTool} state accurate; all tracked items must be complete before final.
142772
+
142773
+ If verification exposes a defect caused by your change, fix it in this turn and verify again. If a failure is pre-existing or outside scope, report it with the command and symptom.
142774
+ </verification>
142775
+
142776
+ ${trackingSection}
142777
+
142778
+ <failure_recovery>
142779
+ When a fix fails, repair the root cause and re-verify. Do not blindly retry the same patch. After three materially different approaches fail, stop editing, explain each attempt and result, and return the blocker clearly.
142780
+ </failure_recovery>
142781
+
142782
+ <communication>
142783
+ Be terse and concrete.
142784
+
142785
+ - Start work directly. No empty acknowledgments.
142786
+ - Send progress only at phase changes: exploration, implementation, verification, blocker.
142787
+ - Explain the why behind non-obvious choices.
142788
+ - Final answer: what changed, where, what verification passed, and any residual risk.
142789
+ - No emojis, no fluff, no claims unsupported by tool output.
142790
+ </communication>`;
142791
+ if (!promptAppend)
142792
+ return prompt;
142793
+ return `${prompt}
142794
+
142795
+ ${resolvePromptAppend(promptAppend)}`;
142796
+ }
141757
142797
  // packages/omo-opencode/src/agents/sisyphus-junior/kimi-k2-7.ts
141758
142798
  function buildKimiK27TaskDisciplineSection(useTaskSystem) {
141759
142799
  const create = useTaskSystem ? "`task_create`" : "`todowrite`";
@@ -141849,6 +142889,8 @@ function getSisyphusJuniorPromptSource(model) {
141849
142889
  if (model && isGeminiModel(model)) {
141850
142890
  return "gemini";
141851
142891
  }
142892
+ if (model && isGlmModel(model))
142893
+ return "glm-5-2";
141852
142894
  return "default";
141853
142895
  }
141854
142896
  function buildSisyphusJuniorPrompt(model, useTaskSystem, promptAppend) {
@@ -141866,6 +142908,8 @@ function buildSisyphusJuniorPrompt(model, useTaskSystem, promptAppend) {
141866
142908
  return buildGptSisyphusJuniorPrompt(useTaskSystem, promptAppend);
141867
142909
  case "gemini":
141868
142910
  return buildGeminiSisyphusJuniorPrompt(useTaskSystem, promptAppend);
142911
+ case "glm-5-2":
142912
+ return buildGlm52SisyphusJuniorPrompt(useTaskSystem, promptAppend);
141869
142913
  case "default":
141870
142914
  default:
141871
142915
  return buildDefaultSisyphusJuniorPrompt(useTaskSystem, promptAppend);
@@ -143964,7 +145008,7 @@ async function loadPluginComponents(params) {
143964
145008
  const errorMessage = error instanceof Error ? error.message : String(error);
143965
145009
  log2("[config-handler] Plugin loading failed", { error: errorMessage });
143966
145010
  addConfigLoadError({ path: "plugin-loading", error: errorMessage });
143967
- return EMPTY_PLUGIN_COMPONENTS;
145011
+ return { ...EMPTY_PLUGIN_COMPONENTS, retryableLoadFailure: true };
143968
145012
  }
143969
145013
  }
143970
145014
 
@@ -144103,8 +145147,38 @@ function collectTrustedVisionCapableModels(pluginConfig) {
144103
145147
  }
144104
145148
  return trusted;
144105
145149
  }
145150
+ function cloneConfigValue(value) {
145151
+ if (Array.isArray(value)) {
145152
+ return value.map(cloneConfigValue);
145153
+ }
145154
+ if (typeof value === "object" && value !== null) {
145155
+ return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, cloneConfigValue(entry)]));
145156
+ }
145157
+ return value;
145158
+ }
145159
+ function cloneAgentConfig(agents) {
145160
+ return cloneConfigValue(agents);
145161
+ }
145162
+ function createAgentConfigCacheKey(config) {
145163
+ return JSON.stringify({
145164
+ agent: config.agent,
145165
+ default_agent: config.default_agent,
145166
+ model: config.model,
145167
+ skills: config.skills
145168
+ });
145169
+ }
145170
+ function replayAgentConfigSideEffects(params) {
145171
+ if (params.configuredDefaultAgent && typeof params.defaultAgent === "string") {
145172
+ setDefaultAgentForSort(params.defaultAgent);
145173
+ }
145174
+ clearRegisteredAgentNames();
145175
+ for (const name of Object.keys(params.agentResult)) {
145176
+ registerAgentName(name);
145177
+ }
145178
+ }
144106
145179
  function createConfigHandler(deps) {
144107
145180
  const { ctx, pluginConfig, modelCacheState, runtimeSkillSourceUrl } = deps;
145181
+ let agentConfigSnapshot;
144108
145182
  return async (config) => {
144109
145183
  const formatterConfig = config.formatter;
144110
145184
  setAdditionalAllowedMcpEnvVars(pluginConfig.mcp_env_allowlist ?? []);
@@ -144115,13 +145189,36 @@ function createConfigHandler(deps) {
144115
145189
  });
144116
145190
  clearFormatterCache();
144117
145191
  const pluginComponents = await loadPluginComponents({ pluginConfig });
145192
+ const pluginComponentsLoadFailed = pluginComponents.retryableLoadFailure === true;
144118
145193
  applyHookConfig({ pluginComponents });
144119
- const agentResult = await applyAgentConfig({
144120
- config,
144121
- pluginConfig,
144122
- ctx,
144123
- pluginComponents
144124
- });
145194
+ const agentCacheKey = createAgentConfigCacheKey(config);
145195
+ let agentResult;
145196
+ if (!pluginComponentsLoadFailed && agentConfigSnapshot?.cacheKey === agentCacheKey) {
145197
+ config.agent = cloneAgentConfig(agentConfigSnapshot.agents);
145198
+ if (agentConfigSnapshot.defaultAgent !== undefined) {
145199
+ config.default_agent = agentConfigSnapshot.defaultAgent;
145200
+ }
145201
+ agentResult = config.agent;
145202
+ replayAgentConfigSideEffects({
145203
+ agentResult,
145204
+ configuredDefaultAgent: agentConfigSnapshot.configuredDefaultAgent,
145205
+ defaultAgent: config.default_agent
145206
+ });
145207
+ } else {
145208
+ const configuredDefaultAgent = getConfiguredDefaultAgent(config);
145209
+ agentResult = await applyAgentConfig({
145210
+ config,
145211
+ pluginConfig,
145212
+ ctx,
145213
+ pluginComponents
145214
+ });
145215
+ agentConfigSnapshot = pluginComponentsLoadFailed ? undefined : {
145216
+ cacheKey: agentCacheKey,
145217
+ configuredDefaultAgent,
145218
+ defaultAgent: config.default_agent,
145219
+ agents: cloneAgentConfig(agentResult)
145220
+ };
145221
+ }
144125
145222
  applyToolConfig({ config, pluginConfig, agentResult });
144126
145223
  await applyMcpConfig({ config, pluginConfig, ctx, pluginComponents });
144127
145224
  await applyCommandConfig({ config, pluginConfig, ctx, pluginComponents });
@@ -147426,9 +148523,9 @@ function getSparkShellRuntimeAwareness(env2 = process.env) {
147426
148523
  "- Use `omo sparkshell --shell '<command>'` only when shell metacharacters are required.",
147427
148524
  "- Use `omo sparkshell --tmux-pane <pane-id> --tail-lines 400` to inspect an existing tmux pane. Tail lines must stay between 100 and 1000.",
147428
148525
  "- When no native sidecar or appserver is available, Sparkshell silently falls back to raw command execution. `OMO_SPARKSHELL_BIN` selects a native sidecar path.",
147429
- "- When `CODEX_THREAD_ID` identifies a Codex session, Sparkshell appends recent session context (first/latest user request + last 5 conversation messages) after the shell result so output consumers stay aligned with the session goals. `OMO_SPARKSHELL_SESSION_CONTEXT=0` disables it.",
148526
+ "- When `CODEX_THREAD_ID` identifies a Codex session, Sparkshell feeds recent session context (first/latest user request + last 5 conversation messages) into oversized-output condensation for relevance ranking, but never appends that context to command output. `OMO_SPARKSHELL_SESSION_CONTEXT=0` disables the lookup.",
147430
148527
  "- Route potentially huge output (full log files, big diffs, `cat`/`grep` over large artifacts) through Sparkshell instead of reading it raw: oversized output is condensed to a budget while preserving error signatures, repeated patterns, session-goal-relevant lines, and head/tail. Tune with `--budget <chars>`; disable with `OMO_SPARKSHELL_CONDENSE=0`.",
147431
- "- Oversized output is first summarized by the spark model (`codex exec`, default `gpt-5.3-codex-spark`) fed with the session context: the summary reproduces the output as-is (no masking) and ends with a `[sparkshell caption]` line describing what ran and which lines were omitted. `OMO_SPARKSHELL_SPARK=0` skips the model and uses deterministic condensation directly."
148528
+ "- Oversized output is first summarized by the spark model (`codex exec`, default `gpt-5.3-codex-spark`) fed with the shell output plus session context: the summary keeps selected output as-is (no masking) and ends with a `[sparkshell caption]` line describing what ran, what the full output contained, and which lines were omitted. `OMO_SPARKSHELL_SPARK=0` skips the model and uses deterministic condensation directly."
147432
148529
  ].join(`
147433
148530
  `);
147434
148531
  }
@@ -147450,20 +148547,8 @@ function isFalsy(value) {
147450
148547
 
147451
148548
  // packages/omo-opencode/src/plugin/system-transform.ts
147452
148549
  var ULTRAWORK_MODE_TAG = "<ultrawork-mode>";
147453
- function reconcileFileEditGuidance(system, modelID) {
147454
- if (!modelID)
147455
- return;
147456
- const [from, to] = isGptModel(modelID) ? [GPT_FILE_EDIT_GUIDANCE, GPT_APPLY_PATCH_GUIDANCE] : [GPT_APPLY_PATCH_GUIDANCE, GPT_FILE_EDIT_GUIDANCE];
147457
- for (let i = 0;i < system.length; i++) {
147458
- const part = system[i];
147459
- if (part.includes(from)) {
147460
- system[i] = part.split(from).join(to);
147461
- }
147462
- }
147463
- }
147464
148550
  function createSystemTransformHandler(defaultMode, getUltraworkMessage2, env2 = process.env) {
147465
148551
  return async (input, output) => {
147466
- reconcileFileEditGuidance(output.system, input.model?.id);
147467
148552
  const sparkshellAwareness = getSparkShellRuntimeAwareness(env2);
147468
148553
  if (sparkshellAwareness.length > 0 && !output.system.some(hasSparkShellRuntimeAwareness)) {
147469
148554
  output.system.push(sparkshellAwareness);
@@ -149053,6 +150138,15 @@ async function resolveSessionAgent(client3, sessionId) {
149053
150138
  // packages/omo-opencode/src/plugin/tool-execute-before.ts
149054
150139
  init_constants3();
149055
150140
  init_storage();
150141
+ var BACKGROUND_WAIT_BLOCK_MESSAGE = [
150142
+ "Background task wait is already managed by the plugin.",
150143
+ "End this response now and wait for the <system-reminder> completion notification.",
150144
+ "After that reminder arrives, call background_output with the task_id from the launch result."
150145
+ ].join(" ");
150146
+ function isPureSleepCommand(command) {
150147
+ const commandLines = command.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
150148
+ return commandLines.length > 0 && commandLines.every((line) => /^sleep\s+\d+(?:\.\d+)?[smhd]?\s*$/i.test(line));
150149
+ }
149056
150150
  function getLoopCommandArguments(args, command) {
149057
150151
  const rawUserMessage = typeof args.user_message === "string" ? args.user_message.trim() : "";
149058
150152
  if (rawUserMessage) {
@@ -149062,7 +150156,7 @@ function getLoopCommandArguments(args, command) {
149062
150156
  return rawName.replace(new RegExp(`^/?(${command})\\s*`, "i"), "");
149063
150157
  }
149064
150158
  function createToolExecuteBeforeHandler3(args) {
149065
- const { ctx, hooks } = args;
150159
+ const { ctx, hooks, backgroundManager } = args;
149066
150160
  function buildUltraworkOracleVerificationPrompt(prompt, originalTask, verificationAttemptId) {
149067
150161
  const verificationPrompt = [
149068
150162
  "You are verifying the active ULTRAWORK loop result for this session.",
@@ -149103,6 +150197,9 @@ function createToolExecuteBeforeHandler3(args) {
149103
150197
  callID: input.callID
149104
150198
  });
149105
150199
  }
150200
+ if (isPureSleepCommand(output.args.command) && (backgroundManager?.hasActiveChildTasks(input.sessionID) === true || backgroundManager?.hasPendingParentWake(input.sessionID) === true)) {
150201
+ throw new Error(BACKGROUND_WAIT_BLOCK_MESSAGE);
150202
+ }
149106
150203
  }
149107
150204
  await hooks.writeExistingFileGuard?.["tool.execute.before"]?.(input, output);
149108
150205
  await hooks.notepadWriteGuard?.["tool.execute.before"]?.(input, output);
@@ -149270,7 +150367,8 @@ function createPluginInterface(args) {
149270
150367
  }),
149271
150368
  "tool.execute.before": createToolExecuteBeforeHandler3({
149272
150369
  ctx,
149273
- hooks
150370
+ hooks,
150371
+ backgroundManager: managers.backgroundManager
149274
150372
  }),
149275
150373
  "tool.execute.after": createToolExecuteAfterHandler3({
149276
150374
  ctx,