openfox 1.6.75 → 1.6.77
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/README.md +18 -18
- package/dist/agent-defaults/code-reviewer.agent.md +1 -0
- package/dist/agent-defaults/explorer.agent.md +2 -1
- package/dist/agent-defaults/verifier.agent.md +4 -0
- package/dist/{ask-3RK5YJZE.js → ask-5SSOA6SZ.js} +2 -2
- package/dist/{auth-LZZX63KI.js → auth-56SIRACI.js} +3 -6
- package/dist/auto-compaction-GOHNI2R2.js +27 -0
- package/dist/{branch.api-XADFZZAA.js → branch.api-PWFW26KC.js} +2 -2
- package/dist/{chat-handler-KYMMXPP6.js → chat-handler-K2RDXBO6.js} +31 -29
- package/dist/{chunk-IA4O65CR.js → chunk-6SYNGMU4.js} +100 -68
- package/dist/{chunk-AFATQ5LJ.js → chunk-B5AP3RSV.js} +1 -1
- package/dist/{chunk-PFRQO5Z3.js → chunk-BBC46FN4.js} +61 -28
- package/dist/{chunk-22CTURMH.js → chunk-BJYPTN5S.js} +1 -1
- package/dist/{chunk-DLINTLB7.js → chunk-BSTVRSV6.js} +7 -5
- package/dist/{chunk-7JPKRM6M.js → chunk-CMQCO27Y.js} +22 -12
- package/dist/{chunk-R4HADRYO.js → chunk-CQGTEGKL.js} +1 -1
- package/dist/{chunk-J5DV33SS.js → chunk-CUDAT6SS.js} +46 -18
- package/dist/{chunk-ETIXH35K.js → chunk-EBQYRNNU.js} +535 -291
- package/dist/{chunk-4CQ7CUQ6.js → chunk-I7JVS7V5.js} +5 -5
- package/dist/{chunk-PNBH3RAX.js → chunk-K44MW7JJ.js} +1 -1
- package/dist/{chunk-BLNFJ22S.js → chunk-KIOUKC3Z.js} +6 -4
- package/dist/{chunk-CTAIXOZJ.js → chunk-NDJ6FKSP.js} +1 -1
- package/dist/{chunk-VIGOXEZG.js → chunk-OJBFC6ER.js} +15 -16
- package/dist/{chunk-GQZGIMJO.js → chunk-OXI26S7U.js} +12 -7
- package/dist/{chunk-NBU6KIOD.js → chunk-PBGOZMVY.js} +4 -4
- package/dist/{chunk-B7E3BICY.js → chunk-RGRBWDZP.js} +2 -4
- package/dist/{chunk-KFBIHS3S.js → chunk-STYHKCG7.js} +20 -14
- package/dist/{chunk-55Z3DJ7G.js → chunk-TGWEH2BC.js} +10 -11
- package/dist/{chunk-TYUNDOX2.js → chunk-UKMRZDWM.js} +90 -41
- package/dist/{chunk-5UTTLO4D.js → chunk-UVN6AKIO.js} +89 -49
- package/dist/{chunk-574HZVLE.js → chunk-VRGRAQDG.js} +2 -2
- package/dist/{chunk-JQBTYHUR.js → chunk-WR6QCJJO.js} +53 -15
- package/dist/{chunk-RBPOAAIZ.js → chunk-XKIEDGQF.js} +22 -18
- package/dist/{chunk-XIZ6B6IS.js → chunk-XSUQDB6R.js} +541 -299
- package/dist/cli/dev.js +2 -2
- package/dist/cli/index.js +2 -2
- package/dist/{config-6T4EHAP2.js → config-5CONAOL7.js} +7 -7
- package/dist/{events-LKEZ3YCW.js → events-5RIXWI5Y.js} +6 -6
- package/dist/{folding-JN2WT44N.js → folding-JNOUTI5Z.js} +2 -2
- package/dist/{inspect-proxy-Y4MRAVB7.js → inspect-proxy-Y75AXMRX.js} +3 -3
- package/dist/{manager-HM2J5VMW.js → manager-W7N3XQ4Q.js} +3 -3
- package/dist/orchestrator-TW5II347.js +43 -0
- package/dist/package.json +19 -3
- package/dist/{paths-ZRI56O63.js → paths-X46PPOI2.js} +2 -2
- package/dist/{processor-23O4HPSS.js → processor-MZ3QIUED.js} +15 -11
- package/dist/{project-creator-LASKNQPA.js → project-creator-VD7MLOWE.js} +8 -5
- package/dist/{projects-HEUOWNSR.js → projects-XLMSDFTQ.js} +4 -4
- package/dist/{protocol-5AWNGFLH.js → protocol-4CTV7OZC.js} +3 -3
- package/dist/{protocol-DRBnujwe.d.ts → protocol-4xbfAlGO.d.ts} +3 -0
- package/dist/{provider-AKN355YH.js → provider-ESEBV3LL.js} +15 -11
- package/dist/{pwa-GHQCMCIU.js → pwa-76XP2DY2.js} +2 -2
- package/dist/{runtime-config-ZCK74XKM.js → runtime-config-CBJJJGBD.js} +2 -2
- package/dist/{serve-TW63YCNQ.js → serve-FTTLGRAO.js} +29 -27
- package/dist/server/index.d.ts +6 -1
- package/dist/server/index.js +22 -22
- package/dist/server/public/__inspect__.js +163 -143
- package/dist/{service-74Z7JK2J.js → service-D6LC3CAM.js} +3 -2
- package/dist/{settings-NI4ITGV6.js → settings-TQNQB56H.js} +4 -4
- package/dist/shared/index.d.ts +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/{store-2IF3ZSLD.js → store-OQ45KONN.js} +2 -2
- package/dist/{tools-RUAY6EVI.js → tools-QJ5K5IJP.js} +18 -18
- package/dist/{vision-fallback-AXH3BGJC.js → vision-fallback-ED27LH6C.js} +3 -3
- package/dist/web/__inspect__.js +178 -155
- package/dist/web/assets/{index-CWdKiSP8.js → index-FjLp1t6r.js} +62 -62
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +19 -3
- package/dist/auto-compaction-OW4P2QWQ.js +0 -27
- package/dist/orchestrator-QP4O7MUM.js +0 -43
package/README.md
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
Autonomous coding agent for local LLMs with contract-driven execution.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
_Session — Criteria tracking, tool calls, and streaming responses_
|
|
8
8
|

