@clinebot/core 0.0.28 → 0.0.30
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 +7 -0
- package/dist/ClineCore.d.ts +28 -2
- package/dist/ClineCore.d.ts.map +1 -1
- package/dist/account/cline-account-service.d.ts +1 -1
- package/dist/account/cline-account-service.d.ts.map +1 -1
- package/dist/account/index.d.ts +1 -1
- package/dist/account/index.d.ts.map +1 -1
- package/dist/account/types.d.ts +5 -0
- package/dist/account/types.d.ts.map +1 -1
- package/dist/auth/bounded-ttl-cache.d.ts +14 -0
- package/dist/auth/bounded-ttl-cache.d.ts.map +1 -0
- package/dist/auth/cline.d.ts +27 -2
- package/dist/auth/cline.d.ts.map +1 -1
- package/dist/auth/oca.d.ts.map +1 -1
- package/dist/chat/chat-schema.d.ts +11 -11
- package/dist/extensions/config/agent-config-loader.d.ts.map +1 -0
- package/dist/{agents → extensions/config}/agent-config-parser.d.ts +2 -2
- package/dist/extensions/config/agent-config-parser.d.ts.map +1 -0
- package/dist/{agents → extensions/config}/hooks-config-loader.d.ts +1 -1
- package/dist/extensions/config/hooks-config-loader.d.ts.map +1 -0
- package/dist/{agents → extensions/config}/index.d.ts +2 -4
- package/dist/extensions/config/index.d.ts.map +1 -0
- package/dist/{runtime/commands.d.ts → extensions/config/runtime-commands.d.ts} +2 -3
- package/dist/extensions/config/runtime-commands.d.ts.map +1 -0
- package/dist/extensions/config/unified-config-file-watcher.d.ts.map +1 -0
- package/dist/extensions/config/user-instruction-config-loader.d.ts.map +1 -0
- package/dist/extensions/context/agentic-compaction.d.ts +13 -0
- package/dist/extensions/context/agentic-compaction.d.ts.map +1 -0
- package/dist/extensions/context/basic-compaction.d.ts +9 -0
- package/dist/extensions/context/basic-compaction.d.ts.map +1 -0
- package/dist/extensions/context/compaction-shared.d.ts +60 -0
- package/dist/extensions/context/compaction-shared.d.ts.map +1 -0
- package/dist/extensions/context/compaction.d.ts +20 -0
- package/dist/extensions/context/compaction.d.ts.map +1 -0
- package/dist/extensions/index.d.ts +5 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/mcp/client.d.ts +3 -0
- package/dist/extensions/mcp/client.d.ts.map +1 -0
- package/dist/extensions/mcp/config-loader.d.ts.map +1 -0
- package/dist/extensions/mcp/index.d.ts +9 -0
- package/dist/extensions/mcp/index.d.ts.map +1 -0
- package/dist/{mcp → extensions/mcp}/manager.d.ts +1 -2
- package/dist/extensions/mcp/manager.d.ts.map +1 -0
- package/dist/extensions/mcp/name-transform.d.ts +3 -0
- package/dist/extensions/mcp/name-transform.d.ts.map +1 -0
- package/dist/extensions/mcp/policies.d.ts +15 -0
- package/dist/extensions/mcp/policies.d.ts.map +1 -0
- package/dist/extensions/mcp/tools.d.ts +4 -0
- package/dist/extensions/mcp/tools.d.ts.map +1 -0
- package/dist/{mcp → extensions/mcp}/types.d.ts +29 -1
- package/dist/extensions/mcp/types.d.ts.map +1 -0
- package/dist/{agents → extensions/plugin}/plugin-config-loader.d.ts +1 -1
- package/dist/extensions/plugin/plugin-config-loader.d.ts.map +1 -0
- package/dist/{agents → extensions/plugin}/plugin-loader.d.ts +1 -1
- package/dist/extensions/plugin/plugin-loader.d.ts.map +1 -0
- package/dist/extensions/plugin/plugin-module-import.d.ts +5 -0
- package/dist/extensions/plugin/plugin-module-import.d.ts.map +1 -0
- package/dist/{agents → extensions/plugin}/plugin-sandbox.d.ts +1 -1
- package/dist/extensions/plugin/plugin-sandbox.d.ts.map +1 -0
- package/dist/extensions/plugin-sandbox-bootstrap.js +485 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/persistent.d.ts +64 -0
- package/dist/hooks/persistent.d.ts.map +1 -0
- package/dist/hooks/subprocess-runner.d.ts +22 -0
- package/dist/hooks/subprocess-runner.d.ts.map +1 -0
- package/dist/hooks/subprocess.d.ts +189 -0
- package/dist/hooks/subprocess.d.ts.map +1 -0
- package/dist/index.d.ts +22 -25
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +560 -447
- package/dist/prompt/default-system.d.ts +2 -0
- package/dist/prompt/default-system.d.ts.map +1 -0
- package/dist/providers/local-provider-service.d.ts +1 -1
- package/dist/providers/local-provider-service.d.ts.map +1 -1
- package/dist/runtime/checkpoint-hooks.d.ts +21 -0
- package/dist/runtime/checkpoint-hooks.d.ts.map +1 -0
- package/dist/runtime/hook-file-hooks.d.ts +1 -1
- package/dist/runtime/hook-file-hooks.d.ts.map +1 -1
- package/dist/runtime/rules.d.ts +1 -1
- package/dist/runtime/rules.d.ts.map +1 -1
- package/dist/runtime/runtime-builder.d.ts +1 -1
- package/dist/runtime/runtime-builder.d.ts.map +1 -1
- package/dist/runtime/session-runtime.d.ts +25 -5
- package/dist/runtime/session-runtime.d.ts.map +1 -1
- package/dist/runtime/subprocess-sandbox.d.ts.map +1 -0
- package/dist/runtime/team-runtime-registry.d.ts +1 -1
- package/dist/runtime/team-runtime-registry.d.ts.map +1 -1
- package/dist/runtime/tool-approval.d.ts +1 -1
- package/dist/session/default-session-manager.d.ts +9 -3
- package/dist/session/default-session-manager.d.ts.map +1 -1
- package/dist/session/file-session-service.d.ts +1 -1
- package/dist/session/file-session-service.d.ts.map +1 -1
- package/dist/session/{unified-session-persistence-service.d.ts → persistence-service.d.ts} +11 -42
- package/dist/session/persistence-service.d.ts.map +1 -0
- package/dist/session/rpc-session-service.d.ts +1 -1
- package/dist/session/rpc-session-service.d.ts.map +1 -1
- package/dist/session/session-agent-events.d.ts +1 -1
- package/dist/session/session-artifacts.d.ts.map +1 -1
- package/dist/session/session-config-builder.d.ts.map +1 -1
- package/dist/session/session-graph.d.ts +1 -1
- package/dist/session/session-graph.d.ts.map +1 -1
- package/dist/session/session-host.d.ts.map +1 -1
- package/dist/session/session-manager.d.ts +6 -5
- package/dist/session/session-manager.d.ts.map +1 -1
- package/dist/session/session-manifest.d.ts +1 -1
- package/dist/session/session-service.d.ts +3 -2
- package/dist/session/session-service.d.ts.map +1 -1
- package/dist/session/session-team-coordination.d.ts +2 -1
- package/dist/session/session-team-coordination.d.ts.map +1 -1
- package/dist/session/utils/helpers.d.ts +51 -3
- package/dist/session/utils/helpers.d.ts.map +1 -1
- package/dist/session/utils/types.d.ts +41 -7
- package/dist/session/utils/types.d.ts.map +1 -1
- package/dist/session/workspace-manager.d.ts +1 -2
- package/dist/session/workspace-manager.d.ts.map +1 -1
- package/dist/session/workspace-manifest.d.ts +1 -22
- package/dist/session/workspace-manifest.d.ts.map +1 -1
- package/dist/storage/file-team-store.d.ts +2 -1
- package/dist/storage/file-team-store.d.ts.map +1 -1
- package/dist/storage/sqlite-team-store.d.ts +4 -1
- package/dist/storage/sqlite-team-store.d.ts.map +1 -1
- package/dist/storage/team-store.d.ts.map +1 -1
- package/dist/team/delegated-agent.d.ts +44 -0
- package/dist/team/delegated-agent.d.ts.map +1 -0
- package/dist/team/index.d.ts +1 -0
- package/dist/team/index.d.ts.map +1 -1
- package/dist/team/multi-agent.d.ts +229 -0
- package/dist/team/multi-agent.d.ts.map +1 -0
- package/dist/team/projections.d.ts +2 -2
- package/dist/team/projections.d.ts.map +1 -1
- package/dist/team/runtime.d.ts +5 -0
- package/dist/team/runtime.d.ts.map +1 -0
- package/dist/team/spawn-agent-tool.d.ts +85 -0
- package/dist/team/spawn-agent-tool.d.ts.map +1 -0
- package/dist/team/subagent-prompts.d.ts +4 -0
- package/dist/team/subagent-prompts.d.ts.map +1 -0
- package/dist/team/team-tools.d.ts +35 -0
- package/dist/team/team-tools.d.ts.map +1 -0
- package/dist/telemetry/OpenTelemetryProvider.d.ts +11 -1
- package/dist/telemetry/OpenTelemetryProvider.d.ts.map +1 -1
- package/dist/telemetry/{LoggerTelemetryAdapter.d.ts → TelemetryLoggerSink.d.ts} +10 -4
- package/dist/telemetry/TelemetryLoggerSink.d.ts.map +1 -0
- package/dist/telemetry/TelemetryService.d.ts.map +1 -1
- package/dist/telemetry/index.js +15 -28
- package/dist/tools/definitions.d.ts +4 -3
- package/dist/tools/definitions.d.ts.map +1 -1
- package/dist/tools/index.d.ts +5 -5
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/model-tool-routing.d.ts.map +1 -1
- package/dist/tools/presets.d.ts +26 -0
- package/dist/tools/presets.d.ts.map +1 -1
- package/dist/tools/schemas.d.ts +8 -0
- package/dist/tools/schemas.d.ts.map +1 -1
- package/dist/tools/types.d.ts +23 -2
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/types/config.d.ts +47 -3
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/events.d.ts +1 -1
- package/dist/types/provider-settings.d.ts +1 -1
- package/dist/types/provider-settings.d.ts.map +1 -1
- package/dist/types/storage.d.ts +2 -1
- package/dist/types/storage.d.ts.map +1 -1
- package/dist/types.d.ts +7 -16
- package/dist/types.d.ts.map +1 -1
- package/package.json +15 -12
- package/src/ClineCore.test.ts +150 -0
- package/src/ClineCore.ts +114 -8
- package/src/account/cline-account-service.test.ts +84 -0
- package/src/account/cline-account-service.ts +2 -2
- package/src/account/index.ts +1 -0
- package/src/account/types.ts +6 -0
- package/src/auth/bounded-ttl-cache.test.ts +38 -0
- package/src/auth/bounded-ttl-cache.ts +53 -0
- package/src/auth/cline.test.ts +173 -36
- package/src/auth/cline.ts +395 -93
- package/src/auth/oca.test.ts +125 -0
- package/src/auth/oca.ts +17 -4
- package/src/{agents → extensions/config}/agent-config-loader.test.ts +1 -1
- package/src/{agents → extensions/config}/agent-config-parser.ts +2 -2
- package/src/{agents → extensions/config}/hooks-config-loader.ts +1 -1
- package/src/{agents → extensions/config}/index.ts +7 -11
- package/src/{runtime/commands.test.ts → extensions/config/runtime-commands.test.ts} +20 -3
- package/src/{runtime/commands.ts → extensions/config/runtime-commands.ts} +1 -8
- package/src/{agents → extensions/config}/unified-config-file-watcher.ts +15 -2
- package/src/{agents → extensions/config}/user-instruction-config-loader.test.ts +90 -2
- package/src/{agents → extensions/config}/user-instruction-config-loader.ts +126 -12
- package/src/extensions/context/agentic-compaction.ts +119 -0
- package/src/extensions/context/basic-compaction.ts +275 -0
- package/src/extensions/context/compaction-shared.ts +458 -0
- package/src/extensions/context/compaction.test.ts +477 -0
- package/src/extensions/context/compaction.ts +203 -0
- package/src/extensions/index.ts +12 -0
- package/src/extensions/mcp/client.ts +420 -0
- package/src/{mcp → extensions/mcp}/index.ts +16 -0
- package/src/{mcp → extensions/mcp}/manager.test.ts +1 -2
- package/src/{mcp → extensions/mcp}/manager.ts +3 -5
- package/src/extensions/mcp/name-transform.ts +33 -0
- package/src/extensions/mcp/policies.ts +47 -0
- package/src/extensions/mcp/tools.ts +47 -0
- package/src/{mcp → extensions/mcp}/types.ts +35 -7
- package/src/{agents → extensions/plugin}/plugin-config-loader.test.ts +18 -13
- package/src/{agents → extensions/plugin}/plugin-config-loader.ts +1 -1
- package/src/{agents → extensions/plugin}/plugin-loader.test.ts +41 -4
- package/src/extensions/plugin/plugin-loader.ts +106 -0
- package/src/extensions/plugin/plugin-module-import.ts +278 -0
- package/src/{agents → extensions/plugin}/plugin-sandbox-bootstrap.ts +30 -92
- package/src/{agents → extensions/plugin}/plugin-sandbox.test.ts +60 -3
- package/src/{agents → extensions/plugin}/plugin-sandbox.ts +146 -56
- package/src/hooks/index.ts +25 -0
- package/src/hooks/persistent.ts +661 -0
- package/src/hooks/subprocess-runner.ts +196 -0
- package/src/hooks/subprocess.ts +669 -0
- package/src/index.ts +200 -118
- package/src/prompt/default-system.ts +21 -0
- package/src/providers/local-provider-registry.ts +1 -1
- package/src/providers/local-provider-service.test.ts +23 -2
- package/src/providers/local-provider-service.ts +2 -2
- package/src/runtime/checkpoint-hooks.test.ts +168 -0
- package/src/runtime/checkpoint-hooks.ts +186 -0
- package/src/runtime/hook-file-hooks.test.ts +40 -1
- package/src/runtime/hook-file-hooks.ts +35 -16
- package/src/runtime/index.ts +4 -19
- package/src/runtime/rules.ts +4 -1
- package/src/runtime/runtime-builder.team-persistence.test.ts +3 -6
- package/src/runtime/runtime-builder.test.ts +266 -160
- package/src/runtime/runtime-builder.ts +120 -47
- package/src/runtime/runtime-parity.test.ts +22 -22
- package/src/runtime/session-runtime.ts +36 -6
- package/src/runtime/{sandbox/subprocess-sandbox.ts → subprocess-sandbox.ts} +24 -3
- package/src/runtime/team-runtime-registry.ts +1 -4
- package/src/runtime/tool-approval.ts +1 -1
- package/src/session/default-session-manager.e2e.test.ts +2 -2
- package/src/session/default-session-manager.test.ts +553 -9
- package/src/session/default-session-manager.ts +162 -46
- package/src/session/file-session-service.ts +3 -3
- package/src/session/index.ts +6 -6
- package/src/session/persistence-service.test.ts +212 -0
- package/src/session/{unified-session-persistence-service.ts → persistence-service.ts} +106 -172
- package/src/session/rpc-session-service.ts +3 -3
- package/src/session/runtime-oauth-token-manager.ts +1 -1
- package/src/session/session-agent-events.ts +1 -1
- package/src/session/session-artifacts.ts +32 -4
- package/src/session/session-config-builder.ts +22 -9
- package/src/session/session-graph.ts +1 -1
- package/src/session/session-host.ts +19 -11
- package/src/session/session-manager.ts +11 -6
- package/src/session/session-service.team-persistence.test.ts +1 -1
- package/src/session/session-service.ts +6 -9
- package/src/session/session-team-coordination.ts +7 -3
- package/src/session/session-telemetry.ts +1 -1
- package/src/session/utils/helpers.test.ts +160 -0
- package/src/session/utils/helpers.ts +289 -42
- package/src/session/utils/types.ts +47 -7
- package/src/session/workspace-manager.ts +5 -3
- package/src/session/workspace-manifest.ts +3 -49
- package/src/storage/file-team-store.ts +2 -5
- package/src/storage/provider-settings-legacy-migration.ts +2 -2
- package/src/storage/provider-settings-manager.test.ts +1 -1
- package/src/storage/sqlite-team-store.ts +212 -125
- package/src/storage/team-store.ts +1 -5
- package/src/team/delegated-agent.ts +131 -0
- package/src/team/index.ts +1 -0
- package/src/team/multi-agent.lifecycle.test.ts +201 -0
- package/src/team/multi-agent.ts +1666 -0
- package/src/team/projections.ts +2 -4
- package/src/team/runtime.ts +54 -0
- package/src/team/spawn-agent-tool.test.ts +387 -0
- package/src/team/spawn-agent-tool.ts +207 -0
- package/src/team/subagent-prompts.ts +41 -0
- package/src/team/team-tools.test.ts +802 -0
- package/src/team/team-tools.ts +792 -0
- package/src/telemetry/OpenTelemetryAdapter.ts +1 -1
- package/src/telemetry/OpenTelemetryProvider.test.ts +216 -3
- package/src/telemetry/OpenTelemetryProvider.ts +110 -20
- package/src/telemetry/TelemetryLoggerSink.test.ts +42 -0
- package/src/telemetry/{LoggerTelemetryAdapter.ts → TelemetryLoggerSink.ts} +21 -14
- package/src/telemetry/TelemetryService.test.ts +7 -7
- package/src/telemetry/TelemetryService.ts +2 -4
- package/src/tools/definitions.test.ts +76 -0
- package/src/tools/definitions.ts +41 -2
- package/src/tools/executors/apply-patch.ts +1 -1
- package/src/tools/executors/editor.ts +1 -1
- package/src/tools/executors/file-read.ts +1 -1
- package/src/tools/executors/search.ts +1 -1
- package/src/tools/executors/web-fetch.ts +1 -1
- package/src/tools/index.ts +6 -1
- package/src/tools/model-tool-routing.ts +2 -0
- package/src/tools/presets.test.ts +8 -0
- package/src/tools/presets.ts +40 -2
- package/src/tools/schemas.ts +19 -0
- package/src/tools/types.ts +31 -2
- package/src/types/config.ts +61 -7
- package/src/types/events.ts +1 -1
- package/src/types/index.ts +0 -1
- package/src/types/provider-settings.ts +1 -1
- package/src/types/storage.ts +2 -5
- package/src/types.ts +32 -44
- package/dist/agents/agent-config-loader.d.ts.map +0 -1
- package/dist/agents/agent-config-parser.d.ts.map +0 -1
- package/dist/agents/hooks-config-loader.d.ts.map +0 -1
- package/dist/agents/index.d.ts.map +0 -1
- package/dist/agents/plugin-config-loader.d.ts.map +0 -1
- package/dist/agents/plugin-loader.d.ts.map +0 -1
- package/dist/agents/plugin-sandbox-bootstrap.js +0 -446
- package/dist/agents/plugin-sandbox.d.ts.map +0 -1
- package/dist/agents/unified-config-file-watcher.d.ts.map +0 -1
- package/dist/agents/user-instruction-config-loader.d.ts.map +0 -1
- package/dist/mcp/config-loader.d.ts.map +0 -1
- package/dist/mcp/index.d.ts +0 -5
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/manager.d.ts.map +0 -1
- package/dist/mcp/types.d.ts.map +0 -1
- package/dist/runtime/commands.d.ts.map +0 -1
- package/dist/runtime/sandbox/subprocess-sandbox.d.ts.map +0 -1
- package/dist/runtime/skills.d.ts +0 -14
- package/dist/runtime/skills.d.ts.map +0 -1
- package/dist/runtime/workflows.d.ts +0 -14
- package/dist/runtime/workflows.d.ts.map +0 -1
- package/dist/session/unified-session-persistence-service.d.ts.map +0 -1
- package/dist/telemetry/LoggerTelemetryAdapter.d.ts.map +0 -1
- package/dist/types/workspace.d.ts +0 -8
- package/dist/types/workspace.d.ts.map +0 -1
- package/src/agents/plugin-loader.ts +0 -175
- package/src/runtime/skills.ts +0 -44
- package/src/runtime/workflows.test.ts +0 -119
- package/src/runtime/workflows.ts +0 -45
- package/src/session/unified-session-persistence-service.test.ts +0 -85
- package/src/telemetry/LoggerTelemetryAdapter.test.ts +0 -42
- package/src/types/workspace.ts +0 -7
- /package/dist/{agents → extensions/config}/agent-config-loader.d.ts +0 -0
- /package/dist/{agents → extensions/config}/unified-config-file-watcher.d.ts +0 -0
- /package/dist/{agents → extensions/config}/user-instruction-config-loader.d.ts +0 -0
- /package/dist/{mcp → extensions/mcp}/config-loader.d.ts +0 -0
- /package/dist/runtime/{sandbox/subprocess-sandbox.d.ts → subprocess-sandbox.d.ts} +0 -0
- /package/src/{agents → extensions/config}/agent-config-loader.ts +0 -0
- /package/src/{agents → extensions/config}/hooks-config-loader.test.ts +0 -0
- /package/src/{agents → extensions/config}/unified-config-file-watcher.test.ts +0 -0
- /package/src/{mcp → extensions/mcp}/config-loader.test.ts +0 -0
- /package/src/{mcp → extensions/mcp}/config-loader.ts +0 -0
|
@@ -187,6 +187,82 @@ describe("default ask_question tool", () => {
|
|
|
187
187
|
});
|
|
188
188
|
});
|
|
189
189
|
|
|
190
|
+
describe("default submit_and_exit tool", () => {
|
|
191
|
+
it("is excluded by default even when executor is provided", () => {
|
|
192
|
+
const tools = createDefaultTools({
|
|
193
|
+
executors: {
|
|
194
|
+
submit: async () => "ok",
|
|
195
|
+
},
|
|
196
|
+
});
|
|
197
|
+
expect(tools.map((tool) => tool.name)).not.toContain("submit_and_exit");
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it("is included only when enabled with a submit executor", () => {
|
|
201
|
+
const toolsWithoutExecutor = createDefaultTools({
|
|
202
|
+
executors: {},
|
|
203
|
+
enableSubmitAndExit: true,
|
|
204
|
+
});
|
|
205
|
+
expect(toolsWithoutExecutor.map((tool) => tool.name)).not.toContain(
|
|
206
|
+
"submit_and_exit",
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
const toolsWithExecutor = createDefaultTools({
|
|
210
|
+
executors: {
|
|
211
|
+
submit: async () => "ok",
|
|
212
|
+
},
|
|
213
|
+
enableSubmitAndExit: true,
|
|
214
|
+
});
|
|
215
|
+
expect(toolsWithExecutor.map((tool) => tool.name)).toContain(
|
|
216
|
+
"submit_and_exit",
|
|
217
|
+
);
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it("validates and executes submit_and_exit input", async () => {
|
|
221
|
+
const execute = vi.fn(async () => "submitted");
|
|
222
|
+
const tools = createDefaultTools({
|
|
223
|
+
executors: {
|
|
224
|
+
submit: execute,
|
|
225
|
+
},
|
|
226
|
+
enableReadFiles: false,
|
|
227
|
+
enableSearch: false,
|
|
228
|
+
enableBash: false,
|
|
229
|
+
enableWebFetch: false,
|
|
230
|
+
enableEditor: false,
|
|
231
|
+
enableSkills: false,
|
|
232
|
+
enableAskQuestion: false,
|
|
233
|
+
enableSubmitAndExit: true,
|
|
234
|
+
});
|
|
235
|
+
const submitTool = tools.find((tool) => tool.name === "submit_and_exit");
|
|
236
|
+
expect(submitTool).toBeDefined();
|
|
237
|
+
if (!submitTool) {
|
|
238
|
+
throw new Error("Expected submit_and_exit tool to be defined.");
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const result = await submitTool.execute(
|
|
242
|
+
{
|
|
243
|
+
summary: "Done and verified with the requested checks.",
|
|
244
|
+
verified: true,
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
agentId: "agent-1",
|
|
248
|
+
conversationId: "conv-1",
|
|
249
|
+
iteration: 1,
|
|
250
|
+
},
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
expect(result).toBe("submitted");
|
|
254
|
+
expect(execute).toHaveBeenCalledWith(
|
|
255
|
+
"Done and verified with the requested checks.",
|
|
256
|
+
true,
|
|
257
|
+
expect.objectContaining({
|
|
258
|
+
agentId: "agent-1",
|
|
259
|
+
conversationId: "conv-1",
|
|
260
|
+
iteration: 1,
|
|
261
|
+
}),
|
|
262
|
+
);
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
|
|
190
266
|
describe("default apply_patch tool", () => {
|
|
191
267
|
it("is included only when enabled with an applyPatch executor", () => {
|
|
192
268
|
const toolsWithoutExecutor = createDefaultTools({
|
package/src/tools/definitions.ts
CHANGED
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
* Factory functions for creating the default tools.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import {
|
|
8
|
+
createTool,
|
|
9
|
+
type Tool,
|
|
10
|
+
validateWithZod,
|
|
11
|
+
zodToJsonSchema,
|
|
12
|
+
} from "@clinebot/shared";
|
|
9
13
|
import {
|
|
10
14
|
formatError,
|
|
11
15
|
formatReadFileQuery,
|
|
@@ -37,6 +41,8 @@ import {
|
|
|
37
41
|
SkillsInputSchema,
|
|
38
42
|
type StructuredCommandInput,
|
|
39
43
|
StructuredCommandsInputUnionSchema,
|
|
44
|
+
type SubmitInput,
|
|
45
|
+
SubmitInputSchema,
|
|
40
46
|
} from "./schemas";
|
|
41
47
|
import type {
|
|
42
48
|
ApplyPatchExecutor,
|
|
@@ -49,6 +55,7 @@ import type {
|
|
|
49
55
|
SearchExecutor,
|
|
50
56
|
SkillsExecutorWithMetadata,
|
|
51
57
|
ToolOperationResult,
|
|
58
|
+
VerifySubmitExecutor,
|
|
52
59
|
WebFetchExecutor,
|
|
53
60
|
} from "./types";
|
|
54
61
|
|
|
@@ -603,6 +610,34 @@ export function createAskQuestionTool(
|
|
|
603
610
|
});
|
|
604
611
|
}
|
|
605
612
|
|
|
613
|
+
export function createSubmitAndExitTool(
|
|
614
|
+
executor: VerifySubmitExecutor,
|
|
615
|
+
config: Pick<DefaultToolsConfig, "submitTimeoutMs"> = {},
|
|
616
|
+
): Tool<SubmitInput, string> {
|
|
617
|
+
const timeoutMs = config.submitTimeoutMs ?? 15000;
|
|
618
|
+
|
|
619
|
+
return createTool<SubmitInput, string>({
|
|
620
|
+
name: "submit_and_exit",
|
|
621
|
+
description:
|
|
622
|
+
"Submit the final answer and exit the conversation. " +
|
|
623
|
+
"For example, submit a summary of the investigation and confirm the issue is resolved. " +
|
|
624
|
+
"You should only submit once all necessary steps are completed. " +
|
|
625
|
+
"Provide a summary of the investigation and confirm the issue is resolved.",
|
|
626
|
+
inputSchema: zodToJsonSchema(SubmitInputSchema),
|
|
627
|
+
timeoutMs,
|
|
628
|
+
retryable: false,
|
|
629
|
+
maxRetries: 0,
|
|
630
|
+
execute: async (input, context) => {
|
|
631
|
+
const validatedInput = validateWithZod(SubmitInputSchema, input);
|
|
632
|
+
return withTimeout(
|
|
633
|
+
executor(validatedInput.summary, validatedInput.verified, context),
|
|
634
|
+
timeoutMs,
|
|
635
|
+
`submit_and_exit timed out after ${timeoutMs}ms`,
|
|
636
|
+
);
|
|
637
|
+
},
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
|
|
606
641
|
// =============================================================================
|
|
607
642
|
// Default Tools Factory
|
|
608
643
|
// =============================================================================
|
|
@@ -657,6 +692,7 @@ export function createDefaultTools(options: CreateDefaultToolsOptions): Tool[] {
|
|
|
657
692
|
enableEditor = true,
|
|
658
693
|
enableSkills = true,
|
|
659
694
|
enableAskQuestion = true,
|
|
695
|
+
enableSubmitAndExit = false,
|
|
660
696
|
...config
|
|
661
697
|
} = options;
|
|
662
698
|
|
|
@@ -703,6 +739,9 @@ export function createDefaultTools(options: CreateDefaultToolsOptions): Tool[] {
|
|
|
703
739
|
// Add ask_question tool if enabled and executor provided
|
|
704
740
|
if (enableAskQuestion && executors.askQuestion) {
|
|
705
741
|
tools.push(createAskQuestionTool(executors.askQuestion, config));
|
|
742
|
+
} else if (enableSubmitAndExit && executors.submit) {
|
|
743
|
+
// Add submit_and_exit tool if enabled and executor provided
|
|
744
|
+
tools.push(createSubmitAndExitTool(executors.submit, config));
|
|
706
745
|
}
|
|
707
746
|
|
|
708
747
|
return tools;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import * as fs from "node:fs/promises";
|
|
8
8
|
import * as path from "node:path";
|
|
9
|
-
import type { ToolContext } from "@clinebot/
|
|
9
|
+
import type { ToolContext } from "@clinebot/shared";
|
|
10
10
|
import type { ApplyPatchInput } from "../schemas";
|
|
11
11
|
import type { ApplyPatchExecutor } from "../types";
|
|
12
12
|
import {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import * as fs from "node:fs/promises";
|
|
8
8
|
import * as path from "node:path";
|
|
9
|
-
import type { ToolContext } from "@clinebot/
|
|
9
|
+
import type { ToolContext } from "@clinebot/shared";
|
|
10
10
|
import type { EditFileInput } from "../schemas";
|
|
11
11
|
import type { EditorExecutor } from "../types";
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import * as fs from "node:fs/promises";
|
|
8
8
|
import * as path from "node:path";
|
|
9
|
-
import type { ToolContext } from "@clinebot/
|
|
9
|
+
import type { ToolContext } from "@clinebot/shared";
|
|
10
10
|
import type { ReadFileRequest } from "../schemas";
|
|
11
11
|
import type { FileReadExecutor } from "../types";
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import * as fs from "node:fs/promises";
|
|
8
8
|
import * as path from "node:path";
|
|
9
|
-
import type { ToolContext } from "@clinebot/
|
|
9
|
+
import type { ToolContext } from "@clinebot/shared";
|
|
10
10
|
import { getFileIndex } from "../../input";
|
|
11
11
|
import type { SearchExecutor } from "../types";
|
|
12
12
|
|
package/src/tools/index.ts
CHANGED
|
@@ -18,6 +18,7 @@ export {
|
|
|
18
18
|
createReadFilesTool,
|
|
19
19
|
createSearchTool,
|
|
20
20
|
createSkillsTool,
|
|
21
|
+
createSubmitAndExitTool,
|
|
21
22
|
createWebFetchTool,
|
|
22
23
|
createWindowsShellTool,
|
|
23
24
|
} from "./definitions";
|
|
@@ -47,6 +48,7 @@ export {
|
|
|
47
48
|
export {
|
|
48
49
|
createDefaultToolsWithPreset,
|
|
49
50
|
createToolPoliciesWithPreset,
|
|
51
|
+
resolveToolPresetName,
|
|
50
52
|
type ToolPolicyPresetName,
|
|
51
53
|
type ToolPresetName,
|
|
52
54
|
ToolPresets,
|
|
@@ -71,6 +73,8 @@ export {
|
|
|
71
73
|
SearchCodebaseInputSchema,
|
|
72
74
|
type SkillsInput,
|
|
73
75
|
SkillsInputSchema,
|
|
76
|
+
type SubmitInput,
|
|
77
|
+
SubmitInputSchema,
|
|
74
78
|
type WebFetchRequest,
|
|
75
79
|
WebFetchRequestSchema,
|
|
76
80
|
} from "./schemas";
|
|
@@ -90,6 +94,7 @@ export type {
|
|
|
90
94
|
SkillsExecutorWithMetadata,
|
|
91
95
|
ToolExecutors,
|
|
92
96
|
ToolOperationResult,
|
|
97
|
+
VerifySubmitExecutor,
|
|
93
98
|
WebFetchExecutor,
|
|
94
99
|
} from "./types";
|
|
95
100
|
|
|
@@ -97,7 +102,7 @@ export type {
|
|
|
97
102
|
// Convenience: Create Tools with Built-in Executors
|
|
98
103
|
// =============================================================================
|
|
99
104
|
|
|
100
|
-
import type { Tool } from "@clinebot/
|
|
105
|
+
import type { Tool } from "@clinebot/shared";
|
|
101
106
|
import { createDefaultTools } from "./definitions";
|
|
102
107
|
import {
|
|
103
108
|
createDefaultExecutors,
|
|
@@ -43,6 +43,7 @@ const TOOL_NAME_TO_FLAG: Record<
|
|
|
43
43
|
| "enableEditor"
|
|
44
44
|
| "enableSkills"
|
|
45
45
|
| "enableAskQuestion"
|
|
46
|
+
| "enableSubmitAndExit"
|
|
46
47
|
>
|
|
47
48
|
> = {
|
|
48
49
|
read_files: "enableReadFiles",
|
|
@@ -53,6 +54,7 @@ const TOOL_NAME_TO_FLAG: Record<
|
|
|
53
54
|
editor: "enableEditor",
|
|
54
55
|
skills: "enableSkills",
|
|
55
56
|
ask_question: "enableAskQuestion",
|
|
57
|
+
submit_and_exit: "enableSubmitAndExit",
|
|
56
58
|
};
|
|
57
59
|
|
|
58
60
|
export const DEFAULT_MODEL_TOOL_ROUTING_RULES: ToolRoutingRule[] = [
|
|
@@ -14,6 +14,14 @@ describe("default tool presets", () => {
|
|
|
14
14
|
expect(ToolPresets.yolo.enableAskQuestion).toBe(false);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
+
it("disables spawn and team tools by default in yolo mode", () => {
|
|
18
|
+
expect(ToolPresets.development.enableSpawnAgent).toBe(true);
|
|
19
|
+
expect(ToolPresets.development.enableAgentTeams).toBe(true);
|
|
20
|
+
expect(ToolPresets.yolo.enableSpawnAgent).toBe(false);
|
|
21
|
+
expect(ToolPresets.yolo.enableAgentTeams).toBe(false);
|
|
22
|
+
expect(ToolPresets.yolo.enableSubmitAndExit).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
|
|
17
25
|
it("yolo preset excludes ask_question even when its executor exists", () => {
|
|
18
26
|
const tools = createDefaultToolsWithPreset("yolo", {
|
|
19
27
|
executors: {
|
package/src/tools/presets.ts
CHANGED
|
@@ -9,6 +9,11 @@ import { ALL_DEFAULT_TOOL_NAMES } from "./constants";
|
|
|
9
9
|
import { createDefaultTools } from "./definitions";
|
|
10
10
|
import type { CreateDefaultToolsOptions, DefaultToolsConfig } from "./types";
|
|
11
11
|
|
|
12
|
+
export interface ToolPresetConfig extends DefaultToolsConfig {
|
|
13
|
+
enableSpawnAgent?: boolean;
|
|
14
|
+
enableAgentTeams?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
12
17
|
/**
|
|
13
18
|
* Preset configurations for common use cases
|
|
14
19
|
*/
|
|
@@ -25,6 +30,9 @@ export const ToolPresets = {
|
|
|
25
30
|
enableEditor: false,
|
|
26
31
|
enableSkills: true,
|
|
27
32
|
enableAskQuestion: true,
|
|
33
|
+
enableSubmitAndExit: false,
|
|
34
|
+
enableSpawnAgent: true,
|
|
35
|
+
enableAgentTeams: true,
|
|
28
36
|
},
|
|
29
37
|
|
|
30
38
|
/**
|
|
@@ -40,6 +48,9 @@ export const ToolPresets = {
|
|
|
40
48
|
enableEditor: false,
|
|
41
49
|
enableSkills: false,
|
|
42
50
|
enableAskQuestion: false,
|
|
51
|
+
enableSubmitAndExit: false,
|
|
52
|
+
enableSpawnAgent: true,
|
|
53
|
+
enableAgentTeams: true,
|
|
43
54
|
},
|
|
44
55
|
|
|
45
56
|
/**
|
|
@@ -55,6 +66,9 @@ export const ToolPresets = {
|
|
|
55
66
|
enableEditor: true,
|
|
56
67
|
enableSkills: true,
|
|
57
68
|
enableAskQuestion: true,
|
|
69
|
+
enableSubmitAndExit: true,
|
|
70
|
+
enableSpawnAgent: true,
|
|
71
|
+
enableAgentTeams: true,
|
|
58
72
|
},
|
|
59
73
|
|
|
60
74
|
/**
|
|
@@ -70,6 +84,9 @@ export const ToolPresets = {
|
|
|
70
84
|
enableEditor: false,
|
|
71
85
|
enableSkills: true,
|
|
72
86
|
enableAskQuestion: true,
|
|
87
|
+
enableSubmitAndExit: false,
|
|
88
|
+
enableSpawnAgent: true,
|
|
89
|
+
enableAgentTeams: true,
|
|
73
90
|
},
|
|
74
91
|
|
|
75
92
|
/**
|
|
@@ -85,6 +102,9 @@ export const ToolPresets = {
|
|
|
85
102
|
enableEditor: false,
|
|
86
103
|
enableSkills: false,
|
|
87
104
|
enableAskQuestion: true,
|
|
105
|
+
enableSubmitAndExit: false,
|
|
106
|
+
enableSpawnAgent: false,
|
|
107
|
+
enableAgentTeams: false,
|
|
88
108
|
},
|
|
89
109
|
|
|
90
110
|
/**
|
|
@@ -100,14 +120,27 @@ export const ToolPresets = {
|
|
|
100
120
|
enableEditor: true,
|
|
101
121
|
enableSkills: true,
|
|
102
122
|
enableAskQuestion: false,
|
|
123
|
+
enableSubmitAndExit: true,
|
|
124
|
+
enableSpawnAgent: false,
|
|
125
|
+
enableAgentTeams: false,
|
|
103
126
|
},
|
|
104
|
-
} as const satisfies Record<string,
|
|
127
|
+
} as const satisfies Record<string, ToolPresetConfig>;
|
|
105
128
|
|
|
106
129
|
/**
|
|
107
130
|
* Type for preset names
|
|
108
131
|
*/
|
|
109
132
|
export type ToolPresetName = keyof typeof ToolPresets;
|
|
110
133
|
|
|
134
|
+
export function resolveToolPresetName(options: {
|
|
135
|
+
mode?: "act" | "plan";
|
|
136
|
+
yolo?: boolean;
|
|
137
|
+
}): ToolPresetName {
|
|
138
|
+
if (options.mode === "plan") {
|
|
139
|
+
return "readonly";
|
|
140
|
+
}
|
|
141
|
+
return options.yolo === true ? "yolo" : "development";
|
|
142
|
+
}
|
|
143
|
+
|
|
111
144
|
/**
|
|
112
145
|
* Tool policy preset names
|
|
113
146
|
*/
|
|
@@ -161,8 +194,13 @@ export function createDefaultToolsWithPreset(
|
|
|
161
194
|
Partial<DefaultToolsConfig>,
|
|
162
195
|
): Tool[] {
|
|
163
196
|
const preset = ToolPresets[presetName];
|
|
197
|
+
const {
|
|
198
|
+
enableSpawnAgent: _enableSpawnAgent,
|
|
199
|
+
enableAgentTeams: _enableAgentTeams,
|
|
200
|
+
...toolConfig
|
|
201
|
+
} = preset;
|
|
164
202
|
return createDefaultTools({
|
|
165
|
-
...
|
|
203
|
+
...toolConfig,
|
|
166
204
|
...options,
|
|
167
205
|
});
|
|
168
206
|
}
|
package/src/tools/schemas.ts
CHANGED
|
@@ -269,6 +269,20 @@ export const AskQuestionInputSchema = z.object({
|
|
|
269
269
|
),
|
|
270
270
|
});
|
|
271
271
|
|
|
272
|
+
export const SubmitInputSchema = z.object({
|
|
273
|
+
summary: z
|
|
274
|
+
.string()
|
|
275
|
+
.min(10)
|
|
276
|
+
.describe(
|
|
277
|
+
"Summarization of the investigation, steps taken, and resolution status to submit at the end of the session. Before submitting, read the problem again along with any provided test's assertions carefully and confirm your fix produces the expected output.",
|
|
278
|
+
),
|
|
279
|
+
verified: z
|
|
280
|
+
.boolean()
|
|
281
|
+
.describe(
|
|
282
|
+
`Have you verified that the issue is resolved to the best of your knowledge, including updating and creating all the requested files and items? 'True' if you have completed the investigation and taken all necessary steps to resolve the issue.\n'False' if you have done all you can but cannot resolve the issue or if you are stuck and cannot proceed further. =\nIMPORTANT: You must run the specific failing test(s) mentioned in the issue or test patch and include the test output in your reasoning. If the test still fails after your fix, you must revise. Do NOT submit with 'true' unless the test output shows the test passing.`,
|
|
283
|
+
),
|
|
284
|
+
});
|
|
285
|
+
|
|
272
286
|
// =============================================================================
|
|
273
287
|
// Type Definitions (derived from Zod schemas)
|
|
274
288
|
// =============================================================================
|
|
@@ -325,3 +339,8 @@ export type SkillsInput = z.infer<typeof SkillsInputSchema>;
|
|
|
325
339
|
* Input for the ask_followup_question tool
|
|
326
340
|
*/
|
|
327
341
|
export type AskQuestionInput = z.infer<typeof AskQuestionInputSchema>;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Input for the submit and exit tool
|
|
345
|
+
*/
|
|
346
|
+
export type SubmitInput = z.infer<typeof SubmitInputSchema>;
|
package/src/tools/types.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Type definitions for executors, configuration, and results.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { ToolContext } from "@clinebot/
|
|
7
|
+
import type { ToolContext } from "@clinebot/shared";
|
|
8
8
|
import type {
|
|
9
9
|
ApplyPatchInput,
|
|
10
10
|
EditFileInput,
|
|
@@ -172,6 +172,20 @@ export interface SkillsExecutorWithMetadata {
|
|
|
172
172
|
configuredSkills?: SkillsExecutorSkillMetadata[];
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
/**
|
|
176
|
+
* Executor for verifying a user's response to a question
|
|
177
|
+
*
|
|
178
|
+
* @param summary - Summary of the solution ans steps taken
|
|
179
|
+
* @param verified - Boolean indicating if the solution has been verified
|
|
180
|
+
* @param context - Tool execution context
|
|
181
|
+
* @returns Executor-specific result payload
|
|
182
|
+
*/
|
|
183
|
+
export type VerifySubmitExecutor = (
|
|
184
|
+
summary: string,
|
|
185
|
+
verified: boolean,
|
|
186
|
+
context: ToolContext,
|
|
187
|
+
) => Promise<string>;
|
|
188
|
+
|
|
175
189
|
/**
|
|
176
190
|
* Collection of all tool executors
|
|
177
191
|
*/
|
|
@@ -192,6 +206,8 @@ export interface ToolExecutors {
|
|
|
192
206
|
skills?: SkillsExecutorWithMetadata;
|
|
193
207
|
/** Follow-up question implementation */
|
|
194
208
|
askQuestion?: AskQuestionExecutor;
|
|
209
|
+
/** Final submission implementation */
|
|
210
|
+
submit?: VerifySubmitExecutor;
|
|
195
211
|
}
|
|
196
212
|
|
|
197
213
|
// =============================================================================
|
|
@@ -209,7 +225,8 @@ export type DefaultToolName =
|
|
|
209
225
|
| "apply_patch"
|
|
210
226
|
| "editor"
|
|
211
227
|
| "skills"
|
|
212
|
-
| "ask_question"
|
|
228
|
+
| "ask_question"
|
|
229
|
+
| "submit_and_exit";
|
|
213
230
|
|
|
214
231
|
/**
|
|
215
232
|
* Configuration for enabling/disabling default tools
|
|
@@ -263,6 +280,12 @@ export interface DefaultToolsConfig {
|
|
|
263
280
|
*/
|
|
264
281
|
enableAskQuestion?: boolean;
|
|
265
282
|
|
|
283
|
+
/**
|
|
284
|
+
* Enable the submit_and_exit tool
|
|
285
|
+
* @default false
|
|
286
|
+
*/
|
|
287
|
+
enableSubmitAndExit?: boolean;
|
|
288
|
+
|
|
266
289
|
/**
|
|
267
290
|
* Current working directory for tools that need it
|
|
268
291
|
*/
|
|
@@ -315,6 +338,12 @@ export interface DefaultToolsConfig {
|
|
|
315
338
|
* @default 15000
|
|
316
339
|
*/
|
|
317
340
|
askQuestionTimeoutMs?: number;
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Timeout for submit_and_exit operations in milliseconds
|
|
344
|
+
* @default 15000
|
|
345
|
+
*/
|
|
346
|
+
submitTimeoutMs?: number;
|
|
318
347
|
}
|
|
319
348
|
|
|
320
349
|
/**
|
package/src/types/config.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
+
import type * as LlmsProviders from "@clinebot/llms";
|
|
1
2
|
import type {
|
|
2
3
|
AgentConfig,
|
|
3
4
|
AgentHooks,
|
|
5
|
+
AgentMode,
|
|
6
|
+
BasicLogger,
|
|
4
7
|
ConsecutiveMistakeLimitContext,
|
|
5
8
|
ConsecutiveMistakeLimitDecision,
|
|
9
|
+
ExtensionContext,
|
|
6
10
|
HookErrorMode,
|
|
7
|
-
TeamEvent,
|
|
8
|
-
Tool,
|
|
9
|
-
} from "@clinebot/agents";
|
|
10
|
-
import type * as LlmsProviders from "@clinebot/llms/providers";
|
|
11
|
-
import type {
|
|
12
|
-
AgentMode,
|
|
13
|
-
BasicLogger,
|
|
14
11
|
ITelemetryService,
|
|
12
|
+
MessageWithMetadata,
|
|
15
13
|
SessionExecutionConfig,
|
|
16
14
|
SessionPromptConfig,
|
|
17
15
|
SessionWorkspaceConfig,
|
|
16
|
+
Tool,
|
|
18
17
|
} from "@clinebot/shared";
|
|
18
|
+
import type { TeamEvent } from "../team";
|
|
19
19
|
import type { ToolRoutingRule } from "../tools/model-tool-routing";
|
|
20
20
|
|
|
21
21
|
export type CoreAgentMode = AgentMode;
|
|
@@ -42,6 +42,57 @@ export interface CoreRuntimeFeatures {
|
|
|
42
42
|
enableTools: boolean;
|
|
43
43
|
enableSpawnAgent: boolean;
|
|
44
44
|
enableAgentTeams: boolean;
|
|
45
|
+
yolo?: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface CoreCompactionContext {
|
|
49
|
+
agentId: string;
|
|
50
|
+
conversationId: string;
|
|
51
|
+
parentAgentId: string | null;
|
|
52
|
+
iteration: number;
|
|
53
|
+
messages: MessageWithMetadata[];
|
|
54
|
+
model: {
|
|
55
|
+
id: string;
|
|
56
|
+
provider: string;
|
|
57
|
+
info?: LlmsProviders.ModelInfo;
|
|
58
|
+
};
|
|
59
|
+
contextWindowTokens: number;
|
|
60
|
+
triggerTokens: number;
|
|
61
|
+
thresholdRatio: number;
|
|
62
|
+
utilizationRatio: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface CoreCompactionResult {
|
|
66
|
+
messages: MessageWithMetadata[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface CoreCompactionSummarizerConfig {
|
|
70
|
+
providerId: string;
|
|
71
|
+
modelId: string;
|
|
72
|
+
apiKey?: string;
|
|
73
|
+
baseUrl?: string;
|
|
74
|
+
headers?: Record<string, string>;
|
|
75
|
+
knownModels?: Record<string, LlmsProviders.ModelInfo>;
|
|
76
|
+
providerConfig?: LlmsProviders.ProviderConfig;
|
|
77
|
+
maxOutputTokens?: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export type CoreCompactionStrategy = "basic" | "agentic";
|
|
81
|
+
|
|
82
|
+
export interface CoreCompactionConfig {
|
|
83
|
+
enabled?: boolean;
|
|
84
|
+
strategy?: CoreCompactionStrategy;
|
|
85
|
+
thresholdRatio?: number;
|
|
86
|
+
reserveTokens?: number;
|
|
87
|
+
preserveRecentTokens?: number;
|
|
88
|
+
contextWindowTokens?: number;
|
|
89
|
+
summarizer?: CoreCompactionSummarizerConfig;
|
|
90
|
+
compact?: (
|
|
91
|
+
context: CoreCompactionContext,
|
|
92
|
+
) =>
|
|
93
|
+
| Promise<CoreCompactionResult | undefined>
|
|
94
|
+
| CoreCompactionResult
|
|
95
|
+
| undefined;
|
|
45
96
|
}
|
|
46
97
|
|
|
47
98
|
export interface CoreSessionConfig
|
|
@@ -67,10 +118,12 @@ export interface CoreSessionConfig
|
|
|
67
118
|
hookErrorMode?: HookErrorMode;
|
|
68
119
|
logger?: BasicLogger;
|
|
69
120
|
telemetry?: ITelemetryService;
|
|
121
|
+
extensionContext?: ExtensionContext;
|
|
70
122
|
extraTools?: Tool[];
|
|
71
123
|
pluginPaths?: string[];
|
|
72
124
|
extensions?: AgentConfig["extensions"];
|
|
73
125
|
execution?: AgentConfig["execution"];
|
|
126
|
+
compaction?: CoreCompactionConfig;
|
|
74
127
|
onTeamEvent?: (event: TeamEvent) => void;
|
|
75
128
|
onConsecutiveMistakeLimitReached?: (
|
|
76
129
|
context: ConsecutiveMistakeLimitContext,
|
|
@@ -83,4 +136,5 @@ export interface CoreSessionConfig
|
|
|
83
136
|
* skills are surfaced in tool metadata and invocable by name.
|
|
84
137
|
*/
|
|
85
138
|
skills?: string[];
|
|
139
|
+
workspaceMetadata?: string;
|
|
86
140
|
}
|
package/src/types/events.ts
CHANGED
|
@@ -60,7 +60,7 @@ export type CoreSessionEvent =
|
|
|
60
60
|
type: "agent_event";
|
|
61
61
|
payload: {
|
|
62
62
|
sessionId: string;
|
|
63
|
-
event: import("@clinebot/
|
|
63
|
+
event: import("@clinebot/shared").AgentEvent;
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
| { type: "team_progress"; payload: SessionTeamProgressEvent }
|
package/src/types/index.ts
CHANGED
package/src/types/storage.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
TeamRuntimeState,
|
|
4
|
-
TeamTeammateSpec,
|
|
5
|
-
} from "@clinebot/agents";
|
|
1
|
+
import type { TeamRuntimeState, TeamTeammateSpec } from "@clinebot/shared";
|
|
2
|
+
import type { TeamEvent } from "../team";
|
|
6
3
|
import type { SessionStatus } from "./common";
|
|
7
4
|
import type { SessionRecord } from "./sessions";
|
|
8
5
|
|