@volcengine/tls-observer-opencode 0.0.3
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/LICENCE +13 -0
- package/README.md +43 -0
- package/dist/config.d.ts +15 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1997 -0
- package/dist/tracer.d.ts +34 -0
- package/dist/tracer.d.ts.map +1 -0
- package/dist/types.d.ts +46 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +30 -0
package/LICENCE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Copyright 2023 Beijing Volcano Engine Technology Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# TLS Observer for OpenCode
|
|
2
|
+
|
|
3
|
+
OpenCode plugin that converts OpenCode session events into GenAI OTEL traces and exports them to Volcengine TLS.
|
|
4
|
+
|
|
5
|
+
## Trace shape
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
agent.turn (server)
|
|
9
|
+
llm.request (client)
|
|
10
|
+
tool.call (client)
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The plugin listens to OpenCode public plugin events, groups them by user turn, and exports one `agent.turn` trace when the assistant reaches `step-finish reason="stop"`.
|
|
14
|
+
|
|
15
|
+
## Configuration
|
|
16
|
+
|
|
17
|
+
Environment variables:
|
|
18
|
+
|
|
19
|
+
- `OPENCODE_TLS_EXPORT=0` disables export.
|
|
20
|
+
- `OPENCODE_TLS_ENV_FILE` optionally points to an env file. Defaults to `~/.config/opencode/tls-observer-opencode.env`.
|
|
21
|
+
- `OPENCODE_TLS_DATA_ROOT` overrides local send-log and retry state.
|
|
22
|
+
- `OPENCODE_TLS_CAPTURE_CONTENT=0` disables prompt/response/tool content capture.
|
|
23
|
+
- `OPENCODE_TLS_ENDPOINT` or `TRACE_TLS_ENDPOINT`
|
|
24
|
+
- `OPENCODE_TLS_REGION` or `TLS_REGION`
|
|
25
|
+
- `OPENCODE_TLS_TRACE_TOPIC_ID` or `TLS_TRACE_TOPIC_ID`
|
|
26
|
+
- `OPENCODE_TLS_API_KEY` or `TLS_API_KEY`
|
|
27
|
+
- `OPENCODE_TLS_AK` / `OPENCODE_TLS_SK` or `TLS_AK` / `TLS_SK`
|
|
28
|
+
|
|
29
|
+
Default data root:
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
~/.config/opencode/plugins/data/tls-observer-opencode
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## OpenCode plugin loading
|
|
36
|
+
|
|
37
|
+
For local installs, place a JavaScript plugin entry file under `~/.config/opencode/plugins/`.
|
|
38
|
+
The installer writes `~/.config/opencode/plugins/tls-observer-opencode.js` and keeps the
|
|
39
|
+
runtime package in `~/.config/opencode/plugins/tls-observer-opencode/`.
|
|
40
|
+
|
|
41
|
+
## Design notes
|
|
42
|
+
|
|
43
|
+
This implementation uses a clean-room OpenCode adapter. It borrows the event-aggregation idea from existing OpenCode tracing integrations, but the code, names, state model, and TLS span mapping are independently implemented for this repository.
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface OpenCodeObserverConfig {
|
|
2
|
+
enabled: boolean;
|
|
3
|
+
dataRoot: string;
|
|
4
|
+
captureContent: boolean;
|
|
5
|
+
debugArtifacts: boolean;
|
|
6
|
+
serviceName: string;
|
|
7
|
+
serviceInstanceId: string;
|
|
8
|
+
pluginVersion: string;
|
|
9
|
+
exportTimeoutMs: number;
|
|
10
|
+
env: Record<string, string | undefined>;
|
|
11
|
+
}
|
|
12
|
+
export declare function loadEnvFile(filePath?: string): boolean;
|
|
13
|
+
export declare function loadConfig(): OpenCodeObserverConfig;
|
|
14
|
+
export declare function localIdentityAttributes(): Record<string, unknown>;
|
|
15
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,OAAO,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CACzC;AAyCD,wBAAgB,WAAW,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAmBtD;AAoDD,wBAAgB,UAAU,IAAI,sBAAsB,CAmBnD;AAED,wBAAgB,uBAAuB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIjE"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Plugin } from '@opencode-ai/plugin';
|
|
2
|
+
import { loadConfig } from './config';
|
|
3
|
+
import { OpenCodeTlsTracer } from './tracer';
|
|
4
|
+
export declare const TlsObserverOpenCodePlugin: Plugin;
|
|
5
|
+
export default TlsObserverOpenCodePlugin;
|
|
6
|
+
export { loadConfig, OpenCodeTlsTracer };
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAuB,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElE,eAAO,MAAM,yBAAyB,EAAE,MAkBvC,CAAC;AAEF,eAAe,yBAAyB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,CAAC"}
|