gitdone-agent 0.8.1 → 0.8.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/index.js +29 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -29,7 +29,7 @@ import { randomUUID, createHash } from 'node:crypto'
|
|
|
29
29
|
// Reported to the server on every sync so the web UI can flag outdated agents.
|
|
30
30
|
// Keep in lockstep with packages/agent/package.json "version" AND
|
|
31
31
|
// src/lib/agentVersion.ts LATEST_AGENT_VERSION.
|
|
32
|
-
const AGENT_VERSION = '0.8.
|
|
32
|
+
const AGENT_VERSION = '0.8.3'
|
|
33
33
|
|
|
34
34
|
const AGENT_DIR = join(homedir(), '.gitdone-agent')
|
|
35
35
|
const CONFIG_PATH = join(AGENT_DIR, 'config.json')
|
|
@@ -1471,6 +1471,17 @@ function aiProviderArg(raw) {
|
|
|
1471
1471
|
return raw === 'codex' ? 'codex' : 'claude'
|
|
1472
1472
|
}
|
|
1473
1473
|
|
|
1474
|
+
// Reasoning effort — how hard the model thinks per turn (gd-507). Both CLIs
|
|
1475
|
+
// take the same five levels, by different spellings (gd-510): Claude Code as
|
|
1476
|
+
// `--effort <level>`, Codex as a `model_reasoning_effort` config override.
|
|
1477
|
+
// Whitelisted rather than pattern-matched, since an unknown level makes either
|
|
1478
|
+
// CLI refuse to start. null (incl. a gitDone older than gd-507) → don't pass
|
|
1479
|
+
// it, and the machine's own setting decides.
|
|
1480
|
+
const AI_EFFORT_LEVELS = ['low', 'medium', 'high', 'xhigh', 'max']
|
|
1481
|
+
function aiEffortArg(raw) {
|
|
1482
|
+
return typeof raw === 'string' && AI_EFFORT_LEVELS.includes(raw.trim()) ? raw.trim() : null
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1474
1485
|
function cliNotFoundMessage(provider, hostname) {
|
|
1475
1486
|
return provider === 'codex'
|
|
1476
1487
|
? `Codex CLI (ChatGPT) не е намерен на този компютър (${hostname}). Инсталирай го (npm i -g @openai/codex), влез с ChatGPT акаунт през „codex login", увери се, че „codex" е в PATH, после рестартирай агента.`
|
|
@@ -1495,7 +1506,7 @@ function cliNotFoundMessage(provider, hostname) {
|
|
|
1495
1506
|
// The commit policy is NOT here: Codex has no tool-level deny list to mirror
|
|
1496
1507
|
// Claude's --disallowedTools, so it rides along in the prompt (codexPrompt).
|
|
1497
1508
|
function codexExecArgs(cfg, opts) {
|
|
1498
|
-
const { model, resumeId } = opts
|
|
1509
|
+
const { model, effort, resumeId } = opts
|
|
1499
1510
|
const flags = [
|
|
1500
1511
|
'--json',
|
|
1501
1512
|
'--skip-git-repo-check',
|
|
@@ -1518,6 +1529,9 @@ function codexExecArgs(cfg, opts) {
|
|
|
1518
1529
|
// it, which killed every resumed turn with "unexpected argument".)
|
|
1519
1530
|
'--dangerously-bypass-approvals-and-sandbox',
|
|
1520
1531
|
...(model ? ['--model', model] : []),
|
|
1532
|
+
// Reasoning effort chosen in gitDone (gd-507). There is no flag for it, so
|
|
1533
|
+
// it goes in as a config override like the MCP settings below.
|
|
1534
|
+
...(effort ? ['-c', `model_reasoning_effort="${effort}"`] : []),
|
|
1521
1535
|
'-c', `mcp_servers.gitdone.url="${cfg.url}/api/mcp"`,
|
|
1522
1536
|
'-c', 'mcp_servers.gitdone.bearer_token_env_var="GITDONE_KEY"',
|
|
1523
1537
|
// Tags the AI agents this run registers with THIS computer (gd-308).
|
|
@@ -1551,6 +1565,7 @@ function runAiCommand(cfg, cmd, repoPath) {
|
|
|
1551
1565
|
const prompt = cmd.payload?.prompt ?? ''
|
|
1552
1566
|
const allowCommit = cmd.payload?.allowCommit === true
|
|
1553
1567
|
const model = aiModelArg(cmd.payload?.model)
|
|
1568
|
+
const effort = aiEffortArg(cmd.payload?.effort)
|
|
1554
1569
|
const provider = aiProviderArg(cmd.payload?.provider)
|
|
1555
1570
|
const isCodex = provider === 'codex'
|
|
1556
1571
|
// gd-466: a token-reset resume asks us to continue the CLI's own conversation.
|
|
@@ -1586,7 +1601,7 @@ function runAiCommand(cfg, cmd, repoPath) {
|
|
|
1586
1601
|
// Piping it to stdin is robust for both the native exe and the shim; `codex
|
|
1587
1602
|
// exec -` reads its prompt from stdin the same way.
|
|
1588
1603
|
const args = isCodex
|
|
1589
|
-
? codexExecArgs(cfg, { model, resumeId })
|
|
1604
|
+
? codexExecArgs(cfg, { model, effort, resumeId })
|
|
1590
1605
|
: [
|
|
1591
1606
|
'-p',
|
|
1592
1607
|
'--output-format', 'stream-json',
|
|
@@ -1600,6 +1615,8 @@ function runAiCommand(cfg, cmd, repoPath) {
|
|
|
1600
1615
|
...(resumeId ? ['--resume', resumeId] : []),
|
|
1601
1616
|
// Model chosen in gitDone (project default / task); omitted → machine default (gd-354).
|
|
1602
1617
|
...(model ? ['--model', model] : []),
|
|
1618
|
+
// Reasoning effort chosen in gitDone (gd-510); omitted → machine default.
|
|
1619
|
+
...(effort ? ['--effort', effort] : []),
|
|
1603
1620
|
'--permission-mode', 'acceptEdits',
|
|
1604
1621
|
'--allowedTools', 'Read,Edit,Write,Bash,mcp__gitdone__*',
|
|
1605
1622
|
// Block git commit/push unless this repo opted in (per-repo aiAutoCommit).
|
|
@@ -1894,7 +1911,7 @@ async function finishChatTurn(cfg, entry, outcome) {
|
|
|
1894
1911
|
// Spawn the persistent claude process for one session and wire its stream
|
|
1895
1912
|
// handlers once. Turns come and go via entry.turn; the process stays.
|
|
1896
1913
|
function spawnChatProc(cfg, opts) {
|
|
1897
|
-
const { sessionId, repoPath, model, allowCommit, resumeId, claudePath, shell, settingsPath, mcpConfigPath } = opts
|
|
1914
|
+
const { sessionId, repoPath, model, effort, allowCommit, resumeId, claudePath, shell, settingsPath, mcpConfigPath } = opts
|
|
1898
1915
|
|
|
1899
1916
|
// Room in the pool: evict the least-recently-used idle process first.
|
|
1900
1917
|
if (chatProcs.size >= CHAT_PROC_MAX) {
|
|
@@ -1914,6 +1931,9 @@ function spawnChatProc(cfg, opts) {
|
|
|
1914
1931
|
// Model resolved for this session (picker / project default); omitted →
|
|
1915
1932
|
// machine default (gd-354). Kept consistent across the session's turns.
|
|
1916
1933
|
...(model ? ['--model', model] : []),
|
|
1934
|
+
// Same for the session's reasoning effort (gd-510) — frozen at spawn, so a
|
|
1935
|
+
// change in gitDone reaches the pooled process on its next respawn.
|
|
1936
|
+
...(effort ? ['--effort', effort] : []),
|
|
1917
1937
|
'--permission-mode', 'acceptEdits',
|
|
1918
1938
|
'--allowedTools', 'Read,Edit,Write,Bash,mcp__gitdone__*',
|
|
1919
1939
|
// Block git commit/push unless this repo opted in (per-repo aiAutoCommit).
|
|
@@ -2005,7 +2025,7 @@ function killTree(child) {
|
|
|
2005
2025
|
// chatProcs under the same entry shape, so ai_chat_stop and the stuck-turn
|
|
2006
2026
|
// sweeper keep working untouched.
|
|
2007
2027
|
function runCodexChatTurn(cfg, cmd, repoPath, opts) {
|
|
2008
|
-
const { sessionId, prompt, resumeId, model, allowCommit } = opts
|
|
2028
|
+
const { sessionId, prompt, resumeId, model, effort, allowCommit } = opts
|
|
2009
2029
|
|
|
2010
2030
|
const { path: codexPath, shell, found } = findCodex()
|
|
2011
2031
|
if (!found) {
|
|
@@ -2016,7 +2036,7 @@ function runCodexChatTurn(cfg, cmd, repoPath, opts) {
|
|
|
2016
2036
|
return
|
|
2017
2037
|
}
|
|
2018
2038
|
|
|
2019
|
-
const args = codexExecArgs(cfg, { model, resumeId })
|
|
2039
|
+
const args = codexExecArgs(cfg, { model, effort, resumeId })
|
|
2020
2040
|
const childEnv = { ...process.env, GITDONE_URL: cfg.url, GITDONE_KEY: cfg.key, GITDONE_SESSION_ID: sessionId }
|
|
2021
2041
|
|
|
2022
2042
|
let child
|
|
@@ -2107,6 +2127,7 @@ async function runAiChat(cfg, cmd, repoPath) {
|
|
|
2107
2127
|
const claudeSessionId = cmd.payload?.claudeSessionId || null
|
|
2108
2128
|
const allowCommit = cmd.payload?.allowCommit === true
|
|
2109
2129
|
const model = aiModelArg(cmd.payload?.model)
|
|
2130
|
+
const effort = aiEffortArg(cmd.payload?.effort)
|
|
2110
2131
|
const provider = aiProviderArg(cmd.payload?.provider)
|
|
2111
2132
|
// A turn may be text-only, image-only, or both — but needs at least one.
|
|
2112
2133
|
if (!sessionId || (!prompt && images.length === 0)) {
|
|
@@ -2141,6 +2162,7 @@ async function runAiChat(cfg, cmd, repoPath) {
|
|
|
2141
2162
|
imgDir: dl?.dir ?? null,
|
|
2142
2163
|
resumeId: claudeSessionId,
|
|
2143
2164
|
model,
|
|
2165
|
+
effort,
|
|
2144
2166
|
allowCommit,
|
|
2145
2167
|
})
|
|
2146
2168
|
return
|
|
@@ -2160,7 +2182,7 @@ async function runAiChat(cfg, cmd, repoPath) {
|
|
|
2160
2182
|
let mcpConfigPath
|
|
2161
2183
|
try { mcpConfigPath = ensureAiMcpConfig(cfg) } catch (e) { log(`✗ ai mcp config setup failed: ${e.message}`) }
|
|
2162
2184
|
try {
|
|
2163
|
-
entry = spawnChatProc(cfg, { sessionId, repoPath, model, allowCommit, resumeId: claudeSessionId, claudePath, shell, settingsPath, mcpConfigPath })
|
|
2185
|
+
entry = spawnChatProc(cfg, { sessionId, repoPath, model, effort, allowCommit, resumeId: claudeSessionId, claudePath, shell, settingsPath, mcpConfigPath })
|
|
2164
2186
|
} catch (err) {
|
|
2165
2187
|
postSessionEvents(cfg, sessionId, [{ role: 'SYSTEM', text: `Грешка при стартиране: ${err.message}` }], 'error')
|
|
2166
2188
|
reportCommandResult(cfg, cmd.id, 'error', err.message)
|