@jamesmurdza/opencode-daytona 0.1.21 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/.opencode/plugin/daytona/core/logger.d.ts +2 -2
  2. package/.opencode/plugin/daytona/core/logger.js +28 -15
  3. package/.opencode/plugin/daytona/core/logger.js.map +1 -1
  4. package/.opencode/plugin/daytona/core/project-data-storage.d.ts +11 -7
  5. package/.opencode/plugin/daytona/core/project-data-storage.js +84 -43
  6. package/.opencode/plugin/daytona/core/project-data-storage.js.map +1 -1
  7. package/.opencode/plugin/daytona/core/session-manager.d.ts +5 -2
  8. package/.opencode/plugin/daytona/core/session-manager.js +113 -60
  9. package/.opencode/plugin/daytona/core/session-manager.js.map +1 -1
  10. package/.opencode/plugin/daytona/core/toast.d.ts +47 -0
  11. package/.opencode/plugin/daytona/core/toast.js +73 -0
  12. package/.opencode/plugin/daytona/core/toast.js.map +1 -0
  13. package/.opencode/plugin/daytona/core/types.d.ts +10 -8
  14. package/.opencode/plugin/daytona/core/types.js +10 -6
  15. package/.opencode/plugin/daytona/core/types.js.map +1 -1
  16. package/.opencode/plugin/daytona/git/host-git-manager.d.ts +34 -7
  17. package/.opencode/plugin/daytona/git/host-git-manager.js +254 -68
  18. package/.opencode/plugin/daytona/git/host-git-manager.js.map +1 -1
  19. package/.opencode/plugin/daytona/git/index.d.ts +4 -1
  20. package/.opencode/plugin/daytona/git/index.js +9 -1
  21. package/.opencode/plugin/daytona/git/index.js.map +1 -1
  22. package/.opencode/plugin/daytona/git/sandbox-git-manager.d.ts +5 -1
  23. package/.opencode/plugin/daytona/git/sandbox-git-manager.js +23 -12
  24. package/.opencode/plugin/daytona/git/sandbox-git-manager.js.map +1 -1
  25. package/.opencode/plugin/daytona/git/session-git-manager.d.ts +19 -3
  26. package/.opencode/plugin/daytona/git/session-git-manager.js +80 -43
  27. package/.opencode/plugin/daytona/git/session-git-manager.js.map +1 -1
  28. package/.opencode/plugin/daytona/index.d.ts +131 -23
  29. package/.opencode/plugin/daytona/index.js +27 -16
  30. package/.opencode/plugin/daytona/index.js.map +1 -1
  31. package/.opencode/plugin/daytona/plugins/custom-tools.d.ts +129 -5
  32. package/.opencode/plugin/daytona/plugins/custom-tools.js +15 -13
  33. package/.opencode/plugin/daytona/plugins/custom-tools.js.map +1 -1
  34. package/.opencode/plugin/daytona/plugins/session-events.d.ts +10 -0
  35. package/.opencode/plugin/daytona/plugins/session-events.js +51 -0
  36. package/.opencode/plugin/daytona/plugins/session-events.js.map +1 -0
  37. package/.opencode/plugin/daytona/plugins/system-transform.d.ts +8 -5
  38. package/.opencode/plugin/daytona/plugins/system-transform.js +19 -15
  39. package/.opencode/plugin/daytona/plugins/system-transform.js.map +1 -1
  40. package/.opencode/plugin/daytona/tools/bash.d.ts +7 -3
  41. package/.opencode/plugin/daytona/tools/bash.js +16 -5
  42. package/.opencode/plugin/daytona/tools/bash.js.map +1 -1
  43. package/.opencode/plugin/daytona/tools/edit.d.ts +6 -2
  44. package/.opencode/plugin/daytona/tools/edit.js +13 -5
  45. package/.opencode/plugin/daytona/tools/edit.js.map +1 -1
  46. package/.opencode/plugin/daytona/tools/get-preview-url.d.ts +6 -2
  47. package/.opencode/plugin/daytona/tools/get-preview-url.js +11 -3
  48. package/.opencode/plugin/daytona/tools/get-preview-url.js.map +1 -1
  49. package/.opencode/plugin/daytona/tools/glob.d.ts +6 -2
  50. package/.opencode/plugin/daytona/tools/glob.js +11 -3
  51. package/.opencode/plugin/daytona/tools/glob.js.map +1 -1
  52. package/.opencode/plugin/daytona/tools/grep.d.ts +6 -2
  53. package/.opencode/plugin/daytona/tools/grep.js +11 -3
  54. package/.opencode/plugin/daytona/tools/grep.js.map +1 -1
  55. package/.opencode/plugin/daytona/tools/ls.d.ts +6 -2
  56. package/.opencode/plugin/daytona/tools/ls.js +11 -3
  57. package/.opencode/plugin/daytona/tools/ls.js.map +1 -1
  58. package/.opencode/plugin/daytona/tools/lsp.d.ts +6 -2
  59. package/.opencode/plugin/daytona/tools/lsp.js +13 -5
  60. package/.opencode/plugin/daytona/tools/lsp.js.map +1 -1
  61. package/.opencode/plugin/daytona/tools/multiedit.d.ts +6 -2
  62. package/.opencode/plugin/daytona/tools/multiedit.js +14 -6
  63. package/.opencode/plugin/daytona/tools/multiedit.js.map +1 -1
  64. package/.opencode/plugin/daytona/tools/patch.d.ts +7 -5
  65. package/.opencode/plugin/daytona/tools/patch.js +13 -13
  66. package/.opencode/plugin/daytona/tools/patch.js.map +1 -1
  67. package/.opencode/plugin/daytona/tools/read.d.ts +6 -2
  68. package/.opencode/plugin/daytona/tools/read.js +11 -3
  69. package/.opencode/plugin/daytona/tools/read.js.map +1 -1
  70. package/.opencode/plugin/daytona/tools/write.d.ts +6 -2
  71. package/.opencode/plugin/daytona/tools/write.js +12 -4
  72. package/.opencode/plugin/daytona/tools/write.js.map +1 -1
  73. package/.opencode/plugin/daytona/tools.d.ts +14 -16
  74. package/.opencode/plugin/daytona/tools.js +31 -23
  75. package/.opencode/plugin/daytona/tools.js.map +1 -1
  76. package/.opencode/plugin/index.d.ts +7 -4
  77. package/.opencode/plugin/index.js +12 -3
  78. package/.opencode/plugin/index.js.map +1 -1
  79. package/README.md +68 -29
  80. package/package.json +34 -17
  81. package/.opencode/plugin/daytona/core/logger.d.ts.map +0 -1
  82. package/.opencode/plugin/daytona/core/project-data-storage.d.ts.map +0 -1
  83. package/.opencode/plugin/daytona/core/session-manager.d.ts.map +0 -1
  84. package/.opencode/plugin/daytona/core/types.d.ts.map +0 -1
  85. package/.opencode/plugin/daytona/git/host-git-manager.d.ts.map +0 -1
  86. package/.opencode/plugin/daytona/git/index.d.ts.map +0 -1
  87. package/.opencode/plugin/daytona/git/sandbox-git-manager.d.ts.map +0 -1
  88. package/.opencode/plugin/daytona/git/session-git-manager.d.ts.map +0 -1
  89. package/.opencode/plugin/daytona/index.d.ts.map +0 -1
  90. package/.opencode/plugin/daytona/plugins/custom-tools.d.ts.map +0 -1
  91. package/.opencode/plugin/daytona/plugins/index.d.ts +0 -8
  92. package/.opencode/plugin/daytona/plugins/index.d.ts.map +0 -1
  93. package/.opencode/plugin/daytona/plugins/index.js +0 -8
  94. package/.opencode/plugin/daytona/plugins/index.js.map +0 -1
  95. package/.opencode/plugin/daytona/plugins/session-cleanup.d.ts +0 -8
  96. package/.opencode/plugin/daytona/plugins/session-cleanup.d.ts.map +0 -1
  97. package/.opencode/plugin/daytona/plugins/session-cleanup.js +0 -38
  98. package/.opencode/plugin/daytona/plugins/session-cleanup.js.map +0 -1
  99. package/.opencode/plugin/daytona/plugins/session-idle-auto-commit.d.ts +0 -7
  100. package/.opencode/plugin/daytona/plugins/session-idle-auto-commit.d.ts.map +0 -1
  101. package/.opencode/plugin/daytona/plugins/session-idle-auto-commit.js +0 -46
  102. package/.opencode/plugin/daytona/plugins/session-idle-auto-commit.js.map +0 -1
  103. package/.opencode/plugin/daytona/plugins/system-transform.d.ts.map +0 -1
  104. package/.opencode/plugin/daytona/tools/bash.d.ts.map +0 -1
  105. package/.opencode/plugin/daytona/tools/edit.d.ts.map +0 -1
  106. package/.opencode/plugin/daytona/tools/get-preview-url.d.ts.map +0 -1
  107. package/.opencode/plugin/daytona/tools/glob.d.ts.map +0 -1
  108. package/.opencode/plugin/daytona/tools/grep.d.ts.map +0 -1
  109. package/.opencode/plugin/daytona/tools/ls.d.ts.map +0 -1
  110. package/.opencode/plugin/daytona/tools/lsp.d.ts.map +0 -1
  111. package/.opencode/plugin/daytona/tools/multiedit.d.ts.map +0 -1
  112. package/.opencode/plugin/daytona/tools/patch.d.ts.map +0 -1
  113. package/.opencode/plugin/daytona/tools/read.d.ts.map +0 -1
  114. package/.opencode/plugin/daytona/tools/write.d.ts.map +0 -1
  115. package/.opencode/plugin/daytona/tools.d.ts.map +0 -1
  116. package/.opencode/plugin/index.d.ts.map +0 -1
