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,175 +0,0 @@
1
- /**
2
- * LocalSandbox: Execute commands locally using child_process.
3
- *
4
- * Useful for local development and testing without cloud sandboxes.
5
- * All file operations are inherited from BaseSandbox and executed
6
- * via shell commands in the local filesystem.
7
- */
8
-
9
- import { spawn } from "child_process";
10
- import type { ExecuteResponse } from "../types";
11
- import { BaseSandbox } from "./sandbox";
12
-
13
- /**
14
- * Options for LocalSandbox.
15
- */
16
- export interface LocalSandboxOptions {
17
- /**
18
- * Working directory for command execution.
19
- * All file paths in sandbox operations are relative to this directory.
20
- * @default process.cwd()
21
- */
22
- cwd?: string;
23
-
24
- /**
25
- * Timeout in milliseconds for command execution.
26
- * Commands that exceed this timeout will be terminated.
27
- * @default 30000 (30 seconds)
28
- */
29
- timeout?: number;
30
-
31
- /**
32
- * Additional environment variables to set for command execution.
33
- * These are merged with the current process environment.
34
- */
35
- env?: Record<string, string>;
36
-
37
- /**
38
- * Maximum output size in bytes before truncation.
39
- * @default 1048576 (1MB)
40
- */
41
- maxOutputSize?: number;
42
- }
43
-
44
- /**
45
- * Local sandbox that executes commands using Node.js child_process.
46
- *
47
- * All commands are executed in a bash shell with the specified working directory.
48
- * Inherits all file operations (read, write, edit, ls, grep, glob) from BaseSandbox.
49
- *
50
- * @example Basic usage
51
- * ```typescript
52
- * import { LocalSandbox } from 'deepagentsdk';
53
- *
54
- * const sandbox = new LocalSandbox({ cwd: './workspace' });
55
- *
56
- * // Execute commands
57
- * const result = await sandbox.execute('ls -la');
58
- * console.log(result.output);
59
- *
60
- * // File operations
61
- * await sandbox.write('./src/index.ts', 'console.log("hello")');
62
- * const content = await sandbox.read('./src/index.ts');
63
- * ```
64
- *
65
- * @example With timeout and environment
66
- * ```typescript
67
- * const sandbox = new LocalSandbox({
68
- * cwd: './workspace',
69
- * timeout: 60000, // 60 seconds
70
- * env: {
71
- * NODE_ENV: 'development',
72
- * DEBUG: '*',
73
- * },
74
- * });
75
- * ```
76
- *
77
- * @example Error handling
78
- * ```typescript
79
- * const result = await sandbox.execute('npm test');
80
- * if (result.exitCode !== 0) {
81
- * console.error('Tests failed:', result.output);
82
- * }
83
- * ```
84
- */
85
- export class LocalSandbox extends BaseSandbox {
86
- private readonly cwd: string;
87
- private readonly timeout: number;
88
- private readonly env: Record<string, string>;
89
- private readonly maxOutputSize: number;
90
- private readonly _id: string;
91
-
92
- /**
93
- * Create a new LocalSandbox instance.
94
- *
95
- * @param options - Configuration options for the sandbox
96
- */
97
- constructor(options: LocalSandboxOptions = {}) {
98
- super();
99
- this.cwd = options.cwd || process.cwd();
100
- this.timeout = options.timeout || 30000;
101
- this.env = options.env || {};
102
- this.maxOutputSize = options.maxOutputSize || 1024 * 1024; // 1MB
103
- this._id = `local-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
104
- }
105
-
106
- /**
107
- * Unique identifier for this sandbox instance.
108
- * Format: `local-{timestamp}-{random}`
109
- */
110
- get id(): string {
111
- return this._id;
112
- }
113
-
114
- /**
115
- * Execute a shell command in the local filesystem.
116
- *
117
- * Commands are executed using bash with the configured working directory
118
- * and environment variables. Output is captured from both stdout and stderr.
119
- *
120
- * @param command - Shell command to execute
121
- * @returns ExecuteResponse with output, exit code, and truncation status
122
- *
123
- * @example
124
- * ```typescript
125
- * const result = await sandbox.execute('echo "Hello" && ls -la');
126
- * console.log(result.output);
127
- * console.log('Exit code:', result.exitCode);
128
- * ```
129
- */
130
- async execute(command: string): Promise<ExecuteResponse> {
131
- return new Promise((resolve) => {
132
- const child = spawn("bash", ["-c", command], {
133
- cwd: this.cwd,
134
- env: { ...process.env, ...this.env },
135
- timeout: this.timeout,
136
- });
137
-
138
- let output = "";
139
- let truncated = false;
140
-
141
- child.stdout.on("data", (data: Buffer) => {
142
- if (output.length < this.maxOutputSize) {
143
- output += data.toString();
144
- } else {
145
- truncated = true;
146
- }
147
- });
148
-
149
- child.stderr.on("data", (data: Buffer) => {
150
- if (output.length < this.maxOutputSize) {
151
- output += data.toString();
152
- } else {
153
- truncated = true;
154
- }
155
- });
156
-
157
- child.on("close", (code) => {
158
- resolve({
159
- output,
160
- exitCode: code,
161
- truncated,
162
- });
163
- });
164
-
165
- child.on("error", (err) => {
166
- resolve({
167
- output: `Error: ${err.message}`,
168
- exitCode: 1,
169
- truncated: false,
170
- });
171
- });
172
- });
173
- }
174
- }
175
-