typeclaw 0.48.12 → 0.49.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 (213) hide show
  1. package/package.json +6 -3
  2. package/scripts/dump-system-prompt.ts +52 -110
  3. package/src/agent/attention-escalation.ts +8 -5
  4. package/src/agent/auth-reloadable.ts +2 -3
  5. package/src/agent/auth.ts +59 -79
  6. package/src/agent/compaction.ts +2 -2
  7. package/src/agent/index.ts +173 -85
  8. package/src/agent/live-sessions.ts +2 -2
  9. package/src/agent/live-subagents.ts +1 -0
  10. package/src/agent/llm-replay-sanitizer.ts +1 -1
  11. package/src/agent/model-overrides.ts +1 -1
  12. package/src/agent/multimodal/look-at.ts +3 -3
  13. package/src/agent/multimodal/read-redirect.ts +1 -1
  14. package/src/agent/plugin-tools.ts +76 -39
  15. package/src/agent/prompt-cache-key.ts +42 -0
  16. package/src/agent/provider-error.ts +179 -10
  17. package/src/agent/reload-tool.ts +1 -1
  18. package/src/agent/restart-handoff/index.ts +7 -14
  19. package/src/agent/reviewer-activity.ts +68 -0
  20. package/src/agent/session-origin.ts +33 -0
  21. package/src/agent/subagents.ts +14 -2
  22. package/src/agent/system-prompt.ts +68 -202
  23. package/src/agent/todo/continuation-policy.ts +12 -4
  24. package/src/agent/tool-error-remediation.ts +1 -1
  25. package/src/agent/tool-file-safety.ts +113 -14
  26. package/src/agent/tool-not-found-nudge.ts +1 -1
  27. package/src/agent/tool-result-budget.ts +2 -2
  28. package/src/agent/tools/channel-disengage.ts +2 -2
  29. package/src/agent/tools/channel-edit.ts +2 -2
  30. package/src/agent/tools/channel-fetch-attachment.ts +2 -2
  31. package/src/agent/tools/channel-history-render.ts +2 -1
  32. package/src/agent/tools/channel-history.ts +2 -2
  33. package/src/agent/tools/channel-react.ts +2 -2
  34. package/src/agent/tools/channel-read.ts +2 -2
  35. package/src/agent/tools/channel-reply.ts +25 -7
  36. package/src/agent/tools/channel-send.ts +51 -9
  37. package/src/agent/tools/curl-impersonate.ts +11 -2
  38. package/src/agent/tools/grant-role.ts +2 -2
  39. package/src/agent/tools/post-github-review.ts +79 -17
  40. package/src/agent/tools/restart.ts +2 -2
  41. package/src/agent/tools/skip-response.ts +4 -4
  42. package/src/agent/tools/spawn-subagent.ts +165 -14
  43. package/src/agent/tools/stream-snapshot.ts +2 -2
  44. package/src/agent/tools/subagent-cancel.ts +2 -2
  45. package/src/agent/tools/subagent-output.ts +10 -2
  46. package/src/agent/tools/todo/index.ts +2 -2
  47. package/src/agent/tools/webfetch/tool.ts +2 -2
  48. package/src/agent/tools/websearch.ts +2 -2
  49. package/src/bundled-plugins/backup/README.md +10 -9
  50. package/src/bundled-plugins/backup/runner.ts +140 -58
  51. package/src/bundled-plugins/backup/subagents.ts +58 -26
  52. package/src/bundled-plugins/github-cli-auth/gh-command.ts +34 -2
  53. package/src/bundled-plugins/github-cli-auth/granted-push.ts +135 -0
  54. package/src/bundled-plugins/github-cli-auth/index.ts +83 -11
  55. package/src/bundled-plugins/github-cli-auth/review-account.ts +23 -0
  56. package/src/bundled-plugins/github-cli-auth/review-checkout.ts +9 -2
  57. package/src/bundled-plugins/github-cli-auth/review-recorder.ts +45 -7
  58. package/src/bundled-plugins/operator/operator.ts +15 -4
  59. package/src/bundled-plugins/reviewer/skills/code-review.ts +1 -1
  60. package/src/bundled-plugins/security/index.ts +50 -2
  61. package/src/bundled-plugins/security/policies/git-exfil.ts +24 -12
  62. package/src/channels/adapters/discord-bot-reactions.ts +18 -0
  63. package/src/channels/adapters/discord-bot.ts +122 -67
  64. package/src/channels/adapters/discord-reactions.ts +18 -0
  65. package/src/channels/adapters/discord.ts +114 -8
  66. package/src/channels/adapters/github/inbound.ts +103 -8
  67. package/src/channels/adapters/github/index.ts +251 -19
  68. package/src/channels/adapters/github/last-alive.ts +27 -0
  69. package/src/channels/adapters/github/outbound.ts +54 -18
  70. package/src/channels/adapters/github/pending-review-store.ts +141 -0
  71. package/src/channels/adapters/github/permission-guidance.ts +1 -0
  72. package/src/channels/adapters/github/reactions.ts +100 -0
  73. package/src/channels/adapters/github/reconcile-cooldown-store.ts +197 -67
  74. package/src/channels/adapters/github/reconcile-open-prs.ts +418 -33
  75. package/src/channels/adapters/github/recovery.ts +106 -0
  76. package/src/channels/adapters/github/review-check.ts +510 -0
  77. package/src/channels/adapters/github/review-submitter.ts +34 -2
  78. package/src/channels/adapters/instagram.ts +32 -14
  79. package/src/channels/adapters/kakaotalk.ts +22 -7
  80. package/src/channels/adapters/line.ts +18 -3
  81. package/src/channels/adapters/outbound-account.ts +20 -0
  82. package/src/channels/adapters/own-reactions.ts +66 -0
  83. package/src/channels/adapters/recovery-correlation.ts +214 -0
  84. package/src/channels/adapters/slack-bot-classify.ts +18 -11
  85. package/src/channels/adapters/slack-bot-dedupe.ts +111 -28
  86. package/src/channels/adapters/slack-bot-reactions.ts +18 -0
  87. package/src/channels/adapters/slack-bot.ts +125 -57
  88. package/src/channels/adapters/slack-classify.ts +25 -4
  89. package/src/channels/adapters/slack-inbound-revision.ts +96 -0
  90. package/src/channels/adapters/slack-reactions.ts +18 -0
  91. package/src/channels/adapters/slack-thread-ts.ts +6 -0
  92. package/src/channels/adapters/slack.ts +48 -3
  93. package/src/channels/adapters/teams.ts +14 -4
  94. package/src/channels/adapters/telegram-bot.ts +56 -10
  95. package/src/channels/adapters/webex-bot.ts +12 -2
  96. package/src/channels/adapters/webex.ts +12 -2
  97. package/src/channels/background-handoff.ts +434 -0
  98. package/src/channels/background-obligations.ts +893 -0
  99. package/src/channels/continuity-types.ts +271 -0
  100. package/src/channels/github-review-check.ts +598 -0
  101. package/src/channels/github-review-turn-ledger.ts +102 -28
  102. package/src/channels/github-review-verdict-coordinator.ts +96 -13
  103. package/src/channels/github-token-bridge.ts +11 -5
  104. package/src/channels/inbound-journal.ts +1738 -0
  105. package/src/channels/index.ts +6 -1
  106. package/src/channels/manager.ts +17 -7
  107. package/src/channels/recovery-dispatcher.ts +264 -0
  108. package/src/channels/recovery-notice.ts +94 -0
  109. package/src/channels/recovery-outbox.ts +459 -0
  110. package/src/channels/router.ts +2582 -633
  111. package/src/channels/schema.ts +8 -1
  112. package/src/channels/subagent-completion-bridge.ts +17 -14
  113. package/src/channels/types.ts +121 -16
  114. package/src/channels/waiting-reactions.ts +664 -0
  115. package/src/cli/compose.ts +7 -4
  116. package/src/cli/hostd.ts +49 -3
  117. package/src/cli/inspect.ts +11 -14
  118. package/src/cli/model.ts +7 -5
  119. package/src/cli/oauth-callbacks.ts +38 -23
  120. package/src/coding-agent/broker-body.ts +38 -0
  121. package/src/coding-agent/broker.ts +290 -0
  122. package/src/coding-agent/claude.ts +95 -0
  123. package/src/coding-agent/codex.ts +104 -0
  124. package/src/coding-agent/index.ts +506 -0
  125. package/src/coding-agent/omo-state.ts +69 -0
  126. package/src/coding-agent/omo-stream.ts +98 -0
  127. package/src/coding-agent/omo.ts +192 -0
  128. package/src/coding-agent/runner.ts +263 -0
  129. package/src/coding-agent/tool.ts +62 -0
  130. package/src/coding-agent/worktree.ts +355 -0
  131. package/src/compose/restart.ts +10 -3
  132. package/src/compose/start.ts +20 -3
  133. package/src/config/config.ts +70 -26
  134. package/src/config/providers.ts +278 -50
  135. package/src/container/exit-reason.ts +44 -0
  136. package/src/container/index.ts +5 -0
  137. package/src/container/log-archive.ts +51 -13
  138. package/src/container/memory-limit.ts +1 -1
  139. package/src/container/memory-oversubscription.ts +36 -6
  140. package/src/container/oom-events.ts +86 -0
  141. package/src/container/restart.ts +2 -0
  142. package/src/container/shared.ts +8 -1
  143. package/src/container/start.ts +25 -13
  144. package/src/container/stop.ts +6 -2
  145. package/src/container/tool-oom-priority.ts +32 -0
  146. package/src/cron/consumer.ts +10 -4
  147. package/src/cron/reloadable.ts +23 -2
  148. package/src/doctor/checks.ts +14 -2
  149. package/src/hostd/daemon.ts +20 -10
  150. package/src/hostd/spawn.ts +106 -5
  151. package/src/hostd/version.ts +20 -0
  152. package/src/hostd/watchdog.ts +241 -0
  153. package/src/init/dockerfile.ts +57 -592
  154. package/src/init/index.ts +6 -7
  155. package/src/init/oauth-login.ts +57 -17
  156. package/src/inspect/transcript-view.ts +6 -3
  157. package/src/mcp/client.ts +3 -1
  158. package/src/operations/classify-tool-outcome.ts +45 -1
  159. package/src/operations/incidents.ts +10 -5
  160. package/src/plugin/core-tool-names.ts +1 -1
  161. package/src/plugin/define.ts +1 -0
  162. package/src/plugin/index.ts +1 -0
  163. package/src/plugin/types.ts +6 -1
  164. package/src/run/background-handoff-boot.ts +86 -0
  165. package/src/run/channel-session-factory.ts +5 -4
  166. package/src/run/index.ts +93 -93
  167. package/src/run/resource-sample.ts +19 -0
  168. package/src/sandbox/build.ts +4 -0
  169. package/src/sandbox/coding-agent.ts +214 -0
  170. package/src/sandbox/policy.ts +1 -0
  171. package/src/sandbox/runtime-private.ts +4 -1
  172. package/src/secrets/coding-agent-auth.ts +97 -0
  173. package/src/secrets/index.ts +0 -16
  174. package/src/secrets/refresh-provider-oauth.ts +30 -76
  175. package/src/secrets/schema.ts +3 -4
  176. package/src/secrets/storage.ts +133 -234
  177. package/src/server/command-runner.ts +6 -2
  178. package/src/server/index.ts +102 -41
  179. package/src/sessions/index.ts +1 -1
  180. package/src/skills/typeclaw-channel-github/SKILL.md +7 -5
  181. package/src/skills/typeclaw-claude-code/SKILL.md +25 -260
  182. package/src/skills/typeclaw-claude-code/references/auth-flow.md +7 -23
  183. package/src/skills/typeclaw-claude-code/references/headless-sessions.md +11 -0
  184. package/src/skills/typeclaw-claude-code/references/results-and-worktrees.md +13 -0
  185. package/src/skills/typeclaw-codex-cli/SKILL.md +35 -270
  186. package/src/skills/typeclaw-codex-cli/references/auth-flow.md +13 -20
  187. package/src/skills/typeclaw-codex-cli/references/headless-sessions.md +26 -0
  188. package/src/skills/typeclaw-codex-cli/references/results-and-worktrees.md +28 -0
  189. package/src/skills/typeclaw-config/SKILL.md +24 -24
  190. package/src/skills/typeclaw-config/references/dockerfile.md +14 -13
  191. package/src/skills/typeclaw-cron/SKILL.md +1 -1
  192. package/src/skills/typeclaw-github-contributing/SKILL.md +2 -2
  193. package/src/skills/typeclaw-memory/SKILL.md +3 -3
  194. package/src/skills/typeclaw-omo-cli/SKILL.md +52 -0
  195. package/src/skills/typeclaw-omo-cli/references/auth-flow.md +11 -0
  196. package/src/skills/typeclaw-omo-cli/references/headless-sessions.md +11 -0
  197. package/src/skills/typeclaw-omo-cli/references/results-and-worktrees.md +23 -0
  198. package/src/skills/typeclaw-plugins/SKILL.md +20 -20
  199. package/src/skills/typeclaw-skills/SKILL.md +19 -2
  200. package/src/skills/typeclaw-troubleshooting/SKILL.md +15 -2
  201. package/src/tui/index.ts +5 -3
  202. package/src/tui/theme.ts +1 -1
  203. package/typeclaw.schema.json +44 -2
  204. package/src/agent/adaptive-thinking-compat.ts +0 -79
  205. package/src/secrets/claude-credentials-json.ts +0 -129
  206. package/src/secrets/codex-auth-json.ts +0 -102
  207. package/src/secrets/export-claude-credentials-file.ts +0 -270
  208. package/src/secrets/export-codex-auth-file.ts +0 -250
  209. package/src/secrets/oauth-xai.ts +0 -348
  210. package/src/skills/typeclaw-claude-code/references/stop-hook.md +0 -101
  211. package/src/skills/typeclaw-claude-code/references/tmux-driving.md +0 -243
  212. package/src/skills/typeclaw-codex-cli/references/stop-hook.md +0 -92
  213. package/src/skills/typeclaw-codex-cli/references/tmux-driving.md +0 -239
