@jamesmurdza/opencode-daytona 0.1.21 → 0.1.22
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/session-manager.d.ts +1 -1
- package/.opencode/plugin/daytona/core/session-manager.d.ts.map +1 -1
- package/.opencode/plugin/daytona/core/session-manager.js +29 -35
- package/.opencode/plugin/daytona/core/session-manager.js.map +1 -1
- package/.opencode/plugin/daytona/core/toast.d.ts +44 -0
- package/.opencode/plugin/daytona/core/toast.d.ts.map +1 -0
- package/.opencode/plugin/daytona/core/toast.js +70 -0
- package/.opencode/plugin/daytona/core/toast.js.map +1 -0
- package/.opencode/plugin/daytona/git/host-git-manager.d.ts +13 -6
- package/.opencode/plugin/daytona/git/host-git-manager.d.ts.map +1 -1
- package/.opencode/plugin/daytona/git/host-git-manager.js +99 -60
- package/.opencode/plugin/daytona/git/host-git-manager.js.map +1 -1
- package/.opencode/plugin/daytona/git/sandbox-git-manager.d.ts +1 -0
- package/.opencode/plugin/daytona/git/sandbox-git-manager.d.ts.map +1 -1
- package/.opencode/plugin/daytona/git/sandbox-git-manager.js +4 -1
- package/.opencode/plugin/daytona/git/sandbox-git-manager.js.map +1 -1
- package/.opencode/plugin/daytona/git/session-git-manager.d.ts +8 -1
- package/.opencode/plugin/daytona/git/session-git-manager.d.ts.map +1 -1
- package/.opencode/plugin/daytona/git/session-git-manager.js +55 -35
- package/.opencode/plugin/daytona/git/session-git-manager.js.map +1 -1
- package/.opencode/plugin/daytona/plugins/custom-tools.d.ts.map +1 -1
- package/.opencode/plugin/daytona/plugins/custom-tools.js +2 -0
- package/.opencode/plugin/daytona/plugins/custom-tools.js.map +1 -1
- package/.opencode/plugin/daytona/plugins/session-cleanup.d.ts.map +1 -1
- package/.opencode/plugin/daytona/plugins/session-cleanup.js +10 -12
- package/.opencode/plugin/daytona/plugins/session-cleanup.js.map +1 -1
- package/.opencode/plugin/daytona/plugins/session-idle-auto-commit.d.ts.map +1 -1
- package/.opencode/plugin/daytona/plugins/session-idle-auto-commit.js +10 -12
- package/.opencode/plugin/daytona/plugins/session-idle-auto-commit.js.map +1 -1
- package/.opencode/plugin/daytona/plugins/system-transform.d.ts.map +1 -1
- package/.opencode/plugin/daytona/plugins/system-transform.js +1 -0
- package/.opencode/plugin/daytona/plugins/system-transform.js.map +1 -1
- package/.opencode/plugin/daytona/tools/bash.d.ts +1 -1
- package/.opencode/plugin/daytona/tools/bash.d.ts.map +1 -1
- package/.opencode/plugin/daytona/tools/bash.js +5 -2
- package/.opencode/plugin/daytona/tools/bash.js.map +1 -1
- package/.opencode/plugin/daytona/tools.d.ts.map +1 -1
- package/.opencode/plugin/daytona/tools.js +2 -1
- package/.opencode/plugin/daytona/tools.js.map +1 -1
- package/README.md +12 -5
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ export declare class DaytonaSessionManager {
|
|
|
9
9
|
private readonly dataStorage;
|
|
10
10
|
private sessionSandboxes;
|
|
11
11
|
private currentProjectId?;
|
|
12
|
-
|
|
12
|
+
readonly repoPath: string;
|
|
13
13
|
constructor(apiKey: string, storageDir: string, repoPath: string);
|
|
14
14
|
/**
|
|
15
15
|
* Check if a sandbox is fully initialized (has process property)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-manager.d.ts","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/core/session-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAKtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"session-manager.d.ts","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/core/session-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAKtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAGtD,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAoB;IAChD,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,gBAAgB,CAAC,CAAQ;IACjC,SAAgB,QAAQ,EAAE,MAAM,CAAA;gBAEpB,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAOhE;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAI1B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAI9B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAU3B;;OAEG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAO1C;;OAEG;IACH,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAInF;;OAEG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAqFnH;;OAEG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAmCzE"}
|
|
@@ -6,6 +6,7 @@ import { Daytona } from '@daytonaio/sdk';
|
|
|
6
6
|
import { logger } from './logger';
|
|
7
7
|
import { SessionGitManager } from '../git/session-git-manager';
|
|
8
8
|
import { ProjectDataStorage } from './project-data-storage';
|
|
9
|
+
import { toast } from './toast';
|
|
9
10
|
export class DaytonaSessionManager {
|
|
10
11
|
apiKey;
|
|
11
12
|
dataStorage;
|
|
@@ -61,17 +62,16 @@ export class DaytonaSessionManager {
|
|
|
61
62
|
* Get or create a sandbox for the given session ID
|
|
62
63
|
*/
|
|
63
64
|
async getSandbox(sessionId, projectId, worktree, pluginCtx) {
|
|
65
|
+
if (pluginCtx?.client?.tui) {
|
|
66
|
+
toast.initialize(pluginCtx.client.tui);
|
|
67
|
+
}
|
|
64
68
|
if (!this.apiKey) {
|
|
65
69
|
logger.error('DAYTONA_API_KEY is not set. Cannot create or retrieve sandbox.');
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
variant: 'error',
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
}
|
|
70
|
+
toast.show({
|
|
71
|
+
title: 'Sandbox error',
|
|
72
|
+
message: 'DAYTONA_API_KEY is not set. Please set the environment variable to use Daytona sandboxes.',
|
|
73
|
+
variant: 'error',
|
|
74
|
+
});
|
|
75
75
|
throw new Error('DAYTONA_API_KEY is not set. Please set the environment variable to use Daytona sandboxes.');
|
|
76
76
|
}
|
|
77
77
|
// Load project sessions if needed
|
|
@@ -79,6 +79,12 @@ export class DaytonaSessionManager {
|
|
|
79
79
|
const existing = this.sessionSandboxes.get(sessionId);
|
|
80
80
|
// If we have a fully initialized sandbox, reuse it
|
|
81
81
|
if (this.isFullyInitialized(existing)) {
|
|
82
|
+
// Refresh sandbox state and ensure it's running
|
|
83
|
+
await existing.refreshData();
|
|
84
|
+
if (existing.state !== 'started') {
|
|
85
|
+
logger.info(`Starting sandbox ${existing.id} (current state: ${existing.state})`);
|
|
86
|
+
await existing.start();
|
|
87
|
+
}
|
|
82
88
|
this.dataStorage.updateSession(projectId, worktree, sessionId, existing.id);
|
|
83
89
|
return existing;
|
|
84
90
|
}
|
|
@@ -95,15 +101,11 @@ export class DaytonaSessionManager {
|
|
|
95
101
|
branchNumber = this.dataStorage.getNextBranchNumber(projectId);
|
|
96
102
|
}
|
|
97
103
|
this.dataStorage.updateSession(projectId, worktree, sessionId, sandbox.id, branchNumber);
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
variant: 'info',
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
}
|
|
104
|
+
toast.show({
|
|
105
|
+
title: 'Sandbox connected',
|
|
106
|
+
message: `Connected to existing sandbox.`,
|
|
107
|
+
variant: 'info',
|
|
108
|
+
});
|
|
107
109
|
return sandbox;
|
|
108
110
|
}
|
|
109
111
|
// Otherwise, create a new sandbox
|
|
@@ -125,25 +127,17 @@ export class DaytonaSessionManager {
|
|
|
125
127
|
}
|
|
126
128
|
catch (err) {
|
|
127
129
|
logger.error(`Failed to initialize git repo or push local changes in sandbox: ${err}`);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
message: err?.message || 'Failed to initialize git repo in sandbox.',
|
|
133
|
-
variant: 'error',
|
|
134
|
-
},
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
if (pluginCtx?.client?.tui?.showToast) {
|
|
139
|
-
pluginCtx.client.tui.showToast({
|
|
140
|
-
body: {
|
|
141
|
-
title: 'Sandbox created',
|
|
142
|
-
message: `Created new sandbox for session.`,
|
|
143
|
-
variant: 'success',
|
|
144
|
-
},
|
|
130
|
+
toast.show({
|
|
131
|
+
title: 'Git error',
|
|
132
|
+
message: err?.message || 'Failed to initialize git repo in sandbox.',
|
|
133
|
+
variant: 'error',
|
|
145
134
|
});
|
|
146
135
|
}
|
|
136
|
+
toast.show({
|
|
137
|
+
title: 'Sandbox created',
|
|
138
|
+
message: `Created new sandbox for session.`,
|
|
139
|
+
variant: 'success',
|
|
140
|
+
});
|
|
147
141
|
return sandbox;
|
|
148
142
|
}
|
|
149
143
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-manager.js","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/core/session-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAgB,MAAM,gBAAgB,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU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AO,CAAC,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;oBAClD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;gBAC/C,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,MAAM,CAAC,KAAK,CAAC,kCAAkC,WAAW,CAAC,SAAS,KAAK,GAAG,EAAE,CAAC,CAAA;gBACjF,CAAC;YACH,CAAC;QACH,CAAC;QAED,wDAAwD;QACxD,IAAI,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;YACrC,MAAM,CAAC,IAAI,CAAC,iCAAiC,SAAS,EAAE,CAAC,CAAA;YACzD,MAAM,OAAO,CAAC,MAAM,EAAE,CAAA;YACtB,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;YAEvC,sBAAsB;YACtB,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YACpD,IAAI,WAAW,EAAE,CAAC;gBAChB,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,SAAS,EAAE,WAAW,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;YAC5E,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAA;QAC9C,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,iCAAiC,SAAS,EAAE,CAAC,CAAA;QAC3D,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global toast notification singleton
|
|
3
|
+
* Queues toasts to prevent showing multiple at the same time
|
|
4
|
+
*/
|
|
5
|
+
type ToastVariant = 'success' | 'error' | 'warning' | 'info';
|
|
6
|
+
interface ToastOptions {
|
|
7
|
+
title: string;
|
|
8
|
+
message: string;
|
|
9
|
+
variant?: ToastVariant;
|
|
10
|
+
}
|
|
11
|
+
interface TuiShowToast {
|
|
12
|
+
showToast: (options: {
|
|
13
|
+
body: {
|
|
14
|
+
title: string;
|
|
15
|
+
message: string;
|
|
16
|
+
variant: ToastVariant;
|
|
17
|
+
};
|
|
18
|
+
}) => void;
|
|
19
|
+
}
|
|
20
|
+
declare class ToastManager {
|
|
21
|
+
private tui;
|
|
22
|
+
private queue;
|
|
23
|
+
private isShowing;
|
|
24
|
+
/**
|
|
25
|
+
* Initialize the toast manager with the TUI instance
|
|
26
|
+
*/
|
|
27
|
+
initialize(tui: TuiShowToast | null | undefined): void;
|
|
28
|
+
/**
|
|
29
|
+
* Show a toast notification
|
|
30
|
+
* If a toast is currently showing, this will be queued
|
|
31
|
+
*/
|
|
32
|
+
show(options: ToastOptions): void;
|
|
33
|
+
/**
|
|
34
|
+
* Process the toast queue, showing one toast at a time
|
|
35
|
+
*/
|
|
36
|
+
private processQueue;
|
|
37
|
+
/**
|
|
38
|
+
* Clear all pending toasts
|
|
39
|
+
*/
|
|
40
|
+
clear(): void;
|
|
41
|
+
}
|
|
42
|
+
export declare const toast: ToastManager;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/core/toast.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,KAAK,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA;AAE5D,UAAU,YAAY;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,YAAY,CAAA;CACvB;AAED,UAAU,YAAY;IACpB,SAAS,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,YAAY,CAAA;SAAE,CAAA;KAAE,KAAK,IAAI,CAAA;CAClG;AAED,cAAM,YAAY;IAChB,OAAO,CAAC,GAAG,CAA4B;IACvC,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,SAAS,CAAQ;IAEzB;;OAEG;IACH,UAAU,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI;IAItD;;;OAGG;IACH,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAUjC;;OAEG;IACH,OAAO,CAAC,YAAY;IAmCpB;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd;AAGD,eAAO,MAAM,KAAK,cAAqB,CAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global toast notification singleton
|
|
3
|
+
* Queues toasts to prevent showing multiple at the same time
|
|
4
|
+
*/
|
|
5
|
+
class ToastManager {
|
|
6
|
+
tui = null;
|
|
7
|
+
queue = [];
|
|
8
|
+
isShowing = false;
|
|
9
|
+
/**
|
|
10
|
+
* Initialize the toast manager with the TUI instance
|
|
11
|
+
*/
|
|
12
|
+
initialize(tui) {
|
|
13
|
+
this.tui = tui || null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Show a toast notification
|
|
17
|
+
* If a toast is currently showing, this will be queued
|
|
18
|
+
*/
|
|
19
|
+
show(options) {
|
|
20
|
+
const toast = {
|
|
21
|
+
variant: 'info',
|
|
22
|
+
...options,
|
|
23
|
+
};
|
|
24
|
+
this.queue.push(toast);
|
|
25
|
+
this.processQueue();
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Process the toast queue, showing one toast at a time
|
|
29
|
+
*/
|
|
30
|
+
processQueue() {
|
|
31
|
+
if (this.isShowing || this.queue.length === 0) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (!this.tui) {
|
|
35
|
+
// If TUI is not available, clear the queue
|
|
36
|
+
this.queue = [];
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
this.isShowing = true;
|
|
40
|
+
const toast = this.queue.shift();
|
|
41
|
+
try {
|
|
42
|
+
this.tui.showToast({
|
|
43
|
+
body: {
|
|
44
|
+
title: toast.title,
|
|
45
|
+
message: toast.message,
|
|
46
|
+
variant: toast.variant || 'info',
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
// If showing fails, continue with next toast
|
|
52
|
+
console.error('Failed to show toast:', err);
|
|
53
|
+
}
|
|
54
|
+
// Wait a bit before showing the next toast to avoid overlap
|
|
55
|
+
// Most toasts are visible for 2-3 seconds, so we wait 2.5 seconds
|
|
56
|
+
setTimeout(() => {
|
|
57
|
+
this.isShowing = false;
|
|
58
|
+
this.processQueue();
|
|
59
|
+
}, 2500);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Clear all pending toasts
|
|
63
|
+
*/
|
|
64
|
+
clear() {
|
|
65
|
+
this.queue = [];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Export singleton instance
|
|
69
|
+
export const toast = new ToastManager();
|
|
70
|
+
//# sourceMappingURL=toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.js","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/core/toast.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,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;QACt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Checks if a git repository exists in the current directory
|
|
5
|
+
* @returns true if a git repo exists, false otherwise
|
|
6
|
+
*/
|
|
7
|
+
hasRepo(): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Pushes local changes to the sandbox remote.
|
|
10
|
+
* @param remoteName Numbered remote (e.g. sandbox-2) matching opencode/N.
|
|
4
11
|
* @param sshUrl The SSH URL of the sandbox remote.
|
|
5
12
|
* @param branch The branch to push to.
|
|
13
|
+
* @returns true if push was successful, false if no repo exists
|
|
6
14
|
*/
|
|
7
|
-
pushLocalToSandboxRemote(sshUrl: string, branch: string):
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
push(remoteName: string, branch: string): void;
|
|
15
|
+
pushLocalToSandboxRemote(remoteName: string, sshUrl: string, branch: string): Promise<boolean>;
|
|
16
|
+
private setRemote;
|
|
17
|
+
pull(remoteName: string, sshUrl: string, branch: string, localBranch?: string): Promise<void>;
|
|
18
|
+
push(remoteName: string, sshUrl: string, branch: string): Promise<void>;
|
|
12
19
|
}
|
|
13
20
|
//# sourceMappingURL=host-git-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-git-manager.d.ts","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/git/host-git-manager.ts"],"names":[],"mappings":"AAOA,qBAAa,cAAc;
|
|
1
|
+
{"version":3,"file":"host-git-manager.d.ts","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/git/host-git-manager.ts"],"names":[],"mappings":"AAOA,qBAAa,cAAc;IAEzB,OAAO,CAAC,cAAc,CAAmC;IAEzD;;;OAGG;IACH,OAAO,IAAI,OAAO;IASlB;;;;;;OAMG;IACG,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAsCpG,OAAO,CAAC,SAAS;IAUX,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA8B7F,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAsB9E"}
|
|
@@ -5,46 +5,65 @@ function execSyncSilent(cmd, options = {}) {
|
|
|
5
5
|
}
|
|
6
6
|
export class HostGitManager {
|
|
7
7
|
// No constructor needed; use global logger
|
|
8
|
+
operationQueue = Promise.resolve();
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
+
* Checks if a git repository exists in the current directory
|
|
11
|
+
* @returns true if a git repo exists, false otherwise
|
|
12
|
+
*/
|
|
13
|
+
hasRepo() {
|
|
14
|
+
try {
|
|
15
|
+
execSyncSilent('git rev-parse --is-inside-work-tree');
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Pushes local changes to the sandbox remote.
|
|
24
|
+
* @param remoteName Numbered remote (e.g. sandbox-2) matching opencode/N.
|
|
10
25
|
* @param sshUrl The SSH URL of the sandbox remote.
|
|
11
26
|
* @param branch The branch to push to.
|
|
27
|
+
* @returns true if push was successful, false if no repo exists
|
|
12
28
|
*/
|
|
13
|
-
pushLocalToSandboxRemote(sshUrl, branch) {
|
|
29
|
+
async pushLocalToSandboxRemote(remoteName, sshUrl, branch) {
|
|
30
|
+
if (!this.hasRepo()) {
|
|
31
|
+
logger.warn('No local git repository found. Skipping push to sandbox.');
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
14
34
|
try {
|
|
15
|
-
logger.info(`
|
|
16
|
-
|
|
17
|
-
execSyncSilent('git
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
logger.info(`Pushing to ${remoteName} (${sshUrl}) on branch ${branch}`);
|
|
36
|
+
const operation = this.operationQueue.then(async () => {
|
|
37
|
+
execSyncSilent('git add .');
|
|
38
|
+
execSyncSilent('git commit -m "Sync local changes before agent start" || echo "No changes to commit"', {
|
|
39
|
+
shell: '/bin/bash',
|
|
40
|
+
});
|
|
41
|
+
this.setRemote(remoteName, sshUrl);
|
|
42
|
+
let attempts = 0;
|
|
43
|
+
while (attempts < 3) {
|
|
44
|
+
try {
|
|
45
|
+
execSyncSilent(`git push ${remoteName} HEAD:${branch}`);
|
|
46
|
+
logger.info(`✓ Pushed local changes to ${remoteName}`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
attempts++;
|
|
51
|
+
if (attempts >= 3) {
|
|
52
|
+
logger.error(`Error pushing to ${remoteName} after 3 attempts: ${e}`);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
logger.warn(`Push attempt ${attempts} failed, retrying...`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
32
59
|
});
|
|
33
|
-
|
|
34
|
-
|
|
60
|
+
this.operationQueue = operation;
|
|
61
|
+
await operation;
|
|
62
|
+
return true;
|
|
35
63
|
}
|
|
36
64
|
catch (e) {
|
|
37
65
|
logger.error(`Error pushing to sandbox: ${e}`);
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
ensureRepo() {
|
|
41
|
-
try {
|
|
42
|
-
execSyncSilent('git rev-parse --is-inside-work-tree');
|
|
43
|
-
logger.info('Git repo already exists in local worktree.');
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
46
|
-
execSyncSilent('git init');
|
|
47
|
-
logger.info('Initialized new git repo in local worktree.');
|
|
66
|
+
return false;
|
|
48
67
|
}
|
|
49
68
|
}
|
|
50
69
|
setRemote(remoteName, sshUrl) {
|
|
@@ -57,41 +76,61 @@ export class HostGitManager {
|
|
|
57
76
|
logger.warn(`Could not set sandbox remote: ${e}`);
|
|
58
77
|
}
|
|
59
78
|
}
|
|
60
|
-
pull(remoteName, branch, localBranch) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
79
|
+
async pull(remoteName, sshUrl, branch, localBranch) {
|
|
80
|
+
const operation = this.operationQueue.then(async () => {
|
|
81
|
+
this.setRemote(remoteName, sshUrl);
|
|
82
|
+
let attempts = 0;
|
|
83
|
+
// The first pull attempt sometimes fails. I'm not sure what the cause is.
|
|
84
|
+
while (attempts < 3) {
|
|
85
|
+
try {
|
|
86
|
+
if (localBranch) {
|
|
87
|
+
// Fetch the remote branch into the specified local branch
|
|
88
|
+
execSyncSilent(`git fetch ${remoteName} ${branch}:${localBranch}`);
|
|
89
|
+
logger.info(`✓ Fetched latest changes from sandbox into ${localBranch}`);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
execSyncSilent(`git pull ${remoteName} ${branch}`);
|
|
93
|
+
logger.info('✓ Pulled latest changes from sandbox');
|
|
94
|
+
}
|
|
95
|
+
return;
|
|
69
96
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
97
|
+
catch (e) {
|
|
98
|
+
attempts++;
|
|
99
|
+
if (attempts >= 3) {
|
|
100
|
+
logger.error(`Error pulling from sandbox after 3 attempts: ${e}`);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
logger.warn(`Pull attempt ${attempts} failed, retrying...`);
|
|
104
|
+
}
|
|
73
105
|
}
|
|
74
|
-
return;
|
|
75
106
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
107
|
+
});
|
|
108
|
+
this.operationQueue = operation;
|
|
109
|
+
await operation;
|
|
110
|
+
}
|
|
111
|
+
async push(remoteName, sshUrl, branch) {
|
|
112
|
+
const operation = this.operationQueue.then(async () => {
|
|
113
|
+
this.setRemote(remoteName, sshUrl);
|
|
114
|
+
let attempts = 0;
|
|
115
|
+
while (attempts < 3) {
|
|
116
|
+
try {
|
|
117
|
+
execSyncSilent(`git push ${remoteName} HEAD:${branch}`);
|
|
118
|
+
logger.info('✓ Pushed changes to sandbox');
|
|
119
|
+
return;
|
|
80
120
|
}
|
|
81
|
-
|
|
82
|
-
|
|
121
|
+
catch (e) {
|
|
122
|
+
attempts++;
|
|
123
|
+
if (attempts >= 3) {
|
|
124
|
+
logger.error(`Error pushing to sandbox after 3 attempts: ${e}`);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
logger.warn(`Push attempt ${attempts} failed, retrying...`);
|
|
128
|
+
}
|
|
83
129
|
}
|
|
84
130
|
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
try {
|
|
89
|
-
execSyncSilent(`git push ${remoteName} HEAD:${branch}`);
|
|
90
|
-
logger.info('✓ Pushed changes to sandbox');
|
|
91
|
-
}
|
|
92
|
-
catch (e) {
|
|
93
|
-
logger.error(`Error pushing to sandbox: ${e}`);
|
|
94
|
-
}
|
|
131
|
+
});
|
|
132
|
+
this.operationQueue = operation;
|
|
133
|
+
await operation;
|
|
95
134
|
}
|
|
96
135
|
}
|
|
97
136
|
//# sourceMappingURL=host-git-manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-git-manager.js","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/git/host-git-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,
|
|
1
|
+
{"version":3,"file":"host-git-manager.js","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/git/host-git-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,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AAO,CAAC,EAAE,CAAC;oBACX,QAAQ,EAAE,CAAA;oBACV,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;wBAClB,MAAM,CAAC,KAAK,CAAC,8CAA8C,CAAC,EAAE,CAAC,CAAA;oBACjE,CAAC;yBAAM,CAAC;wBACN,MAAM,CAAC,IAAI,CAAC,gBAAgB,QAAQ,sBAAsB,CAAC,CAAA;oBAC7D,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,cAAc,GAAG,SAAS,CAAA;QAC/B,MAAM,SAAS,CAAA;IACjB,CAAC;CACF"}
|
|
@@ -3,6 +3,7 @@ export declare class DaytonaSandboxGitManager {
|
|
|
3
3
|
private readonly sandbox;
|
|
4
4
|
private readonly repoPath;
|
|
5
5
|
constructor(sandbox: Sandbox, repoPath: string);
|
|
6
|
+
ensureDirectory(): Promise<void>;
|
|
6
7
|
ensureRepo(): Promise<void>;
|
|
7
8
|
autoCommit(): Promise<boolean>;
|
|
8
9
|
resetToRemote(branch: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-git-manager.d.ts","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/git/sandbox-git-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAG7C,qBAAa,wBAAwB;IAEjC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBADR,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM;IAG7B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAW3B,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAqB9B,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAiBnD"}
|
|
1
|
+
{"version":3,"file":"sandbox-git-manager.d.ts","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/git/sandbox-git-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAG7C,qBAAa,wBAAwB;IAEjC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBADR,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM;IAG7B,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAW3B,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAqB9B,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAiBnD"}
|
|
@@ -6,8 +6,11 @@ export class DaytonaSandboxGitManager {
|
|
|
6
6
|
this.sandbox = sandbox;
|
|
7
7
|
this.repoPath = repoPath;
|
|
8
8
|
}
|
|
9
|
+
async ensureDirectory() {
|
|
10
|
+
await this.sandbox.fs.createFolder(this.repoPath, '755');
|
|
11
|
+
}
|
|
9
12
|
async ensureRepo() {
|
|
10
|
-
await this.
|
|
13
|
+
await this.ensureDirectory();
|
|
11
14
|
const isGit = await this.sandbox.process.executeCommand('git rev-parse --is-inside-work-tree', this.repoPath);
|
|
12
15
|
if (!isGit || isGit.result.trim() !== 'true') {
|
|
13
16
|
await this.sandbox.process.executeCommand('git init', this.repoPath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-git-manager.js","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/git/sandbox-git-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAEvC,MAAM,OAAO,wBAAwB;IAEhB;IACA;IAFnB,YACmB,OAAgB,EAChB,QAAgB;QADhB,YAAO,GAAP,OAAO,CAAS;QAChB,aAAQ,GAAR,QAAQ,CAAQ;IAChC,CAAC;IAEJ,KAAK,CAAC,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AAA;YACzE,MAAM,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAA;YACtD,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,wBAAwB,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;YACvG,IAAI,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;gBAC/B,MAAM,CAAC,IAAI,CAAC,iDAAiD,YAAY,CAAC,MAAM,EAAE,CAAC,CAAA;YACrF,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAA;YAC/D,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,KAAK,CAAC,qCAAqC,GAAG,EAAE,CAAC,CAAA;QAC1D,CAAC;IACH,CAAC;CACF"}
|
|
@@ -10,8 +10,15 @@ export declare class SessionGitManager {
|
|
|
10
10
|
private readonly repoPath;
|
|
11
11
|
private readonly branch;
|
|
12
12
|
private readonly localBranch;
|
|
13
|
+
/** Numbered remote (sandbox-2) matches localBranch (opencode/2) */
|
|
14
|
+
private readonly remoteName;
|
|
13
15
|
constructor(sandbox: Sandbox, repoPath: string, branchNumber: number);
|
|
14
16
|
private getSshUrl;
|
|
17
|
+
/**
|
|
18
|
+
* Check if local git repository exists
|
|
19
|
+
* @returns true if repo exists, false otherwise
|
|
20
|
+
*/
|
|
21
|
+
hasLocalRepo(): boolean;
|
|
15
22
|
/**
|
|
16
23
|
* Initialize git in the sandbox and sync with host
|
|
17
24
|
* Used when a new sandbox is created for a session
|
|
@@ -20,7 +27,7 @@ export declare class SessionGitManager {
|
|
|
20
27
|
/**
|
|
21
28
|
* Auto-commit in the sandbox and pull latest from host
|
|
22
29
|
* Used on session idle
|
|
23
|
-
* Returns true if changes were synced, false if no changes
|
|
30
|
+
* Returns true if changes were synced, false if no changes or no local repo
|
|
24
31
|
*/
|
|
25
32
|
autoCommitAndPull(pluginCtx?: PluginInput): Promise<boolean>;
|
|
26
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-git-manager.d.ts","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/git/session-git-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"session-git-manager.d.ts","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/git/session-git-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAK7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEtD;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA0B;IACrD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;IACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;IACpC,mEAAmE;IACnE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;gBAEvB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;YAUtD,SAAS;IAMvB;;;OAGG;IACH,YAAY,IAAI,OAAO;IAIvB;;;OAGG;IACG,iBAAiB,CAAC,SAAS,CAAC,EAAE,WAAW;IAkC/C;;;;OAIG;IACG,iBAAiB,CAAC,SAAS,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;CAoCnE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { logger } from '../core/logger';
|
|
2
|
+
import { toast } from '../core/toast';
|
|
2
3
|
import { DaytonaSandboxGitManager } from './sandbox-git-manager';
|
|
3
4
|
import { HostGitManager } from './host-git-manager';
|
|
4
5
|
/**
|
|
@@ -11,11 +12,14 @@ export class SessionGitManager {
|
|
|
11
12
|
repoPath;
|
|
12
13
|
branch;
|
|
13
14
|
localBranch;
|
|
15
|
+
/** Numbered remote (sandbox-2) matches localBranch (opencode/2) */
|
|
16
|
+
remoteName;
|
|
14
17
|
constructor(sandbox, repoPath, branchNumber) {
|
|
15
18
|
this.sandbox = sandbox;
|
|
16
19
|
this.repoPath = repoPath;
|
|
17
20
|
this.branch = 'opencode';
|
|
18
21
|
this.localBranch = `opencode/${branchNumber}`;
|
|
22
|
+
this.remoteName = `sandbox-${branchNumber}`;
|
|
19
23
|
this.sandboxGit = new DaytonaSandboxGitManager(sandbox, repoPath);
|
|
20
24
|
this.hostGit = new HostGitManager();
|
|
21
25
|
}
|
|
@@ -24,70 +28,86 @@ export class SessionGitManager {
|
|
|
24
28
|
logger.info(`Created SSH access token ${sshAccess.token}@ssh.app.daytona.io`);
|
|
25
29
|
return `ssh://${sshAccess.token}@ssh.app.daytona.io${this.repoPath}`;
|
|
26
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Check if local git repository exists
|
|
33
|
+
* @returns true if repo exists, false otherwise
|
|
34
|
+
*/
|
|
35
|
+
hasLocalRepo() {
|
|
36
|
+
return this.hostGit.hasRepo();
|
|
37
|
+
}
|
|
27
38
|
/**
|
|
28
39
|
* Initialize git in the sandbox and sync with host
|
|
29
40
|
* Used when a new sandbox is created for a session
|
|
30
41
|
*/
|
|
31
42
|
async initializeAndSync(pluginCtx) {
|
|
43
|
+
if (pluginCtx?.client?.tui) {
|
|
44
|
+
toast.initialize(pluginCtx.client.tui);
|
|
45
|
+
}
|
|
32
46
|
try {
|
|
47
|
+
// Check if local git repo exists before initializing sandbox repo
|
|
48
|
+
if (!this.hostGit.hasRepo()) {
|
|
49
|
+
// Always ensure the directory exists, even if git syncing is disabled
|
|
50
|
+
await this.sandboxGit.ensureDirectory();
|
|
51
|
+
logger.warn('No local git repository found. Git syncing is disabled.');
|
|
52
|
+
toast.show({
|
|
53
|
+
title: 'Git syncing disabled',
|
|
54
|
+
message: 'No local git repository found. Git syncing is disabled for this session.',
|
|
55
|
+
variant: 'warning',
|
|
56
|
+
});
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
33
59
|
await this.sandboxGit.ensureRepo();
|
|
34
|
-
this.hostGit.ensureRepo();
|
|
35
60
|
const sshUrl = await this.getSshUrl();
|
|
36
|
-
this.hostGit.
|
|
37
|
-
|
|
38
|
-
|
|
61
|
+
const pushed = await this.hostGit.pushLocalToSandboxRemote(this.remoteName, sshUrl, this.branch);
|
|
62
|
+
if (pushed) {
|
|
63
|
+
await this.sandboxGit.resetToRemote(this.branch);
|
|
64
|
+
}
|
|
39
65
|
}
|
|
40
66
|
catch (err) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
variant: 'error',
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
}
|
|
67
|
+
toast.show({
|
|
68
|
+
title: 'Git sync error',
|
|
69
|
+
message: err?.message || 'Failed to sync git repo.',
|
|
70
|
+
variant: 'error',
|
|
71
|
+
});
|
|
50
72
|
throw err;
|
|
51
73
|
}
|
|
52
74
|
}
|
|
53
75
|
/**
|
|
54
76
|
* Auto-commit in the sandbox and pull latest from host
|
|
55
77
|
* Used on session idle
|
|
56
|
-
* Returns true if changes were synced, false if no changes
|
|
78
|
+
* Returns true if changes were synced, false if no changes or no local repo
|
|
57
79
|
*/
|
|
58
80
|
async autoCommitAndPull(pluginCtx) {
|
|
81
|
+
if (pluginCtx?.client?.tui) {
|
|
82
|
+
toast.initialize(pluginCtx.client.tui);
|
|
83
|
+
}
|
|
59
84
|
try {
|
|
85
|
+
// Check if local git repo exists before attempting any git operations
|
|
86
|
+
if (!this.hostGit.hasRepo()) {
|
|
87
|
+
logger.warn('No local git repository found. Git syncing is disabled.');
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
60
90
|
await this.sandboxGit.ensureRepo();
|
|
61
91
|
const hasChanges = await this.sandboxGit.autoCommit();
|
|
62
92
|
// Only sync and notify if there were actual changes
|
|
63
93
|
if (!hasChanges) {
|
|
64
94
|
return false;
|
|
65
95
|
}
|
|
66
|
-
this.hostGit.ensureRepo();
|
|
67
96
|
const sshUrl = await this.getSshUrl();
|
|
68
|
-
this.hostGit.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
message: `Changes have been synced to ${this.localBranch} in your local repository`,
|
|
75
|
-
variant: 'success',
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
}
|
|
97
|
+
await this.hostGit.pull(this.remoteName, sshUrl, this.branch, this.localBranch);
|
|
98
|
+
toast.show({
|
|
99
|
+
title: 'Changes synced',
|
|
100
|
+
message: `Changes have been synced to ${this.localBranch} in your local repository`,
|
|
101
|
+
variant: 'success',
|
|
102
|
+
});
|
|
79
103
|
return true;
|
|
80
104
|
}
|
|
81
105
|
catch (err) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
variant: 'error',
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
}
|
|
106
|
+
toast.show({
|
|
107
|
+
title: 'Sync failed',
|
|
108
|
+
message: err?.message || 'Failed to auto-commit and pull.',
|
|
109
|
+
variant: 'error',
|
|
110
|
+
});
|
|
91
111
|
throw err;
|
|
92
112
|
}
|
|
93
113
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-git-manager.js","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/git/session-git-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAGnD;;GAEG;AACH,MAAM,OAAO,iBAAiB;IACX,UAAU,CAA0B;IACpC,OAAO,CAAgB;IACvB,OAAO,CAAS;IAChB,QAAQ,CAAQ;IAChB,MAAM,CAAQ;IACd,WAAW,CAAQ;
|
|
1
|
+
{"version":3,"file":"session-git-manager.js","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/git/session-git-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAGnD;;GAEG;AACH,MAAM,OAAO,iBAAiB;IACX,UAAU,CAA0B;IACpC,OAAO,CAAgB;IACvB,OAAO,CAAS;IAChB,QAAQ,CAAQ;IAChB,MAAM,CAAQ;IACd,WAAW,CAAQ;IACpC,mEAAmE;IAClD,UAAU,CAAQ;IAEnC,YAAY,OAAgB,EAAE,QAAgB,EAAE,YAAoB;QAClE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,MAAM,GAAG,UAAU,CAAA;QACxB,IAAI,CAAC,WAAW,GAAG,YAAY,YAAY,EAAE,CAAA;QAC7C,IAAI,CAAC,UAAU,GAAG,WAAW,YAAY,EAAE,CAAA;QAC3C,IAAI,CAAC,UAAU,GAAG,IAAI,wBAAwB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;QACjE,IAAI,CAAC,OAAO,GAAG,IAAI,cAAc,EAAE,CAAA;IACrC,CAAC;IAEO,KAAK,CAAC,SAAS;QACrB,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC,CAAA;QACxD,MAAM,CAAC,IAAI,CAAC,4BAA4B,SAAS,CAAC,KAAK,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E,OAAO,IAAI,iCAAiC;gBAC1D,OAAO,EAAE,OAAO;aACjB,CAAC,CAAA;YACF,MAAM,GAAG,CAAA;QACX,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-tools.d.ts","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/plugins/custom-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAA;AAG9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"custom-tools.d.ts","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/plugins/custom-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAA;AAG9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAGpE;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,cAAc,EAAE,qBAAqB,GAAG,MAAM,CAYrF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createDaytonaTools } from '../tools';
|
|
2
2
|
import { logger } from '../core/logger';
|
|
3
|
+
import { toast } from '../core/toast';
|
|
3
4
|
/**
|
|
4
5
|
* Creates the custom tools plugin for Daytona sandbox integration
|
|
5
6
|
* Provides tools for file operations, command execution, and search within sandboxes
|
|
@@ -7,6 +8,7 @@ import { logger } from '../core/logger';
|
|
|
7
8
|
export function createCustomToolsPlugin(sessionManager) {
|
|
8
9
|
return async (pluginCtx) => {
|
|
9
10
|
logger.info('OpenCode started with Daytona plugin');
|
|
11
|
+
toast.initialize(pluginCtx.client?.tui);
|
|
10
12
|
const projectId = pluginCtx.project.id;
|
|
11
13
|
const worktree = pluginCtx.project.worktree;
|
|
12
14
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-tools.js","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/plugins/custom-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"custom-tools.js","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/plugins/custom-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAEvC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAErC;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,cAAqC;IAC3E,OAAO,KAAK,EAAE,SAAsB,EAAE,EAAE;QACtC,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAA;QACnD,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QAEvC,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,CAAA;QACtC,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAA;QAE3C,OAAO;YACL,IAAI,EAAE,kBAAkB,CAAC,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC;SACzE,CAAA;IACH,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-cleanup.d.ts","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/plugins/session-cleanup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"session-cleanup.d.ts","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/plugins/session-cleanup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAKpE;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,cAAc,EAAE,qBAAqB,GAAG,MAAM,CA2BxF"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { EVENT_TYPE_SESSION_DELETED } from '../core/types';
|
|
2
|
+
import { toast } from '../core/toast';
|
|
2
3
|
/**
|
|
3
4
|
* Creates the session cleanup plugin for Daytona
|
|
4
5
|
* Automatically cleans up sandbox resources when sessions end
|
|
5
6
|
*/
|
|
6
7
|
export function createSessionCleanupPlugin(sessionManager) {
|
|
7
8
|
return async (pluginCtx) => {
|
|
9
|
+
toast.initialize(pluginCtx.client?.tui);
|
|
8
10
|
const projectId = pluginCtx.project.id;
|
|
9
11
|
return {
|
|
10
12
|
event: async ({ event }) => {
|
|
@@ -12,21 +14,17 @@ export function createSessionCleanupPlugin(sessionManager) {
|
|
|
12
14
|
const sessionId = event.properties.info.id;
|
|
13
15
|
try {
|
|
14
16
|
await sessionManager.deleteSandbox(sessionId, projectId);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
variant: 'success',
|
|
20
|
-
},
|
|
17
|
+
toast.show({
|
|
18
|
+
title: 'Session deleted',
|
|
19
|
+
message: 'Sandbox deleted successfully.',
|
|
20
|
+
variant: 'success',
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
catch (err) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
variant: 'error',
|
|
29
|
-
},
|
|
24
|
+
toast.show({
|
|
25
|
+
title: 'Delete failed',
|
|
26
|
+
message: err?.message || 'Failed to delete sandbox.',
|
|
27
|
+
variant: 'error',
|
|
30
28
|
});
|
|
31
29
|
throw err;
|
|
32
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-cleanup.js","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/plugins/session-cleanup.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"session-cleanup.js","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/plugins/session-cleanup.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAA;AAE1D,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAErC;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAC,cAAqC;IAC9E,OAAO,KAAK,EAAE,SAAsB,EAAE,EAAE;QACtC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QACvC,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,CAAA;QACtC,OAAO;YACL,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;gBACzB,IAAI,KAAK,CAAC,IAAI,KAAK,0BAA0B,EAAE,CAAC;oBAC9C,MAAM,SAAS,GAAI,KAA6B,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAA;oBACnE,IAAI,CAAC;wBACH,MAAM,cAAc,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;wBACxD,KAAK,CAAC,IAAI,CAAC;4BACT,KAAK,EAAE,iBAAiB;4BACxB,OAAO,EAAE,+BAA+B;4BACxC,OAAO,EAAE,SAAS;yBACnB,CAAC,CAAA;oBACJ,CAAC;oBAAC,OAAO,GAAQ,EAAE,CAAC;wBAClB,KAAK,CAAC,IAAI,CAAC;4BACT,KAAK,EAAE,eAAe;4BACtB,OAAO,EAAE,GAAG,EAAE,OAAO,IAAI,2BAA2B;4BACpD,OAAO,EAAE,OAAO;yBACjB,CAAC,CAAA;wBACF,MAAM,GAAG,CAAA;oBACX,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAA;IACH,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-idle-auto-commit.d.ts","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/plugins/session-idle-auto-commit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"session-idle-auto-commit.d.ts","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/plugins/session-idle-auto-commit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAKpE;;GAEG;AACH,wBAAgB,iCAAiC,CAAC,cAAc,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAoCjH"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { SessionGitManager } from '../git/session-git-manager';
|
|
2
2
|
import { EVENT_TYPE_SESSION_IDLE } from '../core/types';
|
|
3
|
+
import { toast } from '../core/toast';
|
|
3
4
|
/**
|
|
4
5
|
* Creates a plugin to auto-commit in the sandbox on session idle
|
|
5
6
|
*/
|
|
6
7
|
export function createSessionIdleAutoCommitPlugin(sessionManager, repoPath) {
|
|
7
8
|
return async (pluginCtx) => {
|
|
9
|
+
toast.initialize(pluginCtx.client?.tui);
|
|
8
10
|
const projectId = pluginCtx.project.id;
|
|
9
11
|
const worktree = pluginCtx.project.worktree;
|
|
10
12
|
return {
|
|
@@ -16,12 +18,10 @@ export function createSessionIdleAutoCommitPlugin(sessionManager, repoPath) {
|
|
|
16
18
|
const sandbox = await sessionManager.getSandbox(sessionId, projectId, worktree, pluginCtx);
|
|
17
19
|
const branchNumber = sessionManager.getBranchNumberForSandbox(projectId, sandbox.id);
|
|
18
20
|
if (!branchNumber) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
variant: 'error',
|
|
24
|
-
},
|
|
21
|
+
toast.show({
|
|
22
|
+
title: 'Auto-commit failed',
|
|
23
|
+
message: `No branch number found for sandbox ${sandbox.id}`,
|
|
24
|
+
variant: 'error',
|
|
25
25
|
});
|
|
26
26
|
throw new Error(`No branch number found for sandbox ${sandbox.id}`);
|
|
27
27
|
}
|
|
@@ -29,12 +29,10 @@ export function createSessionIdleAutoCommitPlugin(sessionManager, repoPath) {
|
|
|
29
29
|
await sessionGit.autoCommitAndPull(pluginCtx);
|
|
30
30
|
}
|
|
31
31
|
catch (err) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
variant: 'error',
|
|
37
|
-
},
|
|
32
|
+
toast.show({
|
|
33
|
+
title: 'Auto-commit error',
|
|
34
|
+
message: err?.message || 'Failed to auto-commit and pull.',
|
|
35
|
+
variant: 'error',
|
|
38
36
|
});
|
|
39
37
|
throw err;
|
|
40
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-idle-auto-commit.js","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/plugins/session-idle-auto-commit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"session-idle-auto-commit.js","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/plugins/session-idle-auto-commit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAErC;;GAEG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,CAAC,IAAI,CAAC;4BACT,KAAK,EAAE,mBAAmB;4BAC1B,OAAO,EAAE,GAAG,EAAE,OAAO,IAAI,iCAAiC;4BAC1D,OAAO,EAAE,OAAO;yBACjB,CAAC,CAAA;wBACF,MAAM,GAAG,CAAA;oBACX,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAA;IACH,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-transform.d.ts","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/plugins/system-transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAA;AAM9D;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"system-transform.d.ts","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/plugins/system-transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAA;AAM9D;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAkBpE"}
|
|
@@ -10,6 +10,7 @@ export function createSystemTransformPlugin(repoPath) {
|
|
|
10
10
|
## Daytona Sandbox Integration
|
|
11
11
|
This session is integrated with a Daytona sandbox.
|
|
12
12
|
The main project repository is located at: ${repoPath}.
|
|
13
|
+
Bash commands will run in this directory.
|
|
13
14
|
Work in this directory. Do NOT try to use the current working directory of the host system.
|
|
14
15
|
When executing long-running commands, use the 'background' option to run them asynchronously.
|
|
15
16
|
`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-transform.js","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/plugins/system-transform.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CAAC,QAAgB;IAC1D,OAAO,KAAK,EAAE,SAAsB,EAAE,EAAE;QACtC,OAAO;YACL,oCAAoC,EAAE,KAAK,EACzC,KAA2C,EAC3C,MAA6C,EAC7C,EAAE;gBACF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;;;qDAG0B,QAAQ
|
|
1
|
+
{"version":3,"file":"system-transform.js","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/plugins/system-transform.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CAAC,QAAgB;IAC1D,OAAO,KAAK,EAAE,SAAsB,EAAE,EAAE;QACtC,OAAO;YACL,oCAAoC,EAAE,KAAK,EACzC,KAA2C,EAC3C,MAA6C,EAC7C,EAAE;gBACF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;;;qDAG0B,QAAQ;;;;OAItD,CAAC,CAAA;YACF,CAAC;SACF,CAAA;IACH,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { ToolContext, PluginInput } from '@opencode-ai/plugin';
|
|
3
3
|
import type { DaytonaSessionManager } from '../core/session-manager';
|
|
4
|
-
export declare const bashTool: (sessionManager: DaytonaSessionManager, projectId: string, worktree: string, pluginCtx: PluginInput) => {
|
|
4
|
+
export declare const bashTool: (sessionManager: DaytonaSessionManager, projectId: string, worktree: string, pluginCtx: PluginInput, repoPath: string) => {
|
|
5
5
|
description: string;
|
|
6
6
|
args: {
|
|
7
7
|
command: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/tools/bash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAEpE,eAAO,MAAM,QAAQ,GAAI,gBAAgB,qBAAqB,EAAE,WAAW,MAAM,EAAE,UAAU,MAAM,EAAE,WAAW,WAAW;;;;;;
|
|
1
|
+
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/tools/bash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAEpE,eAAO,MAAM,QAAQ,GAAI,gBAAgB,qBAAqB,EAAE,WAAW,MAAM,EAAE,UAAU,MAAM,EAAE,WAAW,WAAW,EAAE,UAAU,MAAM;;;;;;kBAMvH;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,OAAO,WAAW;CAwB/E,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export const bashTool = (sessionManager, projectId, worktree, pluginCtx) => ({
|
|
2
|
+
export const bashTool = (sessionManager, projectId, worktree, pluginCtx, repoPath) => ({
|
|
3
3
|
description: 'Executes shell commands in a Daytona sandbox',
|
|
4
4
|
args: {
|
|
5
5
|
command: z.string(),
|
|
@@ -16,6 +16,9 @@ export const bashTool = (sessionManager, projectId, worktree, pluginCtx) => ({
|
|
|
16
16
|
catch {
|
|
17
17
|
await sandbox.process.createSession(execSessionId);
|
|
18
18
|
}
|
|
19
|
+
await sandbox.process.executeSessionCommand(execSessionId, {
|
|
20
|
+
command: `cd ${repoPath}`,
|
|
21
|
+
});
|
|
19
22
|
const result = await sandbox.process.executeSessionCommand(execSessionId, {
|
|
20
23
|
command: args.command,
|
|
21
24
|
runAsync: true,
|
|
@@ -23,7 +26,7 @@ export const bashTool = (sessionManager, projectId, worktree, pluginCtx) => ({
|
|
|
23
26
|
return `Command started in background (cmdId: ${result.cmdId})`;
|
|
24
27
|
}
|
|
25
28
|
else {
|
|
26
|
-
const result = await sandbox.process.executeCommand(args.command);
|
|
29
|
+
const result = await sandbox.process.executeCommand(args.command, repoPath);
|
|
27
30
|
return `Exit code: ${result.exitCode}\n${result.result}`;
|
|
28
31
|
}
|
|
29
32
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash.js","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/tools/bash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,cAAqC,EAAE,SAAiB,EAAE,QAAgB,EAAE,SAAsB,EAAE,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"bash.js","sourceRoot":"","sources":["../../../../../.opencode/plugin/daytona/tools/bash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,cAAqC,EAAE,SAAiB,EAAE,QAAgB,EAAE,SAAsB,EAAE,QAAgB,EAAE,EAAE,CAAC,CAAC;IACjJ,WAAW,EAAE,8CAA8C;IAC3D,IAAI,EAAE;QACJ,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;KACnC;IACD,KAAK,CAAC,OAAO,CAAC,IAA+C,EAAE,GAAgB;QAC7E,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS,CAAA;QAC/B,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,UAAU,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAA;QAE1F,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,MAAM,aAAa,GAAG,gBAAgB,SAAS,EAAE,CAAA;YACjD,IAAI,CAAC;gBACH,MAAM,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;YACjD,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAAA;YACpD,CAAC;YACD,MAAM,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,aAAa,EAAE;gBACzD,OAAO,EAAE,MAAM,QAAQ,EAAE;aAC1B,CAAC,CAAA;YACF,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,aAAa,EAAE;gBACxE,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,QAAQ,EAAE,IAAI;aACf,CAAC,CAAA;YACF,OAAO,yCAAyC,MAAM,CAAC,KAAK,GAAG,CAAA;QACjE,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;YAC3E,OAAO,cAAc,MAAM,CAAC,QAAQ,KAAK,MAAM,CAAC,MAAM,EAAE,CAAA;QAC1D,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../../.opencode/plugin/daytona/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAcH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEtD,wBAAgB,kBAAkB,CAAC,cAAc,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../../.opencode/plugin/daytona/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAcH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEtD,wBAAgB,kBAAkB,CAAC,cAAc,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW;;;;;;;;;sBALrG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAtB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBX"}
|
|
@@ -13,8 +13,9 @@ import { grepTool } from './tools/grep';
|
|
|
13
13
|
import { lspTool } from './tools/lsp';
|
|
14
14
|
import { getPreviewURLTool } from './tools/get-preview-url';
|
|
15
15
|
export function createDaytonaTools(sessionManager, projectId, worktree, pluginCtx) {
|
|
16
|
+
const repoPath = sessionManager.repoPath;
|
|
16
17
|
return {
|
|
17
|
-
bash: bashTool(sessionManager, projectId, worktree, pluginCtx),
|
|
18
|
+
bash: bashTool(sessionManager, projectId, worktree, pluginCtx, repoPath),
|
|
18
19
|
read: readTool(sessionManager, projectId, worktree, pluginCtx),
|
|
19
20
|
write: writeTool(sessionManager, projectId, worktree, pluginCtx),
|
|
20
21
|
edit: editTool(sessionManager, projectId, worktree, pluginCtx),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../../.opencode/plugin/daytona/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,aA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AM,QAAQ,GAAG,cAAc,CAAC,QAAQ,CAAA;IACxC,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC;QACxE,IAAI,EAAE,QAAQ,CAAC,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC;QAC9D,KAAK,EAAE,SAAS,CAAC,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC;QAChE,IAAI,EAAE,QAAQ,CAAC,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC;QAC9D,SAAS,EAAE,aAAa,CAAC,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC;QACxE,KAAK,EAAE,SAAS,CAAC,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC;QAChE,EAAE,EAAE,MAAM,CAAC,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC;QAC1D,IAAI,EAAE,QAAQ,CAAC,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC;QAC9D,IAAI,EAAE,QAAQ,CAAC,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC;QAC9D,GAAG,EAAE,OAAO,CAAC,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC;QAC5D,aAAa,EAAE,iBAAiB,CAAC,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC;KACjF,CAAA;AACH,CAAC"}
|
package/README.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# Daytona Sandbox Plugin for OpenCode
|
|
2
2
|
|
|
3
|
-
This is an OpenCode plugin that automatically runs
|
|
3
|
+
This is an OpenCode plugin that automatically runs OpenCode sessions in Daytona sandboxes. Each session has it's own remote sandbox and local git branch, which are automatically kept in sync.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- Securely isolate each OpenCode session in a sandbox environment
|
|
8
|
-
-
|
|
9
|
-
-
|
|
8
|
+
- Preserves sandbox environments indefinitely until the OpenCode session is deleted
|
|
9
|
+
- Generates live preview links when a server starts in the sandbox
|
|
10
|
+
- Synchronizes each OpenCode session to a local git branch
|
|
10
11
|
|
|
11
12
|
## Usage
|
|
12
13
|
|
|
@@ -43,7 +44,13 @@ DAYTONA_API_KEY=your-api-key
|
|
|
43
44
|
|
|
44
45
|
### Running OpenCode
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
Before starting OpenCode, ensure that your project is a git repository:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
git init
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Then start OpenCode in your project using the OpenCode command:
|
|
47
54
|
|
|
48
55
|
```bash
|
|
49
56
|
opencode
|
|
@@ -78,7 +85,7 @@ The plugin uses git to synchronize files between the sandbox and your local syst
|
|
|
78
85
|
#### Sandbox Setup
|
|
79
86
|
|
|
80
87
|
When a new Daytona sandbox is created:
|
|
81
|
-
1. The plugin looks for a git repository in the local directory If none is found,
|
|
88
|
+
1. The plugin looks for a git repository in the local directory. If none is found, file synchronization will be disabled.
|
|
82
89
|
2. In the sandbox, a parallel repository to the local repository is created in the sandbox. An `opencode` branch is created in the sandbox repository.
|
|
83
90
|
3. A new `sandbox` remote is added to the local repository using an SSH connection to the sandbox.
|
|
84
91
|
4. The `HEAD` of the local repository is pushed to `opencode`, and the sandbox repository is reset to match this initial state.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jamesmurdza/opencode-daytona",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"description": "OpenCode plugin that automatically runs all sessions in Daytona sandboxes for isolated, reproducible development environments",
|
|
5
5
|
"main": "./.opencode/plugin/index.js",
|
|
6
6
|
"types": "./.opencode/plugin/index.d.ts",
|