@levelcode/sdk 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/src/actions.d.ts +176 -0
- package/dist/common/src/analytics-core.d.ts +52 -0
- package/dist/common/src/analytics.d.ts +9 -0
- package/dist/common/src/browser-actions.d.ts +1200 -0
- package/dist/common/src/constants/agents.d.ts +47 -0
- package/dist/common/src/constants/analytics-events.d.ts +107 -0
- package/dist/common/src/constants/byok.d.ts +2 -0
- package/dist/common/src/constants/claude-oauth.d.ts +36 -0
- package/dist/common/src/constants/index.d.ts +4 -0
- package/dist/common/src/constants/knowledge.d.ts +21 -0
- package/dist/common/src/constants/limits.d.ts +14 -0
- package/dist/common/src/constants/model-config.d.ts +117 -0
- package/dist/common/src/constants/paths.d.ts +23 -0
- package/dist/common/src/constants/skills.d.ts +42 -0
- package/dist/common/src/constants/ui.d.ts +14 -0
- package/dist/common/src/env-ci.d.ts +22 -0
- package/dist/common/src/env-process.d.ts +28 -0
- package/dist/common/src/env-schema.d.ts +24 -0
- package/dist/common/src/env.d.ts +16 -0
- package/dist/common/src/mcp/client.d.ts +6 -0
- package/dist/common/src/old-constants.d.ts +10 -0
- package/dist/common/src/project-file-tree.d.ts +27 -0
- package/dist/common/src/templates/agent-validation.d.ts +48 -0
- package/dist/common/src/templates/initial-agents-dir/types/agent-definition.d.ts +296 -0
- package/dist/common/src/templates/initial-agents-dir/types/tools.d.ts +308 -0
- package/dist/common/src/templates/initial-agents-dir/types/util-types.d.ts +128 -0
- package/dist/common/src/testing/errors.d.ts +14 -0
- package/dist/common/src/testing/mock-modules.d.ts +11 -0
- package/dist/common/src/testing/mock-types.d.ts +97 -0
- package/dist/common/src/testing/mocks/analytics.d.ts +182 -0
- package/dist/common/src/testing/mocks/child-process.d.ts +29 -0
- package/dist/common/src/testing/mocks/crypto.d.ts +159 -0
- package/dist/common/src/testing/mocks/database.d.ts +197 -0
- package/dist/common/src/testing/mocks/fetch.d.ts +35 -0
- package/dist/common/src/testing/mocks/filesystem.d.ts +31 -0
- package/dist/common/src/testing/mocks/index.d.ts +25 -0
- package/dist/common/src/testing/mocks/logger.d.ts +35 -0
- package/dist/common/src/testing/mocks/stream.d.ts +203 -0
- package/dist/common/src/testing/mocks/timers.d.ts +27 -0
- package/dist/common/src/testing/mocks/tree-sitter.d.ts +58 -0
- package/dist/common/src/testing-env-process.d.ts +7 -0
- package/dist/common/src/tools/constants.d.ts +17 -0
- package/dist/common/src/tools/list.d.ts +1140 -0
- package/dist/common/src/tools/params/tool/add-message.d.ts +19 -0
- package/dist/common/src/tools/params/tool/add-subgoal.d.ts +26 -0
- package/dist/common/src/tools/params/tool/ask-user.d.ts +59 -0
- package/dist/common/src/tools/params/tool/browser-logs.d.ts +127 -0
- package/dist/common/src/tools/params/tool/code-search.d.ts +30 -0
- package/dist/common/src/tools/params/tool/create-plan.d.ts +30 -0
- package/dist/common/src/tools/params/tool/end-turn.d.ts +13 -0
- package/dist/common/src/tools/params/tool/find-files.d.ts +31 -0
- package/dist/common/src/tools/params/tool/glob.d.ts +26 -0
- package/dist/common/src/tools/params/tool/list-directory.d.ts +25 -0
- package/dist/common/src/tools/params/tool/lookup-agent-info.d.ts +13 -0
- package/dist/common/src/tools/params/tool/propose-str-replace.d.ts +40 -0
- package/dist/common/src/tools/params/tool/propose-write-file.d.ts +29 -0
- package/dist/common/src/tools/params/tool/read-docs.d.ts +19 -0
- package/dist/common/src/tools/params/tool/read-files.d.ts +35 -0
- package/dist/common/src/tools/params/tool/read-subtree.d.ts +40 -0
- package/dist/common/src/tools/params/tool/run-file-change-hooks.d.ts +63 -0
- package/dist/common/src/tools/params/tool/run-terminal-command.d.ts +88 -0
- package/dist/common/src/tools/params/tool/send-message.d.ts +26 -0
- package/dist/common/src/tools/params/tool/set-messages.d.ts +15 -0
- package/dist/common/src/tools/params/tool/set-output.d.ts +15 -0
- package/dist/common/src/tools/params/tool/skill.d.ts +28 -0
- package/dist/common/src/tools/params/tool/spawn-agent-inline.d.ts +17 -0
- package/dist/common/src/tools/params/tool/spawn-agents.d.ts +26 -0
- package/dist/common/src/tools/params/tool/str-replace.d.ts +43 -0
- package/dist/common/src/tools/params/tool/suggest-followups.d.ts +26 -0
- package/dist/common/src/tools/params/tool/task-completed.d.ts +13 -0
- package/dist/common/src/tools/params/tool/task-create.d.ts +18 -0
- package/dist/common/src/tools/params/tool/task-get.d.ts +15 -0
- package/dist/common/src/tools/params/tool/task-list.d.ts +13 -0
- package/dist/common/src/tools/params/tool/task-update.d.ts +23 -0
- package/dist/common/src/tools/params/tool/team-create.d.ts +17 -0
- package/dist/common/src/tools/params/tool/team-delete.d.ts +13 -0
- package/dist/common/src/tools/params/tool/think-deeply.d.ts +15 -0
- package/dist/common/src/tools/params/tool/update-subgoal.d.ts +25 -0
- package/dist/common/src/tools/params/tool/web-search.d.ts +25 -0
- package/dist/common/src/tools/params/tool/write-file.d.ts +31 -0
- package/dist/common/src/tools/params/tool/write-todos.d.ts +18 -0
- package/dist/common/src/tools/params/utils.d.ts +35 -0
- package/dist/common/src/tools/utils.d.ts +4 -0
- package/dist/common/src/types/agent-template.d.ts +156 -0
- package/dist/common/src/types/contracts/agent-runtime.d.ts +36 -0
- package/dist/common/src/types/contracts/analytics.d.ts +8 -0
- package/dist/common/src/types/contracts/billing.d.ts +40 -0
- package/dist/common/src/types/contracts/client.d.ts +45 -0
- package/dist/common/src/types/contracts/database.d.ts +80 -0
- package/dist/common/src/types/contracts/env.d.ts +150 -0
- package/dist/common/src/types/contracts/llm.d.ts +102 -0
- package/dist/common/src/types/contracts/logger.d.ts +8 -0
- package/dist/common/src/types/dynamic-agent-template.d.ts +227 -0
- package/dist/common/src/types/filesystem.d.ts +6 -0
- package/dist/common/src/types/function-params.d.ts +15 -0
- package/dist/common/src/types/grant.d.ts +2 -0
- package/dist/common/src/types/json.d.ts +9 -0
- package/dist/common/src/types/mcp.d.ts +31 -0
- package/dist/common/src/types/messages/content-part.d.ts +46 -0
- package/dist/common/src/types/messages/data-content.d.ts +3 -0
- package/dist/common/src/types/messages/levelcode-message.d.ts +37 -0
- package/dist/common/src/types/messages/provider-metadata.d.ts +3 -0
- package/dist/common/src/types/print-mode.d.ts +155 -0
- package/dist/common/src/types/session-state.d.ts +94 -0
- package/dist/common/src/types/skill.d.ts +31 -0
- package/dist/common/src/types/source.d.ts +8 -0
- package/dist/common/src/types/spawn.d.ts +8 -0
- package/dist/common/src/types/team-config.d.ts +39 -0
- package/dist/common/src/types/team-protocol.d.ts +64 -0
- package/dist/common/src/util/agent-id-parsing.d.ts +22 -0
- package/dist/common/src/util/agent-name-normalization.d.ts +12 -0
- package/dist/common/src/util/array.d.ts +6 -0
- package/dist/common/src/util/credentials.d.ts +11 -0
- package/dist/common/src/util/error.d.ts +128 -0
- package/dist/common/src/util/file.d.ts +133 -0
- package/dist/common/src/util/format-code-search.d.ts +16 -0
- package/dist/common/src/util/lru-cache.d.ts +30 -0
- package/dist/common/src/util/messages.d.ts +46 -0
- package/dist/common/src/util/model-utils.d.ts +8 -0
- package/dist/common/src/util/object.d.ts +22 -0
- package/dist/common/src/util/promise.d.ts +16 -0
- package/dist/common/src/util/random.d.ts +1 -0
- package/dist/common/src/util/skills.d.ts +5 -0
- package/dist/common/src/util/stop-sequence.d.ts +14 -0
- package/dist/common/src/util/string.d.ts +82 -0
- package/dist/common/src/util/xml.d.ts +12 -0
- package/dist/common/src/util/zod-schema.d.ts +5 -0
- package/dist/common/src/utils/team-fs.d.ts +17 -0
- package/dist/index.cjs +1958 -917
- package/dist/index.cjs.map +25 -10
- package/dist/index.mjs +2392 -1351
- package/dist/index.mjs.map +25 -10
- package/dist/packages/agent-runtime/src/constants.d.ts +1 -0
- package/dist/packages/agent-runtime/src/fast-rewrite.d.ts +45 -0
- package/dist/packages/agent-runtime/src/find-files/request-files-prompt.d.ts +71 -0
- package/dist/packages/agent-runtime/src/generate-diffs-prompt.d.ts +53 -0
- package/dist/packages/agent-runtime/src/get-file-reading-updates.d.ts +8 -0
- package/dist/packages/agent-runtime/src/llm-api/claude.d.ts +5 -0
- package/dist/packages/agent-runtime/src/llm-api/context7-api.d.ts +55 -0
- package/dist/packages/agent-runtime/src/llm-api/gemini-with-fallbacks.d.ts +40 -0
- package/dist/packages/agent-runtime/src/llm-api/levelcode-web-api.d.ts +49 -0
- package/dist/packages/agent-runtime/src/llm-api/relace-api.d.ts +16 -0
- package/dist/packages/agent-runtime/src/main-prompt.d.ts +29 -0
- package/dist/packages/agent-runtime/src/mcp-constants.d.ts +12 -0
- package/dist/packages/agent-runtime/src/mcp.d.ts +10 -0
- package/dist/packages/agent-runtime/src/process-file-block.d.ts +56 -0
- package/dist/packages/agent-runtime/src/process-str-replace.d.ts +21 -0
- package/dist/packages/agent-runtime/src/prompt-agent-stream.d.ts +28 -0
- package/dist/packages/agent-runtime/src/run-agent-step.d.ts +73 -0
- package/dist/packages/agent-runtime/src/run-programmatic-step.d.ts +40 -0
- package/dist/packages/agent-runtime/src/system-prompt/prompts.d.ts +19 -0
- package/dist/packages/agent-runtime/src/system-prompt/search-system-prompt.d.ts +14 -0
- package/dist/packages/agent-runtime/src/system-prompt/truncate-file-tree.d.ts +13 -0
- package/dist/packages/agent-runtime/src/templates/agent-registry.d.ts +35 -0
- package/dist/packages/agent-runtime/src/templates/prompts.d.ts +35 -0
- package/dist/packages/agent-runtime/src/templates/strings.d.ts +32 -0
- package/dist/packages/agent-runtime/src/templates/types.d.ts +13 -0
- package/dist/packages/agent-runtime/src/tool-stream-parser.d.ts +31 -0
- package/dist/packages/agent-runtime/src/tools/handlers/handler-function-type.d.ts +51 -0
- package/dist/packages/agent-runtime/src/tools/handlers/list.d.ts +347 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/add-message.d.ts +9 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/add-subgoal.d.ts +9 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/ask-user.d.ts +10 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/browser-logs.d.ts +8 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/code-search.d.ts +8 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/create-plan.d.ts +13 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/end-turn.d.ts +7 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/find-files.d.ts +27 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/glob.d.ts +10 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/list-directory.d.ts +10 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/lookup-agent-info.d.ts +14 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/propose-str-replace.d.ts +15 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/propose-write-file.d.ts +7 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/proposed-content-store.d.ts +27 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/read-docs.d.ts +21 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/read-files.d.ts +13 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/read-subtree.d.ts +13 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/run-file-change-hooks.d.ts +10 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/run-terminal-command.d.ts +10 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/send-message.d.ts +10 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/set-messages.d.ts +9 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/set-output.d.ts +18 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/skill.d.ts +11 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agent-inline.d.ts +29 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agent-utils.d.ts +100 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agents.d.ts +35 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/str-replace.d.ts +16 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/suggest-followups.d.ts +9 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/task-completed.d.ts +7 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/task-create.d.ts +9 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/task-get.d.ts +9 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/task-list.d.ts +9 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/task-update.d.ts +9 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/team-create.d.ts +10 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/team-delete.d.ts +10 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/think-deeply.d.ts +9 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/update-subgoal.d.ts +11 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/web-search.d.ts +22 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/write-file.d.ts +49 -0
- package/dist/packages/agent-runtime/src/tools/handlers/tool/write-todos.d.ts +9 -0
- package/dist/packages/agent-runtime/src/tools/prompts.d.ts +31 -0
- package/dist/packages/agent-runtime/src/tools/stream-parser.d.ts +33 -0
- package/dist/packages/agent-runtime/src/tools/tool-executor.d.ts +87 -0
- package/dist/packages/agent-runtime/src/util/agent-output.d.ts +3 -0
- package/dist/packages/agent-runtime/src/util/messages.d.ts +68 -0
- package/dist/packages/agent-runtime/src/util/parse-tool-calls-from-text.d.ts +38 -0
- package/dist/packages/agent-runtime/src/util/render-read-files-result.d.ts +15 -0
- package/dist/packages/agent-runtime/src/util/simplify-tool-results.d.ts +7 -0
- package/dist/packages/agent-runtime/src/util/stream-xml-parser.d.ts +34 -0
- package/dist/packages/agent-runtime/src/util/token-counter.d.ts +3 -0
- package/dist/packages/code-map/src/index.d.ts +3 -0
- package/dist/packages/code-map/src/init-node.d.ts +4 -0
- package/dist/packages/code-map/src/languages.d.ts +36 -0
- package/dist/packages/code-map/src/parse.d.ts +21 -0
- package/dist/packages/code-map/src/types.d.ts +8 -0
- package/dist/packages/code-map/src/utils.d.ts +1 -0
- package/dist/sdk/src/__tests__/client.test.d.ts +1 -0
- package/dist/sdk/src/__tests__/code-search.test.d.ts +1 -0
- package/dist/sdk/src/__tests__/credentials.test.d.ts +1 -0
- package/dist/sdk/src/__tests__/database.test.d.ts +1 -0
- package/dist/sdk/src/__tests__/env.test.d.ts +1 -0
- package/dist/sdk/src/__tests__/error-utils.test.d.ts +1 -0
- package/dist/sdk/src/__tests__/initial-session-state.test.d.ts +1 -0
- package/dist/sdk/src/__tests__/knowledge-file-selection.test.d.ts +1 -0
- package/dist/sdk/src/__tests__/load-agents.test.d.ts +1 -0
- package/dist/sdk/src/__tests__/load-mcp-config.test.d.ts +1 -0
- package/dist/sdk/src/__tests__/model-provider.test.d.ts +1 -0
- package/dist/sdk/src/__tests__/read-files.test.d.ts +1 -0
- package/dist/sdk/src/__tests__/run-cancellation.test.d.ts +1 -0
- package/dist/sdk/src/__tests__/run-file-filter.test.d.ts +1 -0
- package/dist/sdk/src/__tests__/run-handle-event.test.d.ts +1 -0
- package/dist/sdk/src/__tests__/run.integration.test.d.ts +1 -0
- package/dist/sdk/src/__tests__/user-knowledge-files.test.d.ts +1 -0
- package/dist/sdk/src/__tests__/validate-agents.test.d.ts +1 -0
- package/dist/sdk/src/agents/load-agents.d.ts +106 -0
- package/dist/sdk/src/agents/load-mcp-config.d.ts +69 -0
- package/dist/sdk/src/client.d.ts +33 -0
- package/dist/sdk/src/constants.d.ts +4 -0
- package/dist/sdk/src/credentials.d.ts +58 -0
- package/dist/sdk/src/custom-tool.d.ts +32 -0
- package/dist/sdk/src/env.d.ts +31 -0
- package/dist/sdk/src/error-utils.d.ts +55 -0
- package/dist/sdk/src/impl/__tests__/prompt-result.test.d.ts +1 -0
- package/dist/sdk/src/impl/agent-runtime.d.ts +8 -0
- package/dist/sdk/src/impl/database.d.ts +7 -0
- package/dist/sdk/src/impl/llm.d.ts +8 -0
- package/dist/sdk/src/impl/model-provider.d.ts +61 -0
- package/dist/sdk/src/index.d.ts +41 -0
- package/dist/sdk/src/native/ripgrep.d.ts +7 -0
- package/dist/sdk/src/retry-config.d.ts +46 -0
- package/dist/sdk/src/run-state.d.ts +81 -0
- package/dist/sdk/src/run.d.ts +79 -0
- package/dist/sdk/src/skills/load-skills.d.ts +42 -0
- package/dist/sdk/src/testing/env.d.ts +5 -0
- package/dist/sdk/src/tools/change-file.d.ts +7 -0
- package/dist/sdk/src/tools/code-search.d.ts +13 -0
- package/dist/sdk/src/tools/glob.d.ts +8 -0
- package/dist/sdk/src/tools/index.d.ts +16 -0
- package/dist/sdk/src/tools/list-directory.d.ts +7 -0
- package/dist/sdk/src/tools/read-files.d.ts +16 -0
- package/dist/sdk/src/tools/run-file-change-hooks.d.ts +4 -0
- package/dist/sdk/src/tools/run-terminal-command.d.ts +8 -0
- package/dist/sdk/src/types/env.d.ts +30 -0
- package/dist/sdk/src/validate-agents.d.ts +45 -0
- package/package.json +1 -1
- package/dist/index.d.ts +0 -3443
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FileProcessingState } from './write-file';
|
|
2
|
+
import type { ClientToolCall, LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
3
|
+
import type { Logger } from '@levelcode/common/types/contracts/logger';
|
|
4
|
+
export declare const handleCreatePlan: (params: {
|
|
5
|
+
previousToolCallFinished: Promise<void>;
|
|
6
|
+
toolCall: LevelCodeToolCall<"create_plan">;
|
|
7
|
+
fileProcessingState: FileProcessingState;
|
|
8
|
+
logger: Logger;
|
|
9
|
+
requestClientToolCall: (toolCall: ClientToolCall<"create_plan">) => Promise<LevelCodeToolOutput<"create_plan">>;
|
|
10
|
+
writeToClient: (chunk: string) => void;
|
|
11
|
+
}) => Promise<{
|
|
12
|
+
output: LevelCodeToolOutput<"create_plan">;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
export declare const handleEndTurn: (params: {
|
|
3
|
+
previousToolCallFinished: Promise<any>;
|
|
4
|
+
toolCall: LevelCodeToolCall<"end_turn">;
|
|
5
|
+
}) => Promise<{
|
|
6
|
+
output: LevelCodeToolOutput<"end_turn">;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { requestRelevantFiles, requestRelevantFilesForTraining } from '../../../find-files/request-files-prompt';
|
|
2
|
+
import { getFileReadingUpdates } from '../../../get-file-reading-updates';
|
|
3
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
4
|
+
import type { RequestFilesFn } from '@levelcode/common/types/contracts/client';
|
|
5
|
+
import type { Logger } from '@levelcode/common/types/contracts/logger';
|
|
6
|
+
import type { ParamsExcluding, ParamsOf } from '@levelcode/common/types/function-params';
|
|
7
|
+
import type { AgentState } from '@levelcode/common/types/session-state';
|
|
8
|
+
import type { ProjectFileContext } from '@levelcode/common/util/file';
|
|
9
|
+
export declare const handleFindFiles: (params: {
|
|
10
|
+
previousToolCallFinished: Promise<any>;
|
|
11
|
+
toolCall: LevelCodeToolCall<"find_files">;
|
|
12
|
+
logger: Logger;
|
|
13
|
+
agentState: AgentState;
|
|
14
|
+
agentStepId: string;
|
|
15
|
+
clientSessionId: string;
|
|
16
|
+
fileContext: ProjectFileContext;
|
|
17
|
+
fingerprintId: string;
|
|
18
|
+
repoId: string | undefined;
|
|
19
|
+
userId: string | undefined;
|
|
20
|
+
userInputId: string;
|
|
21
|
+
} & ParamsExcluding<typeof requestRelevantFiles, "messages" | "system" | "assistantPrompt"> & ParamsExcluding<typeof uploadExpandedFileContextForTraining, "messages" | "system" | "assistantPrompt"> & ParamsExcluding<typeof getFileReadingUpdates, "requestedFiles">) => Promise<{
|
|
22
|
+
output: LevelCodeToolOutput<"find_files">;
|
|
23
|
+
}>;
|
|
24
|
+
declare function uploadExpandedFileContextForTraining(params: {
|
|
25
|
+
requestFiles: RequestFilesFn;
|
|
26
|
+
} & ParamsOf<typeof requestRelevantFilesForTraining>): Promise<void>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ClientToolCall, LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
type ToolName = 'glob';
|
|
3
|
+
export declare const handleGlob: (params: {
|
|
4
|
+
previousToolCallFinished: Promise<void>;
|
|
5
|
+
toolCall: LevelCodeToolCall<ToolName>;
|
|
6
|
+
requestClientToolCall: (toolCall: ClientToolCall<ToolName>) => Promise<LevelCodeToolOutput<ToolName>>;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
output: LevelCodeToolOutput<ToolName>;
|
|
9
|
+
}>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ClientToolCall, LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
type ToolName = 'list_directory';
|
|
3
|
+
export declare const handleListDirectory: (params: {
|
|
4
|
+
previousToolCallFinished: Promise<void>;
|
|
5
|
+
toolCall: LevelCodeToolCall<ToolName>;
|
|
6
|
+
requestClientToolCall: (toolCall: ClientToolCall<ToolName>) => Promise<LevelCodeToolOutput<ToolName>>;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
output: LevelCodeToolOutput<ToolName>;
|
|
9
|
+
}>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
import type { AgentTemplate, Logger } from '@levelcode/common/types/agent-template';
|
|
3
|
+
import type { FetchAgentFromDatabaseFn } from '@levelcode/common/types/contracts/database';
|
|
4
|
+
export declare const handleLookupAgentInfo: (params: {
|
|
5
|
+
toolCall: LevelCodeToolCall<"lookup_agent_info">;
|
|
6
|
+
previousToolCallFinished: Promise<void>;
|
|
7
|
+
apiKey: string;
|
|
8
|
+
databaseAgentCache: Map<string, AgentTemplate | null>;
|
|
9
|
+
localAgentTemplates: Record<string, AgentTemplate>;
|
|
10
|
+
logger: Logger;
|
|
11
|
+
fetchAgentFromDatabase: FetchAgentFromDatabaseFn;
|
|
12
|
+
}) => Promise<{
|
|
13
|
+
output: LevelCodeToolOutput<"lookup_agent_info">;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
import type { RequestOptionalFileFn } from '@levelcode/common/types/contracts/client';
|
|
3
|
+
import type { Logger } from '@levelcode/common/types/contracts/logger';
|
|
4
|
+
import type { ParamsExcluding } from '@levelcode/common/types/function-params';
|
|
5
|
+
import type { AgentState } from '@levelcode/common/types/session-state';
|
|
6
|
+
export declare const handleProposeStrReplace: (params: {
|
|
7
|
+
previousToolCallFinished: Promise<void>;
|
|
8
|
+
toolCall: LevelCodeToolCall<"propose_str_replace">;
|
|
9
|
+
logger: Logger;
|
|
10
|
+
agentState: AgentState;
|
|
11
|
+
runId: string;
|
|
12
|
+
requestOptionalFile: RequestOptionalFileFn;
|
|
13
|
+
} & ParamsExcluding<RequestOptionalFileFn, "filePath">) => Promise<{
|
|
14
|
+
output: LevelCodeToolOutput<"propose_str_replace">;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LevelCodeToolHandlerFunction } from '../handler-function-type';
|
|
2
|
+
/**
|
|
3
|
+
* Proposes writing a file without actually applying the changes.
|
|
4
|
+
* Simply overwrites the file exactly with the given content (creating if it doesn't exist).
|
|
5
|
+
* Returns a unified diff of the changes for review.
|
|
6
|
+
*/
|
|
7
|
+
export declare const handleProposeWriteFile: LevelCodeToolHandlerFunction<"propose_write_file">;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Store for proposed file content by runId.
|
|
3
|
+
* This allows propose_str_replace and propose_write_file tools to
|
|
4
|
+
* track proposed changes within an agent run, isolated by runId.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Get the proposed content map for a specific runId.
|
|
8
|
+
* Creates an empty record if none exists.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getProposedContentForRun(runId: string): Record<string, Promise<string | null>>;
|
|
11
|
+
/**
|
|
12
|
+
* Get proposed content for a specific file in a run.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getProposedContent(runId: string, path: string): Promise<string | null> | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Set proposed content for a specific file in a run.
|
|
17
|
+
*/
|
|
18
|
+
export declare function setProposedContent(runId: string, path: string, content: Promise<string | null>): void;
|
|
19
|
+
/**
|
|
20
|
+
* Clear all proposed content for a specific runId.
|
|
21
|
+
* Should be called when an agent run completes.
|
|
22
|
+
*/
|
|
23
|
+
export declare function clearProposedContentForRun(runId: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* Clear all proposed content (for testing purposes).
|
|
26
|
+
*/
|
|
27
|
+
export declare function clearAllProposedContent(): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { fetchContext7LibraryDocumentation } from '../../../llm-api/context7-api';
|
|
2
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
3
|
+
import type { ClientEnv, CiEnv } from '@levelcode/common/types/contracts/env';
|
|
4
|
+
import type { Logger } from '@levelcode/common/types/contracts/logger';
|
|
5
|
+
import type { ParamsExcluding } from '@levelcode/common/types/function-params';
|
|
6
|
+
export declare const handleReadDocs: (params: {
|
|
7
|
+
previousToolCallFinished: Promise<void>;
|
|
8
|
+
toolCall: LevelCodeToolCall<"read_docs">;
|
|
9
|
+
agentStepId: string;
|
|
10
|
+
clientSessionId: string;
|
|
11
|
+
fingerprintId: string;
|
|
12
|
+
logger: Logger;
|
|
13
|
+
repoId: string | undefined;
|
|
14
|
+
userId: string | undefined;
|
|
15
|
+
userInputId: string;
|
|
16
|
+
clientEnv: ClientEnv;
|
|
17
|
+
ciEnv: CiEnv;
|
|
18
|
+
} & ParamsExcluding<typeof fetchContext7LibraryDocumentation, "query" | "topic" | "tokens">) => Promise<{
|
|
19
|
+
output: LevelCodeToolOutput<"read_docs">;
|
|
20
|
+
creditsUsed: number;
|
|
21
|
+
}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getFileReadingUpdates } from '../../../get-file-reading-updates';
|
|
2
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
3
|
+
import type { ParamsExcluding } from '@levelcode/common/types/function-params';
|
|
4
|
+
import type { ProjectFileContext } from '@levelcode/common/util/file';
|
|
5
|
+
type ToolName = 'read_files';
|
|
6
|
+
export declare const handleReadFiles: (params: {
|
|
7
|
+
previousToolCallFinished: Promise<void>;
|
|
8
|
+
toolCall: LevelCodeToolCall<ToolName>;
|
|
9
|
+
fileContext: ProjectFileContext;
|
|
10
|
+
} & ParamsExcluding<typeof getFileReadingUpdates, "requestedFiles">) => Promise<{
|
|
11
|
+
output: LevelCodeToolOutput<ToolName>;
|
|
12
|
+
}>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
import type { Logger } from '@levelcode/common/types/contracts/logger';
|
|
3
|
+
import type { ProjectFileContext } from '@levelcode/common/util/file';
|
|
4
|
+
type ToolName = 'read_subtree';
|
|
5
|
+
export declare const handleReadSubtree: (params: {
|
|
6
|
+
previousToolCallFinished: Promise<void>;
|
|
7
|
+
toolCall: LevelCodeToolCall<ToolName>;
|
|
8
|
+
fileContext: ProjectFileContext;
|
|
9
|
+
logger: Logger;
|
|
10
|
+
}) => Promise<{
|
|
11
|
+
output: LevelCodeToolOutput<ToolName>;
|
|
12
|
+
}>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ClientToolCall, LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
type ToolName = 'run_file_change_hooks';
|
|
3
|
+
export declare const handleRunFileChangeHooks: (params: {
|
|
4
|
+
previousToolCallFinished: Promise<void>;
|
|
5
|
+
toolCall: LevelCodeToolCall<ToolName>;
|
|
6
|
+
requestClientToolCall: (toolCall: ClientToolCall<ToolName>) => Promise<LevelCodeToolOutput<ToolName>>;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
output: LevelCodeToolOutput<ToolName>;
|
|
9
|
+
}>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ClientToolCall, LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
type ToolName = 'run_terminal_command';
|
|
3
|
+
export declare const handleRunTerminalCommand: ({ previousToolCallFinished, toolCall, requestClientToolCall, }: {
|
|
4
|
+
previousToolCallFinished: Promise<void>;
|
|
5
|
+
toolCall: LevelCodeToolCall<ToolName>;
|
|
6
|
+
requestClientToolCall: (toolCall: ClientToolCall<ToolName>) => Promise<LevelCodeToolOutput<ToolName>>;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
output: LevelCodeToolOutput<ToolName>;
|
|
9
|
+
}>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
type ToolName = 'send_message';
|
|
3
|
+
export declare const handleSendMessage: (params: {
|
|
4
|
+
previousToolCallFinished: Promise<void>;
|
|
5
|
+
toolCall: LevelCodeToolCall<ToolName>;
|
|
6
|
+
agentStepId: string;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
output: LevelCodeToolOutput<ToolName>;
|
|
9
|
+
}>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
import type { AgentState } from '@levelcode/common/types/session-state';
|
|
3
|
+
export declare const handleSetMessages: (params: {
|
|
4
|
+
previousToolCallFinished: Promise<void>;
|
|
5
|
+
toolCall: LevelCodeToolCall<"set_messages">;
|
|
6
|
+
agentState: AgentState;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
output: LevelCodeToolOutput<"set_messages">;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
import type { AgentTemplate, Logger } from '@levelcode/common/types/agent-template';
|
|
3
|
+
import type { FetchAgentFromDatabaseFn } from '@levelcode/common/types/contracts/database';
|
|
4
|
+
import type { AgentState } from '@levelcode/common/types/session-state';
|
|
5
|
+
type ToolName = 'set_output';
|
|
6
|
+
export declare const handleSetOutput: (params: {
|
|
7
|
+
previousToolCallFinished: Promise<void>;
|
|
8
|
+
toolCall: LevelCodeToolCall<ToolName>;
|
|
9
|
+
agentState: AgentState;
|
|
10
|
+
apiKey: string;
|
|
11
|
+
databaseAgentCache: Map<string, AgentTemplate | null>;
|
|
12
|
+
localAgentTemplates: Record<string, AgentTemplate>;
|
|
13
|
+
logger: Logger;
|
|
14
|
+
fetchAgentFromDatabase: FetchAgentFromDatabaseFn;
|
|
15
|
+
}) => Promise<{
|
|
16
|
+
output: LevelCodeToolOutput<ToolName>;
|
|
17
|
+
}>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
import type { ProjectFileContext } from '@levelcode/common/util/file';
|
|
3
|
+
type ToolName = 'skill';
|
|
4
|
+
export declare const handleSkill: (params: {
|
|
5
|
+
previousToolCallFinished: Promise<void>;
|
|
6
|
+
toolCall: LevelCodeToolCall<ToolName>;
|
|
7
|
+
fileContext: ProjectFileContext;
|
|
8
|
+
}) => Promise<{
|
|
9
|
+
output: LevelCodeToolOutput<ToolName>;
|
|
10
|
+
}>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { executeSubagent } from './spawn-agent-utils';
|
|
2
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
3
|
+
import type { AgentTemplate } from '@levelcode/common/types/agent-template';
|
|
4
|
+
import type { Logger } from '@levelcode/common/types/contracts/logger';
|
|
5
|
+
import type { ParamsExcluding } from '@levelcode/common/types/function-params';
|
|
6
|
+
import type { PrintModeEvent } from '@levelcode/common/types/print-mode';
|
|
7
|
+
import type { AgentState } from '@levelcode/common/types/session-state';
|
|
8
|
+
import type { ProjectFileContext } from '@levelcode/common/util/file';
|
|
9
|
+
import type { ToolSet } from 'ai';
|
|
10
|
+
type ToolName = 'spawn_agent_inline';
|
|
11
|
+
export declare const handleSpawnAgentInline: (params: {
|
|
12
|
+
previousToolCallFinished: Promise<void>;
|
|
13
|
+
toolCall: LevelCodeToolCall<ToolName>;
|
|
14
|
+
agentState: AgentState;
|
|
15
|
+
agentTemplate: AgentTemplate;
|
|
16
|
+
clientSessionId: string;
|
|
17
|
+
fileContext: ProjectFileContext;
|
|
18
|
+
fingerprintId: string;
|
|
19
|
+
localAgentTemplates: Record<string, AgentTemplate>;
|
|
20
|
+
logger: Logger;
|
|
21
|
+
system: string;
|
|
22
|
+
tools: ToolSet;
|
|
23
|
+
userId: string | undefined;
|
|
24
|
+
userInputId: string;
|
|
25
|
+
writeToClient: (chunk: string | PrintModeEvent) => void;
|
|
26
|
+
} & ParamsExcluding<typeof executeSubagent, "userInputId" | "prompt" | "spawnParams" | "agentTemplate" | "parentAgentState" | "agentState" | "parentSystemPrompt" | "parentTools" | "onResponseChunk" | "clearUserPromptMessagesAfterResponse" | "fingerprintId">) => Promise<{
|
|
27
|
+
output: LevelCodeToolOutput<ToolName>;
|
|
28
|
+
}>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { loopAgentSteps } from '../../../run-agent-step';
|
|
2
|
+
import { getAgentTemplate } from '../../../templates/agent-registry';
|
|
3
|
+
import type { AgentTemplate } from '@levelcode/common/types/agent-template';
|
|
4
|
+
import type { AgentRuntimeDeps, AgentRuntimeScopedDeps } from '@levelcode/common/types/contracts/agent-runtime';
|
|
5
|
+
import type { Logger } from '@levelcode/common/types/contracts/logger';
|
|
6
|
+
import type { ParamsExcluding, OptionalFields } from '@levelcode/common/types/function-params';
|
|
7
|
+
import type { PrintModeEvent } from '@levelcode/common/types/print-mode';
|
|
8
|
+
import type { AgentState, AgentTemplateType, Subgoal } from '@levelcode/common/types/session-state';
|
|
9
|
+
import type { ProjectFileContext } from '@levelcode/common/util/file';
|
|
10
|
+
import type { ToolSet } from 'ai';
|
|
11
|
+
/**
|
|
12
|
+
* Common context params needed for spawning subagents.
|
|
13
|
+
* These are the params that don't change between different spawn calls
|
|
14
|
+
* and are passed through from the parent agent runtime.
|
|
15
|
+
*/
|
|
16
|
+
export type SubagentContextParams = AgentRuntimeDeps & AgentRuntimeScopedDeps & {
|
|
17
|
+
clientSessionId: string;
|
|
18
|
+
fileContext: ProjectFileContext;
|
|
19
|
+
localAgentTemplates: Record<string, AgentTemplate>;
|
|
20
|
+
repoId: string | undefined;
|
|
21
|
+
repoUrl: string | undefined;
|
|
22
|
+
signal: AbortSignal;
|
|
23
|
+
userId: string | undefined;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Extracts the common context params needed for spawning subagents.
|
|
27
|
+
* This avoids bugs from spreading all params with `...params` which can
|
|
28
|
+
* accidentally pass through params that should be overridden.
|
|
29
|
+
*/
|
|
30
|
+
export declare function extractSubagentContextParams(params: SubagentContextParams): SubagentContextParams;
|
|
31
|
+
/**
|
|
32
|
+
* Checks if a parent agent is allowed to spawn a child agent
|
|
33
|
+
*/
|
|
34
|
+
export declare function getMatchingSpawn(spawnableAgents: AgentTemplateType[], childFullAgentId: string): AgentTemplateType | null;
|
|
35
|
+
/**
|
|
36
|
+
* Synchronously transforms spawn_agents input to use 'commander-lite' instead of 'commander'
|
|
37
|
+
* when the parent agent doesn't have access to 'commander' but does have access to 'commander-lite'.
|
|
38
|
+
* This should be called BEFORE the tool call is streamed to the UI.
|
|
39
|
+
*/
|
|
40
|
+
export declare function transformSpawnAgentsInput(input: Record<string, unknown>, spawnableAgents: AgentTemplateType[]): Record<string, unknown>;
|
|
41
|
+
/**
|
|
42
|
+
* Validates agent template and permissions
|
|
43
|
+
*/
|
|
44
|
+
export declare function validateAndGetAgentTemplate(params: {
|
|
45
|
+
agentTypeStr: string;
|
|
46
|
+
parentAgentTemplate: AgentTemplate;
|
|
47
|
+
localAgentTemplates: Record<string, AgentTemplate>;
|
|
48
|
+
logger: Logger;
|
|
49
|
+
} & ParamsExcluding<typeof getAgentTemplate, 'agentId'>): Promise<{
|
|
50
|
+
agentTemplate: AgentTemplate;
|
|
51
|
+
agentType: string;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* Validates prompt and params against agent schema
|
|
55
|
+
*/
|
|
56
|
+
export declare function validateAgentInput(agentTemplate: AgentTemplate, agentType: string, prompt?: string, params?: any): void;
|
|
57
|
+
/**
|
|
58
|
+
* Creates a new agent state for spawned agents
|
|
59
|
+
*/
|
|
60
|
+
export declare function createAgentState(agentType: string, agentTemplate: AgentTemplate, parentAgentState: AgentState, agentContext: Record<string, Subgoal>): AgentState;
|
|
61
|
+
/**
|
|
62
|
+
* Logs agent spawn information
|
|
63
|
+
*/
|
|
64
|
+
export declare function logAgentSpawn(params: {
|
|
65
|
+
agentTemplate: AgentTemplate;
|
|
66
|
+
agentType: string;
|
|
67
|
+
agentId: string;
|
|
68
|
+
parentId: string | undefined;
|
|
69
|
+
prompt?: string;
|
|
70
|
+
spawnParams?: any;
|
|
71
|
+
inline?: boolean;
|
|
72
|
+
logger: Logger;
|
|
73
|
+
}): void;
|
|
74
|
+
/**
|
|
75
|
+
* Executes a subagent using loopAgentSteps
|
|
76
|
+
*/
|
|
77
|
+
export declare function executeSubagent(options: OptionalFields<{
|
|
78
|
+
agentTemplate: AgentTemplate;
|
|
79
|
+
parentAgentState: AgentState;
|
|
80
|
+
parentTools?: ToolSet;
|
|
81
|
+
onResponseChunk: (chunk: string | PrintModeEvent) => void;
|
|
82
|
+
isOnlyChild?: boolean;
|
|
83
|
+
ancestorRunIds: string[];
|
|
84
|
+
} & ParamsExcluding<typeof loopAgentSteps, 'agentType' | 'ancestorRunIds'>, 'isOnlyChild' | 'clearUserPromptMessagesAfterResponse'>): Promise<{
|
|
85
|
+
agentState: AgentState;
|
|
86
|
+
output: import("@levelcode/common/types/session-state").AgentOutput;
|
|
87
|
+
}>;
|
|
88
|
+
/**
|
|
89
|
+
* Options for registering a spawned agent as a team member.
|
|
90
|
+
*/
|
|
91
|
+
export interface TeamSpawnOptions {
|
|
92
|
+
teamName: string;
|
|
93
|
+
teamRole?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Registers a spawned agent as a member of an existing team.
|
|
97
|
+
* Returns the team context string to prepend to the agent's prompt,
|
|
98
|
+
* or null if the team does not exist.
|
|
99
|
+
*/
|
|
100
|
+
export declare function registerAgentAsTeamMember(agentId: string, agentType: string, options: TeamSpawnOptions, logger: Logger): string | null;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { validateAndGetAgentTemplate, executeSubagent } from './spawn-agent-utils';
|
|
2
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
3
|
+
import type { AgentTemplate } from '@levelcode/common/types/agent-template';
|
|
4
|
+
import type { Logger } from '@levelcode/common/types/contracts/logger';
|
|
5
|
+
import type { ParamsExcluding } from '@levelcode/common/types/function-params';
|
|
6
|
+
import type { PrintModeEvent } from '@levelcode/common/types/print-mode';
|
|
7
|
+
import type { AgentState } from '@levelcode/common/types/session-state';
|
|
8
|
+
import type { ToolSet } from 'ai';
|
|
9
|
+
export type SendSubagentChunk = (data: {
|
|
10
|
+
userInputId: string;
|
|
11
|
+
agentId: string;
|
|
12
|
+
agentType: string;
|
|
13
|
+
chunk: string;
|
|
14
|
+
prompt?: string;
|
|
15
|
+
forwardToPrompt?: boolean;
|
|
16
|
+
}) => void;
|
|
17
|
+
type ToolName = 'spawn_agents';
|
|
18
|
+
export declare const handleSpawnAgents: (params: {
|
|
19
|
+
previousToolCallFinished: Promise<void>;
|
|
20
|
+
toolCall: LevelCodeToolCall<ToolName>;
|
|
21
|
+
agentState: AgentState;
|
|
22
|
+
agentTemplate: AgentTemplate;
|
|
23
|
+
fingerprintId: string;
|
|
24
|
+
localAgentTemplates: Record<string, AgentTemplate>;
|
|
25
|
+
logger: Logger;
|
|
26
|
+
system: string;
|
|
27
|
+
tools?: ToolSet;
|
|
28
|
+
userId: string | undefined;
|
|
29
|
+
userInputId: string;
|
|
30
|
+
sendSubagentChunk: SendSubagentChunk;
|
|
31
|
+
writeToClient: (chunk: string | PrintModeEvent) => void;
|
|
32
|
+
} & ParamsExcluding<typeof validateAndGetAgentTemplate, "agentTypeStr" | "parentAgentTemplate"> & ParamsExcluding<typeof executeSubagent, "userInputId" | "prompt" | "spawnParams" | "agentTemplate" | "parentAgentState" | "agentState" | "fingerprintId" | "isOnlyChild" | "parentSystemPrompt" | "parentTools" | "onResponseChunk">) => Promise<{
|
|
33
|
+
output: LevelCodeToolOutput<ToolName>;
|
|
34
|
+
}>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FileProcessingState } from './write-file';
|
|
2
|
+
import type { ClientToolCall, LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
3
|
+
import type { RequestOptionalFileFn } from '@levelcode/common/types/contracts/client';
|
|
4
|
+
import type { Logger } from '@levelcode/common/types/contracts/logger';
|
|
5
|
+
import type { ParamsExcluding } from '@levelcode/common/types/function-params';
|
|
6
|
+
export declare const handleStrReplace: (params: {
|
|
7
|
+
previousToolCallFinished: Promise<void>;
|
|
8
|
+
toolCall: LevelCodeToolCall<"str_replace">;
|
|
9
|
+
fileProcessingState: FileProcessingState;
|
|
10
|
+
logger: Logger;
|
|
11
|
+
requestClientToolCall: (toolCall: ClientToolCall<"str_replace">) => Promise<LevelCodeToolOutput<"str_replace">>;
|
|
12
|
+
writeToClient: (chunk: string) => void;
|
|
13
|
+
requestOptionalFile: RequestOptionalFileFn;
|
|
14
|
+
} & ParamsExcluding<RequestOptionalFileFn, "filePath">) => Promise<{
|
|
15
|
+
output: LevelCodeToolOutput<"str_replace">;
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
import type { Logger } from '@levelcode/common/types/contracts/logger';
|
|
3
|
+
export declare const handleSuggestFollowups: (params: {
|
|
4
|
+
previousToolCallFinished: Promise<unknown>;
|
|
5
|
+
toolCall: LevelCodeToolCall<"suggest_followups">;
|
|
6
|
+
logger: Logger;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
output: LevelCodeToolOutput<"suggest_followups">;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
export declare const handleTaskCompleted: ({ previousToolCallFinished, }: {
|
|
3
|
+
previousToolCallFinished: Promise<any>;
|
|
4
|
+
toolCall: LevelCodeToolCall<"task_completed">;
|
|
5
|
+
}) => Promise<{
|
|
6
|
+
output: LevelCodeToolOutput<"task_completed">;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
type ToolName = 'task_create';
|
|
3
|
+
export declare const handleTaskCreate: (params: {
|
|
4
|
+
previousToolCallFinished: Promise<void>;
|
|
5
|
+
toolCall: LevelCodeToolCall<ToolName>;
|
|
6
|
+
}) => Promise<{
|
|
7
|
+
output: LevelCodeToolOutput<ToolName>;
|
|
8
|
+
}>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
type ToolName = 'task_get';
|
|
3
|
+
export declare const handleTaskGet: (params: {
|
|
4
|
+
previousToolCallFinished: Promise<void>;
|
|
5
|
+
toolCall: LevelCodeToolCall<ToolName>;
|
|
6
|
+
}) => Promise<{
|
|
7
|
+
output: LevelCodeToolOutput<ToolName>;
|
|
8
|
+
}>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
type ToolName = 'task_list';
|
|
3
|
+
export declare const handleTaskList: (params: {
|
|
4
|
+
previousToolCallFinished: Promise<void>;
|
|
5
|
+
toolCall: LevelCodeToolCall<ToolName>;
|
|
6
|
+
}) => Promise<{
|
|
7
|
+
output: LevelCodeToolOutput<ToolName>;
|
|
8
|
+
}>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
type ToolName = 'task_update';
|
|
3
|
+
export declare const handleTaskUpdate: (params: {
|
|
4
|
+
previousToolCallFinished: Promise<void>;
|
|
5
|
+
toolCall: LevelCodeToolCall<ToolName>;
|
|
6
|
+
}) => Promise<{
|
|
7
|
+
output: LevelCodeToolOutput<ToolName>;
|
|
8
|
+
}>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
type ToolName = 'team_create';
|
|
3
|
+
export declare const handleTeamCreate: (params: {
|
|
4
|
+
previousToolCallFinished: Promise<void>;
|
|
5
|
+
toolCall: LevelCodeToolCall<ToolName>;
|
|
6
|
+
agentStepId: string;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
output: LevelCodeToolOutput<ToolName>;
|
|
9
|
+
}>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
type ToolName = 'team_delete';
|
|
3
|
+
export declare const handleTeamDelete: (params: {
|
|
4
|
+
previousToolCallFinished: Promise<void>;
|
|
5
|
+
toolCall: LevelCodeToolCall<ToolName>;
|
|
6
|
+
agentStepId: string;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
output: LevelCodeToolOutput<ToolName>;
|
|
9
|
+
}>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
import type { Logger } from '@levelcode/common/types/contracts/logger';
|
|
3
|
+
export declare const handleThinkDeeply: (params: {
|
|
4
|
+
previousToolCallFinished: Promise<any>;
|
|
5
|
+
toolCall: LevelCodeToolCall<"think_deeply">;
|
|
6
|
+
logger: Logger;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
output: LevelCodeToolOutput<"think_deeply">;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
import type { Subgoal } from '@levelcode/common/types/session-state';
|
|
3
|
+
type ToolName = 'update_subgoal';
|
|
4
|
+
export declare const handleUpdateSubgoal: (params: {
|
|
5
|
+
previousToolCallFinished: Promise<void>;
|
|
6
|
+
toolCall: LevelCodeToolCall<ToolName>;
|
|
7
|
+
agentContext: Record<string, Subgoal>;
|
|
8
|
+
}) => Promise<{
|
|
9
|
+
output: LevelCodeToolOutput<ToolName>;
|
|
10
|
+
}>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
|
|
2
|
+
import type { ClientEnv, CiEnv } from '@levelcode/common/types/contracts/env';
|
|
3
|
+
import type { Logger } from '@levelcode/common/types/contracts/logger';
|
|
4
|
+
export declare const handleWebSearch: (params: {
|
|
5
|
+
previousToolCallFinished: Promise<void>;
|
|
6
|
+
toolCall: LevelCodeToolCall<"web_search">;
|
|
7
|
+
logger: Logger;
|
|
8
|
+
apiKey: string;
|
|
9
|
+
agentStepId: string;
|
|
10
|
+
clientSessionId: string;
|
|
11
|
+
fingerprintId: string;
|
|
12
|
+
repoId: string | undefined;
|
|
13
|
+
repoUrl: string | undefined;
|
|
14
|
+
userInputId: string;
|
|
15
|
+
userId: string | undefined;
|
|
16
|
+
fetch: typeof globalThis.fetch;
|
|
17
|
+
clientEnv: ClientEnv;
|
|
18
|
+
ciEnv: CiEnv;
|
|
19
|
+
}) => Promise<{
|
|
20
|
+
output: LevelCodeToolOutput<"web_search">;
|
|
21
|
+
creditsUsed: number;
|
|
22
|
+
}>;
|