@@ -1,13 +1,26 @@
1
1
  ---
2
2
  name: typeclaw-troubleshooting
3
- description: Use this skill when you are stuck in a fix-it loop — you've made roughly three attempts at the same failure and you're still cycling shell commands (kill the process, re-run, `sleep`, `capture-pane`, inspect, retry) without converging. Triggers include a hung or runaway process that won't die, a `C-c` that didn't stop the program, `<defunct>`/zombie processes piling up in `ps`, an interactive program that blocks `bash` waiting for input, a script that "ran" but produced no output and no file, repeated "not found"/timeout/same-error-again loops, and any moment you catch yourself thinking "let me wait a bit more and check again" for the third time. Read it before you spawn `operator` to take over the debugging — it covers the operator hand-off prompt, the tmux session pattern, killing stuck/zombie processes properly, and the edge-triggered capture-pane polling loop that the inline retry-and-sleep approach gets wrong.
3
+ description: Use this skill when you are stuck in a fix-it loop — you've made roughly three attempts at the same failure and you're still cycling shell commands (kill the process, re-run, `sleep`, `capture-pane`, inspect, retry) without converging. Triggers include a hung or runaway process that won't die, a `C-c` that didn't stop the program, `<defunct>`/zombie processes piling up in `ps`, an interactive program that blocks `bash` waiting for input, a script that "ran" but produced no output and no file, repeated "not found"/timeout/same-error-again loops, and any moment you catch yourself thinking "let me wait a bit more and check again" for the third time. Also read it before you start a minutes-long or input-waiting program in your own session (dev server, REPL, watcher, `docker compose up`, interactive installer) — foreground `bash` blocks until exit, and this skill has the detached tmux start/observe/drive/stop pattern. Read it before you spawn `operator` to take over the debugging — it covers the operator hand-off prompt, the tmux session pattern, killing stuck/zombie processes properly, and the edge-triggered capture-pane polling loop that the inline retry-and-sleep approach gets wrong.
4
4
  ---
