dominds 1.28.0 → 1.29.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 (51) hide show
  1. package/README.md +1 -0
  2. package/README.zh.md +1 -0
  3. package/dist/dialog-global-registry.d.ts +2 -0
  4. package/dist/dialog-global-registry.js +41 -0
  5. package/dist/dialog.d.ts +1 -0
  6. package/dist/dialog.js +5 -0
  7. package/dist/docs/codex-provider-auth-policy.md +59 -0
  8. package/dist/docs/codex-provider-auth-policy.zh.md +59 -0
  9. package/dist/docs/llm-provider-isolation.md +1 -1
  10. package/dist/docs/llm-provider-isolation.zh.md +1 -1
  11. package/dist/llm/api-quirks.d.ts +1 -0
  12. package/dist/llm/api-quirks.js +2 -1
  13. package/dist/llm/client.d.ts +2 -1
  14. package/dist/llm/defaults.yaml +163 -7
  15. package/dist/llm/gen/codex.d.ts +3 -2
  16. package/dist/llm/gen/codex.js +82 -10
  17. package/dist/llm/gen/google.d.ts +20 -0
  18. package/dist/llm/gen/google.js +735 -0
  19. package/dist/llm/gen/mock.js +8 -0
  20. package/dist/llm/gen/openai-compatible.js +5 -0
  21. package/dist/llm/gen/openai.js +9 -1
  22. package/dist/llm/gen/registry.js +4 -2
  23. package/dist/llm/gen/tool-output-limit.js +1 -0
  24. package/dist/llm/gen/tool-result-image-ingest.d.ts +1 -0
  25. package/dist/llm/gen/tool-result-image-ingest.js +2 -1
  26. package/dist/llm/kernel-driver/drive.js +21 -3
  27. package/dist/main-dialog-goal-reminder.d.ts +20 -0
  28. package/dist/main-dialog-goal-reminder.js +344 -0
  29. package/dist/minds/system-prompt-parts.js +14 -14
  30. package/dist/runtime/driver-messages.js +16 -16
  31. package/dist/server/setup-routes.js +3 -1
  32. package/dist/team.d.ts +12 -3
  33. package/dist/team.js +36 -4
  34. package/dist/tools/builtins.js +2 -0
  35. package/dist/tools/ctrl.d.ts +1 -0
  36. package/dist/tools/ctrl.js +65 -1
  37. package/dist/tools/prompts/control/en/index.md +4 -2
  38. package/dist/tools/prompts/control/en/principles.md +5 -4
  39. package/dist/tools/prompts/control/en/scenarios.md +9 -4
  40. package/dist/tools/prompts/control/en/tools.md +53 -9
  41. package/dist/tools/prompts/control/zh/index.md +4 -2
  42. package/dist/tools/prompts/control/zh/principles.md +5 -4
  43. package/dist/tools/prompts/control/zh/scenarios.md +9 -4
  44. package/dist/tools/prompts/control/zh/tools.md +53 -9
  45. package/dist/tools/team_mgmt-manual.js +10 -8
  46. package/dist/tools/team_mgmt.js +3 -0
  47. package/dist/tools/txt.js +115 -70
  48. package/package.json +5 -4
  49. package/webapp/dist/assets/{main-YWP5PWOM.js → main-YWYVZGBW.js} +119 -60
  50. package/webapp/dist/assets/{main-YWP5PWOM.js.map → main-YWYVZGBW.js.map} +3 -3
  51. package/webapp/dist/index.html +1 -1
package/README.md CHANGED
@@ -375,6 +375,7 @@ Result: fewer bad side effects, higher plan fidelity, and more first‑try succe
375
375
  - **[Dialog Persistence](docs/dialog-persistence.md)** — On-disk layout and lifecycle
376
376
  - **[Interruption & Resumption](docs/interruption-resumption.md)** — Stop/resume semantics
377
377
  - **[Auth](docs/auth.md)** — Authentication and access model
378
+ - **[Codex Provider Auth Policy](docs/codex-provider-auth-policy.md)** — Managed-ChatGPT-OAuth-only boundary and alternatives
378
379
  - **[Mottos](docs/mottos.md)** — Short guiding statements
379
380
 
380
381
  ### Getting Help
package/README.zh.md CHANGED
@@ -285,6 +285,7 @@ Dominds 面向“长期开发运作(DevOps)”场景设计,基于社会化
285
285
  - **[Dialog Persistence](docs/dialog-persistence.zh.md)** — 磁盘持久化存储结构
286
286
  - **[Interruption & Resumption](docs/interruption-resumption.zh.md)** — 任务中断与恢复语义
287
287
  - **[Auth](docs/auth.zh.md)** — 认证机制与访问模型(WebUI + API)
288
+ - **[Codex Provider 认证策略](docs/codex-provider-auth-policy.zh.md)** — 仅支持 ChatGPT 托管 OAuth 的产品边界与替代路径
288
289
  - **[Mottos](docs/mottos.zh.md)** — 警世名言
289
290
 
290
291
  ## 获取帮助