@@ -1,95 +1,132 @@
1
- import { logger } from '../core/logger';
2
- import { DaytonaSandboxGitManager } from './sandbox-git-manager';
3
- import { HostGitManager } from './host-git-manager';
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.SessionGitManager = void 0;
8
+ const logger_1 = require("../core/logger");
9
+ const toast_1 = require("../core/toast");
10
+ const sandbox_git_manager_1 = require("./sandbox-git-manager");
11
+ const host_git_manager_1 = require("./host-git-manager");
4
12
  /**
5
13
  * SessionGitManager: Combines DaytonaSandboxGitManager and HostGitManager for session lifecycle git operations.
6
14
  */
7
- export class SessionGitManager {
15
+ class SessionGitManager {
8
16
  sandboxGit;
9
17
  hostGit;
10
18
  sandbox;
11
19
  repoPath;
20
+ worktree;
12
21
  branch;
13
22
  localBranch;
14
- constructor(sandbox, repoPath, branchNumber) {
23
+ /** Numbered remote (sandbox-2) matches localBranch (opencode/2) */
24
+ remoteName;
25
+ constructor(sandbox, repoPath, worktree, branchNumber) {
15
26
  this.sandbox = sandbox;
16
27
  this.repoPath = repoPath;
28
+ this.worktree = worktree;
17
29
  this.branch = 'opencode';
18
30
  this.localBranch = `opencode/${branchNumber}`;
19
- this.sandboxGit = new DaytonaSandboxGitManager(sandbox, repoPath);
20
- this.hostGit = new HostGitManager();
31
+ this.remoteName = `sandbox-${branchNumber}`;
32
+ this.sandboxGit = new sandbox_git_manager_1.DaytonaSandboxGitManager(sandbox, repoPath);
33
+ this.hostGit = new host_git_manager_1.HostGitManager();
34
+ }
35
+ /**
36
+ * Allocate and reserve the next opencode/N number in the local repo at `worktree`.
37
+ * This keeps all host-git concerns inside the git manager layer.
38
+ */
39
+ static allocateAndReserveBranchNumber(worktree, prefix = 'opencode') {
40
+ return new host_git_manager_1.HostGitManager().allocateAndReserveBranchNumber(worktree, prefix);
21
41
  }
22
42
  async getSshUrl() {
23
43
  const sshAccess = await this.sandbox.createSshAccess(10);
24
- logger.info(`Created SSH access token ${sshAccess.token}@ssh.app.daytona.io`);
25
44
  return `ssh://${sshAccess.token}@ssh.app.daytona.io${this.repoPath}`;
26
45
  }
46
+ /**
47
+ * Check if local git repository exists
48
+ * @returns true if repo exists, false otherwise
49
+ */
50
+ hasLocalRepo() {
51
+ return this.hostGit.hasRepo(this.worktree);
52
+ }
27
53
  /**
28
54
  * Initialize git in the sandbox and sync with host
29
55
  * Used when a new sandbox is created for a session
30
56
  */
31
57
  async initializeAndSync(pluginCtx) {
58
+ if (pluginCtx?.client?.tui) {
59
+ toast_1.toast.initialize(pluginCtx.client.tui);
60
+ }
32
61
  try {
62
+ // Check if local git repo exists before initializing sandbox repo
63
+ if (!this.hostGit.hasRepo(this.worktree)) {
64
+ // Always ensure the directory exists, even if git syncing is disabled
65
+ await this.sandboxGit.ensureDirectory();
66
+ logger_1.logger.warn('No local git repository found. Git syncing is disabled.');
67
+ toast_1.toast.show({
68
+ title: 'Git syncing disabled',
69
+ message: 'No local git repository found. Git syncing is disabled for this session.',
70
+ variant: 'warning',
71
+ });
72
+ return;
73
+ }
33
74
  await this.sandboxGit.ensureRepo();
34
- this.hostGit.ensureRepo();
35
75
  const sshUrl = await this.getSshUrl();
36
- this.hostGit.setRemote('sandbox', sshUrl);
37
- this.hostGit.pushLocalToSandboxRemote(sshUrl, this.branch);
38
- await this.sandboxGit.resetToRemote(this.branch);
76
+ const pushed = await this.hostGit.pushLocalToSandboxRemote(this.remoteName, sshUrl, this.branch, this.worktree);
77
+ if (pushed) {
78
+ await this.sandboxGit.resetToRemote(this.branch);
79
+ }
39
80
  }
40
81
  catch (err) {
41
- if (pluginCtx?.client?.tui?.showToast) {
42
- pluginCtx.client.tui.showToast({
43
- body: {
44
- title: 'Git sync error',
45
- message: err?.message || 'Failed to sync git repo.',
46
- variant: 'error',
47
- },
48
- });
49
- }
82
+ toast_1.toast.show({
83
+ title: 'Git sync error',
84
+ message: err?.message || 'Failed to sync git repo.',
85
+ variant: 'error',
86
+ });
50
87
  throw err;
51
88
  }
52
89
  }
53
90
  /**
54
91
  * Auto-commit in the sandbox and pull latest from host
55
92
  * Used on session idle
56
- * Returns true if changes were synced, false if no changes
93
+ * Returns true if changes were synced, false if no changes or no local repo
57
94
  */
58
95
  async autoCommitAndPull(pluginCtx) {
96
+ if (pluginCtx?.client?.tui) {
97
+ toast_1.toast.initialize(pluginCtx.client.tui);
98
+ }
59
99
  try {
100
+ // Check if local git repo exists before attempting any git operations
101
+ if (!this.hostGit.hasRepo(this.worktree)) {
102
+ logger_1.logger.warn('No local git repository found. Git syncing is disabled.');
103
+ return false;
104
+ }
60
105
  await this.sandboxGit.ensureRepo();
61
106
  const hasChanges = await this.sandboxGit.autoCommit();
62
107
  // Only sync and notify if there were actual changes
63
108
  if (!hasChanges) {
64
109
  return false;
65
110
  }
66
- this.hostGit.ensureRepo();
67
111
  const sshUrl = await this.getSshUrl();
68
- this.hostGit.setRemote('sandbox', sshUrl);
69
- this.hostGit.pull('sandbox', this.branch, this.localBranch);
70
- if (pluginCtx?.client?.tui?.showToast) {
71
- pluginCtx.client.tui.showToast({
72
- body: {
73
- title: 'Changes synced',
74
- message: `Changes have been synced to ${this.localBranch} in your local repository`,
75
- variant: 'success',
76
- },
77
- });
78
- }
112
+ await this.hostGit.pull(this.remoteName, sshUrl, this.branch, this.worktree, this.localBranch);
113
+ toast_1.toast.show({
114
+ title: 'Changes synced',
115
+ message: `Changes have been synced to ${this.localBranch} in your local repository`,
116
+ variant: 'success',
117
+ });
79
118
  return true;
80
119
  }
81
120
  catch (err) {
82
- if (pluginCtx?.client?.tui?.showToast) {
83
- pluginCtx.client.tui.showToast({
84
- body: {
85
- title: 'Sync failed',
86
- message: err?.message || 'Failed to auto-commit and pull.',
87
- variant: 'error',
88
- },
89
- });
90
- }
121
+ toast_1.toast.show({
122
+ title: 'Sync failed',
123
+ message: err?.message || 'Failed to auto-commit and pull.',
124
+ variant: 'error',
125
+ });
126
+ logger_1.logger.error(`[idle/git] error sandboxId=${this.sandbox.id}: ${err}`);
91
127
  throw err;
92
128
  }
93
129
  }
94
130
  }
131
+ exports.SessionGitManager = SessionGitManager;
95
132
  //# sourceMappingURL=session-git-manager.js.map
@@ -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;IAEpC,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,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,qBAAqB,CAAC,CAAA;QAC7E,OAAO,SAAS,SAAS,CAAC,KAAK,sBAAsB,IAAI,CAAC,QAAQ,EAAE,CAAA;IACtE,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,iBAAiB,CAAC,SAAuB;QAC7C,IAAI,CAAC;YACH,M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C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;YAC3D,IAAI,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;gBACtC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC;oBAC7B,IAAI,EAAE;wBACJ,KAAK,EAAE,gBAAgB;wBACvB,OAAO,EAAE,+BAA+B,IAAI,CAAC,WAAW,2BAA2B;wBACnF,OAAO,EAAE,SAAS;qBACnB;iBACF,CAAC,CAAA;YACJ,CAAC;YACD,OAAO,IAAI,CAAA;QACb,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,IAAI,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;gBACtC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC;oBAC7B,IAAI,EAAE;wBACJ,KAAK,EAAE,aAAa;wBACpB,OAAO,EAAE,GAAG,EAAE,OAAO,IAAI,iCAAiC;wBAC1D,OAAO,EAAE,OAAO;qBACjB;iBACF,CAAC,CAAA;YACJ,CAAC;YACD,MAAM,GAAG,CAAA;QACX,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"session-git-manager.js","sourceRoot":"","sources":["../../../../../../../libs/opencode-plugin/.opencode/plugin/daytona/git/session-git-manager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2CAAuC;AACvC,yCAAqC;AACrC,+DAAgE;AAChE,yDAAmD;AAGnD;;GAEG;AACH,MAAa,iBAAiB;IACX,UAAU,CAA0B;IACpC,OAAO,CAAgB;IACvB,OAAO,CAAS;IAChB,QAAQ,CAAQ;IAChB,QAAQ,CAAQ;IAChB,MAAM,CAAQ;IACd,WAAW,CAAQ;IACpC,mEAAmE;IAClD,UAAU,CAAQ;IAEnC,YAAY,OAAgB,EAAE,QAAgB,EAAE,QAAgB,EAAE,YA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zC,eAAM,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAA;gBACtE,OAAO,KAAK,CAAA;YACd,CAAC;YAED,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAA;YAClC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAA;YAErD,oDAAoD;YACpD,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,OAAO,KAAK,CAAA;YACd,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAA;YAErC,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;YAC9F,aAAK,CAAC,IAAI,CAAC;gBACT,KAAK,EAAE,gBAAgB;gBACvB,OAAO,EAAE,+BAA+B,IAAI,CAAC,WAAW,2BAA2B;gBACnF,OAAO,EAAE,SAAS;aACnB,CAAC,CAAA;YACF,OAAO,IAAI,CAAA;QACb,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,aAAK,CAAC,IAAI,CAAC;gBACT,KAAK,EAAE,aAAa;gBACpB,OAAO,EAAE,GAAG,EAAE,OAAO,IAAI,iCAAiC;gBAC1D,OAAO,EAAE,OAAO;aACjB,CAAC,CAAA;YACF,eAAM,CAAC,KAAK,CAAC,8BAA8B,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,GAAG,EAAE,CAAC,CAAA;YACrE,MAAM,GAAG,CAAA;QACX,CAAC;IACH,CAAC;CACF;AA5HD,8CA4HC"}
@@ -1,26 +1,134 @@
1
1
  /**
2
- * OpenCode Plugin: Daytona Sandbox Integration
3
- *
4
- * OpenCode plugins extend the AI coding assistant by adding custom tools, handling events,
5
- * and modifying behavior. Plugins are TypeScript/JavaScript modules that export functions
6
- * which return hooks for various lifecycle events.
7
- *
8
- * This plugin integrates Daytona sandboxes with OpenCode, providing isolated development
9
- * environments for each session. It adds custom tools for file operations, command execution,
10
- * and search within sandboxes, and automatically cleans up resources when sessions end.
11
- *
12
- * Learn more: https://opencode.ai/docs/plugins/
13
- *
14
- * Daytona Sandbox Integration Tools
15
- *
16
- * Requires:
17
- * - npm install @daytonaio/sdk
18
- * - Environment: DAYTONA_API_KEY
2
+ * Copyright 2025 Daytona Platforms Inc.
3
+ * SPDX-License-Identifier: Apache-2.0
19
4
  */
20
- import type { Plugin } from '@opencode-ai/plugin';
5
+ import type { PluginInput } from '@opencode-ai/plugin';
21
6
  export type { EventSessionDeleted, LogLevel, SandboxInfo, SessionInfo, ProjectSessionData } from './core/types';
22
- export declare const CustomToolsPlugin: Plugin;
23
- export declare const DaytonaSessionCleanupPlugin: Plugin;
24
- export declare const SystemTransformPlugin: Plugin;
25
- export declare const DaytonaSessionIdleAutoCommitPlugin: Plugin;
26
- //# sourceMappingURL=index.d.ts.map
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,3 +1,9 @@
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 });
1
7
  /**
2
8
  * OpenCode Plugin: Daytona Sandbox Integration
3
9
  *
@@ -17,21 +23,26 @@
17
23
  * - npm install @daytonaio/sdk
18
24
  * - Environment: DAYTONA_API_KEY
19
25
  */