5
5
 
6
6
  # typeclaw-troubleshooting
7
7
 
8
8
  When a problem fights back, the failure mode is not "I can't fix it" — it's "I'm burning my own context and freezing the conversation while I fix it." A debugging loop is inherently noisy: every retry dumps stale shell output, zombie-process listings, and pane captures into your context, and each blocking `bash` call (especially `sleep N` followed by a capture) leaves the user staring at a frozen-looking conversation. The fix is to move the loop out of your session and into `operator`, which has bash-with-side-effects and runs in its own context window.
9
9
 
10
- This skill is the runbook for that hand-off. Read it once you've hit the trigger (~3 attempts on the same failure without convergence), **before** you spawn `operator`.
10
+ This skill is the runbook for that hand-off. Read it once you've hit the trigger (~3 attempts on the same failure without convergence), **before** you spawn `operator`. It also owns the plain long-running-command pattern below, which applies before any loop starts.
11
+
12
+ ## Long-running and interactive commands
13
+
14
+ Foreground `bash` blocks until the command exits. Run minutes-long or input-waiting programs (dev servers, REPLs, watchers, `docker compose up`, installers) detached in `tmux`:
15
+
16
+ ```sh
17
+ tmux new-session -d -s <name> "<cmd>" # start
18
+ tmux capture-pane -t <name> -p # observe
19
+ tmux send-keys -t <name> "<input>" Enter # drive
20
+ tmux kill-session -t <name> # stop
21
+ ```
22
+
23
+ Use tmux only for work that belongs in your session. In an interactive session that can spawn subagents, delegate self-contained long work (builds, tests, installs, batches) to `operator` instead, so the conversation stays responsive. If the command starts failing in a loop, the rest of this skill applies.
11
24
 
