@xinleibird/bridge-opencode 0.2.5 → 0.2.7
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.
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bridge.ts
CHANGED
|
@@ -104,8 +104,25 @@ export const BridgePlugin: Plugin = async ({ directory }) => {
|
|
|
104
104
|
pendingByCallID.delete(input.callID);
|
|
105
105
|
|
|
106
106
|
for (const filePath of pending.filePaths) {
|
|
107
|
-
await
|
|
108
|
-
|
|
107
|
+
const before = await checkBuffer(filePath);
|
|
108
|
+
let reloadSucceeded = false;
|
|
109
|
+
try {
|
|
110
|
+
await refreshBuffer(filePath);
|
|
111
|
+
reloadSucceeded = true;
|
|
112
|
+
} catch (err) {
|
|
113
|
+
console.error(`Failed to reload ${filePath}:`, err);
|
|
114
|
+
} finally {
|
|
115
|
+
if (before.isCurrent) {
|
|
116
|
+
try {
|
|
117
|
+
await sendMessage(
|
|
118
|
+
reloadSucceeded ? "🔄 Reloaded by OpenCode." : "⚠️ Reload failed.",
|
|
119
|
+
reloadSucceeded ? "info" : "warn",
|
|
120
|
+
);
|
|
121
|
+
} catch {
|
|
122
|
+
// non-fatal
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
109
126
|
}
|
|
110
127
|
},
|
|
111
128
|
|
|
@@ -131,13 +148,15 @@ export const BridgePlugin: Plugin = async ({ directory }) => {
|
|
|
131
148
|
}
|
|
132
149
|
if (!s.startLine) continue;
|
|
133
150
|
|
|
134
|
-
const
|
|
151
|
+
const filePath = s.filePath.startsWith(cwd + "/")
|
|
135
152
|
? "./" + s.filePath.slice(cwd.length + 1)
|
|
136
153
|
: s.filePath;
|
|
137
154
|
|
|
138
|
-
|
|
155
|
+
const fileRef = `${filePath}:${s.startLine}-${s.endLine}`;
|
|
156
|
+
|
|
157
|
+
refs.push(fileRef);
|
|
139
158
|
|
|
140
|
-
const
|
|
159
|
+
const fileName = basename(s.filePath);
|
|
141
160
|
|
|
142
161
|
output.parts.push({
|
|
143
162
|
type: "file",
|
|
@@ -145,7 +164,7 @@ export const BridgePlugin: Plugin = async ({ directory }) => {
|
|
|
145
164
|
sessionID: input.sessionID,
|
|
146
165
|
messageID: input.messageID ?? "",
|
|
147
166
|
mime: "text/plain",
|
|
148
|
-
filename:
|
|
167
|
+
filename: fileName,
|
|
149
168
|
url: `file://${s.filePath}?start=${s.startLine}&end=${s.endLine}`,
|
|
150
169
|
});
|
|
151
170
|
attached++;
|