@igorjpimenta/brayer-opencode 0.0.0-stage → 2026.10.28-beta.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/hooks.js +17 -0
- package/identity.js +11 -0
- package/index.js +5 -0
- package/package.json +22 -4
- package/README.md +0 -3
package/hooks.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { stampBrayerIdentity } from "./identity.js";
|
|
2
|
+
|
|
3
|
+
export function createBrayerHooks() {
|
|
4
|
+
const agents = new Map();
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
"chat.message": async (input) => {
|
|
8
|
+
if (input?.sessionID && input?.agent) agents.set(input.sessionID, input.agent);
|
|
9
|
+
},
|
|
10
|
+
"chat.params": async (input) => {
|
|
11
|
+
if (input?.sessionID && input?.agent) agents.set(input.sessionID, input.agent);
|
|
12
|
+
},
|
|
13
|
+
"tool.execute.before": async (input, output) => {
|
|
14
|
+
stampBrayerIdentity(input, output, { agent: agents.get(input?.sessionID) ?? process.env.BRAYER_AGENT });
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
package/identity.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function isBrayerTool(name) {
|
|
2
|
+
return typeof name === "string" && name.includes("brayer");
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function stampBrayerIdentity(input, output, { agent = null } = {}) {
|
|
6
|
+
if (!isBrayerTool(input?.tool)) return false;
|
|
7
|
+
output.args = output.args ?? {};
|
|
8
|
+
if (!output.args.brayer_agent && agent) output.args.brayer_agent = agent;
|
|
9
|
+
if (!output.args.brayer_session) output.args.brayer_session = input.sessionID;
|
|
10
|
+
return true;
|
|
11
|
+
}
|
package/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@igorjpimenta/brayer-opencode",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "2026.10.28-beta.2",
|
|
4
|
+
"description": "OpenCode companion for Brayer: stamps agent and session identity on Brayer tool calls.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/igorjpimenta/brayer.git",
|
|
10
|
+
"directory": "plugins/opencode/brayer"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"registry": "https://registry.npmjs.org",
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"exports": {
|
|
17
|
+
".": "./index.js"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"index.js",
|
|
21
|
+
"hooks.js",
|
|
22
|
+
"identity.js"
|
|
23
|
+
]
|
|
24
|
+
}
|
package/README.md
DELETED