@vite-plugin-opencode-assistant/shared 1.0.5
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/es/constants.d.ts +74 -0
- package/es/constants.js +65 -0
- package/es/index.d.ts +3 -0
- package/es/index.js +3 -0
- package/es/logger.d.ts +64 -0
- package/es/logger.js +353 -0
- package/es/types.d.ts +126 -0
- package/es/types.js +0 -0
- package/lib/constants.d.ts +74 -0
- package/lib/constants.js +113 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +25 -0
- package/lib/logger.d.ts +64 -0
- package/lib/logger.js +384 -0
- package/lib/types.d.ts +126 -0
- package/lib/types.js +15 -0
- package/package.json +27 -0
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode Vite 插件配置选项
|
|
3
|
+
*/
|
|
4
|
+
export interface OpenCodeOptions {
|
|
5
|
+
/** 是否启用插件,默认 true */
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
/** Web 服务端口,默认 4097 */
|
|
8
|
+
webPort?: number;
|
|
9
|
+
/** 服务主机名,默认 '127.0.0.1' */
|
|
10
|
+
hostname?: string;
|
|
11
|
+
/** 挂件位置,默认 'bottom-right' */
|
|
12
|
+
position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
|
13
|
+
/** 主题模式,默认 'auto' */
|
|
14
|
+
theme?: "light" | "dark" | "auto";
|
|
15
|
+
/** 是否自动打开面板,默认 false */
|
|
16
|
+
open?: boolean;
|
|
17
|
+
/** 是否自动重载,默认 true */
|
|
18
|
+
autoReload?: boolean;
|
|
19
|
+
/** 是否输出详细日志,默认 false */
|
|
20
|
+
verbose?: boolean;
|
|
21
|
+
/** 快捷键配置,默认 'ctrl+k' */
|
|
22
|
+
hotkey?: string;
|
|
23
|
+
/** 服务启动后是否立即预热 Chrome MCP,默认 true */
|
|
24
|
+
warmupChromeMcp?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* OpenCode Web 服务启动选项
|
|
28
|
+
*/
|
|
29
|
+
export interface WebOptions {
|
|
30
|
+
/** 服务端口 */
|
|
31
|
+
port: number;
|
|
32
|
+
/** 服务主机名 */
|
|
33
|
+
hostname: string;
|
|
34
|
+
/** 服务器 URL */
|
|
35
|
+
serverUrl: string;
|
|
36
|
+
/** 工作目录 */
|
|
37
|
+
cwd: string;
|
|
38
|
+
/** 配置目录路径 */
|
|
39
|
+
configDir?: string;
|
|
40
|
+
/** CORS 允许的源 */
|
|
41
|
+
corsOrigins?: string[];
|
|
42
|
+
/** 上下文 API URL */
|
|
43
|
+
contextApiUrl?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 挂件注入配置选项
|
|
47
|
+
*/
|
|
48
|
+
export interface WidgetOptions {
|
|
49
|
+
/** Web 服务 URL */
|
|
50
|
+
webUrl: string;
|
|
51
|
+
/** 服务器 URL */
|
|
52
|
+
serverUrl: string;
|
|
53
|
+
/** 挂件位置 */
|
|
54
|
+
position: string;
|
|
55
|
+
/** 主题模式 */
|
|
56
|
+
theme: string;
|
|
57
|
+
/** 是否自动打开 */
|
|
58
|
+
open: boolean;
|
|
59
|
+
/** 是否自动重载 */
|
|
60
|
+
autoReload: boolean;
|
|
61
|
+
/** 工作目录 */
|
|
62
|
+
cwd: string;
|
|
63
|
+
/** 会话 URL */
|
|
64
|
+
sessionUrl?: string;
|
|
65
|
+
/** 快捷键配置 */
|
|
66
|
+
hotkey?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* OpenCode 会话信息
|
|
70
|
+
*/
|
|
71
|
+
export interface SessionInfo {
|
|
72
|
+
/** 会话 ID */
|
|
73
|
+
id: string;
|
|
74
|
+
/** 会话标识符 */
|
|
75
|
+
slug: string;
|
|
76
|
+
/** 项目 ID */
|
|
77
|
+
projectID: string;
|
|
78
|
+
/** 项目目录 */
|
|
79
|
+
directory: string;
|
|
80
|
+
/** 会话标题 */
|
|
81
|
+
title: string;
|
|
82
|
+
/** 版本号 */
|
|
83
|
+
version: string;
|
|
84
|
+
/** 代码变更统计 */
|
|
85
|
+
summary: {
|
|
86
|
+
/** 新增行数 */
|
|
87
|
+
additions: number;
|
|
88
|
+
/** 删除行数 */
|
|
89
|
+
deletions: number;
|
|
90
|
+
/** 修改文件数 */
|
|
91
|
+
files: number;
|
|
92
|
+
};
|
|
93
|
+
/** 时间信息 */
|
|
94
|
+
time: {
|
|
95
|
+
/** 创建时间戳 */
|
|
96
|
+
created: number;
|
|
97
|
+
/** 更新时间戳 */
|
|
98
|
+
updated: number;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* 选中的元素信息
|
|
103
|
+
*/
|
|
104
|
+
export interface SelectedElement {
|
|
105
|
+
/** 文件路径 */
|
|
106
|
+
filePath: string | null;
|
|
107
|
+
/** 行号 */
|
|
108
|
+
line: number | null;
|
|
109
|
+
/** 列号 */
|
|
110
|
+
column: number | null;
|
|
111
|
+
/** 元素内部文本 */
|
|
112
|
+
innerText: string;
|
|
113
|
+
/** 元素描述(标签名+选择器) */
|
|
114
|
+
description?: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* 页面上下文数据
|
|
118
|
+
*/
|
|
119
|
+
export interface PageContext {
|
|
120
|
+
/** 当前页面 URL */
|
|
121
|
+
url: string;
|
|
122
|
+
/** 当前页面标题 */
|
|
123
|
+
title: string;
|
|
124
|
+
/** 选中的元素列表 */
|
|
125
|
+
selectedElements?: SelectedElement[];
|
|
126
|
+
}
|
package/lib/types.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var types_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(types_exports);
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vite-plugin-opencode-assistant/shared",
|
|
3
|
+
"version": "1.0.5",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"module": "es/index.js",
|
|
7
|
+
"types": "es/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"es",
|
|
10
|
+
"lib"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./es/index.d.ts",
|
|
15
|
+
"import": "./es/index.js",
|
|
16
|
+
"require": "./lib/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public",
|
|
21
|
+
"registry": "https://registry.npmjs.org/"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "pagoda-cli build",
|
|
25
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
26
|
+
}
|
|
27
|
+
}
|