12
25
  ## The trigger, concretely
13
26
 
package/src/tui/index.ts CHANGED
@@ -7,8 +7,8 @@ import {
7
7
  ProcessTerminal,
8
8
  type Terminal,
9
9
  Text,
10
- TUI,
11
- } from '@mariozechner/pi-tui'
10
+ TuiMainScreen,
11
+ } from '@earendil-works/pi-tui'
12
12
 
13
13
  import { parseCommand } from '@/commands'
14
14
 
@@ -97,7 +97,9 @@ export function createTui({
97
97
  }: TuiOptions) {
98
98
  async function run(): Promise<TuiRunResult> {
99
99
  const terminal = createTerminal()
100
- const tui = new TUI(terminal)
100
+ // pi-tui 0.87 exports TUI only as an interface; TuiMainScreen is the
101
+ // concrete scrollback renderer (dist/tui.d.ts:213-244, tui-main-screen.d.ts:11-12).
102
+ const tui = new TuiMainScreen(terminal)
101
103
  const displayUrl = redactUrl(url)
102
104
 
103
105
  const status = new Text(colors.dim(`connecting to ${displayUrl}...`), 0, 0)
package/src/tui/theme.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { EditorTheme, MarkdownTheme } from '@mariozechner/pi-tui'
1
+ import type { EditorTheme, MarkdownTheme } from '@earendil-works/pi-tui'
2
2
 
3
3
  const wrap = (code: string) => (text: string) => `\x1b[${code}m${text}\x1b[0m`
4
4
  const wrapRgb = (r: number, g: number, b: number) => (text: string) => `\x1b[38;2;${r};${g};${b}m${text}\x1b[0m`
@@ -28,14 +28,19 @@
28
28
  "openai/gpt-5.4-mini",
29
29
  "openai/gpt-5.4",
30
30
  "openai/gpt-5.5",
31
+ "openai/gpt-6-sol",
32
+ "openai/gpt-6-luna",
31
33
  "openai-codex/gpt-5.4-mini",
32
34
  "openai-codex/gpt-5.4",
33
35
  "openai-codex/gpt-5.5",
36
+ "openai-codex/gpt-6-sol",
37
+ "openai-codex/gpt-6-luna",
34
38
  "anthropic/claude-haiku-4-5",
35
39
  "anthropic/claude-sonnet-4-6",
36
40
  "anthropic/claude-sonnet-5",
37
41
  "anthropic/claude-opus-4-7",
38
42
  "anthropic/claude-opus-4-8",
43
+ "anthropic/claude-opus-5-5",
39
44
  "anthropic/claude-fable-5",
40
45
  "fireworks/accounts/fireworks/routers/kimi-k2p6-turbo",
41
46
  "zai/glm-4.5-air",
@@ -47,6 +52,7 @@
47
52
  "zai-coding/glm-5-turbo",
48
53
  "zai-coding/glm-5.1",
49
54
  "xai/grok-4.3",
55
+ "xai/grok-4.7",
50
56
  "xai/grok-4.20-0309-reasoning",
51
57
  "xai/grok-4.20-0309-non-reasoning",
52
58
  "xai/grok-build-0.1",
@@ -86,14 +92,19 @@
86
92
  "openai/gpt-5.4-mini",
87
93
  "openai/gpt-5.4",
88
94
  "openai/gpt-5.5",
95
+ "openai/gpt-6-sol",
96
+ "openai/gpt-6-luna",
89
97
  "openai-codex/gpt-5.4-mini",
90
98
  "openai-codex/gpt-5.4",
91
99
  "openai-codex/gpt-5.5",
100
+ "openai-codex/gpt-6-sol",
101
+ "openai-codex/gpt-6-luna",
92
102
  "anthropic/claude-haiku-4-5",
93
103
  "anthropic/claude-sonnet-4-6",
94
104
  "anthropic/claude-sonnet-5",
95
105
  "anthropic/claude-opus-4-7",
96
106
  "anthropic/claude-opus-4-8",
107
+ "anthropic/claude-opus-5-5",
97
108
  "anthropic/claude-fable-5",
98
109
  "fireworks/accounts/fireworks/routers/kimi-k2p6-turbo",
99
110
  "zai/glm-4.5-air",
@@ -105,6 +116,7 @@
105
116
  "zai-coding/glm-5-turbo",
106
117
  "zai-coding/glm-5.1",
107
118
  "xai/grok-4.3",
119
+ "xai/grok-4.7",
108
120
  "xai/grok-4.20-0309-reasoning",
109
121
  "xai/grok-4.20-0309-non-reasoning",
110
122
  "xai/grok-build-0.1",
@@ -145,14 +157,19 @@
145
157
  "openai/gpt-5.4-mini",
146
158
  "openai/gpt-5.4",
147
159
  "openai/gpt-5.5",
160
+ "openai/gpt-6-sol",
161
+ "openai/gpt-6-luna",
148
162
  "openai-codex/gpt-5.4-mini",
149
163
  "openai-codex/gpt-5.4",
150
164
  "openai-codex/gpt-5.5",
165
+ "openai-codex/gpt-6-sol",
166
+ "openai-codex/gpt-6-luna",
151
167
  "anthropic/claude-haiku-4-5",
152
168
  "anthropic/claude-sonnet-4-6",
153
169
  "anthropic/claude-sonnet-5",
154
170
  "anthropic/claude-opus-4-7",
155
171
  "anthropic/claude-opus-4-8",
172
+ "anthropic/claude-opus-5-5",
156
173
  "anthropic/claude-fable-5",
157
174
  "fireworks/accounts/fireworks/routers/kimi-k2p6-turbo",
158
175
  "zai/glm-4.5-air",
@@ -164,6 +181,7 @@
164
181
  "zai-coding/glm-5-turbo",
165
182
  "zai-coding/glm-5.1",
166
183
  "xai/grok-4.3",
184
+ "xai/grok-4.7",
167
185
  "xai/grok-4.20-0309-reasoning",
168
186
  "xai/grok-4.20-0309-non-reasoning",
169
187
  "xai/grok-build-0.1",
@@ -202,14 +220,19 @@
202
220
  "openai/gpt-5.4-mini",
203
221
  "openai/gpt-5.4",
204
222
  "openai/gpt-5.5",
223
+ "openai/gpt-6-sol",
224
+ "openai/gpt-6-luna",
205
225
  "openai-codex/gpt-5.4-mini",
206
226
  "openai-codex/gpt-5.4",
207
227
  "openai-codex/gpt-5.5",
228
+ "openai-codex/gpt-6-sol",
229
+ "openai-codex/gpt-6-luna",
208
230
  "anthropic/claude-haiku-4-5",
209
231
  "anthropic/claude-sonnet-4-6",
210
232
  "anthropic/claude-sonnet-5",
211
233
  "anthropic/claude-opus-4-7",
212
234
  "anthropic/claude-opus-4-8",
235
+ "anthropic/claude-opus-5-5",
213
236
  "anthropic/claude-fable-5",
214
237
  "fireworks/accounts/fireworks/routers/kimi-k2p6-turbo",
215
238
  "zai/glm-4.5-air",
@@ -221,6 +244,7 @@
221
244
  "zai-coding/glm-5-turbo",
222
245
  "zai-coding/glm-5.1",
223
246
  "xai/grok-4.3",
247
+ "xai/grok-4.7",
224
248
  "xai/grok-4.20-0309-reasoning",
225
249
  "xai/grok-4.20-0309-non-reasoning",
226
250
  "xai/grok-build-0.1",
@@ -260,14 +284,19 @@
260
284
  "openai/gpt-5.4-mini",
261
285
  "openai/gpt-5.4",
262
286
  "openai/gpt-5.5",
287
+ "openai/gpt-6-sol",
288
+ "openai/gpt-6-luna",
263
289
  "openai-codex/gpt-5.4-mini",
264
290
  "openai-codex/gpt-5.4",
265
291
  "openai-codex/gpt-5.5",
292
+ "openai-codex/gpt-6-sol",
293
+ "openai-codex/gpt-6-luna",
266
294
  "anthropic/claude-haiku-4-5",
267
295
  "anthropic/claude-sonnet-4-6",
268
296
  "anthropic/claude-sonnet-5",
269
297
  "anthropic/claude-opus-4-7",
270
298
  "anthropic/claude-opus-4-8",
299
+ "anthropic/claude-opus-5-5",
271
300
  "anthropic/claude-fable-5",
272
301
  "fireworks/accounts/fireworks/routers/kimi-k2p6-turbo",
273
302
  "zai/glm-4.5-air",
@@ -279,6 +308,7 @@
279
308
  "zai-coding/glm-5-turbo",
280
309
  "zai-coding/glm-5.1",
281
310
  "xai/grok-4.3",
311
+ "xai/grok-4.7",
282
312
  "xai/grok-4.20-0309-reasoning",
283
313
  "xai/grok-4.20-0309-non-reasoning",
284
314
  "xai/grok-build-0.1",
@@ -317,7 +347,8 @@
317
347
  "low",
318
348
  "medium",
319
349
  "high",
320
- "xhigh"
350
+ "xhigh",
351
+ "max"
321
352
  ]
322
353
  }
