deepagentsdk 0.11.1 → 0.13.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.
Files changed (99) hide show
  1. package/dist/adapters/elements/index.cjs +274 -0
  2. package/dist/adapters/elements/index.cjs.map +1 -0
  3. package/dist/adapters/elements/index.d.cts +122 -0
  4. package/dist/adapters/elements/index.d.mts +122 -0
  5. package/dist/adapters/elements/index.mjs +268 -0
  6. package/dist/adapters/elements/index.mjs.map +1 -0
  7. package/dist/agent-BDM-PIu8.d.mts +1500 -0
  8. package/dist/agent-DToEVxs-.d.cts +1500 -0
  9. package/dist/chunk-C5azi7Hr.cjs +67 -0
  10. package/dist/cli/index.cjs +3162 -0
  11. package/dist/cli/index.cjs.map +1 -0
  12. package/dist/cli/index.d.cts +1 -0
  13. package/dist/cli/index.d.mts +1 -0
  14. package/dist/cli/index.mjs +3120 -0
  15. package/dist/cli/index.mjs.map +1 -0
  16. package/dist/file-saver-BYPKakT4.cjs +3990 -0
  17. package/dist/file-saver-BYPKakT4.cjs.map +1 -0
  18. package/dist/file-saver-Hj5so3dV.mjs +3568 -0
  19. package/dist/file-saver-Hj5so3dV.mjs.map +1 -0
  20. package/dist/index.cjs +1481 -0
  21. package/dist/index.cjs.map +1 -0
  22. package/dist/index.d.cts +1233 -0
  23. package/dist/index.d.mts +1233 -0
  24. package/dist/index.mjs +1381 -0
  25. package/dist/index.mjs.map +1 -0
  26. package/dist/load-BBYEnMwz.mjs +142 -0
  27. package/dist/load-BBYEnMwz.mjs.map +1 -0
  28. package/dist/load-BDxe6Cet.mjs +3 -0
  29. package/dist/load-BrRAKlO6.cjs +163 -0
  30. package/dist/load-BrRAKlO6.cjs.map +1 -0
  31. package/dist/load-DqllBbDc.cjs +4 -0
  32. package/package.json +26 -12
  33. package/src/adapters/elements/index.ts +0 -27
  34. package/src/adapters/elements/messageAdapter.ts +0 -165
  35. package/src/adapters/elements/statusAdapter.ts +0 -39
  36. package/src/adapters/elements/types.ts +0 -97
  37. package/src/adapters/elements/useElementsAdapter.ts +0 -261
  38. package/src/agent.ts +0 -1258
  39. package/src/backends/composite.ts +0 -273
  40. package/src/backends/filesystem.ts +0 -692
  41. package/src/backends/index.ts +0 -22
  42. package/src/backends/local-sandbox.ts +0 -175
  43. package/src/backends/persistent.ts +0 -593
  44. package/src/backends/sandbox.ts +0 -510
  45. package/src/backends/state.ts +0 -244
  46. package/src/backends/utils.ts +0 -287
  47. package/src/checkpointer/file-saver.ts +0 -98
  48. package/src/checkpointer/index.ts +0 -5
  49. package/src/checkpointer/kv-saver.ts +0 -82
  50. package/src/checkpointer/memory-saver.ts +0 -82
  51. package/src/checkpointer/types.ts +0 -125
  52. package/src/cli/components/ApiKeyInput.tsx +0 -300
  53. package/src/cli/components/FilePreview.tsx +0 -237
  54. package/src/cli/components/Input.tsx +0 -277
  55. package/src/cli/components/Message.tsx +0 -93
  56. package/src/cli/components/ModelSelection.tsx +0 -338
  57. package/src/cli/components/SlashMenu.tsx +0 -101
  58. package/src/cli/components/StatusBar.tsx +0 -89
  59. package/src/cli/components/Subagent.tsx +0 -91
  60. package/src/cli/components/TodoList.tsx +0 -133
  61. package/src/cli/components/ToolApproval.tsx +0 -70
  62. package/src/cli/components/ToolCall.tsx +0 -144
  63. package/src/cli/components/ToolCallSummary.tsx +0 -175
  64. package/src/cli/components/Welcome.tsx +0 -75
  65. package/src/cli/components/index.ts +0 -24
  66. package/src/cli/hooks/index.ts +0 -12
  67. package/src/cli/hooks/useAgent.ts +0 -933
  68. package/src/cli/index.tsx +0 -1066
  69. package/src/cli/theme.ts +0 -205
  70. package/src/cli/utils/model-list.ts +0 -365
  71. package/src/constants/errors.ts +0 -29
  72. package/src/constants/limits.ts +0 -195
  73. package/src/index.ts +0 -176
  74. package/src/middleware/agent-memory.ts +0 -330
  75. package/src/prompts.ts +0 -196
  76. package/src/skills/index.ts +0 -2
  77. package/src/skills/load.ts +0 -191
  78. package/src/skills/types.ts +0 -53
  79. package/src/tools/execute.ts +0 -167
  80. package/src/tools/filesystem.ts +0 -418
  81. package/src/tools/index.ts +0 -39
  82. package/src/tools/subagent.ts +0 -443
  83. package/src/tools/todos.ts +0 -101
  84. package/src/tools/web.ts +0 -567
  85. package/src/types/backend.ts +0 -177
  86. package/src/types/core.ts +0 -220
  87. package/src/types/events.ts +0 -430
  88. package/src/types/index.ts +0 -94
  89. package/src/types/structured-output.ts +0 -43
  90. package/src/types/subagent.ts +0 -96
  91. package/src/types.ts +0 -22
  92. package/src/utils/approval.ts +0 -213
  93. package/src/utils/events.ts +0 -416
  94. package/src/utils/eviction.ts +0 -181
  95. package/src/utils/index.ts +0 -34
  96. package/src/utils/model-parser.ts +0 -38
  97. package/src/utils/patch-tool-calls.ts +0 -233
  98. package/src/utils/project-detection.ts +0 -32
  99. package/src/utils/summarization.ts +0 -254
