@intella/sdk 0.0.1 → 0.0.3

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 (117) hide show
  1. package/README.md +6 -483
  2. package/dist/agent-manager.d.ts +47 -0
  3. package/dist/agent-manager.d.ts.map +1 -0
  4. package/dist/agent-manager.js +90 -0
  5. package/dist/agent-manager.js.map +1 -0
  6. package/dist/agents/base-agent.d.ts +41 -0
  7. package/dist/agents/base-agent.d.ts.map +1 -0
  8. package/dist/agents/base-agent.js +148 -0
  9. package/dist/agents/base-agent.js.map +1 -0
  10. package/dist/agents/claude-agent.d.ts +24 -0
  11. package/dist/agents/claude-agent.d.ts.map +1 -0
  12. package/dist/agents/claude-agent.js +65 -0
  13. package/dist/agents/claude-agent.js.map +1 -0
  14. package/dist/agents/codex-agent.d.ts +25 -0
  15. package/dist/agents/codex-agent.d.ts.map +1 -0
  16. package/dist/agents/codex-agent.js +62 -0
  17. package/dist/agents/codex-agent.js.map +1 -0
  18. package/dist/agents/intella-lite-agent.d.ts +21 -0
  19. package/dist/agents/intella-lite-agent.d.ts.map +1 -0
  20. package/dist/agents/intella-lite-agent.js +43 -0
  21. package/dist/agents/intella-lite-agent.js.map +1 -0
  22. package/dist/agents/opencode-agent.d.ts +20 -0
  23. package/dist/agents/opencode-agent.d.ts.map +1 -0
  24. package/dist/agents/opencode-agent.js +36 -0
  25. package/dist/agents/opencode-agent.js.map +1 -0
  26. package/dist/filesystem/base-provider.d.ts +55 -0
  27. package/dist/filesystem/base-provider.d.ts.map +1 -0
  28. package/dist/filesystem/base-provider.js +45 -0
  29. package/dist/filesystem/base-provider.js.map +1 -0
  30. package/dist/filesystem/index.d.ts +3 -0
  31. package/dist/filesystem/index.d.ts.map +1 -0
  32. package/{src/filesystem/index.ts → dist/filesystem/index.js} +1 -2
  33. package/dist/filesystem/index.js.map +1 -0
  34. package/dist/filesystem/memory-provider.d.ts +44 -0
  35. package/dist/filesystem/memory-provider.d.ts.map +1 -0
  36. package/dist/filesystem/memory-provider.js +227 -0
  37. package/dist/filesystem/memory-provider.js.map +1 -0
  38. package/dist/filesystem-manager.d.ts +75 -0
  39. package/dist/filesystem-manager.d.ts.map +1 -0
  40. package/dist/filesystem-manager.js +162 -0
  41. package/dist/filesystem-manager.js.map +1 -0
  42. package/dist/index.d.ts +18 -0
  43. package/dist/index.d.ts.map +1 -0
  44. package/{src/index.ts → dist/index.js} +4 -47
  45. package/dist/index.js.map +1 -0
  46. package/dist/orchestrator.d.ts +32 -0
  47. package/dist/orchestrator.d.ts.map +1 -0
  48. package/dist/orchestrator.js +137 -0
  49. package/dist/orchestrator.js.map +1 -0
  50. package/dist/sandbox/base-provider.d.ts +106 -0
  51. package/dist/sandbox/base-provider.d.ts.map +1 -0
  52. package/dist/sandbox/base-provider.js +74 -0
  53. package/dist/sandbox/base-provider.js.map +1 -0
  54. package/dist/sandbox/daytona-provider.d.ts +93 -0
  55. package/dist/sandbox/daytona-provider.d.ts.map +1 -0
  56. package/dist/sandbox/daytona-provider.js +378 -0
  57. package/dist/sandbox/daytona-provider.js.map +1 -0
  58. package/dist/sandbox/e2b-provider.d.ts +85 -0
  59. package/dist/sandbox/e2b-provider.d.ts.map +1 -0
  60. package/dist/sandbox/e2b-provider.js +363 -0
  61. package/dist/sandbox/e2b-provider.js.map +1 -0
  62. package/dist/sandbox/modal-provider.d.ts +92 -0
  63. package/dist/sandbox/modal-provider.d.ts.map +1 -0
  64. package/dist/sandbox/modal-provider.js +516 -0
  65. package/dist/sandbox/modal-provider.js.map +1 -0
  66. package/dist/sandbox-manager.d.ts +59 -0
  67. package/dist/sandbox-manager.d.ts.map +1 -0
  68. package/dist/sandbox-manager.js +141 -0
  69. package/dist/sandbox-manager.js.map +1 -0
  70. package/dist/sdk.d.ts +173 -0
  71. package/dist/sdk.d.ts.map +1 -0
  72. package/dist/sdk.js +277 -0
  73. package/dist/sdk.js.map +1 -0
  74. package/dist/types.d.ts +423 -0
  75. package/dist/types.d.ts.map +1 -0
  76. package/dist/types.js +2 -0
  77. package/dist/types.js.map +1 -0
  78. package/dist/utils/code-extractor.d.ts +103 -0
  79. package/dist/utils/code-extractor.d.ts.map +1 -0
  80. package/dist/utils/code-extractor.js +133 -0
  81. package/dist/utils/code-extractor.js.map +1 -0
  82. package/package.json +23 -11
  83. package/examples/claude-code/README.md +0 -178
  84. package/examples/claude-code/advanced-config.ts +0 -55
  85. package/examples/claude-code/basic-usage.ts +0 -56
  86. package/examples/claude-code/model-comparison.ts +0 -50
  87. package/examples/claude-code/orchestration.ts +0 -70
  88. package/examples/claude-code/streaming.ts +0 -69
  89. package/examples/claude-code/tsconfig.json +0 -19
  90. package/examples/code-extractor/README.md +0 -77
  91. package/examples/code-extractor/example.ts +0 -145
  92. package/examples/filesystem/basic-usage.ts +0 -84
  93. package/examples/integrated-task/README.md +0 -68
  94. package/examples/integrated-task/integrated-usage.ts +0 -193
  95. package/examples/integrated-task/simple-example.ts +0 -51
  96. package/examples/integrated-task/tsconfig.json +0 -19
  97. package/examples/sandbox/basic-usage.ts +0 -173
  98. package/src/agent-manager.ts +0 -104
  99. package/src/agents/base-agent.ts +0 -166
  100. package/src/agents/claude-agent.ts +0 -77
  101. package/src/agents/codex-agent.ts +0 -72
  102. package/src/agents/intella-lite-agent.ts +0 -55
  103. package/src/agents/opencode-agent.ts +0 -45
  104. package/src/filesystem/agentfs-provider.ts +0 -328
  105. package/src/filesystem/base-provider.ts +0 -98
  106. package/src/filesystem/memory-provider.ts +0 -267
  107. package/src/filesystem-manager.ts +0 -213
  108. package/src/orchestrator.ts +0 -177
  109. package/src/sandbox/base-provider.ts +0 -184
  110. package/src/sandbox/daytona-provider.ts +0 -462
  111. package/src/sandbox/e2b-provider.ts +0 -419
  112. package/src/sandbox/modal-provider.ts +0 -597
  113. package/src/sandbox-manager.ts +0 -175
  114. package/src/sdk.ts +0 -401
  115. package/src/types.ts +0 -451
  116. package/src/utils/code-extractor.ts +0 -194
  117. package/tsconfig.json +0 -25
