opencode-metrics-plugin 0.2.0 → 0.2.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/README.md CHANGED
@@ -76,7 +76,7 @@ opencode 事件流
76
76
  ## 可编程 API
77
77
 
78
78
  ```ts
79
- import { createMetricsRuntime, configureDirs } from 'opencode-metrics-plugin'
79
+ import { createMetricsRuntime, configureDirs } from 'opencode-metrics-plugin/api'
80
80
 
81
81
  const rt = createMetricsRuntime({
82
82
  dirs: { metricsDir: '/data/metrics', eventsDir: '/data/events' },
package/dist/api.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './metrics/index.js';
2
+ export { setLogLevel, setLogFile, flushLogs } from './shared/log.js';
3
+ export type { LogLevel } from './shared/log.js';
package/dist/api.js ADDED
@@ -0,0 +1,4 @@
1
+ // 可编程 API 出口(子路径 opencode-metrics-plugin/api)
2
+ // 与插件入口分离:本模块包含非函数导出(defaultDirs 等),不能作为 opencode 插件模块加载
3
+ export * from './metrics/index.js';
4
+ export { setLogLevel, setLogFile, flushLogs } from './shared/log.js';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,2 @@
1
1
  export { MetricsPlugin, default } from './plugin.js';
2
2
  export type { MetricsPluginOptions } from './plugin.js';
3
- export * from './metrics/index.js';
4
- export { setLogLevel, setLogFile, flushLogs } from './shared/log.js';
5
- export type { LogLevel } from './shared/log.js';
package/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  // opencode-metrics-plugin 包出口
2
- // 默认导出即 opencode 插件入口(dist/index.js);metrics 域与 shared/log 为可编程 API
2
+ // 仅导出插件函数(opencode 加载插件模块时,每个运行时导出都必须是插件函数)
3
+ // 可编程 API 见 './api.js'(opencode-metrics-plugin/api)
3
4
  export { MetricsPlugin, default } from './plugin.js';
4
- export * from './metrics/index.js';
5
- export { setLogLevel, setLogFile, flushLogs } from './shared/log.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-metrics-plugin",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "opencode plugin: auto-records every session's metrics (tokens/rounds/steps/sub-agents/hvigor builds) to snapshot JSON. Zero DB, zero config. Pair with session-viewer for visualization.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -17,6 +17,10 @@
17
17
  ".": {
18
18
  "types": "./dist/index.d.ts",
19
19
  "import": "./dist/index.js"
20
+ },
21
+ "./api": {
22
+ "types": "./dist/api.d.ts",
23
+ "import": "./dist/api.js"
20
24
  }
21
25
  },
22
26
  "files": [