323
354
  },
@@ -1043,7 +1074,8 @@
1043
1074
  "review": {
1044
1075
  "default": {
1045
1076
  "on": "review_requested",
1046
- "approve": true
1077
+ "approve": true,
1078
+ "check": true
1047
1079
  },
1048
1080
  "type": "object",
1049
1081
  "properties": {
@@ -1059,6 +1091,10 @@
1059
1091
  "approve": {
1060
1092
  "default": true,
1061
1093
  "type": "boolean"
1094
+ },
1095
+ "check": {
1096
+ "default": true,
1097
+ "type": "boolean"
1062
1098
  }
1063
1099
  }
1064
1100
  }
@@ -2627,6 +2663,7 @@
2627
2663
  "xvfb": true,
2628
2664
  "claudeCode": false,
2629
2665
  "codexCli": false,
2666
+ "omoCli": false,
2630
2667
  "append": []
2631
2668
  }
2632
2669
  },
@@ -2643,6 +2680,7 @@
2643
2680
  "xvfb": true,
2644
2681
  "claudeCode": false,
2645
2682
  "codexCli": false,
2683
+ "omoCli": false,
2646
2684
  "append": []
2647
2685
  },
2648
2686
  "type": "object",
@@ -2715,6 +2753,10 @@
2715
2753
  "default": false,
2716
2754
  "type": "boolean"
2717
2755
  },
