opencode-beads 0.1.0 → 0.1.2
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/package.json +1 -1
- package/src/plugin.ts +14 -7
package/package.json
CHANGED
package/src/plugin.ts
CHANGED
|
@@ -101,16 +101,25 @@ export const BeadsPlugin: Plugin = async ({ client, $ }) => {
|
|
|
101
101
|
// Skip if already injected this session
|
|
102
102
|
if (injectedSessions.has(sessionID)) return;
|
|
103
103
|
|
|
104
|
-
// Check if
|
|
104
|
+
// Check if beads-context was already injected (handles plugin reload/reconnection)
|
|
105
105
|
try {
|
|
106
106
|
const existing = await client.session.messages({
|
|
107
107
|
path: { id: sessionID },
|
|
108
|
-
query: { limit: 1 },
|
|
109
108
|
});
|
|
110
109
|
|
|
111
|
-
if (existing.data
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
if (existing.data) {
|
|
111
|
+
const hasBeadsContext = existing.data.some(msg => {
|
|
112
|
+
const parts = (msg as any).parts || (msg.info as any).parts;
|
|
113
|
+
if (!parts) return false;
|
|
114
|
+
return parts.some((part: any) =>
|
|
115
|
+
part.type === 'text' && part.text?.includes('<beads-context>')
|
|
116
|
+
);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
if (hasBeadsContext) {
|
|
120
|
+
injectedSessions.add(sessionID);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
114
123
|
}
|
|
115
124
|
} catch {
|
|
116
125
|
// On error, proceed with injection
|
|
@@ -141,5 +150,3 @@ export const BeadsPlugin: Plugin = async ({ client, $ }) => {
|
|
|
141
150
|
},
|
|
142
151
|
};
|
|
143
152
|
};
|
|
144
|
-
|
|
145
|
-
export default BeadsPlugin;
|