|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
_Providers — Local LLM backend configuration_
|
|
11
11
|

|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
_Workflows — Contract-driven execution pipeline_
|
|
14
14
|

|
|
15
15
|
|
|
16
16
|
## Quick Start
|
|
@@ -46,12 +46,12 @@ openfox provider remove # Remove provider
|
|
|
46
46
|
|
|
47
47
|
## CLI Options
|
|
48
48
|
|
|
49
|
-
| Option
|
|
50
|
-
|
|
51
|
-
| `-p, --port <number>` | Specify server port
|
|
52
|
-
| `--no-browser`
|
|
53
|
-
| `-h, --help`
|
|
54
|
-
| `-v, --version`
|
|
49
|
+
| Option | Description | Default |
|
|
50
|
+
| --------------------- | --------------------------- | ------------- |
|
|
51
|
+
| `-p, --port <number>` | Specify server port | 10369 |
|
|
52
|
+
| `--no-browser` | Don't open browser on start | Opens browser |
|
|
53
|
+
| `-h, --help` | Show help message | - |
|
|
54
|
+
| `-v, --version` | Show version number | - |
|
|
55
55
|
|
|
56
56
|
## Requirements
|
|
57
57
|
|
|
@@ -72,30 +72,30 @@ openfox provider remove # Remove provider
|
|
|
72
72
|
|
|
73
73
|
## Screenshots
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
_Homepage — Project overview and session history_
|
|
76
76
|

|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
_Project Selected — Active session with context stats_
|
|
79
79
|

|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
_Stats — Prefill time, generation speed, token usage_
|
|
82
82
|

|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
_Terminal — Integrated terminal for running commands_
|
|
85
85
|

|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
_Notifications — Event log and system messages_
|
|
88
88
|

