@jamesmurdza/opencode-daytona 0.1.21 → 0.1.23
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.
- package/.opencode/plugin/daytona/core/logger.d.ts +2 -2
- package/.opencode/plugin/daytona/core/logger.js +28 -15
- package/.opencode/plugin/daytona/core/logger.js.map +1 -1
- package/.opencode/plugin/daytona/core/project-data-storage.d.ts +11 -7
- package/.opencode/plugin/daytona/core/project-data-storage.js +84 -43
- package/.opencode/plugin/daytona/core/project-data-storage.js.map +1 -1
- package/.opencode/plugin/daytona/core/session-manager.d.ts +5 -2
- package/.opencode/plugin/daytona/core/session-manager.js +113 -60
- package/.opencode/plugin/daytona/core/session-manager.js.map +1 -1
- package/.opencode/plugin/daytona/core/toast.d.ts +47 -0
- package/.opencode/plugin/daytona/core/toast.js +73 -0
- package/.opencode/plugin/daytona/core/toast.js.map +1 -0
- package/.opencode/plugin/daytona/core/types.d.ts +10 -8
- package/.opencode/plugin/daytona/core/types.js +10 -6
- package/.opencode/plugin/daytona/core/types.js.map +1 -1
- package/.opencode/plugin/daytona/git/host-git-manager.d.ts +34 -7
- package/.opencode/plugin/daytona/git/host-git-manager.js +254 -68
- package/.opencode/plugin/daytona/git/host-git-manager.js.map +1 -1
- package/.opencode/plugin/daytona/git/index.d.ts +4 -1
- package/.opencode/plugin/daytona/git/index.js +9 -1
- package/.opencode/plugin/daytona/git/index.js.map +1 -1
- package/.opencode/plugin/daytona/git/sandbox-git-manager.d.ts +5 -1
- package/.opencode/plugin/daytona/git/sandbox-git-manager.js +23 -12
- package/.opencode/plugin/daytona/git/sandbox-git-manager.js.map +1 -1
- package/.opencode/plugin/daytona/git/session-git-manager.d.ts +19 -3
- package/.opencode/plugin/daytona/git/session-git-manager.js +80 -43
- package/.opencode/plugin/daytona/git/session-git-manager.js.map +1 -1
- package/.opencode/plugin/daytona/index.d.ts +131 -23
- package/.opencode/plugin/daytona/index.js +27 -16
- package/.opencode/plugin/daytona/index.js.map +1 -1
- package/.opencode/plugin/daytona/plugins/custom-tools.d.ts +129 -5
- package/.opencode/plugin/daytona/plugins/custom-tools.js +15 -13
- package/.opencode/plugin/daytona/plugins/custom-tools.js.map +1 -1
- package/.opencode/plugin/daytona/plugins/session-events.d.ts +10 -0
- package/.opencode/plugin/daytona/plugins/session-events.js +51 -0
- package/.opencode/plugin/daytona/plugins/session-events.js.map +1 -0
- package/.opencode/plugin/daytona/plugins/system-transform.d.ts +8 -5
- package/.opencode/plugin/daytona/plugins/system-transform.js +19 -15
- package/.opencode/plugin/daytona/plugins/system-transform.js.map +1 -1
- package/.opencode/plugin/daytona/tools/bash.d.ts +7 -3
- package/.opencode/plugin/daytona/tools/bash.js +16 -5
- package/.opencode/plugin/daytona/tools/bash.js.map +1 -1
- package/.opencode/plugin/daytona/tools/edit.d.ts +6 -2
- package/.opencode/plugin/daytona/tools/edit.js +13 -5
- package/.opencode/plugin/daytona/tools/edit.js.map +1 -1
- package/.opencode/plugin/daytona/tools/get-preview-url.d.ts +6 -2
- package/.opencode/plugin/daytona/tools/get-preview-url.js +11 -3
- package/.opencode/plugin/daytona/tools/get-preview-url.js.map +1 -1
- package/.opencode/plugin/daytona/tools/glob.d.ts +6 -2
- package/.opencode/plugin/daytona/tools/glob.js +11 -3
- package/.opencode/plugin/daytona/tools/glob.js.map +1 -1
- package/.opencode/plugin/daytona/tools/grep.d.ts +6 -2
- package/.opencode/plugin/daytona/tools/grep.js +11 -3
- package/.opencode/plugin/daytona/tools/grep.js.map +1 -1
- package/.opencode/plugin/daytona/tools/ls.d.ts +6 -2
- package/.opencode/plugin/daytona/tools/ls.js +11 -3
- package/.opencode/plugin/daytona/tools/ls.js.map +1 -1
- package/.opencode/plugin/daytona/tools/lsp.d.ts +6 -2
- package/.opencode/plugin/daytona/tools/lsp.js +13 -5
- package/.opencode/plugin/daytona/tools/lsp.js.map +1 -1
- package/.opencode/plugin/daytona/tools/multiedit.d.ts +6 -2
- package/.opencode/plugin/daytona/tools/multiedit.js +14 -6
- package/.opencode/plugin/daytona/tools/multiedit.js.map +1 -1
- package/.opencode/plugin/daytona/tools/patch.d.ts +7 -5
- package/.opencode/plugin/daytona/tools/patch.js +13 -13
- package/.opencode/plugin/daytona/tools/patch.js.map +1 -1
- package/.opencode/plugin/daytona/tools/read.d.ts +6 -2
- package/.opencode/plugin/daytona/tools/read.js +11 -3
- package/.opencode/plugin/daytona/tools/read.js.map +1 -1
- package/.opencode/plugin/daytona/tools/write.d.ts +6 -2
- package/.opencode/plugin/daytona/tools/write.js +12 -4
- package/.opencode/plugin/daytona/tools/write.js.map +1 -1
- package/.opencode/plugin/daytona/tools.d.ts +14 -16
- package/.opencode/plugin/daytona/tools.js +31 -23
- package/.opencode/plugin/daytona/tools.js.map +1 -1
- package/.opencode/plugin/index.d.ts +7 -4
- package/.opencode/plugin/index.js +12 -3
- package/.opencode/plugin/index.js.map +1 -1
- package/README.md +68 -29
- package/package.json +34 -17
- package/.opencode/plugin/daytona/core/logger.d.ts.map +0 -1
- package/.opencode/plugin/daytona/core/project-data-storage.d.ts.map +0 -1
- package/.opencode/plugin/daytona/core/session-manager.d.ts.map +0 -1
- package/.opencode/plugin/daytona/core/types.d.ts.map +0 -1
- package/.opencode/plugin/daytona/git/host-git-manager.d.ts.map +0 -1
- package/.opencode/plugin/daytona/git/index.d.ts.map +0 -1
- package/.opencode/plugin/daytona/git/sandbox-git-manager.d.ts.map +0 -1
- package/.opencode/plugin/daytona/git/session-git-manager.d.ts.map +0 -1
- package/.opencode/plugin/daytona/index.d.ts.map +0 -1
- package/.opencode/plugin/daytona/plugins/custom-tools.d.ts.map +0 -1
- package/.opencode/plugin/daytona/plugins/index.d.ts +0 -8
- package/.opencode/plugin/daytona/plugins/index.d.ts.map +0 -1
- package/.opencode/plugin/daytona/plugins/index.js +0 -8
- package/.opencode/plugin/daytona/plugins/index.js.map +0 -1
- package/.opencode/plugin/daytona/plugins/session-cleanup.d.ts +0 -8
- package/.opencode/plugin/daytona/plugins/session-cleanup.d.ts.map +0 -1
- package/.opencode/plugin/daytona/plugins/session-cleanup.js +0 -38
- package/.opencode/plugin/daytona/plugins/session-cleanup.js.map +0 -1
- package/.opencode/plugin/daytona/plugins/session-idle-auto-commit.d.ts +0 -7
- package/.opencode/plugin/daytona/plugins/session-idle-auto-commit.d.ts.map +0 -1
- package/.opencode/plugin/daytona/plugins/session-idle-auto-commit.js +0 -46
- package/.opencode/plugin/daytona/plugins/session-idle-auto-commit.js.map +0 -1
- package/.opencode/plugin/daytona/plugins/system-transform.d.ts.map +0 -1
- package/.opencode/plugin/daytona/tools/bash.d.ts.map +0 -1
- package/.opencode/plugin/daytona/tools/edit.d.ts.map +0 -1
- package/.opencode/plugin/daytona/tools/get-preview-url.d.ts.map +0 -1
- package/.opencode/plugin/daytona/tools/glob.d.ts.map +0 -1
- package/.opencode/plugin/daytona/tools/grep.d.ts.map +0 -1
- package/.opencode/plugin/daytona/tools/ls.d.ts.map +0 -1
- package/.opencode/plugin/daytona/tools/lsp.d.ts.map +0 -1
- package/.opencode/plugin/daytona/tools/multiedit.d.ts.map +0 -1
- package/.opencode/plugin/daytona/tools/patch.d.ts.map +0 -1
- package/.opencode/plugin/daytona/tools/read.d.ts.map +0 -1
- package/.opencode/plugin/daytona/tools/write.d.ts.map +0 -1
- package/.opencode/plugin/daytona/tools.d.ts.map +0 -1
- package/.opencode/plugin/index.d.ts.map +0 -1
|
@@ -1,12 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2025 Daytona Platforms Inc.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.DaytonaSessionManager = void 0;
|
|
1
8
|
/**
|
|
2
9
|
* Manages Daytona sandbox sessions and persists session-sandbox mappings
|
|
3
10
|
* Stores data per-project in ~/.local/share/opencode/storage/daytona/{projectId}.json
|
|
4
11
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
12
|
+
const sdk_1 = require("@daytonaio/sdk");
|
|
13
|
+
const logger_1 = require("./logger");
|
|
14
|
+
const session_git_manager_1 = require("../git/session-git-manager");
|
|
15
|
+
const sandbox_git_manager_1 = require("../git/sandbox-git-manager");
|
|
16
|
+
const project_data_storage_1 = require("./project-data-storage");
|
|
17
|
+
const toast_1 = require("./toast");
|
|
18
|
+
class DaytonaSessionManager {
|
|
10
19
|
apiKey;
|
|
11
20
|
dataStorage;
|
|
12
21
|
sessionSandboxes;
|
|
@@ -14,7 +23,7 @@ export class DaytonaSessionManager {
|
|
|
14
23
|
repoPath;
|
|
15
24
|
constructor(apiKey, storageDir, repoPath) {
|
|
16
25
|
this.apiKey = apiKey;
|
|
17
|
-
this.dataStorage = new ProjectDataStorage(storageDir);
|
|
26
|
+
this.dataStorage = new project_data_storage_1.ProjectDataStorage(storageDir);
|
|
18
27
|
this.repoPath = repoPath;
|
|
19
28
|
this.sessionSandboxes = new Map();
|
|
20
29
|
}
|
|
@@ -39,7 +48,7 @@ export class DaytonaSessionManager {
|
|
|
39
48
|
for (const [sessionId, sessionInfo] of Object.entries(projectData.sessions)) {
|
|
40
49
|
this.sessionSandboxes.set(sessionId, { id: sessionInfo.sandboxId });
|
|
41
50
|
}
|
|
42
|
-
logger.info(`Loaded ${Object.keys(projectData.sessions).length} sessions for project ${projectId}`);
|
|
51
|
+
logger_1.logger.info(`Loaded ${Object.keys(projectData.sessions).length} sessions for project ${projectId}`);
|
|
43
52
|
}
|
|
44
53
|
}
|
|
45
54
|
/**
|
|
@@ -48,6 +57,7 @@ export class DaytonaSessionManager {
|
|
|
48
57
|
setProjectContext(projectId) {
|
|
49
58
|
if (this.currentProjectId !== projectId) {
|
|
50
59
|
this.currentProjectId = projectId;
|
|
60
|
+
this.sessionSandboxes.clear();
|
|
51
61
|
this.loadProjectSessions(projectId);
|
|
52
62
|
}
|
|
53
63
|
}
|
|
@@ -61,17 +71,16 @@ export class DaytonaSessionManager {
|
|
|
61
71
|
* Get or create a sandbox for the given session ID
|
|
62
72
|
*/
|
|
63
73
|
async getSandbox(sessionId, projectId, worktree, pluginCtx) {
|
|
74
|
+
if (pluginCtx?.client?.tui) {
|
|
75
|
+
toast_1.toast.initialize(pluginCtx.client.tui);
|
|
76
|
+
}
|
|
64
77
|
if (!this.apiKey) {
|
|
65
|
-
logger.error('DAYTONA_API_KEY is not set. Cannot create or retrieve sandbox.');
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
variant: 'error',
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
}
|
|
78
|
+
logger_1.logger.error('DAYTONA_API_KEY is not set. Cannot create or retrieve sandbox.');
|
|
79
|
+
toast_1.toast.show({
|
|
80
|
+
title: 'Sandbox error',
|
|
81
|
+
message: 'DAYTONA_API_KEY is not set. Please set the environment variable to use Daytona sandboxes.',
|
|
82
|
+
variant: 'error',
|
|
83
|
+
});
|
|
75
84
|
throw new Error('DAYTONA_API_KEY is not set. Please set the environment variable to use Daytona sandboxes.');
|
|
76
85
|
}
|
|
77
86
|
// Load project sessions if needed
|
|
@@ -79,71 +88,114 @@ export class DaytonaSessionManager {
|
|
|
79
88
|
const existing = this.sessionSandboxes.get(sessionId);
|
|
80
89
|
// If we have a fully initialized sandbox, reuse it
|
|
81
90
|
if (this.isFullyInitialized(existing)) {
|
|
91
|
+
// Refresh sandbox state and ensure it's running
|
|
92
|
+
await existing.refreshData();
|
|
93
|
+
if (existing.state !== 'started') {
|
|
94
|
+
logger_1.logger.info(`Starting sandbox ${existing.id} (current state: ${existing.state})`);
|
|
95
|
+
await existing.start();
|
|
96
|
+
}
|
|
82
97
|
this.dataStorage.updateSession(projectId, worktree, sessionId, existing.id);
|
|
83
98
|
return existing;
|
|
84
99
|
}
|
|
85
100
|
// If we have a sandboxId but not a full sandbox object, reconnect to it
|
|
86
101
|
if (this.isPartiallyInitialized(existing)) {
|
|
87
|
-
logger.info(`Reconnecting to existing sandbox: ${existing.id}`);
|
|
88
|
-
const daytona = new Daytona({ apiKey: this.apiKey });
|
|
102
|
+
logger_1.logger.info(`Reconnecting to existing sandbox: ${existing.id}`);
|
|
103
|
+
const daytona = new sdk_1.Daytona({ apiKey: this.apiKey });
|
|
104
|
+
const reconnectStart = Date.now();
|
|
105
|
+
logger_1.logger.info(`Daytona get begin sandboxId=${existing.id}`);
|
|
89
106
|
const sandbox = await daytona.get(existing.id);
|
|
107
|
+
logger_1.logger.info(`Daytona get done sandboxId=${existing.id} in ${Date.now() - reconnectStart}ms`);
|
|
108
|
+
logger_1.logger.info(`Starting sandbox begin sandboxId=${sandbox.id}`);
|
|
90
109
|
await sandbox.start();
|
|
110
|
+
logger_1.logger.info(`Starting sandbox done sandboxId=${sandbox.id} in ${Date.now() - reconnectStart}ms`);
|
|
91
111
|
this.sessionSandboxes.set(sessionId, sandbox);
|
|
92
112
|
// Preserve branch number if it exists for this sandbox
|
|
93
113
|
let branchNumber = this.dataStorage.getBranchNumberForSandbox(projectId, sandbox.id);
|
|
94
114
|
if (!branchNumber) {
|
|
95
|
-
|
|
115
|
+
try {
|
|
116
|
+
branchNumber = session_git_manager_1.SessionGitManager.allocateAndReserveBranchNumber(worktree);
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
// No local git repo (or git unavailable) shouldn't block sandbox usage.
|
|
120
|
+
branchNumber = undefined;
|
|
121
|
+
}
|
|
96
122
|
}
|
|
97
123
|
this.dataStorage.updateSession(projectId, worktree, sessionId, sandbox.id, branchNumber);
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
124
|
+
toast_1.toast.show({
|
|
125
|
+
title: 'Sandbox connected',
|
|
126
|
+
message: `Connected to existing sandbox.`,
|
|
127
|
+
variant: 'info',
|
|
128
|
+
});
|
|
129
|
+
// Even if git syncing is disabled, ensure the project directory exists in the sandbox.
|
|
130
|
+
if (!branchNumber) {
|
|
131
|
+
try {
|
|
132
|
+
await new sandbox_git_manager_1.DaytonaSandboxGitManager(sandbox, this.repoPath).ensureDirectory();
|
|
133
|
+
}
|
|
134
|
+
catch (err) {
|
|
135
|
+
logger_1.logger.warn(`Failed to ensure sandbox project directory exists: ${err}`);
|
|
136
|
+
}
|
|
106
137
|
}
|
|
107
138
|
return sandbox;
|
|
108
139
|
}
|
|
140
|
+
// If not in cache/storage for this project, try to recover from other projects and migrate.
|
|
141
|
+
if (!existing) {
|
|
142
|
+
const migrated = this.dataStorage.getSession(projectId, worktree, sessionId);
|
|
143
|
+
if (migrated?.sandboxId) {
|
|
144
|
+
logger_1.logger.info(`Recovered session ${sessionId} for project ${projectId} (migrated from another project)`);
|
|
145
|
+
this.sessionSandboxes.set(sessionId, { id: migrated.sandboxId });
|
|
146
|
+
// Re-run getSandbox to go through the normal reconnect path.
|
|
147
|
+
return this.getSandbox(sessionId, projectId, worktree, pluginCtx);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
109
150
|
// Otherwise, create a new sandbox
|
|
110
|
-
logger.info(`Creating new sandbox for session: ${sessionId} in project: ${projectId}`);
|
|
111
|
-
const daytona = new Daytona({ apiKey: this.apiKey });
|
|
112
|
-
const
|
|
151
|
+
logger_1.logger.info(`Creating new sandbox for session: ${sessionId} in project: ${projectId}`);
|
|
152
|
+
const daytona = new sdk_1.Daytona({ apiKey: this.apiKey });
|
|
153
|
+
const createStart = Date.now();
|
|
154
|
+
logger_1.logger.info(`Daytona create begin sessionId=${sessionId}`);
|
|
155
|
+
const waitingLog = setTimeout(() => {
|
|
156
|
+
logger_1.logger.warn(`Daytona create still waiting after ${Date.now() - createStart}ms (sessionId=${sessionId})`);
|
|
157
|
+
}, 15_000);
|
|
158
|
+
const sandbox = await daytona.create().finally(() => clearTimeout(waitingLog));
|
|
159
|
+
logger_1.logger.info(`Daytona create done sessionId=${sessionId} sandboxId=${sandbox.id} in ${Date.now() - createStart}ms`);
|
|
113
160
|
this.sessionSandboxes.set(sessionId, sandbox);
|
|
114
161
|
// Get or assign branch number for this sandbox
|
|
115
162
|
let branchNumber = this.dataStorage.getBranchNumberForSandbox(projectId, sandbox.id);
|
|
116
163
|
if (!branchNumber) {
|
|
117
|
-
|
|
164
|
+
try {
|
|
165
|
+
branchNumber = session_git_manager_1.SessionGitManager.allocateAndReserveBranchNumber(worktree);
|
|
166
|
+
}
|
|
167
|
+
catch (err) {
|
|
168
|
+
logger_1.logger.warn(`allocateAndReserveBranchNumber failed sessionId=${sessionId}: ${err}`);
|
|
169
|
+
// No local git repo (or git unavailable) shouldn't block sandbox usage.
|
|
170
|
+
branchNumber = undefined;
|
|
171
|
+
}
|
|
118
172
|
}
|
|
119
173
|
this.dataStorage.updateSession(projectId, worktree, sessionId, sandbox.id, branchNumber);
|
|
120
|
-
logger.info(`Sandbox created successfully: ${sandbox.id} with branch number ${branchNumber}`);
|
|
174
|
+
logger_1.logger.info(`Sandbox created successfully: ${sandbox.id}${branchNumber ? ` with branch number ${branchNumber}` : ''}`);
|
|
121
175
|
// Initialize git repo in the sandbox and sync with host
|
|
122
176
|
try {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
body: {
|
|
131
|
-
title: 'Git error',
|
|
132
|
-
message: err?.message || 'Failed to initialize git repo in sandbox.',
|
|
133
|
-
variant: 'error',
|
|
134
|
-
},
|
|
135
|
-
});
|
|
177
|
+
if (branchNumber) {
|
|
178
|
+
const sessionGit = new session_git_manager_1.SessionGitManager(sandbox, this.repoPath, worktree, branchNumber);
|
|
179
|
+
await sessionGit.initializeAndSync(pluginCtx);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
// Git disabled; still ensure the directory exists so tools can operate.
|
|
183
|
+
await new sandbox_git_manager_1.DaytonaSandboxGitManager(sandbox, this.repoPath).ensureDirectory();
|
|
136
184
|
}
|
|
137
185
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
},
|
|
186
|
+
catch (err) {
|
|
187
|
+
logger_1.logger.error(`Failed to initialize git repo or push local changes in sandbox: ${err}`);
|
|
188
|
+
toast_1.toast.show({
|
|
189
|
+
title: 'Git error',
|
|
190
|
+
message: err?.message || 'Failed to initialize git repo in sandbox.',
|
|
191
|
+
variant: 'error',
|
|
145
192
|
});
|
|
146
193
|
}
|
|
194
|
+
toast_1.toast.show({
|
|
195
|
+
title: 'Sandbox created',
|
|
196
|
+
message: `Created new sandbox for session.`,
|
|
197
|
+
variant: 'success',
|
|
198
|
+
});
|
|
147
199
|
return sandbox;
|
|
148
200
|
}
|
|
149
201
|
/**
|
|
@@ -153,22 +205,22 @@ export class DaytonaSessionManager {
|
|
|
153
205
|
let sandbox = this.sessionSandboxes.get(sessionId);
|
|
154
206
|
// If not in cache, try to load from storage and reconnect
|
|
155
207
|
if (!sandbox || this.isPartiallyInitialized(sandbox)) {
|
|
156
|
-
const
|
|
157
|
-
const sessionInfo =
|
|
208
|
+
const storedWorktree = this.dataStorage.load(projectId)?.worktree ?? '';
|
|
209
|
+
const sessionInfo = this.dataStorage.getSession(projectId, storedWorktree, sessionId);
|
|
158
210
|
if (sessionInfo?.sandboxId) {
|
|
159
|
-
const daytona = new Daytona({ apiKey: this.apiKey });
|
|
211
|
+
const daytona = new sdk_1.Daytona({ apiKey: this.apiKey });
|
|
160
212
|
try {
|
|
161
213
|
sandbox = await daytona.get(sessionInfo.sandboxId);
|
|
162
214
|
this.sessionSandboxes.set(sessionId, sandbox);
|
|
163
215
|
}
|
|
164
216
|
catch (err) {
|
|
165
|
-
logger.error(`Failed to reconnect to sandbox ${sessionInfo.sandboxId}: ${err}`);
|
|
217
|
+
logger_1.logger.error(`Failed to reconnect to sandbox ${sessionInfo.sandboxId}: ${err}`);
|
|
166
218
|
}
|
|
167
219
|
}
|
|
168
220
|
}
|
|
169
221
|
// Delete the sandbox if we have a fully initialized one
|
|
170
222
|
if (this.isFullyInitialized(sandbox)) {
|
|
171
|
-
logger.info(`Removing sandbox for session: ${sessionId}`);
|
|
223
|
+
logger_1.logger.info(`Removing sandbox for session: ${sessionId}`);
|
|
172
224
|
await sandbox.delete();
|
|
173
225
|
this.sessionSandboxes.delete(sessionId);
|
|
174
226
|
// Remove from storage
|
|
@@ -176,11 +228,12 @@ export class DaytonaSessionManager {
|
|
|
176
228
|
if (projectData) {
|
|
177
229
|
this.dataStorage.removeSession(projectId, projectData.worktree, sessionId);
|
|
178
230
|
}
|
|
179
|
-
logger.info(`Sandbox deleted successfully.`);
|
|
231
|
+
logger_1.logger.info(`Sandbox deleted successfully.`);
|
|
180
232
|
}
|
|
181
233
|
else {
|
|
182
|
-
logger.warn(`No sandbox found for session: ${sessionId}`);
|
|
234
|
+
logger_1.logger.warn(`No sandbox found for session: ${sessionId}`);
|
|
183
235
|
}
|
|
184
236
|
}
|
|
185
237
|
}
|
|
238
|
+
exports.DaytonaSessionManager = DaytonaSessionManager;
|
|
186
239
|
//# sourceMappingURL=session-manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-manager.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"session-manager.js","sourceRoot":"","sources":["../../../../../../../libs/opencode-plugin/.opencode/plugin/daytona/core/session-manager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;GAGG;AAEH,wCAAsD;AACtD,qCAAiC;AAEjC,oEAA8D;AAC9D,oEAAqE;AACrE,iEAA2D;AAE3D,mCAA+B;AAE/B,MAAa,qBAAqB;IACf,MAAM,CAAQ;IACd,WAAW,CAAoB;IACxC,gBAAgB,CAAmB;IACnC,gBAAgB,CAAS;IACjB,QAAQ,CAAQ;IAEhC,YAAY,MAAc,EAAE,UAAkB,EAAE,QAAgB;QAC9D,IAAI,CAAC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W,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;YAC5E,CAAC;YAED,eAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAA;QAC9C,CAAC;aAAM,CAAC;YACN,eAAM,CAAC,IAAI,CAAC,iCAAiC,SAAS,EAAE,CAAC,CAAA;QAC3D,CAAC;IACH,CAAC;CACF;AA9OD,sDA8OC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Daytona Platforms Inc.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Global toast notification singleton
|
|
7
|
+
* Queues toasts to prevent showing multiple at the same time
|
|
8
|
+
*/
|
|
9
|
+
type ToastVariant = 'success' | 'error' | 'warning' | 'info';
|
|
10
|
+
interface ToastOptions {
|
|
11
|
+
title: string;
|
|
12
|
+
message: string;
|
|
13
|
+
variant?: ToastVariant;
|
|
14
|
+
}
|
|
15
|
+
interface TuiShowToast {
|
|
16
|
+
showToast: (options: {
|
|
17
|
+
body: {
|
|
18
|
+
title: string;
|
|
19
|
+
message: string;
|
|
20
|
+
variant: ToastVariant;
|
|
21
|
+
};
|
|
22
|
+
}) => void;
|
|
23
|
+
}
|
|
24
|
+
declare class ToastManager {
|
|
25
|
+
private tui;
|
|
26
|
+
private queue;
|
|
27
|
+
private isShowing;
|
|
28
|
+
/**
|
|
29
|
+
* Initialize the toast manager with the TUI instance
|
|
30
|
+
*/
|
|
31
|
+
initialize(tui: TuiShowToast | null | undefined): void;
|
|
32
|
+
/**
|
|
33
|
+
* Show a toast notification
|
|
34
|
+
* If a toast is currently showing, this will be queued
|
|
35
|
+
*/
|
|
36
|
+
show(options: ToastOptions): void;
|
|
37
|
+
/**
|
|
38
|
+
* Process the toast queue, showing one toast at a time
|
|
39
|
+
*/
|
|
40
|
+
private processQueue;
|
|
41
|
+
/**
|
|
42
|
+
* Clear all pending toasts
|
|
43
|
+
*/
|
|
44
|
+
clear(): void;
|
|
45
|
+
}
|
|
46
|
+
export declare const toast: ToastManager;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2025 Daytona Platforms Inc.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.toast = void 0;
|
|
8
|
+
class ToastManager {
|
|
9
|
+
tui = null;
|
|
10
|
+
queue = [];
|
|
11
|
+
isShowing = false;
|
|
12
|
+
/**
|
|
13
|
+
* Initialize the toast manager with the TUI instance
|
|
14
|
+
*/
|
|
15
|
+
initialize(tui) {
|
|
16
|
+
this.tui = tui || null;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Show a toast notification
|
|
20
|
+
* If a toast is currently showing, this will be queued
|
|
21
|
+
*/
|
|
22
|
+
show(options) {
|
|
23
|
+
const toast = {
|
|
24
|
+
variant: 'info',
|
|
25
|
+
...options,
|
|
26
|
+
};
|
|
27
|
+
this.queue.push(toast);
|
|
28
|
+
this.processQueue();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Process the toast queue, showing one toast at a time
|
|
32
|
+
*/
|
|
33
|
+
processQueue() {
|
|
34
|
+
if (this.isShowing || this.queue.length === 0) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (!this.tui) {
|
|
38
|
+
// If TUI is not available, clear the queue
|
|
39
|
+
this.queue = [];
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
this.isShowing = true;
|
|
43
|
+
const toast = this.queue.shift();
|
|
44
|
+
try {
|
|
45
|
+
this.tui.showToast({
|
|
46
|
+
body: {
|
|
47
|
+
title: toast.title,
|
|
48
|
+
message: toast.message,
|
|
49
|
+
variant: toast.variant || 'info',
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
// If showing fails, continue with next toast
|
|
55
|
+
console.error('Failed to show toast:', err);
|
|
56
|
+
}
|
|
57
|
+
// Wait a bit before showing the next toast to avoid overlap
|
|
58
|
+
// Most toasts are visible for 2-3 seconds, so we wait 2.5 seconds
|
|
59
|
+
setTimeout(() => {
|
|
60
|
+
this.isShowing = false;
|
|
61
|
+
this.processQueue();
|
|
62
|
+
}, 2500);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Clear all pending toasts
|
|
66
|
+
*/
|
|
67
|
+
clear() {
|
|
68
|
+
this.queue = [];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Export singleton instance
|
|
72
|
+
exports.toast = new ToastManager();
|
|
73
|
+
//# sourceMappingURL=toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.js","sourceRoot":"","sources":["../../../../../../../libs/opencode-plugin/.opencode/plugin/daytona/core/toast.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAmBH,MAAM,YAAY;IACR,GAAG,GAAwB,IAAI,CAAA;IAC/B,KAAK,GAAmB,EAAE,CAAA;IAC1B,SAAS,GAAG,KAAK,CAAA;IAEzB;;OAEG;IACH,UAAU,CAAC,GAAoC;QAC7C,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,IAAI,CAAA;IACxB,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,OAAqB;QACxB,MAAM,KAAK,GAAiB;YAC1B,OAAO,EAAE,MAAM;YACf,GAAG,OAAO;SACX,CAAA;QAED,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACtB,IAAI,CAAC,YAAY,EAAE,CAAA;IACrB,CAAC;IAED;;OAEG;IACK,YAAY;QAClB,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9C,OAAM;QACR,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YACd,2CAA2C;YAC3C,IAAI,CAAC,KAAK,GAAG,EAAE,CAAA;YACf,OAAM;QACR,CAAC;QAED,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;QACrB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAG,CAAA;QAEjC,IAAI,CAAC;YACH,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;gBACjB,IAAI,EAAE;oBACJ,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,OAAO,EAAE,KAAK,CAAC,OAAO;oBACtB,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,MAAM;iBACjC;aACF,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,6CAA6C;YAC7C,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAA;QAC7C,CAAC;QAED,4DAA4D;QAC5D,kEAAkE;QAClE,UAAU,CAAC,GAAG,EAAE;YACd,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;YACtB,IAAI,CAAC,YAAY,EAAE,CAAA;QACrB,CAAC,EAAE,IAAI,CAAC,CAAA;IACV,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,KAAK,GAAG,EAAE,CAAA;IACjB,CAAC;CACF;AAED,4BAA4B;AACf,QAAA,KAAK,GAAG,IAAI,YAAY,EAAE,CAAA"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Daytona Platforms Inc.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
1
5
|
/**
|
|
2
6
|
* Type definitions and constants for the Daytona OpenCode plugin
|
|
3
7
|
*/
|
|
@@ -17,7 +21,8 @@ export type EventSessionIdle = {
|
|
|
17
21
|
};
|
|
18
22
|
};
|
|
19
23
|
export type ExperimentalChatSystemTransformInput = {
|
|
20
|
-
sessionID
|
|
24
|
+
sessionID?: string;
|
|
25
|
+
model: any;
|
|
21
26
|
};
|
|
22
27
|
export type ExperimentalChatSystemTransformOutput = {
|
|
23
28
|
system: string[];
|
|
@@ -30,22 +35,19 @@ export type SandboxInfo = {
|
|
|
30
35
|
};
|
|
31
36
|
export type SessionInfo = {
|
|
32
37
|
sandboxId: string;
|
|
33
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Only set when the local worktree is a git repo (used to create opencode/N branches/remotes).
|
|
40
|
+
*/
|
|
41
|
+
branchNumber?: number;
|
|
34
42
|
created: number;
|
|
35
43
|
lastAccessed: number;
|
|
36
44
|
};
|
|
37
45
|
export type ProjectSessionData = {
|
|
38
46
|
projectId: string;
|
|
39
47
|
worktree: string;
|
|
40
|
-
/**
|
|
41
|
-
* Monotonically increasing pointer for branch numbering.
|
|
42
|
-
* We persist this so we don't reuse branch numbers after sessions are deleted.
|
|
43
|
-
*/
|
|
44
|
-
lastBranchNumber?: number;
|
|
45
48
|
sessions: Record<string, SessionInfo>;
|
|
46
49
|
};
|
|
47
50
|
export type SessionSandboxMap = Map<string, Sandbox | SandboxInfo>;
|
|
48
51
|
export declare const LOG_LEVEL_INFO: LogLevel;
|
|
49
52
|
export declare const LOG_LEVEL_ERROR: LogLevel;
|
|
50
53
|
export declare const LOG_LEVEL_WARN: LogLevel;
|
|
51
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* Copyright 2025 Daytona Platforms Inc.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
3
5
|
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.LOG_LEVEL_WARN = exports.LOG_LEVEL_ERROR = exports.LOG_LEVEL_INFO = exports.EVENT_TYPE_SESSION_IDLE = exports.EVENT_TYPE_SESSION_DELETED = void 0;
|
|
4
8
|
// OpenCode constants
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
exports.EVENT_TYPE_SESSION_DELETED = 'session.deleted';
|
|
10
|
+
exports.EVENT_TYPE_SESSION_IDLE = 'session.idle';
|
|
7
11
|
// Daytona plugin constants
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
exports.LOG_LEVEL_INFO = 'INFO';
|
|
13
|
+
exports.LOG_LEVEL_ERROR = 'ERROR';
|
|
14
|
+
exports.LOG_LEVEL_WARN = 'WARN';
|
|
11
15
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../libs/opencode-plugin/.opencode/plugin/daytona/core/types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAiCH,qBAAqB;AAER,QAAA,0BAA0B,GAAG,iBAAiB,CAAA;AAC9C,QAAA,uBAAuB,GAAG,cAAc,CAAA;AA4BrD,2BAA2B;AAEd,QAAA,cAAc,GAAa,MAAM,CAAA;AACjC,QAAA,eAAe,GAAa,OAAO,CAAA;AACnC,QAAA,cAAc,GAAa,MAAM,CAAA"}
|
|
@@ -1,13 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Daytona Platforms Inc.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
1
5
|
export declare class HostGitManager {
|
|
6
|
+
private operationQueue;
|
|
7
|
+
/** Cached OID of an empty commit used to reserve branch refs (branches must point at commits, not blobs). */
|
|
8
|
+
private emptyCommitOidCache;
|
|
2
9
|
/**
|
|
3
|
-
*
|
|
10
|
+
* Checks if a git repository exists in the current directory
|
|
11
|
+
* @returns true if a git repo exists, false otherwise
|
|
12
|
+
*/
|
|
13
|
+
hasRepo(cwd?: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Allocates the next available opencode/N branch number by scanning local refs and
|
|
16
|
+
* reserving the chosen number by creating the ref immediately.
|
|
17
|
+
*
|
|
18
|
+
* This avoids relying on OpenCode's project ID and works even in repos with no commits.
|
|
19
|
+
*/
|
|
20
|
+
allocateAndReserveBranchNumber(cwd: string, prefix?: string): number;
|
|
21
|
+
private refExists;
|
|
22
|
+
/**
|
|
23
|
+
* Returns a commit OID that branch refs can point at. Uses HEAD if the repo has commits,
|
|
24
|
+
* otherwise creates and caches an empty commit (empty tree + commit). Branch refs must
|
|
25
|
+
* point at commits, not blobs.
|
|
26
|
+
*/
|
|
27
|
+
private getOrCreateEmptyCommitOid;
|
|
28
|
+
/**
|
|
29
|
+
* Pushes local changes to the sandbox remote.
|
|
30
|
+
* @param remoteName Numbered remote (e.g. sandbox-2) matching opencode/N.
|
|
4
31
|
* @param sshUrl The SSH URL of the sandbox remote.
|
|
5
32
|
* @param branch The branch to push to.
|
|
33
|
+
* @param cwd Worktree path to run git in.
|
|
34
|
+
* @returns true if push was successful, false if no repo exists
|
|
6
35
|
*/
|
|
7
|
-
pushLocalToSandboxRemote(sshUrl: string, branch: string):
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
push(remoteName: string, branch: string): void;
|
|
36
|
+
pushLocalToSandboxRemote(remoteName: string, sshUrl: string, branch: string, cwd: string): Promise<boolean>;
|
|
37
|
+
private setRemote;
|
|
38
|
+
pull(remoteName: string, sshUrl: string, branch: string, cwd: string, localBranch?: string): Promise<void>;
|
|
39
|
+
push(remoteName: string, sshUrl: string, branch: string, cwd: string): Promise<void>;
|
|
12
40
|
}
|
|
13
|
-
//# sourceMappingURL=host-git-manager.d.ts.map
|