@jamesmurdza/opencode-daytona 0.1.14 → 0.1.16

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 (134) hide show
  1. package/.opencode/plugin/daytona/core/logger.d.ts +15 -0
  2. package/.opencode/plugin/daytona/core/logger.d.ts.map +1 -0
  3. package/.opencode/plugin/daytona/core/logger.js +43 -0
  4. package/.opencode/plugin/daytona/core/logger.js.map +1 -0
  5. package/.opencode/plugin/daytona/core/project-data-storage.d.ts +38 -0
  6. package/.opencode/plugin/daytona/core/project-data-storage.d.ts.map +1 -0
  7. package/.opencode/plugin/daytona/core/project-data-storage.js +130 -0
  8. package/.opencode/plugin/daytona/core/project-data-storage.js.map +1 -0
  9. package/.opencode/plugin/daytona/core/session-manager.d.ts +42 -0
  10. package/.opencode/plugin/daytona/core/session-manager.d.ts.map +1 -0
  11. package/.opencode/plugin/daytona/core/session-manager.js +151 -0
  12. package/.opencode/plugin/daytona/core/session-manager.js.map +1 -0
  13. package/.opencode/plugin/daytona/core/types.d.ts +51 -0
  14. package/.opencode/plugin/daytona/core/types.d.ts.map +1 -0
  15. package/.opencode/plugin/daytona/core/types.js +11 -0
  16. package/.opencode/plugin/daytona/core/types.js.map +1 -0
  17. package/.opencode/plugin/daytona/git/host-git-manager.d.ts +13 -0
  18. package/.opencode/plugin/daytona/git/host-git-manager.d.ts.map +1 -0
  19. package/.opencode/plugin/daytona/git/host-git-manager.js +97 -0
  20. package/.opencode/plugin/daytona/git/host-git-manager.js.map +1 -0
  21. package/.opencode/plugin/daytona/git/index.d.ts +2 -0
  22. package/.opencode/plugin/daytona/git/index.d.ts.map +1 -0
  23. package/.opencode/plugin/daytona/git/index.js +2 -0
  24. package/.opencode/plugin/daytona/git/index.js.map +1 -0
  25. package/.opencode/plugin/daytona/git/sandbox-git-manager.d.ts +10 -0
  26. package/.opencode/plugin/daytona/git/sandbox-git-manager.d.ts.map +1 -0
  27. package/.opencode/plugin/daytona/git/sandbox-git-manager.js +49 -0
  28. package/.opencode/plugin/daytona/git/sandbox-git-manager.js.map +1 -0
  29. package/.opencode/plugin/daytona/git/session-git-manager.d.ts +25 -0
  30. package/.opencode/plugin/daytona/git/session-git-manager.d.ts.map +1 -0
  31. package/.opencode/plugin/daytona/git/session-git-manager.js +52 -0
  32. package/.opencode/plugin/daytona/git/session-git-manager.js.map +1 -0
  33. package/.opencode/plugin/daytona/index.d.ts +26 -0
  34. package/.opencode/plugin/daytona/index.d.ts.map +1 -0
  35. package/.opencode/plugin/daytona/index.js +37 -0
  36. package/.opencode/plugin/daytona/index.js.map +1 -0
  37. package/.opencode/plugin/daytona/plugins/custom-tools.d.ts +8 -0
  38. package/.opencode/plugin/daytona/plugins/custom-tools.d.ts.map +1 -0
  39. package/.opencode/plugin/daytona/plugins/custom-tools.js +17 -0
  40. package/.opencode/plugin/daytona/plugins/custom-tools.js.map +1 -0
  41. package/.opencode/plugin/daytona/plugins/index.d.ts +8 -0
  42. package/.opencode/plugin/daytona/plugins/index.d.ts.map +1 -0
  43. package/.opencode/plugin/daytona/plugins/{index.ts → index.js} +5 -5
  44. package/.opencode/plugin/daytona/plugins/index.js.map +1 -0
  45. package/.opencode/plugin/daytona/plugins/session-cleanup.d.ts +8 -0
  46. package/.opencode/plugin/daytona/plugins/session-cleanup.d.ts.map +1 -0
  47. package/.opencode/plugin/daytona/plugins/session-cleanup.js +19 -0
  48. package/.opencode/plugin/daytona/plugins/session-cleanup.js.map +1 -0
  49. package/.opencode/plugin/daytona/plugins/session-idle-auto-commit.d.ts +7 -0
  50. package/.opencode/plugin/daytona/plugins/session-idle-auto-commit.d.ts.map +1 -0
  51. package/.opencode/plugin/daytona/plugins/session-idle-auto-commit.js +28 -0
  52. package/.opencode/plugin/daytona/plugins/session-idle-auto-commit.js.map +1 -0
  53. package/.opencode/plugin/daytona/plugins/system-transform.d.ts +7 -0
  54. package/.opencode/plugin/daytona/plugins/system-transform.d.ts.map +1 -0
  55. package/.opencode/plugin/daytona/plugins/system-transform.js +20 -0
  56. package/.opencode/plugin/daytona/plugins/system-transform.js.map +1 -0
  57. package/.opencode/plugin/daytona/tools/bash.d.ts +15 -0
  58. package/.opencode/plugin/daytona/tools/bash.d.ts.map +1 -0
  59. package/.opencode/plugin/daytona/tools/bash.js +31 -0
  60. package/.opencode/plugin/daytona/tools/bash.js.map +1 -0
  61. package/.opencode/plugin/daytona/tools/edit.d.ts +17 -0
  62. package/.opencode/plugin/daytona/tools/edit.d.ts.map +1 -0
  63. package/.opencode/plugin/daytona/tools/edit.js +19 -0
  64. package/.opencode/plugin/daytona/tools/edit.js.map +1 -0
  65. package/.opencode/plugin/daytona/tools/get-preview-url.d.ts +13 -0
  66. package/.opencode/plugin/daytona/tools/get-preview-url.d.ts.map +1 -0
  67. package/.opencode/plugin/daytona/tools/get-preview-url.js +13 -0
  68. package/.opencode/plugin/daytona/tools/get-preview-url.js.map +1 -0
  69. package/.opencode/plugin/daytona/tools/glob.d.ts +13 -0
  70. package/.opencode/plugin/daytona/tools/glob.d.ts.map +1 -0
  71. package/.opencode/plugin/daytona/tools/glob.js +17 -0
  72. package/.opencode/plugin/daytona/tools/glob.js.map +1 -0
  73. package/.opencode/plugin/daytona/tools/grep.d.ts +13 -0
  74. package/.opencode/plugin/daytona/tools/grep.d.ts.map +1 -0
  75. package/.opencode/plugin/daytona/tools/grep.js +17 -0
  76. package/.opencode/plugin/daytona/tools/grep.js.map +1 -0
  77. package/.opencode/plugin/daytona/tools/ls.d.ts +13 -0
  78. package/.opencode/plugin/daytona/tools/ls.d.ts.map +1 -0
  79. package/.opencode/plugin/daytona/tools/ls.js +18 -0
  80. package/.opencode/plugin/daytona/tools/ls.js.map +1 -0
  81. package/.opencode/plugin/daytona/tools/lsp.d.ts +17 -0
  82. package/.opencode/plugin/daytona/tools/lsp.d.ts.map +1 -0
  83. package/.opencode/plugin/daytona/tools/lsp.js +13 -0
  84. package/.opencode/plugin/daytona/tools/lsp.js.map +1 -0
  85. package/.opencode/plugin/daytona/tools/multiedit.d.ts +21 -0
  86. package/.opencode/plugin/daytona/tools/multiedit.d.ts.map +1 -0
  87. package/.opencode/plugin/daytona/tools/multiedit.js +23 -0
  88. package/.opencode/plugin/daytona/tools/multiedit.js.map +1 -0
  89. package/.opencode/plugin/daytona/tools/patch.d.ts +17 -0
  90. package/.opencode/plugin/daytona/tools/patch.d.ts.map +1 -0
  91. package/.opencode/plugin/daytona/tools/patch.js +19 -0
  92. package/.opencode/plugin/daytona/tools/patch.js.map +1 -0
  93. package/.opencode/plugin/daytona/tools/read.d.ts +13 -0
  94. package/.opencode/plugin/daytona/tools/read.d.ts.map +1 -0
  95. package/.opencode/plugin/daytona/tools/read.js +14 -0
  96. package/.opencode/plugin/daytona/tools/read.js.map +1 -0
  97. package/.opencode/plugin/daytona/tools/write.d.ts +15 -0
  98. package/.opencode/plugin/daytona/tools/write.d.ts.map +1 -0
  99. package/.opencode/plugin/daytona/tools/write.js +14 -0
  100. package/.opencode/plugin/daytona/tools/write.js.map +1 -0
  101. package/.opencode/plugin/daytona/tools.d.ts +130 -0
  102. package/.opencode/plugin/daytona/tools.d.ts.map +1 -0
  103. package/.opencode/plugin/daytona/tools.js +30 -0
  104. package/.opencode/plugin/daytona/tools.js.map +1 -0
  105. package/.opencode/plugin/index.d.ts +6 -0
  106. package/.opencode/plugin/index.d.ts.map +1 -0
  107. package/.opencode/plugin/{index.ts → index.js} +2 -1
  108. package/.opencode/plugin/index.js.map +1 -0
  109. package/package.json +6 -1
  110. package/.opencode/plugin/daytona/core/logger.ts +0 -50
  111. package/.opencode/plugin/daytona/core/project-data-storage.ts +0 -154
  112. package/.opencode/plugin/daytona/core/session-manager.ts +0 -170
  113. package/.opencode/plugin/daytona/core/types.ts +0 -68
  114. package/.opencode/plugin/daytona/git/host-git-manager.ts +0 -94
  115. package/.opencode/plugin/daytona/git/index.ts +0 -1
  116. package/.opencode/plugin/daytona/git/sandbox-git-manager.ts +0 -51
  117. package/.opencode/plugin/daytona/git/session-git-manager.ts +0 -65
  118. package/.opencode/plugin/daytona/index.ts +0 -50
  119. package/.opencode/plugin/daytona/plugins/custom-tools.ts +0 -20
  120. package/.opencode/plugin/daytona/plugins/session-cleanup.ts +0 -22
  121. package/.opencode/plugin/daytona/plugins/session-idle-auto-commit.ts +0 -30
  122. package/.opencode/plugin/daytona/plugins/system-transform.ts +0 -28
  123. package/.opencode/plugin/daytona/tools/bash.ts +0 -32
  124. package/.opencode/plugin/daytona/tools/edit.ts +0 -21
  125. package/.opencode/plugin/daytona/tools/get-preview-url.ts +0 -15
  126. package/.opencode/plugin/daytona/tools/glob.ts +0 -16
  127. package/.opencode/plugin/daytona/tools/grep.ts +0 -16
  128. package/.opencode/plugin/daytona/tools/ls.ts +0 -18
  129. package/.opencode/plugin/daytona/tools/lsp.ts +0 -15
  130. package/.opencode/plugin/daytona/tools/multiedit.ts +0 -32
  131. package/.opencode/plugin/daytona/tools/patch.ts +0 -21
  132. package/.opencode/plugin/daytona/tools/read.ts +0 -16
  133. package/.opencode/plugin/daytona/tools/write.ts +0 -16
  134. package/.opencode/plugin/daytona/tools.ts +0 -33
