@mindfoldhq/trellis 0.5.0-beta.6 → 0.5.0-beta.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.
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.5.0-beta.7",
|
|
3
|
+
"description": "Fix opencode plugin loader incompatibility with OpenCode 1.2.x. Plugins shipped `export default { id, server: async (...) => hooks }` object shape; OpenCode iterates `Object.entries(mod)` and calls each export as a function (`packages/opencode/src/plugin/index.ts:90 — for ([_, fn] of Object.entries(mod)) await fn(input)`), which crashes with `TypeError: fn is not a function`. Fixed by changing all 3 plugins to the current factory-function shape: `export default async (input) => hooks`.",
|
|
4
|
+
"breaking": false,
|
|
5
|
+
"recommendMigrate": false,
|
|
6
|
+
"changelog": "**Bug Fixes:**\n- fix(opencode): plugins now use the factory-function export shape (`export default async ({ directory, client }) => hooks`) that OpenCode 1.2.x requires. The previous `{ id, server }` object shape crashed OpenCode on startup with `TypeError: fn3 is not a function. (In 'fn3(input)', 'fn3' is an instance of Object)` at `src/plugin/index.ts:90:28`, because OpenCode 1.2.x iterates every module export with `Object.entries(mod)` and calls each one as a function (`for ([_, fn] of Object.entries(mod)) await fn(input)`). The `server:` field was never unwrapped by the runtime. Affects all 3 plugins: `inject-subagent-context.js`, `inject-workflow-state.js`, `session-start.js`.\n Users on any trellis version that configured opencode — including 0.4.x stable — were affected as soon as they updated opencode to 1.2.x. Upgrade to this version to restore opencode startup.",
|
|
7
|
+
"migrations": [],
|
|
8
|
+
"notes": "Pure template-content fix for opencode users. No path migrations. `trellis update` auto-updates the 3 plugin files (unmodified copies) or prompts for confirm with diff (if you customized them)."
|
|
9
|
+
}
|
|
@@ -255,13 +255,16 @@ ${originalPrompt}
|
|
|
255
255
|
return templates[agentType] || originalPrompt
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
-
export default
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
258
|
+
// OpenCode plugin factory: `export default async (input) => hooks`.
|
|
259
|
+
// OpenCode 1.2.x iterates every module export and invokes it as a function
|
|
260
|
+
// (packages/opencode/src/plugin/index.ts — `for ([_, fn] of Object.entries(mod)) await fn(input)`);
|
|
261
|
+
// the previous `{ id, server }` object shape failed with
|
|
262
|
+
// `TypeError: fn is not a function` in 1.2.x.
|
|
263
|
+
export default async ({ directory }) => {
|
|
264
|
+
const ctx = new TrellisContext(directory)
|
|
265
|
+
debugLog("inject", "Plugin loaded, directory:", directory)
|
|
266
|
+
|
|
267
|
+
return {
|
|
265
268
|
"tool.execute.before": async (input, output) => {
|
|
266
269
|
try {
|
|
267
270
|
debugLog("inject", "tool.execute.before called, tool:", input?.tool)
|
|
@@ -337,5 +340,4 @@ export default {
|
|
|
337
340
|
}
|
|
338
341
|
}
|
|
339
342
|
}
|
|
340
|
-
}
|
|
341
343
|
}
|
|
@@ -107,13 +107,12 @@ function buildBreadcrumb(id, status, templates) {
|
|
|
107
107
|
return `<workflow-state>\n${header}\n${body}\n</workflow-state>`
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
debugLog("workflow-state", "Plugin loaded, directory:", directory)
|
|
110
|
+
// OpenCode 1.2.x expects plugins to be factory functions (see inject-subagent-context.js comment).
|
|
111
|
+
export default async ({ directory }) => {
|
|
112
|
+
const ctx = new TrellisContext(directory)
|
|
113
|
+
debugLog("workflow-state", "Plugin loaded, directory:", directory)
|
|
115
114
|
|
|
116
|
-
|
|
115
|
+
return {
|
|
117
116
|
// chat.message fires on every user message. Inject breadcrumb in-place
|
|
118
117
|
// so it persists in conversation history.
|
|
119
118
|
"chat.message": async (input, output) => {
|
|
@@ -155,6 +154,5 @@ export default {
|
|
|
155
154
|
)
|
|
156
155
|
}
|
|
157
156
|
},
|
|
158
|
-
|
|
159
|
-
},
|
|
157
|
+
}
|
|
160
158
|
}
|
|
@@ -432,13 +432,12 @@ async function hasPersistedInjectedContext(client, directory, sessionID) {
|
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
434
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
debugLog("session", "Plugin loaded, directory:", directory)
|
|
435
|
+
// OpenCode 1.2.x expects plugins to be factory functions (see inject-subagent-context.js comment).
|
|
436
|
+
export default async ({ directory, client }) => {
|
|
437
|
+
const ctx = new TrellisContext(directory)
|
|
438
|
+
debugLog("session", "Plugin loaded, directory:", directory)
|
|
440
439
|
|
|
441
|
-
|
|
440
|
+
return {
|
|
442
441
|
// Clear in-memory dedupe after compaction so context can be re-injected.
|
|
443
442
|
event: ({ event }) => {
|
|
444
443
|
try {
|
|
@@ -511,6 +510,5 @@ export default {
|
|
|
511
510
|
debugLog("session", "Error in chat.message:", error.message, error.stack)
|
|
512
511
|
}
|
|
513
512
|
}
|
|
514
|
-
}
|
|
515
513
|
}
|
|
516
514
|
}
|
package/package.json
CHANGED