@longzai-intelligence-local-server/core 0.0.0-stage → 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/README.md +12 -2
- package/dist/index.d.ts +108 -0
- package/dist/index.js +1 -0
- package/dist/rolldown-runtime-BqT_7tdF.js +1 -0
- package/package.json +48 -4
package/README.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @longzai-intelligence-local-server/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
桌面本地服务 IPC 契约核心包。承载四通道名常量、zod schema 与推断类型,main 与 preload 与 renderer 与服务端四端均可引入,运行时依赖仅 `zod`。
|
|
4
|
+
|
|
5
|
+
## 导出面
|
|
6
|
+
|
|
7
|
+
- 通道常量:`LOCAL_SERVER_CHANNELS` 及 `LOCAL_SERVER_GET_STATUS`、`LOCAL_SERVER_START`、`LOCAL_SERVER_STOP`、`LOCAL_SERVER_GET_URL` 四单项
|
|
8
|
+
- zod schema:`serverStatusSchema`、`serverResultSchema`、`serverUrlSchema` 与四个空参数 schema
|
|
9
|
+
- 类型:`ServerStatus`、`ServerResult`、`ServerUrl`、`LocalServerIPCAPI`
|
|
10
|
+
|
|
11
|
+
## 契约边界
|
|
12
|
+
|
|
13
|
+
通道名继承产品群桌面族存量契约的短横线形态,如 `local-server:get-status`,作为零成本切换边界不得变更。`LocalServerIPCAPI` 以类型形态引用 electron 仓 core 包的 `IPCMethodDefinition`,构建期擦除,不带入任何运行时依赖。
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import "./rolldown-runtime-BqT_7tdF.js";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
import { IPCMethodDefinition } from "@longzai-intelligence-electron/core";
|
|
4
|
+
/**
|
|
5
|
+
* 本地服务 IPC 通道常量
|
|
6
|
+
*
|
|
7
|
+
* 通道名继承自产品群桌面族存量契约即 `local-server:get-status` 等短横线形态,
|
|
8
|
+
* 作为零成本切换边界保持不变,新增取址通道一处
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* 获取服务器状态通道
|
|
12
|
+
*/
|
|
13
|
+
declare const LOCAL_SERVER_GET_STATUS: 'local-server:get-status';
|
|
14
|
+
/**
|
|
15
|
+
* 启动本地服务器通道
|
|
16
|
+
*/
|
|
17
|
+
declare const LOCAL_SERVER_START: 'local-server:start';
|
|
18
|
+
/**
|
|
19
|
+
* 停止本地服务器通道
|
|
20
|
+
*/
|
|
21
|
+
declare const LOCAL_SERVER_STOP: 'local-server:stop';
|
|
22
|
+
/**
|
|
23
|
+
* 获取本地服务真实基址通道
|
|
24
|
+
*
|
|
25
|
+
* 渲染层经此通道取监听零口后的真实地址,替代硬编码本机端口
|
|
26
|
+
*/
|
|
27
|
+
declare const LOCAL_SERVER_GET_URL: 'local-server:get-url';
|
|
28
|
+
/**
|
|
29
|
+
* 本地服务通道常量集合
|
|
30
|
+
*/
|
|
31
|
+
declare const LOCAL_SERVER_CHANNELS: {
|
|
32
|
+
readonly GET_STATUS: "local-server:get-status";
|
|
33
|
+
readonly START: "local-server:start";
|
|
34
|
+
readonly STOP: "local-server:stop";
|
|
35
|
+
readonly GET_URL: "local-server:get-url";
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* 服务器状态 schema
|
|
39
|
+
*/
|
|
40
|
+
declare const serverStatusSchema: z.ZodEnum<{
|
|
41
|
+
error: "error";
|
|
42
|
+
running: "running";
|
|
43
|
+
starting: "starting";
|
|
44
|
+
stopped: "stopped";
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* 启停结果 schema
|
|
48
|
+
*/
|
|
49
|
+
declare const serverResultSchema: z.ZodObject<{
|
|
50
|
+
success: z.ZodBoolean;
|
|
51
|
+
error: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
/**
|
|
54
|
+
* 本地服务基址 schema,服务未就绪时为 null
|
|
55
|
+
*/
|
|
56
|
+
declare const serverUrlSchema: z.ZodNullable<z.ZodString>;
|
|
57
|
+
/**
|
|
58
|
+
* 状态查询参数 schema
|
|
59
|
+
*/
|
|
60
|
+
declare const serverStatusParamsSchema: z.ZodReadonly<z.ZodObject<{}, z.core.$strip>>;
|
|
61
|
+
/**
|
|
62
|
+
* 启动参数 schema
|
|
63
|
+
*/
|
|
64
|
+
declare const startServerParamsSchema: z.ZodReadonly<z.ZodObject<{}, z.core.$strip>>;
|
|
65
|
+
/**
|
|
66
|
+
* 停止参数 schema
|
|
67
|
+
*/
|
|
68
|
+
declare const stopServerParamsSchema: z.ZodReadonly<z.ZodObject<{}, z.core.$strip>>;
|
|
69
|
+
/**
|
|
70
|
+
* 取址参数 schema
|
|
71
|
+
*/
|
|
72
|
+
declare const getServerUrlParamsSchema: z.ZodReadonly<z.ZodObject<{}, z.core.$strip>>;
|
|
73
|
+
/**
|
|
74
|
+
* 服务器状态
|
|
75
|
+
*/
|
|
76
|
+
type ServerStatus = z.infer<typeof serverStatusSchema>;
|
|
77
|
+
/**
|
|
78
|
+
* 启停结果
|
|
79
|
+
*/
|
|
80
|
+
type ServerResult = z.infer<typeof serverResultSchema>;
|
|
81
|
+
/**
|
|
82
|
+
* 本地服务基址,服务未就绪时为 null
|
|
83
|
+
*/
|
|
84
|
+
type ServerUrl = z.infer<typeof serverUrlSchema>;
|
|
85
|
+
/**
|
|
86
|
+
* 本地服务 IPC API 定义
|
|
87
|
+
*
|
|
88
|
+
* 方法名与通道常量的映射见 preload 入口的组装助手
|
|
89
|
+
*/
|
|
90
|
+
type LocalServerIPCAPI = {
|
|
91
|
+
/**
|
|
92
|
+
* 查询服务器状态
|
|
93
|
+
*/
|
|
94
|
+
getStatus: IPCMethodDefinition<readonly [], ServerStatus>;
|
|
95
|
+
/**
|
|
96
|
+
* 启动本地服务器
|
|
97
|
+
*/
|
|
98
|
+
start: IPCMethodDefinition<readonly [], ServerResult>;
|
|
99
|
+
/**
|
|
100
|
+
* 停止本地服务器
|
|
101
|
+
*/
|
|
102
|
+
stop: IPCMethodDefinition<readonly [], ServerResult>;
|
|
103
|
+
/**
|
|
104
|
+
* 获取本地服务真实基址
|
|
105
|
+
*/
|
|
106
|
+
getUrl: IPCMethodDefinition<readonly [], ServerUrl>;
|
|
107
|
+
};
|
|
108
|
+
export { LOCAL_SERVER_CHANNELS, LOCAL_SERVER_GET_STATUS, LOCAL_SERVER_GET_URL, LOCAL_SERVER_START, LOCAL_SERVER_STOP, type LocalServerIPCAPI, type ServerResult, type ServerStatus, type ServerUrl, getServerUrlParamsSchema, serverResultSchema, serverStatusParamsSchema, serverStatusSchema, serverUrlSchema, startServerParamsSchema, stopServerParamsSchema };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";import*as e from"zod";const t=`local-server:get-status`,n=`local-server:start`,r=`local-server:stop`,i=`local-server:get-url`,a={GET_STATUS:t,START:n,STOP:r,GET_URL:i},o=e.enum([`running`,`stopped`,`starting`,`error`]),s=e.object({success:e.boolean(),error:e.string().optional()}),c=e.string().nullable(),l=e.object({}).readonly(),u=e.object({}).readonly(),d=e.object({}).readonly(),f=e.object({}).readonly();export{a as LOCAL_SERVER_CHANNELS,t as LOCAL_SERVER_GET_STATUS,i as LOCAL_SERVER_GET_URL,n as LOCAL_SERVER_START,r as LOCAL_SERVER_STOP,f as getServerUrlParamsSchema,s as serverResultSchema,l as serverStatusParamsSchema,o as serverStatusSchema,c as serverUrlSchema,u as startServerParamsSchema,d as stopServerParamsSchema};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"node:module";export{};
|
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longzai-intelligence-local-server/core",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Longzai Intelligence 桌面本地服务通道常量与 zod 契约核心包",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"core",
|
|
7
|
+
"desktop",
|
|
8
|
+
"ipc",
|
|
9
|
+
"local-server",
|
|
10
|
+
"longzai-intelligence",
|
|
11
|
+
"zod"
|
|
12
|
+
],
|
|
13
|
+
"license": "UNLICENSED",
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"type": "module",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "lzi-builder",
|
|
26
|
+
"build:prod": "NODE_ENV=production bun run build",
|
|
27
|
+
"prepublishOnly": "bun run build:prod",
|
|
28
|
+
"dev": "lzi-builder --watch",
|
|
29
|
+
"clean": "lzi-dev-tools clean",
|
|
30
|
+
"test": "vitest run",
|
|
31
|
+
"test:watch": "vitest",
|
|
32
|
+
"test:coverage": "vitest run --coverage",
|
|
33
|
+
"lint": "lzi-lint lint",
|
|
34
|
+
"lint:fix": "lzi-lint fix",
|
|
35
|
+
"typecheck": "bun run typecheck:app && bun run typecheck:node && bun run typecheck:test",
|
|
36
|
+
"typecheck:app": "lzi-tsgo typecheck tsconfig/app.json",
|
|
37
|
+
"typecheck:node": "lzi-tsgo typecheck tsconfig/node.json",
|
|
38
|
+
"typecheck:test": "lzi-tsgo typecheck tsconfig/test.json"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"zod": "^4.4.3"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@longzai-intelligence-electron/core": "^0.0.4",
|
|
45
|
+
"@longzai-intelligence-testing/utils": "^0.0.3",
|
|
46
|
+
"@longzai-intelligence-vitest/config": "^0.0.12",
|
|
47
|
+
"vitest": "^4.1.4"
|
|
48
|
+
},
|
|
49
|
+
"packageManager": "bun@1.4.3"
|
|
50
|
+
}
|