|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
_Agents — Sub-agent management and execution_
|
|
91
91
|

|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
_General Instructions — Global custom instructions_
|
|
94
94
|

|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
_Vision Fallback — Image processing configuration_
|
|
97
97
|

|
|
98
98
|
|
|
99
99
|
## License
|
|
100
100
|
|
|
101
|
-
MIT
|
|
101
|
+
MIT
|
|
@@ -15,8 +15,9 @@ You are a codebase exploration expert.
|
|
|
15
15
|
Your role is to investigate and map out code structure, find relevant files, and explain how components work together.
|
|
16
16
|
|
|
17
17
|
Guidelines:
|
|
18
|
+
|
|
18
19
|
- Use run_command with grep/glob to discover code
|
|
19
20
|
- Trace dependencies and imports to understand relationships
|
|
20
21
|
- Identify patterns and conventions in the codebase
|
|
21
22
|
- Report findings clearly with file paths and key observations
|
|
22
|
-
- Look for tests, documentation, and configuration to supplement your understanding
|
|
23
|
+
- Look for tests, documentation, and configuration to supplement your understanding
|
|
@@ -14,6 +14,7 @@ allowedTools:
|
|
|
14
14
|
You are a code reviewer performing independent verification.
|
|
15
15
|
|
|
16
16
|
The user will provide:
|
|
17
|
+
|
|
17
18
|
- Task summary
|
|
18
19
|
- Criteria to verify (with status markers)
|
|
19
20
|
- Modified files
|
|
@@ -21,16 +22,19 @@ The user will provide:
|
|
|
21
22
|
## YOUR TASK
|
|
22
23
|
|
|
23
24
|
For each criterion marked [NEEDS VERIFICATION]:
|
|
25
|
+
|
|
24
26
|
1. Consider the task summary and criterion description
|
|
25
27
|
2. If the criterion requires code changes, read the modified files and verify the implementation
|
|
26
28
|
3. If the criterion is conceptual or doesn't require code (e.g., test/placeholder criteria), verify based on the description alone
|
|
27
29
|
4. Run tests or commands only if applicable to the criterion
|
|
28
30
|
|
|
29
31
|
Then call:
|
|
32
|
+
|
|
30
33
|
- `criterion` with action "pass" if the criterion is satisfied
|
|
31
34
|
- `criterion` with action "fail" if it is NOT satisfied (explain why clearly)
|
|
32
35
|
|
|
33
36
|
## IMPORTANT
|
|
37
|
+
|
|
34
38
|
- Start by analyzing what each criterion actually requires
|
|
35
39
|
- For trivial or non-code criteria, pass them immediately without exploring the codebase
|
|
36
40
|
- For code-related criteria, focus on the modified files provided
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
cancelQuestionsForSession,
|
|
7
7
|
hasPendingQuestion,
|
|
8
8
|
provideAnswer
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BJYPTN5S.js";
|
|
10
10
|
export {
|
|
11
11
|
AskUserInterrupt,
|
|
12
12
|
askUserTool,
|
|
@@ -16,4 +16,4 @@ export {
|
|
|
16
16
|
hasPendingQuestion,
|
|
17
17
|
provideAnswer
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=ask-
|
|
19
|
+
//# sourceMappingURL=ask-5SSOA6SZ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getAuthConfigPath
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CQGTEGKL.js";
|
|
4
4
|
|
|
5
5
|
// src/cli/auth.ts
|
|
6
6
|
import { readFile, writeFile, mkdir, access } from "fs/promises";
|
|
@@ -30,10 +30,7 @@ async function authConfigExists(mode) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
function encryptPassword(password, publicKey) {
|
|
33
|
-
const encrypted = publicEncrypt(
|
|
34
|
-
{ key: publicKey, padding: 1 },
|
|
35
|
-
Buffer.from(password)
|
|
36
|
-
);
|
|
33
|
+
const encrypted = publicEncrypt({ key: publicKey, padding: 1 }, Buffer.from(password));
|
|
37
34
|
return encrypted.toString("base64");
|
|
38
35
|
}
|
|
39
36
|
function hashPassword(password) {
|
|
@@ -50,4 +47,4 @@ export {
|
|
|
50
47
|
saveAuthConfig,
|
|
51
48
|
verifyPassword
|
|
52
49
|
};
|
|
53
|
-
//# sourceMappingURL=auth-
|
|
50
|
+
//# sourceMappingURL=auth-56SIRACI.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
maybeAutoCompactContext,
|
|
3
|
+
performManualContextCompaction,
|
|
4
|
+
resolveCompactionStatsIdentity
|
|
5
|
+
} from "./chunk-EBQYRNNU.js";
|
|
6
|
+
import "./chunk-OXI26S7U.js";
|
|
7
|
+
import "./chunk-CMQCO27Y.js";
|
|
8
|
+
import "./chunk-XKIEDGQF.js";
|
|
9
|
+
import "./chunk-PBGOZMVY.js";
|
|
10
|
+
import "./chunk-VRGRAQDG.js";
|
|
11
|
+
import "./chunk-CUDAT6SS.js";
|
|
12
|
+
import "./chunk-UVN6AKIO.js";
|
|
13
|
+
import "./chunk-KIOUKC3Z.js";
|
|
14
|
+
import "./chunk-BBC46FN4.js";
|
|
15
|
+
import "./chunk-STYHKCG7.js";
|
|
16
|
+
import "./chunk-BJYPTN5S.js";
|
|
17
|
+
import "./chunk-NDJ6FKSP.js";
|
|
18
|
+
import "./chunk-CQGTEGKL.js";
|
|
19
|
+
import "./chunk-B5AP3RSV.js";
|
|
20
|
+
import "./chunk-BSTVRSV6.js";
|
|
21
|
+
import "./chunk-K44MW7JJ.js";
|
|
22
|
+
export {
|
|
23
|
+
maybeAutoCompactContext,
|
|
24
|
+
performManualContextCompaction,
|
|
25
|
+
resolveCompactionStatsIdentity
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=auto-compaction-GOHNI2R2.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
logger
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-K44MW7JJ.js";
|
|
4
4
|
|
|
5
5
|
// src/server/branch.api.ts
|
|
6
6
|
import { spawn } from "child_process";
|
|
@@ -45,4 +45,4 @@ function getGitBranch(cwd) {
|
|
|
45
45
|
export {
|
|
46
46
|
getCurrentBranch
|
|
47
47
|
};
|
|
48
|
-
//# sourceMappingURL=branch.api-
|
|
48
|
+
//# sourceMappingURL=branch.api-PWFW26KC.js.map
|
|
@@ -5,35 +5,35 @@ import {
|
|
|
5
5
|
generateSessionName,
|
|
6
6
|
getSessionMessageCount,
|
|
7
7
|
needsNameGenerationCheck
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-I7JVS7V5.js";
|
|
9
9
|
import {
|
|
10
10
|
runChatTurn
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-6SYNGMU4.js";
|
|
12
|
+
import "./chunk-EBQYRNNU.js";
|
|
13
|
+
import "./chunk-OXI26S7U.js";
|
|
14
|
+
import "./chunk-CMQCO27Y.js";
|
|
15
|
+
import "./chunk-XKIEDGQF.js";
|
|
16
|
+
import "./chunk-PBGOZMVY.js";
|
|
17
|
+
import "./chunk-VRGRAQDG.js";
|
|
18
|
+
import "./chunk-CUDAT6SS.js";
|
|
19
19
|
import {
|
|
20
20
|
getEventStore
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-UVN6AKIO.js";
|
|
22
|
+
import "./chunk-KIOUKC3Z.js";
|
|
23
|
+
import "./chunk-BBC46FN4.js";
|
|
24
24
|
import {
|
|
25
25
|
createChatMessageMessage,
|
|
26
26
|
createPhaseChangedMessage,
|
|
27
27
|
createSessionRunningMessage
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
33
|
-
import "./chunk-
|
|
28
|
+
} from "./chunk-STYHKCG7.js";
|
|
29
|
+
import "./chunk-BJYPTN5S.js";
|
|
30
|
+
import "./chunk-NDJ6FKSP.js";
|
|
31
|
+
import "./chunk-CQGTEGKL.js";
|
|
32
|
+
import "./chunk-B5AP3RSV.js";
|
|
33
|
+
import "./chunk-BSTVRSV6.js";
|
|
34
34
|
import {
|
|
35
35
|
logger
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-K44MW7JJ.js";
|
|
37
37
|
|
|
38
38
|
// src/server/session/chat-handler.ts
|
|
39
39
|
var activeAgents = /* @__PURE__ */ new Map();
|
|
@@ -61,7 +61,7 @@ async function startChatSession(sessionId, content, deps, options) {
|
|
|
61
61
|
sessionManager.setRunning(sessionId, true);
|
|
62
62
|
broadcastForSession(sessionId, createSessionRunningMessage(true));
|
|
63
63
|
try {
|
|
64
|
-
const { maybeAutoCompactContext } = await import("./auto-compaction-
|
|
64
|
+
const { maybeAutoCompactContext } = await import("./auto-compaction-GOHNI2R2.js");
|
|
65
65
|
await maybeAutoCompactContext({
|
|
66
66
|
sessionManager,
|
|
67
67
|
sessionId,
|
|
@@ -121,14 +121,16 @@ async function startChatSession(sessionId, content, deps, options) {
|
|
|
121
121
|
}
|
|
122
122
|
function startTurnWithCompletionChain(sessionId, controller, deps) {
|
|
123
123
|
const { sessionManager, llmClient, statsIdentity, broadcastForSession } = deps;
|
|
124
|
-
runChatTurn(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
124
|
+
runChatTurn(
|
|
125
|
+
buildRunChatTurnParams({
|
|
126
|
+
sessionManager,
|
|
127
|
+
sessionId,
|
|
128
|
+
llmClient,
|
|
129
|
+
statsIdentity,
|
|
130
|
+
signal: controller.signal,
|
|
131
|
+
onMessage: (msg) => broadcastForSession(sessionId, msg)
|
|
132
|
+
})
|
|
133
|
+
).catch((error) => {
|
|
132
134
|
if (error instanceof Error && error.message === "Aborted") {
|
|
133
135
|
return;
|
|
134
136
|
}
|
|
@@ -170,4 +172,4 @@ export {
|
|
|
170
172
|
startChatSession,
|
|
171
173
|
stopSessionExecution
|
|
172
174
|
};
|
|
173
|
-
//# sourceMappingURL=chat-handler-
|
|
175
|
+
//# sourceMappingURL=chat-handler-K2RDXBO6.js.map
|
|
@@ -13,17 +13,17 @@ import {
|
|
|
13
13
|
getToolRegistryForAgent,
|
|
14
14
|
loadAllAgentsDefault,
|
|
15
15
|
runTopLevelAgentLoop
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-EBQYRNNU.js";
|
|
17
17
|
import {
|
|
18
18
|
getCurrentContextWindowId,
|
|
19
19
|
getEventStore
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-UVN6AKIO.js";
|
|
21
21
|
import {
|
|
22
22
|
buildSnapshotFromSessionState
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-BBC46FN4.js";
|
|
24
24
|
import {
|
|
25
25
|
logger
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-K44MW7JJ.js";
|
|
27
27
|
|
|
28
28
|
// src/server/sub-agents/verifier-helpers.ts
|
|
29
29
|
var MAX_CONSECUTIVE_VERIFIER_NUDGES = 10;
|
|
@@ -99,11 +99,19 @@ async function runChatTurn(options) {
|
|
|
99
99
|
recoverable: false
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
|
-
eventStore.append(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
eventStore.append(
|
|
103
|
+
sessionId,
|
|
104
|
+
createMessageStartEvent(
|
|
105
|
+
errorMsgId2,
|
|
106
|
+
"user",
|
|
107
|
+
`Access denied: ${error.paths.join(", ")}. If you need this file, explain why and ask the user for permission.`,
|
|
108
|
+
{
|
|
109
|
+
...getCurrentWindowMessageOptions(sessionId) ?? {},
|
|
110
|
+
isSystemGenerated: true,
|
|
111
|
+
messageKind: "correction"
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
);
|
|
107
115
|
eventStore.append(sessionId, createChatDoneEvent(errorMsgId2, "error"));
|
|
108
116
|
return;
|
|
109
117
|
}
|
|
@@ -121,11 +129,19 @@ async function runChatTurn(options) {
|
|
|
121
129
|
recoverable: false
|
|
122
130
|
}
|
|
123
131
|
});
|
|
124
|
-
eventStore.append(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
132
|
+
eventStore.append(
|
|
133
|
+
sessionId,
|
|
134
|
+
createMessageStartEvent(
|
|
135
|
+
errorMsgId,
|
|
136
|
+
"user",
|
|
137
|
+
`Error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
138
|
+
{
|
|
139
|
+
...getCurrentWindowMessageOptions(sessionId) ?? {},
|
|
140
|
+
isSystemGenerated: true,
|
|
141
|
+
messageKind: "correction"
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
);
|
|
129
145
|
eventStore.append(sessionId, createChatDoneEvent(errorMsgId, "error"));
|
|
130
146
|
} finally {
|
|
131
147
|
eventStore.append(sessionId, { type: "running.changed", data: { isRunning: false } });
|
|
@@ -173,17 +189,20 @@ async function runGenericAgentTurn(options, turnMetrics, agentId) {
|
|
|
173
189
|
injectModeReminderIfNeeded(options.sessionManager, options.sessionId, agentId, allAgents, options.onMessage);
|
|
174
190
|
const agentDef = findAgentById(agentId, allAgents) ?? findAgentById("planner", allAgents);
|
|
175
191
|
const subAgentDefs = getSubAgents(allAgents);
|
|
176
|
-
await runTopLevelAgentLoop(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
192
|
+
await runTopLevelAgentLoop(
|
|
193
|
+
{
|
|
194
|
+
mode: agentId,
|
|
195
|
+
sessionManager: options.sessionManager,
|
|
196
|
+
sessionId: options.sessionId,
|
|
197
|
+
llmClient: options.llmClient,
|
|
198
|
+
statsIdentity,
|
|
199
|
+
signal: options.signal,
|
|
200
|
+
onMessage: options.onMessage,
|
|
201
|
+
assembleRequest: (input) => assembleAgentRequest({ ...input, agentDef, subAgentDefs, modelName: options.llmClient.getModel() }),
|
|
202
|
+
getToolRegistry: () => getToolRegistryForAgent(agentDef)
|
|
203
|
+
},
|
|
204
|
+
turnMetrics
|
|
205
|
+
);
|
|
187
206
|
}
|
|
188
207
|
function filterToolRegistryForStepDone(baseRegistry, _injectStepDone) {
|
|
189
208
|
return baseRegistry;
|
|
@@ -198,50 +217,63 @@ async function runBuilderTurn(options, turnMetrics) {
|
|
|
198
217
|
const subAgentDefs = getSubAgents(allAgents);
|
|
199
218
|
let stepDoneCalled = false;
|
|
200
219
|
return {
|
|
201
|
-
...await runTopLevelAgentLoop(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
220
|
+
...await runTopLevelAgentLoop(
|
|
221
|
+
{
|
|
222
|
+
mode: "builder",
|
|
223
|
+
sessionManager,
|
|
224
|
+
sessionId,
|
|
225
|
+
llmClient: options.llmClient,
|
|
226
|
+
statsIdentity,
|
|
227
|
+
signal: options.signal,
|
|
228
|
+
onMessage: options.onMessage,
|
|
229
|
+
assembleRequest: (input) => assembleAgentRequest({
|
|
230
|
+
...input,
|
|
231
|
+
agentDef: builderDef,
|
|
232
|
+
subAgentDefs,
|
|
233
|
+
modelName: options.llmClient.getModel()
|
|
234
|
+
}),
|
|
235
|
+
getToolRegistry: () => {
|
|
236
|
+
const baseRegistry = getToolRegistryForAgent(builderDef);
|
|
237
|
+
return filterToolRegistryForStepDone(baseRegistry, options.injectStepDone === true);
|
|
238
|
+
},
|
|
239
|
+
onToolExecuted: (toolCall, toolResult) => {
|
|
240
|
+
if (toolCall.name === "step_done" && toolResult.success) {
|
|
241
|
+
stepDoneCalled = true;
|
|
242
|
+
}
|
|
243
|
+
if (toolResult.success && ["write_file", "edit_file"].includes(toolCall.name)) {
|
|
244
|
+
const path = toolCall.arguments["path"];
|
|
245
|
+
sessionManager.addModifiedFile(sessionId, path);
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
injectKickoff: () => {
|
|
249
|
+
if (options.injectBuilderKickoff !== true) return;
|
|
250
|
+
const session = sessionManager.requireSession(sessionId);
|
|
251
|
+
const currentWindowMessageOptions = getCurrentContextWindowId(sessionId) ? { contextWindowId: getCurrentContextWindowId(sessionId) } : void 0;
|
|
252
|
+
const events = eventStore.getEvents(sessionId);
|
|
253
|
+
const hasBuilderKickoff = events.some((e) => {
|
|
254
|
+
if (e.type !== "message.start") return false;
|
|
255
|
+
const data = e.data;
|
|
256
|
+
return data.messageKind === "auto-prompt" && data.content?.includes("fulfil the");
|
|
257
|
+
});
|
|
258
|
+
if (!hasBuilderKickoff) {
|
|
259
|
+
const kickoffMsgId = crypto.randomUUID();
|
|
260
|
+
const kickoffContent = BUILDER_KICKOFF_PROMPT(session.criteria.length);
|
|
261
|
+
const msgMetadata = { type: "workflow", name: "Workflow", color: "#f59e0b" };
|
|
262
|
+
eventStore.append(
|
|
263
|
+
sessionId,
|
|
264
|
+
createMessageStartEvent(kickoffMsgId, "user", kickoffContent, {
|
|
265
|
+
...currentWindowMessageOptions ?? {},
|
|
266
|
+
isSystemGenerated: true,
|
|
267
|
+
messageKind: "auto-prompt",
|
|
268
|
+
metadata: msgMetadata
|
|
269
|
+
})
|
|
270
|
+
);
|
|
271
|
+
eventStore.append(sessionId, { type: "message.done", data: { messageId: kickoffMsgId } });
|
|
272
|
+
}
|
|
221
273
|
}
|
|
222
274
|
},
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
const session = sessionManager.requireSession(sessionId);
|
|
226
|
-
const events = eventStore.getEvents(sessionId);
|
|
227
|
-
const hasBuilderKickoff = events.some((e) => {
|
|
228
|
-
if (e.type !== "message.start") return false;
|
|
229
|
-
const data = e.data;
|
|
230
|
-
return data.messageKind === "auto-prompt" && data.content?.includes("fulfil the");
|
|
231
|
-
});
|
|
232
|
-
if (!hasBuilderKickoff) {
|
|
233
|
-
const kickoffMsgId = crypto.randomUUID();
|
|
234
|
-
const kickoffContent = BUILDER_KICKOFF_PROMPT(session.criteria.length);
|
|
235
|
-
eventStore.append(sessionId, createMessageStartEvent(kickoffMsgId, "user", kickoffContent, {
|
|
236
|
-
...getCurrentWindowMessageOptions(sessionId) ?? {},
|
|
237
|
-
isSystemGenerated: true,
|
|
238
|
-
messageKind: "auto-prompt",
|
|
239
|
-
metadata: { type: "workflow", name: "Workflow", color: "#f59e0b" }
|
|
240
|
-
}));
|
|
241
|
-
eventStore.append(sessionId, { type: "message.done", data: { messageId: kickoffMsgId } });
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}, turnMetrics),
|
|
275
|
+
turnMetrics
|
|
276
|
+
),
|
|
245
277
|
stepDoneCalled
|
|
246
278
|
};
|
|
247
279
|
}
|
|
@@ -295,4 +327,4 @@ export {
|
|
|
295
327
|
runBuilderTurn,
|
|
296
328
|
runVerifierTurn
|
|
297
329
|
};
|
|
298
|
-
//# sourceMappingURL=chunk-
|
|
330
|
+
//# sourceMappingURL=chunk-6SYNGMU4.js.map
|