@wingman-ai/gateway 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.wingman/agents/coding/agent.md +174 -169
- package/.wingman/agents/coding/implementor.md +25 -1
- package/.wingman/agents/main/agent.md +4 -0
- package/README.md +1 -0
- package/dist/agent/config/agentConfig.cjs +1 -1
- package/dist/agent/config/agentConfig.js +1 -1
- package/dist/agent/config/modelFactory.cjs +22 -2
- package/dist/agent/config/modelFactory.d.ts +2 -0
- package/dist/agent/config/modelFactory.js +22 -2
- package/dist/agent/tests/modelFactory.test.cjs +12 -5
- package/dist/agent/tests/modelFactory.test.js +12 -5
- package/dist/cli/commands/init.cjs +7 -6
- package/dist/cli/commands/init.js +7 -6
- package/dist/cli/commands/provider.cjs +17 -3
- package/dist/cli/commands/provider.js +17 -3
- package/dist/cli/config/loader.cjs +27 -0
- package/dist/cli/config/loader.js +27 -0
- package/dist/cli/config/schema.cjs +80 -2
- package/dist/cli/config/schema.d.ts +88 -0
- package/dist/cli/config/schema.js +67 -1
- package/dist/cli/core/agentInvoker.cjs +191 -13
- package/dist/cli/core/agentInvoker.d.ts +42 -3
- package/dist/cli/core/agentInvoker.js +163 -9
- package/dist/cli/core/sessionManager.cjs +32 -5
- package/dist/cli/core/sessionManager.js +32 -5
- package/dist/cli/index.cjs +6 -5
- package/dist/cli/index.js +6 -5
- package/dist/cli/types.d.ts +32 -0
- package/dist/gateway/http/sessions.cjs +7 -7
- package/dist/gateway/http/sessions.js +7 -7
- package/dist/gateway/server.cjs +191 -41
- package/dist/gateway/server.d.ts +8 -1
- package/dist/gateway/server.js +191 -41
- package/dist/gateway/types.d.ts +1 -0
- package/dist/providers/codex.cjs +167 -0
- package/dist/providers/codex.d.ts +15 -0
- package/dist/providers/codex.js +127 -0
- package/dist/providers/credentials.cjs +8 -0
- package/dist/providers/credentials.js +8 -0
- package/dist/providers/registry.cjs +11 -0
- package/dist/providers/registry.d.ts +1 -1
- package/dist/providers/registry.js +11 -0
- package/dist/tests/agentInvokerSummarization.test.cjs +296 -0
- package/dist/tests/agentInvokerSummarization.test.d.ts +1 -0
- package/dist/tests/agentInvokerSummarization.test.js +290 -0
- package/dist/tests/cli-config-loader.test.cjs +88 -0
- package/dist/tests/cli-config-loader.test.js +88 -0
- package/dist/tests/codex-credentials-precedence.test.cjs +94 -0
- package/dist/tests/codex-credentials-precedence.test.d.ts +1 -0
- package/dist/tests/codex-credentials-precedence.test.js +88 -0
- package/dist/tests/codex-provider.test.cjs +186 -0
- package/dist/tests/codex-provider.test.d.ts +1 -0
- package/dist/tests/codex-provider.test.js +180 -0
- package/dist/tests/gateway.test.cjs +108 -1
- package/dist/tests/gateway.test.js +108 -1
- package/dist/tests/provider-command-codex.test.cjs +57 -0
- package/dist/tests/provider-command-codex.test.d.ts +1 -0
- package/dist/tests/provider-command-codex.test.js +51 -0
- package/dist/tests/sessionStateMessages.test.cjs +38 -0
- package/dist/tests/sessionStateMessages.test.js +38 -0
- package/dist/webui/assets/{index-DDsMIOTX.css → index-BVMavpud.css} +1 -1
- package/dist/webui/assets/index-DCB2aVVf.js +182 -0
- package/dist/webui/index.html +2 -2
- package/package.json +1 -1
- package/dist/webui/assets/index-CPhfGPHc.js +0 -182
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_exports__ = {};
|
|
3
|
-
const external_vitest_namespaceObject = require("vitest");
|
|
4
|
-
const modelFactory_cjs_namespaceObject = require("../config/modelFactory.cjs");
|
|
5
3
|
const anthropic_namespaceObject = require("@langchain/anthropic");
|
|
6
4
|
const openai_namespaceObject = require("@langchain/openai");
|
|
5
|
+
const external_vitest_namespaceObject = require("vitest");
|
|
6
|
+
const modelFactory_cjs_namespaceObject = require("../config/modelFactory.cjs");
|
|
7
7
|
const originalAnthropicApiKey = process.env.ANTHROPIC_API_KEY;
|
|
8
8
|
(0, external_vitest_namespaceObject.beforeEach)(()=>{
|
|
9
9
|
process.env.ANTHROPIC_API_KEY = "test-anthropic-api-key";
|
|
@@ -22,6 +22,10 @@ const originalAnthropicApiKey = process.env.ANTHROPIC_API_KEY;
|
|
|
22
22
|
const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("openai:gpt-4o");
|
|
23
23
|
(0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(openai_namespaceObject.ChatOpenAI);
|
|
24
24
|
});
|
|
25
|
+
(0, external_vitest_namespaceObject.it)("should create a Codex model", ()=>{
|
|
26
|
+
const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("codex:codex-mini-latest");
|
|
27
|
+
(0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(openai_namespaceObject.ChatOpenAI);
|
|
28
|
+
});
|
|
25
29
|
(0, external_vitest_namespaceObject.it)("should force OpenAI models onto the responses API", ()=>{
|
|
26
30
|
const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("openai:gpt-5.2-codex");
|
|
27
31
|
(0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(openai_namespaceObject.ChatOpenAI);
|
|
@@ -79,6 +83,7 @@ const originalAnthropicApiKey = process.env.ANTHROPIC_API_KEY;
|
|
|
79
83
|
const validModels = [
|
|
80
84
|
"anthropic:claude-opus-4-5",
|
|
81
85
|
"openai:gpt-4o",
|
|
86
|
+
"codex:codex-mini-latest",
|
|
82
87
|
"anthropic:claude-sonnet-4-5-20250929",
|
|
83
88
|
"openrouter:openai/gpt-4o",
|
|
84
89
|
"copilot:gpt-4o",
|
|
@@ -115,14 +120,16 @@ const originalAnthropicApiKey = process.env.ANTHROPIC_API_KEY;
|
|
|
115
120
|
(0, external_vitest_namespaceObject.it)("should accept case variations of providers", ()=>{
|
|
116
121
|
const result1 = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString("Anthropic:model");
|
|
117
122
|
const result2 = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString("OPENAI:model");
|
|
118
|
-
const result3 = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString("
|
|
119
|
-
const result4 = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString("
|
|
120
|
-
const result5 = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString("
|
|
123
|
+
const result3 = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString("CODEX:model");
|
|
124
|
+
const result4 = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString("Copilot:model");
|
|
125
|
+
const result5 = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString("LMStudio:model");
|
|
126
|
+
const result6 = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString("OLLAMA:model");
|
|
121
127
|
(0, external_vitest_namespaceObject.expect)(result1.valid).toBe(true);
|
|
122
128
|
(0, external_vitest_namespaceObject.expect)(result2.valid).toBe(true);
|
|
123
129
|
(0, external_vitest_namespaceObject.expect)(result3.valid).toBe(true);
|
|
124
130
|
(0, external_vitest_namespaceObject.expect)(result4.valid).toBe(true);
|
|
125
131
|
(0, external_vitest_namespaceObject.expect)(result5.valid).toBe(true);
|
|
132
|
+
(0, external_vitest_namespaceObject.expect)(result6.valid).toBe(true);
|
|
126
133
|
});
|
|
127
134
|
});
|
|
128
135
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
2
|
-
import { ModelFactory } from "../config/modelFactory.js";
|
|
3
1
|
import { ChatAnthropic } from "@langchain/anthropic";
|
|
4
2
|
import { ChatOpenAI } from "@langchain/openai";
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
4
|
+
import { ModelFactory } from "../config/modelFactory.js";
|
|
5
5
|
const originalAnthropicApiKey = process.env.ANTHROPIC_API_KEY;
|
|
6
6
|
beforeEach(()=>{
|
|
7
7
|
process.env.ANTHROPIC_API_KEY = "test-anthropic-api-key";
|
|
@@ -20,6 +20,10 @@ describe("ModelFactory", ()=>{
|
|
|
20
20
|
const model = ModelFactory.createModel("openai:gpt-4o");
|
|
21
21
|
expect(model).toBeInstanceOf(ChatOpenAI);
|
|
22
22
|
});
|
|
23
|
+
it("should create a Codex model", ()=>{
|
|
24
|
+
const model = ModelFactory.createModel("codex:codex-mini-latest");
|
|
25
|
+
expect(model).toBeInstanceOf(ChatOpenAI);
|
|
26
|
+
});
|
|
23
27
|
it("should force OpenAI models onto the responses API", ()=>{
|
|
24
28
|
const model = ModelFactory.createModel("openai:gpt-5.2-codex");
|
|
25
29
|
expect(model).toBeInstanceOf(ChatOpenAI);
|
|
@@ -77,6 +81,7 @@ describe("ModelFactory", ()=>{
|
|
|
77
81
|
const validModels = [
|
|
78
82
|
"anthropic:claude-opus-4-5",
|
|
79
83
|
"openai:gpt-4o",
|
|
84
|
+
"codex:codex-mini-latest",
|
|
80
85
|
"anthropic:claude-sonnet-4-5-20250929",
|
|
81
86
|
"openrouter:openai/gpt-4o",
|
|
82
87
|
"copilot:gpt-4o",
|
|
@@ -113,14 +118,16 @@ describe("ModelFactory", ()=>{
|
|
|
113
118
|
it("should accept case variations of providers", ()=>{
|
|
114
119
|
const result1 = ModelFactory.validateModelString("Anthropic:model");
|
|
115
120
|
const result2 = ModelFactory.validateModelString("OPENAI:model");
|
|
116
|
-
const result3 = ModelFactory.validateModelString("
|
|
117
|
-
const result4 = ModelFactory.validateModelString("
|
|
118
|
-
const result5 = ModelFactory.validateModelString("
|
|
121
|
+
const result3 = ModelFactory.validateModelString("CODEX:model");
|
|
122
|
+
const result4 = ModelFactory.validateModelString("Copilot:model");
|
|
123
|
+
const result5 = ModelFactory.validateModelString("LMStudio:model");
|
|
124
|
+
const result6 = ModelFactory.validateModelString("OLLAMA:model");
|
|
119
125
|
expect(result1.valid).toBe(true);
|
|
120
126
|
expect(result2.valid).toBe(true);
|
|
121
127
|
expect(result3.valid).toBe(true);
|
|
122
128
|
expect(result4.valid).toBe(true);
|
|
123
129
|
expect(result5.valid).toBe(true);
|
|
130
|
+
expect(result6.valid).toBe(true);
|
|
124
131
|
});
|
|
125
132
|
});
|
|
126
133
|
});
|
|
@@ -41,15 +41,15 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
41
41
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
42
42
|
const external_node_path_namespaceObject = require("node:path");
|
|
43
43
|
const external_node_url_namespaceObject = require("node:url");
|
|
44
|
+
const prompts_namespaceObject = require("@clack/prompts");
|
|
44
45
|
const external_chalk_namespaceObject = require("chalk");
|
|
45
46
|
var external_chalk_default = /*#__PURE__*/ __webpack_require__.n(external_chalk_namespaceObject);
|
|
46
|
-
const
|
|
47
|
-
const outputManager_cjs_namespaceObject = require("../core/outputManager.cjs");
|
|
48
|
-
const schema_cjs_namespaceObject = require("../config/schema.cjs");
|
|
47
|
+
const modelFactory_cjs_namespaceObject = require("../../agent/config/modelFactory.cjs");
|
|
49
48
|
const external_logger_cjs_namespaceObject = require("../../logger.cjs");
|
|
50
|
-
const registry_cjs_namespaceObject = require("../../providers/registry.cjs");
|
|
51
49
|
const credentials_cjs_namespaceObject = require("../../providers/credentials.cjs");
|
|
52
|
-
const
|
|
50
|
+
const registry_cjs_namespaceObject = require("../../providers/registry.cjs");
|
|
51
|
+
const schema_cjs_namespaceObject = require("../config/schema.cjs");
|
|
52
|
+
const outputManager_cjs_namespaceObject = require("../core/outputManager.cjs");
|
|
53
53
|
const DEFAULT_AGENT_ID = "wingman";
|
|
54
54
|
const DEFAULT_AGENT_DESCRIPTION = "General-purpose coding assistant for this workspace.";
|
|
55
55
|
const DEFAULT_AGENT_PROMPT = "You are Wingman, a coding assistant for this repository.\nBe direct and concise. Ask clarifying questions when requirements are unclear.\nPrefer minimal diffs and safe changes. Avoid destructive actions unless asked.\nUse tools to inspect the codebase before editing.";
|
|
@@ -64,6 +64,7 @@ const DEFAULT_FS_ROOT = ".";
|
|
|
64
64
|
const DEFAULT_MODELS = {
|
|
65
65
|
anthropic: "anthropic:claude-sonnet-4-5",
|
|
66
66
|
openai: "openai:gpt-4o",
|
|
67
|
+
codex: "codex:codex-mini-latest",
|
|
67
68
|
openrouter: "openrouter:openai/gpt-4o",
|
|
68
69
|
copilot: "copilot:gpt-4o",
|
|
69
70
|
xai: "xai:grok-beta"
|
|
@@ -649,7 +650,7 @@ Options:
|
|
|
649
650
|
--agents <list> Copy only these bundled agents (comma-separated)
|
|
650
651
|
--model <provider:model>
|
|
651
652
|
Set model for the starter agent
|
|
652
|
-
--provider <name> Provider to configure (anthropic|openai|openrouter|copilot|xai)
|
|
653
|
+
--provider <name> Provider to configure (anthropic|openai|codex|openrouter|copilot|xai)
|
|
653
654
|
--token <token> Save provider token (non-interactive)
|
|
654
655
|
--api-key <key> Alias for --token
|
|
655
656
|
--fs-root <path> Add fs root (default: ".")
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
import chalk from "chalk";
|
|
5
4
|
import { cancel, confirm as prompts_confirm, intro, isCancel, multiselect, note, outro, select as prompts_select, spinner, text as prompts_text } from "@clack/prompts";
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import { ModelFactory } from "../../agent/config/modelFactory.js";
|
|
8
7
|
import { createLogger, getLogFilePath } from "../../logger.js";
|
|
9
|
-
import { listProviderSpecs, normalizeProviderName } from "../../providers/registry.js";
|
|
10
8
|
import { getCredentialsPath, resolveProviderToken, saveProviderToken } from "../../providers/credentials.js";
|
|
11
|
-
import {
|
|
9
|
+
import { listProviderSpecs, normalizeProviderName } from "../../providers/registry.js";
|
|
10
|
+
import { WingmanConfigSchema } from "../config/schema.js";
|
|
11
|
+
import { OutputManager } from "../core/outputManager.js";
|
|
12
12
|
const DEFAULT_AGENT_ID = "wingman";
|
|
13
13
|
const DEFAULT_AGENT_DESCRIPTION = "General-purpose coding assistant for this workspace.";
|
|
14
14
|
const DEFAULT_AGENT_PROMPT = "You are Wingman, a coding assistant for this repository.\nBe direct and concise. Ask clarifying questions when requirements are unclear.\nPrefer minimal diffs and safe changes. Avoid destructive actions unless asked.\nUse tools to inspect the codebase before editing.";
|
|
@@ -23,6 +23,7 @@ const DEFAULT_FS_ROOT = ".";
|
|
|
23
23
|
const DEFAULT_MODELS = {
|
|
24
24
|
anthropic: "anthropic:claude-sonnet-4-5",
|
|
25
25
|
openai: "openai:gpt-4o",
|
|
26
|
+
codex: "codex:codex-mini-latest",
|
|
26
27
|
openrouter: "openrouter:openai/gpt-4o",
|
|
27
28
|
copilot: "copilot:gpt-4o",
|
|
28
29
|
xai: "xai:grok-beta"
|
|
@@ -608,7 +609,7 @@ Options:
|
|
|
608
609
|
--agents <list> Copy only these bundled agents (comma-separated)
|
|
609
610
|
--model <provider:model>
|
|
610
611
|
Set model for the starter agent
|
|
611
|
-
--provider <name> Provider to configure (anthropic|openai|openrouter|copilot|xai)
|
|
612
|
+
--provider <name> Provider to configure (anthropic|openai|codex|openrouter|copilot|xai)
|
|
612
613
|
--token <token> Save provider token (non-interactive)
|
|
613
614
|
--api-key <key> Alias for --token
|
|
614
615
|
--fs-root <path> Add fs root (default: ".")
|
|
@@ -27,11 +27,12 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
27
27
|
executeProviderCommand: ()=>executeProviderCommand
|
|
28
28
|
});
|
|
29
29
|
const external_node_readline_namespaceObject = require("node:readline");
|
|
30
|
-
const
|
|
30
|
+
const external_logger_cjs_namespaceObject = require("../../logger.cjs");
|
|
31
|
+
const codex_cjs_namespaceObject = require("../../providers/codex.cjs");
|
|
31
32
|
const credentials_cjs_namespaceObject = require("../../providers/credentials.cjs");
|
|
32
|
-
const registry_cjs_namespaceObject = require("../../providers/registry.cjs");
|
|
33
33
|
const oauth_cjs_namespaceObject = require("../../providers/oauth.cjs");
|
|
34
|
-
const
|
|
34
|
+
const registry_cjs_namespaceObject = require("../../providers/registry.cjs");
|
|
35
|
+
const outputManager_cjs_namespaceObject = require("../core/outputManager.cjs");
|
|
35
36
|
async function executeProviderCommand(args) {
|
|
36
37
|
const outputManager = new outputManager_cjs_namespaceObject.OutputManager(args.outputMode);
|
|
37
38
|
try {
|
|
@@ -82,6 +83,16 @@ async function handleLogin(outputManager, args) {
|
|
|
82
83
|
writeLine(outputManager, `Saved ${provider.label} credentials to ${(0, credentials_cjs_namespaceObject.getCredentialsPath)()}`);
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
86
|
+
if ("codex" === provider.name) {
|
|
87
|
+
const codexAuth = (0, codex_cjs_namespaceObject.resolveCodexAuthFromFile)();
|
|
88
|
+
if (codexAuth.accessToken) return void writeLine(outputManager, `Detected Codex login at ${codexAuth.authPath}. Wingman will use it automatically.`);
|
|
89
|
+
if ("interactive" !== outputManager.getMode()) throw new Error(`Codex login not found at ${codexAuth.authPath}. Run "codex login" or pass --token.`);
|
|
90
|
+
writeLine(outputManager, `No Codex login found at ${codexAuth.authPath}.`);
|
|
91
|
+
const resolvedToken = await promptForToken(`Enter ${provider.label} token: `);
|
|
92
|
+
(0, credentials_cjs_namespaceObject.saveProviderToken)(provider.name, resolvedToken);
|
|
93
|
+
writeLine(outputManager, `Saved ${provider.label} credentials to ${(0, credentials_cjs_namespaceObject.getCredentialsPath)()}`);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
85
96
|
if ("oauth" === provider.type) {
|
|
86
97
|
const credentials = await (0, oauth_cjs_namespaceObject.loginWithLocalCallback)(provider.name, {
|
|
87
98
|
clientId: getOptionValue(args.options, "client-id"),
|
|
@@ -132,6 +143,7 @@ Usage:
|
|
|
132
143
|
Examples:
|
|
133
144
|
wingman provider status
|
|
134
145
|
wingman provider login copilot
|
|
146
|
+
wingman provider login codex
|
|
135
147
|
wingman provider login openrouter --api-key="<key>"
|
|
136
148
|
wingman provider login lmstudio
|
|
137
149
|
wingman provider login ollama
|
|
@@ -143,6 +155,8 @@ Options:
|
|
|
143
155
|
Environment Variables:
|
|
144
156
|
ANTHROPIC_API_KEY Anthropic API key
|
|
145
157
|
OPENAI_API_KEY OpenAI API key
|
|
158
|
+
CODEX_ACCESS_TOKEN OpenAI Codex ChatGPT access token
|
|
159
|
+
CHATGPT_ACCESS_TOKEN OpenAI Codex ChatGPT access token
|
|
146
160
|
OPENROUTER_API_KEY OpenRouter API key
|
|
147
161
|
GITHUB_COPILOT_TOKEN GitHub Copilot token
|
|
148
162
|
COPILOT_TOKEN GitHub Copilot token
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createInterface } from "node:readline";
|
|
2
|
-
import {
|
|
2
|
+
import { createLogger, getLogFilePath } from "../../logger.js";
|
|
3
|
+
import { resolveCodexAuthFromFile } from "../../providers/codex.js";
|
|
3
4
|
import { deleteProviderCredentials, getCredentialsPath, resolveProviderToken, saveProviderToken, setProviderCredentials } from "../../providers/credentials.js";
|
|
4
|
-
import { getProviderSpec, listProviderSpecs } from "../../providers/registry.js";
|
|
5
5
|
import { loginWithLocalCallback } from "../../providers/oauth.js";
|
|
6
|
-
import {
|
|
6
|
+
import { getProviderSpec, listProviderSpecs } from "../../providers/registry.js";
|
|
7
|
+
import { OutputManager } from "../core/outputManager.js";
|
|
7
8
|
async function executeProviderCommand(args) {
|
|
8
9
|
const outputManager = new OutputManager(args.outputMode);
|
|
9
10
|
try {
|
|
@@ -54,6 +55,16 @@ async function handleLogin(outputManager, args) {
|
|
|
54
55
|
writeLine(outputManager, `Saved ${provider.label} credentials to ${getCredentialsPath()}`);
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
58
|
+
if ("codex" === provider.name) {
|
|
59
|
+
const codexAuth = resolveCodexAuthFromFile();
|
|
60
|
+
if (codexAuth.accessToken) return void writeLine(outputManager, `Detected Codex login at ${codexAuth.authPath}. Wingman will use it automatically.`);
|
|
61
|
+
if ("interactive" !== outputManager.getMode()) throw new Error(`Codex login not found at ${codexAuth.authPath}. Run "codex login" or pass --token.`);
|
|
62
|
+
writeLine(outputManager, `No Codex login found at ${codexAuth.authPath}.`);
|
|
63
|
+
const resolvedToken = await promptForToken(`Enter ${provider.label} token: `);
|
|
64
|
+
saveProviderToken(provider.name, resolvedToken);
|
|
65
|
+
writeLine(outputManager, `Saved ${provider.label} credentials to ${getCredentialsPath()}`);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
57
68
|
if ("oauth" === provider.type) {
|
|
58
69
|
const credentials = await loginWithLocalCallback(provider.name, {
|
|
59
70
|
clientId: getOptionValue(args.options, "client-id"),
|
|
@@ -104,6 +115,7 @@ Usage:
|
|
|
104
115
|
Examples:
|
|
105
116
|
wingman provider status
|
|
106
117
|
wingman provider login copilot
|
|
118
|
+
wingman provider login codex
|
|
107
119
|
wingman provider login openrouter --api-key="<key>"
|
|
108
120
|
wingman provider login lmstudio
|
|
109
121
|
wingman provider login ollama
|
|
@@ -115,6 +127,8 @@ Options:
|
|
|
115
127
|
Environment Variables:
|
|
116
128
|
ANTHROPIC_API_KEY Anthropic API key
|
|
117
129
|
OPENAI_API_KEY OpenAI API key
|
|
130
|
+
CODEX_ACCESS_TOKEN OpenAI Codex ChatGPT access token
|
|
131
|
+
CHATGPT_ACCESS_TOKEN OpenAI Codex ChatGPT access token
|
|
118
132
|
OPENROUTER_API_KEY OpenRouter API key
|
|
119
133
|
GITHUB_COPILOT_TOKEN GitHub Copilot token
|
|
120
134
|
COPILOT_TOKEN GitHub Copilot token
|
|
@@ -91,6 +91,33 @@ class WingmanConfigLoader {
|
|
|
91
91
|
return {
|
|
92
92
|
logLevel: "info",
|
|
93
93
|
recursionLimit: 5000,
|
|
94
|
+
summarization: {
|
|
95
|
+
enabled: true,
|
|
96
|
+
maxTokensBeforeSummary: 12000,
|
|
97
|
+
messagesToKeep: 8
|
|
98
|
+
},
|
|
99
|
+
modelRetry: {
|
|
100
|
+
enabled: true,
|
|
101
|
+
maxRetries: 2,
|
|
102
|
+
backoffFactor: 2,
|
|
103
|
+
initialDelayMs: 1000,
|
|
104
|
+
maxDelayMs: 60000,
|
|
105
|
+
jitter: true,
|
|
106
|
+
onFailure: "continue"
|
|
107
|
+
},
|
|
108
|
+
toolRetry: {
|
|
109
|
+
enabled: false,
|
|
110
|
+
maxRetries: 2,
|
|
111
|
+
backoffFactor: 2,
|
|
112
|
+
initialDelayMs: 1000,
|
|
113
|
+
maxDelayMs: 60000,
|
|
114
|
+
jitter: true,
|
|
115
|
+
onFailure: "continue"
|
|
116
|
+
},
|
|
117
|
+
humanInTheLoop: {
|
|
118
|
+
enabled: false,
|
|
119
|
+
interruptOn: {}
|
|
120
|
+
},
|
|
94
121
|
search: {
|
|
95
122
|
provider: "duckduckgo",
|
|
96
123
|
maxResults: 5
|
|
@@ -63,6 +63,33 @@ class WingmanConfigLoader {
|
|
|
63
63
|
return {
|
|
64
64
|
logLevel: "info",
|
|
65
65
|
recursionLimit: 5000,
|
|
66
|
+
summarization: {
|
|
67
|
+
enabled: true,
|
|
68
|
+
maxTokensBeforeSummary: 12000,
|
|
69
|
+
messagesToKeep: 8
|
|
70
|
+
},
|
|
71
|
+
modelRetry: {
|
|
72
|
+
enabled: true,
|
|
73
|
+
maxRetries: 2,
|
|
74
|
+
backoffFactor: 2,
|
|
75
|
+
initialDelayMs: 1000,
|
|
76
|
+
maxDelayMs: 60000,
|
|
77
|
+
jitter: true,
|
|
78
|
+
onFailure: "continue"
|
|
79
|
+
},
|
|
80
|
+
toolRetry: {
|
|
81
|
+
enabled: false,
|
|
82
|
+
maxRetries: 2,
|
|
83
|
+
backoffFactor: 2,
|
|
84
|
+
initialDelayMs: 1000,
|
|
85
|
+
maxDelayMs: 60000,
|
|
86
|
+
jitter: true,
|
|
87
|
+
onFailure: "continue"
|
|
88
|
+
},
|
|
89
|
+
humanInTheLoop: {
|
|
90
|
+
enabled: false,
|
|
91
|
+
interruptOn: {}
|
|
92
|
+
},
|
|
66
93
|
search: {
|
|
67
94
|
provider: "duckduckgo",
|
|
68
95
|
maxResults: 5
|
|
@@ -25,11 +25,15 @@ var __webpack_exports__ = {};
|
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
SearchConfigSchema: ()=>SearchConfigSchema,
|
|
28
|
-
|
|
28
|
+
HumanInTheLoopConfigSchema: ()=>HumanInTheLoopConfigSchema,
|
|
29
29
|
AgentsConfigSchema: ()=>AgentsConfigSchema,
|
|
30
|
+
GatewayConfigSchema: ()=>GatewayConfigSchema,
|
|
31
|
+
SkillsConfigSchema: ()=>SkillsConfigSchema,
|
|
32
|
+
SummarizationConfigSchema: ()=>SummarizationConfigSchema,
|
|
33
|
+
ModelRetryConfigSchema: ()=>ModelRetryConfigSchema,
|
|
30
34
|
WingmanConfigSchema: ()=>WingmanConfigSchema,
|
|
31
35
|
validateConfig: ()=>validateConfig,
|
|
32
|
-
|
|
36
|
+
ToolRetryConfigSchema: ()=>ToolRetryConfigSchema
|
|
33
37
|
});
|
|
34
38
|
const external_zod_namespaceObject = require("zod");
|
|
35
39
|
const types_cjs_namespaceObject = require("../../agent/middleware/hooks/types.cjs");
|
|
@@ -49,6 +53,45 @@ const SkillsConfigSchema = external_zod_namespaceObject.z.object({
|
|
|
49
53
|
githubToken: external_zod_namespaceObject.z.string().optional().describe("GitHub personal access token for higher API rate limits"),
|
|
50
54
|
skillsDirectory: external_zod_namespaceObject.z.string().default("skills").describe("Directory to install skills in")
|
|
51
55
|
});
|
|
56
|
+
const SummarizationConfigSchema = external_zod_namespaceObject.z.object({
|
|
57
|
+
enabled: external_zod_namespaceObject.z.boolean().optional().default(true).describe("Enable conversation history summarization"),
|
|
58
|
+
maxTokensBeforeSummary: external_zod_namespaceObject.z.number().min(1000).max(1000000).optional().default(12000).describe("Token threshold before summarizing conversation history"),
|
|
59
|
+
messagesToKeep: external_zod_namespaceObject.z.number().min(2).max(100).optional().default(8).describe("How many most recent messages to keep after summarization")
|
|
60
|
+
});
|
|
61
|
+
const RetryOnFailureSchema = external_zod_namespaceObject.z["enum"]([
|
|
62
|
+
"continue",
|
|
63
|
+
"error"
|
|
64
|
+
]);
|
|
65
|
+
const BaseRetryConfigSchema = external_zod_namespaceObject.z.object({
|
|
66
|
+
enabled: external_zod_namespaceObject.z.boolean().optional().default(false).describe("Enable retry middleware"),
|
|
67
|
+
maxRetries: external_zod_namespaceObject.z.number().min(0).max(20).optional().default(2).describe("Maximum number of retry attempts"),
|
|
68
|
+
backoffFactor: external_zod_namespaceObject.z.number().min(0).max(10).optional().default(2).describe("Exponential backoff multiplier"),
|
|
69
|
+
initialDelayMs: external_zod_namespaceObject.z.number().min(0).max(120000).optional().default(1000).describe("Initial delay before first retry in milliseconds"),
|
|
70
|
+
maxDelayMs: external_zod_namespaceObject.z.number().min(0).max(300000).optional().default(60000).describe("Maximum backoff delay in milliseconds"),
|
|
71
|
+
jitter: external_zod_namespaceObject.z.boolean().optional().default(true).describe("Add randomized jitter to retry delays"),
|
|
72
|
+
onFailure: RetryOnFailureSchema.optional().default("continue").describe("Behavior when retries are exhausted")
|
|
73
|
+
});
|
|
74
|
+
const ModelRetryConfigSchema = BaseRetryConfigSchema;
|
|
75
|
+
const ToolRetryConfigSchema = BaseRetryConfigSchema.extend({
|
|
76
|
+
tools: external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.string().min(1)).optional().describe("Optional list of tool names to apply retry logic to")
|
|
77
|
+
});
|
|
78
|
+
const AllowedDecisionSchema = external_zod_namespaceObject.z["enum"]([
|
|
79
|
+
"approve",
|
|
80
|
+
"edit",
|
|
81
|
+
"reject"
|
|
82
|
+
]);
|
|
83
|
+
const InterruptOnToolConfigSchema = external_zod_namespaceObject.z.union([
|
|
84
|
+
external_zod_namespaceObject.z.boolean(),
|
|
85
|
+
external_zod_namespaceObject.z.object({
|
|
86
|
+
allowedDecisions: external_zod_namespaceObject.z.array(AllowedDecisionSchema).min(1).describe("Allowed decisions for this tool"),
|
|
87
|
+
description: external_zod_namespaceObject.z.string().optional().describe("Optional custom review prompt for this tool"),
|
|
88
|
+
argsSchema: external_zod_namespaceObject.z.record(external_zod_namespaceObject.z.string(), external_zod_namespaceObject.z.any()).optional().describe("Optional argument schema for edit decisions")
|
|
89
|
+
})
|
|
90
|
+
]);
|
|
91
|
+
const HumanInTheLoopConfigSchema = external_zod_namespaceObject.z.object({
|
|
92
|
+
enabled: external_zod_namespaceObject.z.boolean().optional().default(false).describe("Enable human-in-the-loop tool approval"),
|
|
93
|
+
interruptOn: external_zod_namespaceObject.z.record(external_zod_namespaceObject.z.string(), InterruptOnToolConfigSchema).optional().default({}).describe("Per-tool approval policy mapping")
|
|
94
|
+
});
|
|
52
95
|
const GatewayAuthSchema = external_zod_namespaceObject.z.object({
|
|
53
96
|
mode: external_zod_namespaceObject.z["enum"]([
|
|
54
97
|
"token",
|
|
@@ -177,6 +220,33 @@ const WingmanConfigSchema = external_zod_namespaceObject.z.object({
|
|
|
177
220
|
]).optional().default("info"),
|
|
178
221
|
defaultAgent: external_zod_namespaceObject.z.string().optional(),
|
|
179
222
|
recursionLimit: external_zod_namespaceObject.z.number().min(1).max(1000000).optional().default(5000),
|
|
223
|
+
summarization: SummarizationConfigSchema.optional().default({
|
|
224
|
+
enabled: true,
|
|
225
|
+
maxTokensBeforeSummary: 12000,
|
|
226
|
+
messagesToKeep: 8
|
|
227
|
+
}),
|
|
228
|
+
modelRetry: ModelRetryConfigSchema.optional().default({
|
|
229
|
+
enabled: true,
|
|
230
|
+
maxRetries: 2,
|
|
231
|
+
backoffFactor: 2,
|
|
232
|
+
initialDelayMs: 1000,
|
|
233
|
+
maxDelayMs: 60000,
|
|
234
|
+
jitter: true,
|
|
235
|
+
onFailure: "continue"
|
|
236
|
+
}),
|
|
237
|
+
toolRetry: ToolRetryConfigSchema.optional().default({
|
|
238
|
+
enabled: false,
|
|
239
|
+
maxRetries: 2,
|
|
240
|
+
backoffFactor: 2,
|
|
241
|
+
initialDelayMs: 1000,
|
|
242
|
+
maxDelayMs: 60000,
|
|
243
|
+
jitter: true,
|
|
244
|
+
onFailure: "continue"
|
|
245
|
+
}),
|
|
246
|
+
humanInTheLoop: HumanInTheLoopConfigSchema.optional().default({
|
|
247
|
+
enabled: false,
|
|
248
|
+
interruptOn: {}
|
|
249
|
+
}),
|
|
180
250
|
toolHooks: types_cjs_namespaceObject.HooksConfigSchema.optional().describe("Global tool hooks configuration"),
|
|
181
251
|
hooks: external_gateway_hooks_types_cjs_namespaceObject.InternalHooksConfigSchema.optional().describe("Internal hook configuration"),
|
|
182
252
|
search: SearchConfigSchema.optional().default({
|
|
@@ -248,15 +318,23 @@ function validateConfig(data) {
|
|
|
248
318
|
}
|
|
249
319
|
exports.AgentsConfigSchema = __webpack_exports__.AgentsConfigSchema;
|
|
250
320
|
exports.GatewayConfigSchema = __webpack_exports__.GatewayConfigSchema;
|
|
321
|
+
exports.HumanInTheLoopConfigSchema = __webpack_exports__.HumanInTheLoopConfigSchema;
|
|
322
|
+
exports.ModelRetryConfigSchema = __webpack_exports__.ModelRetryConfigSchema;
|
|
251
323
|
exports.SearchConfigSchema = __webpack_exports__.SearchConfigSchema;
|
|
252
324
|
exports.SkillsConfigSchema = __webpack_exports__.SkillsConfigSchema;
|
|
325
|
+
exports.SummarizationConfigSchema = __webpack_exports__.SummarizationConfigSchema;
|
|
326
|
+
exports.ToolRetryConfigSchema = __webpack_exports__.ToolRetryConfigSchema;
|
|
253
327
|
exports.WingmanConfigSchema = __webpack_exports__.WingmanConfigSchema;
|
|
254
328
|
exports.validateConfig = __webpack_exports__.validateConfig;
|
|
255
329
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
256
330
|
"AgentsConfigSchema",
|
|
257
331
|
"GatewayConfigSchema",
|
|
332
|
+
"HumanInTheLoopConfigSchema",
|
|
333
|
+
"ModelRetryConfigSchema",
|
|
258
334
|
"SearchConfigSchema",
|
|
259
335
|
"SkillsConfigSchema",
|
|
336
|
+
"SummarizationConfigSchema",
|
|
337
|
+
"ToolRetryConfigSchema",
|
|
260
338
|
"WingmanConfigSchema",
|
|
261
339
|
"validateConfig"
|
|
262
340
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
@@ -14,6 +14,52 @@ export declare const SkillsConfigSchema: z.ZodObject<{
|
|
|
14
14
|
skillsDirectory: z.ZodDefault<z.ZodString>;
|
|
15
15
|
}, z.core.$strip>;
|
|
16
16
|
export type SkillsConfig = z.infer<typeof SkillsConfigSchema>;
|
|
17
|
+
export declare const SummarizationConfigSchema: z.ZodObject<{
|
|
18
|
+
enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
19
|
+
maxTokensBeforeSummary: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
20
|
+
messagesToKeep: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export type SummarizationConfig = z.infer<typeof SummarizationConfigSchema>;
|
|
23
|
+
export declare const ModelRetryConfigSchema: z.ZodObject<{
|
|
24
|
+
enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
25
|
+
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
26
|
+
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
27
|
+
initialDelayMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
28
|
+
maxDelayMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
29
|
+
jitter: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
30
|
+
onFailure: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
31
|
+
error: "error";
|
|
32
|
+
continue: "continue";
|
|
33
|
+
}>>>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export type ModelRetryConfig = z.infer<typeof ModelRetryConfigSchema>;
|
|
36
|
+
export declare const ToolRetryConfigSchema: z.ZodObject<{
|
|
37
|
+
enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
38
|
+
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
39
|
+
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
40
|
+
initialDelayMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
41
|
+
maxDelayMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
42
|
+
jitter: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
43
|
+
onFailure: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
44
|
+
error: "error";
|
|
45
|
+
continue: "continue";
|
|
46
|
+
}>>>;
|
|
47
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
export type ToolRetryConfig = z.infer<typeof ToolRetryConfigSchema>;
|
|
50
|
+
export declare const HumanInTheLoopConfigSchema: z.ZodObject<{
|
|
51
|
+
enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
52
|
+
interruptOn: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
53
|
+
allowedDecisions: z.ZodArray<z.ZodEnum<{
|
|
54
|
+
approve: "approve";
|
|
55
|
+
edit: "edit";
|
|
56
|
+
reject: "reject";
|
|
57
|
+
}>>;
|
|
58
|
+
description: z.ZodOptional<z.ZodString>;
|
|
59
|
+
argsSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
60
|
+
}, z.core.$strip>]>>>>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
export type HumanInTheLoopConfig = z.infer<typeof HumanInTheLoopConfigSchema>;
|
|
17
63
|
export declare const GatewayConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
18
64
|
host: z.ZodDefault<z.ZodString>;
|
|
19
65
|
port: z.ZodDefault<z.ZodNumber>;
|
|
@@ -92,6 +138,48 @@ export declare const WingmanConfigSchema: z.ZodObject<{
|
|
|
92
138
|
}>>>;
|
|
93
139
|
defaultAgent: z.ZodOptional<z.ZodString>;
|
|
94
140
|
recursionLimit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
141
|
+
summarization: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
142
|
+
enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
143
|
+
maxTokensBeforeSummary: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
144
|
+
messagesToKeep: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
145
|
+
}, z.core.$strip>>>;
|
|
146
|
+
modelRetry: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
147
|
+
enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
148
|
+
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
149
|
+
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
150
|
+
initialDelayMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
151
|
+
maxDelayMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
152
|
+
jitter: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
153
|
+
onFailure: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
154
|
+
error: "error";
|
|
155
|
+
continue: "continue";
|
|
156
|
+
}>>>;
|
|
157
|
+
}, z.core.$strip>>>;
|
|
158
|
+
toolRetry: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
159
|
+
enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
160
|
+
maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
161
|
+
backoffFactor: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
162
|
+
initialDelayMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
163
|
+
maxDelayMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
164
|
+
jitter: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
165
|
+
onFailure: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
166
|
+
error: "error";
|
|
167
|
+
continue: "continue";
|
|
168
|
+
}>>>;
|
|
169
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
170
|
+
}, z.core.$strip>>>;
|
|
171
|
+
humanInTheLoop: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
172
|
+
enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
173
|
+
interruptOn: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
174
|
+
allowedDecisions: z.ZodArray<z.ZodEnum<{
|
|
175
|
+
approve: "approve";
|
|
176
|
+
edit: "edit";
|
|
177
|
+
reject: "reject";
|
|
178
|
+
}>>;
|
|
179
|
+
description: z.ZodOptional<z.ZodString>;
|
|
180
|
+
argsSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
181
|
+
}, z.core.$strip>]>>>>;
|
|
182
|
+
}, z.core.$strip>>>;
|
|
95
183
|
toolHooks: z.ZodOptional<z.ZodObject<{
|
|
96
184
|
PreToolUse: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
97
185
|
matcher: z.ZodOptional<z.ZodString>;
|
|
@@ -16,6 +16,45 @@ const SkillsConfigSchema = z.object({
|
|
|
16
16
|
githubToken: z.string().optional().describe("GitHub personal access token for higher API rate limits"),
|
|
17
17
|
skillsDirectory: z.string().default("skills").describe("Directory to install skills in")
|
|
18
18
|
});
|
|
19
|
+
const SummarizationConfigSchema = z.object({
|
|
20
|
+
enabled: z.boolean().optional().default(true).describe("Enable conversation history summarization"),
|
|
21
|
+
maxTokensBeforeSummary: z.number().min(1000).max(1000000).optional().default(12000).describe("Token threshold before summarizing conversation history"),
|
|
22
|
+
messagesToKeep: z.number().min(2).max(100).optional().default(8).describe("How many most recent messages to keep after summarization")
|
|
23
|
+
});
|
|
24
|
+
const RetryOnFailureSchema = z["enum"]([
|
|
25
|
+
"continue",
|
|
26
|
+
"error"
|
|
27
|
+
]);
|
|
28
|
+
const BaseRetryConfigSchema = z.object({
|
|
29
|
+
enabled: z.boolean().optional().default(false).describe("Enable retry middleware"),
|
|
30
|
+
maxRetries: z.number().min(0).max(20).optional().default(2).describe("Maximum number of retry attempts"),
|
|
31
|
+
backoffFactor: z.number().min(0).max(10).optional().default(2).describe("Exponential backoff multiplier"),
|
|
32
|
+
initialDelayMs: z.number().min(0).max(120000).optional().default(1000).describe("Initial delay before first retry in milliseconds"),
|
|
33
|
+
maxDelayMs: z.number().min(0).max(300000).optional().default(60000).describe("Maximum backoff delay in milliseconds"),
|
|
34
|
+
jitter: z.boolean().optional().default(true).describe("Add randomized jitter to retry delays"),
|
|
35
|
+
onFailure: RetryOnFailureSchema.optional().default("continue").describe("Behavior when retries are exhausted")
|
|
36
|
+
});
|
|
37
|
+
const ModelRetryConfigSchema = BaseRetryConfigSchema;
|
|
38
|
+
const ToolRetryConfigSchema = BaseRetryConfigSchema.extend({
|
|
39
|
+
tools: z.array(z.string().min(1)).optional().describe("Optional list of tool names to apply retry logic to")
|
|
40
|
+
});
|
|
41
|
+
const AllowedDecisionSchema = z["enum"]([
|
|
42
|
+
"approve",
|
|
43
|
+
"edit",
|
|
44
|
+
"reject"
|
|
45
|
+
]);
|
|
46
|
+
const InterruptOnToolConfigSchema = z.union([
|
|
47
|
+
z.boolean(),
|
|
48
|
+
z.object({
|
|
49
|
+
allowedDecisions: z.array(AllowedDecisionSchema).min(1).describe("Allowed decisions for this tool"),
|
|
50
|
+
description: z.string().optional().describe("Optional custom review prompt for this tool"),
|
|
51
|
+
argsSchema: z.record(z.string(), z.any()).optional().describe("Optional argument schema for edit decisions")
|
|
52
|
+
})
|
|
53
|
+
]);
|
|
54
|
+
const HumanInTheLoopConfigSchema = z.object({
|
|
55
|
+
enabled: z.boolean().optional().default(false).describe("Enable human-in-the-loop tool approval"),
|
|
56
|
+
interruptOn: z.record(z.string(), InterruptOnToolConfigSchema).optional().default({}).describe("Per-tool approval policy mapping")
|
|
57
|
+
});
|
|
19
58
|
const GatewayAuthSchema = z.object({
|
|
20
59
|
mode: z["enum"]([
|
|
21
60
|
"token",
|
|
@@ -144,6 +183,33 @@ const WingmanConfigSchema = z.object({
|
|
|
144
183
|
]).optional().default("info"),
|
|
145
184
|
defaultAgent: z.string().optional(),
|
|
146
185
|
recursionLimit: z.number().min(1).max(1000000).optional().default(5000),
|
|
186
|
+
summarization: SummarizationConfigSchema.optional().default({
|
|
187
|
+
enabled: true,
|
|
188
|
+
maxTokensBeforeSummary: 12000,
|
|
189
|
+
messagesToKeep: 8
|
|
190
|
+
}),
|
|
191
|
+
modelRetry: ModelRetryConfigSchema.optional().default({
|
|
192
|
+
enabled: true,
|
|
193
|
+
maxRetries: 2,
|
|
194
|
+
backoffFactor: 2,
|
|
195
|
+
initialDelayMs: 1000,
|
|
196
|
+
maxDelayMs: 60000,
|
|
197
|
+
jitter: true,
|
|
198
|
+
onFailure: "continue"
|
|
199
|
+
}),
|
|
200
|
+
toolRetry: ToolRetryConfigSchema.optional().default({
|
|
201
|
+
enabled: false,
|
|
202
|
+
maxRetries: 2,
|
|
203
|
+
backoffFactor: 2,
|
|
204
|
+
initialDelayMs: 1000,
|
|
205
|
+
maxDelayMs: 60000,
|
|
206
|
+
jitter: true,
|
|
207
|
+
onFailure: "continue"
|
|
208
|
+
}),
|
|
209
|
+
humanInTheLoop: HumanInTheLoopConfigSchema.optional().default({
|
|
210
|
+
enabled: false,
|
|
211
|
+
interruptOn: {}
|
|
212
|
+
}),
|
|
147
213
|
toolHooks: HooksConfigSchema.optional().describe("Global tool hooks configuration"),
|
|
148
214
|
hooks: InternalHooksConfigSchema.optional().describe("Internal hook configuration"),
|
|
149
215
|
search: SearchConfigSchema.optional().default({
|
|
@@ -213,4 +279,4 @@ function validateConfig(data) {
|
|
|
213
279
|
};
|
|
214
280
|
}
|
|
215
281
|
}
|
|
216
|
-
export { AgentsConfigSchema, GatewayConfigSchema, SearchConfigSchema, SkillsConfigSchema, WingmanConfigSchema, validateConfig };
|
|
282
|
+
export { AgentsConfigSchema, GatewayConfigSchema, HumanInTheLoopConfigSchema, ModelRetryConfigSchema, SearchConfigSchema, SkillsConfigSchema, SummarizationConfigSchema, ToolRetryConfigSchema, WingmanConfigSchema, validateConfig };
|