@@ -1,22 +0,0 @@
1
- import type { Plugin, PluginInput } from '@opencode-ai/plugin'
2
- import type { DaytonaSessionManager } from '../core/session-manager'
3
- import { EVENT_TYPE_SESSION_DELETED } from '../core/types'
4
- import type { EventSessionDeleted } from '../core/types'
5
-
6
- /**
7
- * Creates the session cleanup plugin for Daytona
8
- * Automatically cleans up sandbox resources when sessions end
9
- */
10
- export function createSessionCleanupPlugin(sessionManager: DaytonaSessionManager): Plugin {
11
- return async (pluginCtx: PluginInput) => {
12
- const projectId = pluginCtx.project.id
13
- return {
14
- event: async ({ event }) => {
15
- if (event.type === EVENT_TYPE_SESSION_DELETED) {
16
- const sessionId = (event as EventSessionDeleted).properties.info.id
17
- await sessionManager.deleteSandbox(sessionId, projectId)
18
- }
19
- },
20
- }
21
- }
22
- }
@@ -1,30 +0,0 @@
1
- import type { Plugin, PluginInput } from '@opencode-ai/plugin'
2
- import type { DaytonaSessionManager } from '../core/session-manager'
3
- import { SessionGitManager } from '../git/session-git-manager'
4
- import { EVENT_TYPE_SESSION_IDLE } from '../core/types'
5
-
6
- /**
7
- * Creates a plugin to auto-commit in the sandbox on session idle
8
- */
9
- export function createSessionIdleAutoCommitPlugin(sessionManager: DaytonaSessionManager, repoPath: string): Plugin {
10
- return async (pluginCtx: PluginInput) => {
11
- const projectId = pluginCtx.project.id
12
- const worktree = pluginCtx.project.worktree
13
- return {
14
- event: async (args: any) => {
15
- const event = args.event
16
- if (event.type === EVENT_TYPE_SESSION_IDLE) {
17
- const sessionId = event.properties.sessionID
18
- // Use SessionGitManager abstraction for auto-commit and pull
19
- const sandbox = await sessionManager.getSandbox(sessionId, projectId, worktree)
20
- const branchNumber = sessionManager.getBranchNumberForSandbox(projectId, sandbox.id)
21
- if (!branchNumber) {
22
- throw new Error(`No branch number found for sandbox ${sandbox.id}`)
23
- }
24
- const sessionGit = new SessionGitManager(sandbox, repoPath, branchNumber)
25
- await sessionGit.autoCommitAndPull()
26
- }
27
- },
28
- }
29
- }
30
- }
@@ -1,28 +0,0 @@
1
- import type { Plugin, PluginInput } from '@opencode-ai/plugin'
2
- import type {
3
- ExperimentalChatSystemTransformInput,
4
- ExperimentalChatSystemTransformOutput,
5
- } from '../core/types'
6
-
7
- /**
8
- * Creates the system transform plugin for Daytona
9
- * Adds Daytona-specific instructions to the system prompt
10
- */
11
- export function createSystemTransformPlugin(repoPath: string): Plugin {
12
- return async (pluginCtx: PluginInput) => {
13
- return {
14
- 'experimental.chat.system.transform': async (
15
- input: ExperimentalChatSystemTransformInput,
16
- output: ExperimentalChatSystemTransformOutput,
17
- ) => {
18
- output.system.push(`
19
- ## Daytona Sandbox Integration
20
- This session is integrated with a Daytona sandbox.
21
- The main project repository is located at: ${repoPath}.
22
- Work in this directory. Do NOT try to use the current working directory of the host system.
23
- When executing long-running commands, use the 'background' option to run them asynchronously.
24
- `)
25
- },
26
- }
27
- }
28
- }
@@ -1,32 +0,0 @@
1
- import { z } from 'zod'
2
- import type { ToolContext } from '@opencode-ai/plugin'
3
- import type { DaytonaSessionManager } from '../core/session-manager'
4
-
5
- export const bashTool = (sessionManager: DaytonaSessionManager, projectId: string, worktree: string) => ({
6
- description: 'Executes shell commands in a Daytona sandbox',
7
- args: {
8
- command: z.string(),
9
- background: z.boolean().optional(),
10
- },
11
- async execute(args: { command: string; background?: boolean }, ctx: ToolContext) {
12
- const sessionId = ctx.sessionID
13
- const sandbox = await sessionManager.getSandbox(sessionId, projectId, worktree)
14
-
15
- if (args.background) {
16
- const execSessionId = `exec-session-${sessionId}`
17
- try {
18
- await sandbox.process.getSession(execSessionId)
19
- } catch {
20
- await sandbox.process.createSession(execSessionId)
21
- }
22
- const result = await sandbox.process.executeSessionCommand(execSessionId, {
23
- command: args.command,
24
- runAsync: true,
25
- })
26
- return `Command started in background (cmdId: ${result.cmdId})`
27
- } else {
28
- const result = await sandbox.process.executeCommand(args.command)
29
- return `Exit code: ${result.exitCode}\n${result.result}`
30
- }
31
- },
32
- })
@@ -1,21 +0,0 @@
1
- import { z } from 'zod'
2
- import type { ToolContext } from '@opencode-ai/plugin'
3
- import type { DaytonaSessionManager } from '../core/session-manager'
4
-
5
- export const editTool = (sessionManager: DaytonaSessionManager, projectId: string, worktree: string) => ({
6
- description: 'Replaces text in a file in Daytona sandbox',
7
- args: {
8
- filePath: z.string(),
9
- oldString: z.string(),
10
- newString: z.string(),
11
- },
12
- async execute(args: { filePath: string; oldString: string; newString: string }, ctx: ToolContext) {
13
- const sandbox = await sessionManager.getSandbox(ctx.sessionID, projectId, worktree)
14
- const buffer = await sandbox.fs.downloadFile(args.filePath)
15
- const decoder = new TextDecoder()
16
- const content = decoder.decode(buffer)
17
- const newContent = content.replace(args.oldString, args.newString)
18
- await sandbox.fs.uploadFile(Buffer.from(newContent), args.filePath)
19
- return `Edited ${args.filePath}`
20
- },
21
- })
@@ -1,15 +0,0 @@
1
- import { z } from 'zod'
2
- import type { ToolContext } from '@opencode-ai/plugin'
3
- import type { DaytonaSessionManager } from '../core/session-manager'
4
-
5
- export const getPreviewURLTool = (sessionManager: DaytonaSessionManager, projectId: string, worktree: string) => ({
6
- description: 'Gets a preview URL for the Daytona sandbox',
7
- args: {
8
- port: z.number(),
9
- },
10
- async execute(args: { port: number }, ctx: ToolContext) {
11
- const sandbox = await sessionManager.getSandbox(ctx.sessionID, projectId, worktree)
12
- const previewLink = await sandbox.getPreviewLink(args.port)
13
- return `Sandbox Preview URL: ${previewLink.url}`
14
- },
15
- })
@@ -1,16 +0,0 @@
1
- import { z } from 'zod'
2
- import type { ToolContext } from '@opencode-ai/plugin'
3
- import type { DaytonaSessionManager } from '../core/session-manager'
4
-
5
- export const globTool = (sessionManager: DaytonaSessionManager, projectId: string, worktree: string) => ({
6
- description: 'Searches for files matching a pattern in Daytona sandbox',
7
- args: {
8
- pattern: z.string(),
9
- },
10
- async execute(args: { pattern: string }, ctx: ToolContext) {
11
- const sandbox = await sessionManager.getSandbox(ctx.sessionID, projectId, worktree)
12
- const workDir = await sandbox.getWorkDir()
13
- const result = await sandbox.fs.searchFiles(workDir, args.pattern)
14
- return result.files.join('\n')
15
- },
16
- })
@@ -1,16 +0,0 @@
1
- import { z } from 'zod'
2
- import type { ToolContext } from '@opencode-ai/plugin'
3
- import type { DaytonaSessionManager } from '../core/session-manager'
4
-
5
- export const grepTool = (sessionManager: DaytonaSessionManager, projectId: string, worktree: string) => ({
6
- description: 'Searches for text pattern in files in Daytona sandbox',
7
- args: {
8
- pattern: z.string(),
9
- },
10
- async execute(args: { pattern: string }, ctx: ToolContext) {
11
- const sandbox = await sessionManager.getSandbox(ctx.sessionID, projectId, worktree)
12
- const workDir = await sandbox.getWorkDir()
13
- const matches = await sandbox.fs.findFiles(workDir, args.pattern)
14
- return matches.map((m) => `${m.file}:${m.line}: ${m.content}`).join('\n')
15
- },
16
- })
@@ -1,18 +0,0 @@
1
- import { z } from 'zod'
2
- import type { ToolContext } from '@opencode-ai/plugin'
3
- import type { DaytonaSessionManager } from '../core/session-manager'
4
- import type { FileInfo } from '@daytonaio/sdk'
5
-
6
- export const lsTool = (sessionManager: DaytonaSessionManager, projectId: string, worktree: string) => ({
7
- description: 'Lists files in a directory in Daytona sandbox',
8
- args: {
9
- dirPath: z.string().optional(),
10
- },
11
- async execute(args: { dirPath?: string }, ctx: ToolContext) {
12
- const sandbox = await sessionManager.getSandbox(ctx.sessionID, projectId, worktree)
13
- const workDir = await sandbox.getWorkDir()
14
- const path = args.dirPath || workDir
15
- const files = (await sandbox.fs.listFiles(path)) as FileInfo[]
16
- return files.map((f) => f.name).join('\n')
17
- },
18
- })
@@ -1,15 +0,0 @@
1
- import { z } from 'zod'
2
- import type { ToolContext } from '@opencode-ai/plugin'
3
- import type { DaytonaSessionManager } from '../core/session-manager'
4
-
5
- export const lspTool = (sessionManager: DaytonaSessionManager, projectId: string, worktree: string) => ({
6
- description: 'LSP operation in Daytona sandbox (code intelligence)',
7
- args: {
8
- op: z.string(),
9
- filePath: z.string(),
10
- line: z.number(),
11
- },
12
- async execute(args: { op: string; filePath: string; line: number }, ctx: ToolContext) {
13
- return `LSP operations are not yet implemented in the Daytona plugin.`
14
- },
15
- })
@@ -1,32 +0,0 @@
1
- import { z } from 'zod'
2
- import type { ToolContext } from '@opencode-ai/plugin'
3
- import type { DaytonaSessionManager } from '../core/session-manager'
4
-
5
- export const multieditTool = (sessionManager: DaytonaSessionManager, projectId: string, worktree: string) => ({
6
- description: 'Applies multiple edits to a file in Daytona sandbox atomically',
7
- args: {
8
- filePath: z.string(),
9
- edits: z.array(
10
- z.object({
11
- oldString: z.string(),
12
- newString: z.string(),
13
- }),
14
- ),
15
- },
16
- async execute(
17
- args: { filePath: string; edits: Array<{ oldString: string; newString: string }> },
18
- ctx: ToolContext,
19
- ) {
20
- const sandbox = await sessionManager.getSandbox(ctx.sessionID, projectId, worktree)
21
- const buffer = await sandbox.fs.downloadFile(args.filePath)
22
- const decoder = new TextDecoder()
23
- let content = decoder.decode(buffer)
24
-
25
- for (const edit of args.edits) {
26
- content = content.replace(edit.oldString, edit.newString)
27
- }
28
-
29
- await sandbox.fs.uploadFile(Buffer.from(content), args.filePath)
30
- return `Applied ${args.edits.length} edits to ${args.filePath}`
31
- },
32
- })
@@ -1,21 +0,0 @@
1
- import { z } from 'zod'
2
- import type { ToolContext } from '@opencode-ai/plugin'
3
- import type { DaytonaSessionManager } from '../core/session-manager'
4
-
5
- export const patchTool = (sessionManager: DaytonaSessionManager, projectId: string, worktree: string) => ({
6
- description: 'Patches a file with a code snippet in Daytona sandbox',
7
- args: {
8
- filePath: z.string(),
9
- oldSnippet: z.string(),
10
- newSnippet: z.string(),
11
- },
12
- async execute(args: { filePath: string; oldSnippet: string; newSnippet: string }, ctx: ToolContext) {
13
- const sandbox = await sessionManager.getSandbox(ctx.sessionID, projectId, worktree)
14
- const buffer = await sandbox.fs.downloadFile(args.filePath)
15
- const decoder = new TextDecoder()
16
- const content = decoder.decode(buffer)
17
- const newContent = content.replace(args.oldSnippet, args.newSnippet)
18
- await sandbox.fs.uploadFile(Buffer.from(newContent), args.filePath)
19
- return `Patched ${args.filePath}`
20
- },
21
- })
@@ -1,16 +0,0 @@
1
- import { z } from 'zod'
2
- import type { ToolContext } from '@opencode-ai/plugin'
3
- import type { DaytonaSessionManager } from '../core/session-manager'
4
-
5
- export const readTool = (sessionManager: DaytonaSessionManager, projectId: string, worktree: string) => ({
6
- description: 'Reads file from Daytona sandbox',
7
- args: {
8
- filePath: z.string(),
9
- },
10
- async execute(args: { filePath: string }, ctx: ToolContext) {
11
- const sandbox = await sessionManager.getSandbox(ctx.sessionID, projectId, worktree)
12
- const buffer = await sandbox.fs.downloadFile(args.filePath)
13
- const decoder = new TextDecoder()
14
- return decoder.decode(buffer)
15
- },
16
- })
@@ -1,16 +0,0 @@
1
- import { z } from 'zod'
2
- import type { ToolContext } from '@opencode-ai/plugin'
3
- import type { DaytonaSessionManager } from '../core/session-manager'
4
-
5
- export const writeTool = (sessionManager: DaytonaSessionManager, projectId: string, worktree: string) => ({
6
- description: 'Writes content to file in Daytona sandbox',
7
- args: {
8
- filePath: z.string(),
9
- content: z.string(),
10
- },
11
- async execute(args: { filePath: string; content: string }, ctx: ToolContext) {
12
- const sandbox = await sessionManager.getSandbox(ctx.sessionID, projectId, worktree)
13
- await sandbox.fs.uploadFile(Buffer.from(args.content), args.filePath)
14
- return `Written ${args.content.length} bytes to ${args.filePath}`
15
- },
16
- })
@@ -1,33 +0,0 @@
1
- /**
2
- * Tool implementations for Daytona sandbox integration
3
- */
4
-
5
- import { bashTool } from './tools/bash'
6
- import { readTool } from './tools/read'
7
- import { writeTool } from './tools/write'
8
- import { editTool } from './tools/edit'
9
- import { multieditTool } from './tools/multiedit'
10
- import { patchTool } from './tools/patch'
11
- import { lsTool } from './tools/ls'
12
- import { globTool } from './tools/glob'
13
- import { grepTool } from './tools/grep'
14
- import { lspTool } from './tools/lsp'
15
- import { getPreviewURLTool } from './tools/get-preview-url'
16
-
17
- import type { DaytonaSessionManager } from './core/session-manager'
18
-
19
- export function createDaytonaTools(sessionManager: DaytonaSessionManager, projectId: string, worktree: string) {
20
- return {
21
- bash: bashTool(sessionManager, projectId, worktree),
22
- read: readTool(sessionManager, projectId, worktree),
23
- write: writeTool(sessionManager, projectId, worktree),
24
- edit: editTool(sessionManager, projectId, worktree),
25
- multiedit: multieditTool(sessionManager, projectId, worktree),
26
- patch: patchTool(sessionManager, projectId, worktree),
27
- ls: lsTool(sessionManager, projectId, worktree),
28
- glob: globTool(sessionManager, projectId, worktree),
29
- grep: grepTool(sessionManager, projectId, worktree),
30
- lsp: lspTool(sessionManager, projectId, worktree),
31
- getPreviewURL: getPreviewURLTool(sessionManager, projectId, worktree),
32
- }
33
- }