@levelcode/sdk 0.0.5 → 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 +1940 -917
- package/dist/index.cjs.map +24 -9
- package/dist/index.mjs +2380 -1357
- package/dist/index.mjs.map +24 -9
- 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
package/dist/index.d.ts
DELETED
|
@@ -1,3443 +0,0 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
-
|
|
3
|
-
/// <reference types="node" />
|
|
4
|
-
|
|
5
|
-
export type JSONValue = null | string | number | boolean | JSONObject | JSONArray;
|
|
6
|
-
export declare const jsonValueSchema: z.ZodType<JSONValue>;
|
|
7
|
-
export declare const jsonObjectSchema: z.ZodType<JSONObject>;
|
|
8
|
-
export type JSONObject = {
|
|
9
|
-
[key in string]: JSONValue;
|
|
10
|
-
};
|
|
11
|
-
export declare const jsonArraySchema: z.ZodType<JSONArray>;
|
|
12
|
-
export type JSONArray = JSONValue[];
|
|
13
|
-
declare const textPartSchema: z.ZodObject<{
|
|
14
|
-
type: z.ZodLiteral<"text">;
|
|
15
|
-
text: z.ZodString;
|
|
16
|
-
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
|
|
17
|
-
}, z.core.$strip>;
|
|
18
|
-
export type TextPart = z.infer<typeof textPartSchema>;
|
|
19
|
-
declare const imagePartSchema: z.ZodObject<{
|
|
20
|
-
type: z.ZodLiteral<"image">;
|
|
21
|
-
image: z.ZodUnion<readonly [
|
|
22
|
-
z.ZodUnion<readonly [
|
|
23
|
-
z.ZodString,
|
|
24
|
-
z.ZodCustom<Uint8Array, Uint8Array>,
|
|
25
|
-
z.ZodCustom<ArrayBuffer, ArrayBuffer>,
|
|
26
|
-
z.ZodCustom<Buffer, Buffer>
|
|
27
|
-
]>,
|
|
28
|
-
z.ZodCustom<URL, URL>
|
|
29
|
-
]>;
|
|
30
|
-
mediaType: z.ZodOptional<z.ZodString>;
|
|
31
|
-
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
|
|
32
|
-
}, z.core.$strip>;
|
|
33
|
-
export type ImagePart = z.infer<typeof imagePartSchema>;
|
|
34
|
-
declare const filePartSchema: z.ZodObject<{
|
|
35
|
-
type: z.ZodLiteral<"file">;
|
|
36
|
-
data: z.ZodUnion<readonly [
|
|
37
|
-
z.ZodUnion<readonly [
|
|
38
|
-
z.ZodString,
|
|
39
|
-
z.ZodCustom<Uint8Array, Uint8Array>,
|
|
40
|
-
z.ZodCustom<ArrayBuffer, ArrayBuffer>,
|
|
41
|
-
z.ZodCustom<Buffer, Buffer>
|
|
42
|
-
]>,
|
|
43
|
-
z.ZodCustom<URL, URL>
|
|
44
|
-
]>;
|
|
45
|
-
filename: z.ZodOptional<z.ZodString>;
|
|
46
|
-
mediaType: z.ZodString;
|
|
47
|
-
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
|
|
48
|
-
}, z.core.$strip>;
|
|
49
|
-
type FilePart = z.infer<typeof filePartSchema>;
|
|
50
|
-
declare const reasoningPartSchema: z.ZodObject<{
|
|
51
|
-
type: z.ZodLiteral<"reasoning">;
|
|
52
|
-
text: z.ZodString;
|
|
53
|
-
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
|
|
54
|
-
}, z.core.$strip>;
|
|
55
|
-
type ReasoningPart = z.infer<typeof reasoningPartSchema>;
|
|
56
|
-
declare const toolCallPartSchema: z.ZodObject<{
|
|
57
|
-
type: z.ZodLiteral<"tool-call">;
|
|
58
|
-
toolCallId: z.ZodString;
|
|
59
|
-
toolName: z.ZodString;
|
|
60
|
-
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
61
|
-
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>>;
|
|
62
|
-
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
63
|
-
}, z.core.$strip>;
|
|
64
|
-
type ToolCallPart = z.infer<typeof toolCallPartSchema>;
|
|
65
|
-
declare const toolResultOutputSchema: z.ZodDiscriminatedUnion<[
|
|
66
|
-
z.ZodObject<{
|
|
67
|
-
type: z.ZodLiteral<"json">;
|
|
68
|
-
value: z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>;
|
|
69
|
-
}, z.core.$strip>,
|
|
70
|
-
z.ZodObject<{
|
|
71
|
-
type: z.ZodLiteral<"media">;
|
|
72
|
-
data: z.ZodString;
|
|
73
|
-
mediaType: z.ZodString;
|
|
74
|
-
}, z.core.$strip>
|
|
75
|
-
], "type">;
|
|
76
|
-
type ToolResultOutput = z.infer<typeof toolResultOutputSchema>;
|
|
77
|
-
declare const providerMetadataSchema: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>;
|
|
78
|
-
type ProviderMetadata = z.infer<typeof providerMetadataSchema>;
|
|
79
|
-
export type AuxiliaryMessageData = {
|
|
80
|
-
providerOptions?: ProviderMetadata;
|
|
81
|
-
tags?: string[];
|
|
82
|
-
/**
|
|
83
|
-
* Unix timestamp (ms) when the message was added to history.
|
|
84
|
-
* Used to detect prompt cache expiry (>5 min gap = cache miss).
|
|
85
|
-
* This field is stripped before sending to the LLM.
|
|
86
|
-
*/
|
|
87
|
-
sentAt?: number;
|
|
88
|
-
/** @deprecated Use tags instead. */
|
|
89
|
-
timeToLive?: "agentStep" | "userPrompt";
|
|
90
|
-
/** @deprecated Use tags instead. */
|
|
91
|
-
keepDuringTruncation?: boolean;
|
|
92
|
-
/** @deprecated Use tags instead. */
|
|
93
|
-
keepLastTags?: string[];
|
|
94
|
-
};
|
|
95
|
-
export type SystemMessage = {
|
|
96
|
-
role: "system";
|
|
97
|
-
content: TextPart[];
|
|
98
|
-
} & AuxiliaryMessageData;
|
|
99
|
-
export type UserMessage = {
|
|
100
|
-
role: "user";
|
|
101
|
-
content: (TextPart | ImagePart | FilePart)[];
|
|
102
|
-
} & AuxiliaryMessageData;
|
|
103
|
-
export type AssistantMessage = {
|
|
104
|
-
role: "assistant";
|
|
105
|
-
content: (TextPart | ReasoningPart | ToolCallPart)[];
|
|
106
|
-
} & AuxiliaryMessageData;
|
|
107
|
-
export type ToolMessage = {
|
|
108
|
-
role: "tool";
|
|
109
|
-
toolCallId: string;
|
|
110
|
-
toolName: string;
|
|
111
|
-
content: ToolResultOutput[];
|
|
112
|
-
} & AuxiliaryMessageData;
|
|
113
|
-
export type Message = SystemMessage | UserMessage | AssistantMessage | ToolMessage;
|
|
114
|
-
export declare const dataContentSchema: z.ZodUnion<readonly [
|
|
115
|
-
z.ZodString,
|
|
116
|
-
z.ZodCustom<Uint8Array, Uint8Array>,
|
|
117
|
-
z.ZodCustom<ArrayBuffer, ArrayBuffer>,
|
|
118
|
-
z.ZodCustom<Buffer, Buffer>
|
|
119
|
-
]>;
|
|
120
|
-
export type DataContent = z.infer<typeof dataContentSchema>;
|
|
121
|
-
export declare const printModeStartSchema: z.ZodObject<{
|
|
122
|
-
type: z.ZodLiteral<"start">;
|
|
123
|
-
agentId: z.ZodOptional<z.ZodString>;
|
|
124
|
-
messageHistoryLength: z.ZodNumber;
|
|
125
|
-
}, z.core.$strip>;
|
|
126
|
-
export type PrintModeStart = z.infer<typeof printModeStartSchema>;
|
|
127
|
-
export declare const printModeErrorSchema: z.ZodObject<{
|
|
128
|
-
type: z.ZodLiteral<"error">;
|
|
129
|
-
message: z.ZodString;
|
|
130
|
-
}, z.core.$strip>;
|
|
131
|
-
export type PrintModeError = z.infer<typeof printModeErrorSchema>;
|
|
132
|
-
export declare const printModeDownloadStatusSchema: z.ZodObject<{
|
|
133
|
-
type: z.ZodLiteral<"download">;
|
|
134
|
-
version: z.ZodString;
|
|
135
|
-
status: z.ZodEnum<{
|
|
136
|
-
complete: "complete";
|
|
137
|
-
failed: "failed";
|
|
138
|
-
}>;
|
|
139
|
-
}, z.core.$strip>;
|
|
140
|
-
export type PrintModeDownloadStatus = z.infer<typeof printModeDownloadStatusSchema>;
|
|
141
|
-
export declare const printModeToolCallSchema: z.ZodObject<{
|
|
142
|
-
type: z.ZodLiteral<"tool_call">;
|
|
143
|
-
toolCallId: z.ZodString;
|
|
144
|
-
toolName: z.ZodString;
|
|
145
|
-
input: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
146
|
-
agentId: z.ZodOptional<z.ZodString>;
|
|
147
|
-
parentAgentId: z.ZodOptional<z.ZodString>;
|
|
148
|
-
includeToolCall: z.ZodOptional<z.ZodBoolean>;
|
|
149
|
-
}, z.core.$strip>;
|
|
150
|
-
export type PrintModeToolCall = z.infer<typeof printModeToolCallSchema>;
|
|
151
|
-
export declare const printModeToolResultSchema: z.ZodObject<{
|
|
152
|
-
type: z.ZodLiteral<"tool_result">;
|
|
153
|
-
toolCallId: z.ZodString;
|
|
154
|
-
toolName: z.ZodString;
|
|
155
|
-
output: z.ZodArray<z.ZodDiscriminatedUnion<[
|
|
156
|
-
z.ZodObject<{
|
|
157
|
-
type: z.ZodLiteral<"json">;
|
|
158
|
-
value: z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>;
|
|
159
|
-
}, z.core.$strip>,
|
|
160
|
-
z.ZodObject<{
|
|
161
|
-
type: z.ZodLiteral<"media">;
|
|
162
|
-
data: z.ZodString;
|
|
163
|
-
mediaType: z.ZodString;
|
|
164
|
-
}, z.core.$strip>
|
|
165
|
-
], "type">>;
|
|
166
|
-
parentAgentId: z.ZodOptional<z.ZodString>;
|
|
167
|
-
}, z.core.$strip>;
|
|
168
|
-
export type PrintModeToolResult = z.infer<typeof printModeToolResultSchema>;
|
|
169
|
-
export declare const printModeTextSchema: z.ZodObject<{
|
|
170
|
-
type: z.ZodLiteral<"text">;
|
|
171
|
-
text: z.ZodString;
|
|
172
|
-
agentId: z.ZodOptional<z.ZodString>;
|
|
173
|
-
}, z.core.$strip>;
|
|
174
|
-
export type PrintModeText = z.infer<typeof printModeTextSchema>;
|
|
175
|
-
export declare const printModeFinishSchema: z.ZodObject<{
|
|
176
|
-
type: z.ZodLiteral<"finish">;
|
|
177
|
-
agentId: z.ZodOptional<z.ZodString>;
|
|
178
|
-
totalCost: z.ZodNumber;
|
|
179
|
-
}, z.core.$strip>;
|
|
180
|
-
export type PrintModeFinish = z.infer<typeof printModeFinishSchema>;
|
|
181
|
-
export declare const printModeSubagentStartSchema: z.ZodObject<{
|
|
182
|
-
type: z.ZodLiteral<"subagent_start">;
|
|
183
|
-
agentId: z.ZodString;
|
|
184
|
-
agentType: z.ZodString;
|
|
185
|
-
displayName: z.ZodString;
|
|
186
|
-
onlyChild: z.ZodBoolean;
|
|
187
|
-
parentAgentId: z.ZodOptional<z.ZodString>;
|
|
188
|
-
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
189
|
-
prompt: z.ZodOptional<z.ZodString>;
|
|
190
|
-
}, z.core.$strip>;
|
|
191
|
-
export type PrintModeSubagentStart = z.infer<typeof printModeSubagentStartSchema>;
|
|
192
|
-
export declare const printModeSubagentFinishSchema: z.ZodObject<{
|
|
193
|
-
type: z.ZodLiteral<"subagent_finish">;
|
|
194
|
-
agentId: z.ZodString;
|
|
195
|
-
agentType: z.ZodString;
|
|
196
|
-
displayName: z.ZodString;
|
|
197
|
-
onlyChild: z.ZodBoolean;
|
|
198
|
-
parentAgentId: z.ZodOptional<z.ZodString>;
|
|
199
|
-
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
200
|
-
prompt: z.ZodOptional<z.ZodString>;
|
|
201
|
-
}, z.core.$strip>;
|
|
202
|
-
export type PrintModeSubagentFinish = z.infer<typeof printModeSubagentFinishSchema>;
|
|
203
|
-
export declare const printModeReasoningDeltaSchema: z.ZodObject<{
|
|
204
|
-
type: z.ZodLiteral<"reasoning_delta">;
|
|
205
|
-
text: z.ZodString;
|
|
206
|
-
ancestorRunIds: z.ZodArray<z.ZodString>;
|
|
207
|
-
runId: z.ZodString;
|
|
208
|
-
}, z.core.$strip>;
|
|
209
|
-
export type PrintModeReasoningDelta = z.infer<typeof printModeReasoningDeltaSchema>;
|
|
210
|
-
export declare const printModeEventSchema: z.ZodDiscriminatedUnion<[
|
|
211
|
-
z.ZodObject<{
|
|
212
|
-
type: z.ZodLiteral<"download">;
|
|
213
|
-
version: z.ZodString;
|
|
214
|
-
status: z.ZodEnum<{
|
|
215
|
-
complete: "complete";
|
|
216
|
-
failed: "failed";
|
|
217
|
-
}>;
|
|
218
|
-
}, z.core.$strip>,
|
|
219
|
-
z.ZodObject<{
|
|
220
|
-
type: z.ZodLiteral<"error">;
|
|
221
|
-
message: z.ZodString;
|
|
222
|
-
}, z.core.$strip>,
|
|
223
|
-
z.ZodObject<{
|
|
224
|
-
type: z.ZodLiteral<"finish">;
|
|
225
|
-
agentId: z.ZodOptional<z.ZodString>;
|
|
226
|
-
totalCost: z.ZodNumber;
|
|
227
|
-
}, z.core.$strip>,
|
|
228
|
-
z.ZodObject<{
|
|
229
|
-
type: z.ZodLiteral<"start">;
|
|
230
|
-
agentId: z.ZodOptional<z.ZodString>;
|
|
231
|
-
messageHistoryLength: z.ZodNumber;
|
|
232
|
-
}, z.core.$strip>,
|
|
233
|
-
z.ZodObject<{
|
|
234
|
-
type: z.ZodLiteral<"subagent_finish">;
|
|
235
|
-
agentId: z.ZodString;
|
|
236
|
-
agentType: z.ZodString;
|
|
237
|
-
displayName: z.ZodString;
|
|
238
|
-
onlyChild: z.ZodBoolean;
|
|
239
|
-
parentAgentId: z.ZodOptional<z.ZodString>;
|
|
240
|
-
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
241
|
-
prompt: z.ZodOptional<z.ZodString>;
|
|
242
|
-
}, z.core.$strip>,
|
|
243
|
-
z.ZodObject<{
|
|
244
|
-
type: z.ZodLiteral<"subagent_start">;
|
|
245
|
-
agentId: z.ZodString;
|
|
246
|
-
agentType: z.ZodString;
|
|
247
|
-
displayName: z.ZodString;
|
|
248
|
-
onlyChild: z.ZodBoolean;
|
|
249
|
-
parentAgentId: z.ZodOptional<z.ZodString>;
|
|
250
|
-
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
251
|
-
prompt: z.ZodOptional<z.ZodString>;
|
|
252
|
-
}, z.core.$strip>,
|
|
253
|
-
z.ZodObject<{
|
|
254
|
-
type: z.ZodLiteral<"text">;
|
|
255
|
-
text: z.ZodString;
|
|
256
|
-
agentId: z.ZodOptional<z.ZodString>;
|
|
257
|
-
}, z.core.$strip>,
|
|
258
|
-
z.ZodObject<{
|
|
259
|
-
type: z.ZodLiteral<"tool_call">;
|
|
260
|
-
toolCallId: z.ZodString;
|
|
261
|
-
toolName: z.ZodString;
|
|
262
|
-
input: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
263
|
-
agentId: z.ZodOptional<z.ZodString>;
|
|
264
|
-
parentAgentId: z.ZodOptional<z.ZodString>;
|
|
265
|
-
includeToolCall: z.ZodOptional<z.ZodBoolean>;
|
|
266
|
-
}, z.core.$strip>,
|
|
267
|
-
z.ZodObject<{
|
|
268
|
-
type: z.ZodLiteral<"tool_result">;
|
|
269
|
-
toolCallId: z.ZodString;
|
|
270
|
-
toolName: z.ZodString;
|
|
271
|
-
output: z.ZodArray<z.ZodDiscriminatedUnion<[
|
|
272
|
-
z.ZodObject<{
|
|
273
|
-
type: z.ZodLiteral<"json">;
|
|
274
|
-
value: z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>;
|
|
275
|
-
}, z.core.$strip>,
|
|
276
|
-
z.ZodObject<{
|
|
277
|
-
type: z.ZodLiteral<"media">;
|
|
278
|
-
data: z.ZodString;
|
|
279
|
-
mediaType: z.ZodString;
|
|
280
|
-
}, z.core.$strip>
|
|
281
|
-
], "type">>;
|
|
282
|
-
parentAgentId: z.ZodOptional<z.ZodString>;
|
|
283
|
-
}, z.core.$strip>,
|
|
284
|
-
z.ZodObject<{
|
|
285
|
-
type: z.ZodLiteral<"reasoning_delta">;
|
|
286
|
-
text: z.ZodString;
|
|
287
|
-
ancestorRunIds: z.ZodArray<z.ZodString>;
|
|
288
|
-
runId: z.ZodString;
|
|
289
|
-
}, z.core.$strip>
|
|
290
|
-
], "type">;
|
|
291
|
-
export type PrintModeEvent = z.infer<typeof printModeEventSchema>;
|
|
292
|
-
declare const toolNames: readonly [
|
|
293
|
-
"add_subgoal",
|
|
294
|
-
"add_message",
|
|
295
|
-
"ask_user",
|
|
296
|
-
"browser_logs",
|
|
297
|
-
"code_search",
|
|
298
|
-
"create_plan",
|
|
299
|
-
"end_turn",
|
|
300
|
-
"find_files",
|
|
301
|
-
"glob",
|
|
302
|
-
"list_directory",
|
|
303
|
-
"lookup_agent_info",
|
|
304
|
-
"propose_str_replace",
|
|
305
|
-
"propose_write_file",
|
|
306
|
-
"read_docs",
|
|
307
|
-
"read_files",
|
|
308
|
-
"read_subtree",
|
|
309
|
-
"run_file_change_hooks",
|
|
310
|
-
"run_terminal_command",
|
|
311
|
-
"set_messages",
|
|
312
|
-
"set_output",
|
|
313
|
-
"skill",
|
|
314
|
-
"spawn_agents",
|
|
315
|
-
"spawn_agent_inline",
|
|
316
|
-
"str_replace",
|
|
317
|
-
"suggest_followups",
|
|
318
|
-
"task_completed",
|
|
319
|
-
"think_deeply",
|
|
320
|
-
"update_subgoal",
|
|
321
|
-
"web_search",
|
|
322
|
-
"write_file",
|
|
323
|
-
"write_todos"
|
|
324
|
-
];
|
|
325
|
-
declare const publishedTools: readonly [
|
|
326
|
-
"add_message",
|
|
327
|
-
"ask_user",
|
|
328
|
-
"code_search",
|
|
329
|
-
"end_turn",
|
|
330
|
-
"find_files",
|
|
331
|
-
"glob",
|
|
332
|
-
"list_directory",
|
|
333
|
-
"lookup_agent_info",
|
|
334
|
-
"propose_str_replace",
|
|
335
|
-
"propose_write_file",
|
|
336
|
-
"read_docs",
|
|
337
|
-
"read_files",
|
|
338
|
-
"read_subtree",
|
|
339
|
-
"run_file_change_hooks",
|
|
340
|
-
"run_terminal_command",
|
|
341
|
-
"set_messages",
|
|
342
|
-
"set_output",
|
|
343
|
-
"skill",
|
|
344
|
-
"spawn_agents",
|
|
345
|
-
"str_replace",
|
|
346
|
-
"suggest_followups",
|
|
347
|
-
"task_completed",
|
|
348
|
-
"think_deeply",
|
|
349
|
-
"web_search",
|
|
350
|
-
"write_file",
|
|
351
|
-
"write_todos"
|
|
352
|
-
];
|
|
353
|
-
export type ToolName = (typeof toolNames)[number];
|
|
354
|
-
type PublishedToolName = (typeof publishedTools)[number];
|
|
355
|
-
export type CustomToolDefinition<N extends string = string, Args extends any = any, Input extends any = any> = {
|
|
356
|
-
toolName: N;
|
|
357
|
-
inputSchema: z.ZodType<Args, Input>;
|
|
358
|
-
description: string;
|
|
359
|
-
endsAgentStep: boolean;
|
|
360
|
-
exampleInputs: Input[];
|
|
361
|
-
execute: (params: Args) => Promise<ToolResultOutput[]>;
|
|
362
|
-
};
|
|
363
|
-
/**
|
|
364
|
-
* Creates a CustomToolDefinition object
|
|
365
|
-
*
|
|
366
|
-
* @param toolName the name of the tool
|
|
367
|
-
* @param inputSchema a Zod4 schema describing the input of the tool.
|
|
368
|
-
* @param description a description of the tool to be passed to the LLM. This should describe what the tool does and when to use it.
|
|
369
|
-
* @param endsAgentStep whether the tool ends the agent step. If `true`, this will be used as a "stop sequence" for the LLM. i.e. it will not be able to call any other tools after this one in a single step and must wait for the tool results. Used for tools that give more information to the LLM.
|
|
370
|
-
* @param exampleInputs an array of example inputs for the tool.
|
|
371
|
-
* @param execute what to do when the tool is called. Can be either a sync or async. Must return an array of {@linkcode ToolResultOutput}
|
|
372
|
-
* @returns a {@linkcode CustomToolDefinition} object
|
|
373
|
-
*/
|
|
374
|
-
export declare function getCustomToolDefinition<TN extends string, Args extends any, Input extends any>({ toolName, inputSchema, description, endsAgentStep, exampleInputs, execute, }: {
|
|
375
|
-
toolName: TN extends ToolName ? TN & {
|
|
376
|
-
error: `Hi there. This is a message from the LevelCode team: You have used a custom tool where you needed to use overrideTools instead for name: ${TN}`;
|
|
377
|
-
} : TN;
|
|
378
|
-
inputSchema: z.ZodType<Args, Input>;
|
|
379
|
-
description: string;
|
|
380
|
-
endsAgentStep?: boolean;
|
|
381
|
-
exampleInputs?: Input[];
|
|
382
|
-
execute: (params: Args) => Promise<ToolResultOutput[]> | ToolResultOutput[];
|
|
383
|
-
}): CustomToolDefinition<TN, Args, Input>;
|
|
384
|
-
/**
|
|
385
|
-
* The primary/default knowledge file name.
|
|
386
|
-
* Used when creating new knowledge files.
|
|
387
|
-
*/
|
|
388
|
-
export declare const PRIMARY_KNOWLEDGE_FILE_NAME = "knowledge.md";
|
|
389
|
-
/**
|
|
390
|
-
* Knowledge file names in priority order (highest priority first).
|
|
391
|
-
* Used for both project knowledge files and home directory user knowledge files.
|
|
392
|
-
*/
|
|
393
|
-
export declare const KNOWLEDGE_FILE_NAMES: readonly [
|
|
394
|
-
"knowledge.md",
|
|
395
|
-
"AGENTS.md",
|
|
396
|
-
"CLAUDE.md"
|
|
397
|
-
];
|
|
398
|
-
/**
|
|
399
|
-
* Checks if a file path is a knowledge file.
|
|
400
|
-
* Matches:
|
|
401
|
-
* - Exact file names: knowledge.md, AGENTS.md, CLAUDE.md (case-insensitive)
|
|
402
|
-
* - Pattern: *.knowledge.md (e.g., authentication.knowledge.md)
|
|
403
|
-
*/
|
|
404
|
-
export declare function isKnowledgeFile(filePath: string): boolean;
|
|
405
|
-
type ToolName$1 = "add_message" | "ask_user" | "code_search" | "end_turn" | "find_files" | "glob" | "list_directory" | "lookup_agent_info" | "propose_str_replace" | "propose_write_file" | "read_docs" | "read_files" | "read_subtree" | "run_file_change_hooks" | "run_terminal_command" | "set_messages" | "set_output" | "skill" | "spawn_agents" | "str_replace" | "suggest_followups" | "task_completed" | "think_deeply" | "web_search" | "write_file" | "write_todos";
|
|
406
|
-
interface ToolParamsMap {
|
|
407
|
-
add_message: AddMessageParams;
|
|
408
|
-
ask_user: AskUserParams;
|
|
409
|
-
code_search: CodeSearchParams;
|
|
410
|
-
end_turn: EndTurnParams;
|
|
411
|
-
find_files: FindFilesParams;
|
|
412
|
-
glob: GlobParams;
|
|
413
|
-
list_directory: ListDirectoryParams;
|
|
414
|
-
lookup_agent_info: LookupAgentInfoParams;
|
|
415
|
-
propose_str_replace: ProposeStrReplaceParams;
|
|
416
|
-
propose_write_file: ProposeWriteFileParams;
|
|
417
|
-
read_docs: ReadDocsParams;
|
|
418
|
-
read_files: ReadFilesParams;
|
|
419
|
-
read_subtree: ReadSubtreeParams;
|
|
420
|
-
run_file_change_hooks: RunFileChangeHooksParams;
|
|
421
|
-
run_terminal_command: RunTerminalCommandParams;
|
|
422
|
-
set_messages: SetMessagesParams;
|
|
423
|
-
set_output: SetOutputParams;
|
|
424
|
-
skill: SkillParams;
|
|
425
|
-
spawn_agents: SpawnAgentsParams;
|
|
426
|
-
str_replace: StrReplaceParams;
|
|
427
|
-
suggest_followups: SuggestFollowupsParams;
|
|
428
|
-
task_completed: TaskCompletedParams;
|
|
429
|
-
think_deeply: ThinkDeeplyParams;
|
|
430
|
-
web_search: WebSearchParams;
|
|
431
|
-
write_file: WriteFileParams;
|
|
432
|
-
write_todos: WriteTodosParams;
|
|
433
|
-
}
|
|
434
|
-
interface AddMessageParams {
|
|
435
|
-
role: "user" | "assistant";
|
|
436
|
-
content: string;
|
|
437
|
-
}
|
|
438
|
-
interface AskUserParams {
|
|
439
|
-
/** List of multiple choice questions to ask the user */
|
|
440
|
-
questions: {
|
|
441
|
-
/** The question to ask the user */
|
|
442
|
-
question: string;
|
|
443
|
-
/** Short label (max 12 chars) displayed as a chip/tag */
|
|
444
|
-
header?: string;
|
|
445
|
-
/** Array of answer options with label and optional description (minimum 2) */
|
|
446
|
-
options: {
|
|
447
|
-
/** The display text for this option */
|
|
448
|
-
label: string;
|
|
449
|
-
/** Explanation shown when option is focused */
|
|
450
|
-
description?: string;
|
|
451
|
-
}[];
|
|
452
|
-
/** If true, allows selecting multiple options (checkbox). If false, single selection only (radio). */
|
|
453
|
-
multiSelect?: boolean;
|
|
454
|
-
/** Validation rules for "Other" text input */
|
|
455
|
-
validation?: {
|
|
456
|
-
/** Maximum length for "Other" text input */
|
|
457
|
-
maxLength?: number;
|
|
458
|
-
/** Minimum length for "Other" text input */
|
|
459
|
-
minLength?: number;
|
|
460
|
-
/** Regex pattern for "Other" text input */
|
|
461
|
-
pattern?: string;
|
|
462
|
-
/** Custom error message when pattern fails */
|
|
463
|
-
patternError?: string;
|
|
464
|
-
};
|
|
465
|
-
}[];
|
|
466
|
-
}
|
|
467
|
-
interface CodeSearchParams {
|
|
468
|
-
/** The pattern to search for. */
|
|
469
|
-
pattern: string;
|
|
470
|
-
/** Optional ripgrep flags to customize the search (e.g., "-i" for case-insensitive, "-g *.ts -g *.js" for TypeScript and JavaScript files only, "-g !*.test.ts" to exclude Typescript test files, "-A 3" for 3 lines after match, "-B 2" for 2 lines before match). */
|
|
471
|
-
flags?: string;
|
|
472
|
-
/** Optional working directory to search within, relative to the project root. Defaults to searching the entire project. */
|
|
473
|
-
cwd?: string;
|
|
474
|
-
/** Maximum number of results to return per file. Defaults to 15. There is also a global limit of 250 results across all files. */
|
|
475
|
-
maxResults?: number;
|
|
476
|
-
}
|
|
477
|
-
interface EndTurnParams {
|
|
478
|
-
}
|
|
479
|
-
interface FindFilesParams {
|
|
480
|
-
/** A brief natural language description of the files or the name of a function or class you are looking for. It's also helpful to mention a directory or two to look within. */
|
|
481
|
-
prompt: string;
|
|
482
|
-
}
|
|
483
|
-
interface GlobParams {
|
|
484
|
-
/** Glob pattern to match files against (e.g., *.js, src/glob/*.ts, glob/test/glob/*.go). */
|
|
485
|
-
pattern: string;
|
|
486
|
-
/** Optional working directory to search within, relative to project root. If not provided, searches from project root. */
|
|
487
|
-
cwd?: string;
|
|
488
|
-
}
|
|
489
|
-
interface ListDirectoryParams {
|
|
490
|
-
/** Directory path to list, relative to the project root. */
|
|
491
|
-
path: string;
|
|
492
|
-
}
|
|
493
|
-
interface LookupAgentInfoParams {
|
|
494
|
-
/** Agent ID (short local or full published format) */
|
|
495
|
-
agentId: string;
|
|
496
|
-
}
|
|
497
|
-
interface ProposeStrReplaceParams {
|
|
498
|
-
/** The path to the file to edit. */
|
|
499
|
-
path: string;
|
|
500
|
-
/** Array of replacements to make. */
|
|
501
|
-
replacements: {
|
|
502
|
-
/** The string to replace. This must be an *exact match* of the string you want to replace, including whitespace and punctuation. */
|
|
503
|
-
old: string;
|
|
504
|
-
/** The string to replace the corresponding old string with. Can be empty to delete. */
|
|
505
|
-
new: string;
|
|
506
|
-
/** Whether to allow multiple replacements of old string. */
|
|
507
|
-
allowMultiple?: boolean;
|
|
508
|
-
}[];
|
|
509
|
-
}
|
|
510
|
-
interface ProposeWriteFileParams {
|
|
511
|
-
/** Path to the file relative to the **project root** */
|
|
512
|
-
path: string;
|
|
513
|
-
/** What the change is intended to do in only one sentence. */
|
|
514
|
-
instructions: string;
|
|
515
|
-
/** Edit snippet to apply to the file. */
|
|
516
|
-
content: string;
|
|
517
|
-
}
|
|
518
|
-
interface ReadDocsParams {
|
|
519
|
-
/** The library or framework name (e.g., "Next.js", "MongoDB", "React"). Use the official name as it appears in documentation if possible. Only public libraries available in Context7's database are supported, so small or private libraries may not be available. */
|
|
520
|
-
libraryTitle: string;
|
|
521
|
-
/** Specific topic to focus on (e.g., "routing", "hooks", "authentication") */
|
|
522
|
-
topic: string;
|
|
523
|
-
/** Optional maximum number of tokens to return. Defaults to 20000. Values less than 10000 are automatically increased to 10000. */
|
|
524
|
-
max_tokens?: number;
|
|
525
|
-
}
|
|
526
|
-
interface ReadFilesParams {
|
|
527
|
-
/** List of file paths to read. */
|
|
528
|
-
paths: string[];
|
|
529
|
-
}
|
|
530
|
-
interface ReadSubtreeParams {
|
|
531
|
-
/** List of paths to directories or files. Relative to the project root. If omitted, the entire project tree is used. */
|
|
532
|
-
paths?: string[];
|
|
533
|
-
/** Maximum token budget for the subtree blob; the tree will be truncated to fit within this budget by first dropping file variables and then removing the most-nested files and directories. */
|
|
534
|
-
maxTokens?: number;
|
|
535
|
-
}
|
|
536
|
-
interface RunFileChangeHooksParams {
|
|
537
|
-
/** List of file paths that were changed and should trigger file change hooks */
|
|
538
|
-
files: string[];
|
|
539
|
-
}
|
|
540
|
-
interface RunTerminalCommandParams {
|
|
541
|
-
/** CLI command valid for user's OS. */
|
|
542
|
-
command: string;
|
|
543
|
-
/** Either SYNC (waits, returns output) or BACKGROUND (runs in background). Default SYNC */
|
|
544
|
-
process_type?: "SYNC" | "BACKGROUND";
|
|
545
|
-
/** The working directory to run the command in. Default is the project root. */
|
|
546
|
-
cwd?: string;
|
|
547
|
-
/** Set to -1 for no timeout. Does not apply for BACKGROUND commands. Default 30 */
|
|
548
|
-
timeout_seconds?: number;
|
|
549
|
-
}
|
|
550
|
-
interface SetMessagesParams {
|
|
551
|
-
messages: any;
|
|
552
|
-
}
|
|
553
|
-
interface SetOutputParams {
|
|
554
|
-
}
|
|
555
|
-
interface SkillParams {
|
|
556
|
-
/** The name of the skill to load */
|
|
557
|
-
name: string;
|
|
558
|
-
}
|
|
559
|
-
interface SpawnAgentsParams {
|
|
560
|
-
agents: {
|
|
561
|
-
/** Agent to spawn */
|
|
562
|
-
agent_type: string;
|
|
563
|
-
/** Prompt to send to the agent */
|
|
564
|
-
prompt?: string;
|
|
565
|
-
/** Parameters object for the agent (if any) */
|
|
566
|
-
params?: Record<string, any>;
|
|
567
|
-
}[];
|
|
568
|
-
}
|
|
569
|
-
interface StrReplaceParams {
|
|
570
|
-
/** The path to the file to edit. */
|
|
571
|
-
path: string;
|
|
572
|
-
/** Array of replacements to make. */
|
|
573
|
-
replacements: {
|
|
574
|
-
/** The string to replace. This must be an *exact match* of the string you want to replace, including whitespace and punctuation. */
|
|
575
|
-
old: string;
|
|
576
|
-
/** The string to replace the corresponding old string with. Can be empty to delete. */
|
|
577
|
-
new: string;
|
|
578
|
-
/** Whether to allow multiple replacements of old string. */
|
|
579
|
-
allowMultiple?: boolean;
|
|
580
|
-
}[];
|
|
581
|
-
}
|
|
582
|
-
interface SuggestFollowupsParams {
|
|
583
|
-
/** List of suggested followup prompts the user can click to send */
|
|
584
|
-
followups: {
|
|
585
|
-
/** The full prompt text to send as a user message when clicked */
|
|
586
|
-
prompt: string;
|
|
587
|
-
/** Short display label for the card (defaults to truncated prompt if not provided) */
|
|
588
|
-
label?: string;
|
|
589
|
-
}[];
|
|
590
|
-
}
|
|
591
|
-
interface TaskCompletedParams {
|
|
592
|
-
}
|
|
593
|
-
interface ThinkDeeplyParams {
|
|
594
|
-
/** Detailed step-by-step analysis. Initially keep each step concise (max ~5-7 words per step). */
|
|
595
|
-
thought: string;
|
|
596
|
-
}
|
|
597
|
-
interface WebSearchParams {
|
|
598
|
-
/** The search query to find relevant web content */
|
|
599
|
-
query: string;
|
|
600
|
-
/** Search depth - 'standard' for quick results, 'deep' for more comprehensive search. Default is 'standard'. */
|
|
601
|
-
depth?: "standard" | "deep";
|
|
602
|
-
}
|
|
603
|
-
interface WriteFileParams {
|
|
604
|
-
/** Path to the file relative to the **project root** */
|
|
605
|
-
path: string;
|
|
606
|
-
/** What the change is intended to do in only one sentence. */
|
|
607
|
-
instructions: string;
|
|
608
|
-
/** Edit snippet to apply to the file. */
|
|
609
|
-
content: string;
|
|
610
|
-
}
|
|
611
|
-
interface WriteTodosParams {
|
|
612
|
-
/** List of todos with their completion status. Add ALL of the applicable tasks to the list, so you don't forget to do anything. Try to order the todos the same way you will complete them. Do not mark todos as completed if you have not completed them yet! */
|
|
613
|
-
todos: {
|
|
614
|
-
/** Description of the task */
|
|
615
|
-
task: string;
|
|
616
|
-
/** Whether the task is completed */
|
|
617
|
-
completed: boolean;
|
|
618
|
-
}[];
|
|
619
|
-
}
|
|
620
|
-
type GetToolParams<T extends ToolName$1> = ToolParamsMap[T];
|
|
621
|
-
type JSONValue$1 = null | string | number | boolean | JSONObject$1 | JSONArray$1;
|
|
622
|
-
type JSONObject$1 = {
|
|
623
|
-
[key: string]: JSONValue$1;
|
|
624
|
-
};
|
|
625
|
-
type JSONArray$1 = JSONValue$1[];
|
|
626
|
-
type JsonSchema = {
|
|
627
|
-
type?: "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
|
|
628
|
-
description?: string;
|
|
629
|
-
properties?: Record<string, JsonSchema | boolean>;
|
|
630
|
-
required?: string[];
|
|
631
|
-
enum?: Array<string | number | boolean | null>;
|
|
632
|
-
[k: string]: unknown;
|
|
633
|
-
};
|
|
634
|
-
type JsonObjectSchema = JsonSchema & {
|
|
635
|
-
type: "object";
|
|
636
|
-
};
|
|
637
|
-
type DataContent$1 = string | Uint8Array | ArrayBuffer | Buffer;
|
|
638
|
-
type ProviderMetadata$1 = Record<string, Record<string, JSONValue$1>>;
|
|
639
|
-
type TextPart$1 = {
|
|
640
|
-
type: "text";
|
|
641
|
-
text: string;
|
|
642
|
-
providerOptions?: ProviderMetadata$1;
|
|
643
|
-
};
|
|
644
|
-
type ImagePart$1 = {
|
|
645
|
-
type: "image";
|
|
646
|
-
image: DataContent$1;
|
|
647
|
-
mediaType?: string;
|
|
648
|
-
providerOptions?: ProviderMetadata$1;
|
|
649
|
-
};
|
|
650
|
-
type FilePart$1 = {
|
|
651
|
-
type: "file";
|
|
652
|
-
data: DataContent$1;
|
|
653
|
-
filename?: string;
|
|
654
|
-
mediaType: string;
|
|
655
|
-
providerOptions?: ProviderMetadata$1;
|
|
656
|
-
};
|
|
657
|
-
type ReasoningPart$1 = {
|
|
658
|
-
type: "reasoning";
|
|
659
|
-
text: string;
|
|
660
|
-
providerOptions?: ProviderMetadata$1;
|
|
661
|
-
};
|
|
662
|
-
type ToolCallPart$1 = {
|
|
663
|
-
type: "tool-call";
|
|
664
|
-
toolCallId: string;
|
|
665
|
-
toolName: string;
|
|
666
|
-
input: Record<string, unknown>;
|
|
667
|
-
providerOptions?: ProviderMetadata$1;
|
|
668
|
-
providerExecuted?: boolean;
|
|
669
|
-
};
|
|
670
|
-
type ToolResultOutput$1 = {
|
|
671
|
-
type: "json";
|
|
672
|
-
value: JSONValue$1;
|
|
673
|
-
} | {
|
|
674
|
-
type: "media";
|
|
675
|
-
data: string;
|
|
676
|
-
mediaType: string;
|
|
677
|
-
};
|
|
678
|
-
type AuxiliaryMessageData$1 = {
|
|
679
|
-
providerOptions?: ProviderMetadata$1;
|
|
680
|
-
tags?: string[];
|
|
681
|
-
/** @deprecated Use tags instead. */
|
|
682
|
-
timeToLive?: "agentStep" | "userPrompt";
|
|
683
|
-
/** @deprecated Use tags instead. */
|
|
684
|
-
keepDuringTruncation?: boolean;
|
|
685
|
-
/** @deprecated Use tags instead. */
|
|
686
|
-
keepLastTags?: string[];
|
|
687
|
-
};
|
|
688
|
-
type SystemMessage$1 = {
|
|
689
|
-
role: "system";
|
|
690
|
-
content: TextPart$1[];
|
|
691
|
-
} & AuxiliaryMessageData$1;
|
|
692
|
-
type UserMessage$1 = {
|
|
693
|
-
role: "user";
|
|
694
|
-
content: (TextPart$1 | ImagePart$1 | FilePart$1)[];
|
|
695
|
-
} & AuxiliaryMessageData$1;
|
|
696
|
-
type AssistantMessage$1 = {
|
|
697
|
-
role: "assistant";
|
|
698
|
-
content: (TextPart$1 | ReasoningPart$1 | ToolCallPart$1)[];
|
|
699
|
-
} & AuxiliaryMessageData$1;
|
|
700
|
-
type ToolMessage$1 = {
|
|
701
|
-
role: "tool";
|
|
702
|
-
toolCallId: string;
|
|
703
|
-
toolName: string;
|
|
704
|
-
content: ToolResultOutput$1[];
|
|
705
|
-
} & AuxiliaryMessageData$1;
|
|
706
|
-
type Message$1 = SystemMessage$1 | UserMessage$1 | AssistantMessage$1 | ToolMessage$1;
|
|
707
|
-
type MCPConfig = {
|
|
708
|
-
type?: "stdio";
|
|
709
|
-
command: string;
|
|
710
|
-
args?: string[];
|
|
711
|
-
env?: Record<string, string>;
|
|
712
|
-
} | {
|
|
713
|
-
type?: "http" | "sse";
|
|
714
|
-
url: string;
|
|
715
|
-
params?: Record<string, string>;
|
|
716
|
-
headers?: Record<string, string>;
|
|
717
|
-
};
|
|
718
|
-
interface Logger {
|
|
719
|
-
debug: (data: any, msg?: string) => void;
|
|
720
|
-
info: (data: any, msg?: string) => void;
|
|
721
|
-
warn: (data: any, msg?: string) => void;
|
|
722
|
-
error: (data: any, msg?: string) => void;
|
|
723
|
-
}
|
|
724
|
-
/**
|
|
725
|
-
* LevelCode Agent Type Definitions
|
|
726
|
-
*
|
|
727
|
-
* This file provides TypeScript type definitions for creating custom LevelCode agents.
|
|
728
|
-
* Import these types in your agent files to get full type safety and IntelliSense.
|
|
729
|
-
*
|
|
730
|
-
* Usage in .agents/your-agent.ts:
|
|
731
|
-
* import { AgentDefinition, ToolName, ModelName } from './types/agent-definition'
|
|
732
|
-
*
|
|
733
|
-
* const definition: AgentDefinition = {
|
|
734
|
-
* // ... your agent configuration with full type safety ...
|
|
735
|
-
* }
|
|
736
|
-
*
|
|
737
|
-
* export default definition
|
|
738
|
-
*/
|
|
739
|
-
export interface AgentDefinition {
|
|
740
|
-
/** Unique identifier for this agent. Must contain only lowercase letters, numbers, and hyphens, e.g. 'code-reviewer' */
|
|
741
|
-
id: string;
|
|
742
|
-
/** Version string (if not provided, will default to '0.0.1' and be bumped on each publish) */
|
|
743
|
-
version?: string;
|
|
744
|
-
/** Publisher ID for the agent. Must be provided if you want to publish the agent. */
|
|
745
|
-
publisher?: string;
|
|
746
|
-
/** Human-readable name for the agent */
|
|
747
|
-
displayName: string;
|
|
748
|
-
/** AI model to use for this agent. Can be any model in OpenRouter: https://openrouter.ai/models */
|
|
749
|
-
model: ModelName;
|
|
750
|
-
/**
|
|
751
|
-
* https://openrouter.ai/docs/use-cases/reasoning-tokens
|
|
752
|
-
* One of `max_tokens` or `effort` is required.
|
|
753
|
-
* If `exclude` is true, reasoning will be removed from the response. Default is false.
|
|
754
|
-
*/
|
|
755
|
-
reasoningOptions?: {
|
|
756
|
-
enabled?: boolean;
|
|
757
|
-
exclude?: boolean;
|
|
758
|
-
} & ({
|
|
759
|
-
max_tokens: number;
|
|
760
|
-
} | {
|
|
761
|
-
effort: "high" | "medium" | "low" | "minimal" | "none";
|
|
762
|
-
});
|
|
763
|
-
/**
|
|
764
|
-
* Provider routing options for OpenRouter.
|
|
765
|
-
* Controls which providers to use and fallback behavior.
|
|
766
|
-
* See https://openrouter.ai/docs/features/provider-routing
|
|
767
|
-
*/
|
|
768
|
-
providerOptions?: {
|
|
769
|
-
/**
|
|
770
|
-
* List of provider slugs to try in order (e.g. ["anthropic", "openai"])
|
|
771
|
-
*/
|
|
772
|
-
order?: string[];
|
|
773
|
-
/**
|
|
774
|
-
* Whether to allow backup providers when primary is unavailable (default: true)
|
|
775
|
-
*/
|
|
776
|
-
allow_fallbacks?: boolean;
|
|
777
|
-
/**
|
|
778
|
-
* Only use providers that support all parameters in your request (default: false)
|
|
779
|
-
*/
|
|
780
|
-
require_parameters?: boolean;
|
|
781
|
-
/**
|
|
782
|
-
* Control whether to use providers that may store data
|
|
783
|
-
*/
|
|
784
|
-
data_collection?: "allow" | "deny";
|
|
785
|
-
/**
|
|
786
|
-
* List of provider slugs to allow for this request
|
|
787
|
-
*/
|
|
788
|
-
only?: string[];
|
|
789
|
-
/**
|
|
790
|
-
* List of provider slugs to skip for this request
|
|
791
|
-
*/
|
|
792
|
-
ignore?: string[];
|
|
793
|
-
/**
|
|
794
|
-
* List of quantization levels to filter by (e.g. ["int4", "int8"])
|
|
795
|
-
*/
|
|
796
|
-
quantizations?: Array<"int4" | "int8" | "fp4" | "fp6" | "fp8" | "fp16" | "bf16" | "fp32" | "unknown">;
|
|
797
|
-
/**
|
|
798
|
-
* Sort providers by price, throughput, or latency
|
|
799
|
-
*/
|
|
800
|
-
sort?: "price" | "throughput" | "latency";
|
|
801
|
-
/**
|
|
802
|
-
* Maximum pricing you want to pay for this request
|
|
803
|
-
*/
|
|
804
|
-
max_price?: {
|
|
805
|
-
prompt?: number | string;
|
|
806
|
-
completion?: number | string;
|
|
807
|
-
image?: number | string;
|
|
808
|
-
audio?: number | string;
|
|
809
|
-
request?: number | string;
|
|
810
|
-
};
|
|
811
|
-
};
|
|
812
|
-
/** MCP servers by name. Names cannot contain `/`. */
|
|
813
|
-
mcpServers?: Record<string, MCPConfig>;
|
|
814
|
-
/**
|
|
815
|
-
* Tools this agent can use.
|
|
816
|
-
*
|
|
817
|
-
* By default, all tools are available from any specified MCP server. In
|
|
818
|
-
* order to limit the tools from a specific MCP server, add the tool name(s)
|
|
819
|
-
* in the format `'mcpServerName/toolName1'`, `'mcpServerName/toolName2'`,
|
|
820
|
-
* etc.
|
|
821
|
-
*/
|
|
822
|
-
toolNames?: (ToolName$1 | (string & {}))[];
|
|
823
|
-
/** Other agents this agent can spawn, like 'levelcode/file-picker@0.0.1'.
|
|
824
|
-
*
|
|
825
|
-
* Use the fully qualified agent id from the agent store, including publisher and version: 'levelcode/file-picker@0.0.1'
|
|
826
|
-
* (publisher and version are required!)
|
|
827
|
-
*
|
|
828
|
-
* Or, use the agent id from a local agent file in your .agents directory: 'file-picker'.
|
|
829
|
-
*/
|
|
830
|
-
spawnableAgents?: string[];
|
|
831
|
-
/** The input schema required to spawn the agent. Provide a prompt string and/or a params object or none.
|
|
832
|
-
* 80% of the time you want just a prompt string with a description:
|
|
833
|
-
* inputSchema: {
|
|
834
|
-
* prompt: { type: 'string', description: 'A description of what info would be helpful to the agent' }
|
|
835
|
-
* }
|
|
836
|
-
*/
|
|
837
|
-
inputSchema?: {
|
|
838
|
-
prompt?: {
|
|
839
|
-
type: "string";
|
|
840
|
-
description?: string;
|
|
841
|
-
};
|
|
842
|
-
params?: JsonObjectSchema;
|
|
843
|
-
};
|
|
844
|
-
/** How the agent should output a response to its parent (defaults to 'last_message')
|
|
845
|
-
*
|
|
846
|
-
* last_message: The last message from the agent, typically after using tools.
|
|
847
|
-
*
|
|
848
|
-
* all_messages: All messages from the agent, including tool calls and results.
|
|
849
|
-
*
|
|
850
|
-
* structured_output: Make the agent output a JSON object. Can be used with outputSchema or without if you want freeform json output.
|
|
851
|
-
*/
|
|
852
|
-
outputMode?: "last_message" | "all_messages" | "structured_output";
|
|
853
|
-
/** JSON schema for structured output (when outputMode is 'structured_output') */
|
|
854
|
-
outputSchema?: JsonObjectSchema;
|
|
855
|
-
/** Prompt for when and why to spawn this agent. Include the main purpose and use cases.
|
|
856
|
-
*
|
|
857
|
-
* This field is key if the agent is intended to be spawned by other agents. */
|
|
858
|
-
spawnerPrompt?: string;
|
|
859
|
-
/** Whether to include conversation history from the parent agent in context.
|
|
860
|
-
*
|
|
861
|
-
* Defaults to false.
|
|
862
|
-
* Use this when the agent needs to know all the previous messages in the conversation.
|
|
863
|
-
*/
|
|
864
|
-
includeMessageHistory?: boolean;
|
|
865
|
-
/** Whether to inherit the parent agent's system prompt instead of using this agent's own systemPrompt.
|
|
866
|
-
*
|
|
867
|
-
* Defaults to false.
|
|
868
|
-
* Use this when you want to enable prompt caching by preserving the same system prompt prefix.
|
|
869
|
-
* Cannot be used together with the systemPrompt field.
|
|
870
|
-
*/
|
|
871
|
-
inheritParentSystemPrompt?: boolean;
|
|
872
|
-
/** Background information for the agent. Fairly optional. Prefer using instructionsPrompt for agent instructions. */
|
|
873
|
-
systemPrompt?: string;
|
|
874
|
-
/** Instructions for the agent.
|
|
875
|
-
*
|
|
876
|
-
* IMPORTANT: Updating this prompt is the best way to shape the agent's behavior.
|
|
877
|
-
* This prompt is inserted after each user input. */
|
|
878
|
-
instructionsPrompt?: string;
|
|
879
|
-
/** Prompt inserted at each agent step.
|
|
880
|
-
*
|
|
881
|
-
* Powerful for changing the agent's behavior, but usually not necessary for smart models.
|
|
882
|
-
* Prefer instructionsPrompt for most instructions. */
|
|
883
|
-
stepPrompt?: string;
|
|
884
|
-
/** Programmatically step the agent forward and run tools.
|
|
885
|
-
*
|
|
886
|
-
* You can either yield:
|
|
887
|
-
* - A tool call object with toolName and input properties.
|
|
888
|
-
* - 'STEP' to run agent's model and generate one assistant message.
|
|
889
|
-
* - 'STEP_ALL' to run the agent's model until it uses the end_turn tool or stops includes no tool calls in a message.
|
|
890
|
-
*
|
|
891
|
-
* Or use 'return' to end the turn.
|
|
892
|
-
*
|
|
893
|
-
* Example 1:
|
|
894
|
-
* function* handleSteps({ agentState, prompt, params, logger }) {
|
|
895
|
-
* logger.info('Starting file read process')
|
|
896
|
-
* const { toolResult } = yield {
|
|
897
|
-
* toolName: 'read_files',
|
|
898
|
-
* input: { paths: ['file1.txt', 'file2.txt'] }
|
|
899
|
-
* }
|
|
900
|
-
* yield 'STEP_ALL'
|
|
901
|
-
*
|
|
902
|
-
* // Optionally do a post-processing step here...
|
|
903
|
-
* logger.info('Files read successfully, setting output')
|
|
904
|
-
* yield {
|
|
905
|
-
* toolName: 'set_output',
|
|
906
|
-
* input: {
|
|
907
|
-
* output: 'The files were read successfully.',
|
|
908
|
-
* },
|
|
909
|
-
* }
|
|
910
|
-
* }
|
|
911
|
-
*
|
|
912
|
-
* Example 2:
|
|
913
|
-
* handleSteps: function* ({ agentState, prompt, params, logger }) {
|
|
914
|
-
* while (true) {
|
|
915
|
-
* logger.debug('Spawning thinker agent')
|
|
916
|
-
* yield {
|
|
917
|
-
* toolName: 'spawn_agents',
|
|
918
|
-
* input: {
|
|
919
|
-
* agents: [
|
|
920
|
-
* {
|
|
921
|
-
* agent_type: 'thinker',
|
|
922
|
-
* prompt: 'Think deeply about the user request',
|
|
923
|
-
* },
|
|
924
|
-
* ],
|
|
925
|
-
* },
|
|
926
|
-
* }
|
|
927
|
-
* const { stepsComplete } = yield 'STEP'
|
|
928
|
-
* if (stepsComplete) break
|
|
929
|
-
* }
|
|
930
|
-
* }
|
|
931
|
-
*/
|
|
932
|
-
handleSteps?: (context: AgentStepContext) => Generator<ToolCall | "STEP" | "STEP_ALL" | StepText | GenerateN, void, {
|
|
933
|
-
agentState: AgentState;
|
|
934
|
-
toolResult: ToolResultOutput$1[] | undefined;
|
|
935
|
-
stepsComplete: boolean;
|
|
936
|
-
nResponses?: string[];
|
|
937
|
-
}>;
|
|
938
|
-
}
|
|
939
|
-
interface AgentState {
|
|
940
|
-
agentId: string;
|
|
941
|
-
runId: string;
|
|
942
|
-
parentId: string | undefined;
|
|
943
|
-
/** The agent's conversation history: messages from the user and the assistant. */
|
|
944
|
-
messageHistory: Message$1[];
|
|
945
|
-
/** The last value set by the set_output tool. This is a plain object or undefined if not set. */
|
|
946
|
-
output: Record<string, any> | undefined;
|
|
947
|
-
/** The system prompt for this agent. */
|
|
948
|
-
systemPrompt: string;
|
|
949
|
-
/** The tool definitions for this agent. */
|
|
950
|
-
toolDefinitions: Record<string, {
|
|
951
|
-
description: string | undefined;
|
|
952
|
-
inputSchema: {};
|
|
953
|
-
}>;
|
|
954
|
-
/**
|
|
955
|
-
* The token count from the Anthropic API.
|
|
956
|
-
* This is updated on every agent step via the /api/v1/token-count endpoint.
|
|
957
|
-
*/
|
|
958
|
-
contextTokenCount: number;
|
|
959
|
-
}
|
|
960
|
-
interface AgentStepContext {
|
|
961
|
-
agentState: AgentState;
|
|
962
|
-
prompt?: string;
|
|
963
|
-
params?: Record<string, any>;
|
|
964
|
-
logger: Logger;
|
|
965
|
-
}
|
|
966
|
-
type StepText = {
|
|
967
|
-
type: "STEP_TEXT";
|
|
968
|
-
text: string;
|
|
969
|
-
};
|
|
970
|
-
type GenerateN = {
|
|
971
|
-
type: "GENERATE_N";
|
|
972
|
-
n: number;
|
|
973
|
-
};
|
|
974
|
-
type ToolCall<T extends ToolName$1 = ToolName$1> = {
|
|
975
|
-
[K in T]: {
|
|
976
|
-
toolName: K;
|
|
977
|
-
input: GetToolParams<K>;
|
|
978
|
-
includeToolCall?: boolean;
|
|
979
|
-
};
|
|
980
|
-
}[T];
|
|
981
|
-
type ModelName = "openai/gpt-5.1" | "openai/gpt-5.1-chat" | "openai/gpt-5-mini" | "openai/gpt-5-nano" | "anthropic/claude-sonnet-4.5" | "anthropic/claude-opus-4.1" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-preview-09-2025" | "google/gemini-2.5-flash-lite-preview-09-2025" | "x-ai/grok-4-07-09" | "x-ai/grok-4-fast" | "x-ai/grok-code-fast-1" | "qwen/qwen3-max" | "qwen/qwen3-coder-plus" | "qwen/qwen3-coder" | "qwen/qwen3-coder:nitro" | "qwen/qwen3-coder-flash" | "qwen/qwen3-235b-a22b-2507" | "qwen/qwen3-235b-a22b-2507:nitro" | "qwen/qwen3-235b-a22b-thinking-2507" | "qwen/qwen3-235b-a22b-thinking-2507:nitro" | "qwen/qwen3-30b-a3b" | "qwen/qwen3-30b-a3b:nitro" | "deepseek/deepseek-chat-v3-0324" | "deepseek/deepseek-chat-v3-0324:nitro" | "deepseek/deepseek-r1-0528" | "deepseek/deepseek-r1-0528:nitro" | "moonshotai/kimi-k2" | "moonshotai/kimi-k2:nitro" | "z-ai/glm-4.6" | "z-ai/glm-4.6:nitro" | (string & {});
|
|
982
|
-
type LoggerFn = (data: unknown, msg?: string, ...args: unknown[]) => unknown;
|
|
983
|
-
type Logger$1 = {
|
|
984
|
-
debug: LoggerFn;
|
|
985
|
-
info: LoggerFn;
|
|
986
|
-
warn: LoggerFn;
|
|
987
|
-
error: LoggerFn;
|
|
988
|
-
};
|
|
989
|
-
/** File system used for LevelCode SDK.
|
|
990
|
-
*
|
|
991
|
-
* Compatible with `fs.promises` from the `'fs'` module.
|
|
992
|
-
*/
|
|
993
|
-
export type LevelCodeFileSystem = Pick<typeof fs.promises, "mkdir" | "readdir" | "readFile" | "stat" | "writeFile">;
|
|
994
|
-
declare const SkillDefinitionSchema: z.ZodObject<{
|
|
995
|
-
name: z.ZodString;
|
|
996
|
-
description: z.ZodString;
|
|
997
|
-
license: z.ZodOptional<z.ZodString>;
|
|
998
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
999
|
-
content: z.ZodString;
|
|
1000
|
-
filePath: z.ZodString;
|
|
1001
|
-
}, z.core.$strip>;
|
|
1002
|
-
export type SkillDefinition = z.infer<typeof SkillDefinitionSchema>;
|
|
1003
|
-
/**
|
|
1004
|
-
* Collection of skills keyed by skill name.
|
|
1005
|
-
*/
|
|
1006
|
-
export type SkillsMap = Record<string, SkillDefinition>;
|
|
1007
|
-
interface FileTreeNode {
|
|
1008
|
-
name: string;
|
|
1009
|
-
type: "file" | "directory";
|
|
1010
|
-
filePath: string;
|
|
1011
|
-
lastReadTime?: number;
|
|
1012
|
-
children?: FileTreeNode[];
|
|
1013
|
-
}
|
|
1014
|
-
declare const customToolDefinitionsSchema: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1015
|
-
inputSchema: z.ZodCustom<Record<string, unknown> | z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, Record<string, unknown> | z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
1016
|
-
endsAgentStep: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
1017
|
-
description: z.ZodOptional<z.ZodString>;
|
|
1018
|
-
exampleInputs: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
1019
|
-
}, z.core.$strip>>>;
|
|
1020
|
-
type CustomToolDefinitions = NonNullable<z.input<typeof customToolDefinitionsSchema>>;
|
|
1021
|
-
type ProjectFileContext = {
|
|
1022
|
-
projectRoot: string;
|
|
1023
|
-
cwd: string;
|
|
1024
|
-
fileTree: FileTreeNode[];
|
|
1025
|
-
fileTokenScores: Record<string, Record<string, number>>;
|
|
1026
|
-
tokenCallers?: Record<string, Record<string, string[]>>;
|
|
1027
|
-
knowledgeFiles: Record<string, string>;
|
|
1028
|
-
userKnowledgeFiles?: Record<string, string>;
|
|
1029
|
-
agentTemplates: Record<string, any>;
|
|
1030
|
-
customToolDefinitions: CustomToolDefinitions;
|
|
1031
|
-
skills?: SkillsMap;
|
|
1032
|
-
gitChanges: {
|
|
1033
|
-
status: string;
|
|
1034
|
-
diff: string;
|
|
1035
|
-
diffCached: string;
|
|
1036
|
-
lastCommitMessages: string;
|
|
1037
|
-
};
|
|
1038
|
-
changesSinceLastChat: Record<string, string>;
|
|
1039
|
-
shellConfigFiles: Record<string, string>;
|
|
1040
|
-
systemInfo: {
|
|
1041
|
-
platform: string;
|
|
1042
|
-
shell: string;
|
|
1043
|
-
nodeVersion: string;
|
|
1044
|
-
arch: string;
|
|
1045
|
-
homedir: string;
|
|
1046
|
-
cpus: number;
|
|
1047
|
-
};
|
|
1048
|
-
};
|
|
1049
|
-
declare const toolCallSchema: z.ZodObject<{
|
|
1050
|
-
toolName: z.ZodString;
|
|
1051
|
-
toolCallId: z.ZodString;
|
|
1052
|
-
input: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
1053
|
-
}, z.core.$strip>;
|
|
1054
|
-
type ToolCall$1 = z.infer<typeof toolCallSchema>;
|
|
1055
|
-
declare const subgoalSchema: z.ZodObject<{
|
|
1056
|
-
objective: z.ZodOptional<z.ZodString>;
|
|
1057
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
1058
|
-
NOT_STARTED: "NOT_STARTED";
|
|
1059
|
-
IN_PROGRESS: "IN_PROGRESS";
|
|
1060
|
-
COMPLETE: "COMPLETE";
|
|
1061
|
-
ABORTED: "ABORTED";
|
|
1062
|
-
}>>;
|
|
1063
|
-
plan: z.ZodOptional<z.ZodString>;
|
|
1064
|
-
logs: z.ZodArray<z.ZodString>;
|
|
1065
|
-
}, z.core.$strip>;
|
|
1066
|
-
type Subgoal = z.infer<typeof subgoalSchema>;
|
|
1067
|
-
type AgentState$1 = {
|
|
1068
|
-
/**
|
|
1069
|
-
* @deprecated agentId is replaced by runId
|
|
1070
|
-
*/
|
|
1071
|
-
agentId: string;
|
|
1072
|
-
agentType: AgentTemplateType | null;
|
|
1073
|
-
agentContext: Record<string, Subgoal>;
|
|
1074
|
-
ancestorRunIds: string[];
|
|
1075
|
-
runId?: string;
|
|
1076
|
-
subagents: AgentState$1[];
|
|
1077
|
-
childRunIds: string[];
|
|
1078
|
-
messageHistory: Message[];
|
|
1079
|
-
stepsRemaining: number;
|
|
1080
|
-
creditsUsed: number;
|
|
1081
|
-
directCreditsUsed: number;
|
|
1082
|
-
output?: Record<string, any>;
|
|
1083
|
-
parentId?: string;
|
|
1084
|
-
systemPrompt: string;
|
|
1085
|
-
toolDefinitions: Record<string, {
|
|
1086
|
-
description: string | undefined;
|
|
1087
|
-
inputSchema: {};
|
|
1088
|
-
}>;
|
|
1089
|
-
/**
|
|
1090
|
-
* The accurate token count from the Anthropic API.
|
|
1091
|
-
* This is updated on every agent step via the /api/v1/token-count endpoint.
|
|
1092
|
-
*/
|
|
1093
|
-
contextTokenCount: number;
|
|
1094
|
-
};
|
|
1095
|
-
declare const AgentOutputSchema: z.ZodDiscriminatedUnion<[
|
|
1096
|
-
z.ZodObject<{
|
|
1097
|
-
type: z.ZodLiteral<"structuredOutput">;
|
|
1098
|
-
value: z.ZodUnion<[
|
|
1099
|
-
z.ZodRecord<z.ZodString, z.ZodAny>,
|
|
1100
|
-
z.ZodNull
|
|
1101
|
-
]>;
|
|
1102
|
-
}, z.core.$strip>,
|
|
1103
|
-
z.ZodObject<{
|
|
1104
|
-
type: z.ZodLiteral<"lastMessage">;
|
|
1105
|
-
value: z.ZodArray<z.ZodAny>;
|
|
1106
|
-
}, z.core.$strip>,
|
|
1107
|
-
z.ZodObject<{
|
|
1108
|
-
type: z.ZodLiteral<"allMessages">;
|
|
1109
|
-
value: z.ZodArray<z.ZodAny>;
|
|
1110
|
-
}, z.core.$strip>,
|
|
1111
|
-
z.ZodObject<{
|
|
1112
|
-
type: z.ZodLiteral<"error">;
|
|
1113
|
-
message: z.ZodString;
|
|
1114
|
-
statusCode: z.ZodOptional<z.ZodNumber>;
|
|
1115
|
-
}, z.core.$strip>
|
|
1116
|
-
], "type">;
|
|
1117
|
-
type AgentOutput = z.infer<typeof AgentOutputSchema>;
|
|
1118
|
-
declare const agentTemplateTypeSchema: z.ZodEnum<{
|
|
1119
|
-
base: "base";
|
|
1120
|
-
base_free: "base_free";
|
|
1121
|
-
base_max: "base_max";
|
|
1122
|
-
base_experimental: "base_experimental";
|
|
1123
|
-
claude4_gemini_thinking: "claude4_gemini_thinking";
|
|
1124
|
-
superagent: "superagent";
|
|
1125
|
-
base_agent_builder: "base_agent_builder";
|
|
1126
|
-
ask: "ask";
|
|
1127
|
-
planner: "planner";
|
|
1128
|
-
dry_run: "dry_run";
|
|
1129
|
-
thinker: "thinker";
|
|
1130
|
-
file_picker: "file_picker";
|
|
1131
|
-
file_explorer: "file_explorer";
|
|
1132
|
-
researcher: "researcher";
|
|
1133
|
-
reviewer: "reviewer";
|
|
1134
|
-
agent_builder: "agent_builder";
|
|
1135
|
-
example_programmatic: "example_programmatic";
|
|
1136
|
-
}>;
|
|
1137
|
-
type AgentTemplateType = z.infer<typeof agentTemplateTypeSchema> | (string & {});
|
|
1138
|
-
type SessionState = {
|
|
1139
|
-
fileContext: ProjectFileContext;
|
|
1140
|
-
mainAgentState: AgentState$1;
|
|
1141
|
-
};
|
|
1142
|
-
type LevelCodeSpawn = (command: string, args?: readonly string[], options?: SpawnOptions) => ChildProcess;
|
|
1143
|
-
/**
|
|
1144
|
-
* Given a list of candidate file paths, selects the one with highest priority.
|
|
1145
|
-
* Priority order: knowledge.md > AGENTS.md > CLAUDE.md (case-insensitive).
|
|
1146
|
-
* Returns undefined if no knowledge files are found.
|
|
1147
|
-
* @internal Exported for testing
|
|
1148
|
-
*/
|
|
1149
|
-
export declare function selectHighestPriorityKnowledgeFile(candidates: string[]): string | undefined;
|
|
1150
|
-
export type RunState = {
|
|
1151
|
-
sessionState?: SessionState;
|
|
1152
|
-
output: AgentOutput;
|
|
1153
|
-
};
|
|
1154
|
-
export type InitialSessionStateOptions = {
|
|
1155
|
-
cwd?: string;
|
|
1156
|
-
projectFiles?: Record<string, string>;
|
|
1157
|
-
knowledgeFiles?: Record<string, string>;
|
|
1158
|
-
/** User-provided knowledge files that will be merged with home directory files */
|
|
1159
|
-
userKnowledgeFiles?: Record<string, string>;
|
|
1160
|
-
agentDefinitions?: AgentDefinition[];
|
|
1161
|
-
customToolDefinitions?: CustomToolDefinition[];
|
|
1162
|
-
maxAgentSteps?: number;
|
|
1163
|
-
fs?: LevelCodeFileSystem;
|
|
1164
|
-
spawn?: LevelCodeSpawn;
|
|
1165
|
-
logger?: Logger$1;
|
|
1166
|
-
};
|
|
1167
|
-
/**
|
|
1168
|
-
* Loads user knowledge files from the home directory.
|
|
1169
|
-
* Checks for ~/.knowledge.md, ~/.AGENTS.md, and ~/.CLAUDE.md with priority fallback.
|
|
1170
|
-
* Matching is case-insensitive (e.g., ~/.KNOWLEDGE.md will match).
|
|
1171
|
-
* Returns a record with the tilde-prefixed path as key (e.g., "~/.knowledge.md").
|
|
1172
|
-
* @internal Exported for testing
|
|
1173
|
-
*/
|
|
1174
|
-
export declare function loadUserKnowledgeFiles(params: {
|
|
1175
|
-
fs: LevelCodeFileSystem;
|
|
1176
|
-
logger: Logger$1;
|
|
1177
|
-
/** Optional home directory override for testing */
|
|
1178
|
-
homeDir?: string;
|
|
1179
|
-
}): Promise<Record<string, string>>;
|
|
1180
|
-
/**
|
|
1181
|
-
* Selects knowledge files from a list of file paths with fallback logic.
|
|
1182
|
-
* For each directory, checks for knowledge.md first, then AGENTS.md, then CLAUDE.md.
|
|
1183
|
-
* @internal Exported for testing
|
|
1184
|
-
*/
|
|
1185
|
-
export declare function selectKnowledgeFilePaths(allFilePaths: string[]): string[];
|
|
1186
|
-
export declare function initialSessionState(params: InitialSessionStateOptions): Promise<SessionState>;
|
|
1187
|
-
export declare function generateInitialRunState({ cwd, projectFiles, knowledgeFiles, userKnowledgeFiles, agentDefinitions, customToolDefinitions, maxAgentSteps, fs, }: {
|
|
1188
|
-
cwd: string;
|
|
1189
|
-
projectFiles?: Record<string, string>;
|
|
1190
|
-
knowledgeFiles?: Record<string, string>;
|
|
1191
|
-
userKnowledgeFiles?: Record<string, string>;
|
|
1192
|
-
agentDefinitions?: AgentDefinition[];
|
|
1193
|
-
customToolDefinitions?: CustomToolDefinition[];
|
|
1194
|
-
maxAgentSteps?: number;
|
|
1195
|
-
fs: LevelCodeFileSystem;
|
|
1196
|
-
}): Promise<RunState>;
|
|
1197
|
-
export declare function withAdditionalMessage({ runState, message, }: {
|
|
1198
|
-
runState: RunState;
|
|
1199
|
-
message: Message;
|
|
1200
|
-
}): RunState;
|
|
1201
|
-
export declare function withMessageHistory({ runState, messages, }: {
|
|
1202
|
-
runState: RunState;
|
|
1203
|
-
messages: Message[];
|
|
1204
|
-
}): RunState;
|
|
1205
|
-
/**
|
|
1206
|
-
* Applies overrides to an existing session state, allowing specific fields to be updated
|
|
1207
|
-
* even when continuing from a previous run.
|
|
1208
|
-
*/
|
|
1209
|
-
export declare function applyOverridesToSessionState(cwd: string | undefined, baseSessionState: SessionState, overrides: {
|
|
1210
|
-
projectFiles?: Record<string, string>;
|
|
1211
|
-
knowledgeFiles?: Record<string, string>;
|
|
1212
|
-
agentDefinitions?: AgentDefinition[];
|
|
1213
|
-
customToolDefinitions?: CustomToolDefinition[];
|
|
1214
|
-
maxAgentSteps?: number;
|
|
1215
|
-
}): Promise<SessionState>;
|
|
1216
|
-
export type FileFilterResult = {
|
|
1217
|
-
status: "blocked" | "allow-example" | "allow";
|
|
1218
|
-
};
|
|
1219
|
-
export type FileFilter = (filePath: string) => FileFilterResult;
|
|
1220
|
-
export declare function getFiles(params: {
|
|
1221
|
-
filePaths: string[];
|
|
1222
|
-
cwd: string;
|
|
1223
|
-
fs: LevelCodeFileSystem;
|
|
1224
|
-
/**
|
|
1225
|
-
* Filter to classify files before reading.
|
|
1226
|
-
* If provided, the caller takes full control of filtering (no gitignore check).
|
|
1227
|
-
* If not provided, the SDK applies gitignore checking automatically.
|
|
1228
|
-
*/
|
|
1229
|
-
fileFilter?: FileFilter;
|
|
1230
|
-
}): Promise<Record<string, string | null>>;
|
|
1231
|
-
declare const toolParams: {
|
|
1232
|
-
add_message: {
|
|
1233
|
-
toolName: "add_message";
|
|
1234
|
-
endsAgentStep: true;
|
|
1235
|
-
description: string;
|
|
1236
|
-
inputSchema: z.ZodObject<{
|
|
1237
|
-
role: z.ZodEnum<{
|
|
1238
|
-
user: "user";
|
|
1239
|
-
assistant: "assistant";
|
|
1240
|
-
}>;
|
|
1241
|
-
content: z.ZodString;
|
|
1242
|
-
}, z.core.$strip>;
|
|
1243
|
-
outputSchema: z.ZodTuple<[
|
|
1244
|
-
z.ZodObject<{
|
|
1245
|
-
type: z.ZodLiteral<"json">;
|
|
1246
|
-
value: z.ZodObject<{
|
|
1247
|
-
message: z.ZodString;
|
|
1248
|
-
}, z.core.$strip>;
|
|
1249
|
-
}, z.core.$strip>
|
|
1250
|
-
], null>;
|
|
1251
|
-
};
|
|
1252
|
-
add_subgoal: {
|
|
1253
|
-
toolName: "add_subgoal";
|
|
1254
|
-
endsAgentStep: false;
|
|
1255
|
-
description: string;
|
|
1256
|
-
inputSchema: z.ZodObject<{
|
|
1257
|
-
id: z.ZodString;
|
|
1258
|
-
objective: z.ZodString;
|
|
1259
|
-
status: z.ZodEnum<{
|
|
1260
|
-
NOT_STARTED: "NOT_STARTED";
|
|
1261
|
-
IN_PROGRESS: "IN_PROGRESS";
|
|
1262
|
-
COMPLETE: "COMPLETE";
|
|
1263
|
-
ABORTED: "ABORTED";
|
|
1264
|
-
}>;
|
|
1265
|
-
plan: z.ZodOptional<z.ZodString>;
|
|
1266
|
-
log: z.ZodOptional<z.ZodString>;
|
|
1267
|
-
}, z.core.$strip>;
|
|
1268
|
-
outputSchema: z.ZodTuple<[
|
|
1269
|
-
z.ZodObject<{
|
|
1270
|
-
type: z.ZodLiteral<"json">;
|
|
1271
|
-
value: z.ZodType<{
|
|
1272
|
-
message: string;
|
|
1273
|
-
}, unknown, z.core.$ZodTypeInternals<{
|
|
1274
|
-
message: string;
|
|
1275
|
-
}, unknown>>;
|
|
1276
|
-
}, z.core.$strip>
|
|
1277
|
-
], null>;
|
|
1278
|
-
};
|
|
1279
|
-
ask_user: {
|
|
1280
|
-
toolName: "ask_user";
|
|
1281
|
-
endsAgentStep: true;
|
|
1282
|
-
description: string;
|
|
1283
|
-
inputSchema: z.ZodObject<{
|
|
1284
|
-
questions: z.ZodArray<z.ZodObject<{
|
|
1285
|
-
question: z.ZodString;
|
|
1286
|
-
header: z.ZodOptional<z.ZodString>;
|
|
1287
|
-
options: z.ZodArray<z.ZodObject<{
|
|
1288
|
-
label: z.ZodString;
|
|
1289
|
-
description: z.ZodOptional<z.ZodString>;
|
|
1290
|
-
}, z.core.$strip>>;
|
|
1291
|
-
multiSelect: z.ZodDefault<z.ZodBoolean>;
|
|
1292
|
-
validation: z.ZodOptional<z.ZodObject<{
|
|
1293
|
-
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
1294
|
-
minLength: z.ZodOptional<z.ZodNumber>;
|
|
1295
|
-
pattern: z.ZodOptional<z.ZodString>;
|
|
1296
|
-
patternError: z.ZodOptional<z.ZodString>;
|
|
1297
|
-
}, z.core.$strip>>;
|
|
1298
|
-
}, z.core.$strip>>;
|
|
1299
|
-
}, z.core.$strip>;
|
|
1300
|
-
outputSchema: z.ZodTuple<[
|
|
1301
|
-
z.ZodObject<{
|
|
1302
|
-
type: z.ZodLiteral<"json">;
|
|
1303
|
-
value: z.ZodType<{
|
|
1304
|
-
answers?: {
|
|
1305
|
-
questionIndex: number;
|
|
1306
|
-
selectedOption?: string | undefined;
|
|
1307
|
-
selectedOptions?: string[] | undefined;
|
|
1308
|
-
otherText?: string | undefined;
|
|
1309
|
-
}[] | undefined;
|
|
1310
|
-
skipped?: boolean | undefined;
|
|
1311
|
-
}, unknown, z.core.$ZodTypeInternals<{
|
|
1312
|
-
answers?: {
|
|
1313
|
-
questionIndex: number;
|
|
1314
|
-
selectedOption?: string | undefined;
|
|
1315
|
-
selectedOptions?: string[] | undefined;
|
|
1316
|
-
otherText?: string | undefined;
|
|
1317
|
-
}[] | undefined;
|
|
1318
|
-
skipped?: boolean | undefined;
|
|
1319
|
-
}, unknown>>;
|
|
1320
|
-
}, z.core.$strip>
|
|
1321
|
-
], null>;
|
|
1322
|
-
};
|
|
1323
|
-
browser_logs: {
|
|
1324
|
-
toolName: "browser_logs";
|
|
1325
|
-
endsAgentStep: true;
|
|
1326
|
-
description: string;
|
|
1327
|
-
inputSchema: z.ZodObject<{
|
|
1328
|
-
type: z.ZodString;
|
|
1329
|
-
url: z.ZodString;
|
|
1330
|
-
waitUntil: z.ZodOptional<z.ZodEnum<{
|
|
1331
|
-
networkidle0: "networkidle0";
|
|
1332
|
-
load: "load";
|
|
1333
|
-
domcontentloaded: "domcontentloaded";
|
|
1334
|
-
}>>;
|
|
1335
|
-
}, z.core.$strip>;
|
|
1336
|
-
outputSchema: z.ZodTuple<[
|
|
1337
|
-
z.ZodObject<{
|
|
1338
|
-
type: z.ZodLiteral<"json">;
|
|
1339
|
-
value: z.ZodType<{
|
|
1340
|
-
success: boolean;
|
|
1341
|
-
logs: {
|
|
1342
|
-
type: "error" | "debug" | "info" | "warning" | "verbose";
|
|
1343
|
-
message: string;
|
|
1344
|
-
timestamp: number;
|
|
1345
|
-
source: "tool" | "browser";
|
|
1346
|
-
location?: string | undefined;
|
|
1347
|
-
stack?: string | undefined;
|
|
1348
|
-
category?: string | undefined;
|
|
1349
|
-
level?: number | undefined;
|
|
1350
|
-
}[];
|
|
1351
|
-
error?: string | undefined;
|
|
1352
|
-
logFilter?: {
|
|
1353
|
-
types?: ("error" | "debug" | "info" | "warning" | "verbose")[] | undefined;
|
|
1354
|
-
minLevel?: number | undefined;
|
|
1355
|
-
categories?: string[] | undefined;
|
|
1356
|
-
} | undefined;
|
|
1357
|
-
networkEvents?: {
|
|
1358
|
-
url: string;
|
|
1359
|
-
method: string;
|
|
1360
|
-
timestamp: number;
|
|
1361
|
-
status?: number | undefined;
|
|
1362
|
-
errorText?: string | undefined;
|
|
1363
|
-
}[] | undefined;
|
|
1364
|
-
metrics?: {
|
|
1365
|
-
loadTime: number;
|
|
1366
|
-
memoryUsage: number;
|
|
1367
|
-
jsErrors: number;
|
|
1368
|
-
networkErrors: number;
|
|
1369
|
-
ttfb?: number | undefined;
|
|
1370
|
-
lcp?: number | undefined;
|
|
1371
|
-
fcp?: number | undefined;
|
|
1372
|
-
domContentLoaded?: number | undefined;
|
|
1373
|
-
sessionDuration?: number | undefined;
|
|
1374
|
-
} | undefined;
|
|
1375
|
-
screenshots?: {
|
|
1376
|
-
post: {
|
|
1377
|
-
type: "image";
|
|
1378
|
-
source: {
|
|
1379
|
-
type: "base64";
|
|
1380
|
-
media_type: "image/jpeg";
|
|
1381
|
-
data: string;
|
|
1382
|
-
};
|
|
1383
|
-
};
|
|
1384
|
-
pre?: {
|
|
1385
|
-
type: "image";
|
|
1386
|
-
source: {
|
|
1387
|
-
type: "base64";
|
|
1388
|
-
media_type: "image/jpeg";
|
|
1389
|
-
data: string;
|
|
1390
|
-
};
|
|
1391
|
-
} | undefined;
|
|
1392
|
-
} | undefined;
|
|
1393
|
-
}, unknown, z.core.$ZodTypeInternals<{
|
|
1394
|
-
success: boolean;
|
|
1395
|
-
logs: {
|
|
1396
|
-
type: "error" | "debug" | "info" | "warning" | "verbose";
|
|
1397
|
-
message: string;
|
|
1398
|
-
timestamp: number;
|
|
1399
|
-
source: "tool" | "browser";
|
|
1400
|
-
location?: string | undefined;
|
|
1401
|
-
stack?: string | undefined;
|
|
1402
|
-
category?: string | undefined;
|
|
1403
|
-
level?: number | undefined;
|
|
1404
|
-
}[];
|
|
1405
|
-
error?: string | undefined;
|
|
1406
|
-
logFilter?: {
|
|
1407
|
-
types?: ("error" | "debug" | "info" | "warning" | "verbose")[] | undefined;
|
|
1408
|
-
minLevel?: number | undefined;
|
|
1409
|
-
categories?: string[] | undefined;
|
|
1410
|
-
} | undefined;
|
|
1411
|
-
networkEvents?: {
|
|
1412
|
-
url: string;
|
|
1413
|
-
method: string;
|
|
1414
|
-
timestamp: number;
|
|
1415
|
-
status?: number | undefined;
|
|
1416
|
-
errorText?: string | undefined;
|
|
1417
|
-
}[] | undefined;
|
|
1418
|
-
metrics?: {
|
|
1419
|
-
loadTime: number;
|
|
1420
|
-
memoryUsage: number;
|
|
1421
|
-
jsErrors: number;
|
|
1422
|
-
networkErrors: number;
|
|
1423
|
-
ttfb?: number | undefined;
|
|
1424
|
-
lcp?: number | undefined;
|
|
1425
|
-
fcp?: number | undefined;
|
|
1426
|
-
domContentLoaded?: number | undefined;
|
|
1427
|
-
sessionDuration?: number | undefined;
|
|
1428
|
-
} | undefined;
|
|
1429
|
-
screenshots?: {
|
|
1430
|
-
post: {
|
|
1431
|
-
type: "image";
|
|
1432
|
-
source: {
|
|
1433
|
-
type: "base64";
|
|
1434
|
-
media_type: "image/jpeg";
|
|
1435
|
-
data: string;
|
|
1436
|
-
};
|
|
1437
|
-
};
|
|
1438
|
-
pre?: {
|
|
1439
|
-
type: "image";
|
|
1440
|
-
source: {
|
|
1441
|
-
type: "base64";
|
|
1442
|
-
media_type: "image/jpeg";
|
|
1443
|
-
data: string;
|
|
1444
|
-
};
|
|
1445
|
-
} | undefined;
|
|
1446
|
-
} | undefined;
|
|
1447
|
-
}, unknown>>;
|
|
1448
|
-
}, z.core.$strip>
|
|
1449
|
-
], null>;
|
|
1450
|
-
};
|
|
1451
|
-
code_search: {
|
|
1452
|
-
toolName: "code_search";
|
|
1453
|
-
endsAgentStep: true;
|
|
1454
|
-
description: string;
|
|
1455
|
-
inputSchema: z.ZodObject<{
|
|
1456
|
-
pattern: z.ZodString;
|
|
1457
|
-
flags: z.ZodOptional<z.ZodString>;
|
|
1458
|
-
cwd: z.ZodOptional<z.ZodString>;
|
|
1459
|
-
maxResults: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
1460
|
-
}, z.core.$strip>;
|
|
1461
|
-
outputSchema: z.ZodTuple<[
|
|
1462
|
-
z.ZodObject<{
|
|
1463
|
-
type: z.ZodLiteral<"json">;
|
|
1464
|
-
value: z.ZodType<{
|
|
1465
|
-
stdout: string;
|
|
1466
|
-
message: string;
|
|
1467
|
-
stderr?: string | undefined;
|
|
1468
|
-
exitCode?: number | undefined;
|
|
1469
|
-
} | {
|
|
1470
|
-
errorMessage: string;
|
|
1471
|
-
}, unknown, z.core.$ZodTypeInternals<{
|
|
1472
|
-
stdout: string;
|
|
1473
|
-
message: string;
|
|
1474
|
-
stderr?: string | undefined;
|
|
1475
|
-
exitCode?: number | undefined;
|
|
1476
|
-
} | {
|
|
1477
|
-
errorMessage: string;
|
|
1478
|
-
}, unknown>>;
|
|
1479
|
-
}, z.core.$strip>
|
|
1480
|
-
], null>;
|
|
1481
|
-
};
|
|
1482
|
-
create_plan: {
|
|
1483
|
-
toolName: "create_plan";
|
|
1484
|
-
endsAgentStep: false;
|
|
1485
|
-
description: string;
|
|
1486
|
-
inputSchema: z.ZodObject<{
|
|
1487
|
-
path: z.ZodString;
|
|
1488
|
-
plan: z.ZodString;
|
|
1489
|
-
}, z.core.$strip>;
|
|
1490
|
-
outputSchema: z.ZodTuple<[
|
|
1491
|
-
z.ZodObject<{
|
|
1492
|
-
type: z.ZodLiteral<"json">;
|
|
1493
|
-
value: z.ZodType<{
|
|
1494
|
-
file: string;
|
|
1495
|
-
message: string;
|
|
1496
|
-
unifiedDiff: string;
|
|
1497
|
-
} | {
|
|
1498
|
-
file: string;
|
|
1499
|
-
errorMessage: string;
|
|
1500
|
-
patch?: string | undefined;
|
|
1501
|
-
}, unknown, z.core.$ZodTypeInternals<{
|
|
1502
|
-
file: string;
|
|
1503
|
-
message: string;
|
|
1504
|
-
unifiedDiff: string;
|
|
1505
|
-
} | {
|
|
1506
|
-
file: string;
|
|
1507
|
-
errorMessage: string;
|
|
1508
|
-
patch?: string | undefined;
|
|
1509
|
-
}, unknown>>;
|
|
1510
|
-
}, z.core.$strip>
|
|
1511
|
-
], null>;
|
|
1512
|
-
};
|
|
1513
|
-
end_turn: {
|
|
1514
|
-
toolName: "end_turn";
|
|
1515
|
-
endsAgentStep: true;
|
|
1516
|
-
description: string;
|
|
1517
|
-
inputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
1518
|
-
outputSchema: z.ZodTuple<[
|
|
1519
|
-
z.ZodObject<{
|
|
1520
|
-
type: z.ZodLiteral<"json">;
|
|
1521
|
-
value: z.ZodObject<{
|
|
1522
|
-
message: z.ZodString;
|
|
1523
|
-
}, z.core.$strip>;
|
|
1524
|
-
}, z.core.$strip>
|
|
1525
|
-
], null>;
|
|
1526
|
-
};
|
|
1527
|
-
find_files: {
|
|
1528
|
-
toolName: "find_files";
|
|
1529
|
-
endsAgentStep: true;
|
|
1530
|
-
description: string;
|
|
1531
|
-
inputSchema: z.ZodObject<{
|
|
1532
|
-
prompt: z.ZodString;
|
|
1533
|
-
}, z.core.$strip>;
|
|
1534
|
-
outputSchema: z.ZodTuple<[
|
|
1535
|
-
z.ZodObject<{
|
|
1536
|
-
type: z.ZodLiteral<"json">;
|
|
1537
|
-
value: z.ZodType<({
|
|
1538
|
-
path: string;
|
|
1539
|
-
content: string;
|
|
1540
|
-
referencedBy?: Record<string, string[]> | undefined;
|
|
1541
|
-
} | {
|
|
1542
|
-
path: string;
|
|
1543
|
-
contentOmittedForLength: true;
|
|
1544
|
-
})[] | {
|
|
1545
|
-
message: string;
|
|
1546
|
-
}, unknown, z.core.$ZodTypeInternals<({
|
|
1547
|
-
path: string;
|
|
1548
|
-
content: string;
|
|
1549
|
-
referencedBy?: Record<string, string[]> | undefined;
|
|
1550
|
-
} | {
|
|
1551
|
-
path: string;
|
|
1552
|
-
contentOmittedForLength: true;
|
|
1553
|
-
})[] | {
|
|
1554
|
-
message: string;
|
|
1555
|
-
}, unknown>>;
|
|
1556
|
-
}, z.core.$strip>
|
|
1557
|
-
], null>;
|
|
1558
|
-
};
|
|
1559
|
-
glob: {
|
|
1560
|
-
toolName: "glob";
|
|
1561
|
-
description: string;
|
|
1562
|
-
endsAgentStep: false;
|
|
1563
|
-
inputSchema: z.ZodObject<{
|
|
1564
|
-
pattern: z.ZodString;
|
|
1565
|
-
cwd: z.ZodOptional<z.ZodString>;
|
|
1566
|
-
}, z.core.$strip>;
|
|
1567
|
-
outputSchema: z.ZodTuple<[
|
|
1568
|
-
z.ZodObject<{
|
|
1569
|
-
type: z.ZodLiteral<"json">;
|
|
1570
|
-
value: z.ZodType<{
|
|
1571
|
-
files: string[];
|
|
1572
|
-
count: number;
|
|
1573
|
-
message: string;
|
|
1574
|
-
} | {
|
|
1575
|
-
errorMessage: string;
|
|
1576
|
-
}, unknown, z.core.$ZodTypeInternals<{
|
|
1577
|
-
files: string[];
|
|
1578
|
-
count: number;
|
|
1579
|
-
message: string;
|
|
1580
|
-
} | {
|
|
1581
|
-
errorMessage: string;
|
|
1582
|
-
}, unknown>>;
|
|
1583
|
-
}, z.core.$strip>
|
|
1584
|
-
], null>;
|
|
1585
|
-
};
|
|
1586
|
-
list_directory: {
|
|
1587
|
-
toolName: "list_directory";
|
|
1588
|
-
endsAgentStep: true;
|
|
1589
|
-
description: string;
|
|
1590
|
-
inputSchema: z.ZodObject<{
|
|
1591
|
-
path: z.ZodString;
|
|
1592
|
-
}, z.core.$strip>;
|
|
1593
|
-
outputSchema: z.ZodTuple<[
|
|
1594
|
-
z.ZodObject<{
|
|
1595
|
-
type: z.ZodLiteral<"json">;
|
|
1596
|
-
value: z.ZodType<{
|
|
1597
|
-
files: string[];
|
|
1598
|
-
directories: string[];
|
|
1599
|
-
path: string;
|
|
1600
|
-
} | {
|
|
1601
|
-
errorMessage: string;
|
|
1602
|
-
}, unknown, z.core.$ZodTypeInternals<{
|
|
1603
|
-
files: string[];
|
|
1604
|
-
directories: string[];
|
|
1605
|
-
path: string;
|
|
1606
|
-
} | {
|
|
1607
|
-
errorMessage: string;
|
|
1608
|
-
}, unknown>>;
|
|
1609
|
-
}, z.core.$strip>
|
|
1610
|
-
], null>;
|
|
1611
|
-
};
|
|
1612
|
-
lookup_agent_info: {
|
|
1613
|
-
toolName: "lookup_agent_info";
|
|
1614
|
-
endsAgentStep: false;
|
|
1615
|
-
description: string;
|
|
1616
|
-
inputSchema: z.ZodObject<{
|
|
1617
|
-
agentId: z.ZodString;
|
|
1618
|
-
}, z.core.$strip>;
|
|
1619
|
-
outputSchema: z.ZodTuple<[
|
|
1620
|
-
z.ZodObject<{
|
|
1621
|
-
type: z.ZodLiteral<"json">;
|
|
1622
|
-
value: z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>;
|
|
1623
|
-
}, z.core.$strip>
|
|
1624
|
-
], null>;
|
|
1625
|
-
};
|
|
1626
|
-
propose_str_replace: {
|
|
1627
|
-
toolName: "propose_str_replace";
|
|
1628
|
-
endsAgentStep: false;
|
|
1629
|
-
description: string;
|
|
1630
|
-
inputSchema: z.ZodObject<{
|
|
1631
|
-
path: z.ZodString;
|
|
1632
|
-
replacements: z.ZodArray<z.ZodObject<{
|
|
1633
|
-
old: z.ZodString;
|
|
1634
|
-
new: z.ZodString;
|
|
1635
|
-
allowMultiple: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
1636
|
-
}, z.core.$strip>>;
|
|
1637
|
-
}, z.core.$strip>;
|
|
1638
|
-
outputSchema: z.ZodTuple<[
|
|
1639
|
-
z.ZodObject<{
|
|
1640
|
-
type: z.ZodLiteral<"json">;
|
|
1641
|
-
value: z.ZodType<{
|
|
1642
|
-
file: string;
|
|
1643
|
-
message: string;
|
|
1644
|
-
unifiedDiff: string;
|
|
1645
|
-
} | {
|
|
1646
|
-
file: string;
|
|
1647
|
-
errorMessage: string;
|
|
1648
|
-
}, unknown, z.core.$ZodTypeInternals<{
|
|
1649
|
-
file: string;
|
|
1650
|
-
message: string;
|
|
1651
|
-
unifiedDiff: string;
|
|
1652
|
-
} | {
|
|
1653
|
-
file: string;
|
|
1654
|
-
errorMessage: string;
|
|
1655
|
-
}, unknown>>;
|
|
1656
|
-
}, z.core.$strip>
|
|
1657
|
-
], null>;
|
|
1658
|
-
};
|
|
1659
|
-
propose_write_file: {
|
|
1660
|
-
toolName: "propose_write_file";
|
|
1661
|
-
endsAgentStep: false;
|
|
1662
|
-
description: string;
|
|
1663
|
-
inputSchema: z.ZodObject<{
|
|
1664
|
-
path: z.ZodString;
|
|
1665
|
-
instructions: z.ZodString;
|
|
1666
|
-
content: z.ZodString;
|
|
1667
|
-
}, z.core.$strip>;
|
|
1668
|
-
outputSchema: z.ZodTuple<[
|
|
1669
|
-
z.ZodObject<{
|
|
1670
|
-
type: z.ZodLiteral<"json">;
|
|
1671
|
-
value: z.ZodType<{
|
|
1672
|
-
file: string;
|
|
1673
|
-
message: string;
|
|
1674
|
-
unifiedDiff: string;
|
|
1675
|
-
} | {
|
|
1676
|
-
file: string;
|
|
1677
|
-
errorMessage: string;
|
|
1678
|
-
}, unknown, z.core.$ZodTypeInternals<{
|
|
1679
|
-
file: string;
|
|
1680
|
-
message: string;
|
|
1681
|
-
unifiedDiff: string;
|
|
1682
|
-
} | {
|
|
1683
|
-
file: string;
|
|
1684
|
-
errorMessage: string;
|
|
1685
|
-
}, unknown>>;
|
|
1686
|
-
}, z.core.$strip>
|
|
1687
|
-
], null>;
|
|
1688
|
-
};
|
|
1689
|
-
read_docs: {
|
|
1690
|
-
toolName: "read_docs";
|
|
1691
|
-
endsAgentStep: true;
|
|
1692
|
-
description: string;
|
|
1693
|
-
inputSchema: z.ZodObject<{
|
|
1694
|
-
libraryTitle: z.ZodString;
|
|
1695
|
-
topic: z.ZodString;
|
|
1696
|
-
max_tokens: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
1697
|
-
}, z.core.$strip>;
|
|
1698
|
-
outputSchema: z.ZodTuple<[
|
|
1699
|
-
z.ZodObject<{
|
|
1700
|
-
type: z.ZodLiteral<"json">;
|
|
1701
|
-
value: z.ZodType<{
|
|
1702
|
-
documentation: string;
|
|
1703
|
-
}, unknown, z.core.$ZodTypeInternals<{
|
|
1704
|
-
documentation: string;
|
|
1705
|
-
}, unknown>>;
|
|
1706
|
-
}, z.core.$strip>
|
|
1707
|
-
], null>;
|
|
1708
|
-
};
|
|
1709
|
-
read_files: {
|
|
1710
|
-
toolName: "read_files";
|
|
1711
|
-
endsAgentStep: true;
|
|
1712
|
-
description: string;
|
|
1713
|
-
inputSchema: z.ZodObject<{
|
|
1714
|
-
paths: z.ZodArray<z.ZodString>;
|
|
1715
|
-
}, z.core.$strip>;
|
|
1716
|
-
outputSchema: z.ZodTuple<[
|
|
1717
|
-
z.ZodObject<{
|
|
1718
|
-
type: z.ZodLiteral<"json">;
|
|
1719
|
-
value: z.ZodType<({
|
|
1720
|
-
path: string;
|
|
1721
|
-
content: string;
|
|
1722
|
-
referencedBy?: Record<string, string[]> | undefined;
|
|
1723
|
-
} | {
|
|
1724
|
-
path: string;
|
|
1725
|
-
contentOmittedForLength: true;
|
|
1726
|
-
})[], unknown, z.core.$ZodTypeInternals<({
|
|
1727
|
-
path: string;
|
|
1728
|
-
content: string;
|
|
1729
|
-
referencedBy?: Record<string, string[]> | undefined;
|
|
1730
|
-
} | {
|
|
1731
|
-
path: string;
|
|
1732
|
-
contentOmittedForLength: true;
|
|
1733
|
-
})[], unknown>>;
|
|
1734
|
-
}, z.core.$strip>
|
|
1735
|
-
], null>;
|
|
1736
|
-
};
|
|
1737
|
-
read_subtree: {
|
|
1738
|
-
toolName: "read_subtree";
|
|
1739
|
-
endsAgentStep: true;
|
|
1740
|
-
description: string;
|
|
1741
|
-
inputSchema: z.ZodObject<{
|
|
1742
|
-
paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1743
|
-
maxTokens: z.ZodDefault<z.ZodNumber>;
|
|
1744
|
-
}, z.core.$strip>;
|
|
1745
|
-
outputSchema: z.ZodTuple<[
|
|
1746
|
-
z.ZodObject<{
|
|
1747
|
-
type: z.ZodLiteral<"json">;
|
|
1748
|
-
value: z.ZodType<({
|
|
1749
|
-
path: string;
|
|
1750
|
-
type: "directory";
|
|
1751
|
-
printedTree: string;
|
|
1752
|
-
tokenCount: number;
|
|
1753
|
-
truncationLevel: "none" | "tokens" | "unimportant-files" | "depth-based";
|
|
1754
|
-
} | {
|
|
1755
|
-
path: string;
|
|
1756
|
-
type: "file";
|
|
1757
|
-
variables: string[];
|
|
1758
|
-
} | {
|
|
1759
|
-
path: string;
|
|
1760
|
-
errorMessage: string;
|
|
1761
|
-
})[], unknown, z.core.$ZodTypeInternals<({
|
|
1762
|
-
path: string;
|
|
1763
|
-
type: "directory";
|
|
1764
|
-
printedTree: string;
|
|
1765
|
-
tokenCount: number;
|
|
1766
|
-
truncationLevel: "none" | "tokens" | "unimportant-files" | "depth-based";
|
|
1767
|
-
} | {
|
|
1768
|
-
path: string;
|
|
1769
|
-
type: "file";
|
|
1770
|
-
variables: string[];
|
|
1771
|
-
} | {
|
|
1772
|
-
path: string;
|
|
1773
|
-
errorMessage: string;
|
|
1774
|
-
})[], unknown>>;
|
|
1775
|
-
}, z.core.$strip>
|
|
1776
|
-
], null>;
|
|
1777
|
-
};
|
|
1778
|
-
run_file_change_hooks: {
|
|
1779
|
-
toolName: "run_file_change_hooks";
|
|
1780
|
-
endsAgentStep: true;
|
|
1781
|
-
description: string;
|
|
1782
|
-
inputSchema: z.ZodObject<{
|
|
1783
|
-
files: z.ZodArray<z.ZodString>;
|
|
1784
|
-
}, z.core.$strip>;
|
|
1785
|
-
outputSchema: z.ZodTuple<[
|
|
1786
|
-
z.ZodObject<{
|
|
1787
|
-
type: z.ZodLiteral<"json">;
|
|
1788
|
-
value: z.ZodType<((({
|
|
1789
|
-
command: string;
|
|
1790
|
-
startingCwd?: string | undefined;
|
|
1791
|
-
message?: string | undefined;
|
|
1792
|
-
stderr?: string | undefined;
|
|
1793
|
-
stdout?: string | undefined;
|
|
1794
|
-
exitCode?: number | undefined;
|
|
1795
|
-
} | {
|
|
1796
|
-
command: string;
|
|
1797
|
-
stdoutOmittedForLength: true;
|
|
1798
|
-
startingCwd?: string | undefined;
|
|
1799
|
-
message?: string | undefined;
|
|
1800
|
-
stderr?: string | undefined;
|
|
1801
|
-
exitCode?: number | undefined;
|
|
1802
|
-
} | {
|
|
1803
|
-
command: string;
|
|
1804
|
-
processId: number;
|
|
1805
|
-
backgroundProcessStatus: "error" | "running" | "completed";
|
|
1806
|
-
} | {
|
|
1807
|
-
command: string;
|
|
1808
|
-
errorMessage: string;
|
|
1809
|
-
}) & {
|
|
1810
|
-
hookName: string;
|
|
1811
|
-
}) | {
|
|
1812
|
-
errorMessage: string;
|
|
1813
|
-
})[], unknown, z.core.$ZodTypeInternals<((({
|
|
1814
|
-
command: string;
|
|
1815
|
-
startingCwd?: string | undefined;
|
|
1816
|
-
message?: string | undefined;
|
|
1817
|
-
stderr?: string | undefined;
|
|
1818
|
-
stdout?: string | undefined;
|
|
1819
|
-
exitCode?: number | undefined;
|
|
1820
|
-
} | {
|
|
1821
|
-
command: string;
|
|
1822
|
-
stdoutOmittedForLength: true;
|
|
1823
|
-
startingCwd?: string | undefined;
|
|
1824
|
-
message?: string | undefined;
|
|
1825
|
-
stderr?: string | undefined;
|
|
1826
|
-
exitCode?: number | undefined;
|
|
1827
|
-
} | {
|
|
1828
|
-
command: string;
|
|
1829
|
-
processId: number;
|
|
1830
|
-
backgroundProcessStatus: "error" | "running" | "completed";
|
|
1831
|
-
} | {
|
|
1832
|
-
command: string;
|
|
1833
|
-
errorMessage: string;
|
|
1834
|
-
}) & {
|
|
1835
|
-
hookName: string;
|
|
1836
|
-
}) | {
|
|
1837
|
-
errorMessage: string;
|
|
1838
|
-
})[], unknown>>;
|
|
1839
|
-
}, z.core.$strip>
|
|
1840
|
-
], null>;
|
|
1841
|
-
};
|
|
1842
|
-
run_terminal_command: {
|
|
1843
|
-
toolName: "run_terminal_command";
|
|
1844
|
-
endsAgentStep: true;
|
|
1845
|
-
description: string;
|
|
1846
|
-
inputSchema: z.ZodObject<{
|
|
1847
|
-
command: z.ZodString;
|
|
1848
|
-
process_type: z.ZodDefault<z.ZodEnum<{
|
|
1849
|
-
SYNC: "SYNC";
|
|
1850
|
-
BACKGROUND: "BACKGROUND";
|
|
1851
|
-
}>>;
|
|
1852
|
-
cwd: z.ZodOptional<z.ZodString>;
|
|
1853
|
-
timeout_seconds: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
1854
|
-
}, z.core.$strip>;
|
|
1855
|
-
outputSchema: z.ZodTuple<[
|
|
1856
|
-
z.ZodObject<{
|
|
1857
|
-
type: z.ZodLiteral<"json">;
|
|
1858
|
-
value: z.ZodType<{
|
|
1859
|
-
command: string;
|
|
1860
|
-
startingCwd?: string | undefined;
|
|
1861
|
-
message?: string | undefined;
|
|
1862
|
-
stderr?: string | undefined;
|
|
1863
|
-
stdout?: string | undefined;
|
|
1864
|
-
exitCode?: number | undefined;
|
|
1865
|
-
} | {
|
|
1866
|
-
command: string;
|
|
1867
|
-
stdoutOmittedForLength: true;
|
|
1868
|
-
startingCwd?: string | undefined;
|
|
1869
|
-
message?: string | undefined;
|
|
1870
|
-
stderr?: string | undefined;
|
|
1871
|
-
exitCode?: number | undefined;
|
|
1872
|
-
} | {
|
|
1873
|
-
command: string;
|
|
1874
|
-
processId: number;
|
|
1875
|
-
backgroundProcessStatus: "error" | "running" | "completed";
|
|
1876
|
-
} | {
|
|
1877
|
-
command: string;
|
|
1878
|
-
errorMessage: string;
|
|
1879
|
-
}, unknown, z.core.$ZodTypeInternals<{
|
|
1880
|
-
command: string;
|
|
1881
|
-
startingCwd?: string | undefined;
|
|
1882
|
-
message?: string | undefined;
|
|
1883
|
-
stderr?: string | undefined;
|
|
1884
|
-
stdout?: string | undefined;
|
|
1885
|
-
exitCode?: number | undefined;
|
|
1886
|
-
} | {
|
|
1887
|
-
command: string;
|
|
1888
|
-
stdoutOmittedForLength: true;
|
|
1889
|
-
startingCwd?: string | undefined;
|
|
1890
|
-
message?: string | undefined;
|
|
1891
|
-
stderr?: string | undefined;
|
|
1892
|
-
exitCode?: number | undefined;
|
|
1893
|
-
} | {
|
|
1894
|
-
command: string;
|
|
1895
|
-
processId: number;
|
|
1896
|
-
backgroundProcessStatus: "error" | "running" | "completed";
|
|
1897
|
-
} | {
|
|
1898
|
-
command: string;
|
|
1899
|
-
errorMessage: string;
|
|
1900
|
-
}, unknown>>;
|
|
1901
|
-
}, z.core.$strip>
|
|
1902
|
-
], null>;
|
|
1903
|
-
};
|
|
1904
|
-
set_messages: {
|
|
1905
|
-
toolName: "set_messages";
|
|
1906
|
-
endsAgentStep: true;
|
|
1907
|
-
description: string;
|
|
1908
|
-
inputSchema: z.ZodObject<{
|
|
1909
|
-
messages: z.ZodAny;
|
|
1910
|
-
}, z.core.$strip>;
|
|
1911
|
-
outputSchema: z.ZodTuple<[
|
|
1912
|
-
z.ZodObject<{
|
|
1913
|
-
type: z.ZodLiteral<"json">;
|
|
1914
|
-
value: z.ZodObject<{
|
|
1915
|
-
message: z.ZodString;
|
|
1916
|
-
}, z.core.$strip>;
|
|
1917
|
-
}, z.core.$strip>
|
|
1918
|
-
], null>;
|
|
1919
|
-
};
|
|
1920
|
-
set_output: {
|
|
1921
|
-
toolName: "set_output";
|
|
1922
|
-
endsAgentStep: false;
|
|
1923
|
-
description: string;
|
|
1924
|
-
inputSchema: z.ZodObject<{
|
|
1925
|
-
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1926
|
-
}, z.core.$loose>;
|
|
1927
|
-
outputSchema: z.ZodTuple<[
|
|
1928
|
-
z.ZodObject<{
|
|
1929
|
-
type: z.ZodLiteral<"json">;
|
|
1930
|
-
value: z.ZodObject<{
|
|
1931
|
-
message: z.ZodString;
|
|
1932
|
-
}, z.core.$strip>;
|
|
1933
|
-
}, z.core.$strip>
|
|
1934
|
-
], null>;
|
|
1935
|
-
};
|
|
1936
|
-
skill: {
|
|
1937
|
-
toolName: "skill";
|
|
1938
|
-
endsAgentStep: true;
|
|
1939
|
-
description: string;
|
|
1940
|
-
inputSchema: z.ZodObject<{
|
|
1941
|
-
name: z.ZodString;
|
|
1942
|
-
}, z.core.$strip>;
|
|
1943
|
-
outputSchema: z.ZodTuple<[
|
|
1944
|
-
z.ZodObject<{
|
|
1945
|
-
type: z.ZodLiteral<"json">;
|
|
1946
|
-
value: z.ZodType<{
|
|
1947
|
-
name: string;
|
|
1948
|
-
description: string;
|
|
1949
|
-
content: string;
|
|
1950
|
-
license?: string | undefined;
|
|
1951
|
-
}, unknown, z.core.$ZodTypeInternals<{
|
|
1952
|
-
name: string;
|
|
1953
|
-
description: string;
|
|
1954
|
-
content: string;
|
|
1955
|
-
license?: string | undefined;
|
|
1956
|
-
}, unknown>>;
|
|
1957
|
-
}, z.core.$strip>
|
|
1958
|
-
], null>;
|
|
1959
|
-
};
|
|
1960
|
-
spawn_agents: {
|
|
1961
|
-
toolName: "spawn_agents";
|
|
1962
|
-
endsAgentStep: true;
|
|
1963
|
-
description: string;
|
|
1964
|
-
inputSchema: z.ZodObject<{
|
|
1965
|
-
agents: z.ZodArray<z.ZodObject<{
|
|
1966
|
-
agent_type: z.ZodString;
|
|
1967
|
-
prompt: z.ZodOptional<z.ZodString>;
|
|
1968
|
-
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1969
|
-
}, z.core.$strip>>;
|
|
1970
|
-
}, z.core.$strip>;
|
|
1971
|
-
outputSchema: z.ZodTuple<[
|
|
1972
|
-
z.ZodObject<{
|
|
1973
|
-
type: z.ZodLiteral<"json">;
|
|
1974
|
-
value: z.ZodType<({
|
|
1975
|
-
agentType: string;
|
|
1976
|
-
} & JSONObject)[], unknown, z.core.$ZodTypeInternals<({
|
|
1977
|
-
agentType: string;
|
|
1978
|
-
} & JSONObject)[], unknown>>;
|
|
1979
|
-
}, z.core.$strip>
|
|
1980
|
-
], null>;
|
|
1981
|
-
};
|
|
1982
|
-
spawn_agent_inline: {
|
|
1983
|
-
toolName: "spawn_agent_inline";
|
|
1984
|
-
endsAgentStep: true;
|
|
1985
|
-
description: string;
|
|
1986
|
-
inputSchema: z.ZodObject<{
|
|
1987
|
-
agent_type: z.ZodString;
|
|
1988
|
-
prompt: z.ZodOptional<z.ZodString>;
|
|
1989
|
-
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1990
|
-
}, z.core.$strip>;
|
|
1991
|
-
outputSchema: z.ZodTuple<[
|
|
1992
|
-
z.ZodObject<{
|
|
1993
|
-
type: z.ZodLiteral<"json">;
|
|
1994
|
-
value: z.ZodObject<{
|
|
1995
|
-
message: z.ZodString;
|
|
1996
|
-
}, z.core.$strip>;
|
|
1997
|
-
}, z.core.$strip>
|
|
1998
|
-
], null>;
|
|
1999
|
-
};
|
|
2000
|
-
str_replace: {
|
|
2001
|
-
toolName: "str_replace";
|
|
2002
|
-
endsAgentStep: false;
|
|
2003
|
-
description: string;
|
|
2004
|
-
inputSchema: z.ZodObject<{
|
|
2005
|
-
path: z.ZodString;
|
|
2006
|
-
replacements: z.ZodArray<z.ZodObject<{
|
|
2007
|
-
old: z.ZodString;
|
|
2008
|
-
new: z.ZodString;
|
|
2009
|
-
allowMultiple: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
2010
|
-
}, z.core.$strip>>;
|
|
2011
|
-
}, z.core.$strip>;
|
|
2012
|
-
outputSchema: z.ZodTuple<[
|
|
2013
|
-
z.ZodObject<{
|
|
2014
|
-
type: z.ZodLiteral<"json">;
|
|
2015
|
-
value: z.ZodType<{
|
|
2016
|
-
file: string;
|
|
2017
|
-
message: string;
|
|
2018
|
-
unifiedDiff: string;
|
|
2019
|
-
} | {
|
|
2020
|
-
file: string;
|
|
2021
|
-
errorMessage: string;
|
|
2022
|
-
patch?: string | undefined;
|
|
2023
|
-
}, unknown, z.core.$ZodTypeInternals<{
|
|
2024
|
-
file: string;
|
|
2025
|
-
message: string;
|
|
2026
|
-
unifiedDiff: string;
|
|
2027
|
-
} | {
|
|
2028
|
-
file: string;
|
|
2029
|
-
errorMessage: string;
|
|
2030
|
-
patch?: string | undefined;
|
|
2031
|
-
}, unknown>>;
|
|
2032
|
-
}, z.core.$strip>
|
|
2033
|
-
], null>;
|
|
2034
|
-
};
|
|
2035
|
-
suggest_followups: {
|
|
2036
|
-
toolName: "suggest_followups";
|
|
2037
|
-
endsAgentStep: false;
|
|
2038
|
-
description: string;
|
|
2039
|
-
inputSchema: z.ZodObject<{
|
|
2040
|
-
followups: z.ZodArray<z.ZodObject<{
|
|
2041
|
-
prompt: z.ZodString;
|
|
2042
|
-
label: z.ZodOptional<z.ZodString>;
|
|
2043
|
-
}, z.core.$strip>>;
|
|
2044
|
-
}, z.core.$strip>;
|
|
2045
|
-
outputSchema: z.ZodTuple<[
|
|
2046
|
-
z.ZodObject<{
|
|
2047
|
-
type: z.ZodLiteral<"json">;
|
|
2048
|
-
value: z.ZodType<{
|
|
2049
|
-
message: string;
|
|
2050
|
-
}, unknown, z.core.$ZodTypeInternals<{
|
|
2051
|
-
message: string;
|
|
2052
|
-
}, unknown>>;
|
|
2053
|
-
}, z.core.$strip>
|
|
2054
|
-
], null>;
|
|
2055
|
-
};
|
|
2056
|
-
task_completed: {
|
|
2057
|
-
toolName: "task_completed";
|
|
2058
|
-
endsAgentStep: true;
|
|
2059
|
-
description: string;
|
|
2060
|
-
inputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
2061
|
-
outputSchema: z.ZodTuple<[
|
|
2062
|
-
z.ZodObject<{
|
|
2063
|
-
type: z.ZodLiteral<"json">;
|
|
2064
|
-
value: z.ZodObject<{
|
|
2065
|
-
message: z.ZodString;
|
|
2066
|
-
}, z.core.$strip>;
|
|
2067
|
-
}, z.core.$strip>
|
|
2068
|
-
], null>;
|
|
2069
|
-
};
|
|
2070
|
-
think_deeply: {
|
|
2071
|
-
toolName: "think_deeply";
|
|
2072
|
-
endsAgentStep: false;
|
|
2073
|
-
description: string;
|
|
2074
|
-
inputSchema: z.ZodObject<{
|
|
2075
|
-
thought: z.ZodString;
|
|
2076
|
-
}, z.core.$strip>;
|
|
2077
|
-
outputSchema: z.ZodTuple<[
|
|
2078
|
-
z.ZodObject<{
|
|
2079
|
-
type: z.ZodLiteral<"json">;
|
|
2080
|
-
value: z.ZodObject<{
|
|
2081
|
-
message: z.ZodString;
|
|
2082
|
-
}, z.core.$strip>;
|
|
2083
|
-
}, z.core.$strip>
|
|
2084
|
-
], null>;
|
|
2085
|
-
};
|
|
2086
|
-
update_subgoal: {
|
|
2087
|
-
toolName: "update_subgoal";
|
|
2088
|
-
endsAgentStep: false;
|
|
2089
|
-
description: string;
|
|
2090
|
-
inputSchema: z.ZodObject<{
|
|
2091
|
-
id: z.ZodString;
|
|
2092
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
2093
|
-
NOT_STARTED: "NOT_STARTED";
|
|
2094
|
-
IN_PROGRESS: "IN_PROGRESS";
|
|
2095
|
-
COMPLETE: "COMPLETE";
|
|
2096
|
-
ABORTED: "ABORTED";
|
|
2097
|
-
}>>;
|
|
2098
|
-
plan: z.ZodOptional<z.ZodString>;
|
|
2099
|
-
log: z.ZodOptional<z.ZodString>;
|
|
2100
|
-
}, z.core.$strip>;
|
|
2101
|
-
outputSchema: z.ZodTuple<[
|
|
2102
|
-
z.ZodObject<{
|
|
2103
|
-
type: z.ZodLiteral<"json">;
|
|
2104
|
-
value: z.ZodType<{
|
|
2105
|
-
message: string;
|
|
2106
|
-
}, unknown, z.core.$ZodTypeInternals<{
|
|
2107
|
-
message: string;
|
|
2108
|
-
}, unknown>>;
|
|
2109
|
-
}, z.core.$strip>
|
|
2110
|
-
], null>;
|
|
2111
|
-
};
|
|
2112
|
-
web_search: {
|
|
2113
|
-
toolName: "web_search";
|
|
2114
|
-
endsAgentStep: true;
|
|
2115
|
-
description: string;
|
|
2116
|
-
inputSchema: z.ZodObject<{
|
|
2117
|
-
query: z.ZodString;
|
|
2118
|
-
depth: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
2119
|
-
standard: "standard";
|
|
2120
|
-
deep: "deep";
|
|
2121
|
-
}>>>;
|
|
2122
|
-
}, z.core.$strip>;
|
|
2123
|
-
outputSchema: z.ZodTuple<[
|
|
2124
|
-
z.ZodObject<{
|
|
2125
|
-
type: z.ZodLiteral<"json">;
|
|
2126
|
-
value: z.ZodType<{
|
|
2127
|
-
result: string;
|
|
2128
|
-
} | {
|
|
2129
|
-
errorMessage: string;
|
|
2130
|
-
}, unknown, z.core.$ZodTypeInternals<{
|
|
2131
|
-
result: string;
|
|
2132
|
-
} | {
|
|
2133
|
-
errorMessage: string;
|
|
2134
|
-
}, unknown>>;
|
|
2135
|
-
}, z.core.$strip>
|
|
2136
|
-
], null>;
|
|
2137
|
-
};
|
|
2138
|
-
write_file: {
|
|
2139
|
-
toolName: "write_file";
|
|
2140
|
-
endsAgentStep: false;
|
|
2141
|
-
description: string;
|
|
2142
|
-
inputSchema: z.ZodObject<{
|
|
2143
|
-
path: z.ZodString;
|
|
2144
|
-
instructions: z.ZodString;
|
|
2145
|
-
content: z.ZodString;
|
|
2146
|
-
}, z.core.$strip>;
|
|
2147
|
-
outputSchema: z.ZodTuple<[
|
|
2148
|
-
z.ZodObject<{
|
|
2149
|
-
type: z.ZodLiteral<"json">;
|
|
2150
|
-
value: z.ZodType<{
|
|
2151
|
-
file: string;
|
|
2152
|
-
message: string;
|
|
2153
|
-
unifiedDiff: string;
|
|
2154
|
-
} | {
|
|
2155
|
-
file: string;
|
|
2156
|
-
errorMessage: string;
|
|
2157
|
-
patch?: string | undefined;
|
|
2158
|
-
}, unknown, z.core.$ZodTypeInternals<{
|
|
2159
|
-
file: string;
|
|
2160
|
-
message: string;
|
|
2161
|
-
unifiedDiff: string;
|
|
2162
|
-
} | {
|
|
2163
|
-
file: string;
|
|
2164
|
-
errorMessage: string;
|
|
2165
|
-
patch?: string | undefined;
|
|
2166
|
-
}, unknown>>;
|
|
2167
|
-
}, z.core.$strip>
|
|
2168
|
-
], null>;
|
|
2169
|
-
};
|
|
2170
|
-
write_todos: {
|
|
2171
|
-
toolName: "write_todos";
|
|
2172
|
-
endsAgentStep: false;
|
|
2173
|
-
description: string;
|
|
2174
|
-
inputSchema: z.ZodObject<{
|
|
2175
|
-
todos: z.ZodArray<z.ZodObject<{
|
|
2176
|
-
task: z.ZodString;
|
|
2177
|
-
completed: z.ZodBoolean;
|
|
2178
|
-
}, z.core.$strip>>;
|
|
2179
|
-
}, z.core.$strip>;
|
|
2180
|
-
outputSchema: z.ZodTuple<[
|
|
2181
|
-
z.ZodObject<{
|
|
2182
|
-
type: z.ZodLiteral<"json">;
|
|
2183
|
-
value: z.ZodObject<{
|
|
2184
|
-
message: z.ZodString;
|
|
2185
|
-
}, z.core.$strip>;
|
|
2186
|
-
}, z.core.$strip>
|
|
2187
|
-
], null>;
|
|
2188
|
-
};
|
|
2189
|
-
};
|
|
2190
|
-
export type LevelCodeToolOutput<T extends ToolName = ToolName> = {
|
|
2191
|
-
[K in ToolName]: K extends ToolName ? z.infer<(typeof toolParams)[K]["outputSchema"]> : never;
|
|
2192
|
-
}[T];
|
|
2193
|
-
declare const clientToolCallSchema: z.ZodDiscriminatedUnion<[
|
|
2194
|
-
z.ZodObject<{
|
|
2195
|
-
toolName: z.ZodLiteral<"ask_user">;
|
|
2196
|
-
input: z.ZodObject<{
|
|
2197
|
-
questions: z.ZodArray<z.ZodObject<{
|
|
2198
|
-
question: z.ZodString;
|
|
2199
|
-
header: z.ZodOptional<z.ZodString>;
|
|
2200
|
-
options: z.ZodArray<z.ZodObject<{
|
|
2201
|
-
label: z.ZodString;
|
|
2202
|
-
description: z.ZodOptional<z.ZodString>;
|
|
2203
|
-
}, z.core.$strip>>;
|
|
2204
|
-
multiSelect: z.ZodDefault<z.ZodBoolean>;
|
|
2205
|
-
validation: z.ZodOptional<z.ZodObject<{
|
|
2206
|
-
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
2207
|
-
minLength: z.ZodOptional<z.ZodNumber>;
|
|
2208
|
-
pattern: z.ZodOptional<z.ZodString>;
|
|
2209
|
-
patternError: z.ZodOptional<z.ZodString>;
|
|
2210
|
-
}, z.core.$strip>>;
|
|
2211
|
-
}, z.core.$strip>>;
|
|
2212
|
-
}, z.core.$strip>;
|
|
2213
|
-
}, z.core.$strip>,
|
|
2214
|
-
z.ZodObject<{
|
|
2215
|
-
toolName: z.ZodLiteral<"browser_logs">;
|
|
2216
|
-
input: z.ZodObject<{
|
|
2217
|
-
type: z.ZodString;
|
|
2218
|
-
url: z.ZodString;
|
|
2219
|
-
waitUntil: z.ZodOptional<z.ZodEnum<{
|
|
2220
|
-
networkidle0: "networkidle0";
|
|
2221
|
-
load: "load";
|
|
2222
|
-
domcontentloaded: "domcontentloaded";
|
|
2223
|
-
}>>;
|
|
2224
|
-
}, z.core.$strip>;
|
|
2225
|
-
}, z.core.$strip>,
|
|
2226
|
-
z.ZodObject<{
|
|
2227
|
-
toolName: z.ZodLiteral<"code_search">;
|
|
2228
|
-
input: z.ZodObject<{
|
|
2229
|
-
pattern: z.ZodString;
|
|
2230
|
-
flags: z.ZodOptional<z.ZodString>;
|
|
2231
|
-
cwd: z.ZodOptional<z.ZodString>;
|
|
2232
|
-
maxResults: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
2233
|
-
}, z.core.$strip>;
|
|
2234
|
-
}, z.core.$strip>,
|
|
2235
|
-
z.ZodObject<{
|
|
2236
|
-
toolName: z.ZodLiteral<"create_plan">;
|
|
2237
|
-
input: z.ZodObject<{
|
|
2238
|
-
type: z.ZodEnum<{
|
|
2239
|
-
file: "file";
|
|
2240
|
-
patch: "patch";
|
|
2241
|
-
}>;
|
|
2242
|
-
path: z.ZodString;
|
|
2243
|
-
content: z.ZodString;
|
|
2244
|
-
}, z.core.$strip>;
|
|
2245
|
-
}, z.core.$strip>,
|
|
2246
|
-
z.ZodObject<{
|
|
2247
|
-
toolName: z.ZodLiteral<"glob">;
|
|
2248
|
-
input: z.ZodObject<{
|
|
2249
|
-
pattern: z.ZodString;
|
|
2250
|
-
cwd: z.ZodOptional<z.ZodString>;
|
|
2251
|
-
}, z.core.$strip>;
|
|
2252
|
-
}, z.core.$strip>,
|
|
2253
|
-
z.ZodObject<{
|
|
2254
|
-
toolName: z.ZodLiteral<"list_directory">;
|
|
2255
|
-
input: z.ZodObject<{
|
|
2256
|
-
path: z.ZodString;
|
|
2257
|
-
}, z.core.$strip>;
|
|
2258
|
-
}, z.core.$strip>,
|
|
2259
|
-
z.ZodObject<{
|
|
2260
|
-
toolName: z.ZodLiteral<"run_file_change_hooks">;
|
|
2261
|
-
input: z.ZodObject<{
|
|
2262
|
-
files: z.ZodArray<z.ZodString>;
|
|
2263
|
-
}, z.core.$strip>;
|
|
2264
|
-
}, z.core.$strip>,
|
|
2265
|
-
z.ZodObject<{
|
|
2266
|
-
toolName: z.ZodLiteral<"run_terminal_command">;
|
|
2267
|
-
input: z.ZodIntersection<z.ZodObject<{
|
|
2268
|
-
command: z.ZodString;
|
|
2269
|
-
process_type: z.ZodDefault<z.ZodEnum<{
|
|
2270
|
-
SYNC: "SYNC";
|
|
2271
|
-
BACKGROUND: "BACKGROUND";
|
|
2272
|
-
}>>;
|
|
2273
|
-
cwd: z.ZodOptional<z.ZodString>;
|
|
2274
|
-
timeout_seconds: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
2275
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
2276
|
-
mode: z.ZodEnum<{
|
|
2277
|
-
user: "user";
|
|
2278
|
-
assistant: "assistant";
|
|
2279
|
-
}>;
|
|
2280
|
-
}, z.core.$strip>>;
|
|
2281
|
-
}, z.core.$strip>,
|
|
2282
|
-
z.ZodObject<{
|
|
2283
|
-
toolName: z.ZodLiteral<"str_replace">;
|
|
2284
|
-
input: z.ZodObject<{
|
|
2285
|
-
type: z.ZodEnum<{
|
|
2286
|
-
file: "file";
|
|
2287
|
-
patch: "patch";
|
|
2288
|
-
}>;
|
|
2289
|
-
path: z.ZodString;
|
|
2290
|
-
content: z.ZodString;
|
|
2291
|
-
}, z.core.$strip>;
|
|
2292
|
-
}, z.core.$strip>,
|
|
2293
|
-
z.ZodObject<{
|
|
2294
|
-
toolName: z.ZodLiteral<"write_file">;
|
|
2295
|
-
input: z.ZodObject<{
|
|
2296
|
-
type: z.ZodEnum<{
|
|
2297
|
-
file: "file";
|
|
2298
|
-
patch: "patch";
|
|
2299
|
-
}>;
|
|
2300
|
-
path: z.ZodString;
|
|
2301
|
-
content: z.ZodString;
|
|
2302
|
-
}, z.core.$strip>;
|
|
2303
|
-
}, z.core.$strip>
|
|
2304
|
-
], "toolName">;
|
|
2305
|
-
declare const clientToolNames: ("glob" | "create_plan" | "ask_user" | "browser_logs" | "code_search" | "list_directory" | "run_file_change_hooks" | "run_terminal_command" | "str_replace" | "write_file")[];
|
|
2306
|
-
export type ClientToolName = (typeof clientToolNames)[number];
|
|
2307
|
-
export type ClientToolCall<T extends ClientToolName = ClientToolName> = Extract<z.infer<typeof clientToolCallSchema>, {
|
|
2308
|
-
toolName: T;
|
|
2309
|
-
}> & Pick<ToolCallPart, "toolCallId" | "toolName" | "input" | "providerOptions">;
|
|
2310
|
-
type Source<T> = T | Promise<T> | (T extends (...args: unknown[]) => unknown ? never : () => T | Promise<T>);
|
|
2311
|
-
type LevelCodeClientOptions = {
|
|
2312
|
-
apiKey?: string;
|
|
2313
|
-
cwd?: string;
|
|
2314
|
-
projectFiles?: Record<string, string>;
|
|
2315
|
-
knowledgeFiles?: Record<string, string>;
|
|
2316
|
-
agentDefinitions?: AgentDefinition[];
|
|
2317
|
-
maxAgentSteps?: number;
|
|
2318
|
-
env?: Record<string, string>;
|
|
2319
|
-
handleEvent?: (event: PrintModeEvent) => void | Promise<void>;
|
|
2320
|
-
handleStreamChunk?: (chunk: string | {
|
|
2321
|
-
type: "subagent_chunk";
|
|
2322
|
-
agentId: string;
|
|
2323
|
-
agentType: string;
|
|
2324
|
-
chunk: string;
|
|
2325
|
-
} | {
|
|
2326
|
-
type: "reasoning_chunk";
|
|
2327
|
-
agentId: string;
|
|
2328
|
-
ancestorRunIds: string[];
|
|
2329
|
-
chunk: string;
|
|
2330
|
-
}) => void | Promise<void>;
|
|
2331
|
-
/** Optional filter to classify files before reading (runs before gitignore check) */
|
|
2332
|
-
fileFilter?: FileFilter;
|
|
2333
|
-
overrideTools?: Partial<{
|
|
2334
|
-
[K in ClientToolName & PublishedToolName]: (input: ClientToolCall<K>["input"]) => Promise<LevelCodeToolOutput<K>>;
|
|
2335
|
-
} & {
|
|
2336
|
-
read_files: (input: {
|
|
2337
|
-
filePaths: string[];
|
|
2338
|
-
}) => Promise<Record<string, string | null>>;
|
|
2339
|
-
}>;
|
|
2340
|
-
customToolDefinitions?: CustomToolDefinition[];
|
|
2341
|
-
fsSource?: Source<LevelCodeFileSystem>;
|
|
2342
|
-
spawnSource?: Source<LevelCodeSpawn>;
|
|
2343
|
-
logger?: Logger$1;
|
|
2344
|
-
};
|
|
2345
|
-
export type ImageContent = {
|
|
2346
|
-
type: "image";
|
|
2347
|
-
image: string;
|
|
2348
|
-
mediaType: string;
|
|
2349
|
-
};
|
|
2350
|
-
export type TextContent = {
|
|
2351
|
-
type: "text";
|
|
2352
|
-
text: string;
|
|
2353
|
-
};
|
|
2354
|
-
export type MessageContent = TextContent | ImageContent;
|
|
2355
|
-
export type RunOptions = {
|
|
2356
|
-
agent: string | AgentDefinition;
|
|
2357
|
-
prompt: string;
|
|
2358
|
-
/** Content array for multimodal messages (text + images) */
|
|
2359
|
-
content?: MessageContent[];
|
|
2360
|
-
params?: Record<string, any>;
|
|
2361
|
-
previousRun?: RunState;
|
|
2362
|
-
extraToolResults?: ToolMessage[];
|
|
2363
|
-
signal?: AbortSignal;
|
|
2364
|
-
costMode?: string;
|
|
2365
|
-
};
|
|
2366
|
-
type RunExecutionOptions = RunOptions & LevelCodeClientOptions & {
|
|
2367
|
-
apiKey: string;
|
|
2368
|
-
fingerprintId: string;
|
|
2369
|
-
};
|
|
2370
|
-
export declare function run(options: RunExecutionOptions): Promise<RunState>;
|
|
2371
|
-
/**
|
|
2372
|
-
* Combines prompt, params, and content into a unified message content structure.
|
|
2373
|
-
* Always wraps the first text part in <user_message> tags for consistent XML framing.
|
|
2374
|
-
* If you need a specific text part wrapped, put it first or pre-wrap it yourself before calling.
|
|
2375
|
-
*/
|
|
2376
|
-
export declare function buildUserMessageContent(prompt: string | undefined, params: Record<string, any> | undefined, content?: Array<TextPart | ImagePart>): Array<TextPart | ImagePart>;
|
|
2377
|
-
export declare class LevelCodeClient {
|
|
2378
|
-
options: LevelCodeClientOptions & {
|
|
2379
|
-
apiKey: string;
|
|
2380
|
-
fingerprintId: string;
|
|
2381
|
-
};
|
|
2382
|
-
constructor(options: LevelCodeClientOptions);
|
|
2383
|
-
/**
|
|
2384
|
-
* Run a LevelCode agent with the specified options.
|
|
2385
|
-
*
|
|
2386
|
-
* @param agent - The agent to run. Use 'base' for the default agent, or specify a custom agent ID if you made your own agent config.
|
|
2387
|
-
* @param prompt - The user prompt describing what you want the agent to do.
|
|
2388
|
-
* @param params - (Optional) Additional parameters for the agent. Most agents don't use this, but some custom agents can take a JSON object as input in addition to the user prompt string.
|
|
2389
|
-
* @param handleEvent - (Optional) Callback function that receives every event during execution (assistant messages, tool calls, etc.). This allows you to stream the agent's progress in real-time. We will likely add a token-by-token streaming callback in the future.
|
|
2390
|
-
* @param previousRun - (Optional) JSON state returned from a previous run() call. Use this to continue a conversation or session with the agent, maintaining context from previous interactions.
|
|
2391
|
-
* @param projectFiles - (Optional) All the files in your project as a plain JavaScript object. Keys should be the full path from your current directory to each file, and values should be the string contents of the file. Example: { "src/index.ts": "console.log('hi')" }. This helps LevelCode pick good source files for context.
|
|
2392
|
-
* @param knowledgeFiles - (Optional) Knowledge files to inject into every run() call. Uses the same schema as projectFiles - keys are file paths and values are file contents. These files are added directly to the agent's context.
|
|
2393
|
-
* @param agentDefinitions - (Optional) Array of custom agent definitions. Each object should satisfy the AgentDefinition type. You can input the agent's id field into the agent parameter to run that agent.
|
|
2394
|
-
* @param customToolDefinitions - (Optional) Array of custom tool definitions that extend the agent's capabilities. Each tool definition includes a name, Zod schema for input validation, and a handler function. These tools can be called by the agent during execution.
|
|
2395
|
-
* @param maxAgentSteps - (Optional) Maximum number of steps the agent can take before stopping. Use this as a safety measure in case your agent starts going off the rails. A reasonable number is around 20.
|
|
2396
|
-
* @param env - (Optional) Environment variables to pass to terminal commands executed by the agent. These will be merged with the current process environment, with the custom values taking precedence. Can also be provided in individual run() calls to override.
|
|
2397
|
-
*
|
|
2398
|
-
* @returns A Promise that resolves to a RunState JSON object which you can pass to a subsequent run() call to continue the run. Use result.output to get the agent's output.
|
|
2399
|
-
*/
|
|
2400
|
-
run(options: RunOptions & LevelCodeClientOptions): Promise<RunState>;
|
|
2401
|
-
/**
|
|
2402
|
-
* Check connection to the LevelCode backend by hitting the /healthz endpoint.
|
|
2403
|
-
*
|
|
2404
|
-
* @returns Promise that resolves to true if connected, false otherwise
|
|
2405
|
-
*/
|
|
2406
|
-
checkConnection(): Promise<boolean>;
|
|
2407
|
-
}
|
|
2408
|
-
declare const clientEnvSchema: z.ZodObject<{
|
|
2409
|
-
NEXT_PUBLIC_CB_ENVIRONMENT: z.ZodDefault<z.ZodEnum<{
|
|
2410
|
-
dev: "dev";
|
|
2411
|
-
test: "test";
|
|
2412
|
-
prod: "prod";
|
|
2413
|
-
}>>;
|
|
2414
|
-
NEXT_PUBLIC_LEVELCODE_APP_URL: z.ZodDefault<z.ZodString>;
|
|
2415
|
-
NEXT_PUBLIC_SUPPORT_EMAIL: z.ZodDefault<z.ZodString>;
|
|
2416
|
-
NEXT_PUBLIC_POSTHOG_API_KEY: z.ZodDefault<z.ZodString>;
|
|
2417
|
-
NEXT_PUBLIC_POSTHOG_HOST_URL: z.ZodDefault<z.ZodString>;
|
|
2418
|
-
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: z.ZodDefault<z.ZodString>;
|
|
2419
|
-
NEXT_PUBLIC_STRIPE_CUSTOMER_PORTAL: z.ZodDefault<z.ZodString>;
|
|
2420
|
-
NEXT_PUBLIC_GOOGLE_SITE_VERIFICATION_ID: z.ZodOptional<z.ZodString>;
|
|
2421
|
-
NEXT_PUBLIC_WEB_PORT: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
2422
|
-
}, z.core.$strip>;
|
|
2423
|
-
type ClientEnv = z.infer<typeof clientEnvSchema>;
|
|
2424
|
-
type BaseEnv = {
|
|
2425
|
-
SHELL?: string;
|
|
2426
|
-
COMSPEC?: string;
|
|
2427
|
-
HOME?: string;
|
|
2428
|
-
USERPROFILE?: string;
|
|
2429
|
-
APPDATA?: string;
|
|
2430
|
-
XDG_CONFIG_HOME?: string;
|
|
2431
|
-
TERM?: string;
|
|
2432
|
-
TERM_PROGRAM?: string;
|
|
2433
|
-
TERM_BACKGROUND?: string;
|
|
2434
|
-
TERMINAL_EMULATOR?: string;
|
|
2435
|
-
COLORFGBG?: string;
|
|
2436
|
-
NODE_ENV?: string;
|
|
2437
|
-
NODE_PATH?: string;
|
|
2438
|
-
PATH?: string;
|
|
2439
|
-
};
|
|
2440
|
-
type SdkEnv = BaseEnv & {
|
|
2441
|
-
LEVELCODE_RG_PATH?: string;
|
|
2442
|
-
LEVELCODE_WASM_DIR?: string;
|
|
2443
|
-
VERBOSE?: string;
|
|
2444
|
-
OVERRIDE_TARGET?: string;
|
|
2445
|
-
OVERRIDE_PLATFORM?: string;
|
|
2446
|
-
OVERRIDE_ARCH?: string;
|
|
2447
|
-
};
|
|
2448
|
-
/**
|
|
2449
|
-
* Get the path to the bundled ripgrep binary based on the current platform
|
|
2450
|
-
* @param importMetaUrl - import.meta.url from the calling module
|
|
2451
|
-
* @returns Path to the ripgrep binary
|
|
2452
|
-
*/
|
|
2453
|
-
export declare function getBundledRgPath(importMetaUrl?: string, env?: SdkEnv): string;
|
|
2454
|
-
declare function changeFile(params: {
|
|
2455
|
-
parameters: unknown;
|
|
2456
|
-
cwd: string;
|
|
2457
|
-
fs: LevelCodeFileSystem;
|
|
2458
|
-
}): Promise<LevelCodeToolOutput<"str_replace">>;
|
|
2459
|
-
declare function codeSearch({ projectPath, pattern, flags, cwd, maxResults, globalMaxResults, maxOutputStringLength, timeoutSeconds, logger, }: {
|
|
2460
|
-
projectPath: string;
|
|
2461
|
-
pattern: string;
|
|
2462
|
-
flags?: string;
|
|
2463
|
-
cwd?: string;
|
|
2464
|
-
maxResults?: number;
|
|
2465
|
-
globalMaxResults?: number;
|
|
2466
|
-
maxOutputStringLength?: number;
|
|
2467
|
-
timeoutSeconds?: number;
|
|
2468
|
-
logger?: Logger$1;
|
|
2469
|
-
}): Promise<LevelCodeToolOutput<"code_search">>;
|
|
2470
|
-
declare function glob(params: {
|
|
2471
|
-
pattern: string;
|
|
2472
|
-
projectPath: string;
|
|
2473
|
-
cwd?: string;
|
|
2474
|
-
fs: LevelCodeFileSystem;
|
|
2475
|
-
}): Promise<LevelCodeToolOutput<"glob">>;
|
|
2476
|
-
declare function listDirectory(params: {
|
|
2477
|
-
directoryPath: string;
|
|
2478
|
-
projectPath: string;
|
|
2479
|
-
fs: LevelCodeFileSystem;
|
|
2480
|
-
}): Promise<LevelCodeToolOutput<"list_directory">>;
|
|
2481
|
-
declare function runFileChangeHooks({ files, }: {
|
|
2482
|
-
files: string[];
|
|
2483
|
-
}): Promise<LevelCodeToolOutput<"run_file_change_hooks">>;
|
|
2484
|
-
export declare function runTerminalCommand({ command, process_type, cwd, timeout_seconds, env, }: {
|
|
2485
|
-
command: string;
|
|
2486
|
-
process_type: "SYNC" | "BACKGROUND";
|
|
2487
|
-
cwd: string;
|
|
2488
|
-
timeout_seconds: number;
|
|
2489
|
-
env?: NodeJS.ProcessEnv;
|
|
2490
|
-
}): Promise<LevelCodeToolOutput<"run_terminal_command">>;
|
|
2491
|
-
export declare const ToolHelpers: {
|
|
2492
|
-
runTerminalCommand: typeof runTerminalCommand;
|
|
2493
|
-
codeSearch: typeof codeSearch;
|
|
2494
|
-
glob: typeof glob;
|
|
2495
|
-
listDirectory: typeof listDirectory;
|
|
2496
|
-
getFiles: typeof getFiles;
|
|
2497
|
-
runFileChangeHooks: typeof runFileChangeHooks;
|
|
2498
|
-
changeFile: typeof changeFile;
|
|
2499
|
-
};
|
|
2500
|
-
export declare const IS_DEV: boolean;
|
|
2501
|
-
export declare const IS_TEST: boolean;
|
|
2502
|
-
export declare const IS_PROD: boolean;
|
|
2503
|
-
export declare const LEVELCODE_BINARY = "levelcode";
|
|
2504
|
-
export declare const WEBSITE_URL: string;
|
|
2505
|
-
declare const mcpConfigSchema: z.ZodUnion<readonly [
|
|
2506
|
-
z.ZodObject<{
|
|
2507
|
-
type: z.ZodDefault<z.ZodEnum<{
|
|
2508
|
-
http: "http";
|
|
2509
|
-
sse: "sse";
|
|
2510
|
-
}>>;
|
|
2511
|
-
url: z.ZodString;
|
|
2512
|
-
params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
2513
|
-
headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
2514
|
-
}, z.core.$strict>,
|
|
2515
|
-
z.ZodObject<{
|
|
2516
|
-
type: z.ZodDefault<z.ZodLiteral<"stdio">>;
|
|
2517
|
-
command: z.ZodString;
|
|
2518
|
-
args: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2519
|
-
env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
2520
|
-
}, z.core.$strict>
|
|
2521
|
-
]>;
|
|
2522
|
-
type MCPConfig$1 = z.infer<typeof mcpConfigSchema>;
|
|
2523
|
-
declare const models: {
|
|
2524
|
-
readonly ft_filepicker_003: "196166068534771712";
|
|
2525
|
-
readonly ft_filepicker_005: "8493203957034778624";
|
|
2526
|
-
readonly ft_filepicker_007: "2589952415784501248";
|
|
2527
|
-
readonly ft_filepicker_topk_001: "3676445825887633408";
|
|
2528
|
-
readonly ft_filepicker_008: "2672143108984012800";
|
|
2529
|
-
readonly ft_filepicker_topk_002: "1694861989844615168";
|
|
2530
|
-
readonly ft_filepicker_010: "3808739064941641728";
|
|
2531
|
-
readonly ft_filepicker_010_epoch_2: "6231675664466968576";
|
|
2532
|
-
readonly ft_filepicker_topk_003: "1502192368286171136";
|
|
2533
|
-
readonly openrouter_claude_sonnet_4_5: "anthropic/claude-sonnet-4.5";
|
|
2534
|
-
readonly openrouter_claude_sonnet_4: "anthropic/claude-4-sonnet-20250522";
|
|
2535
|
-
readonly openrouter_claude_opus_4: "anthropic/claude-opus-4.1";
|
|
2536
|
-
readonly openrouter_claude_3_5_haiku: "anthropic/claude-3.5-haiku-20241022";
|
|
2537
|
-
readonly openrouter_claude_3_5_sonnet: "anthropic/claude-3.5-sonnet-20240620";
|
|
2538
|
-
readonly openrouter_gpt4o: "openai/gpt-4o-2024-11-20";
|
|
2539
|
-
readonly openrouter_gpt5: "openai/gpt-5.1";
|
|
2540
|
-
readonly openrouter_gpt5_chat: "openai/gpt-5.1-chat";
|
|
2541
|
-
readonly openrouter_gpt4o_mini: "openai/gpt-4o-mini-2024-07-18";
|
|
2542
|
-
readonly openrouter_gpt4_1_nano: "openai/gpt-4.1-nano";
|
|
2543
|
-
readonly openrouter_o3_mini: "openai/o3-mini-2025-01-31";
|
|
2544
|
-
readonly openrouter_gemini2_5_pro_preview: "google/gemini-2.5-pro";
|
|
2545
|
-
readonly openrouter_gemini2_5_flash: "google/gemini-2.5-flash";
|
|
2546
|
-
readonly openrouter_gemini2_5_flash_thinking: "google/gemini-2.5-flash-preview:thinking";
|
|
2547
|
-
readonly openrouter_grok_4: "x-ai/grok-4-07-09";
|
|
2548
|
-
readonly deepseekChat: "deepseek-chat";
|
|
2549
|
-
readonly deepseekReasoner: "deepseek-reasoner";
|
|
2550
|
-
readonly gpt4_1: "gpt-4.1-2025-04-14";
|
|
2551
|
-
readonly gpt4o: "gpt-4o-2024-11-20";
|
|
2552
|
-
readonly gpt4omini: "gpt-4o-mini-2024-07-18";
|
|
2553
|
-
readonly o3mini: "o3-mini-2025-01-31";
|
|
2554
|
-
readonly o3: "o3-2025-04-16";
|
|
2555
|
-
readonly o3pro: "o3-pro-2025-06-10";
|
|
2556
|
-
readonly o4mini: "o4-mini-2025-04-16";
|
|
2557
|
-
readonly generatePatch: "ft:gpt-4o-2024-08-06:manifold-markets:generate-patch-batch2:AKYtDIhk";
|
|
2558
|
-
};
|
|
2559
|
-
type Model = (typeof models)[keyof typeof models] | (string & {});
|
|
2560
|
-
type OpenRouterReasoningOptions = {
|
|
2561
|
-
/**
|
|
2562
|
-
* https://openrouter.ai/docs/use-cases/reasoning-tokens
|
|
2563
|
-
* One of `max_tokens` or `effort` is required.
|
|
2564
|
-
* If `exclude` is true, reasoning will be removed from the response. Default is false.
|
|
2565
|
-
*/
|
|
2566
|
-
enabled?: boolean;
|
|
2567
|
-
exclude?: boolean;
|
|
2568
|
-
} & ({
|
|
2569
|
-
max_tokens: number;
|
|
2570
|
-
} | {
|
|
2571
|
-
effort: "high" | "medium" | "low" | "minimal" | "none";
|
|
2572
|
-
});
|
|
2573
|
-
type OpenRouterProviderRoutingOptions = {
|
|
2574
|
-
/**
|
|
2575
|
-
* List of provider slugs to try in order (e.g. ["anthropic", "openai"])
|
|
2576
|
-
*/
|
|
2577
|
-
order?: string[];
|
|
2578
|
-
/**
|
|
2579
|
-
* Whether to allow backup providers when primary is unavailable (default: true)
|
|
2580
|
-
*/
|
|
2581
|
-
allow_fallbacks?: boolean;
|
|
2582
|
-
/**
|
|
2583
|
-
* Only use providers that support all parameters in your request (default: false)
|
|
2584
|
-
*/
|
|
2585
|
-
require_parameters?: boolean;
|
|
2586
|
-
/**
|
|
2587
|
-
* Control whether to use providers that may store data
|
|
2588
|
-
*/
|
|
2589
|
-
data_collection?: "allow" | "deny";
|
|
2590
|
-
/**
|
|
2591
|
-
* List of provider slugs to allow for this request
|
|
2592
|
-
*/
|
|
2593
|
-
only?: string[];
|
|
2594
|
-
/**
|
|
2595
|
-
* List of provider slugs to skip for this request
|
|
2596
|
-
*/
|
|
2597
|
-
ignore?: string[];
|
|
2598
|
-
/**
|
|
2599
|
-
* List of quantization levels to filter by (e.g. ["int4", "int8"])
|
|
2600
|
-
*/
|
|
2601
|
-
quantizations?: Array<"int4" | "int8" | "fp4" | "fp6" | "fp8" | "fp16" | "bf16" | "fp32" | "unknown">;
|
|
2602
|
-
/**
|
|
2603
|
-
* Sort providers by price, throughput, or latency
|
|
2604
|
-
*/
|
|
2605
|
-
sort?: "price" | "throughput" | "latency";
|
|
2606
|
-
/**
|
|
2607
|
-
* Maximum pricing you want to pay for this request
|
|
2608
|
-
*/
|
|
2609
|
-
max_price?: {
|
|
2610
|
-
prompt?: number | string;
|
|
2611
|
-
completion?: number | string;
|
|
2612
|
-
image?: number | string;
|
|
2613
|
-
audio?: number | string;
|
|
2614
|
-
request?: number | string;
|
|
2615
|
-
};
|
|
2616
|
-
};
|
|
2617
|
-
type AgentTemplate<P = string | undefined, T = Record<string, any> | undefined> = {
|
|
2618
|
-
id: AgentTemplateType;
|
|
2619
|
-
displayName: string;
|
|
2620
|
-
model: Model;
|
|
2621
|
-
reasoningOptions?: OpenRouterReasoningOptions;
|
|
2622
|
-
providerOptions?: OpenRouterProviderRoutingOptions;
|
|
2623
|
-
mcpServers: Record<string, MCPConfig$1>;
|
|
2624
|
-
toolNames: (ToolName | (string & {}))[];
|
|
2625
|
-
spawnableAgents: AgentTemplateType[];
|
|
2626
|
-
spawnerPrompt?: string;
|
|
2627
|
-
systemPrompt: string;
|
|
2628
|
-
instructionsPrompt: string;
|
|
2629
|
-
stepPrompt: string;
|
|
2630
|
-
parentInstructions?: Record<string, string>;
|
|
2631
|
-
inputSchema: {
|
|
2632
|
-
prompt?: z.ZodSchema<P>;
|
|
2633
|
-
params?: z.ZodSchema<T>;
|
|
2634
|
-
};
|
|
2635
|
-
includeMessageHistory: boolean;
|
|
2636
|
-
inheritParentSystemPrompt: boolean;
|
|
2637
|
-
outputMode: "last_message" | "all_messages" | "structured_output";
|
|
2638
|
-
outputSchema?: z.ZodSchema<any>;
|
|
2639
|
-
handleSteps?: StepHandler<P, T> | string;
|
|
2640
|
-
};
|
|
2641
|
-
type StepText$1 = {
|
|
2642
|
-
type: "STEP_TEXT";
|
|
2643
|
-
text: string;
|
|
2644
|
-
};
|
|
2645
|
-
type GenerateN$1 = {
|
|
2646
|
-
type: "GENERATE_N";
|
|
2647
|
-
n: number;
|
|
2648
|
-
};
|
|
2649
|
-
type StepGenerator = Generator<Omit<ToolCall, "toolCallId"> | "STEP" | "STEP_ALL" | StepText$1 | GenerateN$1, // Generic tool call type
|
|
2650
|
-
void, {
|
|
2651
|
-
agentState: AgentState;
|
|
2652
|
-
toolResult: ToolResultOutput[];
|
|
2653
|
-
stepsComplete: boolean;
|
|
2654
|
-
nResponses?: string[];
|
|
2655
|
-
}>;
|
|
2656
|
-
type StepHandler<P = string | undefined, T = Record<string, any> | undefined> = (context: {
|
|
2657
|
-
agentState: AgentState$1;
|
|
2658
|
-
prompt: P;
|
|
2659
|
-
params: T;
|
|
2660
|
-
logger: Logger;
|
|
2661
|
-
}) => StepGenerator;
|
|
2662
|
-
type User = {
|
|
2663
|
-
id: string;
|
|
2664
|
-
email: string;
|
|
2665
|
-
discord_id: string | null;
|
|
2666
|
-
referral_code: string | null;
|
|
2667
|
-
stripe_customer_id: string | null;
|
|
2668
|
-
banned: boolean;
|
|
2669
|
-
};
|
|
2670
|
-
type UserColumn = keyof User;
|
|
2671
|
-
type GetUserInfoFromApiKeyInput<T extends UserColumn> = {
|
|
2672
|
-
apiKey: string;
|
|
2673
|
-
fields: readonly T[];
|
|
2674
|
-
logger: Logger$1;
|
|
2675
|
-
};
|
|
2676
|
-
type GetUserInfoFromApiKeyOutput<T extends UserColumn> = Promise<{
|
|
2677
|
-
[K in T]: User[K];
|
|
2678
|
-
} | null>;
|
|
2679
|
-
type Prettify<T> = {
|
|
2680
|
-
[K in keyof T]: T[K];
|
|
2681
|
-
} & {};
|
|
2682
|
-
type StripExact<T> = T extends infer U & {
|
|
2683
|
-
[x: string]: never;
|
|
2684
|
-
} ? U : T;
|
|
2685
|
-
type ParamsOfFunction<T> = T extends (params: infer C) => any ? StripExact<C> : never;
|
|
2686
|
-
type IsUnion<T, U = T> = T extends any ? ([
|
|
2687
|
-
U
|
|
2688
|
-
] extends [
|
|
2689
|
-
T
|
|
2690
|
-
] ? false : true) : false;
|
|
2691
|
-
type ParamsOfArray<T> = UnionToIntersection<T extends [
|
|
2692
|
-
infer fn,
|
|
2693
|
-
...infer rest
|
|
2694
|
-
] ? ParamsOfFunction<fn> | ParamsOfArray<rest> : {}>;
|
|
2695
|
-
type ParamsOfUnion<T> = IsUnion<T> extends true ? UnionToIntersection<ParamsOfFunction<T>> : ParamsOfFunction<T>;
|
|
2696
|
-
type ParamsOf<T> = Prettify<T extends any[] ? ParamsOfArray<T> : ParamsOfUnion<T>>;
|
|
2697
|
-
type ParamsExcluding<T, K extends keyof ParamsOf<T>> = Prettify<Omit<ParamsOf<T>, K>>;
|
|
2698
|
-
export declare function getUserInfoFromApiKey<T extends UserColumn>(params: GetUserInfoFromApiKeyInput<T>): GetUserInfoFromApiKeyOutput<T>;
|
|
2699
|
-
export declare const getOpenRouterApiKeyFromEnv: () => string | undefined;
|
|
2700
|
-
/**
|
|
2701
|
-
* Standalone mode: bypass all backend dependencies, route LLM calls directly.
|
|
2702
|
-
* Default mode when no backend URL (NEXT_PUBLIC_LEVELCODE_APP_URL) is configured.
|
|
2703
|
-
* Also activates when a direct provider key (OPENROUTER_API_KEY or ANTHROPIC_API_KEY)
|
|
2704
|
-
* is set AND LEVELCODE_API_KEY is NOT set.
|
|
2705
|
-
*/
|
|
2706
|
-
export declare const isStandaloneMode: () => boolean;
|
|
2707
|
-
declare const userSchema: z.ZodObject<{
|
|
2708
|
-
id: z.ZodString;
|
|
2709
|
-
email: z.ZodString;
|
|
2710
|
-
name: z.ZodNullable<z.ZodString>;
|
|
2711
|
-
authToken: z.ZodString;
|
|
2712
|
-
fingerprintId: z.ZodString;
|
|
2713
|
-
fingerprintHash: z.ZodString;
|
|
2714
|
-
}, z.core.$strip>;
|
|
2715
|
-
type User$1 = z.infer<typeof userSchema>;
|
|
2716
|
-
export declare const userFromJson: (json: string) => User$1 | null;
|
|
2717
|
-
/**
|
|
2718
|
-
* Get the config directory path based on the environment.
|
|
2719
|
-
* Uses the clientEnv to determine the environment suffix.
|
|
2720
|
-
*/
|
|
2721
|
-
export declare const getConfigDir: (clientEnv?: ClientEnv) => string;
|
|
2722
|
-
/**
|
|
2723
|
-
* Get the credentials file path based on the environment.
|
|
2724
|
-
*/
|
|
2725
|
-
export declare const getCredentialsPath: (clientEnv?: ClientEnv) => string;
|
|
2726
|
-
export declare const getUserCredentials: (clientEnv?: ClientEnv) => User$1 | null;
|
|
2727
|
-
/**
|
|
2728
|
-
* Claude OAuth credentials stored in the credentials file.
|
|
2729
|
-
*/
|
|
2730
|
-
export interface ClaudeOAuthCredentials {
|
|
2731
|
-
accessToken: string;
|
|
2732
|
-
refreshToken: string;
|
|
2733
|
-
expiresAt: number;
|
|
2734
|
-
connectedAt: number;
|
|
2735
|
-
}
|
|
2736
|
-
/**
|
|
2737
|
-
* Get Claude OAuth credentials from file or environment variable.
|
|
2738
|
-
* Environment variable takes precedence.
|
|
2739
|
-
* @returns OAuth credentials or null if not found
|
|
2740
|
-
*/
|
|
2741
|
-
export declare const getClaudeOAuthCredentials: (clientEnv?: ClientEnv) => ClaudeOAuthCredentials | null;
|
|
2742
|
-
/**
|
|
2743
|
-
* Save Claude OAuth credentials to the credentials file.
|
|
2744
|
-
* Preserves existing user credentials.
|
|
2745
|
-
*/
|
|
2746
|
-
export declare const saveClaudeOAuthCredentials: (credentials: ClaudeOAuthCredentials, clientEnv?: ClientEnv) => void;
|
|
2747
|
-
/**
|
|
2748
|
-
* Clear Claude OAuth credentials from the credentials file.
|
|
2749
|
-
* Preserves other credentials.
|
|
2750
|
-
*/
|
|
2751
|
-
export declare const clearClaudeOAuthCredentials: (clientEnv?: ClientEnv) => void;
|
|
2752
|
-
/**
|
|
2753
|
-
* Check if Claude OAuth credentials are valid (not expired).
|
|
2754
|
-
* Returns true if credentials exist and haven't expired.
|
|
2755
|
-
*/
|
|
2756
|
-
export declare const isClaudeOAuthValid: (clientEnv?: ClientEnv) => boolean;
|
|
2757
|
-
/**
|
|
2758
|
-
* Refresh the Claude OAuth access token using the refresh token.
|
|
2759
|
-
* Returns the new credentials if successful, null if refresh fails.
|
|
2760
|
-
* Uses a mutex to prevent concurrent refresh attempts.
|
|
2761
|
-
*/
|
|
2762
|
-
export declare const refreshClaudeOAuthToken: (clientEnv?: ClientEnv) => Promise<ClaudeOAuthCredentials | null>;
|
|
2763
|
-
/**
|
|
2764
|
-
* Get valid Claude OAuth credentials, refreshing if necessary.
|
|
2765
|
-
* This is the main function to use when you need credentials for an API call.
|
|
2766
|
-
*
|
|
2767
|
-
* - Returns credentials immediately if valid (>5 min until expiry)
|
|
2768
|
-
* - Attempts refresh if token is expired or near-expiry
|
|
2769
|
-
* - Returns null if no credentials or refresh fails
|
|
2770
|
-
*/
|
|
2771
|
-
export declare const getValidClaudeOAuthCredentials: (clientEnv?: ClientEnv) => Promise<ClaudeOAuthCredentials | null>;
|
|
2772
|
-
/**
|
|
2773
|
-
* Agent definition with source file path metadata.
|
|
2774
|
-
*/
|
|
2775
|
-
export type LoadedAgentDefinition = AgentDefinition & {
|
|
2776
|
-
/** The file path this agent was loaded from */
|
|
2777
|
-
_sourceFilePath: string;
|
|
2778
|
-
};
|
|
2779
|
-
/**
|
|
2780
|
-
* Loaded agent definitions keyed by agent ID.
|
|
2781
|
-
*/
|
|
2782
|
-
export type LoadedAgents = Record<string, LoadedAgentDefinition>;
|
|
2783
|
-
/**
|
|
2784
|
-
* Validation error for an agent that failed validation.
|
|
2785
|
-
*/
|
|
2786
|
-
export type AgentValidationError = {
|
|
2787
|
-
/** The agent's ID */
|
|
2788
|
-
agentId: string;
|
|
2789
|
-
/** The source file path where the agent was loaded from */
|
|
2790
|
-
filePath: string;
|
|
2791
|
-
/** The validation error message */
|
|
2792
|
-
message: string;
|
|
2793
|
-
};
|
|
2794
|
-
/**
|
|
2795
|
-
* Result returned by loadLocalAgents when validate: true.
|
|
2796
|
-
* Contains both the valid agents and any validation errors.
|
|
2797
|
-
*/
|
|
2798
|
-
export type LoadLocalAgentsResult = {
|
|
2799
|
-
/** Valid agent definitions that passed validation */
|
|
2800
|
-
agents: LoadedAgents;
|
|
2801
|
-
/** Validation errors for agents that failed validation */
|
|
2802
|
-
validationErrors: AgentValidationError[];
|
|
2803
|
-
};
|
|
2804
|
-
/**
|
|
2805
|
-
* Load agent definitions from `.agents` directories.
|
|
2806
|
-
*
|
|
2807
|
-
* By default, searches for agents in:
|
|
2808
|
-
* - `{cwd}/.agents`
|
|
2809
|
-
* - `{cwd}/../.agents`
|
|
2810
|
-
* - `{homedir}/.agents`
|
|
2811
|
-
*
|
|
2812
|
-
* Agent files can be `.ts`, `.tsx`, `.js`, `.mjs`, or `.cjs`.
|
|
2813
|
-
* TypeScript files are loaded natively by Bun's runtime.
|
|
2814
|
-
*
|
|
2815
|
-
* @param options.agentsPath - Optional path to a specific agents directory
|
|
2816
|
-
* @param options.verbose - Whether to log errors during loading
|
|
2817
|
-
* @param options.validate - Whether to validate agents after loading
|
|
2818
|
-
* @returns When validate is false/omitted: Record of agent definitions keyed by agent ID.
|
|
2819
|
-
* When validate is true: Object with valid agents and validation errors.
|
|
2820
|
-
*
|
|
2821
|
-
* @example
|
|
2822
|
-
* ```typescript
|
|
2823
|
-
* // Load from default locations
|
|
2824
|
-
* const agents = await loadLocalAgents({ verbose: true })
|
|
2825
|
-
*
|
|
2826
|
-
* // Load from a specific directory
|
|
2827
|
-
* const agents = await loadLocalAgents({ agentsPath: './my-agents' })
|
|
2828
|
-
*
|
|
2829
|
-
* // Load and validate agents - returns both valid agents and errors
|
|
2830
|
-
* const { agents, validationErrors } = await loadLocalAgents({ validate: true })
|
|
2831
|
-
* if (validationErrors.length > 0) {
|
|
2832
|
-
* console.error('Some agents failed validation:', validationErrors)
|
|
2833
|
-
* }
|
|
2834
|
-
*
|
|
2835
|
-
* // Access source file path for debugging
|
|
2836
|
-
* for (const agent of Object.values(agents)) {
|
|
2837
|
-
* console.log(`${agent.id} loaded from ${agent._sourceFilePath}`)
|
|
2838
|
-
* }
|
|
2839
|
-
*
|
|
2840
|
-
* // Use with client.run()
|
|
2841
|
-
* const result = await client.run({
|
|
2842
|
-
* agent: 'my-agent',
|
|
2843
|
-
* agentDefinitions: Object.values(agents),
|
|
2844
|
-
* prompt: 'Hello',
|
|
2845
|
-
* })
|
|
2846
|
-
* ```
|
|
2847
|
-
*/
|
|
2848
|
-
export declare function loadLocalAgents(options: {
|
|
2849
|
-
agentsPath?: string;
|
|
2850
|
-
verbose?: boolean;
|
|
2851
|
-
validate: true;
|
|
2852
|
-
}): Promise<LoadLocalAgentsResult>;
|
|
2853
|
-
export declare function loadLocalAgents(options: {
|
|
2854
|
-
agentsPath?: string;
|
|
2855
|
-
verbose?: boolean;
|
|
2856
|
-
validate?: false;
|
|
2857
|
-
}): Promise<LoadedAgents>;
|
|
2858
|
-
declare const mcpFileSchema: z.ZodObject<{
|
|
2859
|
-
mcpServers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [
|
|
2860
|
-
z.ZodObject<{
|
|
2861
|
-
type: z.ZodDefault<z.ZodEnum<{
|
|
2862
|
-
http: "http";
|
|
2863
|
-
sse: "sse";
|
|
2864
|
-
}>>;
|
|
2865
|
-
url: z.ZodString;
|
|
2866
|
-
params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
2867
|
-
headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
2868
|
-
}, z.core.$strict>,
|
|
2869
|
-
z.ZodObject<{
|
|
2870
|
-
type: z.ZodDefault<z.ZodLiteral<"stdio">>;
|
|
2871
|
-
command: z.ZodString;
|
|
2872
|
-
args: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2873
|
-
env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
2874
|
-
}, z.core.$strict>
|
|
2875
|
-
]>>>;
|
|
2876
|
-
}, z.core.$strip>;
|
|
2877
|
-
export type MCPFileConfig = z.infer<typeof mcpFileSchema>;
|
|
2878
|
-
/**
|
|
2879
|
-
* Loaded MCP configuration with resolved environment variables.
|
|
2880
|
-
*/
|
|
2881
|
-
export type LoadedMCPConfig = {
|
|
2882
|
-
mcpServers: Record<string, MCPConfig$1>;
|
|
2883
|
-
/** The file path this config was loaded from */
|
|
2884
|
-
_sourceFilePath: string;
|
|
2885
|
-
};
|
|
2886
|
-
/**
|
|
2887
|
-
* Load MCP configuration from `mcp.json` files in `.agents` directories.
|
|
2888
|
-
*
|
|
2889
|
-
* By default, searches for mcp.json in:
|
|
2890
|
-
* - `{cwd}/.agents/mcp.json`
|
|
2891
|
-
* - `{cwd}/../.agents/mcp.json`
|
|
2892
|
-
* - `{homedir}/.agents/mcp.json`
|
|
2893
|
-
*
|
|
2894
|
-
* Later directories take precedence, so project MCP servers override global ones.
|
|
2895
|
-
* Environment variable references (e.g., `$API_KEY`) are resolved from process.env.
|
|
2896
|
-
*
|
|
2897
|
-
* @param options.verbose - Whether to log errors during loading
|
|
2898
|
-
* @returns Record of MCP server configurations keyed by server name
|
|
2899
|
-
*
|
|
2900
|
-
* @example
|
|
2901
|
-
* ```typescript
|
|
2902
|
-
* // Load from default locations
|
|
2903
|
-
* const mcpConfig = await loadMCPConfig({ verbose: true })
|
|
2904
|
-
*
|
|
2905
|
-
* // Access MCP servers
|
|
2906
|
-
* for (const [serverName, config] of Object.entries(mcpConfig.mcpServers)) {
|
|
2907
|
-
* console.log(`MCP server: ${serverName}`)
|
|
2908
|
-
* }
|
|
2909
|
-
* ```
|
|
2910
|
-
*/
|
|
2911
|
-
export declare function loadMCPConfig(options: {
|
|
2912
|
-
verbose?: boolean;
|
|
2913
|
-
}): Promise<LoadedMCPConfig>;
|
|
2914
|
-
/**
|
|
2915
|
-
* Synchronously load MCP configuration from `mcp.json` files in `.agents` directories.
|
|
2916
|
-
* This is a sync version for use in contexts where async is not available.
|
|
2917
|
-
*
|
|
2918
|
-
* @param options.verbose - Whether to log errors during loading
|
|
2919
|
-
* @returns Record of MCP server configurations keyed by server name
|
|
2920
|
-
*/
|
|
2921
|
-
export declare function loadMCPConfigSync(options: {
|
|
2922
|
-
verbose?: boolean;
|
|
2923
|
-
}): LoadedMCPConfig;
|
|
2924
|
-
/**
|
|
2925
|
-
* Formats available skills as XML for inclusion in tool descriptions.
|
|
2926
|
-
*/
|
|
2927
|
-
export declare function formatAvailableSkillsXml(skills: SkillsMap): string;
|
|
2928
|
-
export type LoadSkillsOptions = {
|
|
2929
|
-
/** Working directory for project skills. Defaults to process.cwd() */
|
|
2930
|
-
cwd?: string;
|
|
2931
|
-
/** Optional specific skills directory path */
|
|
2932
|
-
skillsPath?: string;
|
|
2933
|
-
/** Whether to log errors during loading */
|
|
2934
|
-
verbose?: boolean;
|
|
2935
|
-
};
|
|
2936
|
-
/**
|
|
2937
|
-
* Load skills from .agents/skills and .claude/skills directories.
|
|
2938
|
-
*
|
|
2939
|
-
* By default, searches for skills in (later overrides earlier):
|
|
2940
|
-
* - `~/.claude/skills/` (global, Claude Code compatible)
|
|
2941
|
-
* - `~/.agents/skills/` (global)
|
|
2942
|
-
* - `{cwd}/.claude/skills/` (project, Claude Code compatible)
|
|
2943
|
-
* - `{cwd}/.agents/skills/` (project, highest priority)
|
|
2944
|
-
*
|
|
2945
|
-
* Each skill must be in its own directory with a SKILL.md file:
|
|
2946
|
-
* - `.agents/skills/my-skill/SKILL.md`
|
|
2947
|
-
* - `.claude/skills/my-skill/SKILL.md`
|
|
2948
|
-
*
|
|
2949
|
-
* @param options.cwd - Working directory for project skills
|
|
2950
|
-
* @param options.skillsPath - Optional path to a specific skills directory
|
|
2951
|
-
* @param options.verbose - Whether to log errors during loading
|
|
2952
|
-
* @returns Record of skill definitions keyed by skill name
|
|
2953
|
-
*
|
|
2954
|
-
* @example
|
|
2955
|
-
* ```typescript
|
|
2956
|
-
* // Load from default locations
|
|
2957
|
-
* const skills = await loadSkills({ verbose: true })
|
|
2958
|
-
*
|
|
2959
|
-
* // Load from a specific directory
|
|
2960
|
-
* const skills = await loadSkills({ skillsPath: './my-skills' })
|
|
2961
|
-
*
|
|
2962
|
-
* // Access a skill
|
|
2963
|
-
* const gitReleaseSkill = skills['git-release']
|
|
2964
|
-
* console.log(gitReleaseSkill.description)
|
|
2965
|
-
* ```
|
|
2966
|
-
*/
|
|
2967
|
-
export declare function loadSkills(options?: LoadSkillsOptions): Promise<SkillsMap>;
|
|
2968
|
-
export interface ValidationResult {
|
|
2969
|
-
success: boolean;
|
|
2970
|
-
validationErrors: Array<{
|
|
2971
|
-
id: string;
|
|
2972
|
-
message: string;
|
|
2973
|
-
}>;
|
|
2974
|
-
errorCount: number;
|
|
2975
|
-
}
|
|
2976
|
-
export interface ValidateAgentsOptions {
|
|
2977
|
-
/**
|
|
2978
|
-
* Whether to perform remote validation via the web API.
|
|
2979
|
-
* Remote validation checks spawnable agents against the database.
|
|
2980
|
-
*/
|
|
2981
|
-
remote?: boolean;
|
|
2982
|
-
/**
|
|
2983
|
-
* The base URL of the LevelCode website API.
|
|
2984
|
-
* Optional - defaults to NEXT_PUBLIC_LEVELCODE_APP_URL or environment-based URL.
|
|
2985
|
-
* Example: 'https://levelcode.vercel.app'
|
|
2986
|
-
*/
|
|
2987
|
-
websiteUrl?: string;
|
|
2988
|
-
}
|
|
2989
|
-
/**
|
|
2990
|
-
* Validates an array of agent definitions.
|
|
2991
|
-
*
|
|
2992
|
-
* By default, performs local Zod schema validation.
|
|
2993
|
-
* When `options.remote` is true, additionally validates spawnable agents via the web API.
|
|
2994
|
-
*
|
|
2995
|
-
* @param definitions - Array of agent definitions to validate
|
|
2996
|
-
* @param options - Optional configuration for validation
|
|
2997
|
-
* @returns Promise<ValidationResult> - Validation results with any errors
|
|
2998
|
-
*
|
|
2999
|
-
* @example
|
|
3000
|
-
* ```typescript
|
|
3001
|
-
* // Local validation only
|
|
3002
|
-
* const result = await validateAgents(definitions)
|
|
3003
|
-
*
|
|
3004
|
-
* // Remote validation
|
|
3005
|
-
* const result = await validateAgents(definitions, {
|
|
3006
|
-
* remote: true,
|
|
3007
|
-
* websiteUrl: 'https://levelcode.vercel.app'
|
|
3008
|
-
* })
|
|
3009
|
-
* ```
|
|
3010
|
-
*/
|
|
3011
|
-
export declare function validateAgents(definitions: AgentDefinition[], options?: ValidateAgentsOptions): Promise<ValidationResult>;
|
|
3012
|
-
/**
|
|
3013
|
-
* SDK Error Utilities
|
|
3014
|
-
*
|
|
3015
|
-
* Simple utilities for error handling based on HTTP status codes.
|
|
3016
|
-
* Uses the AI SDK's error types which include statusCode property.
|
|
3017
|
-
*/
|
|
3018
|
-
/**
|
|
3019
|
-
* Error type with statusCode property
|
|
3020
|
-
*/
|
|
3021
|
-
export type HttpError = Error & {
|
|
3022
|
-
statusCode: number;
|
|
3023
|
-
};
|
|
3024
|
-
/**
|
|
3025
|
-
* HTTP status codes that should trigger automatic retry
|
|
3026
|
-
*/
|
|
3027
|
-
export declare const RETRYABLE_STATUS_CODES: Set<number>;
|
|
3028
|
-
/**
|
|
3029
|
-
* Creates an Error with a statusCode property
|
|
3030
|
-
*/
|
|
3031
|
-
export declare function createHttpError(message: string, statusCode: number): HttpError;
|
|
3032
|
-
/**
|
|
3033
|
-
* Creates an authentication error (401)
|
|
3034
|
-
*/
|
|
3035
|
-
export declare function createAuthError(message?: string): HttpError;
|
|
3036
|
-
/**
|
|
3037
|
-
* Creates a forbidden error (403)
|
|
3038
|
-
*/
|
|
3039
|
-
export declare function createForbiddenError(message?: string): HttpError;
|
|
3040
|
-
/**
|
|
3041
|
-
* Creates a payment required error (402)
|
|
3042
|
-
*/
|
|
3043
|
-
export declare function createPaymentRequiredError(message?: string): HttpError;
|
|
3044
|
-
/**
|
|
3045
|
-
* Creates a server error (500 by default, or custom 5xx)
|
|
3046
|
-
*/
|
|
3047
|
-
export declare function createServerError(message?: string, statusCode?: number): HttpError;
|
|
3048
|
-
/**
|
|
3049
|
-
* Creates a network error (503 - service unavailable)
|
|
3050
|
-
* Used for connection failures, DNS errors, timeouts, etc.
|
|
3051
|
-
*/
|
|
3052
|
-
export declare function createNetworkError(message?: string): HttpError;
|
|
3053
|
-
/**
|
|
3054
|
-
* Checks if an HTTP status code is retryable
|
|
3055
|
-
*/
|
|
3056
|
-
export declare function isRetryableStatusCode(statusCode: number | undefined): boolean;
|
|
3057
|
-
/**
|
|
3058
|
-
* Extracts the statusCode from an error if available.
|
|
3059
|
-
* Checks both 'statusCode' (our convention) and 'status' (AI SDK's APICallError convention).
|
|
3060
|
-
*/
|
|
3061
|
-
export declare function getErrorStatusCode(error: unknown): number | undefined;
|
|
3062
|
-
/**
|
|
3063
|
-
* Sanitizes error messages for display
|
|
3064
|
-
* Removes sensitive information and formats for user consumption
|
|
3065
|
-
*/
|
|
3066
|
-
export declare function sanitizeErrorMessage(error: unknown): string;
|
|
3067
|
-
/**
|
|
3068
|
-
* Retry Configuration Constants
|
|
3069
|
-
*
|
|
3070
|
-
* This module defines constants for retry behavior and exponential backoff.
|
|
3071
|
-
* Used by the CLI to automatically retry failed messages after reconnection.
|
|
3072
|
-
*
|
|
3073
|
-
* @example
|
|
3074
|
-
* ```typescript
|
|
3075
|
-
* import { MAX_RETRIES_PER_MESSAGE, RETRY_BACKOFF_BASE_DELAY_MS } from '@levelcode/sdk'
|
|
3076
|
-
*
|
|
3077
|
-
* let retryCount = 0
|
|
3078
|
-
* let backoffDelay = RETRY_BACKOFF_BASE_DELAY_MS
|
|
3079
|
-
*
|
|
3080
|
-
* while (retryCount < MAX_RETRIES_PER_MESSAGE) {
|
|
3081
|
-
* await new Promise(resolve => setTimeout(resolve, backoffDelay))
|
|
3082
|
-
* // ... retry logic
|
|
3083
|
-
* backoffDelay = Math.min(backoffDelay * 2, RETRY_BACKOFF_MAX_DELAY_MS)
|
|
3084
|
-
* retryCount++
|
|
3085
|
-
* }
|
|
3086
|
-
* ```
|
|
3087
|
-
*/
|
|
3088
|
-
/**
|
|
3089
|
-
* Maximum number of retry attempts per message
|
|
3090
|
-
* After this many attempts, the message is marked as permanently failed
|
|
3091
|
-
*/
|
|
3092
|
-
export declare const MAX_RETRIES_PER_MESSAGE = 3;
|
|
3093
|
-
/**
|
|
3094
|
-
* Base delay in milliseconds for exponential backoff
|
|
3095
|
-
* First retry: 1s, Second: 2s, Third: 4s, Fourth: 8s (capped)
|
|
3096
|
-
*/
|
|
3097
|
-
export declare const RETRY_BACKOFF_BASE_DELAY_MS = 1000;
|
|
3098
|
-
/**
|
|
3099
|
-
* Maximum delay in milliseconds for exponential backoff
|
|
3100
|
-
* Prevents backoff from growing indefinitely
|
|
3101
|
-
*/
|
|
3102
|
-
export declare const RETRY_BACKOFF_MAX_DELAY_MS = 8000;
|
|
3103
|
-
/**
|
|
3104
|
-
* Duration in milliseconds to show the reconnection message
|
|
3105
|
-
* After this time, the message auto-hides
|
|
3106
|
-
*/
|
|
3107
|
-
export declare const RECONNECTION_MESSAGE_DURATION_MS = 2000;
|
|
3108
|
-
/**
|
|
3109
|
-
* Delay in milliseconds before retrying messages after reconnection
|
|
3110
|
-
* Gives the connection time to stabilize before attempting retries
|
|
3111
|
-
*/
|
|
3112
|
-
export declare const RECONNECTION_RETRY_DELAY_MS = 500;
|
|
3113
|
-
/**
|
|
3114
|
-
* Set a custom WASM directory for loading tree-sitter WASM files.
|
|
3115
|
-
* This can be useful for custom packaging or deployment scenarios.
|
|
3116
|
-
*/
|
|
3117
|
-
export declare function setWasmDir(dir: string): void;
|
|
3118
|
-
export interface TokenCallerMap {
|
|
3119
|
-
[filePath: string]: {
|
|
3120
|
-
[token: string]: string[];
|
|
3121
|
-
};
|
|
3122
|
-
}
|
|
3123
|
-
export interface FileTokenData {
|
|
3124
|
-
tokenScores: {
|
|
3125
|
-
[filePath: string]: {
|
|
3126
|
-
[token: string]: number;
|
|
3127
|
-
};
|
|
3128
|
-
};
|
|
3129
|
-
tokenCallers: TokenCallerMap;
|
|
3130
|
-
}
|
|
3131
|
-
export declare function getFileTokenScores(projectRoot: string, filePaths: string[], readFile?: (filePath: string) => string | null): Promise<FileTokenData>;
|
|
3132
|
-
declare enum AnalyticsEvent {
|
|
3133
|
-
APP_LAUNCHED = "cli.app_launched",
|
|
3134
|
-
FINGERPRINT_GENERATED = "cli.fingerprint_generated",
|
|
3135
|
-
CHANGE_DIRECTORY = "cli.change_directory",
|
|
3136
|
-
INVALID_COMMAND = "cli.invalid_command",
|
|
3137
|
-
KNOWLEDGE_FILE_UPDATED = "cli.knowledge_file_updated",
|
|
3138
|
-
LOGIN = "cli.login",
|
|
3139
|
-
SLASH_MENU_ACTIVATED = "cli.slash_menu_activated",
|
|
3140
|
-
SLASH_COMMAND_USED = "cli.slash_command_used",
|
|
3141
|
-
TERMINAL_COMMAND_COMPLETED = "cli.terminal_command_completed",
|
|
3142
|
-
USER_INPUT_COMPLETE = "cli.user_input_complete",
|
|
3143
|
-
UPDATE_LEVELCODE_FAILED = "cli.update_levelcode_failed",
|
|
3144
|
-
FEEDBACK_SUBMITTED = "cli.feedback_submitted",
|
|
3145
|
-
FEEDBACK_BUTTON_HOVERED = "cli.feedback_button_hovered",
|
|
3146
|
-
FOLLOWUP_CLICKED = "cli.followup_clicked",
|
|
3147
|
-
AGENT_STEP = "backend.agent_step",
|
|
3148
|
-
CREDIT_GRANT = "backend.credit_grant",
|
|
3149
|
-
CREDIT_CONSUMED = "backend.credit_consumed",
|
|
3150
|
-
MALFORMED_TOOL_CALL_JSON = "backend.malformed_tool_call_json",
|
|
3151
|
-
TOOL_USE = "backend.tool_use",
|
|
3152
|
-
UNKNOWN_TOOL_CALL = "backend.unknown_tool_call",
|
|
3153
|
-
USER_INPUT = "backend.user_input",
|
|
3154
|
-
ADVISORY_LOCK_CONTENTION = "backend.advisory_lock_contention",
|
|
3155
|
-
TRANSACTION_RETRY_THRESHOLD_EXCEEDED = "backend.transaction_retry_threshold_exceeded",
|
|
3156
|
-
SUBSCRIPTION_CREATED = "backend.subscription_created",
|
|
3157
|
-
SUBSCRIPTION_CANCELED = "backend.subscription_canceled",
|
|
3158
|
-
SUBSCRIPTION_PAYMENT_FAILED = "backend.subscription_payment_failed",
|
|
3159
|
-
SUBSCRIPTION_BLOCK_CREATED = "backend.subscription_block_created",
|
|
3160
|
-
SUBSCRIPTION_BLOCK_LIMIT_HIT = "backend.subscription_block_limit_hit",
|
|
3161
|
-
SUBSCRIPTION_WEEKLY_LIMIT_HIT = "backend.subscription_weekly_limit_hit",
|
|
3162
|
-
SUBSCRIPTION_CREDITS_MIGRATED = "backend.subscription_credits_migrated",
|
|
3163
|
-
SUBSCRIPTION_TIER_CHANGED = "backend.subscription_tier_changed",
|
|
3164
|
-
SIGNUP = "web.signup",
|
|
3165
|
-
AUTH_LOGIN_STARTED = "auth.login_started",
|
|
3166
|
-
AUTH_REFERRAL_GITHUB_LOGIN_STARTED = "auth.referral_github_login_started",
|
|
3167
|
-
AUTH_LOGOUT_COMPLETED = "auth.logout_completed",
|
|
3168
|
-
COOKIE_CONSENT_ACCEPTED = "cookie_consent.accepted",
|
|
3169
|
-
COOKIE_CONSENT_DECLINED = "cookie_consent.declined",
|
|
3170
|
-
ONBOARDING_STEP_COMPLETED = "onboarding_step_completed",
|
|
3171
|
-
ONBOARDING_STEP_VIEWED = "onboarding_step_viewed",
|
|
3172
|
-
ONBOARDING_PM_SELECTED = "onboarding_pm_selected",
|
|
3173
|
-
ONBOARDING_EDITOR_OPENED = "onboarding_editor_opened",
|
|
3174
|
-
ONBOARD_PAGE_CD_COMMAND_COPIED = "onboard_page.cd_command_copied",
|
|
3175
|
-
ONBOARD_PAGE_RUN_COMMAND_COPIED = "onboard_page.run_command_copied",
|
|
3176
|
-
ONBOARD_PAGE_INSTALL_COMMAND_COPIED = "onboard_page.install_command_copied",
|
|
3177
|
-
INSTALL_DIALOG_CD_COMMAND_COPIED = "install_dialog.cd_command_copied",
|
|
3178
|
-
INSTALL_DIALOG_RUN_COMMAND_COPIED = "install_dialog.run_command_copied",
|
|
3179
|
-
INSTALL_DIALOG_INSTALL_COMMAND_COPIED = "install_dialog.install_command_copied",
|
|
3180
|
-
HOME_FEATURE_LEARN_MORE_CLICKED = "home.feature_learn_more_clicked",
|
|
3181
|
-
HOME_INSTALL_COMMAND_COPIED = "home.install_command_copied",
|
|
3182
|
-
HOME_TRY_FREE_CLICKED = "home.try_free_clicked",
|
|
3183
|
-
HOME_TESTIMONIAL_CLICKED = "home.testimonial_clicked",
|
|
3184
|
-
HOME_CTA_INSTALL_GUIDE_CLICKED = "home.cta_install_guide_clicked",
|
|
3185
|
-
HOME_COMPETITION_TAB_CHANGED = "home.competition_tab_changed",
|
|
3186
|
-
DEMO_TERMINAL_COMMAND_EXECUTED = "demo_terminal.command_executed",
|
|
3187
|
-
DEMO_TERMINAL_HELP_VIEWED = "demo_terminal.help_viewed",
|
|
3188
|
-
DEMO_TERMINAL_OPTIMIZE_REQUESTED = "demo_terminal.optimize_requested",
|
|
3189
|
-
DEMO_TERMINAL_FIX_MEMORY_LEAK = "demo_terminal.fix_memory_leak",
|
|
3190
|
-
DEMO_TERMINAL_REFACTOR_REQUESTED = "demo_terminal.refactor_requested",
|
|
3191
|
-
DEMO_TERMINAL_FEATURE_REQUESTED = "demo_terminal.feature_requested",
|
|
3192
|
-
DEMO_TERMINAL_THEME_CHANGED = "demo_terminal.theme_changed",
|
|
3193
|
-
TOAST_SHOWN = "toast.shown",
|
|
3194
|
-
REFERRAL_BANNER_CLICKED = "referral_banner.clicked",
|
|
3195
|
-
AGENT_RUN_API_REQUEST = "api.agent_run_request",
|
|
3196
|
-
AGENT_RUN_CREATED = "api.agent_run_created",
|
|
3197
|
-
AGENT_RUN_COMPLETED = "api.agent_run_completed",
|
|
3198
|
-
AGENT_RUN_VALIDATION_ERROR = "api.agent_run_validation_error",
|
|
3199
|
-
AGENT_RUN_CREATION_ERROR = "api.agent_run_creation_error",
|
|
3200
|
-
AGENT_RUN_COMPLETION_ERROR = "api.agent_run_completion_error",
|
|
3201
|
-
ME_API_REQUEST = "api.me_request",
|
|
3202
|
-
ME_VALIDATION_ERROR = "api.me_validation_error",
|
|
3203
|
-
CHAT_COMPLETIONS_REQUEST = "api.chat_completions_request",
|
|
3204
|
-
CHAT_COMPLETIONS_AUTH_ERROR = "api.chat_completions_auth_error",
|
|
3205
|
-
CHAT_COMPLETIONS_VALIDATION_ERROR = "api.chat_completions_validation_error",
|
|
3206
|
-
CHAT_COMPLETIONS_INSUFFICIENT_CREDITS = "api.chat_completions_insufficient_credits",
|
|
3207
|
-
CHAT_COMPLETIONS_GENERATION_STARTED = "api.chat_completions_generation_started",
|
|
3208
|
-
CHAT_COMPLETIONS_STREAM_STARTED = "api.chat_completions_stream_started",
|
|
3209
|
-
CHAT_COMPLETIONS_ERROR = "api.chat_completions_error",
|
|
3210
|
-
USAGE_API_REQUEST = "api.usage_request",
|
|
3211
|
-
USAGE_API_AUTH_ERROR = "api.usage_auth_error",
|
|
3212
|
-
WEB_SEARCH_REQUEST = "api.web_search_request",
|
|
3213
|
-
WEB_SEARCH_AUTH_ERROR = "api.web_search_auth_error",
|
|
3214
|
-
WEB_SEARCH_VALIDATION_ERROR = "api.web_search_validation_error",
|
|
3215
|
-
WEB_SEARCH_INSUFFICIENT_CREDITS = "api.web_search_insufficient_credits",
|
|
3216
|
-
WEB_SEARCH_ERROR = "api.web_search_error",
|
|
3217
|
-
DOCS_SEARCH_REQUEST = "api.docs_search_request",
|
|
3218
|
-
DOCS_SEARCH_AUTH_ERROR = "api.docs_search_auth_error",
|
|
3219
|
-
DOCS_SEARCH_VALIDATION_ERROR = "api.docs_search_validation_error",
|
|
3220
|
-
DOCS_SEARCH_INSUFFICIENT_CREDITS = "api.docs_search_insufficient_credits",
|
|
3221
|
-
DOCS_SEARCH_ERROR = "api.docs_search_error",
|
|
3222
|
-
ADS_API_AUTH_ERROR = "api.ads_auth_error",
|
|
3223
|
-
TOKEN_COUNT_REQUEST = "api.token_count_request",
|
|
3224
|
-
TOKEN_COUNT_AUTH_ERROR = "api.token_count_auth_error",
|
|
3225
|
-
TOKEN_COUNT_VALIDATION_ERROR = "api.token_count_validation_error",
|
|
3226
|
-
TOKEN_COUNT_ERROR = "api.token_count_error",
|
|
3227
|
-
CLAUDE_OAUTH_REQUEST = "sdk.claude_oauth_request",
|
|
3228
|
-
CLAUDE_OAUTH_RATE_LIMITED = "sdk.claude_oauth_rate_limited",
|
|
3229
|
-
CLAUDE_OAUTH_AUTH_ERROR = "sdk.claude_oauth_auth_error",
|
|
3230
|
-
FLUSH_FAILED = "common.flush_failed",
|
|
3231
|
-
CLI_LOG = "cli.log"
|
|
3232
|
-
}
|
|
3233
|
-
type TrackEventFn = (params: {
|
|
3234
|
-
event: AnalyticsEvent;
|
|
3235
|
-
userId: string;
|
|
3236
|
-
properties?: Record<string, any>;
|
|
3237
|
-
logger: Logger$1;
|
|
3238
|
-
}) => void;
|
|
3239
|
-
type GrantType = "free" | "referral" | "referral_legacy" | "subscription" | "purchase" | "admin" | "organization" | "ad";
|
|
3240
|
-
type ServerActionResponseChunk = {
|
|
3241
|
-
type: "response-chunk";
|
|
3242
|
-
userInputId: string;
|
|
3243
|
-
chunk: string | PrintModeEvent;
|
|
3244
|
-
};
|
|
3245
|
-
type ServerActionSubagentResponseChunk = {
|
|
3246
|
-
type: "subagent-response-chunk";
|
|
3247
|
-
userInputId: string;
|
|
3248
|
-
agentId: string;
|
|
3249
|
-
agentType: string;
|
|
3250
|
-
chunk: string;
|
|
3251
|
-
prompt?: string;
|
|
3252
|
-
forwardToPrompt?: boolean;
|
|
3253
|
-
};
|
|
3254
|
-
type ServerActionHandleStepsLogChunk = {
|
|
3255
|
-
type: "handlesteps-log-chunk";
|
|
3256
|
-
userInputId: string;
|
|
3257
|
-
agentId: string;
|
|
3258
|
-
level: "debug" | "info" | "warn" | "error";
|
|
3259
|
-
data: any;
|
|
3260
|
-
message?: string;
|
|
3261
|
-
};
|
|
3262
|
-
type PromptResponse = {
|
|
3263
|
-
type: "prompt-response";
|
|
3264
|
-
promptId: string;
|
|
3265
|
-
sessionState: SessionState;
|
|
3266
|
-
toolCalls?: ToolCall$1[];
|
|
3267
|
-
toolResults?: ToolMessage[];
|
|
3268
|
-
output?: AgentOutput;
|
|
3269
|
-
};
|
|
3270
|
-
type ServerActionReadFiles = {
|
|
3271
|
-
type: "read-files";
|
|
3272
|
-
filePaths: string[];
|
|
3273
|
-
requestId: string;
|
|
3274
|
-
};
|
|
3275
|
-
type ServerActionToolCallRequest = {
|
|
3276
|
-
type: "tool-call-request";
|
|
3277
|
-
userInputId: string;
|
|
3278
|
-
requestId: string;
|
|
3279
|
-
toolName: string;
|
|
3280
|
-
input: Record<string, any>;
|
|
3281
|
-
timeout?: number;
|
|
3282
|
-
mcpConfig?: MCPConfig$1;
|
|
3283
|
-
};
|
|
3284
|
-
type InitResponse = {
|
|
3285
|
-
type: "init-response";
|
|
3286
|
-
message?: string;
|
|
3287
|
-
agentNames?: Record<string, string>;
|
|
3288
|
-
} & Omit<UsageResponse, "type">;
|
|
3289
|
-
type UsageResponse = {
|
|
3290
|
-
type: "usage-response";
|
|
3291
|
-
usage: number;
|
|
3292
|
-
remainingBalance: number;
|
|
3293
|
-
balanceBreakdown?: Record<GrantType, number>;
|
|
3294
|
-
next_quota_reset: Date | null;
|
|
3295
|
-
autoTopupAdded?: number;
|
|
3296
|
-
autoTopupEnabled?: boolean;
|
|
3297
|
-
};
|
|
3298
|
-
type MessageCostResponse = {
|
|
3299
|
-
type: "message-cost-response";
|
|
3300
|
-
promptId: string;
|
|
3301
|
-
credits: number;
|
|
3302
|
-
agentId?: string;
|
|
3303
|
-
};
|
|
3304
|
-
type ServerActionActionError = {
|
|
3305
|
-
type: "action-error";
|
|
3306
|
-
message: string;
|
|
3307
|
-
error?: string;
|
|
3308
|
-
remainingBalance?: number;
|
|
3309
|
-
};
|
|
3310
|
-
type ServerActionPromptError = {
|
|
3311
|
-
type: "prompt-error";
|
|
3312
|
-
userInputId: string;
|
|
3313
|
-
message: string;
|
|
3314
|
-
error?: string;
|
|
3315
|
-
remainingBalance?: number;
|
|
3316
|
-
};
|
|
3317
|
-
type ServerActionRequestReconnect = {
|
|
3318
|
-
type: "request-reconnect";
|
|
3319
|
-
};
|
|
3320
|
-
type ServerActionRequestMcpToolData = {
|
|
3321
|
-
type: "request-mcp-tool-data";
|
|
3322
|
-
requestId: string;
|
|
3323
|
-
mcpConfig: MCPConfig$1;
|
|
3324
|
-
toolNames?: string[];
|
|
3325
|
-
};
|
|
3326
|
-
type ServerActionAny = ServerActionResponseChunk | ServerActionSubagentResponseChunk | ServerActionHandleStepsLogChunk | PromptResponse | ServerActionReadFiles | ServerActionToolCallRequest | InitResponse | UsageResponse | MessageCostResponse | ServerActionActionError | ServerActionPromptError | ServerActionRequestReconnect | ServerActionRequestMcpToolData;
|
|
3327
|
-
type ServerActionType = ServerActionAny["type"];
|
|
3328
|
-
type ServerAction<T extends ServerActionType = ServerActionType> = {
|
|
3329
|
-
[K in ServerActionType]: Extract<ServerActionAny, {
|
|
3330
|
-
type: K;
|
|
3331
|
-
}>;
|
|
3332
|
-
}[T];
|
|
3333
|
-
type SendActionFn = (params: {
|
|
3334
|
-
action: ServerAction;
|
|
3335
|
-
}) => void;
|
|
3336
|
-
type PromptResult<T> = PromptSuccess<T> | PromptAborted;
|
|
3337
|
-
type PromptSuccess<T> = {
|
|
3338
|
-
aborted: false;
|
|
3339
|
-
value: T;
|
|
3340
|
-
};
|
|
3341
|
-
type PromptAborted = {
|
|
3342
|
-
aborted: true;
|
|
3343
|
-
reason?: string;
|
|
3344
|
-
};
|
|
3345
|
-
type StreamChunk = {
|
|
3346
|
-
type: "text";
|
|
3347
|
-
text: string;
|
|
3348
|
-
agentId?: string;
|
|
3349
|
-
} | {
|
|
3350
|
-
type: "reasoning";
|
|
3351
|
-
text: string;
|
|
3352
|
-
} | Pick<ToolCallPart, "type" | "toolCallId" | "toolName" | "input" | "providerOptions"> | {
|
|
3353
|
-
type: "error";
|
|
3354
|
-
message: string;
|
|
3355
|
-
};
|
|
3356
|
-
type PromptAiSdkStreamFn = (params: {
|
|
3357
|
-
apiKey: string;
|
|
3358
|
-
runId: string;
|
|
3359
|
-
messages: Message[];
|
|
3360
|
-
clientSessionId: string;
|
|
3361
|
-
fingerprintId: string;
|
|
3362
|
-
model: Model;
|
|
3363
|
-
userId: string | undefined;
|
|
3364
|
-
chargeUser?: boolean;
|
|
3365
|
-
thinkingBudget?: number;
|
|
3366
|
-
userInputId: string;
|
|
3367
|
-
agentId?: string;
|
|
3368
|
-
maxRetries?: number;
|
|
3369
|
-
onCostCalculated?: (credits: number) => Promise<void>;
|
|
3370
|
-
includeCacheControl?: boolean;
|
|
3371
|
-
agentProviderOptions?: OpenRouterProviderRoutingOptions;
|
|
3372
|
-
/** List of agents that can be spawned - used to transform agent tool calls */
|
|
3373
|
-
spawnableAgents?: string[];
|
|
3374
|
-
/** Map of locally available agent templates - used to transform agent tool calls */
|
|
3375
|
-
localAgentTemplates?: Record<string, AgentTemplate>;
|
|
3376
|
-
/** Cost mode - 'free' mode means 0 credits charged for all agents */
|
|
3377
|
-
costMode?: string;
|
|
3378
|
-
sendAction: SendActionFn;
|
|
3379
|
-
logger: Logger$1;
|
|
3380
|
-
trackEvent: TrackEventFn;
|
|
3381
|
-
signal: AbortSignal;
|
|
3382
|
-
} & ParamsExcluding<typeof streamText, "model" | "messages">) => AsyncGenerator<StreamChunk, PromptResult<string | null>>;
|
|
3383
|
-
type PromptAiSdkFn = (params: {
|
|
3384
|
-
apiKey: string;
|
|
3385
|
-
runId: string;
|
|
3386
|
-
messages: Message[];
|
|
3387
|
-
clientSessionId: string;
|
|
3388
|
-
fingerprintId: string;
|
|
3389
|
-
userInputId: string;
|
|
3390
|
-
model: Model;
|
|
3391
|
-
userId: string | undefined;
|
|
3392
|
-
chargeUser?: boolean;
|
|
3393
|
-
agentId?: string;
|
|
3394
|
-
onCostCalculated?: (credits: number) => Promise<void>;
|
|
3395
|
-
includeCacheControl?: boolean;
|
|
3396
|
-
agentProviderOptions?: OpenRouterProviderRoutingOptions;
|
|
3397
|
-
maxRetries?: number;
|
|
3398
|
-
/** Cost mode - 'free' mode means 0 credits charged for all agents */
|
|
3399
|
-
costMode?: string;
|
|
3400
|
-
sendAction: SendActionFn;
|
|
3401
|
-
logger: Logger$1;
|
|
3402
|
-
trackEvent: TrackEventFn;
|
|
3403
|
-
n?: number;
|
|
3404
|
-
signal: AbortSignal;
|
|
3405
|
-
} & ParamsExcluding<typeof generateText, "model" | "messages">) => Promise<PromptResult<string>>;
|
|
3406
|
-
type PromptAiSdkStructuredInput<T> = {
|
|
3407
|
-
apiKey: string;
|
|
3408
|
-
runId: string;
|
|
3409
|
-
messages: Message[];
|
|
3410
|
-
schema: z.ZodType<T>;
|
|
3411
|
-
clientSessionId: string;
|
|
3412
|
-
fingerprintId: string;
|
|
3413
|
-
userInputId: string;
|
|
3414
|
-
model: Model;
|
|
3415
|
-
userId: string | undefined;
|
|
3416
|
-
maxTokens?: number;
|
|
3417
|
-
temperature?: number;
|
|
3418
|
-
timeout?: number;
|
|
3419
|
-
chargeUser?: boolean;
|
|
3420
|
-
agentId?: string;
|
|
3421
|
-
onCostCalculated?: (credits: number) => Promise<void>;
|
|
3422
|
-
includeCacheControl?: boolean;
|
|
3423
|
-
agentProviderOptions?: OpenRouterProviderRoutingOptions;
|
|
3424
|
-
maxRetries?: number;
|
|
3425
|
-
sendAction: SendActionFn;
|
|
3426
|
-
logger: Logger$1;
|
|
3427
|
-
trackEvent: TrackEventFn;
|
|
3428
|
-
signal: AbortSignal;
|
|
3429
|
-
};
|
|
3430
|
-
type PromptAiSdkStructuredOutput<T> = Promise<PromptResult<T>>;
|
|
3431
|
-
export declare function promptAiSdkStream(params: ParamsOf<PromptAiSdkStreamFn> & {
|
|
3432
|
-
skipClaudeOAuth?: boolean;
|
|
3433
|
-
onClaudeOAuthStatusChange?: (isActive: boolean) => void;
|
|
3434
|
-
}): ReturnType<PromptAiSdkStreamFn>;
|
|
3435
|
-
export declare function promptAiSdk(params: ParamsOf<PromptAiSdkFn>): ReturnType<PromptAiSdkFn>;
|
|
3436
|
-
export declare function promptAiSdkStructured<T>(params: PromptAiSdkStructuredInput<T>): PromptAiSdkStructuredOutput<T>;
|
|
3437
|
-
/**
|
|
3438
|
-
* Reset the Claude OAuth rate limit cache.
|
|
3439
|
-
* Call this when user reconnects their Claude subscription.
|
|
3440
|
-
*/
|
|
3441
|
-
export declare function resetClaudeOAuthRateLimit(): void;
|
|
3442
|
-
|
|
3443
|
-
export {};
|