@intella/sdk 0.0.1 → 0.0.2

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 (120) hide show
  1. package/dist/agent-manager.d.ts +47 -0
  2. package/dist/agent-manager.d.ts.map +1 -0
  3. package/dist/agent-manager.js +90 -0
  4. package/dist/agent-manager.js.map +1 -0
  5. package/dist/agents/base-agent.d.ts +41 -0
  6. package/dist/agents/base-agent.d.ts.map +1 -0
  7. package/dist/agents/base-agent.js +139 -0
  8. package/dist/agents/base-agent.js.map +1 -0
  9. package/dist/agents/claude-agent.d.ts +24 -0
  10. package/dist/agents/claude-agent.d.ts.map +1 -0
  11. package/dist/agents/claude-agent.js +65 -0
  12. package/dist/agents/claude-agent.js.map +1 -0
  13. package/dist/agents/codex-agent.d.ts +25 -0
  14. package/dist/agents/codex-agent.d.ts.map +1 -0
  15. package/dist/agents/codex-agent.js +62 -0
  16. package/dist/agents/codex-agent.js.map +1 -0
  17. package/dist/agents/intella-lite-agent.d.ts +21 -0
  18. package/dist/agents/intella-lite-agent.d.ts.map +1 -0
  19. package/dist/agents/intella-lite-agent.js +43 -0
  20. package/dist/agents/intella-lite-agent.js.map +1 -0
  21. package/dist/agents/opencode-agent.d.ts +20 -0
  22. package/dist/agents/opencode-agent.d.ts.map +1 -0
  23. package/dist/agents/opencode-agent.js +36 -0
  24. package/dist/agents/opencode-agent.js.map +1 -0
  25. package/dist/filesystem/agentfs-provider.d.ts +42 -0
  26. package/dist/filesystem/agentfs-provider.d.ts.map +1 -0
  27. package/dist/filesystem/agentfs-provider.js +308 -0
  28. package/dist/filesystem/agentfs-provider.js.map +1 -0
  29. package/dist/filesystem/base-provider.d.ts +55 -0
  30. package/dist/filesystem/base-provider.d.ts.map +1 -0
  31. package/dist/filesystem/base-provider.js +44 -0
  32. package/dist/filesystem/base-provider.js.map +1 -0
  33. package/dist/filesystem/index.d.ts +4 -0
  34. package/dist/filesystem/index.d.ts.map +1 -0
  35. package/{src/filesystem/index.ts → dist/filesystem/index.js} +1 -1
  36. package/dist/filesystem/index.js.map +1 -0
  37. package/dist/filesystem/memory-provider.d.ts +44 -0
  38. package/dist/filesystem/memory-provider.d.ts.map +1 -0
  39. package/dist/filesystem/memory-provider.js +227 -0
  40. package/dist/filesystem/memory-provider.js.map +1 -0
  41. package/dist/filesystem-manager.d.ts +75 -0
  42. package/dist/filesystem-manager.d.ts.map +1 -0
  43. package/dist/filesystem-manager.js +164 -0
  44. package/dist/filesystem-manager.js.map +1 -0
  45. package/dist/index.d.ts +18 -0
  46. package/dist/index.d.ts.map +1 -0
  47. package/{src/index.ts → dist/index.js} +3 -46
  48. package/dist/index.js.map +1 -0
  49. package/dist/orchestrator.d.ts +32 -0
  50. package/dist/orchestrator.d.ts.map +1 -0
  51. package/dist/orchestrator.js +136 -0
  52. package/dist/orchestrator.js.map +1 -0
  53. package/dist/sandbox/base-provider.d.ts +106 -0
  54. package/dist/sandbox/base-provider.d.ts.map +1 -0
  55. package/dist/sandbox/base-provider.js +73 -0
  56. package/dist/sandbox/base-provider.js.map +1 -0
  57. package/dist/sandbox/daytona-provider.d.ts +93 -0
  58. package/dist/sandbox/daytona-provider.d.ts.map +1 -0
  59. package/dist/sandbox/daytona-provider.js +378 -0
  60. package/dist/sandbox/daytona-provider.js.map +1 -0
  61. package/dist/sandbox/e2b-provider.d.ts +85 -0
  62. package/dist/sandbox/e2b-provider.d.ts.map +1 -0
  63. package/dist/sandbox/e2b-provider.js +342 -0
  64. package/dist/sandbox/e2b-provider.js.map +1 -0
  65. package/dist/sandbox/modal-provider.d.ts +92 -0
  66. package/dist/sandbox/modal-provider.d.ts.map +1 -0
  67. package/dist/sandbox/modal-provider.js +516 -0
  68. package/dist/sandbox/modal-provider.js.map +1 -0
  69. package/dist/sandbox-manager.d.ts +59 -0
  70. package/dist/sandbox-manager.d.ts.map +1 -0
  71. package/dist/sandbox-manager.js +141 -0
  72. package/dist/sandbox-manager.js.map +1 -0
  73. package/dist/sdk.d.ts +173 -0
  74. package/dist/sdk.d.ts.map +1 -0
  75. package/dist/sdk.js +273 -0
  76. package/dist/sdk.js.map +1 -0
  77. package/dist/types.d.ts +419 -0
  78. package/dist/types.d.ts.map +1 -0
  79. package/dist/types.js +2 -0
  80. package/dist/types.js.map +1 -0
  81. package/dist/utils/code-extractor.d.ts +103 -0
  82. package/dist/utils/code-extractor.d.ts.map +1 -0
  83. package/dist/utils/code-extractor.js +133 -0
  84. package/dist/utils/code-extractor.js.map +1 -0
  85. package/package.json +6 -1
  86. package/examples/claude-code/README.md +0 -178
  87. package/examples/claude-code/advanced-config.ts +0 -55
  88. package/examples/claude-code/basic-usage.ts +0 -56
  89. package/examples/claude-code/model-comparison.ts +0 -50
  90. package/examples/claude-code/orchestration.ts +0 -70
  91. package/examples/claude-code/streaming.ts +0 -69
  92. package/examples/claude-code/tsconfig.json +0 -19
  93. package/examples/code-extractor/README.md +0 -77
  94. package/examples/code-extractor/example.ts +0 -145
  95. package/examples/filesystem/basic-usage.ts +0 -84
  96. package/examples/integrated-task/README.md +0 -68
  97. package/examples/integrated-task/integrated-usage.ts +0 -193
  98. package/examples/integrated-task/simple-example.ts +0 -51
  99. package/examples/integrated-task/tsconfig.json +0 -19
  100. package/examples/sandbox/basic-usage.ts +0 -173
  101. package/src/agent-manager.ts +0 -104
  102. package/src/agents/base-agent.ts +0 -166
  103. package/src/agents/claude-agent.ts +0 -77
  104. package/src/agents/codex-agent.ts +0 -72
  105. package/src/agents/intella-lite-agent.ts +0 -55
  106. package/src/agents/opencode-agent.ts +0 -45
  107. package/src/filesystem/agentfs-provider.ts +0 -328
  108. package/src/filesystem/base-provider.ts +0 -98
  109. package/src/filesystem/memory-provider.ts +0 -267
  110. package/src/filesystem-manager.ts +0 -213
  111. package/src/orchestrator.ts +0 -177
  112. package/src/sandbox/base-provider.ts +0 -184
  113. package/src/sandbox/daytona-provider.ts +0 -462
  114. package/src/sandbox/e2b-provider.ts +0 -419
  115. package/src/sandbox/modal-provider.ts +0 -597
  116. package/src/sandbox-manager.ts +0 -175
  117. package/src/sdk.ts +0 -401
  118. package/src/types.ts +0 -451
  119. package/src/utils/code-extractor.ts +0 -194
  120. package/tsconfig.json +0 -25
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Orchestrator
3
+ * Coordinates multiple agents for task execution
4
+ */
5
+ export class Orchestrator {
6
+ constructor(agentManager) {
7
+ this.agentManager = agentManager;
8
+ }
9
+ /**
10
+ * Execute orchestration with multiple agents
11
+ */
12
+ async orchestrate(request) {
13
+ switch (request.strategy) {
14
+ case 'sequential':
15
+ return this.sequentialOrchestration(request);
16
+ case 'parallel':
17
+ return this.parallelOrchestration(request);
18
+ case 'conditional':
19
+ return this.conditionalOrchestration(request);
20
+ default:
21
+ throw new Error(`Unknown orchestration strategy: ${request.strategy}`);
22
+ }
23
+ }
24
+ /**
25
+ * Sequential orchestration: agents work in sequence, passing results
26
+ */
27
+ async sequentialOrchestration(request) {
28
+ const { task, agents, options } = request;
29
+ const agentResponses = [];
30
+ let currentTask = { ...task };
31
+ let accumulatedResult = '';
32
+ for (const agentType of agents) {
33
+ const agent = this.agentManager.getAgent(agentType);
34
+ // If passing results, include previous results in the prompt
35
+ if (options?.passResults && accumulatedResult) {
36
+ currentTask = {
37
+ ...currentTask,
38
+ prompt: `${currentTask.prompt}\n\nPrevious results:\n${accumulatedResult}`,
39
+ };
40
+ }
41
+ const response = await agent.execute(currentTask);
42
+ agentResponses.push({
43
+ agentType,
44
+ response: response.text,
45
+ metadata: response.metadata,
46
+ });
47
+ accumulatedResult = response.text;
48
+ // Update task for next iteration if passing results
49
+ if (options?.passResults) {
50
+ currentTask = {
51
+ ...task,
52
+ prompt: response.text,
53
+ };
54
+ }
55
+ }
56
+ return {
57
+ result: accumulatedResult,
58
+ agentResponses,
59
+ strategy: 'sequential',
60
+ };
61
+ }
62
+ /**
63
+ * Parallel orchestration: agents work simultaneously, results combined
64
+ */
65
+ async parallelOrchestration(request) {
66
+ const { task, agents, options } = request;
67
+ // Execute all agents in parallel
68
+ const responses = await Promise.all(agents.map(async (agentType) => {
69
+ const agent = this.agentManager.getAgent(agentType);
70
+ const response = await agent.execute(task);
71
+ return {
72
+ agentType,
73
+ response: response.text,
74
+ metadata: response.metadata,
75
+ };
76
+ }));
77
+ // Combine results based on strategy
78
+ const combineStrategy = options?.combineStrategy || 'merge';
79
+ let result;
80
+ switch (combineStrategy) {
81
+ case 'merge':
82
+ result = responses.map((r) => r.response).join('\n\n---\n\n');
83
+ break;
84
+ case 'first':
85
+ result = responses[0]?.response || '';
86
+ break;
87
+ case 'best':
88
+ // For now, just use the first response
89
+ // This could be enhanced with ranking/scoring logic
90
+ result = responses[0]?.response || '';
91
+ break;
92
+ default:
93
+ result = responses.map((r) => r.response).join('\n\n---\n\n');
94
+ }
95
+ return {
96
+ result,
97
+ agentResponses: responses,
98
+ strategy: 'parallel',
99
+ };
100
+ }
101
+ /**
102
+ * Conditional orchestration: route to agents based on task characteristics
103
+ */
104
+ async conditionalOrchestration(request) {
105
+ const { task, agents, options } = request;
106
+ // Use custom router if provided, otherwise use first agent
107
+ const router = options?.router || (() => agents[0]);
108
+ const selectedAgentType = router(task);
109
+ if (!agents.includes(selectedAgentType)) {
110
+ throw new Error(`Router selected agent ${selectedAgentType} which is not in the agents list`);
111
+ }
112
+ const agent = this.agentManager.getAgent(selectedAgentType);
113
+ const response = await agent.execute(task);
114
+ return {
115
+ result: response.text,
116
+ agentResponses: [
117
+ {
118
+ agentType: selectedAgentType,
119
+ response: response.text,
120
+ metadata: response.metadata,
121
+ },
122
+ ],
123
+ strategy: 'conditional',
124
+ };
125
+ }
126
+ /**
127
+ * Register a custom orchestration strategy
128
+ * This allows extending the orchestrator with custom strategies
129
+ */
130
+ async addCustomStrategy(name, strategy) {
131
+ // Store custom strategies (implementation can be extended)
132
+ // For now, this is a placeholder for future extensibility
133
+ this[`${name}Orchestration`] = strategy;
134
+ }
135
+ }
136
+ //# sourceMappingURL=orchestrator.js.map
@@ -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,MAAM,EAAE,QAAQ,CAAC,IAAI;YACrB,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,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ACnB,CAAC,GAAG,EAAE,MAAM,GAAG,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,73 @@
1
+ /**
2
+ * Base sandbox provider
3
+ * Abstract implementation that provides common functionality
4
+ */
5
+ export class BaseSandboxProvider {
6
+ constructor(type, config) {
7
+ this.initialized = false;
8
+ this.config = {};
9
+ this.sandboxId = null;
10
+ this.client = null;
11
+ this.type = type;
12
+ if (config) {
13
+ this.config = { ...this.config, ...config };
14
+ if (this.getClient) {
15
+ this.client = this.getClient();
16
+ }
17
+ }
18
+ }
19
+ /**
20
+ * Initialize/create a sandbox
21
+ * If fromSandboxId is provided in config, will call fromSandbox instead
22
+ */
23
+ async initialize(config) {
24
+ if (config) {
25
+ this.config = { ...this.config, ...config };
26
+ }
27
+ // If fromSandboxId is provided, use fromSandbox instead of creating new
28
+ if (this.config.fromSandboxId) {
29
+ return this.fromSandbox(this.config.fromSandboxId, config);
30
+ }
31
+ // Otherwise, call the provider-specific initialization
32
+ return this.initializeSandbox(config);
33
+ }
34
+ /**
35
+ * Check if sandbox is initialized
36
+ */
37
+ isInitialized() {
38
+ return this.initialized;
39
+ }
40
+ /**
41
+ * Get sandbox ID
42
+ */
43
+ getSandboxId() {
44
+ return this.sandboxId;
45
+ }
46
+ /**
47
+ * Ensure sandbox is initialized before operation
48
+ */
49
+ ensureInitialized() {
50
+ if (!this.initialized) {
51
+ throw new Error(`Sandbox provider ${this.type} is not initialized. Call initialize() first.`);
52
+ }
53
+ }
54
+ /**
55
+ * Normalize path (remove leading/trailing slashes, handle ..)
56
+ */
57
+ normalizePath(path) {
58
+ return path
59
+ .split('/')
60
+ .filter((segment) => segment !== '' && segment !== '.')
61
+ .reduce((acc, segment) => {
62
+ if (segment === '..') {
63
+ acc.pop();
64
+ }
65
+ else {
66
+ acc.push(segment);
67
+ }
68
+ return acc;
69
+ }, [])
70
+ .join('/');
71
+ }
72
+ }
73
+ //# 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;IAOvC,YAAY,IAAyB,EAAE,MAAsB;QANnD,gBAAW,GAAG,KAAK,CAAC;QACpB,WAAM,GAAkB,EAAE,CAAC;QAC3B,cAAS,GAAkB,IAAI,CAAC;QAChC,WAAM,GAAe,IAAI,CAAC;QAIlC,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,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