
Security News
Static vs. Runtime Reachability: Insights from Latio’s On the Record Podcast
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
sdk-test-dummy
Advanced tools
A TypeScript SDK for interacting with Daytona Server API, providing a simple interface for Daytona Workspace management, Git operations, file system operations, and language server protocol support.
Before using the Daytona SDK, you need to have a running Daytona server instance and proper configuration.
For detailed instructions on installing and setting up the Daytona server, please refer to the official installation guide at: https://github.com/daytonaio/daytona
To use the SDK, you'll need two essential pieces of information:
Server Address:
daytona server config
to get your server's configurationAPI URL
value in the outputAPI Key:
daytona api-key generate
You can install the package using npm:
npm install @daytona/sdk
Or using yarn:
yarn add @daytona/sdk
Here's a simple example of using the SDK:
import { Daytona } from '@daytona/sdk'
// Initialize the Daytona client
const daytona = new Daytona()
// Create the workspace instance
const workspace = await daytona.create({
language: 'typescript',
})
// Run the code securely inside the workspace
const response = await workspace.process.code_run('console.log("Hello World!")')
console.log(response.result)
The SDK can be configured using environment variables or by passing a configuration object:
import { Daytona, DaytonaConfig } from '@daytona/sdk'
const config: DaytonaConfig = {
apiKey: 'your-api-key',
serverUrl: 'https://your-daytona-server',
target: 'your-target',
}
const daytona = new Daytona(config)
Or using environment variables:
DAYTONA_API_KEY
: Your Daytona API keyDAYTONA_SERVER_URL
: The Daytona server URLDAYTONA_TARGET
: Your target environmentconst response = await workspace.process.code_run(
'print("Sum of 3 and 4 is " + str(3 + 4))',
)
if (response.code !== 0) {
console.log(`Error: ${response.code} ${response.result}`)
} else {
console.log(response.result)
}
// Upload a file
await workspace.fs.uploadFile('/path/to/file.txt', new Blob(['Hello, World!']))
// Download a file
const content = await workspace.fs.downloadFile('/path/to/file.txt')
// Search for files
const matches = await workspace.fs.findFiles(root_dir, 'search_pattern')
// Clone a repository
await workspace.git.clone('https://github.com/example/repo', '/path/to/clone')
// List branches
const branches = await workspace.git.branches('/path/to/repo')
// Add files
await workspace.git.add('/path/to/repo', ['file1.txt', 'file2.txt'])
// Create and start a language server
const lsp = workspace.createLspServer('typescript', '/path/to/project')
await lsp.start()
// Notify the lsp for the file
await lsp.didOpen('/path/to/file.ts')
// Get document symbols
const symbols = await lsp.documentSymbols('/path/to/file.ts')
// Get completions
const completions = await lsp.completions('/path/to/file.ts', {
line: 10,
character: 15,
})
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the Apache License, Version 2.0 - see below for details:
Copyright 2024 Daytona
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
For the full license text, please see the Apache License 2.0.
FAQs
Daytona client library for AI Agents
The npm package sdk-test-dummy receives a total of 0 weekly downloads. As such, sdk-test-dummy popularity was classified as not popular.
We found that sdk-test-dummy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.