@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.
@@ -0,0 +1,34 @@
1
+ import type { PluginInput } from '@opencode-ai/plugin';
2
+ import type { OpenCodeObserverConfig } from './config';
3
+ import type { EventWithProperties, OpenCodeMessage, OpenCodeModel, OpenCodePart } from './types';
4
+ type SessionHistoryLoader = (sessionID: string) => Promise<Array<{
5
+ info: OpenCodeMessage;
6
+ parts: OpenCodePart[];
7
+ }>>;
8
+ export declare class OpenCodeTlsTracer {
9
+ private readonly config;
10
+ private sessions;
11
+ constructor(config: OpenCodeObserverConfig);
12
+ private getSession;
13
+ private getMessage;
14
+ private loadHistory;
15
+ private updateSessionInfo;
16
+ private attachPromptContextIfReady;
17
+ private registerCompletedMessage;
18
+ private exportTurn;
19
+ handleSystemPrompt(input: {
20
+ sessionID?: string;
21
+ model: OpenCodeModel;
22
+ }, output: {
23
+ system: string[];
24
+ }, loader: SessionHistoryLoader): Promise<void>;
25
+ handleEvent(event: EventWithProperties, loader: SessionHistoryLoader): Promise<void>;
26
+ flush(sessionID?: string): Promise<void>;
27
+ get observedSessionCount(): number;
28
+ }
29
+ export declare function loadSessionMessages(ctx: PluginInput, sessionID: string): Promise<Array<{
30
+ info: OpenCodeMessage;
31
+ parts: OpenCodePart[];
32
+ }>>;
33
+ export {};
34
+ //# sourceMappingURL=tracer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracer.d.ts","sourceRoot":"","sources":["../src/tracer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,KAAK,EACV,mBAAmB,EAMnB,eAAe,EACf,aAAa,EACb,YAAY,EACb,MAAM,SAAS,CAAC;AAEjB,KAAK,oBAAoB,GAAG,CAC1B,SAAS,EAAE,MAAM,KACd,OAAO,CAAC,KAAK,CAAC;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,YAAY,EAAE,CAAA;CAAE,CAAC,CAAC,CAAC;AAiHtE,qBAAa,iBAAiB;IAGhB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,OAAO,CAAC,QAAQ,CAAsC;gBAEzB,MAAM,EAAE,sBAAsB;IAE3D,OAAO,CAAC,UAAU;IAalB,OAAO,CAAC,UAAU;YAYJ,WAAW;IAczB,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,0BAA0B;IAOlC,OAAO,CAAC,wBAAwB;IAoBhC,OAAO,CAAC,UAAU;IA8CZ,kBAAkB,CACtB,KAAK,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,aAAa,CAAA;KAAE,EACnD,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,EAC5B,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,IAAI,CAAC;IAUV,WAAW,CAAC,KAAK,EAAE,mBAAmB,EAAE,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAwEpF,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK9C,IAAI,oBAAoB,IAAI,MAAM,CAEjC;CACF;AAED,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,KAAK,CAAC;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,YAAY,EAAE,CAAA;CAAE,CAAC,CAAC,CAMlE"}
@@ -0,0 +1,46 @@
1
+ import type { Event, Message, Model, Part } from '@opencode-ai/sdk';
2
+ export type OpenCodeEvent = Event;
3
+ export type OpenCodeMessage = Message;
4
+ export type OpenCodePart = Part;
5
+ export type OpenCodeModel = Model;
6
+ export type ObservedPart = OpenCodePart & {
7
+ receivedAt?: number;
8
+ };
9
+ export interface PromptContext {
10
+ model?: OpenCodeModel;
11
+ system?: string[];
12
+ }
13
+ export interface ObservedMessage {
14
+ info?: OpenCodeMessage;
15
+ parts: ObservedPart[];
16
+ completed: boolean;
17
+ promptContext?: PromptContext;
18
+ }
19
+ export type TurnExportState = 'open' | 'ready' | 'exporting' | 'exported';
20
+ export interface ObservedTurn {
21
+ turnId: string;
22
+ messages: ObservedMessage[];
23
+ exportState: TurnExportState;
24
+ }
25
+ export interface ObservedSessionInfo {
26
+ id: string;
27
+ parentID?: string;
28
+ directory?: string;
29
+ title?: string;
30
+ version?: string;
31
+ }
32
+ export interface ObservedSession {
33
+ sessionID: string;
34
+ parentID?: string;
35
+ info?: ObservedSessionInfo;
36
+ history?: ObservedMessage[];
37
+ messages: Map<string, ObservedMessage>;
38
+ turns: Map<string, ObservedTurn>;
39
+ pendingSystemPrompt?: PromptContext;
40
+ pendingExports: Promise<unknown>[];
41
+ }
42
+ export interface EventWithProperties {
43
+ type: string;
44
+ properties?: Record<string, unknown>;
45
+ }
46
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEpE,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC;AAClC,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC;AACtC,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC;AAChC,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC;AAElC,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,EAA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ry to Volcengine TLS with GenAI OTEL traces.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ }
12
+ },
13
+ "types": "./dist/index.d.ts",
14
+ "engines": {
15
+ "node": ">=18"
16
+ },
17
+ "keywords": [
18
+ "opencode",
19
+ "observability",
20
+ "opentelemetry",
21
+ "tls"
22
+ ],
23
+ "license": "Apache-2.0",
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "dependencies": {
28
+ "@volcengine/openapi": "^1.36.1"
29
+ }
30
+ }