20
- import { join } from 'path';
21
- import { xdgData } from 'xdg-basedir';
22
- // Import modules
23
- import { setLogFilePath } from './core/logger';
24
- import { DaytonaSessionManager } from './core/session-manager';
25
- import { createCustomToolsPlugin, createSessionCleanupPlugin, createSystemTransformPlugin, createSessionIdleAutoCommitPlugin, } from './plugins';
26
- // Initialize logger and session manager using xdg-basedir (same as OpenCode)
27
- const LOG_FILE = join(xdgData, 'opencode', 'log', 'daytona.log');
28
- const STORAGE_DIR = join(xdgData, 'opencode', 'storage', 'daytona');
26
+ const path_1 = require("path");
27
+ const xdg_basedir_1 = require("xdg-basedir");
28
+ const logger_1 = require("./core/logger");
29
+ const session_manager_1 = require("./core/session-manager");
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
+ const LOG_FILE = (0, path_1.join)(xdg_basedir_1.xdgData, 'opencode', 'log', 'daytona.log');
35
+ const STORAGE_DIR = (0, path_1.join)(xdg_basedir_1.xdgData, 'opencode', 'storage', 'daytona');
29
36
  const REPO_PATH = '/home/daytona/project';
30
- setLogFilePath(LOG_FILE);
31
- const sessionManager = new DaytonaSessionManager(process.env.DAYTONA_API_KEY || '', STORAGE_DIR, REPO_PATH);
32
- // Export plugin instances
33
- export const CustomToolsPlugin = createCustomToolsPlugin(sessionManager);
34
- export const DaytonaSessionCleanupPlugin = createSessionCleanupPlugin(sessionManager);
35
- export const SystemTransformPlugin = createSystemTransformPlugin(REPO_PATH);
36
- export const DaytonaSessionIdleAutoCommitPlugin = createSessionIdleAutoCommitPlugin(sessionManager, REPO_PATH);
37
+ (0, logger_1.setLogFilePath)(LOG_FILE);
38
+ const sessionManager = new session_manager_1.DaytonaSessionManager(process.env.DAYTONA_API_KEY || '', STORAGE_DIR, REPO_PATH);
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;
37
48
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../.opencode/plugin/daytona/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EA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;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,8 +1,132 @@
1
- import type { Plugin } from '@opencode-ai/plugin';
1
+ /**
2
+ * Copyright 2025 Daytona Platforms Inc.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import type { PluginInput } from '@opencode-ai/plugin';
2
6
  import type { DaytonaSessionManager } from '../core/session-manager';
3
7
  /**
4
- * Creates the custom tools plugin for Daytona sandbox integration
5
- * Provides tools for file operations, command execution, and search within sandboxes
8
+ * Custom tools for Daytona sandbox: file ops, command execution, search.
6
9
  */
