opencode-axonhub-tracing 1.0.0

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/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # opencode-axonhub-tracing
2
+
3
+ An OpenCode plugin that automatically injects AxonHub tracing headers into your LLM requests. This allows AxonHub to group all requests from the same OpenCode session together for trace aggregation.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g opencode-axonhub-tracing
9
+ # or
10
+ bun add -g opencode-axonhub-tracing
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Add the plugin to your `opencode.json`:
16
+
17
+ ```json
18
+ {
19
+ "$schema": "https://opencode.ai/config.json",
20
+ "plugin": ["opencode-axonhub-tracing"]
21
+ }
22
+ ```
23
+
24
+ That's it! The plugin will automatically add:
25
+ - `AH-Trace-Id` - Set to the current OpenCode session ID.
26
+
27
+ ## How It Works
28
+
29
+ 1. The plugin hooks into the `chat.headers` event.
30
+ 2. It injects the `AH-Trace-Id` into the headers of every AI provider request.
31
+ 3. The trace ID is derived from the OpenCode `sessionID`, ensuring all requests in a single session are linked in AxonHub.
32
+
33
+ ## Requirements
34
+
35
+ - OpenCode 1.1.40 or later
36
+ - An AxonHub setup
37
+
38
+ ## License
39
+
40
+ MIT
@@ -0,0 +1,19 @@
1
+ import type { Hooks, PluginInput } from "@opencode-ai/plugin";
2
+ /**
3
+ * OpenCode plugin for AxonHub tracing.
4
+ *
5
+ * Automatically injects AH-Trace-Id header into all AI provider requests for
6
+ * AxonHub trace aggregation. This allows AxonHub to group requests from the
7
+ * same OpenCode session into a single trace.
8
+ *
9
+ * ## Configuration
10
+ *
11
+ * Add to your `.opencode/config.json`:
12
+ *
13
+ * ```json
14
+ * {
15
+ * "plugin": ["opencode-axonhub-tracing"]
16
+ * }
17
+ * ```
18
+ */
19
+ export default function AxonHubTracing(_input: PluginInput): Promise<Hooks>;
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ // index.ts
2
+ async function AxonHubTracing(_input) {
3
+ return {
4
+ "chat.headers": async (input, output) => {
5
+ if (input.sessionID) {
6
+ output.headers["AH-Trace-Id"] = input.sessionID;
7
+ }
8
+ }
9
+ };
10
+ }
11
+ export {
12
+ AxonHubTracing as default
13
+ };
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "opencode-axonhub-tracing",
3
+ "version": "1.0.0",
4
+ "description": "OpenCode plugin for AxonHub tracing - automatically injects session headers for request tracing",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.js",
13
+ "types": "./dist/index.d.ts"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "build": "bun build index.ts --outdir dist --target node && bun run build:types",
21
+ "build:types": "tsc --declaration --emitDeclarationOnly --outDir dist",
22
+ "prepublishOnly": "bun run build",
23
+ "test": "bun test",
24
+ "release": "npm publish"
25
+ },
26
+ "keywords": [
27
+ "opencode",
28
+ "axonhub",
29
+ "tracing",
30
+ "session",
31
+ "tracking",
32
+ "observability",
33
+ "plugin",
34
+ "llm",
35
+ "ai"
36
+ ],
37
+ "author": "",
38
+ "license": "MIT",
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/your-org/opencode-axonhub-tracing.git"
42
+ },
43
+ "bugs": {
44
+ "url": "https://github.com/your-org/opencode-axonhub-tracing/issues"
45
+ },
46
+ "homepage": "https://github.com/your-org/opencode-axonhub-tracing#readme",
47
+ "peerDependencies": {
48
+ "@opencode-ai/plugin": ">=0.15.0",
49
+ "@opencode-ai/sdk": ">=0.15.0",
50
+ "typescript": ">=5.0.0"
51
+ },
52
+ "devDependencies": {
53
+ "@opencode-ai/plugin": "^0.15.0",
54
+ "@opencode-ai/sdk": "^0.15.0",
55
+ "@types/bun": "^1.3.1",
56
+ "typescript": "^5.9.3"
57
+ }
58
+ }