2756
+ "omoCli": {
2757
+ "default": false,
2758
+ "type": "boolean"
2759
+ },
2718
2760
  "append": {
2719
2761
  "default": [],
2720
2762
  "type": "array",
@@ -1,79 +0,0 @@
1
- // Compatibility shim for adaptive-thinking-only Anthropic models on the
2
- // pinned pi stack (@mariozechner/* 0.73.x).
3
- //
4
- // The problem: Sonnet 5 and Fable 5 accept ONLY adaptive thinking. Manual
5
- // extended thinking (`thinking: {type: "enabled"}` with `budget_tokens`)
6
- // returns a 400. But pi-ai's `supportsAdaptiveThinking()` matches only
7
- // 4.6-generation ids (`opus-4-6`, `sonnet-4-6`), so for any OTHER Anthropic
8
- // model registered with `reasoning: true` it falls back to the budget-based
9
- // path — and thinking is on by default (pi-coding-agent's
10
- // DEFAULT_THINKING_LEVEL is "medium", and `defaultThinkingLevelForRef`
11
- // deliberately defers to it). Net effect without this shim: a session on
12
- // Sonnet 5 / Fable 5 400s on its first request. Still true on 0.73.1: pi-ai
13
- // 0.73.1 does not force adaptive thinking for these ids, so bumping the
14
- // @mariozechner/* stack to 0.73 (PR #1123) did not obviate this shim.
15
- //
16
- // The fix: pi-ai calls `options.onPayload(params, model)` right before the
17
- // HTTP request and adopts a non-undefined return value as the request params
18
- // (see `streamAnthropic` in pi-ai's providers/anthropic.ts). We hook that seam
19
- // via `Agent.onPayload` — a public field, same seam `src/agent/index.ts`
20
- // already uses for `convertToLlm` (the replay sanitizer) — and rewrite
21
- // `thinking: {type: "enabled", ...}` to `thinking: {type: "adaptive"}` for
22
- // exactly the adaptive-only model ids. Everything else passes through
23
- // byte-identical.
24
- //
25
- // Not covered (deliberately): pi-ai also sends the
26
- // `interleaved-thinking-2025-05-14` beta header for non-4.6 models. That
27
- // header is set at SDK-client construction, before `onPayload` runs, so this
28
- // shim can't remove it — it is redundant-but-harmless on adaptive models (the
29
- // API ignores it), unlike the budget `thinking` payload which hard-fails.
30
- //
31
- // TODO(pi-migration): DELETE THIS FILE when typeclaw migrates off the
32
- // @mariozechner/pi-* 0.73.x line to @earendil-works/pi-* >= 0.80 (the same
33
- // maintainers' scope rename; @mariozechner ends at 0.73.1, @earendil-works
34
- // starts at 0.74.0). As of @earendil-works/pi-ai 0.80.3 the sonnet-5 / fable-5
35
- // model records carry `compat: { forceAdaptiveThinking: true }`, and the
36
- // Anthropic transport reads that flag to emit `thinking: {type: "adaptive"}`
37
- // itself (AnthropicMessagesCompat.forceAdaptiveThinking) — so on that stack the
38
- // rewrite here becomes redundant and both this file and its `onPayload` wiring
39
- // in `src/agent/index.ts` should be removed.
40
-
41
- import type { Api, Model } from '@mariozechner/pi-ai'
42
-
43
- type OnPayload = (payload: unknown, model: Model<Api>) => unknown | undefined | Promise<unknown | undefined>
44
-
45
- type OnPayloadHost = { onPayload?: OnPayload }
46
-
47
- // Mirrors pi-ai's own id matching style (`String.includes`, date-suffix
48
- // tolerant). Scoped to the Anthropic Messages API so a same-named id on a
49
- // different transport (e.g. a Bedrock alias) is never touched.
50
- export function isAdaptiveOnlyAnthropicModel(model: Pick<Model<Api>, 'api' | 'id'>): boolean {
51
- if (model.api !== 'anthropic-messages') return false
52
- return model.id.includes('sonnet-5') || model.id.includes('fable-5')
53
- }
54
-
55
- // Pure rewrite: budget-based `thinking` -> `{type: "adaptive"}` for
56
- // adaptive-only models. Returns the ORIGINAL payload object (not a clone)
57
- // whenever no rewrite applies, so "untouched" is reference-checkable in tests.
58
- export function rewriteThinkingForAdaptiveOnlyModels(payload: unknown, model: Pick<Model<Api>, 'api' | 'id'>): unknown {
59
- if (!isAdaptiveOnlyAnthropicModel(model)) return payload
60
- if (payload === null || typeof payload !== 'object') return payload
61
- if (!('thinking' in payload)) return payload
62
- const thinking = payload.thinking
63
- if (thinking === null || typeof thinking !== 'object') return payload
64
- if (!('type' in thinking) || thinking.type !== 'enabled') return payload
65
- return { ...payload, thinking: { type: 'adaptive' } }
66
- }
67
-
68
- // Layers the rewrite over an agent's existing `onPayload` (pi-coding-agent
69
- // installs one that dispatches extension `before_provider_request` handlers).
70
- // Honors pi's contract that an `undefined` return means "keep the original
71
- // payload": the inner hook's undefined falls back to the incoming payload
72
- // before the rewrite runs, so the rewrite always sees the effective params.
73
- export function applyAdaptiveThinkingCompat(agent: OnPayloadHost): void {
74
- const inner = agent.onPayload
75
- agent.onPayload = async (payload, model) => {
76
- const effective = inner === undefined ? payload : ((await inner(payload, model)) ?? payload)
77
- return rewriteThinkingForAdaptiveOnlyModels(effective, model)
78
- }
79
- }
@@ -1,129 +0,0 @@
1
- import type { ProviderCredential } from './schema'
2
-
3
- // Emit the on-disk shape Claude Code consumes at ~/.claude/.credentials.json
4
- // (Linux/Windows; macOS keeps this same JSON inside the Keychain entry
5
- // "Claude Code-credentials"). The single required top-level key is
6
- // `claudeAiOauth`. Field names use camelCase, not snake_case — diverging
7
- // from Codex CLI's `tokens.access_token` shape but matching every
8
- // third-party Claude Code integration we surveyed (ATLAS_OS, OmniRoute,
9
- // jcode, paperclip, opencode-claude-auth).
10
- //
11
- // `expiresAt` is MILLISECONDS since epoch, not seconds and not ISO. The
12
- // CLI carries no top-level expiry field outside `claudeAiOauth` — token
13
- // expiry is recorded both as `expiresAt` here and embedded in the JWT
14
- // `exp` claim of `accessToken`. The runtime exporter (export-claude-
15
- // credentials-file.ts) uses the JWT exp for its newer-wins compare,
16
- // mirroring the Codex CLI exporter's approach, because `expiresAt` is
17
- // the field Claude Code itself rewrites on in-place refresh.
18
- //
19
- // `mcpOAuth` (MCP server OAuth state) may coexist alongside
20
- // `claudeAiOauth` in the same file. This emitter accepts an optional
21
- // `preserveMcpOAuth` block so callers that read-merge-write the file
22
- // don't drop unrelated state. Codex CLI's file is fully owned by the
23
- // OAuth credential and has no equivalent; this is the one extra
24
- // complication versus emitCodexAuthJson.
25
- export type ClaudeAiOauthBlock = {
26
- accessToken: string
27
- refreshToken: string
28
- expiresAt: number
29
- scopes?: string[]
30
- subscriptionType?: string
31
- }
32
-
33
- export type EmitClaudeCredentialsJsonOptions = {
34
- preserveMcpOAuth?: unknown
35
- }
36
-
37
- export function emitClaudeCredentialsJson(
38
- credential: ProviderCredential,
39
- options: EmitClaudeCredentialsJsonOptions = {},
40
- ): string {
41
- if (credential.type !== 'oauth') {
42
- throw new Error('emitClaudeCredentialsJson only accepts oauth-typed credentials')
43
- }
44
- const fields = credential as ProviderCredential & {
45
- access?: unknown
46
- refresh?: unknown
47
- expires?: unknown
48
- scopes?: unknown
49
- subscriptionType?: unknown
50
- }
51
- const access = fields.access
52
- const refresh = fields.refresh
53
- if (typeof access !== 'string' || access.length === 0) {
54
- throw new Error('credential is missing a non-empty `access` field')
55
- }
56
- if (typeof refresh !== 'string' || refresh.length === 0) {
57
- throw new Error('credential is missing a non-empty `refresh` field')
58
- }
59
-
60
- // Resolution order for `expiresAt`:
61
- // 1. `expires` on the credential (pi-ai writes absolute ms epoch here).
62
- // 2. JWT `exp` claim decoded from `access`.
63
- // 3. 0 — Claude Code treats a missing/zero expiry as "expired" and
64
- // triggers an immediate refresh on next use, which is the safe
65
- // fallback when neither source is available.
66
- const expiresAt = readExpiryMs(fields, access)
67
-
68
- const claudeAiOauth: ClaudeAiOauthBlock = {
69
- accessToken: access,
70
- refreshToken: refresh,
71
- expiresAt,
72
- }
73
- if (Array.isArray(fields.scopes) && fields.scopes.every((s): s is string => typeof s === 'string')) {
74
- claudeAiOauth.scopes = fields.scopes
75
- }
76
- if (typeof fields.subscriptionType === 'string' && fields.subscriptionType.length > 0) {
77
- claudeAiOauth.subscriptionType = fields.subscriptionType
78
- }
79
-
80
- // Read-merge-write: preserve any existing `mcpOAuth` block the caller
81
- // supplied. The emitter doesn't read disk itself (that's the exporter's
82
- // job); the caller passes whatever it found at the existing file path.
83
- const out: Record<string, unknown> = { claudeAiOauth }
84
- if (options.preserveMcpOAuth !== undefined) {
85
- out['mcpOAuth'] = options.preserveMcpOAuth
86
- }
87
- return `${JSON.stringify(out, null, 2)}\n`
88
- }
89
-
90
- // Extracts the JWT `exp` claim (seconds since epoch) and converts to ms.
91
- // Used by the runtime exporter's newer-wins compare and by emit's
92
- // `expiresAt` fallback. Returns null on any decode failure; the caller
93
- // treats that as "unknown freshness". Logic mirrors
94
- // decodeCodexAccessTokenExpiryMs verbatim — Claude Code OAuth access
95
- // tokens are standard JWTs with the same base64url-encoded payload
96
- // shape Codex uses.
97
- export function decodeClaudeAccessTokenExpiryMs(accessToken: string): number | null {
98
- const parts = accessToken.split('.')
99
- if (parts.length !== 3) return null
100
- const middle = parts[1] ?? ''
101
- if (middle === '') return null
102
- const normalized = middle.replace(/-/g, '+').replace(/_/g, '/')
103
- const padded = normalized + '='.repeat((4 - (normalized.length % 4)) % 4)
104
- let payload: Record<string, unknown>
105
- try {
106
- const decoded = typeof atob === 'function' ? atob(padded) : Buffer.from(padded, 'base64').toString('utf8')
107
- const parsed: unknown = JSON.parse(decoded)
108
- if (!isPlainObject(parsed)) return null
109
- payload = parsed
110
- } catch {
111
- return null
112
- }
113
- const exp = payload['exp']
114
- if (typeof exp !== 'number' || !Number.isFinite(exp)) return null
115
- return Math.floor(exp * 1000)
116
- }
117
-
118
- function readExpiryMs(fields: { expires?: unknown }, accessToken: string): number {
119
- if (typeof fields.expires === 'number' && Number.isFinite(fields.expires)) {
120
- return fields.expires
121
- }
122
- const fromJwt = decodeClaudeAccessTokenExpiryMs(accessToken)
123
- if (fromJwt !== null) return fromJwt
124
- return 0
125
- }
126
-
127
- function isPlainObject(value: unknown): value is Record<string, unknown> {
128
- return typeof value === 'object' && value !== null && !Array.isArray(value)
129
- }
@@ -1,102 +0,0 @@
1
- import type { ProviderCredential } from './schema'
2
-
3
- // Emit the on-disk shape Codex CLI consumes at ~/.codex/auth.json: a `tokens`
4
- // object with id_token, access_token, refresh_token, and optional account_id.
5
- // No top-level `expires` — codex re-derives expiry from the JWT `exp` claim.
6
- //
7
- // id_token is load-bearing: codex's deserializer (token_data.rs) declares
8
- // `id_token: IdTokenInfo` with no Option/#[serde(default)], so omitting it
9
- // fails the whole auth.json load with `missing field id_token` before any
10
- // model call. codex parses it via `parse_chatgpt_jwt_claims`, which accepts
11
- // any decodable 3-part JWT and treats every claim as optional.
12
- //
13
- // We prefer a real captured id_token (`idToken`/`id_token` on the credential,
14
- // e.g. from a future pi-ai that persists it) and fall back to `access`. The
15
- // fallback is sound because this flow's access token is itself a ChatGPT-claims
16
- // JWT (carries `https://api.openai.com/auth`), so codex reads the same
17
- // plan/account fields from it — self-healing agents whose stored credential
18
- // predates id_token capture, without a re-login.
19
- export function emitCodexAuthJson(credential: ProviderCredential): string {
20
- if (credential.type !== 'oauth') {
21
- throw new Error('emitCodexAuthJson only accepts oauth-typed credentials')
22
- }
23
- const fields = credential as ProviderCredential & {
24
- access?: unknown
25
- refresh?: unknown
26
- accountId?: unknown
27
- idToken?: unknown
28
- id_token?: unknown
29
- }
30
- const access = fields.access
31
- const refresh = fields.refresh
32
- if (typeof access !== 'string' || access.length === 0) {
33
- throw new Error('credential is missing a non-empty `access` field')
34
- }
35
- if (typeof refresh !== 'string' || refresh.length === 0) {
36
- throw new Error('credential is missing a non-empty `refresh` field')
37
- }
38
-
39
- const capturedIdToken = firstNonEmptyString(fields.idToken, fields.id_token)
40
- const idToken = capturedIdToken ?? access
41
-
42
- const tokens: Record<string, string> = {
43
- id_token: idToken,
44
- access_token: access,
45
- refresh_token: refresh,
46
- }
47
- if (typeof fields.accountId === 'string' && fields.accountId.length > 0) {
48
- tokens['account_id'] = fields.accountId
49
- }
50
- return `${JSON.stringify({ tokens }, null, 2)}\n`
51
- }
52
-
53
- function firstNonEmptyString(...values: unknown[]): string | null {
54
- for (const value of values) {
55
- if (typeof value === 'string' && value.length > 0) return value
56
- }
57
- return null
58
- }
59
-
60
- // Extracts the JWT `exp` claim (seconds since epoch) and converts to ms.
61
- // Used by the runtime exporter's newer-wins compare: ~/.codex/auth.json
62
- // carries no top-level expiry, but the JWT inside `tokens.access_token`
63
- // does. Returns null on any decode failure; the caller treats that as
64
- // "unknown freshness" and falls back to overwriting from typeclaw's copy.
65
- export function decodeCodexAccessTokenExpiryMs(accessToken: string): number | null {
66
- const payload = decodeJwtPayload(accessToken)
67
- if (payload === null) return null
68
- const exp = payload['exp']
69
- if (typeof exp !== 'number' || !Number.isFinite(exp)) return null
70
- return Math.floor(exp * 1000)
71
- }
72
-
73
- // True when the string decodes the way codex's `decode_jwt_payload` requires:
74
- // three non-empty dot-separated parts with a base64url payload that is a JSON
75
- // object. codex runs exactly this on `tokens.id_token` (via
76
- // `parse_chatgpt_jwt_claims`) and rejects the whole auth.json if it fails, so
77
- // the exporter uses this to decide whether an on-disk id_token is usable —
78
- // not just non-empty.
79
- export function isDecodableJwt(token: string): boolean {
80
- return decodeJwtPayload(token) !== null
81
- }
82
-
83
- function decodeJwtPayload(jwt: string): Record<string, unknown> | null {
84
- const parts = jwt.split('.')
85
- if (parts.length !== 3) return null
86
- const middle = parts[1] ?? ''
87
- if (middle === '') return null
88
- // base64url → base64, then pad to a multiple of 4 (atob is strict).
89
- const normalized = middle.replace(/-/g, '+').replace(/_/g, '/')
90
- const padded = normalized + '='.repeat((4 - (normalized.length % 4)) % 4)
91
- try {
92
- const decoded = typeof atob === 'function' ? atob(padded) : Buffer.from(padded, 'base64').toString('utf8')
93
- const parsed: unknown = JSON.parse(decoded)
94
- return isPlainObject(parsed) ? parsed : null
95
- } catch {
96
- return null
97
- }
98
- }
99
-
100
- function isPlainObject(value: unknown): value is Record<string, unknown> {
101
- return typeof value === 'object' && value !== null && !Array.isArray(value)
102
- }