@songsid/agend 2.3.4-beta.1 → 2.3.4-beta.11

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 (303) hide show
  1. package/THIRD_PARTY_NOTICES.md +37 -0
  2. package/dist/agend-home.d.ts +13 -0
  3. package/dist/agend-home.js +42 -0
  4. package/dist/agend-home.js.map +1 -1
  5. package/dist/agent-cli-instructions.md +1 -1
  6. package/dist/agent-credentials.d.ts +24 -0
  7. package/dist/agent-credentials.js +66 -0
  8. package/dist/agent-credentials.js.map +1 -0
  9. package/dist/agent-endpoint.d.ts +3 -1
  10. package/dist/agent-endpoint.js +13 -0
  11. package/dist/agent-endpoint.js.map +1 -1
  12. package/dist/auth-api.js +10 -2
  13. package/dist/auth-api.js.map +1 -1
  14. package/dist/authority/session-authorizations.d.ts +28 -4
  15. package/dist/authority/session-authorizations.js +63 -17
  16. package/dist/authority/session-authorizations.js.map +1 -1
  17. package/dist/backend/antigravity.js +3 -1
  18. package/dist/backend/antigravity.js.map +1 -1
  19. package/dist/backend/claude-code.d.ts +3 -0
  20. package/dist/backend/claude-code.js +89 -4
  21. package/dist/backend/claude-code.js.map +1 -1
  22. package/dist/backend/codex-footer-hints.d.ts +4 -0
  23. package/dist/backend/codex-footer-hints.js +27 -0
  24. package/dist/backend/codex-footer-hints.js.map +1 -0
  25. package/dist/backend/codex-metadata.d.ts +14 -0
  26. package/dist/backend/codex-metadata.js +45 -0
  27. package/dist/backend/codex-metadata.js.map +1 -1
  28. package/dist/backend/codex-session-lookup.d.ts +35 -0
  29. package/dist/backend/codex-session-lookup.js +93 -0
  30. package/dist/backend/codex-session-lookup.js.map +1 -1
  31. package/dist/backend/codex-speed.d.ts +14 -0
  32. package/dist/backend/codex-speed.js +35 -0
  33. package/dist/backend/codex-speed.js.map +1 -0
  34. package/dist/backend/codex.d.ts +27 -0
  35. package/dist/backend/codex.js +133 -25
  36. package/dist/backend/codex.js.map +1 -1
  37. package/dist/backend/kiro-identity.d.ts +2 -0
  38. package/dist/backend/kiro-identity.js +13 -6
  39. package/dist/backend/kiro-identity.js.map +1 -1
  40. package/dist/backend/kiro.d.ts +3 -0
  41. package/dist/backend/kiro.js +68 -5
  42. package/dist/backend/kiro.js.map +1 -1
  43. package/dist/backend/muse.js +5 -3
  44. package/dist/backend/muse.js.map +1 -1
  45. package/dist/backend/types.d.ts +6 -1
  46. package/dist/backend/types.js +3 -0
  47. package/dist/backend/types.js.map +1 -1
  48. package/dist/backend-availability.d.ts +6 -0
  49. package/dist/backend-availability.js +13 -5
  50. package/dist/backend-availability.js.map +1 -1
  51. package/dist/cache-ledger.d.ts +95 -0
  52. package/dist/cache-ledger.js +276 -4
  53. package/dist/cache-ledger.js.map +1 -1
  54. package/dist/cache-service.d.ts +5 -0
  55. package/dist/cache-service.js +16 -4
  56. package/dist/cache-service.js.map +1 -1
  57. package/dist/channel/adapters/discord.js +27 -4
  58. package/dist/channel/adapters/discord.js.map +1 -1
  59. package/dist/channel/adapters/telegram.d.ts +51 -0
  60. package/dist/channel/adapters/telegram.js +238 -18
  61. package/dist/channel/adapters/telegram.js.map +1 -1
  62. package/dist/channel/inbox-temp-name.d.ts +9 -0
  63. package/dist/channel/inbox-temp-name.js +13 -0
  64. package/dist/channel/inbox-temp-name.js.map +1 -0
  65. package/dist/channel/mcp-tools.js +3 -3
  66. package/dist/channel/mcp-tools.js.map +1 -1
  67. package/dist/channel/types.d.ts +2 -0
  68. package/dist/chat-log-ids.d.ts +48 -0
  69. package/dist/chat-log-ids.js +182 -0
  70. package/dist/chat-log-ids.js.map +1 -0
  71. package/dist/classic-channel-manager.d.ts +8 -1
  72. package/dist/classic-channel-manager.js +24 -2
  73. package/dist/classic-channel-manager.js.map +1 -1
  74. package/dist/cli.js +4 -6
  75. package/dist/cli.js.map +1 -1
  76. package/dist/config-validator.js +5 -0
  77. package/dist/config-validator.js.map +1 -1
  78. package/dist/cross-instance-notice.d.ts +10 -0
  79. package/dist/cross-instance-notice.js +67 -5
  80. package/dist/cross-instance-notice.js.map +1 -1
  81. package/dist/daemon.d.ts +52 -0
  82. package/dist/daemon.js +530 -34
  83. package/dist/daemon.js.map +1 -1
  84. package/dist/delivery-consumed-watch.d.ts +23 -1
  85. package/dist/delivery-consumed-watch.js +30 -3
  86. package/dist/delivery-consumed-watch.js.map +1 -1
  87. package/dist/delivery-reconciliation.d.ts +7 -0
  88. package/dist/delivery-reconciliation.js +9 -1
  89. package/dist/delivery-reconciliation.js.map +1 -1
  90. package/dist/dialog-screen-text.d.ts +16 -0
  91. package/dist/dialog-screen-text.js +51 -0
  92. package/dist/dialog-screen-text.js.map +1 -0
  93. package/dist/export-import.d.ts +7 -0
  94. package/dist/export-import.js +44 -10
  95. package/dist/export-import.js.map +1 -1
  96. package/dist/fleet-context.d.ts +2 -0
  97. package/dist/fleet-manager.d.ts +147 -11
  98. package/dist/fleet-manager.js +747 -118
  99. package/dist/fleet-manager.js.map +1 -1
  100. package/dist/fleet-yaml-patch.d.ts +3 -0
  101. package/dist/fleet-yaml-patch.js +103 -0
  102. package/dist/fleet-yaml-patch.js.map +1 -0
  103. package/dist/general-knowledge/skills/concepts/SKILL.md +393 -0
  104. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +1 -0
  105. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +3 -1
  106. package/dist/general-knowledge/skills/kiro-engine-migration/SKILL.md +41 -4
  107. package/dist/general-knowledge/skills/model-discovery/SKILL.md +2 -0
  108. package/dist/general-knowledge/skills/web-appearance/SKILL.md +1 -1
  109. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +10 -4
  110. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +1 -1
  111. package/dist/install-stream.d.ts +53 -0
  112. package/dist/install-stream.js +134 -0
  113. package/dist/install-stream.js.map +1 -0
  114. package/dist/instance-config-impact.js +2 -0
  115. package/dist/instance-config-impact.js.map +1 -1
  116. package/dist/instance-lifecycle.d.ts +20 -2
  117. package/dist/instance-lifecycle.js +80 -12
  118. package/dist/instance-lifecycle.js.map +1 -1
  119. package/dist/instance-topic-delete.d.ts +77 -0
  120. package/dist/instance-topic-delete.js +123 -0
  121. package/dist/instance-topic-delete.js.map +1 -0
  122. package/dist/instructions.d.ts +1 -1
  123. package/dist/instructions.js +1 -1
  124. package/dist/instructions.js.map +1 -1
  125. package/dist/kiro-engine-status.d.ts +11 -0
  126. package/dist/kiro-engine-status.js +6 -0
  127. package/dist/kiro-engine-status.js.map +1 -1
  128. package/dist/kiro-resume-summary.d.ts +37 -0
  129. package/dist/kiro-resume-summary.js +85 -0
  130. package/dist/kiro-resume-summary.js.map +1 -0
  131. package/dist/locale.js +90 -6
  132. package/dist/locale.js.map +1 -1
  133. package/dist/log-service.d.ts +30 -0
  134. package/dist/log-service.js +36 -3
  135. package/dist/log-service.js.map +1 -1
  136. package/dist/log-steps.d.ts +4 -3
  137. package/dist/log-steps.js +32 -7
  138. package/dist/log-steps.js.map +1 -1
  139. package/dist/logger.d.ts +12 -0
  140. package/dist/logger.js +43 -1
  141. package/dist/logger.js.map +1 -1
  142. package/dist/login-controller.js +9 -1
  143. package/dist/login-controller.js.map +1 -1
  144. package/dist/login-flows.d.ts +2 -0
  145. package/dist/login-flows.js +5 -2
  146. package/dist/login-flows.js.map +1 -1
  147. package/dist/login-manager.d.ts +6 -0
  148. package/dist/login-manager.js +10 -1
  149. package/dist/login-manager.js.map +1 -1
  150. package/dist/missed-offline.d.ts +25 -0
  151. package/dist/missed-offline.js +79 -0
  152. package/dist/missed-offline.js.map +1 -0
  153. package/dist/needs-you-hub.d.ts +6 -1
  154. package/dist/needs-you-hub.js +31 -8
  155. package/dist/needs-you-hub.js.map +1 -1
  156. package/dist/needs-you.d.ts +22 -2
  157. package/dist/needs-you.js +17 -3
  158. package/dist/needs-you.js.map +1 -1
  159. package/dist/office-share-page.d.ts +1 -1
  160. package/dist/office-share-page.js +6 -2
  161. package/dist/office-share-page.js.map +1 -1
  162. package/dist/outbound-handlers.js +59 -3
  163. package/dist/outbound-handlers.js.map +1 -1
  164. package/dist/outbound-schemas.d.ts +1 -0
  165. package/dist/outbound-schemas.js +9 -3
  166. package/dist/outbound-schemas.js.map +1 -1
  167. package/dist/package-preimage.js +27 -2
  168. package/dist/package-preimage.js.map +1 -1
  169. package/dist/queued-handoffs.d.ts +33 -0
  170. package/dist/queued-handoffs.js +75 -0
  171. package/dist/queued-handoffs.js.map +1 -0
  172. package/dist/reply-buttons-controller.js +10 -0
  173. package/dist/reply-buttons-controller.js.map +1 -1
  174. package/dist/scheduler/db.d.ts +2 -1
  175. package/dist/scheduler/db.js +23 -9
  176. package/dist/scheduler/db.js.map +1 -1
  177. package/dist/selection-card.d.ts +2 -3
  178. package/dist/selection-card.js +99 -26
  179. package/dist/selection-card.js.map +1 -1
  180. package/dist/settings-api.d.ts +13 -0
  181. package/dist/settings-api.js +22 -1
  182. package/dist/settings-api.js.map +1 -1
  183. package/dist/settings-change.js +16 -1
  184. package/dist/settings-change.js.map +1 -1
  185. package/dist/settings-instance-patch.js +27 -0
  186. package/dist/settings-instance-patch.js.map +1 -1
  187. package/dist/stall-reporter.d.ts +21 -0
  188. package/dist/stall-reporter.js +82 -0
  189. package/dist/stall-reporter.js.map +1 -0
  190. package/dist/tmux-control.d.ts +2 -2
  191. package/dist/tmux-control.js +4 -2
  192. package/dist/tmux-control.js.map +1 -1
  193. package/dist/tmux-exec-helper.d.ts +6 -3
  194. package/dist/tmux-exec-helper.js +115 -53
  195. package/dist/tmux-exec-helper.js.map +1 -1
  196. package/dist/tmux-manager.d.ts +6 -0
  197. package/dist/tmux-manager.js +17 -0
  198. package/dist/tmux-manager.js.map +1 -1
  199. package/dist/tool-permissions.d.ts +5 -2
  200. package/dist/tool-permissions.js +6 -5
  201. package/dist/tool-permissions.js.map +1 -1
  202. package/dist/tool-progress.d.ts +2 -0
  203. package/dist/tool-progress.js +19 -3
  204. package/dist/tool-progress.js.map +1 -1
  205. package/dist/topic-commands.js +4 -0
  206. package/dist/topic-commands.js.map +1 -1
  207. package/dist/tunnel/cloudflared-install.d.ts +4 -0
  208. package/dist/tunnel/cloudflared-install.js +20 -1
  209. package/dist/tunnel/cloudflared-install.js.map +1 -1
  210. package/dist/tunnel/cloudflared.d.ts +8 -1
  211. package/dist/tunnel/cloudflared.js +34 -6
  212. package/dist/tunnel/cloudflared.js.map +1 -1
  213. package/dist/tunnel/lease.d.ts +3 -3
  214. package/dist/tunnel/lease.js +23 -19
  215. package/dist/tunnel/lease.js.map +1 -1
  216. package/dist/tunnel/manager.js +6 -7
  217. package/dist/tunnel/manager.js.map +1 -1
  218. package/dist/ui/chat-md-strings.js +9 -0
  219. package/dist/ui/chat-store.js +20 -3
  220. package/dist/ui/chat-strings.js +4 -4
  221. package/dist/ui/chat-thread.js +105 -13
  222. package/dist/ui/fleet-canvas.js +4 -3
  223. package/dist/ui/fleet-office-model.js +55 -22
  224. package/dist/ui/fleet-office-overview.js +6 -38
  225. package/dist/ui/fleet-office-pack.js +4 -3
  226. package/dist/ui/fleet-office-skin.js +114 -21
  227. package/dist/ui/fleet-office-store.js +5 -0
  228. package/dist/ui/fleet-office-zones.js +2 -2
  229. package/dist/ui/fleet-office.js +41 -9
  230. package/dist/ui/fleet-usage.js +90 -27
  231. package/dist/ui/panel-chat.js +5 -2
  232. package/dist/ui/panel-log.js +7 -1
  233. package/dist/ui/panel-needs.js +17 -8
  234. package/dist/ui/preview-panel.js +78 -2
  235. package/dist/ui/settings-codex-copy.js +19 -0
  236. package/dist/ui/settings-dialogs.js +8 -0
  237. package/dist/ui/settings-model.js +16 -2
  238. package/dist/ui/settings-strings.js +2 -2
  239. package/dist/ui/shared/app-i18n.js +4 -4
  240. package/dist/ui/shared/app-needs.js +1 -1
  241. package/dist/ui/shared/app-shell.js +4 -2
  242. package/dist/ui/shared/app-stream.js +26 -0
  243. package/dist/ui/shared/app.css +55 -3
  244. package/dist/ui/shared/office/guild.png +0 -0
  245. package/dist/ui/shared/office/school.png +0 -0
  246. package/dist/ui/shared/panel-view.js +339 -17
  247. package/dist/ui/shared/usage-dialog.js +18 -1
  248. package/dist/ui/shared/view-history.css +17 -0
  249. package/dist/ui/shared/view-history.js +438 -0
  250. package/dist/ui/shared/view-strings.js +42 -0
  251. package/dist/unattended-install.d.ts +6 -0
  252. package/dist/unattended-install.js +79 -0
  253. package/dist/unattended-install.js.map +1 -0
  254. package/dist/usage/capacity.d.ts +69 -0
  255. package/dist/usage/capacity.js +119 -0
  256. package/dist/usage/capacity.js.map +1 -0
  257. package/dist/usage/i18n-keys.d.ts +1 -1
  258. package/dist/usage/i18n-keys.js +3 -0
  259. package/dist/usage/i18n-keys.js.map +1 -1
  260. package/dist/usage/profile-timeline.d.ts +16 -0
  261. package/dist/usage/profile-timeline.js +58 -0
  262. package/dist/usage/profile-timeline.js.map +1 -0
  263. package/dist/usage/quota-history.d.ts +43 -0
  264. package/dist/usage/quota-history.js +168 -0
  265. package/dist/usage/quota-history.js.map +1 -0
  266. package/dist/usage/usage-api.d.ts +31 -0
  267. package/dist/usage/usage-api.js +80 -1
  268. package/dist/usage/usage-api.js.map +1 -1
  269. package/dist/usage-report.d.ts +25 -1
  270. package/dist/usage-report.js +55 -4
  271. package/dist/usage-report.js.map +1 -1
  272. package/dist/usage-rollup.d.ts +6 -1
  273. package/dist/usage-rollup.js +16 -4
  274. package/dist/usage-rollup.js.map +1 -1
  275. package/dist/view-api.d.ts +31 -0
  276. package/dist/view-api.js +186 -41
  277. package/dist/view-api.js.map +1 -1
  278. package/dist/view-history.d.ts +84 -0
  279. package/dist/view-history.js +116 -0
  280. package/dist/view-history.js.map +1 -0
  281. package/dist/web-api.d.ts +6 -0
  282. package/dist/web-api.js +15 -4
  283. package/dist/web-api.js.map +1 -1
  284. package/dist/web-chat-history.d.ts +20 -0
  285. package/dist/web-chat-history.js +21 -0
  286. package/dist/web-chat-history.js.map +1 -1
  287. package/dist/web-guest-access.js +5 -1
  288. package/dist/web-guest-access.js.map +1 -1
  289. package/dist/web-login.d.ts +4 -3
  290. package/dist/web-login.js +23 -14
  291. package/dist/web-login.js.map +1 -1
  292. package/dist/web-office-pack-tools.d.ts +1 -1
  293. package/dist/web-office-pack-tools.js +1 -1
  294. package/dist/web-office-pack-tools.js.map +1 -1
  295. package/dist/web-session-authorization.d.ts +13 -2
  296. package/dist/web-session-authorization.js +10 -3
  297. package/dist/web-session-authorization.js.map +1 -1
  298. package/dist/web-session.d.ts +5 -0
  299. package/dist/web-session.js +20 -8
  300. package/dist/web-session.js.map +1 -1
  301. package/launcher/agend-install.cjs +16 -2
  302. package/launcher/private-home.cjs +1 -1
  303. package/package.json +1 -1