@@ -1,177 +0,0 @@
1
- /**
2
- * Backend protocol and filesystem types.
3
- */
4
-
5
- import type { TodoItem } from "./core";
6
-
7
- /**
8
- * File data structure used by backends.
9
- */
10
- export interface FileData {
11
- /** Lines of text content */
12
- content: string[];
13
- /** ISO format timestamp of creation */
14
- created_at: string;
15
- /** ISO format timestamp of last modification */
16
- modified_at: string;
17
- }
18
-
19
- /**
20
- * Structured file listing info.
21
- */
22
- export interface FileInfo {
23
- /** File path */
24
- path: string;
25
- /** Whether this is a directory */
26
- is_dir?: boolean;
27
- /** File size in bytes (approximate) */
28
- size?: number;
29
- /** ISO 8601 timestamp of last modification */
30
- modified_at?: string;
31
- }
32
-
33
- /**
34
- * Structured grep match entry.
35
- */
36
- export interface GrepMatch {
37
- /** File path where match was found */
38
- path: string;
39
- /** Line number (1-indexed) */
40
- line: number;
41
- /** The matching line text */
42
- text: string;
43
- }
44
-
45
- /**
46
- * Result from backend write operations.
47
- */
48
- export interface WriteResult {
49
- /** Whether the write operation succeeded */
50
- success: boolean;
51
- /** Error message on failure, undefined on success */
52
- error?: string;
53
- /** File path of written file, undefined on failure */
54
- path?: string;
55
- }
56
-
57
- /**
58
- * Result from backend edit operations.
59
- */
60
- export interface EditResult {
61
- /** Whether the edit operation succeeded */
62
- success: boolean;
63
- /** Error message on failure, undefined on success */
64
- error?: string;
65
- /** File path of edited file, undefined on failure */
66
- path?: string;
67
- /** Number of replacements made, undefined on failure */
68
- occurrences?: number;
69
- }
70
-
71
- /**
72
- * Shared state for deep agent operations.
73
- * This is passed to tools and modified during execution.
74
- */
75
- export interface DeepAgentState {
76
- /** Current todo list */
77
- todos: TodoItem[];
78
- /** Virtual filesystem (for StateBackend) */
79
- files: Record<string, FileData>;
80
- }
81
-
82
- /**
83
- * Protocol for pluggable memory backends.
84
- */
85
- export interface BackendProtocol {
86
- /**
87
- * Structured listing with file metadata.
88
- */
89
- lsInfo(path: string): FileInfo[] | Promise<FileInfo[]>;
90
-
91
- /**
92
- * Read file content with line numbers or an error string.
93
- */
94
- read(
95
- filePath: string,
96
- offset?: number,
97
- limit?: number
98
- ): string | Promise<string>;
99
-
100
- /**
101
- * Read file content as raw FileData.
102
- */
103
- readRaw(filePath: string): FileData | Promise<FileData>;
104
-
105
- /**
106
- * Structured search results or error string for invalid input.
107
- */
108
- grepRaw(
109
- pattern: string,
110
- path?: string | null,
111
- glob?: string | null
112
- ): GrepMatch[] | string | Promise<GrepMatch[] | string>;
113
-
114
- /**
115
- * Structured glob matching returning FileInfo objects.
116
- */
117
- globInfo(pattern: string, path?: string): FileInfo[] | Promise<FileInfo[]>;
118
-
119
- /**
120
- * Create a new file or overwrite existing file.
121
- */
122
- write(filePath: string, content: string): WriteResult | Promise<WriteResult>;
123
-
124
- /**
125
- * Edit a file by replacing string occurrences.
126
- */
127
- edit(
128
- filePath: string,
129
- oldString: string,
130
- newString: string,
131
- replaceAll?: boolean
132
- ): EditResult | Promise<EditResult>;
133
- }
134
-
135
- /**
136
- * Factory function type for creating backend instances from agent state.
137
- */
138
- export type BackendFactory = (state: DeepAgentState) => BackendProtocol;
139
-
140
- /**
141
- * Result of command execution in a sandbox.
142
- */
143
- export interface ExecuteResponse {
144
- /** Combined stdout and stderr output of the executed command */
145
- output: string;
146
- /** Exit code (0 = success, non-zero = failure, null = unknown/timeout) */
147
- exitCode: number | null;
148
- /** Whether the output was truncated due to size limits */
149
- truncated: boolean;
150
- }
151
-
152
- /**
153
- * Protocol for sandbox backends with command execution capability.
154
- */
155
- export interface SandboxBackendProtocol extends BackendProtocol {
156
- /**
157
- * Execute a shell command in the sandbox.
158
- */
159
- execute(command: string): Promise<ExecuteResponse>;
160
-
161
- /**
162
- * Unique identifier for this sandbox instance.
163
- */
164
- readonly id: string;
165
- }
166
-
167
- /**
168
- * Type guard to check if a backend is a SandboxBackendProtocol.
169
- */
170
- export function isSandboxBackend(
171
- backend: BackendProtocol
172
- ): backend is SandboxBackendProtocol {
173
- return (
174
- typeof (backend as SandboxBackendProtocol).execute === "function" &&
175
- typeof (backend as SandboxBackendProtocol).id === "string"
176
- );
177
- }
package/src/types/core.ts DELETED
@@ -1,220 +0,0 @@
1
- /**
2
- * Core agent configuration, state, and control types.
3
- */
4
-
5
- import type {
6
- ToolSet,
7
- LanguageModel,
8
- LanguageModelMiddleware,
9
- StopCondition,
10
- ToolLoopAgentSettings,
11
- } from "ai";
12
- import type { z } from "zod";
13
- import type { BaseCheckpointSaver } from "../checkpointer/types";
14
- import type { BackendProtocol, BackendFactory } from "./backend";
15
- import type { SubAgent, InterruptOnConfig } from "./subagent";
16
-
17
- // Re-export LanguageModel for convenience
18
- export type { LanguageModel };
19
-
20
- /**
21
- * Configuration options for agent memory middleware.
22
- */
23
- export interface AgentMemoryOptions {
24
- /**
25
- * Unique identifier for the agent (e.g., "code-architect", "research-agent").
26
- * Used to locate agent-specific memory at ~/.deepagents/{agentId}/agent.md
27
- */
28
- agentId: string;
29
-
30
- /**
31
- * Optional working directory for project-level memory detection.
32
- * Defaults to process.cwd().
33
- */
34
- workingDirectory?: string;
35
-
36
- /**
37
- * Optional custom path for user-level .deepagents directory.
38
- * Defaults to os.homedir() + '/.deepagents'.
39
- */
40
- userDeepagentsDir?: string;
41
-
42
- /**
43
- * Optional callback to request user approval for creating project-level .deepagents/ directory.
44
- */
45
- requestProjectApproval?: (projectPath: string) => Promise<boolean>;
46
- }
47
-
48
- /**
49
- * Todo item for task planning and tracking.
50
- */
51
- export interface TodoItem {
52
- /** Unique identifier for the todo */
53
- id: string;
54
- /** Description of the task */
55
- content: string;
56
- /** Current status */
57
- status: "pending" | "in_progress" | "completed" | "cancelled";
58
- }
59
-
60
- /**
61
- * Tool choice type for prepareStep.
62
- */
63
- export type DeepAgentToolChoice =
64
- | "auto"
65
- | "none"
66
- | "required"
67
- | { type: "tool"; toolName: string };
68
-
69
- /**
70
- * Result from prepareStep callback.
71
- */
72
- export interface PrepareStepResult {
73
- toolChoice?: DeepAgentToolChoice;
74
- model?: LanguageModel;
75
- [key: string]: unknown;
76
- }
77
-
78
- /**
79
- * Arguments passed to prepareStep callback.
80
- */
81
- export interface PrepareStepArgs {
82
- stepNumber: number;
83
- steps: unknown[];
84
- model: LanguageModel;
85
- messages: import("ai").ModelMessage[];
86
- experimental_context?: unknown;
87
- }
88
-
89
- /**
90
- * Prepare step function type with permissive tool choice typing.
91
- */
92
- export type PrepareStepFunction = (
93
- args: PrepareStepArgs
94
- ) => PrepareStepResult | PromiseLike<PrepareStepResult>;
95
-
96
- /**
97
- * Loop control callbacks for agent iteration.
98
- */
99
- export interface LoopControlOptions {
100
- /**
101
- * Called before each step to dynamically adjust settings.
102
- */
103
- prepareStep?: PrepareStepFunction;
104
-
105
- /**
106
- * Called after each step finishes.
107
- */
108
- onStepFinish?: ToolLoopAgentSettings["onStepFinish"];
109
-
110
- /**
111
- * Called when all steps are finished.
112
- */
113
- onFinish?: ToolLoopAgentSettings["onFinish"];
114
-
115
- /**
116
- * Custom stop conditions (composed with maxSteps safety limit).
117
- */
118
- stopWhen?: StopCondition<ToolSet> | StopCondition<ToolSet>[];
119
- }
120
-
121
- /**
122
- * Sampling and generation parameters for model calls.
123
- */
124
- export interface GenerationOptions {
125
- /** Sampling temperature (0-2). */
126
- temperature?: number;
127
- /** Nucleus sampling (0-1). */
128
- topP?: number;
129
- /** Top-K sampling. */
130
- topK?: number;
131
- /** Maximum number of tokens to generate per response. */
132
- maxOutputTokens?: number;
133
- /** Presence penalty (-1 to 1). */
134
- presencePenalty?: number;
135
- /** Frequency penalty (-1 to 1). */
136
- frequencyPenalty?: number;
137
- /** Random seed for deterministic generation. */
138
- seed?: number;
139
- /** Sequences that stop generation when encountered. */
140
- stopSequences?: string[];
141
- /** Maximum number of retries for failed API calls. */
142
- maxRetries?: number;
143
- }
144
-
145
- /**
146
- * Advanced options for power users.
147
- */
148
- export interface AdvancedAgentOptions {
149
- /** OpenTelemetry configuration for observability. */
150
- experimental_telemetry?: ToolLoopAgentSettings["experimental_telemetry"];
151
- /** Provider-specific options passed through to the model provider. */
152
- providerOptions?: ToolLoopAgentSettings["providerOptions"];
153
- /** Custom context passed to tool executions. */
154
- experimental_context?: ToolLoopAgentSettings["experimental_context"];
155
- /** Control which tool the model should call. */
156
- toolChoice?: ToolLoopAgentSettings["toolChoice"];
157
- /** Limit which tools are available for the model to call. */
158
- activeTools?: string[];
159
- }
160
-
161
- /**
162
- * Summarization configuration options.
163
- */
164
- export interface SummarizationConfig {
165
- /** Enable automatic summarization when approaching token limits. */
166
- enabled: boolean;
167
- /** Token threshold to trigger summarization (default: 170000). */
168
- tokenThreshold?: number;
169
- /** Number of recent messages to keep intact without summarization (default: 6). */
170
- keepMessages?: number;
171
- /** Model to use for summarization. */
172
- model?: LanguageModel;
173
- }
174
-
175
- /**
176
- * Configuration parameters for creating a Deep Agent.
177
- */
178
- export interface CreateDeepAgentParams {
179
- /** The AI SDK LanguageModel instance to use. */
180
- model: LanguageModel;
181
- /** Optional middleware to wrap the model. */
182
- middleware?: LanguageModelMiddleware | LanguageModelMiddleware[];
183
- /** Optional custom tools the agent should have access to. */
184
- tools?: ToolSet;
185
- /** Optional custom system prompt for the agent. */
186
- systemPrompt?: string;
187
- /** Optional list of subagent specifications for task delegation. */
188
- subagents?: SubAgent[];
189
- /** Optional backend for filesystem operations. */
190
- backend?: BackendProtocol | BackendFactory;
191
- /** Optional maximum number of steps for the agent loop (default: 100). */
192
- maxSteps?: number;
193
- /** Optional flag to include the general-purpose subagent (default: true). */
194
- includeGeneralPurposeAgent?: boolean;
195
- /** Optional token limit before evicting large tool results to filesystem. */
196
- toolResultEvictionLimit?: number;
197
- /** Optional flag to enable prompt caching (Anthropic only). */
198
- enablePromptCaching?: boolean;
199
- /** Optional summarization configuration. */
200
- summarization?: SummarizationConfig;
201
- /** Configuration for human-in-the-loop tool approval. */
202
- interruptOn?: InterruptOnConfig;
203
- /** Optional checkpointer for persisting agent state. */
204
- checkpointer?: BaseCheckpointSaver;
205
- /** @deprecated Use `agentId` instead. */
206
- skillsDir?: string;
207
- /** Optional agent identifier for loading agent-specific memory and skills. */
208
- agentId?: string;
209
- /** Optional configuration for structured output parsing. */
210
- output?: {
211
- schema: z.ZodType<any>;
212
- description?: string;
213
- };
214
- /** Advanced loop control options. */
215
- loopControl?: LoopControlOptions;
216
- /** Advanced generation options. */
217
- generationOptions?: GenerationOptions;
218
- /** Advanced agent options. */
219
- advancedOptions?: AdvancedAgentOptions;
220
- }