@volcengine/tls-observer-pi 0.0.1

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 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,58 @@
1
+ # TLS Observer for Pi
2
+
3
+ Pi Coding Agent plugin that converts Pi lifecycle 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 Pi public lifecycle hooks, groups them by session and turn in memory, and exports one `agent.turn` trace when the turn or agent run finishes.
14
+
15
+ ## Configuration
16
+
17
+ Environment variables:
18
+
19
+ - `PI_TLS_EXPORT=0` disables export.
20
+ - `PI_TLS_ENV_FILE` optionally points to an env file. Defaults to `~/.pi/agent/tls-observer-pi.env`.
21
+ - `PI_TLS_DATA_ROOT` overrides local send-log and retry state.
22
+ - `PI_TLS_CAPTURE_CONTENT=0` disables prompt/response/tool content capture.
23
+ - `PI_TLS_ENDPOINT` or `TRACE_TLS_ENDPOINT` or `TLS_ENDPOINT`
24
+ - `PI_TLS_REGION` or `TRACE_TLS_REGION` or `TLS_REGION`
25
+ - `PI_TLS_TRACE_TOPIC_ID` or `PI_TLS_TOPIC_ID` or `TRACE_TLS_TRACE_TOPIC_ID` or `TLS_TRACE_TOPIC_ID`
26
+ - `PI_TLS_API_KEY` or `TRACE_TLS_API_KEY` or `TLS_API_KEY`
27
+ - `PI_TLS_AK` / `PI_TLS_SK` or `TRACE_TLS_AK` / `TRACE_TLS_SK` or `TLS_AK` / `TLS_SK`
28
+
29
+ Default data root:
30
+
31
+ ```text
32
+ ~/.pi/agent/tls-observer-pi
33
+ ```
34
+
35
+ ## Pi plugin loading
36
+
37
+ Install with the dedicated installer:
38
+
39
+ ```bash
40
+ npm exec -y --package=@volcengine/tls-observer-pi-install -- tls-observer-pi-install
41
+ ```
42
+
43
+ If `pi` is not on `PATH`, pass `PI_TLS_PI_BIN=/absolute/path/to/pi` or `--pi-bin /absolute/path/to/pi`.
44
+
45
+ For local installs, build the runtime package first and point the installer at the package source. The installer uses Pi CLI install semantics: `pi install npm:<package>` for registry installs and `pi install <local-path>` for local runtime packages.
46
+
47
+ ```bash
48
+ cd packages/pi
49
+ rslib build
50
+ node scripts/build-package.mjs
51
+ cd ../pi-install
52
+ PI_PLUGIN_SOURCE=../pi/dist-package npm exec -y -- tls-observer-pi-install
53
+ cd -
54
+ ```
55
+
56
+ ## Design notes
57
+
58
+ This implementation uses a clean-room Pi adapter. It borrows the event-aggregation idea from existing Pi tracing integrations, but the code, names, state model, and TLS span mapping are independently implemented for this repository.
@@ -0,0 +1,13 @@
1
+ export interface PiObserverConfig {
2
+ enabled: boolean;
3
+ dataRoot: string;
4
+ captureContent: boolean;
5
+ serviceName: string;
6
+ serviceInstanceId: string;
7
+ pluginVersion: string;
8
+ exportTimeoutMs: number;
9
+ env: Record<string, string | undefined>;
10
+ }
11
+ export declare function loadEnvFile(filePath?: string): boolean;
12
+ export declare function loadConfig(): PiObserverConfig;
13
+ //# 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,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,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;AAmCD,wBAAgB,WAAW,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAmBtD;AAiDD,wBAAgB,UAAU,IAAI,gBAAgB,CAkB7C"}
@@ -0,0 +1,7 @@
1
+ import { loadConfig } from './config';
2
+ import { PiTlsTracer } from './tracer';
3
+ import type { PiExtensionApi } from './types';
4
+ export declare const TlsObserverPiPlugin: (pi: PiExtensionApi) => Promise<void>;
5
+ export default TlsObserverPiPlugin;
6
+ export { loadConfig, PiTlsTracer };
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,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,eAAO,MAAM,mBAAmB,GAAU,IAAI,cAAc,kBAqE3D,CAAC;AAEF,eAAe,mBAAmB,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC"}