7
- export declare function createCustomToolsPlugin(sessionManager: DaytonaSessionManager): Plugin;
8
- //# sourceMappingURL=custom-tools.d.ts.map
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,17 +1,19 @@
1
- import { createDaytonaTools } from '../tools';
2
- import { logger } from '../core/logger';
1
+ "use strict";
3
2
  /**
4
- * Creates the custom tools plugin for Daytona sandbox integration
5
- * Provides tools for file operations, command execution, and search within sandboxes
3
+ * Copyright 2025 Daytona Platforms Inc.
4
+ * SPDX-License-Identifier: Apache-2.0
6
5
  */
7
- export function createCustomToolsPlugin(sessionManager) {
8
- return async (pluginCtx) => {
9
- logger.info('OpenCode started with Daytona plugin');
10
- const projectId = pluginCtx.project.id;
11
- const worktree = pluginCtx.project.worktree;
12
- return {
13
- tool: createDaytonaTools(sessionManager, projectId, worktree, pluginCtx),
14
- };
15
- };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.customTools = customTools;
8
+ const tools_1 = require("../tools");
9
+ const logger_1 = require("../core/logger");
10
+ /**
11
+ * Custom tools for Daytona sandbox: file ops, command execution, search.
12
+ */
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);
16
18
  }
17
19
  //# sourceMappingURL=custom-tools.js.map
@@ -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;AAGvC;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,cAAqC;IAC3E,OAAO,KAAK,EAAE,SAAsB,EAAE,EAAE;QACtC,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAA;QAEnD,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
+ {"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 2025 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>>;