@daytonaio/opencode 0.149.0-alpha.2 → 0.150.0
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 +1 -1
- package/.opencode/plugin/daytona/core/logger.js +1 -1
- package/.opencode/plugin/daytona/core/project-data-storage.d.ts +1 -1
- package/.opencode/plugin/daytona/core/project-data-storage.js +1 -1
- package/.opencode/plugin/daytona/core/session-manager.d.ts +1 -1
- package/.opencode/plugin/daytona/core/session-manager.js +1 -1
- package/.opencode/plugin/daytona/core/toast.d.ts +1 -1
- package/.opencode/plugin/daytona/core/toast.js +1 -1
- package/.opencode/plugin/daytona/core/types.d.ts +1 -1
- package/.opencode/plugin/daytona/core/types.js +1 -1
- package/.opencode/plugin/daytona/git/host-git-manager.d.ts +1 -1
- package/.opencode/plugin/daytona/git/host-git-manager.js +1 -1
- package/.opencode/plugin/daytona/git/index.d.ts +1 -1
- package/.opencode/plugin/daytona/git/index.js +1 -1
- package/.opencode/plugin/daytona/git/sandbox-git-manager.d.ts +1 -1
- package/.opencode/plugin/daytona/git/sandbox-git-manager.js +1 -1
- package/.opencode/plugin/daytona/git/session-git-manager.d.ts +1 -1
- package/.opencode/plugin/daytona/git/session-git-manager.js +1 -1
- package/.opencode/plugin/daytona/index.d.ts +130 -6
- package/.opencode/plugin/daytona/index.js +14 -10
- package/.opencode/plugin/daytona/index.js.map +1 -1
- package/.opencode/plugin/daytona/plugins/custom-tools.d.ts +126 -5
- package/.opencode/plugin/daytona/plugins/custom-tools.js +8 -15
- 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 +55 -0
- package/.opencode/plugin/daytona/plugins/session-events.js.map +1 -0
- package/.opencode/plugin/daytona/plugins/system-transform.d.ts +5 -5
- package/.opencode/plugin/daytona/plugins/system-transform.js +14 -19
- 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.js +1 -1
- package/.opencode/plugin/daytona/tools/edit.d.ts +1 -1
- package/.opencode/plugin/daytona/tools/edit.js +1 -1
- package/.opencode/plugin/daytona/tools/get-preview-url.d.ts +1 -1
- package/.opencode/plugin/daytona/tools/get-preview-url.js +1 -1
- package/.opencode/plugin/daytona/tools/glob.d.ts +1 -1
- package/.opencode/plugin/daytona/tools/glob.js +1 -1
- package/.opencode/plugin/daytona/tools/grep.d.ts +1 -1
- package/.opencode/plugin/daytona/tools/grep.js +1 -1
- package/.opencode/plugin/daytona/tools/ls.d.ts +1 -1
- package/.opencode/plugin/daytona/tools/ls.js +1 -1
- package/.opencode/plugin/daytona/tools/lsp.d.ts +1 -1
- package/.opencode/plugin/daytona/tools/lsp.js +1 -1
- package/.opencode/plugin/daytona/tools/multiedit.d.ts +1 -1
- package/.opencode/plugin/daytona/tools/multiedit.js +1 -1
- package/.opencode/plugin/daytona/tools/patch.d.ts +1 -1
- package/.opencode/plugin/daytona/tools/patch.js +1 -1
- package/.opencode/plugin/daytona/tools/read.d.ts +1 -1
- package/.opencode/plugin/daytona/tools/read.js +1 -1
- package/.opencode/plugin/daytona/tools/write.d.ts +1 -1
- package/.opencode/plugin/daytona/tools/write.js +1 -1
- package/.opencode/plugin/daytona/tools.d.ts +1 -1
- package/.opencode/plugin/daytona/tools.js +1 -1
- package/.opencode/plugin/index.d.ts +4 -4
- package/.opencode/plugin/index.js +6 -4
- package/.opencode/plugin/index.js.map +1 -1
- package/README.md +19 -0
- package/package.json +3 -3
- package/.opencode/plugin/daytona/plugins/index.d.ts +0 -11
- package/.opencode/plugin/daytona/plugins/index.js +0 -19
- package/.opencode/plugin/daytona/plugins/index.js.map +0 -1
- package/.opencode/plugin/daytona/plugins/session-cleanup.d.ts +0 -11
- package/.opencode/plugin/daytona/plugins/session-cleanup.js +0 -43
- package/.opencode/plugin/daytona/plugins/session-cleanup.js.map +0 -1
- package/.opencode/plugin/daytona/plugins/session-idle-auto-commit.d.ts +0 -10
- package/.opencode/plugin/daytona/plugins/session-idle-auto-commit.js +0 -54
- package/.opencode/plugin/daytona/plugins/session-idle-auto-commit.js.map +0 -1
|
@@ -1,10 +1,134 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright Daytona Platforms Inc.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { PluginInput } from '@opencode-ai/plugin';
|
|
6
6
|
export type { EventSessionDeleted, LogLevel, SandboxInfo, SessionInfo, ProjectSessionData } from './core/types';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
declare function daytonaPlugin(ctx: PluginInput): Promise<{
|
|
8
|
+
tool: {
|
|
9
|
+
bash: {
|
|
10
|
+
description: string;
|
|
11
|
+
args: {
|
|
12
|
+
command: import("zod").ZodString;
|
|
13
|
+
background: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
14
|
+
};
|
|
15
|
+
execute(args: {
|
|
16
|
+
command: string;
|
|
17
|
+
background?: boolean;
|
|
18
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
19
|
+
};
|
|
20
|
+
read: {
|
|
21
|
+
description: string;
|
|
22
|
+
args: {
|
|
23
|
+
filePath: import("zod").ZodString;
|
|
24
|
+
};
|
|
25
|
+
execute(args: {
|
|
26
|
+
filePath: string;
|
|
27
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
28
|
+
};
|
|
29
|
+
write: {
|
|
30
|
+
description: string;
|
|
31
|
+
args: {
|
|
32
|
+
filePath: import("zod").ZodString;
|
|
33
|
+
content: import("zod").ZodString;
|
|
34
|
+
};
|
|
35
|
+
execute(args: {
|
|
36
|
+
filePath: string;
|
|
37
|
+
content: string;
|
|
38
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
39
|
+
};
|
|
40
|
+
edit: {
|
|
41
|
+
description: string;
|
|
42
|
+
args: {
|
|
43
|
+
filePath: import("zod").ZodString;
|
|
44
|
+
oldString: import("zod").ZodString;
|
|
45
|
+
newString: import("zod").ZodString;
|
|
46
|
+
};
|
|
47
|
+
execute(args: {
|
|
48
|
+
filePath: string;
|
|
49
|
+
oldString: string;
|
|
50
|
+
newString: string;
|
|
51
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
52
|
+
};
|
|
53
|
+
multiedit: {
|
|
54
|
+
description: string;
|
|
55
|
+
args: {
|
|
56
|
+
filePath: import("zod").ZodString;
|
|
57
|
+
edits: import("zod").ZodArray<import("zod").ZodObject<{
|
|
58
|
+
oldString: import("zod").ZodString;
|
|
59
|
+
newString: import("zod").ZodString;
|
|
60
|
+
}, import("zod/v4/core").$strip>>;
|
|
61
|
+
};
|
|
62
|
+
execute(args: {
|
|
63
|
+
filePath: string;
|
|
64
|
+
edits: Array<{
|
|
65
|
+
oldString: string;
|
|
66
|
+
newString: string;
|
|
67
|
+
}>;
|
|
68
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
69
|
+
};
|
|
70
|
+
patch: {
|
|
71
|
+
description: string;
|
|
72
|
+
args: {
|
|
73
|
+
patchText: import("zod").ZodString;
|
|
74
|
+
};
|
|
75
|
+
execute(args: {
|
|
76
|
+
filePath: string;
|
|
77
|
+
oldSnippet: string;
|
|
78
|
+
newSnippet: string;
|
|
79
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
80
|
+
};
|
|
81
|
+
ls: {
|
|
82
|
+
description: string;
|
|
83
|
+
args: {
|
|
84
|
+
dirPath: import("zod").ZodOptional<import("zod").ZodString>;
|
|
85
|
+
};
|
|
86
|
+
execute(args: {
|
|
87
|
+
dirPath?: string;
|
|
88
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
89
|
+
};
|
|
90
|
+
glob: {
|
|
91
|
+
description: string;
|
|
92
|
+
args: {
|
|
93
|
+
pattern: import("zod").ZodString;
|
|
94
|
+
};
|
|
95
|
+
execute(args: {
|
|
96
|
+
pattern: string;
|
|
97
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
98
|
+
};
|
|
99
|
+
grep: {
|
|
100
|
+
description: string;
|
|
101
|
+
args: {
|
|
102
|
+
pattern: import("zod").ZodString;
|
|
103
|
+
};
|
|
104
|
+
execute(args: {
|
|
105
|
+
pattern: string;
|
|
106
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
107
|
+
};
|
|
108
|
+
lsp: {
|
|
109
|
+
description: string;
|
|
110
|
+
args: {
|
|
111
|
+
op: import("zod").ZodString;
|
|
112
|
+
filePath: import("zod").ZodString;
|
|
113
|
+
line: import("zod").ZodNumber;
|
|
114
|
+
};
|
|
115
|
+
execute(args: {
|
|
116
|
+
op: string;
|
|
117
|
+
filePath: string;
|
|
118
|
+
line: number;
|
|
119
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
120
|
+
};
|
|
121
|
+
getPreviewURL: {
|
|
122
|
+
description: string;
|
|
123
|
+
args: {
|
|
124
|
+
port: import("zod").ZodNumber;
|
|
125
|
+
};
|
|
126
|
+
execute(args: {
|
|
127
|
+
port: number;
|
|
128
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
event: (args: any) => Promise<void>;
|
|
132
|
+
'experimental.chat.system.transform': (input: import("./core/types").ExperimentalChatSystemTransformInput, output: import("./core/types").ExperimentalChatSystemTransformOutput) => Promise<void>;
|
|
133
|
+
}>;
|
|
134
|
+
export default daytonaPlugin;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright
|
|
3
|
+
* Copyright Daytona Platforms Inc.
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.DaytonaSessionIdleAutoCommitPlugin = exports.SystemTransformPlugin = exports.DaytonaSessionCleanupPlugin = exports.CustomToolsPlugin = void 0;
|
|
8
7
|
/**
|
|
9
8
|
* OpenCode Plugin: Daytona Sandbox Integration
|
|
10
9
|
*
|
|
@@ -26,19 +25,24 @@ exports.DaytonaSessionIdleAutoCommitPlugin = exports.SystemTransformPlugin = exp
|
|
|
26
25
|
*/
|
|
27
26
|
const path_1 = require("path");
|
|
28
27
|
const xdg_basedir_1 = require("xdg-basedir");
|
|
29
|
-
// Import modules
|
|
30
28
|
const logger_1 = require("./core/logger");
|
|
31
29
|
const session_manager_1 = require("./core/session-manager");
|
|
32
|
-
const
|
|
33
|
-
|
|
30
|
+
const toast_1 = require("./core/toast");
|
|
31
|
+
const custom_tools_1 = require("./plugins/custom-tools");
|
|
32
|
+
const session_events_1 = require("./plugins/session-events");
|
|
33
|
+
const system_transform_1 = require("./plugins/system-transform");
|
|
34
34
|
const LOG_FILE = (0, path_1.join)(xdg_basedir_1.xdgData, 'opencode', 'log', 'daytona.log');
|
|
35
35
|
const STORAGE_DIR = (0, path_1.join)(xdg_basedir_1.xdgData, 'opencode', 'storage', 'daytona');
|
|
36
36
|
const REPO_PATH = '/home/daytona/project';
|
|
37
37
|
(0, logger_1.setLogFilePath)(LOG_FILE);
|
|
38
38
|
const sessionManager = new session_manager_1.DaytonaSessionManager(process.env.DAYTONA_API_KEY || '', STORAGE_DIR, REPO_PATH);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
async function daytonaPlugin(ctx) {
|
|
40
|
+
toast_1.toast.initialize(ctx.client?.tui);
|
|
41
|
+
return {
|
|
42
|
+
tool: await (0, custom_tools_1.customTools)(ctx, sessionManager),
|
|
43
|
+
event: await (0, session_events_1.eventHandlers)(ctx, sessionManager, REPO_PATH),
|
|
44
|
+
'experimental.chat.system.transform': await (0, system_transform_1.systemPromptTransform)(ctx, REPO_PATH),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
exports.default = daytonaPlugin;
|
|
44
48
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/opencode-plugin/.opencode/plugin/daytona/index.ts"],"names":[],"mappings":";AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/opencode-plugin/.opencode/plugin/daytona/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AAEH,+BAA2B;AAC3B,6CAAqC;AAErC,0CAA8C;AAC9C,4DAA8D;AAC9D,wCAAoC;AACpC,yDAAoD;AACpD,6DAAwD;AACxD,iEAAkE;AAIlE,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,qBAAO,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,CAAC,CAAA;AAChE,MAAM,WAAW,GAAG,IAAA,WAAI,EAAC,qBAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,CAAA;AACnE,MAAM,SAAS,GAAG,uBAAuB,CAAA;AAEzC,IAAA,uBAAc,EAAC,QAAQ,CAAC,CAAA;AACxB,MAAM,cAAc,GAAG,IAAI,uCAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,EAAE,EAAE,WAAW,EAAE,SAAS,CAAC,CAAA;AAE3G,KAAK,UAAU,aAAa,CAAC,GAAgB;IAC3C,aAAK,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACjC,OAAO;QACL,IAAI,EAAE,MAAM,IAAA,0BAAW,EAAC,GAAG,EAAE,cAAc,CAAC;QAC5C,KAAK,EAAE,MAAM,IAAA,8BAAa,EAAC,GAAG,EAAE,cAAc,EAAE,SAAS,CAAC;QAC1D,oCAAoC,EAAE,MAAM,IAAA,wCAAqB,EAAC,GAAG,EAAE,SAAS,CAAC;KAClF,CAAA;AACH,CAAC;AAED,kBAAe,aAAa,CAAA"}
|
|
@@ -1,11 +1,132 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright Daytona Platforms Inc.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { PluginInput } from '@opencode-ai/plugin';
|
|
6
6
|
import type { DaytonaSessionManager } from '../core/session-manager';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* Provides tools for file operations, command execution, and search within sandboxes
|
|
8
|
+
* Custom tools for Daytona sandbox: file ops, command execution, search.
|
|
10
9
|
*/
|
|
11
|
-
export declare function
|
|
10
|
+
export declare function customTools(ctx: PluginInput, sessionManager: DaytonaSessionManager): Promise<{
|
|
11
|
+
bash: {
|
|
12
|
+
description: string;
|
|
13
|
+
args: {
|
|
14
|
+
command: import("zod").ZodString;
|
|
15
|
+
background: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
16
|
+
};
|
|
17
|
+
execute(args: {
|
|
18
|
+
command: string;
|
|
19
|
+
background?: boolean;
|
|
20
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
21
|
+
};
|
|
22
|
+
read: {
|
|
23
|
+
description: string;
|
|
24
|
+
args: {
|
|
25
|
+
filePath: import("zod").ZodString;
|
|
26
|
+
};
|
|
27
|
+
execute(args: {
|
|
28
|
+
filePath: string;
|
|
29
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
30
|
+
};
|
|
31
|
+
write: {
|
|
32
|
+
description: string;
|
|
33
|
+
args: {
|
|
34
|
+
filePath: import("zod").ZodString;
|
|
35
|
+
content: import("zod").ZodString;
|
|
36
|
+
};
|
|
37
|
+
execute(args: {
|
|
38
|
+
filePath: string;
|
|
39
|
+
content: string;
|
|
40
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
41
|
+
};
|
|
42
|
+
edit: {
|
|
43
|
+
description: string;
|
|
44
|
+
args: {
|
|
45
|
+
filePath: import("zod").ZodString;
|
|
46
|
+
oldString: import("zod").ZodString;
|
|
47
|
+
newString: import("zod").ZodString;
|
|
48
|
+
};
|
|
49
|
+
execute(args: {
|
|
50
|
+
filePath: string;
|
|
51
|
+
oldString: string;
|
|
52
|
+
newString: string;
|
|
53
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
54
|
+
};
|
|
55
|
+
multiedit: {
|
|
56
|
+
description: string;
|
|
57
|
+
args: {
|
|
58
|
+
filePath: import("zod").ZodString;
|
|
59
|
+
edits: import("zod").ZodArray<import("zod").ZodObject<{
|
|
60
|
+
oldString: import("zod").ZodString;
|
|
61
|
+
newString: import("zod").ZodString;
|
|
62
|
+
}, import("zod/v4/core").$strip>>;
|
|
63
|
+
};
|
|
64
|
+
execute(args: {
|
|
65
|
+
filePath: string;
|
|
66
|
+
edits: Array<{
|
|
67
|
+
oldString: string;
|
|
68
|
+
newString: string;
|
|
69
|
+
}>;
|
|
70
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
71
|
+
};
|
|
72
|
+
patch: {
|
|
73
|
+
description: string;
|
|
74
|
+
args: {
|
|
75
|
+
patchText: import("zod").ZodString;
|
|
76
|
+
};
|
|
77
|
+
execute(args: {
|
|
78
|
+
filePath: string;
|
|
79
|
+
oldSnippet: string;
|
|
80
|
+
newSnippet: string;
|
|
81
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
82
|
+
};
|
|
83
|
+
ls: {
|
|
84
|
+
description: string;
|
|
85
|
+
args: {
|
|
86
|
+
dirPath: import("zod").ZodOptional<import("zod").ZodString>;
|
|
87
|
+
};
|
|
88
|
+
execute(args: {
|
|
89
|
+
dirPath?: string;
|
|
90
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
91
|
+
};
|
|
92
|
+
glob: {
|
|
93
|
+
description: string;
|
|
94
|
+
args: {
|
|
95
|
+
pattern: import("zod").ZodString;
|
|
96
|
+
};
|
|
97
|
+
execute(args: {
|
|
98
|
+
pattern: string;
|
|
99
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
100
|
+
};
|
|
101
|
+
grep: {
|
|
102
|
+
description: string;
|
|
103
|
+
args: {
|
|
104
|
+
pattern: import("zod").ZodString;
|
|
105
|
+
};
|
|
106
|
+
execute(args: {
|
|
107
|
+
pattern: string;
|
|
108
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
109
|
+
};
|
|
110
|
+
lsp: {
|
|
111
|
+
description: string;
|
|
112
|
+
args: {
|
|
113
|
+
op: import("zod").ZodString;
|
|
114
|
+
filePath: import("zod").ZodString;
|
|
115
|
+
line: import("zod").ZodNumber;
|
|
116
|
+
};
|
|
117
|
+
execute(args: {
|
|
118
|
+
op: string;
|
|
119
|
+
filePath: string;
|
|
120
|
+
line: number;
|
|
121
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
122
|
+
};
|
|
123
|
+
getPreviewURL: {
|
|
124
|
+
description: string;
|
|
125
|
+
args: {
|
|
126
|
+
port: import("zod").ZodNumber;
|
|
127
|
+
};
|
|
128
|
+
execute(args: {
|
|
129
|
+
port: number;
|
|
130
|
+
}, ctx: import("@opencode-ai/plugin/tool", { with: { "resolution-mode": "import" } }).ToolContext): Promise<string>;
|
|
131
|
+
};
|
|
132
|
+
}>;
|
|
@@ -1,26 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright
|
|
3
|
+
* Copyright Daytona Platforms Inc.
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.customTools = customTools;
|
|
8
8
|
const tools_1 = require("../tools");
|
|
9
9
|
const logger_1 = require("../core/logger");
|
|
10
|
-
const toast_1 = require("../core/toast");
|
|
11
10
|
/**
|
|
12
|
-
*
|
|
13
|
-
* Provides tools for file operations, command execution, and search within sandboxes
|
|
11
|
+
* Custom tools for Daytona sandbox: file ops, command execution, search.
|
|
14
12
|
*/
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const worktree = pluginCtx.project.worktree;
|
|
21
|
-
return {
|
|
22
|
-
tool: (0, tools_1.createDaytonaTools)(sessionManager, projectId, worktree, pluginCtx),
|
|
23
|
-
};
|
|
24
|
-
};
|
|
13
|
+
async function customTools(ctx, sessionManager) {
|
|
14
|
+
logger_1.logger.info('OpenCode started with Daytona plugin');
|
|
15
|
+
const projectId = ctx.project.id;
|
|
16
|
+
const worktree = ctx.project.worktree;
|
|
17
|
+
return (0, tools_1.createDaytonaTools)(sessionManager, projectId, worktree, ctx);
|
|
25
18
|
}
|
|
26
19
|
//# sourceMappingURL=custom-tools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-tools.js","sourceRoot":"","sources":["../../../../../../../libs/opencode-plugin/.opencode/plugin/daytona/plugins/custom-tools.ts"],"names":[],"mappings":";AAAA;;;GAGG;;
|
|
1
|
+
{"version":3,"file":"custom-tools.js","sourceRoot":"","sources":["../../../../../../../libs/opencode-plugin/.opencode/plugin/daytona/plugins/custom-tools.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAUH,kCAKC;AAZD,oCAA6C;AAC7C,2CAAuC;AAGvC;;GAEG;AACI,KAAK,UAAU,WAAW,CAAC,GAAgB,EAAE,cAAqC;IACvF,eAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAA;IACnD,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,EAAE,CAAA;IAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAA;IACrC,OAAO,IAAA,0BAAkB,EAAC,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAA;AACrE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Daytona Platforms Inc.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import type { PluginInput } from '@opencode-ai/plugin';
|
|
6
|
+
import type { DaytonaSessionManager } from '../core/session-manager';
|
|
7
|
+
/**
|
|
8
|
+
* Handles OpenCode session events.
|
|
9
|
+
*/
|
|
10
|
+
export declare function eventHandlers(ctx: PluginInput, sessionManager: DaytonaSessionManager, repoPath: string): Promise<(args: any) => Promise<void>>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright Daytona Platforms Inc.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.eventHandlers = eventHandlers;
|
|
8
|
+
const session_git_manager_1 = require("../git/session-git-manager");
|
|
9
|
+
const types_1 = require("../core/types");
|
|
10
|
+
const toast_1 = require("../core/toast");
|
|
11
|
+
const logger_1 = require("../core/logger");
|
|
12
|
+
/**
|
|
13
|
+
* Handles OpenCode session events.
|
|
14
|
+
*/
|
|
15
|
+
async function eventHandlers(ctx, sessionManager, repoPath) {
|
|
16
|
+
const projectId = ctx.project.id;
|
|
17
|
+
const worktree = ctx.project.worktree;
|
|
18
|
+
return async (args) => {
|
|
19
|
+
const event = args.event;
|
|
20
|
+
if (event.type === types_1.EVENT_TYPE_SESSION_DELETED) {
|
|
21
|
+
const sessionId = event.properties.info.id;
|
|
22
|
+
try {
|
|
23
|
+
await sessionManager.deleteSandbox(sessionId, projectId);
|
|
24
|
+
toast_1.toast.show({ title: 'Session deleted', message: 'Sandbox deleted successfully.', variant: 'success' });
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
toast_1.toast.show({ title: 'Delete failed', message: err?.message || 'Failed to delete sandbox.', variant: 'error' });
|
|
28
|
+
throw err;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
else if (event.type === types_1.EVENT_TYPE_SESSION_IDLE) {
|
|
32
|
+
const sessionId = event.properties.sessionID;
|
|
33
|
+
const start = Date.now();
|
|
34
|
+
try {
|
|
35
|
+
const sandbox = await sessionManager.getSandbox(sessionId, projectId, worktree, ctx);
|
|
36
|
+
const branchNumber = sessionManager.getBranchNumberForSandbox(projectId, sandbox.id);
|
|
37
|
+
if (!branchNumber)
|
|
38
|
+
return;
|
|
39
|
+
const sessionGit = new session_git_manager_1.SessionGitManager(sandbox, repoPath, worktree, branchNumber);
|
|
40
|
+
const didSync = await sessionGit.autoCommitAndPull(ctx);
|
|
41
|
+
logger_1.logger.info(`[idle] done sessionId=${sessionId} sandboxId=${sandbox.id} synced=${didSync} in ${Date.now() - start}ms`);
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
logger_1.logger.error(`[idle] error sessionId=${sessionId} in ${Date.now() - start}ms: ${err}`);
|
|
45
|
+
toast_1.toast.show({
|
|
46
|
+
title: 'Auto-commit error',
|
|
47
|
+
message: err?.message || 'Failed to auto-commit and pull.',
|
|
48
|
+
variant: 'error',
|
|
49
|
+
});
|
|
50
|
+
throw err;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=session-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-events.js","sourceRoot":"","sources":["../../../../../../../libs/opencode-plugin/.opencode/plugin/daytona/plugins/session-events.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAYH,sCAqCC;AA9CD,oEAA8D;AAC9D,yCAA6G;AAC7G,yCAAqC;AACrC,2CAAuC;AAGvC;;GAEG;AACI,KAAK,UAAU,aAAa,CAAC,GAAgB,EAAE,cAAqC,EAAE,QAAgB;IAC3G,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,EAAE,CAAA;IAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAA;IACrC,OAAO,KAAK,EAAE,IAAS,EAAE,EAAE;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;QACxB,IAAI,KAAK,CAAC,IAAI,KAAK,kCAA0B,EAAE,CAAC;YAC9C,MAAM,SAAS,GAAI,KAA6B,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAA;YACnE,IAAI,CAAC;gBACH,MAAM,cAAc,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;gBACxD,aAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,+BAA+B,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAA;YACxG,CAAC;YAAC,OAAO,GAAQ,EAAE,CAAC;gBAClB,aAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,IAAI,2BAA2B,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAA;gBAC9G,MAAM,GAAG,CAAA;YACX,CAAC;QACH,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,+BAAuB,EAAE,CAAC;YAClD,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,SAAS,CAAA;YAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;YACxB,IAAI,CAAC;gBACH,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,UAAU,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAA;gBACpF,MAAM,YAAY,GAAG,cAAc,CAAC,yBAAyB,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,CAAA;gBACpF,IAAI,CAAC,YAAY;oBAAE,OAAM;gBACzB,MAAM,UAAU,GAAG,IAAI,uCAAiB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAA;gBACnF,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAA;gBACvD,eAAM,CAAC,IAAI,CACT,yBAAyB,SAAS,cAAc,OAAO,CAAC,EAAE,WAAW,OAAO,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAC1G,CAAA;YACH,CAAC;YAAC,OAAO,GAAQ,EAAE,CAAC;gBAClB,eAAM,CAAC,KAAK,CAAC,0BAA0B,SAAS,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,GAAG,EAAE,CAAC,CAAA;gBACtF,aAAK,CAAC,IAAI,CAAC;oBACT,KAAK,EAAE,mBAAmB;oBAC1B,OAAO,EAAE,GAAG,EAAE,OAAO,IAAI,iCAAiC;oBAC1D,OAAO,EAAE,OAAO;iBACjB,CAAC,CAAA;gBACF,MAAM,GAAG,CAAA;YACX,CAAC;QACH,CAAC;IACH,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright Daytona Platforms Inc.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { PluginInput } from '@opencode-ai/plugin';
|
|
6
|
+
import type { ExperimentalChatSystemTransformInput, ExperimentalChatSystemTransformOutput } from '../core/types';
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
-
* Adds Daytona-specific instructions to the system prompt
|
|
8
|
+
* Adds Daytona-specific instructions to the system prompt.
|
|
9
9
|
*/
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function systemPromptTransform(ctx: PluginInput, repoPath: string): Promise<(input: ExperimentalChatSystemTransformInput, output: ExperimentalChatSystemTransformOutput) => Promise<void>>;
|
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright
|
|
3
|
+
* Copyright Daytona Platforms Inc.
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.systemPromptTransform = systemPromptTransform;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* Adds Daytona-specific instructions to the system prompt
|
|
9
|
+
* Adds Daytona-specific instructions to the system prompt.
|
|
11
10
|
*/
|
|
12
|
-
function
|
|
13
|
-
return async (
|
|
14
|
-
|
|
15
|
-
'
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
'Before showing a preview URL, ensure the server is running in the sandbox on that port.',
|
|
24
|
-
].join('\n'));
|
|
25
|
-
},
|
|
26
|
-
};
|
|
11
|
+
async function systemPromptTransform(ctx, repoPath) {
|
|
12
|
+
return async (input, output) => {
|
|
13
|
+
output.system.push([
|
|
14
|
+
'## Daytona Sandbox Integration',
|
|
15
|
+
'This session is integrated with a Daytona sandbox.',
|
|
16
|
+
`The main project repository is located at: ${repoPath}.`,
|
|
17
|
+
'Bash commands will run in this directory.',
|
|
18
|
+
'Put all projects in the project directory. Do NOT try to use the current working directory of the host system.',
|
|
19
|
+
"When executing long-running commands, use the 'background' option to run them asynchronously.",
|
|
20
|
+
'Before showing a preview URL, ensure the server is running in the sandbox on that port.',
|
|
21
|
+
].join('\n'));
|
|
27
22
|
};
|
|
28
23
|
}
|
|
29
24
|
//# sourceMappingURL=system-transform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-transform.js","sourceRoot":"","sources":["../../../../../../../libs/opencode-plugin/.opencode/plugin/daytona/plugins/system-transform.ts"],"names":[],"mappings":";AAAA;;;GAGG;;
|
|
1
|
+
{"version":3,"file":"system-transform.js","sourceRoot":"","sources":["../../../../../../../libs/opencode-plugin/.opencode/plugin/daytona/plugins/system-transform.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAQH,sDAcC;AAjBD;;GAEG;AACI,KAAK,UAAU,qBAAqB,CAAC,GAAgB,EAAE,QAAgB;IAC5E,OAAO,KAAK,EAAE,KAA2C,EAAE,MAA6C,EAAE,EAAE;QAC1G,MAAM,CAAC,MAAM,CAAC,IAAI,CAChB;YACE,gCAAgC;YAChC,oDAAoD;YACpD,8CAA8C,QAAQ,GAAG;YACzD,2CAA2C;YAC3C,gHAAgH;YAChH,+FAA+F;YAC/F,yFAAyF;SAC1F,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAA;IACH,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright Daytona Platforms Inc.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
* Main entry point for the OpenCode Daytona plugin
|
|
7
|
-
* Re-exports
|
|
6
|
+
* Main entry point for the OpenCode Daytona plugin.
|
|
7
|
+
* Re-exports the default plugin from daytona.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export { default } from './daytona/index.js';
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright
|
|
3
|
+
* Copyright Daytona Platforms Inc.
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.default = void 0;
|
|
7
8
|
const tslib_1 = require("tslib");
|
|
8
9
|
/**
|
|
9
|
-
* Main entry point for the OpenCode Daytona plugin
|
|
10
|
-
* Re-exports
|
|
10
|
+
* Main entry point for the OpenCode Daytona plugin.
|
|
11
|
+
* Re-exports the default plugin from daytona.
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
+
var index_js_1 = require("./daytona/index.js");
|
|
14
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(index_js_1).default; } });
|
|
13
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/opencode-plugin/.opencode/plugin/index.ts"],"names":[],"mappings":";AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/opencode-plugin/.opencode/plugin/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH;;;GAGG;AAEH,+CAA4C;AAAnC,4HAAA,OAAO,OAAA"}
|
package/README.md
CHANGED
|
@@ -178,6 +178,25 @@ npx nx run opencode-plugin:build
|
|
|
178
178
|
|
|
179
179
|
This compiles the TypeScript source files in `.opencode/` to JavaScript in `dist/.opencode/`.
|
|
180
180
|
|
|
181
|
+
#### Test the built package
|
|
182
|
+
|
|
183
|
+
After building, create a test project and add a plugin file to load the built plugin (replace `[ABSOLUTE_PATH_TO_DAYTONA]` with your clone path, e.g. `/Users/you/daytona`):
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
mkdir -p ~/myproject && cd ~/myproject
|
|
187
|
+
mkdir -p .opencode/plugins
|
|
188
|
+
cat > .opencode/plugins/daytona-local.js << 'EOF'
|
|
189
|
+
module.exports = require('[ABSOLUTE_PATH_TO_DAYTONA]/dist/libs/opencode-plugin/.opencode/plugin')
|
|
190
|
+
EOF
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Initialize git to enable file syncing, and start OpenCode:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
git init
|
|
197
|
+
opencode
|
|
198
|
+
```
|
|
199
|
+
|
|
181
200
|
### Publishing
|
|
182
201
|
|
|
183
202
|
Log into npm:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daytonaio/opencode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.150.0",
|
|
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",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"tar": "^7.5.7",
|
|
40
40
|
"xdg-basedir": "^5.1.0",
|
|
41
41
|
"zod": "^4.2.1",
|
|
42
|
-
"@daytonaio/api-client": "0.
|
|
43
|
-
"@daytonaio/toolbox-api-client": "0.
|
|
42
|
+
"@daytonaio/api-client": "0.150.0",
|
|
43
|
+
"@daytonaio/toolbox-api-client": "0.150.0"
|
|
44
44
|
},
|
|
45
45
|
"bugs": {
|
|
46
46
|
"url": "https://github.com/daytonaio/daytona/issues"
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 Daytona Platforms Inc.
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* OpenCode plugin implementations for Daytona sandbox integration
|
|
7
|
-
*/
|
|
8
|
-
export { createCustomToolsPlugin } from './custom-tools';
|
|
9
|
-
export { createSessionIdleAutoCommitPlugin } from './session-idle-auto-commit';
|
|
10
|
-
export { createSessionCleanupPlugin } from './session-cleanup';
|
|
11
|
-
export { createSystemTransformPlugin } from './system-transform';
|
|
@@ -1,19 +0,0 @@
|
|
|
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.createSystemTransformPlugin = exports.createSessionCleanupPlugin = exports.createSessionIdleAutoCommitPlugin = exports.createCustomToolsPlugin = void 0;
|
|
8
|
-
/**
|
|
9
|
-
* OpenCode plugin implementations for Daytona sandbox integration
|
|
10
|
-
*/
|
|
11
|
-
var custom_tools_1 = require("./custom-tools");
|
|
12
|
-
Object.defineProperty(exports, "createCustomToolsPlugin", { enumerable: true, get: function () { return custom_tools_1.createCustomToolsPlugin; } });
|
|
13
|
-
var session_idle_auto_commit_1 = require("./session-idle-auto-commit");
|
|
14
|
-
Object.defineProperty(exports, "createSessionIdleAutoCommitPlugin", { enumerable: true, get: function () { return session_idle_auto_commit_1.createSessionIdleAutoCommitPlugin; } });
|
|
15
|
-
var session_cleanup_1 = require("./session-cleanup");
|
|
16
|
-
Object.defineProperty(exports, "createSessionCleanupPlugin", { enumerable: true, get: function () { return session_cleanup_1.createSessionCleanupPlugin; } });
|
|
17
|
-
var system_transform_1 = require("./system-transform");
|
|
18
|
-
Object.defineProperty(exports, "createSystemTransformPlugin", { enumerable: true, get: function () { return system_transform_1.createSystemTransformPlugin; } });
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/opencode-plugin/.opencode/plugin/daytona/plugins/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AAEH,+CAAwD;AAA/C,uHAAA,uBAAuB,OAAA;AAChC,uEAA8E;AAArE,6IAAA,iCAAiC,OAAA;AAC1C,qDAA8D;AAArD,6HAAA,0BAA0B,OAAA;AACnC,uDAAgE;AAAvD,+HAAA,2BAA2B,OAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 Daytona Platforms Inc.
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
import type { Plugin } from '@opencode-ai/plugin';
|
|
6
|
-
import type { DaytonaSessionManager } from '../core/session-manager';
|
|
7
|
-
/**
|
|
8
|
-
* Creates the session cleanup plugin for Daytona
|
|
9
|
-
* Automatically cleans up sandbox resources when sessions end
|
|
10
|
-
*/
|
|
11
|
-
export declare function createSessionCleanupPlugin(sessionManager: DaytonaSessionManager): Plugin;
|
|
@@ -1,43 +0,0 @@
|
|
|
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.createSessionCleanupPlugin = createSessionCleanupPlugin;
|
|
8
|
-
const types_1 = require("../core/types");
|
|
9
|
-
const toast_1 = require("../core/toast");
|
|
10
|
-
/**
|
|
11
|
-
* Creates the session cleanup plugin for Daytona
|
|
12
|
-
* Automatically cleans up sandbox resources when sessions end
|
|
13
|
-
*/
|
|
14
|
-
function createSessionCleanupPlugin(sessionManager) {
|
|
15
|
-
return async (pluginCtx) => {
|
|
16
|
-
toast_1.toast.initialize(pluginCtx.client?.tui);
|
|
17
|
-
const projectId = pluginCtx.project.id;
|
|
18
|
-
return {
|
|
19
|
-
event: async ({ event }) => {
|
|
20
|
-
if (event.type === types_1.EVENT_TYPE_SESSION_DELETED) {
|
|
21
|
-
const sessionId = event.properties.info.id;
|
|
22
|
-
try {
|
|
23
|
-
await sessionManager.deleteSandbox(sessionId, projectId);
|
|
24
|
-
toast_1.toast.show({
|
|
25
|
-
title: 'Session deleted',
|
|
26
|
-
message: 'Sandbox deleted successfully.',
|
|
27
|
-
variant: 'success',
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
catch (err) {
|
|
31
|
-
toast_1.toast.show({
|
|
32
|
-
title: 'Delete failed',
|
|
33
|
-
message: err?.message || 'Failed to delete sandbox.',
|
|
34
|
-
variant: 'error',
|
|
35
|
-
});
|
|
36
|
-
throw err;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=session-cleanup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session-cleanup.js","sourceRoot":"","sources":["../../../../../../../libs/opencode-plugin/.opencode/plugin/daytona/plugins/session-cleanup.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAYH,gEA2BC;AAnCD,yCAA0D;AAE1D,yCAAqC;AAErC;;;GAGG;AACH,SAAgB,0BAA0B,CAAC,cAAqC;IAC9E,OAAO,KAAK,EAAE,SAAsB,EAAE,EAAE;QACtC,aAAK,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,kCAA0B,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,aAAK,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,aAAK,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,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 Daytona Platforms Inc.
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
import type { Plugin } from '@opencode-ai/plugin';
|
|
6
|
-
import type { DaytonaSessionManager } from '../core/session-manager';
|
|
7
|
-
/**
|
|
8
|
-
* Creates a plugin to auto-commit in the sandbox on session idle
|
|
9
|
-
*/
|
|
10
|
-
export declare function createSessionIdleAutoCommitPlugin(sessionManager: DaytonaSessionManager, repoPath: string): Plugin;
|
|
@@ -1,54 +0,0 @@
|
|
|
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.createSessionIdleAutoCommitPlugin = createSessionIdleAutoCommitPlugin;
|
|
8
|
-
const session_git_manager_1 = require("../git/session-git-manager");
|
|
9
|
-
const types_1 = require("../core/types");
|
|
10
|
-
const toast_1 = require("../core/toast");
|
|
11
|
-
const logger_1 = require("../core/logger");
|
|
12
|
-
/**
|
|
13
|
-
* Creates a plugin to auto-commit in the sandbox on session idle
|
|
14
|
-
*/
|
|
15
|
-
function createSessionIdleAutoCommitPlugin(sessionManager, repoPath) {
|
|
16
|
-
return async (pluginCtx) => {
|
|
17
|
-
toast_1.toast.initialize(pluginCtx.client?.tui);
|
|
18
|
-
const projectId = pluginCtx.project.id;
|
|
19
|
-
const worktree = pluginCtx.project.worktree;
|
|
20
|
-
return {
|
|
21
|
-
event: async (args) => {
|
|
22
|
-
const event = args.event;
|
|
23
|
-
if (event.type === types_1.EVENT_TYPE_SESSION_IDLE) {
|
|
24
|
-
const sessionId = event.properties.sessionID;
|
|
25
|
-
const start = Date.now();
|
|
26
|
-
try {
|
|
27
|
-
const sandbox = await sessionManager.getSandbox(sessionId, projectId, worktree, pluginCtx);
|
|
28
|
-
const branchNumber = sessionManager.getBranchNumberForSandbox(projectId, sandbox.id);
|
|
29
|
-
if (!branchNumber) {
|
|
30
|
-
// No local git repo => no branch reservation => nothing to sync.
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const sessionGit = new session_git_manager_1.SessionGitManager(sandbox, repoPath, worktree, branchNumber);
|
|
34
|
-
const didSync = await sessionGit.autoCommitAndPull(pluginCtx);
|
|
35
|
-
logger_1.logger.info(`[idle] done sessionId=${sessionId} sandboxId=${sandbox.id} synced=${didSync} in ${Date.now() - start}ms`);
|
|
36
|
-
}
|
|
37
|
-
catch (err) {
|
|
38
|
-
logger_1.logger.error(`[idle] error sessionId=${sessionId} in ${Date.now() - start}ms: ${err}`);
|
|
39
|
-
toast_1.toast.show({
|
|
40
|
-
title: 'Auto-commit error',
|
|
41
|
-
message: err?.message || 'Failed to auto-commit and pull.',
|
|
42
|
-
variant: 'error',
|
|
43
|
-
});
|
|
44
|
-
throw err;
|
|
45
|
-
}
|
|
46
|
-
finally {
|
|
47
|
-
// Intentionally no-op; keep logs minimal.
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=session-idle-auto-commit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session-idle-auto-commit.js","sourceRoot":"","sources":["../../../../../../../libs/opencode-plugin/.opencode/plugin/daytona/plugins/session-idle-auto-commit.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAYH,8EAuCC;AA/CD,oEAA8D;AAC9D,yCAAuD;AACvD,yCAAqC;AACrC,2CAAuC;AAEvC;;GAEG;AACH,SAAgB,iCAAiC,CAAC,cAAqC,EAAE,QAAgB;IACvG,OAAO,KAAK,EAAE,SAAsB,EAAE,EAAE;QACtC,aAAK,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QACvC,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,CAAA;QACtC,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAA;QAE3C,OAAO;YACL,KAAK,EAAE,KAAK,EAAE,IAAS,EAAE,EAAE;gBACzB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;gBACxB,IAAI,KAAK,CAAC,IAAI,KAAK,+BAAuB,EAAE,CAAC;oBAC3C,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,SAAS,CAAA;oBAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;oBACxB,IAAI,CAAC;wBACH,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,UAAU,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAA;wBAC1F,MAAM,YAAY,GAAG,cAAc,CAAC,yBAAyB,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,CAAA;wBACpF,IAAI,CAAC,YAAY,EAAE,CAAC;4BAClB,iEAAiE;4BACjE,OAAM;wBACR,CAAC;wBACD,MAAM,UAAU,GAAG,IAAI,uCAAiB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAA;wBACnF,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAA;wBAC7D,eAAM,CAAC,IAAI,CACT,yBAAyB,SAAS,cAAc,OAAO,CAAC,EAAE,WAAW,OAAO,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAC1G,CAAA;oBACH,CAAC;oBAAC,OAAO,GAAQ,EAAE,CAAC;wBAClB,eAAM,CAAC,KAAK,CAAC,0BAA0B,SAAS,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,GAAG,EAAE,CAAC,CAAA;wBACtF,aAAK,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;4BAAS,CAAC;wBACT,0CAA0C;oBAC5C,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAA;IACH,CAAC,CAAA;AACH,CAAC"}
|