@@ -0,0 +1,32 @@
1
+ import type { OrchestrationRequest, OrchestrationResponse } from './types.js';
2
+ import { AgentManager } from './agent-manager.js';
3
+ /**
4
+ * Orchestrator
5
+ * Coordinates multiple agents for task execution
6
+ */
7
+ export declare class Orchestrator {
8
+ private agentManager;
9
+ constructor(agentManager: AgentManager);
10
+ /**
11
+ * Execute orchestration with multiple agents
12
+ */
13
+ orchestrate(request: OrchestrationRequest): Promise<OrchestrationResponse>;
14
+ /**
15
+ * Sequential orchestration: agents work in sequence, passing results
16
+ */
17
+ private sequentialOrchestration;
18
+ /**
19
+ * Parallel orchestration: agents work simultaneously, results combined
20
+ */
21
+ private parallelOrchestration;
22
+ /**
23
+ * Conditional orchestration: route to agents based on task characteristics
24
+ */
25
+ private conditionalOrchestration;
26
+ /**
27
+ * Register a custom orchestration strategy
28
+ * This allows extending the orchestrator with custom strategies
29
+ */
30
+ addCustomStrategy(name: string, strategy: (request: OrchestrationRequest) => Promise<OrchestrationResponse>): Promise<void>;
31
+ }
32
+ //# sourceMappingURL=orchestrator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../src/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;GAGG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,YAAY,CAAe;gBAEvB,YAAY,EAAE,YAAY;IAItC;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAahF;;OAEG;YACW,uBAAuB;IA4CrC;;OAEG;YACW,qBAAqB;IA6CnC;;OAEG;YACW,wBAAwB;IA+BtC;;;OAGG;IACG,iBAAiB,CACrB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,qBAAqB,CAAC,GAC1E,OAAO,CAAC,IAAI,CAAC;CAKjB"}
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Orchestrator
3
+ * Coordinates multiple agents for task execution
4
+ */
5
+ export class Orchestrator {
6
+ agentManager;
7
+ constructor(agentManager) {
8
+ this.agentManager = agentManager;
9
+ }
10
+ /**
11
+ * Execute orchestration with multiple agents
12
+ */
13
+ async orchestrate(request) {
14
+ switch (request.strategy) {
15
+ case 'sequential':
16
+ return this.sequentialOrchestration(request);
17
+ case 'parallel':
18
+ return this.parallelOrchestration(request);
19
+ case 'conditional':
20
+ return this.conditionalOrchestration(request);
21
+ default:
22
+ throw new Error(`Unknown orchestration strategy: ${request.strategy}`);
23
+ }
24
+ }
25
+ /**
26
+ * Sequential orchestration: agents work in sequence, passing results
27
+ */
28
+ async sequentialOrchestration(request) {
29
+ const { task, agents, options } = request;
30
+ const agentResponses = [];
31
+ let currentTask = { ...task };
32
+ let accumulatedResult = '';
33
+ for (const agentType of agents) {
34
+ const agent = this.agentManager.getAgent(agentType);
35
+ // If passing results, include previous results in the prompt
36
+ if (options?.passResults && accumulatedResult) {
37
+ currentTask = {
38
+ ...currentTask,
39
+ prompt: `${currentTask.prompt}\n\nPrevious results:\n${accumulatedResult}`,
40
+ };
41
+ }
42
+ const response = await agent.execute(currentTask);
43
+ agentResponses.push({
44
+ agentType,
45
+ response: response.text,
46
+ metadata: response.metadata,
47
+ });
48
+ accumulatedResult = response.text;
49
+ // Update task for next iteration if passing results
50
+ if (options?.passResults) {
51
+ currentTask = {
52
+ ...task,
53
+ prompt: response.text,
54
+ };
55
+ }
56
+ }
57
+ return {
58
+ result: accumulatedResult,
59
+ agentResponses,
60
+ strategy: 'sequential',
61
+ };
62
+ }
63
+ /**
64
+ * Parallel orchestration: agents work simultaneously, results combined
65
+ */
66
+ async parallelOrchestration(request) {
67
+ const { task, agents, options } = request;
68
+ // Execute all agents in parallel
69
+ const responses = await Promise.all(agents.map(async (agentType) => {
70
+ const agent = this.agentManager.getAgent(agentType);
71
+ const response = await agent.execute(task);
72
+ return {
73
+ agentType,
74
+ response: response.text,
75
+ metadata: response.metadata,
76
+ };
77
+ }));
78
+ // Combine results based on strategy
79
+ const combineStrategy = options?.combineStrategy || 'merge';
80
+ let result;
81
+ switch (combineStrategy) {
82
+ case 'merge':
83
+ result = responses.map((r) => r.response).join('\n\n---\n\n');
84
+ break;
85
+ case 'first':
86
+ result = responses[0]?.response || '';
87
+ break;
88
+ case 'best':
89
+ // For now, just use the first response
90
+ // This could be enhanced with ranking/scoring logic
91
+ result = responses[0]?.response || '';
92
+ break;
93
+ default:
94
+ result = responses.map((r) => r.response).join('\n\n---\n\n');
95
+ }
96
+ return {
97
+ result,
98
+ agentResponses: responses,
99
+ strategy: 'parallel',
100
+ };
101
+ }
102
+ /**
103
+ * Conditional orchestration: route to agents based on task characteristics
104
+ */
105
+ async conditionalOrchestration(request) {
106
+ const { task, agents, options } = request;
107
+ // Use custom router if provided, otherwise use first agent
108
+ const router = options?.router || (() => agents[0]);
109
+ const selectedAgentType = router(task);
110
+ if (!agents.includes(selectedAgentType)) {
111
+ throw new Error(`Router selected agent ${selectedAgentType} which is not in the agents list`);
112
+ }
113
+ const agent = this.agentManager.getAgent(selectedAgentType);
114
+ const response = await agent.execute(task);
115
+ return {
116
+ result: response.text,
117
+ agentResponses: [
118
+ {
119
+ agentType: selectedAgentType,
120
+ response: response.text,
121
+ metadata: response.metadata,
122
+ },
123
+ ],
124
+ strategy: 'conditional',
125
+ };
126
+ }
127
+ /**
128
+ * Register a custom orchestration strategy
129
+ * This allows extending the orchestrator with custom strategies
130
+ */
131
+ async addCustomStrategy(name, strategy) {
132
+ // Store custom strategies (implementation can be extended)
133
+ // For now, this is a placeholder for future extensibility
134
+ this[`${name}Orchestration`] = strategy;
135
+ }
136
+ }
137
+ //# sourceMappingURL=orchestrator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrator.js","sourceRoot":"","s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ACrB,cAAc,EAAE;gBACd;oBACE,SAAS,EAAE,iBAAiB;oBAC5B,QAAQ,EAAE,QAAQ,CAAC,IAAI;oBACvB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;iBAC5B;aACF;YACD,QAAQ,EAAE,aAAa;SACxB,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,iBAAiB,CACrB,IAAY,EACZ,QAA2E;QAE3E,2DAA2D;QAC3D,0DAA0D;QACzD,IAAY,CAAC,GAAG,IAAI,eAAe,CAAC,GAAG,QAAQ,CAAC;IACnD,CAAC;CACF"}
@@ -0,0 +1,106 @@
1
+ import type { SandboxProviderType, SandboxConfig, CommandResult, CodeExecutionResult, ISandboxProvider, SandboxInfo } from '../types.js';
2
+ /**
3
+ * Base sandbox provider
4
+ * Abstract implementation that provides common functionality
5
+ */
6
+ export declare abstract class BaseSandboxProvider implements ISandboxProvider {
7
+ protected initialized: boolean;
8
+ protected config: SandboxConfig;
9
+ protected sandboxId: string | null;
10
+ protected client: any | null;
11
+ readonly type: SandboxProviderType;
12
+ constructor(type: SandboxProviderType, config?: SandboxConfig);
13
+ abstract getClient(): any;
14
+ /**
15
+ * Initialize/create a sandbox
16
+ * If fromSandboxId is provided in config, will call fromSandbox instead
17
+ */
18
+ initialize(config?: SandboxConfig): Promise<void>;
19
+ /**
20
+ * Provider-specific initialization (creates new sandbox)
21
+ */
22
+ protected abstract initializeSandbox(config?: SandboxConfig): Promise<void>;
23
+ /**
24
+ * Connect to an existing sandbox by ID
25
+ */
26
+ abstract fromSandbox(sandboxId: string, config?: SandboxConfig): Promise<any>;
27
+ /**
28
+ * Check if sandbox is initialized
29
+ */
30
+ isInitialized(): boolean;
31
+ /**
32
+ * Close/cleanup the sandbox
33
+ */
34
+ abstract close(): Promise<void>;
35
+ /**
36
+ * Get sandbox ID
37
+ */
38
+ getSandboxId(): string | null;
39
+ /**
40
+ * Execute a command in the sandbox
41
+ */
42
+ abstract executeCommand(command: string, options?: {
43
+ cwd?: string;
44
+ env?: Record<string, string>;
45
+ timeout?: number;
46
+ }): Promise<CommandResult>;
47
+ /**
48
+ * Run code (e.g., Python, JavaScript) in the sandbox
49
+ */
50
+ abstract runCode(code: string, options?: {
51
+ language?: string;
52
+ env?: Record<string, string>;
53
+ timeout?: number;
54
+ onStdout?: (data: string) => void;
55
+ onStderr?: (data: string) => void;
56
+ }): Promise<CodeExecutionResult>;
57
+ /**
58
+ * Upload a file to the sandbox
59
+ */
60
+ abstract uploadFile(localPath: string, remotePath: string): Promise<void>;
61
+ /**
62
+ * Download a file from the sandbox
63
+ */
64
+ abstract downloadFile(remotePath: string, localPath: string): Promise<void>;
65
+ /**
66
+ * Read a file from the sandbox
67
+ */
68
+ abstract readFile(path: string): Promise<string>;
69
+ /**
70
+ * Write a file to the sandbox
71
+ */
72
+ abstract writeFile(path: string, content: string): Promise<void>;
73
+ /**
74
+ * List files in a directory
75
+ */
76
+ abstract listFiles(path: string): Promise<string[]>;
77
+ /**
78
+ * Check if a file exists
79
+ */
80
+ abstract fileExists(path: string): Promise<boolean>;
81
+ /**
82
+ * Delete a file
83
+ */
84
+ abstract deleteFile(path: string): Promise<void>;
85
+ /**
86
+ * Get sandbox status
87
+ */
88
+ abstract getStatus(): Promise<{
89
+ isRunning: boolean;
90
+ createdAt?: number;
91
+ [key: string]: unknown;
92
+ }>;
93
+ /**
94
+ * Get detailed sandbox information
95
+ */
96
+ abstract getInfo(sandboxId?: string): Promise<SandboxInfo>;
97
+ /**
98
+ * Ensure sandbox is initialized before operation
99
+ */
100
+ protected ensureInitialized(): void;
101
+ /**
102
+ * Normalize path (remove leading/trailing slashes, handle ..)
103
+ */
104
+ protected normalizePath(path: string): string;
105
+ }
106
+ //# sourceMappingURL=base-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-provider.d.ts","sourceRoot":"","sources":["../../src/sandbox/base-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EAC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,OAAO,CAAC;KACxB,CAAC;IAEF;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAE1D;;OAEG;IACH,SAAS,CAAC,iBAAiB,IAAI,IAAI;IAQnC;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAc9C"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Base sandbox provider
3
+ * Abstract implementation that provides common functionality
4
+ */
5
+ export class BaseSandboxProvider {
6
+ initialized = false;
7
+ config = {};
8
+ sandboxId = null;
9
+ client = null;
10
+ type;
11
+ constructor(type, config) {
12
+ this.type = type;
13
+ if (config) {
14
+ this.config = { ...this.config, ...config };
15
+ if (this.getClient) {
16
+ this.client = this.getClient();
17
+ }
18
+ }
19
+ }
20
+ /**
21
+ * Initialize/create a sandbox
22
+ * If fromSandboxId is provided in config, will call fromSandbox instead
23
+ */
24
+ async initialize(config) {
25
+ if (config) {
26
+ this.config = { ...this.config, ...config };
27
+ }
28
+ // If fromSandboxId is provided, use fromSandbox instead of creating new
29
+ if (this.config.fromSandboxId) {
30
+ return this.fromSandbox(this.config.fromSandboxId, config);
31
+ }
32
+ // Otherwise, call the provider-specific initialization
33
+ return this.initializeSandbox(config);
34
+ }
35
+ /**
36
+ * Check if sandbox is initialized
37
+ */
38
+ isInitialized() {
39
+ return this.initialized;
40
+ }
41
+ /**
42
+ * Get sandbox ID
43
+ */
44
+ getSandboxId() {
45
+ return this.sandboxId;
46
+ }
47
+ /**
48
+ * Ensure sandbox is initialized before operation
49
+ */
50
+ ensureInitialized() {
51
+ if (!this.initialized) {
52
+ throw new Error(`Sandbox provider ${this.type} is not initialized. Call initialize() first.`);
53
+ }
54
+ }
55
+ /**
56
+ * Normalize path (remove leading/trailing slashes, handle ..)
57
+ */
58
+ normalizePath(path) {
59
+ return path
60
+ .split('/')
61
+ .filter((segment) => segment !== '' && segment !== '.')
62
+ .reduce((acc, segment) => {
63
+ if (segment === '..') {
64
+ acc.pop();
65
+ }
66
+ else {
67
+ acc.push(segment);
68
+ }
69
+ return acc;
70
+ }, [])
71
+ .join('/');
72
+ }
73
+ }
74
+ //# sourceMappingURL=base-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-provider.js","sourceRoot":"","sources":["../../src/sandbox/base-provider.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,MAAM,OAAgB,mBAAmB;IAC7B,WAAW,GAAG,KAAK,CAAC;IACpB,MAAM,GAAkB,EAAE,CAAC;IAC3B,SAAS,GAAkB,IAAI,CAAC;IAChC,MAAM,GAAe,IAAI,CAAC;IACpB,IAAI,CAAsB;IAE1C,YAAY,IAAyB,EAAE,MAAsB;QAC3D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;YAC5C,IAAG,IAAI,CAAC,SAAS,EAAE,CAAC;gBAClB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;YACjC,CAAC;QACH,CAAC;IACH,CAAC;IAID;;;OAGG;IACH,KAAK,CAAC,UAAU,CAAC,MAAsB;QACrC,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;QAC9C,CAAC;QAED,wEAAwE;QACxE,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QAC7D,CAAC;QAED,uDAAuD;QACvD,OAAO,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAYD;;OAEG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAOD;;OAEG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IA6ED;;OAEG;IACO,iBAAiB;QACzB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CACb,oBAAoB,IAAI,CAAC,IAAI,+CAA+C,CAC7E,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;OAEG;IACO,aAAa,CAAC,IAAY;QAClC,OAAO,IAAI;aACR,KAAK,CAAC,GAAG,CAAC;aACV,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,EAAE,IAAI,OAAO,KAAK,GAAG,CAAC;aACtD,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;YACvB,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;gBACrB,GAAG,CAAC,GAAG,EAAE,CAAC;YACZ,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACpB,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAc,CAAC;aACjB,IAAI,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;CACF"}
@@ -0,0 +1,93 @@
1
+ import { BaseSandboxProvider } from './base-provider.js';
2
+ import type { SandboxConfig, CommandResult, CodeExecutionResult, SandboxInfo } from '../types.js';
3
+ import { Daytona, Sandbox } from '@daytonaio/sdk';
4
+ /**
5
+ * Daytona Sandbox Provider
6
+ * Provides sandbox execution capabilities using Daytona
7
+ */
8
+ export declare class DaytonaSandboxProvider extends BaseSandboxProvider {
9
+ protected client: Daytona | null;
10
+ private sandboxInstance;
11
+ constructor(config?: SandboxConfig);
12
+ getClient(): Daytona;
13
+ /**
14
+ * Initialize/create a Daytona sandbox
15
+ */
16
+ protected initializeSandbox(config?: SandboxConfig): Promise<void>;
17
+ /**
18
+ * Connect to an existing Daytona sandbox by ID
19
+ */
20
+ fromSandbox(sandboxId: string, config?: SandboxConfig): Promise<Sandbox>;
21
+ /**
22
+ * Close/cleanup the Daytona sandbox
23
+ */
24
+ close(): Promise<void>;
25
+ /**
26
+ * Execute a command in the Daytona sandbox
27
+ * @param command - Command to execute
28
+ * @param options - Execution options (cwd, env, timeout)
29
+ */
30
+ executeCommand(command: string, options?: {
31
+ cwd?: string;
32
+ env?: Record<string, string>;
33
+ timeout?: number;
34
+ }): Promise<CommandResult>;
35
+ /**
36
+ * Run code (e.g., Python, JavaScript, TypeScript) in the Daytona sandbox
37
+ * Uses the stateless codeRun method: https://www.daytona.io/docs/en/process-code-execution/
38
+ */
39
+ runCode(code: string, options?: {
40
+ language?: string;
41
+ env?: Record<string, string>;
42
+ timeout?: number;
43
+ onStdout?: (data: string) => void;
44
+ onStderr?: (data: string) => void;
45
+ }): Promise<CodeExecutionResult>;
46
+ /**
47
+ * Upload a file to the Daytona sandbox
48
+ * Uses fs.uploadFile: https://www.daytona.io/docs/en/file-system-operations/
49
+ */
50
+ uploadFile(localPath: string, remotePath: string): Promise<void>;
51
+ /**
52
+ * Download a file from the Daytona sandbox
53
+ * Uses fs.downloadFile: https://www.daytona.io/docs/en/file-system-operations/
54
+ */
55
+ downloadFile(remotePath: string, localPath: string): Promise<void>;
56
+ /**
57
+ * Read a file from the Daytona sandbox
58
+ * Uses fs.downloadFile: https://www.daytona.io/docs/en/file-system-operations/
59
+ */
60
+ readFile(path: string): Promise<string>;
61
+ /**
62
+ * Write a file to the Daytona sandbox
63
+ * Uses fs.uploadFile: https://www.daytona.io/docs/en/file-system-operations/
64
+ */
65
+ writeFile(path: string, content: string): Promise<void>;
66
+ /**
67
+ * List files in a directory
68
+ * Uses fs.listFiles: https://www.daytona.io/docs/en/file-system-operations/
69
+ */
70
+ listFiles(path: string): Promise<string[]>;
71
+ /**
72
+ * Check if a file exists
73
+ */
74
+ fileExists(path: string): Promise<boolean>;
75
+ /**
76
+ * Delete a file
77
+ * Uses fs.deleteFile: https://www.daytona.io/docs/en/file-system-operations/
78
+ */
79
+ deleteFile(path: string): Promise<void>;
80
+ /**
81
+ * Get sandbox status
82
+ */
83
+ getStatus(): Promise<{
84
+ isRunning: boolean;
85
+ createdAt?: number;
86
+ [key: string]: unknown;
87
+ }>;
88
+ /**
89
+ * Get detailed sandbox information
90
+ */
91
+ getInfo(sandboxId?: string): Promise<SandboxInfo>;
92
+ }
93
+ //# sourceMappingURL=daytona-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daytona-provider.d.ts","sourceRoot":"","sources":["../../src/sandbox/daytona-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClG,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC7D,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAQ;IACxC,OAAO,CAAC,eAAe,CAAwB;gBAEnC,MAAM,CAAC,EAAE,aAAa;IAQlC,SAAS,IAAI,OAAO;IAkBpB;;OAEG;cACa,iBAAiB,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IA+CxE;;OAEG;IACG,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC;IA4B9E;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAe5B;;;;OAIG;IACG,cAAc,CAClB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAA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