deepagentsdk 0.11.0 → 0.12.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 (103) hide show
  1. package/dist/adapters/elements/index.cjs +324 -0
  2. package/dist/adapters/elements/index.cjs.map +1 -0
  3. package/dist/adapters/elements/index.d.cts +212 -0
  4. package/dist/adapters/elements/index.d.mts +212 -0
  5. package/dist/adapters/elements/index.mjs +320 -0
  6. package/dist/adapters/elements/index.mjs.map +1 -0
  7. package/dist/agent-CrH-He58.mjs +2974 -0
  8. package/dist/agent-CrH-He58.mjs.map +1 -0
  9. package/dist/agent-Cuks-Idh.cjs +3396 -0
  10. package/dist/agent-Cuks-Idh.cjs.map +1 -0
  11. package/dist/chunk-CbDLau6x.cjs +34 -0
  12. package/dist/cli/index.cjs +3162 -0
  13. package/dist/cli/index.cjs.map +1 -0
  14. package/dist/cli/index.d.cts +1 -0
  15. package/dist/cli/index.d.mts +1 -0
  16. package/dist/cli/index.mjs +3120 -0
  17. package/dist/cli/index.mjs.map +1 -0
  18. package/dist/file-saver-BJCqMIb5.mjs +655 -0
  19. package/dist/file-saver-BJCqMIb5.mjs.map +1 -0
  20. package/dist/file-saver-C6O2LAvg.cjs +679 -0
  21. package/dist/file-saver-C6O2LAvg.cjs.map +1 -0
  22. package/dist/index.cjs +1471 -0
  23. package/dist/index.cjs.map +1 -0
  24. package/dist/index.d.cts +1581 -0
  25. package/dist/index.d.mts +1581 -0
  26. package/dist/index.mjs +1371 -0
  27. package/dist/index.mjs.map +1 -0
  28. package/dist/load-79a2H4m0.cjs +163 -0
  29. package/dist/load-79a2H4m0.cjs.map +1 -0
  30. package/dist/load-94gjHorc.mjs +3 -0
  31. package/dist/load-B6CA5js_.mjs +142 -0
  32. package/dist/load-B6CA5js_.mjs.map +1 -0
  33. package/dist/load-C2qVmZMp.cjs +3 -0
  34. package/dist/types-4g9UvXal.d.mts +1151 -0
  35. package/dist/types-IulnvhFg.d.cts +1151 -0
  36. package/package.json +26 -12
  37. package/src/adapters/elements/index.ts +0 -27
  38. package/src/adapters/elements/messageAdapter.ts +0 -165
  39. package/src/adapters/elements/statusAdapter.ts +0 -39
  40. package/src/adapters/elements/types.ts +0 -97
  41. package/src/adapters/elements/useElementsAdapter.ts +0 -261
  42. package/src/agent.ts +0 -1258
  43. package/src/backends/composite.ts +0 -273
  44. package/src/backends/filesystem.ts +0 -692
  45. package/src/backends/index.ts +0 -22
  46. package/src/backends/local-sandbox.ts +0 -175
  47. package/src/backends/persistent.ts +0 -593
  48. package/src/backends/sandbox.ts +0 -510
  49. package/src/backends/state.ts +0 -244
  50. package/src/backends/utils.ts +0 -287
  51. package/src/checkpointer/file-saver.ts +0 -98
  52. package/src/checkpointer/index.ts +0 -5
  53. package/src/checkpointer/kv-saver.ts +0 -82
  54. package/src/checkpointer/memory-saver.ts +0 -82
  55. package/src/checkpointer/types.ts +0 -125
  56. package/src/cli/components/ApiKeyInput.tsx +0 -300
  57. package/src/cli/components/FilePreview.tsx +0 -237
  58. package/src/cli/components/Input.tsx +0 -277
  59. package/src/cli/components/Message.tsx +0 -93
  60. package/src/cli/components/ModelSelection.tsx +0 -338
  61. package/src/cli/components/SlashMenu.tsx +0 -101
  62. package/src/cli/components/StatusBar.tsx +0 -89
  63. package/src/cli/components/Subagent.tsx +0 -91
  64. package/src/cli/components/TodoList.tsx +0 -133
  65. package/src/cli/components/ToolApproval.tsx +0 -70
  66. package/src/cli/components/ToolCall.tsx +0 -144
  67. package/src/cli/components/ToolCallSummary.tsx +0 -175
  68. package/src/cli/components/Welcome.tsx +0 -75
  69. package/src/cli/components/index.ts +0 -24
  70. package/src/cli/hooks/index.ts +0 -12
  71. package/src/cli/hooks/useAgent.ts +0 -933
  72. package/src/cli/index.tsx +0 -1066
  73. package/src/cli/theme.ts +0 -205
  74. package/src/cli/utils/model-list.ts +0 -365
  75. package/src/constants/errors.ts +0 -29
  76. package/src/constants/limits.ts +0 -195
  77. package/src/index.ts +0 -176
  78. package/src/middleware/agent-memory.ts +0 -330
  79. package/src/prompts.ts +0 -196
  80. package/src/skills/index.ts +0 -2
  81. package/src/skills/load.ts +0 -191
  82. package/src/skills/types.ts +0 -53
  83. package/src/tools/execute.ts +0 -167
  84. package/src/tools/filesystem.ts +0 -418
  85. package/src/tools/index.ts +0 -39
  86. package/src/tools/subagent.ts +0 -443
  87. package/src/tools/todos.ts +0 -101
  88. package/src/tools/web.ts +0 -567
  89. package/src/types/backend.ts +0 -177
  90. package/src/types/core.ts +0 -220
  91. package/src/types/events.ts +0 -430
  92. package/src/types/index.ts +0 -94
  93. package/src/types/structured-output.ts +0 -43
  94. package/src/types/subagent.ts +0 -96
  95. package/src/types.ts +0 -22
  96. package/src/utils/approval.ts +0 -213
  97. package/src/utils/events.ts +0 -416
  98. package/src/utils/eviction.ts +0 -181
  99. package/src/utils/index.ts +0 -34
  100. package/src/utils/model-parser.ts +0 -38
  101. package/src/utils/patch-tool-calls.ts +0 -233
  102. package/src/utils/project-detection.ts +0 -32
  103. 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
-