@@ -0,0 +1,14 @@
1
+ export declare const CODEX_SPEEDS: readonly ["fast", "standard"];
2
+ export type CodexSpeed = typeof CODEX_SPEEDS[number];
3
+ /** The catalog's id for Codex's Fast tier. */
4
+ export declare const CODEX_FAST_TIER = "priority";
5
+ export declare function isCodexSpeed(value: unknown): value is CodexSpeed;
6
+ /** The flags to append (with a leading space) for the configured speed, or why none (a quiet launch note). */
7
+ export declare function codexSpeed(speed: unknown, catalog: {
8
+ model: string | null;
9
+ tiers: string[] | null;
10
+ unproven?: boolean;
11
+ }): {
12
+ arg: string | null;
13
+ note: string | null;
14
+ };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * M-2446: a per-agent Codex speed (`backend_options.codex.speed`), as launch flags. Unset launches as before.
3
+ * - "fast" → `-c service_tier="fast" -c features.fast_mode=true`, only when the catalog entry of the model that
4
+ * will run advertises the "priority" tier (Codex's Fast). Codex sends `service_tier: "priority"` then
5
+ * (verified on 0.165.0 against a mock Responses API). Otherwise no flag and a quiet note: codex would
6
+ * drop the tier itself with a warning row, and an unproven model may not take it.
7
+ * - "standard" → `-c service_tier="default"`: no tier on the wire, overriding a Fast default saved by `/fast`.
8
+ * Codex accepts any string here and silently omits an unknown one, so the value is allow-listed (here and in
9
+ * config-validator.ts). Fast uses ChatGPT plan limits at 2.5× the Standard rate (OpenAI's Codex Speed page).
10
+ */
11
+ import { t } from "../locale.js";
12
+ import { shellQuote } from "./types.js";
13
+ export const CODEX_SPEEDS = ["fast", "standard"];
14
+ /** The catalog's id for Codex's Fast tier. */
15
+ export const CODEX_FAST_TIER = "priority";
16
+ export function isCodexSpeed(value) {
17
+ return typeof value === "string" && CODEX_SPEEDS.includes(value);
18
+ }
19
+ /** The flags to append (with a leading space) for the configured speed, or why none (a quiet launch note). */
20
+ export function codexSpeed(speed, catalog) {
21
+ if (speed === undefined || speed === null || speed === "")
22
+ return { arg: null, note: null };
23
+ if (!isCodexSpeed(speed))
24
+ return { arg: null, note: t("codex.speed_skipped", String(speed), t("codex.speed_not_a_speed", CODEX_SPEEDS.join(", "))) };
25
+ if (speed === "standard")
26
+ return { arg: ` -c ${shellQuote(`service_tier="default"`)}`, note: null };
27
+ if (catalog.unproven)
28
+ return { arg: null, note: t("codex.speed_skipped", speed, t("effort.launch_codex_model_unproven")) };
29
+ if (!catalog.tiers)
30
+ return { arg: null, note: t("codex.speed_skipped", speed, t("codex.speed_unknown_model", catalog.model ?? "—")) };
31
+ if (!catalog.tiers.includes(CODEX_FAST_TIER))
32
+ return { arg: null, note: t("codex.speed_skipped", speed, t("codex.speed_not_offered", catalog.model ?? "—")) };
33
+ return { arg: ` -c ${shellQuote(`service_tier="fast"`)} -c features.fast_mode=true`, note: null };
34
+ }
35
+ //# sourceMappingURL=codex-speed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-speed.js","sourceRoot":"","sources":["../../src/backend/codex-speed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,UAAU,CAAU,CAAC;AAE1D,8CAA8C;AAC9C,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;AAE1C,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,YAAkC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC1F,CAAC;AAED,8GAA8G;AAC9G,MAAM,UAAU,UAAU,CACxB,KAAc,EAAE,OAA6E;IAE7F,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC5F,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,qBAAqB,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,yBAAyB,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IACrJ,IAAI,KAAK,KAAK,UAAU;QAAE,OAAO,EAAE,GAAG,EAAE,OAAO,UAAU,CAAC,wBAAwB,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACpG,IAAI,OAAO,CAAC,QAAQ;QAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,qBAAqB,EAAE,KAAK,EAAE,CAAC,CAAC,oCAAoC,CAAC,CAAC,EAAE,CAAC;IAC3H,IAAI,CAAC,OAAO,CAAC,KAAK;QAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,qBAAqB,EAAE,KAAK,EAAE,CAAC,CAAC,2BAA2B,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC;IACtI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC;QAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,qBAAqB,EAAE,KAAK,EAAE,CAAC,CAAC,yBAAyB,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC;IAC9J,OAAO,EAAE,GAAG,EAAE,OAAO,UAAU,CAAC,qBAAqB,CAAC,6BAA6B,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACpG,CAAC"}
@@ -20,6 +20,21 @@ export declare const CODEX_STATUS_GLYPH: string;
20
20
  */
21
21
  export declare function codexLiveRowMatches(pane: string, rowPattern: RegExp): boolean;
22
22
  export declare function codexAppServerDisconnected(pane: string): boolean;
23
+ /**
24
+ * M-2266: a one-shot "resume this conversation" for the next launch, written by the fleet (restart_instance with
25
+ * resume_session_id, validated there) into the instance directory and consumed by that launch.
26
+ */
27
+ export declare const CODEX_RESUME_NEXT_FILE = "codex-resume-next.json";
28
+ /**
29
+ * M-2266: the conversation the last launch was told to resume (auto or one-shot). The next launch asks codex's
30
+ * database whether that resume took (codex records the thread as it opens it); if it did not, that launch starts
31
+ * fresh once and says so — never the same failing resume again.
32
+ */
33
+ export declare const CODEX_RESUME_ATTEMPT_FILE = "codex-resume-attempt.json";
34
+ /** M-2266: conversations an auto-resume could not open (codex refused the id); skipped by later auto-resumes. */
35
+ export declare const CODEX_RESUME_FAILED_FILE = "codex-resume-failed.json";
36
+ /** Above this, a resumed rollout carries a note that codex may compact it first. */
37
+ export declare const CODEX_RESUME_LARGE_BYTES: number;
23
38
  export declare class CodexBackend implements CliBackend {
24
39
  private instanceDir;
25
40
  /**
@@ -290,6 +305,18 @@ export declare class CodexBackend implements CliBackend {
290
305
  getInputUnavailableTransients(): InputUnavailableTransient[];
291
306
  getContextUsage(): number | null;
292
307
  getSessionId(): string | null;
308
+ /** The launch as the database plans it — and, when it has no conversation for this directory, an auto-resume (M-2266). */
309
+ private plannedCommand;
310
+ /** The database this instance's codex writes (see planResume). */
311
+ private stateDbPath;
312
+ /** M-2266: read and remove a JSON `{ id }` file in the instance directory; the id, or null. */
313
+ private takeIdFile;
314
+ private takeResumeAttempt;
315
+ private takeResumeNext;
316
+ /** M-2266: conversations an auto-resume tried and codex could not open; never auto-picked again. */
317
+ private failedResumes;
318
+ private rememberFailedResume;
319
+ private writeResumeAttempt;
293
320
  /** Which Codex session this launch resumes (#984). Reads, never writes, Codex state. */
294
321
  private planResume;
295
322
  /** Only a resume paints "Resuming session…"; a fresh launch never does. */
@@ -4,15 +4,17 @@ import { execFileSync } from "node:child_process";
4
4
  import { execFile } from "../child-process.js";
5
5
  import { promisify } from "node:util";
6
6
  import { basename, dirname, join, resolve } from "node:path";
7
+ import { stripCodexPassiveHintRow, withCodexPassiveHintTail } from "./codex-footer-hints.js";
7
8
  import { codexPackageWarning } from "./codex-package.js";
8
9
  import { probeCliVersion, resolveBinary, shellQuote, validateModel, validateProvider, warnIfModelMismatch } from "./types.js";
9
10
  import { credentialHomeSpec, credentialProfileHome, prepareCredentialProfileHome, resolveCredentialProfile, } from "./credential-profile.js";
10
11
  import { getAgendHome } from "../paths.js";
11
- import { CODEX_MODELS_CACHE_MAX_BYTES, codexShortHomeFor, readCodexEffortLevels, readCodexModelEffortLevels, resolveCodexLaunchModel } from "./codex-metadata.js";
12
+ import { CODEX_MODELS_CACHE_MAX_BYTES, codexShortHomeFor, readCodexEffortLevels, readCodexModelEffortLevels, readCodexModelServiceTiers, resolveCodexLaunchModel } from "./codex-metadata.js";
12
13
  import { EFFORT_CAPABILITIES } from "./effort-metadata.js";
13
14
  import { codexEffort } from "./launch-effort.js";
15
+ import { codexSpeed } from "./codex-speed.js";
14
16
  import { appendWithMarker, removeMarker } from "./marker-utils.js";
15
- import { codexSiblingState, codexStateDbAbsent, cwdRolloutsProvenAbsent, findExactCwdCodexSession, planCodexResume, newestMissedCwdRollout } from "./codex-session-lookup.js";
17
+ import { checkResumeId, codexSiblingState, codexStateDbAbsent, codexThreadRowExists, cwdRolloutsProvenAbsent, findExactCwdCodexSession, planCodexResume, newestResumableRollout } from "./codex-session-lookup.js";
16
18
  import { t } from "../locale.js";
17
19
  import { quotaLine, quotaLowLine, quotaPausedLine } from "../quota-notice.js";
18
20
  import { parse as parseToml } from "smol-toml";
@@ -968,6 +970,21 @@ function codexUnboxedResumeLoading(rows) {
968
970
  return false;
969
971
  return after.slice(composer + 1).every(row => row === "");
970
972
  }
973
+ /**
974
+ * M-2266: a one-shot "resume this conversation" for the next launch, written by the fleet (restart_instance with
975
+ * resume_session_id, validated there) into the instance directory and consumed by that launch.
976
+ */
977
+ export const CODEX_RESUME_NEXT_FILE = "codex-resume-next.json";
978
+ /**
979
+ * M-2266: the conversation the last launch was told to resume (auto or one-shot). The next launch asks codex's
980
+ * database whether that resume took (codex records the thread as it opens it); if it did not, that launch starts
981
+ * fresh once and says so — never the same failing resume again.
982
+ */
983
+ export const CODEX_RESUME_ATTEMPT_FILE = "codex-resume-attempt.json";
984
+ /** M-2266: conversations an auto-resume could not open (codex refused the id); skipped by later auto-resumes. */
985
+ export const CODEX_RESUME_FAILED_FILE = "codex-resume-failed.json";
986
+ /** Above this, a resumed rollout carries a note that codex may compact it first. */
987
+ export const CODEX_RESUME_LARGE_BYTES = 20 * 1024 * 1024;
971
988
  export class CodexBackend {
972
989
  instanceDir;
973
990
  /**
@@ -1123,6 +1140,7 @@ export class CodexBackend {
1123
1140
  const rows = pane.replace(/\r/g, "").split("\n");
1124
1141
  while (rows.length && !rows[rows.length - 1].trim())
1125
1142
  rows.pop();
1143
+ stripCodexPassiveHintRow(rows);
1126
1144
  const footer = rows.pop() ?? "";
1127
1145
  // Codex preserves other configured status-line items after the context
1128
1146
  // meter (observed on 0.156.0: "Context 100% left · GPT-6-Astra"). They
@@ -1193,6 +1211,9 @@ export class CodexBackend {
1193
1211
  // idle chrome. Remove only that observed decorative glyph; broader
1194
1212
  // punctuation stripping could turn real tool output into a false prompt.
1195
1213
  const rows = pane.replace(/\r/g, "").split("\n").map(row => row.replace(/⋆/gu, ""));
1214
+ while (rows.length && !rows.at(-1).trim())
1215
+ rows.pop();
1216
+ stripCodexPassiveHintRow(rows);
1196
1217
  let prompt = -1;
1197
1218
  for (let i = rows.length - 1; i >= 0; i--) {
1198
1219
  if (/^[>›]\s*Ask Codex to do anything\s*$/.test(rows[i])) {
@@ -1256,27 +1277,39 @@ export class CodexBackend {
1256
1277
  cmd = `${this.binaryPath} ${approvalFlag}`;
1257
1278
  }
1258
1279
  else {
1259
- const plan = this.planResume(config);
1260
- this.lastLaunchResumes = plan.mode === "resume" || plan.mode === "last";
1261
- if (plan.mode === "resume")
1262
- cmd = `${this.binaryPath} resume ${shellQuote(plan.id)} ${approvalFlag}`;
1263
- else if (plan.mode === "last")
1264
- cmd = `${this.binaryPath} resume --last ${approvalFlag}`;
1265
- else
1280
+ const resumeBy = (id, why, bytes) => {
1281
+ this.lastLaunchResumes = true;
1282
+ this.writeResumeAttempt(id);
1283
+ const large = bytes !== null && bytes > CODEX_RESUME_LARGE_BYTES ? ` ${t("codex.resume_large", String(Math.round(bytes / (1024 * 1024))))}` : "";
1284
+ this.launchWarning = why + large;
1285
+ return `${this.binaryPath} resume ${shellQuote(id)} ${approvalFlag}`;
1286
+ };
1287
+ const sessionsDir = join(this.isolatedCodexHome, "sessions");
1288
+ // M-2266: the previous launch was told to resume a conversation by id. Codex records a thread as it opens it,
1289
+ // so a resume that did not take (codex exited with "No saved session found…") left no row: this launch starts
1290
+ // fresh, once, and says so. A database that cannot be read proves nothing, and planning goes on as usual.
1291
+ // A new one-shot ask comes first: it is the person's explicit choice for this launch.
1292
+ const oneShot = this.takeResumeNext();
1293
+ const attempt = this.takeResumeAttempt();
1294
+ const failed = !oneShot && attempt !== null && codexThreadRowExists(this.stateDbPath(), attempt) === false;
1295
+ if (failed) {
1296
+ // Remembered, so the auto-resume never picks this conversation again on a later launch.
1297
+ this.rememberFailedResume(attempt);
1266
1298
  cmd = `${this.binaryPath} ${approvalFlag}`;
1267
- if (plan.mode === "last")
1268
- this.launchWarning = t("codex.resume_db_unreadable_last", plan.cause);
1269
- else if (plan.mode === "fresh" && plan.reason === "unreadable-with-siblings") {
1270
- this.launchWarning = t("codex.resume_db_unreadable_fresh", plan.cause);
1299
+ this.launchWarning = t("codex.resume_failed", config.workingDirectory, attempt);
1300
+ }
1301
+ else if (oneShot) {
1302
+ // M-2266: validated when it was asked for (restart_instance); checked again now, as the rollout may have moved.
1303
+ const check = checkResumeId(sessionsDir, config.workingDirectory, oneShot);
1304
+ if (check.ok)
1305
+ cmd = resumeBy(check.rollout.id, t("codex.resume_oneshot", config.workingDirectory, check.rollout.id), check.rollout.bytes);
1306
+ else {
1307
+ cmd = this.plannedCommand(config, approvalFlag, sessionsDir, resumeBy);
1308
+ this.launchWarning = [t("codex.resume_oneshot_invalid", config.workingDirectory, oneShot, check.reason), this.launchWarning].filter(Boolean).join("\n");
1309
+ }
1271
1310
  }
1272
- else if (plan.mode === "fresh") {
1273
- // #1053: "none" is also what a lookup that missed looks like (#1028
1274
- // was a silent new session per restart). A workspace that never had
1275
- // a conversation stays quiet; one whose rollout shows a turn is told
1276
- // which conversation to resume by hand.
1277
- const missed = newestMissedCwdRollout(join(this.isolatedCodexHome, "sessions"), config.workingDirectory);
1278
- if (missed)
1279
- this.launchWarning = t("codex.resume_none_but_history", config.workingDirectory, missed.id);
1311
+ else {
1312
+ cmd = this.plannedCommand(config, approvalFlag, sessionsDir, resumeBy);
1280
1313
  }
1281
1314
  }
1282
1315
  if (config.model) {
@@ -1299,7 +1332,13 @@ export class CodexBackend {
1299
1332
  : { model: runs.model, levels: null, unproven: true });
1300
1333
  if (effort.arg)
1301
1334
  cmd += effort.arg;
1302
- this.quietLaunchNotes = effort.note ? [effort.note] : [];
1335
+ // M-2446: the per-agent speed (codex-speed.ts) — Fast only where the running model's catalog entry offers it.
1336
+ const speed = codexSpeed(config.backendOptions?.speed, runs.proven
1337
+ ? readCodexModelServiceTiers({ isolatedHome: this.isolatedCodexHome, sharedHome: this.sharedCodexHome, model: runs.model })
1338
+ : { model: runs.model, tiers: null, unproven: true });
1339
+ if (speed.arg)
1340
+ cmd += speed.arg;
1341
+ this.quietLaunchNotes = [effort.note, speed.note].filter((n) => !!n);
1303
1342
  // AgEnD instances are unattended processes: an interactive self-update
1304
1343
  // picker blocks delivery and must never be enabled by a copied global or
1305
1344
  // managed config layer. Keep this last so the CLI override is authoritative.
@@ -1827,7 +1866,7 @@ export class CodexBackend {
1827
1866
  // U+22C6 is Codex's observed cosmetic starfield; it can be drawn in the
1828
1867
  // prompt, between prompt/footer, and below the footer. A drafted composer
1829
1868
  // is also idle once this same bottom footer proves it owns the screen.
1830
- const contextReady = /(?:^|\n)[>›][ \t⋆]+(?!\d+\.)\S[^\r\n]*\r?\n(?:[ \t⋆]*\r?\n){0,3}[ \t⋆]+(?:[0-9a-f-]{36}[ \t]+·[ \t]+)?Context[ \t]+(?:\d+%[ \t]+(?:left|used)|\d+…|…)[^\r\n]*(?:\r?\n[ \t⋆]*)*$/i;
1869
+ const contextReady = withCodexPassiveHintTail(/(?:^|\n)[>›][ \t⋆]+(?!\d+\.)\S[^\r\n]*\r?\n(?:[ \t⋆]*\r?\n){0,3}[ \t⋆]+(?:[0-9a-f-]{36}[ \t]+·[ \t]+)?Context[ \t]+(?:\d+%[ \t]+(?:left|used)|\d+…|…)[^\r\n]*(?:\r?\n[ \t⋆]*)*$/i);
1831
1870
  const footerPattern = this.configuredStatusLineFooterPattern();
1832
1871
  if (!footerPattern)
1833
1872
  return contextReady;
@@ -1836,13 +1875,13 @@ export class CodexBackend {
1836
1875
  // configured, that value must specifically be Ready. This is positive
1837
1876
  // structural proof, never a deny-list of known dialogs.
1838
1877
  const footerSource = footerPattern.source.slice(1, -1);
1839
- const noContextReady = new RegExp(String.raw `(?:^|\n)[>›][ \t⋆]*Ask Codex to do anything[ \t⋆]*\r?\n(?:[ \t⋆]*\r?\n){0,3}${footerSource}(?:\r?\n[ \t⋆]*)*$`, "iu");
1878
+ const noContextReady = withCodexPassiveHintTail(new RegExp(String.raw `(?:^|\n)[>›][ \t⋆]*Ask Codex to do anything[ \t⋆]*\r?\n(?:[ \t⋆]*\r?\n){0,3}${footerSource}(?:\r?\n[ \t⋆]*)*$`, "iu"));
1840
1879
  // #978: a configured footer that carries a Context item in any position
1841
1880
  // is the Context footer: same drafted-composer rule as Context-first. The
1842
1881
  // whole row must match the configured item grammar, so an arbitrary
1843
1882
  // indented line that merely contains `Context N% left` cannot pass.
1844
1883
  const configuredContextReady = this.configuredHasContextItem()
1845
- ? new RegExp(String.raw `(?:^|\n)[>›][ \t⋆]+(?!\d+\.)\S[^\r\n]*\r?\n(?:[ \t⋆]*\r?\n){0,3}(?=[^\r\n]*${CODEX_CONTEXT_ITEM})${footerSource}(?:\r?\n[ \t⋆]*)*$`, "iu")
1884
+ ? withCodexPassiveHintTail(new RegExp(String.raw `(?:^|\n)[>›][ \t⋆]+(?!\d+\.)\S[^\r\n]*\r?\n(?:[ \t⋆]*\r?\n){0,3}(?=[^\r\n]*${CODEX_CONTEXT_ITEM})${footerSource}(?:\r?\n[ \t⋆]*)*$`, "iu"))
1846
1885
  : null;
1847
1886
  return new RegExp([contextReady.source, noContextReady.source, configuredContextReady?.source]
1848
1887
  .filter((source) => !!source)
@@ -2376,6 +2415,75 @@ export class CodexBackend {
2376
2415
  // (planResume); AgEnD persists no session id of its own (#913 was reverted).
2377
2416
  return null;
2378
2417
  }
2418
+ /** The launch as the database plans it — and, when it has no conversation for this directory, an auto-resume (M-2266). */
2419
+ plannedCommand(config, approvalFlag, sessionsDir, resumeBy) {
2420
+ const plan = this.planResume(config);
2421
+ this.lastLaunchResumes = plan.mode === "resume" || plan.mode === "last";
2422
+ if (plan.mode === "resume")
2423
+ return `${this.binaryPath} resume ${shellQuote(plan.id)} ${approvalFlag}`;
2424
+ if (plan.mode === "last") {
2425
+ this.launchWarning = t("codex.resume_db_unreadable_last", plan.cause);
2426
+ return `${this.binaryPath} resume --last ${approvalFlag}`;
2427
+ }
2428
+ if (plan.reason === "unreadable-with-siblings") {
2429
+ this.launchWarning = t("codex.resume_db_unreadable_fresh", plan.cause);
2430
+ return `${this.binaryPath} ${approvalFlag}`;
2431
+ }
2432
+ // #1053 found these and only told the person; M-2266 (the user's choice) resumes it: codex's database has no
2433
+ // conversation for this directory, but its newest CLI rollout of exactly this directory, with a turn, is still
2434
+ // there — `codex resume <id>` reads it.
2435
+ const found = newestResumableRollout(sessionsDir, config.workingDirectory, undefined, this.failedResumes());
2436
+ if (found)
2437
+ return resumeBy(found.id, t("codex.resume_auto", config.workingDirectory, found.id), found.bytes);
2438
+ return `${this.binaryPath} ${approvalFlag}`;
2439
+ }
2440
+ /** The database this instance's codex writes (see planResume). */
2441
+ stateDbPath() {
2442
+ const instanceDb = join(this.isolatedCodexHome, "state_5.sqlite");
2443
+ const sharedDb = join(this.sharedCodexHome, "state_5.sqlite");
2444
+ return existsSync(instanceDb) || sharedDb === instanceDb ? instanceDb : sharedDb;
2445
+ }
2446
+ /** M-2266: read and remove a JSON `{ id }` file in the instance directory; the id, or null. */
2447
+ takeIdFile(name) {
2448
+ const path = join(this.instanceDir, name);
2449
+ let id = null;
2450
+ try {
2451
+ const v = JSON.parse(readFileSync(path, "utf-8"));
2452
+ if (typeof v.id === "string" && /^[0-9a-f-]{36}$/i.test(v.id))
2453
+ id = v.id;
2454
+ }
2455
+ catch { /* absent or unreadable */ }
2456
+ try {
2457
+ unlinkSync(path);
2458
+ }
2459
+ catch { /* absent */ }
2460
+ return id;
2461
+ }
2462
+ takeResumeAttempt() { return this.takeIdFile(CODEX_RESUME_ATTEMPT_FILE); }
2463
+ takeResumeNext() { return this.takeIdFile(CODEX_RESUME_NEXT_FILE); }
2464
+ /** M-2266: conversations an auto-resume tried and codex could not open; never auto-picked again. */
2465
+ failedResumes() {
2466
+ try {
2467
+ const v = JSON.parse(readFileSync(join(this.instanceDir, CODEX_RESUME_FAILED_FILE), "utf-8"));
2468
+ return new Set(Array.isArray(v.ids) ? v.ids.filter((x) => typeof x === "string") : []);
2469
+ }
2470
+ catch {
2471
+ return new Set();
2472
+ }
2473
+ }
2474
+ rememberFailedResume(id) {
2475
+ const ids = [...this.failedResumes(), id].slice(-50);
2476
+ try {
2477
+ writeFileSync(join(this.instanceDir, CODEX_RESUME_FAILED_FILE), JSON.stringify({ ids: [...new Set(ids)] }), { mode: 0o600 });
2478
+ }
2479
+ catch { /* best effort: then the next launch may try it once more, and fall back again */ }
2480
+ }
2481
+ writeResumeAttempt(id) {
2482
+ try {
2483
+ writeFileSync(join(this.instanceDir, CODEX_RESUME_ATTEMPT_FILE), JSON.stringify({ id, at: new Date().toISOString() }), { mode: 0o600 });
2484
+ }
2485
+ catch { /* without it a failed resume is only retried, as any failed launch is */ }
2486
+ }
2379
2487
  /** Which Codex session this launch resumes (#984). Reads, never writes, Codex state. */
2380
2488
  planResume(config) {
2381
2489
  // Read the database Codex actually writes: the one in this instance's