@@ -34,6 +34,8 @@ declare class GlobalDialogRegistry {
34
34
  private driveTriggerSubChan;
35
35
  static getInstance(): GlobalDialogRegistry;
36
36
  get(rootId: string): MainDialog | undefined;
37
+ getRunningDialogsByAgent(agentId: string): Dialog[];
38
+ private reconcileMainDialogGoalRemindersForAgent;
37
39
  register(mainDialog: MainDialog): void;
38
40
  unregister(rootId: string): void;
39
41
  private enqueueRoot;
@@ -4,6 +4,7 @@ exports.globalDialogRegistry = void 0;
4
4
  const evt_1 = require("@longrun-ai/kernel/evt");
5
5
  const dialog_1 = require("./dialog");
6
6
  const log_1 = require("./log");
7
+ const main_dialog_goal_reminder_1 = require("./main-dialog-goal-reminder");
7
8
  const persistence_1 = require("./persistence");
8
9
  const log = (0, log_1.createLogger)('dialog-global-registry');
9
10
  class GlobalDialogRegistry {
@@ -33,6 +34,45 @@ class GlobalDialogRegistry {
33
34
  get(rootId) {
34
35
  return this.entries.get(rootId)?.mainDialog;
35
36
  }
37
+ getRunningDialogsByAgent(agentId) {
38
+ const dialogs = [];
39
+ const seenDialogIds = new Set();
40
+ for (const entry of this.entries.values()) {
41
+ for (const dialog of entry.mainDialog.getLoadedDialogTreeSnapshot()) {
42
+ const dialogId = dialog.id.valueOf();
43
+ if (dialog.status === 'running' &&
44
+ dialog.agentId === agentId &&
45
+ !seenDialogIds.has(dialogId)) {
46
+ seenDialogIds.add(dialogId);
47
+ dialogs.push(dialog);
48
+ }
49
+ }
50
+ }
51
+ return dialogs;
52
+ }
53
+ reconcileMainDialogGoalRemindersForAgent(agentId) {
54
+ const runningDialogs = this.getRunningDialogsByAgent(agentId);
55
+ if (runningDialogs.length <= 1) {
56
+ return;
57
+ }
58
+ for (const entry of this.entries.values()) {
59
+ const dialog = entry.mainDialog;
60
+ if (dialog.status !== 'running' || dialog.agentId !== agentId) {
61
+ continue;
62
+ }
63
+ const changed = (0, main_dialog_goal_reminder_1.refreshFollowTaskdocMainDialogGoalReminderForKnownParallelState)(dialog);
64
+ if (!changed) {
65
+ continue;
66
+ }
67
+ void dialog.dlgStore.persistReminders(dialog, dialog.reminders).catch((error) => {
68
+ log.warn('Failed to persist main-dialog goal reminder after parallel dialog detection', error, {
69
+ rootId: dialog.id.rootId,
70
+ selfId: dialog.id.selfId,
71
+ agentId: dialog.agentId,
72
+ });
73
+ });
74
+ }
75
+ }
36
76
  register(mainDialog) {
37
77
  // This registry is keyed by the *tree root id*.
38
78
  // Only the canonical main dialog (selfId === rootId) should be stored here.
@@ -48,6 +88,7 @@ class GlobalDialogRegistry {
48
88
  driveQueued: false,
49
89
  activeRunClearedDrivePending: false,
50
90
  });
91
+ this.reconcileMainDialogGoalRemindersForAgent(mainDialog.agentId);
51
92
  void (async () => {
52
93
  try {
53
94
  const hasPendingNextStepTriggers = await persistence_1.DialogPersistence.hasPendingNextStepTriggers(mainDialog.id);
package/dist/dialog.d.ts CHANGED
@@ -279,6 +279,7 @@ export declare abstract class Dialog {
279
279
  private dispatchSharedReminderOwnerUpdateImpacts;
280
280
  /**
281
281
  * Emits current visible reminders without reconciling tool-owned state or writing persistence.
282
+ * Dominds-managed fixed dialog reminders may be materialized in memory so display stays complete.
282
283
  * This is for read-only dialog display, especially completed/archived dialogs opened from old tabs.
283
284
  */
284
285
  emitReminderSnapshot(): Promise<ReminderContent[]>;
package/dist/dialog.js CHANGED
@@ -9,6 +9,7 @@ const time_1 = require("@longrun-ai/kernel/utils/time");
9
9
  const util_1 = require("util");
10
10
  const evt_registry_1 = require("./evt-registry");
11
11
  const log_1 = require("./log");
12
+ const main_dialog_goal_reminder_1 = require("./main-dialog-goal-reminder");
12
13
  const async_fifo_mutex_1 = require("./runtime/async-fifo-mutex");
13
14
  const driver_messages_1 = require("./runtime/driver-messages");
14
15
  const inter_dialog_format_1 = require("./runtime/inter-dialog-format");
@@ -530,6 +531,7 @@ class Dialog {
530
531
  this.touchReminders();
531
532
  }
532
533
  async listVisibleReminderTargets() {
534
+ await (0, main_dialog_goal_reminder_1.ensureMainDialogGoalReminder)(this);
533
535
  const targets = this.reminders.map((reminder, index) => ({
534
536
  source: 'dialog',
535
537
  index,
@@ -692,9 +694,11 @@ class Dialog {
692
694
  }
693
695
  /**
694
696
  * Emits current visible reminders without reconciling tool-owned state or writing persistence.
697
+ * Dominds-managed fixed dialog reminders may be materialized in memory so display stays complete.
695
698
  * This is for read-only dialog display, especially completed/archived dialogs opened from old tabs.
696
699
  */
697
700
  async emitReminderSnapshot() {
701
+ await (0, main_dialog_goal_reminder_1.ensureMainDialogGoalReminder)(this);
698
702
  const taskSharedTarget = {
699
703
  kind: 'task',
700
704
  agentId: this.agentId,
@@ -713,6 +717,7 @@ class Dialog {
713
717
  * Returns reminder contents with metadata for the frontend.
714
718
  */
715
719
  async processReminderUpdates() {
720
+ await (0, main_dialog_goal_reminder_1.ensureMainDialogGoalReminder)(this);
716
721
  const taskSharedTarget = {
717
722
  kind: 'task',
718
723
  agentId: this.agentId,
@@ -0,0 +1,59 @@
1
+ # Codex Provider Authentication Policy
2
+
3
+ ## Decided product boundary
4
+
5
+ The built-in Dominds `apiType: codex` provider **supports only managed ChatGPT OAuth file authentication**. Its runtime accepts only a final `auth_mode: chatgpt` state backed by refreshable `id_token`, `access_token`, and `refresh_token` values plus a ChatGPT account ID.
6
+
7
+ This product boundary is intentionally narrower than `codex-rs`; it is not a backlog of modes that should be enabled automatically. `codex-auth` may continue recognizing the complete `codex-rs` authentication contract so it can produce accurate diagnostics. Recognizing an authentication method does not authorize the Dominds Codex provider to send requests with it.
8
+
9
+ Current behavior is:
10
+
11
+ | Detected authentication method | Dominds Codex provider behavior |
12
+ | ------------------------------------------------------- | ------------------------------------------------------------------- |
13
+ | Complete, refreshable managed `chatgpt` OAuth file auth | Accepted |
14
+ | `chatgpt` from the ephemeral auth store | Rejected |
15
+ | `chatgpt` missing a required token or account ID | Rejected; Codex ChatGPT file login must be run again |
16
+ | `chatgptAuthTokens`, whether refreshable or not | Rejected |
17
+ | `apikey` | Rejected |
18
+ | External `headers` | Rejected |
19
+ | `agentIdentity` | Rejected |
20
+ | `personalAccessToken` | Rejected |
21
+ | `bedrockApiKey` | Rejected |
22
+ | `CODEX_ACCESS_TOKEN` containing a PAT or Agent Identity | Rejected; this variable overrides persistent auth and must be unset |
23
+
24
+ Unsupported startup auth is rejected before request-client creation. If credentials change to another mode, come from the ephemeral auth store, or remain `chatgpt` but become incomplete during refresh or 401 recovery, they are rejected again before any retry request. These local policy failures use the stable `DOMINDS_CODEX_PROVIDER_AUTH_POLICY` error code and are non-retriable. The provider must not fall back based on an upstream error, repeat the same authentication path, or silently select another credential.
25
+
26
+ ## When another authentication method is required
27
+
28
+ If the target service exposes the OpenAI Responses API, configure a custom `apiType: openai` provider with its own authentication environment variable. For example:
29
+
30
+ ```yaml
31
+ providers:
32
+ my_openai_responses:
33
+ name: My OpenAI Responses API
34
+ apiType: openai
35
+ baseUrl: https://api.openai.com/v1
36
+ apiKeyEnvVar: MY_OPENAI_API_KEY
37
+ models:
38
+ gpt-5.6-sol:
39
+ name: GPT-5.6 Sol
40
+ optimal_max_tokens: 600000
41
+ critical_max_tokens: 922000
42
+ caution_remediation_cadence_generations: 10
43
+ context_length: 1050000
44
+ input_length: 1050000
45
+ output_length: 128000
46
+ context_window: '1.05M'
47
+ ```
48
+
49
+ If `apiType: openai` cannot cover the required authentication flow, submit a feature request through [Dominds issues](https://github.com/longrun-ai/dominds/issues). Do not opportunistically add the new authentication method to the Codex provider.
50
+
51
+ ## Default rule for future `codex-rs` alignment
52
+
53
+ Future synchronization with the `codex-rs` authentication contract must preserve this policy by default:
54
+
55
+ 1. Update `codex-auth` parsing, types, and diagnostics for new contracts and modes.
56
+ 2. Continue accepting only complete, refreshable, file-backed managed `chatgpt` OAuth at the Dominds Codex provider request boundary.
57
+ 3. Reject every new mode loudly before any HTTP request, retaining guidance for a custom OpenAI Responses API provider or a Dominds feature request.
58
+ 4. Update code comments, this document, and regression tests covering every authentication branch.
59
+ 5. Expand the Codex provider authentication surface only through an explicit Dominds product decision. Upstream support alone is not sufficient justification.
@@ -0,0 +1,59 @@
1
+ # Codex Provider 认证策略
2
+
3
+ ## 确定的产品边界
4
+
5
+ Dominds 内置 `apiType: codex` provider **只支持 ChatGPT 托管 OAuth 文件认证**。运行时最终只放行 `auth_mode: chatgpt`,并要求 `auth.json` 具有可刷新的 `id_token`、`access_token`、`refresh_token` 和 ChatGPT account ID。
6
+
7
+ 这是有意窄于 `codex-rs` 的产品边界,不是尚未完成的自动兼容清单。`codex-auth` 可以继续识别 `codex-rs` 的完整认证契约,以便给出准确诊断;但识别某种认证方式,不代表 Dominds Codex provider 可以使用它发送请求。
8
+
9
+ 当前处理如下:
10
+
11
+ | 检测到的认证方式 | Dominds Codex provider 行为 |
12
+ | --------------------------------------------- | -------------------------------------------- |
13
+ | 完整、可刷新的 `chatgpt` 托管 OAuth 文件认证 | 放行 |
14
+ | 临时认证仓中的 `chatgpt` | 拒绝 |
15
+ | 缺少必要 token 或 account ID 的 `chatgpt` | 拒绝;要求重新执行 Codex ChatGPT 文件登录 |
16
+ | `chatgptAuthTokens`(无论能否刷新) | 拒绝 |
17
+ | `apikey` | 拒绝 |
18
+ | 外部 `headers` | 拒绝 |
19
+ | `agentIdentity` | 拒绝 |
20
+ | `personalAccessToken` | 拒绝 |
21
+ | `bedrockApiKey` | 拒绝 |
22
+ | `CODEX_ACCESS_TOKEN`(PAT 或 Agent Identity) | 拒绝;该变量会覆盖持久化认证,必须先取消设置 |
23
+
24
+ 启动时检测到不支持的认证,会在创建请求客户端之前拒绝。运行期间若凭证在刷新或 401 恢复中变成其他模式、来自临时认证仓,或仍为 `chatgpt` 但已不完整,会在任何重试请求发出前再次拒绝。此类本地认证策略错误使用稳定错误码 `DOMINDS_CODEX_PROVIDER_AUTH_POLICY`,属于不可重试失败;不允许根据上游错误回退、反复重试同一认证路径,也不允许静默改用其他凭证。
25
+
26
+ ## 需要其他认证方式时
27
+
28
+ 如果目标服务提供 OpenAI Responses API,请配置自定义 `apiType: openai` provider,并使用它自己的认证环境变量。例如:
29
+
30
+ ```yaml
31
+ providers:
32
+ my_openai_responses:
33
+ name: My OpenAI Responses API
34
+ apiType: openai
35
+ baseUrl: https://api.openai.com/v1
36
+ apiKeyEnvVar: MY_OPENAI_API_KEY
37
+ models:
38
+ gpt-5.6-sol:
39
+ name: GPT-5.6 Sol
40
+ optimal_max_tokens: 600000
41
+ critical_max_tokens: 922000
42
+ caution_remediation_cadence_generations: 10
43
+ context_length: 1050000
44
+ input_length: 1050000
45
+ output_length: 128000
46
+ context_window: '1.05M'
47
+ ```
48
+
49
+ 如果 `apiType: openai` 不能覆盖所需认证流程,请在 [Dominds issues](https://github.com/longrun-ai/dominds/issues) 提交 feature request;不要把新认证方式顺手接入 Codex provider。
50
+
51
+ ## 与 `codex-rs` 对齐时的默认规则
52
+
53
+ 以后同步 `codex-rs` 认证契约时,默认必须保留本策略:
54
+
55
+ 1. 更新 `codex-auth` 对新契约和新认证方式的解析、类型及诊断。
56
+ 2. 在 Dominds Codex provider 的请求边界继续只放行完整、可刷新且来自文件的托管 `chatgpt` OAuth。
57
+ 3. 对任何新认证方式在发送 HTTP 请求前响亮拒绝,并保留自定义 OpenAI Responses API provider / feature request 指引。
58
+ 4. 同步更新代码注释、本文档和覆盖全部认证分支的回归测试。
59
+ 5. 只有经过明确的 Dominds 产品决策,才能扩大 Codex provider 的认证范围;“上游已经支持”本身不是扩大范围的理由。
@@ -12,7 +12,7 @@ This means:
12
12
  - `apiType: anthropic` owns official Anthropic Messages semantics, including object-shaped `model_params.anthropic.thinking`.
13
13
  - `apiType: anthropic-compatible` owns Anthropic-compatible gateway semantics, including boolean `model_params.anthropic-compatible.thinking` mapped to provider `enabled` / `disabled` request objects.
14
14
 
15
- Some providers expose OpenAI-compatible or Anthropic-compatible endpoints while still requiring explicit provider quirks. Volcano Engine Ark Coding Plan now uses the OpenAI-compatible Chat Completions shape with its dedicated `/api/coding/v3` endpoint; the historical Anthropic-compatible Volcano tool-call quirks have been removed. Kimi Code also uses the OpenAI-compatible Chat Completions shape, but must use the built-in `kimi-code` provider's dedicated `/coding/v1` endpoint, versioned `KimiCLI/Dominds/<version>` User-Agent, `prompt_cache_key`, and Kimi-specific `thinking`/`reasoning_effort` request shaping. See [`volcengine-coding-plan-openai-compatible.zh.md`](./volcengine-coding-plan-openai-compatible.zh.md) for the Volcano migration design record.
15
+ Some provider / API paths expose similar endpoints or model capabilities while still requiring explicit provider quirk profiles. The built-in Codex (ChatGPT) provider enables `codex-anti-early-finalization` by default; it appends a work-language-specific reasoning-completion guard only to Codex provider `instructions` to reduce suspected early reasoning truncation / premature finalization on the ChatGPT/Codex path, and it does not apply to `apiType: openai`. Volcano Engine Ark Coding Plan now uses the OpenAI-compatible Chat Completions shape with its dedicated `/api/coding/v3` endpoint; the historical Anthropic-compatible Volcano tool-call quirks have been removed. Kimi Code also uses the OpenAI-compatible Chat Completions shape, but must use the built-in `kimi-code` provider's dedicated `/coding/v1` endpoint, versioned `KimiCLI/Dominds/<version>` User-Agent, `prompt_cache_key`, and Kimi-specific `thinking`/`reasoning_effort` request shaping. See [`volcengine-coding-plan-openai-compatible.zh.md`](./volcengine-coding-plan-openai-compatible.zh.md) for the Volcano migration design record.
16
16
 
17
17
  Similar field names across wrappers do not imply compatibility. For example, `reasoning_effort`, `verbosity`, `parallel_tool_calls`, and web search controls may look similar but can still differ in accepted values, payload shape, lifecycle events, validation rules, and runtime meaning.
18
18
 
@@ -12,7 +12,7 @@ Dominds 把每个 LLM provider wrapper 视为独立的协议适配器,而不
12
12
  - `apiType: anthropic` 只负责 Anthropic 官方 Messages 语义,包括 object 形态的 `model_params.anthropic.thinking`。
13
13
  - `apiType: anthropic-compatible` 负责 Anthropic 兼容网关语义,包括 boolean 形态的 `model_params.anthropic-compatible.thinking`,并映射为 provider 请求里的 `enabled` / `disabled` object。
14
14
 
15
- 某些 provider 虽然暴露 OpenAI-compatible Anthropic-compatible endpoint,但仍可能需要明确的 provider quirk profile。火山方舟 Coding Plan 现在走 OpenAI-compatible Chat Completions 形态,并使用专属 `/api/coding/v3` endpoint;历史 Anthropic-compatible 火山工具调用 quirk 已取消。Kimi Code 也走 OpenAI-compatible Chat Completions 形态,但必须使用内置 `kimi-code` provider 的专属 `/coding/v1` endpoint、带 Dominds 版本的 `KimiCLI/Dominds/<version>` User-Agent、`prompt_cache_key` 和 Kimi 专用 `thinking`/`reasoning_effort` 请求整形。火山迁移设计记录见 [`volcengine-coding-plan-openai-compatible.zh.md`](./volcengine-coding-plan-openai-compatible.zh.md)。
15
+ 某些 provider / API 路径虽然暴露相似 endpoint 或模型能力,但仍可能需要明确的 provider quirk profile。内置 Codex (ChatGPT) provider 默认启用 `codex-anti-early-finalization`,只在 Codex provider 的 `instructions` 里按当前工作语言追加推理完成检查提示,用于规避 ChatGPT/Codex 路径疑似思考过早截断/提前收尾的问题;这个 quirk 不应用到 `apiType: openai`。火山方舟 Coding Plan 现在走 OpenAI-compatible Chat Completions 形态,并使用专属 `/api/coding/v3` endpoint;历史 Anthropic-compatible 火山工具调用 quirk 已取消。Kimi Code 也走 OpenAI-compatible Chat Completions 形态,但必须使用内置 `kimi-code` provider 的专属 `/coding/v1` endpoint、带 Dominds 版本的 `KimiCLI/Dominds/<version>` User-Agent、`prompt_cache_key` 和 Kimi 专用 `thinking`/`reasoning_effort` 请求整形。火山迁移设计记录见 [`volcengine-coding-plan-openai-compatible.zh.md`](./volcengine-coding-plan-openai-compatible.zh.md)。
16
16
 
17
17
  不同 wrapper 下看起来同名的字段,不代表它们可以互相兼容。比如 `reasoning_effort`、`verbosity`、`parallel_tool_calls`、web search 相关开关,名字可能相似,但可接受值、请求载荷形状、流事件生命周期、校验规则和运行时含义都可能不同。
18
18
 
@@ -6,6 +6,7 @@ export type LlmFailureKind = 'retriable' | 'rejected' | 'fatal';
6
6
  export declare const KIMI_CODE_API_QUIRK = "kimi-code";
7
7
  export declare const MINIMAX_REASONING_DETAILS_API_QUIRK = "minimax-reasoning-details";
8
8
  export declare const MINIMAX_THINKING_TYPE_API_QUIRK = "minimax-thinking-type";
9
+ export declare const CODEX_ANTI_EARLY_FINALIZATION_API_QUIRK = "codex-anti-early-finalization";
9
10
  export declare const SAME_CONTEXT_EMPTY_RESPONSE_API_QUIRK = "same-context-empty-response";
10
11
  export declare const VOLCENGINE_INVALID_PARAMETER_AGGRESSIVE_RETRY_API_QUIRK = "volcengine-invalid-parameter-aggressive-retry";
11
12
  export type LlmFailureSummary = {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.XCODE_BEST_STREAM_INTERNAL_ERROR_CODE = exports.VOLCENGINE_INVALID_PARAMETER_AGGRESSIVE_RETRY_API_QUIRK = exports.SAME_CONTEXT_EMPTY_RESPONSE_API_QUIRK = exports.MINIMAX_THINKING_TYPE_API_QUIRK = exports.MINIMAX_REASONING_DETAILS_API_QUIRK = exports.KIMI_CODE_API_QUIRK = void 0;
3
+ exports.XCODE_BEST_STREAM_INTERNAL_ERROR_CODE = exports.VOLCENGINE_INVALID_PARAMETER_AGGRESSIVE_RETRY_API_QUIRK = exports.SAME_CONTEXT_EMPTY_RESPONSE_API_QUIRK = exports.CODEX_ANTI_EARLY_FINALIZATION_API_QUIRK = exports.MINIMAX_THINKING_TYPE_API_QUIRK = exports.MINIMAX_REASONING_DETAILS_API_QUIRK = exports.KIMI_CODE_API_QUIRK = void 0;
4
4
  exports.normalizeProviderApiQuirks = normalizeProviderApiQuirks;
5
5
  exports.createLlmFailureQuirkHandlerSession = createLlmFailureQuirkHandlerSession;
6
6
  const persistence_errors_1 = require("../persistence-errors");
@@ -8,6 +8,7 @@ exports.KIMI_CODE_API_QUIRK = 'kimi-code';
8
8
  exports.MINIMAX_REASONING_DETAILS_API_QUIRK = 'minimax-reasoning-details';
9
9
  // MiniMax's `/v1` API rejects `thinking.type: 'enabled'`; rewrites the request `thinking` form to use `adaptive` instead.
10
10
  exports.MINIMAX_THINKING_TYPE_API_QUIRK = 'minimax-thinking-type';
11
+ exports.CODEX_ANTI_EARLY_FINALIZATION_API_QUIRK = 'codex-anti-early-finalization';
11
12
  exports.SAME_CONTEXT_EMPTY_RESPONSE_API_QUIRK = 'same-context-empty-response';
12
13
  exports.VOLCENGINE_INVALID_PARAMETER_AGGRESSIVE_RETRY_API_QUIRK = 'volcengine-invalid-parameter-aggressive-retry';
13
14
  const DOMINDS_LLM_EMPTY_RESPONSE_ERROR_CODE = 'DOMINDS_LLM_EMPTY_RESPONSE';
@@ -56,8 +56,9 @@ export type ProviderModelParamOptions = {
56
56
  'openai-compatible'?: Record<string, ModelParamOption>;
57
57
  anthropic?: Record<string, ModelParamOption>;
58
58
  'anthropic-compatible'?: Record<string, ModelParamOption>;
59
+ google?: Record<string, ModelParamOption>;
59
60
  };
60
- export type ProviderApiType = 'codex' | 'anthropic' | 'anthropic-compatible' | 'mock' | 'openai' | 'openai-compatible';
61
+ export type ProviderApiType = 'mock' | 'anthropic' | 'anthropic-compatible' | 'openai' | 'openai-compatible' | 'codex' | 'google';
61
62
  export type ProviderConfig = {
62
63
  name: string;
63
64
  apiType: ProviderApiType;
@@ -6,8 +6,8 @@
6
6
  # - llm_retry_conservative_delay_ms: base delay for provider-classified conservative retries (default 30000; fixed for first 10 retries, then ramps by x1.5 with the normal max-delay cap).
7
7
  # - llm_retry_backoff_multiplier: exponential factor between retries (default 1.5).
8
8
  # - llm_retry_max_delay_ms: upper bound for retry delay (default 1800000 / 30m).
9
- # - apiQuirks: optional provider/gateway quirk profile(s) for non-standard transport behavior
10
- # and provider-specific failure handling that can override the driver's default retry disposition.
9
+ # - apiQuirks: optional provider/gateway quirk profile(s) for non-standard transport behavior,
10
+ # request shaping, and provider-specific failure handling that can override the driver's default retry disposition.
11
11
  # Example: `apiQuirks: xcode.best` currently covers both keepalive/heartbeat stream quirks and
12
12
  # repeated empty-response deadlock detection for the same unchanged dialog context, plus conservative retry
13
13
  # classification for gateway-returned HTML 502 Bad Gateway pages and
@@ -17,13 +17,109 @@
17
17
  # `apiQuirks: volcengine-invalid-parameter-aggressive-retry` classifies Volcano Ark Coding Plan
18
18
  # transient `400 InvalidParameter` failures as aggressive retry when the shape matches that
19
19
  # provider's replay-successful instability.
20
+ # `apiQuirks: codex-anti-early-finalization` is Codex-provider-only request shaping that appends
21
+ # a work-language-specific reasoning-completion guard to ChatGPT/Codex instructions to reduce
22
+ # early-finalization / suspiciously short reasoning runs. It is intentionally not applied to the
23
+ # OpenAI API provider.
20
24
  # - tool_result_max_chars: optional transport-level cap for a single tool-result text payload
21
25
  # before Dominds projects it into the provider request. Use this when a provider/gateway enforces
22
26
  # a stricter per-item string limit than Dominds' built-in defaults.
23
27
  providers:
28
+ google:
29
+ name: Google Gemini
30
+ apiType: google
31
+ baseUrl: https://generativelanguage.googleapis.com
32
+ apiKeyEnvVar: GEMINI_API_KEY
33
+ tech_spec_url: https://ai.google.dev/gemini-api/docs
34
+ api_mgmt_url: https://aistudio.google.com/
35
+ model_param_options:
36
+ google:
37
+ thinking:
38
+ prominent: true
39
+ type: boolean
40
+ description: Enable or disable model internal reasoning/thinking.
41
+ thinking_budget:
42
+ type: integer
43
+ min: 0
44
+ description: Budget for thinking tokens. Leave unset to use the model's default adaptive/dynamic thinking.
45
+ temperature:
46
+ type: number
47
+ min: 0
48
+ max: 2
49
+ description: Sampling temperature (0–2).
50
+ top_p:
51
+ type: number
52
+ min: 0
53
+ max: 1
54
+ description: Nucleus sampling probability (0–1).
55
+ google_search_tool:
56
+ prominent: true
57
+ type: boolean
58
+ default: true
59
+ description: Enable Gemini Google Search Grounding to access real-time internet data.
60
+ models:
61
+ gemini-3.5-flash:
62
+ name: Gemini 3.5 Flash
63
+ optimal_max_tokens: 300000
64
+ supports_thinking: true
65
+ default_thinking: true
66
+ context_length: 1048576
67
+ input_length: 1048576
68
+ output_length: 65536
69
+ context_window: '1M'
70
+ gemini-3.1-pro:
71
+ name: Gemini 3.1 Pro
72
+ optimal_max_tokens: 500000
73
+ supports_thinking: true
74
+ default_thinking: true
75
+ context_length: 2097152
76
+ input_length: 2097152
77
+ output_length: 65536
78
+ context_window: '2M'
79
+ gemini-2.5-flash:
80
+ name: Gemini 2.5 Flash
81
+ optimal_max_tokens: 300000
82
+ supports_thinking: true
83
+ default_thinking: true
84
+ context_length: 1048576
85
+ input_length: 1048576
86
+ output_length: 65536
87
+ context_window: '1M'
88
+ gemini-2.5-pro:
89
+ name: Gemini 2.5 Pro
90
+ optimal_max_tokens: 500000
91
+ supports_thinking: true
92
+ default_thinking: true
93
+ context_length: 2097152
94
+ input_length: 2097152
95
+ output_length: 65536
96
+ context_window: '2M'
97
+ gemini-1.5-flash:
98
+ name: Gemini 1.5 Flash
99
+ optimal_max_tokens: 300000
100
+ supports_thinking: false
101
+ default_thinking: false
102
+ context_length: 1048576
103
+ input_length: 1048576
104
+ output_length: 8192
105
+ context_window: '1M'
106
+ gemini-1.5-pro:
107
+ name: Gemini 1.5 Pro
108
+ optimal_max_tokens: 500000
109
+ supports_thinking: false
110
+ default_thinking: false
111
+ context_length: 2097152
112
+ input_length: 2097152
113
+ output_length: 8192
114
+ context_window: '2M'
24
115
  codex:
25
116
  name: Codex (ChatGPT)
26
117
  apiType: codex
118
+ # Product auth policy: this provider accepts only managed, refreshable ChatGPT OAuth file
119
+ # auth. Do not widen it automatically when syncing codex-rs auth modes; direct other auth
120
+ # methods to a custom `apiType: openai` Responses provider or a Dominds feature request.
121
+ apiQuirks:
122
+ - codex-anti-early-finalization
27
123
  baseUrl: https://chatgpt.com/backend-api/
28
124
  apiKeyEnvVar: CODEX_HOME
29
125
  tech_spec_url: https://platform.openai.com/docs/api-reference/responses
@@ -41,10 +137,10 @@ providers:
41
137
  prominent: true
42
138
  default: high
43
139
  # Trade latency/cost for quality on reasoning-capable models.
44
- # Allowed: none | minimal | low | medium | high | xhigh
140
+ # Allowed: none | minimal | low | medium | high | xhigh | max | ultra
45
141
  type: enum
46
- values: [none, minimal, low, medium, high, xhigh]
47
- description: Reasoning effort level (when supported by the model).
142
+ values: [none, minimal, low, medium, high, xhigh, max, ultra]
143
+ description: Reasoning effort level. For GPT-5.6 Sol/Terra, ultra is a Codex orchestration preset and is sent to inference as max, matching codex-rs.
48
144
  reasoning_summary:
49
145
  type: enum
50
146
  default: auto
@@ -95,6 +191,30 @@ providers:
95
191
  type: boolean
96
192
  description: Force JSON object output mode.
97
193
  models:
194
+ gpt-5.6-sol:
195
+ name: GPT-5.6 Sol
196
+ optimal_max_tokens: 200000
197
+ caution_remediation_cadence_generations: 10
198
+ context_length: 272000
199
+ input_length: 272000
200
+ output_length: 32768
201
+ context_window: '272K'
202
+ gpt-5.6-terra:
203
+ name: GPT-5.6 Terra
204
+ optimal_max_tokens: 200000
205
+ caution_remediation_cadence_generations: 10
206
+ context_length: 272000
207
+ input_length: 272000
208
+ output_length: 32768
209
+ context_window: '272K'
210
+ gpt-5.6-luna:
211
+ name: GPT-5.6 Luna
212
+ optimal_max_tokens: 200000
213
+ caution_remediation_cadence_generations: 10
214
+ context_length: 272000
215
+ input_length: 272000
216
+ output_length: 32768
217
+ context_window: '272K'
98
218
  gpt-5.5:
99
219
  name: GPT-5.5
100
220
  optimal_max_tokens: 200000
@@ -923,9 +1043,9 @@ providers:
923
1043
  prominent: true
924
1044
  default: high
925
1045
  # Trade latency/cost for quality on reasoning-capable models.
926
- # Allowed: none | minimal | low | medium | high | xhigh
1046
+ # Allowed: none | minimal | low | medium | high | xhigh | max
927
1047
  type: enum
928
- values: [none, minimal, low, medium, high, xhigh]
1048
+ values: [none, minimal, low, medium, high, xhigh, max]
929
1049
  description: Reasoning effort level (when supported by the model).
930
1050
  reasoning_summary:
931
1051
  type: enum
@@ -994,6 +1114,42 @@ providers:
994
1114
  type: boolean
995
1115
  description: Include `web_search_call.action.sources` in the response payload.
996
1116
  models:
1117
+ gpt-5.6:
1118
+ name: GPT-5.6 Sol (alias)
1119
+ optimal_max_tokens: 600000
1120
+ critical_max_tokens: 922000
1121
+ caution_remediation_cadence_generations: 10
1122
+ context_length: 1050000
1123
+ input_length: 1050000
1124
+ output_length: 128000
1125
+ context_window: '1.05M'
1126
+ gpt-5.6-sol:
1127
+ name: GPT-5.6 Sol
1128
+ optimal_max_tokens: 600000
1129
+ critical_max_tokens: 922000
1130
+ caution_remediation_cadence_generations: 10
1131
+ context_length: 1050000
1132
+ input_length: 1050000
1133
+ output_length: 128000
1134
+ context_window: '1.05M'
1135
+ gpt-5.6-terra:
1136
+ name: GPT-5.6 Terra
1137
+ optimal_max_tokens: 600000
1138
+ critical_max_tokens: 922000
1139
+ caution_remediation_cadence_generations: 10
1140
+ context_length: 1050000
1141
+ input_length: 1050000
1142
+ output_length: 128000
1143
+ context_window: '1.05M'
1144
+ gpt-5.6-luna:
1145
+ name: GPT-5.6 Luna
1146
+ optimal_max_tokens: 600000
1147
+ critical_max_tokens: 922000
1148
+ caution_remediation_cadence_generations: 10
1149
+ context_length: 1050000
1150
+ input_length: 1050000
1151
+ output_length: 128000
1152
+ context_window: '1.05M'
997
1153
  gpt-5.5:
998
1154
  name: GPT-5.5
999
1155
  optimal_max_tokens: 200000
@@ -5,7 +5,7 @@
5
5
  * Isolation principle: this wrapper owns Codex-native request/stream semantics and must not reuse
6
6
  * OpenAI Responses parameter namespaces or event interpretations.
7
7
  */
8
- import type { ChatGptResponsesRequest, ChatGptTool } from '@longrun-ai/codex-auth';
8
+ import type { ChatGptReasoningEffort, ChatGptResponsesRequest, ChatGptTool } from '@longrun-ai/codex-auth';
9
9
  import type { Team } from '../../team';
10
10
  import type { FuncTool } from '../../tool';
11
11
  import type { ChatMessage, ProviderConfig } from '../client';
@@ -13,7 +13,8 @@ import type { LlmBatchResult, LlmFailureDisposition, LlmGenerator, LlmRequestCon
13
13
  type CodexToolChoice = 'none' | 'auto' | 'required';
14
14
  export declare function resolveCodexToolChoice(tools: readonly ChatGptTool[], requestContext: LlmRequestContext): CodexToolChoice;
15
15
  export declare function resolveCodexServiceTier(serviceTier: ChatGptResponsesRequest['service_tier'] | undefined): Exclude<NonNullable<ChatGptResponsesRequest['service_tier']>, 'default'> | undefined;
16
- export declare function resolveCodexInstructions(systemPrompt: string): string;
16
+ export declare function resolveCodexInstructions(systemPrompt: string, providerConfig?: ProviderConfig): string;
17
+ export declare function resolveCodexReasoningEffortForRequest(model: string, reasoningEffort: NonNullable<Team.ModelParams['codex']>['reasoning_effort']): ChatGptReasoningEffort | undefined;
17
18
  export declare class CodexGen implements LlmGenerator {
18
19
  get apiType(): string;
19
20
  classifyFailure(error: unknown): LlmFailureDisposition | undefined;