@rezti/dsh-rez-suite 0.1.5 → 0.1.7
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 +1 -1
- package/README.zh.md +1 -1
- package/lib/client.d.ts +11 -3
- package/lib/client.js +215 -161
- package/lib/index.d.ts +20 -0
- package/lib/index.js +182 -29
- package/package.json +6 -6
- package/src/client/locales.ts +23 -7
- package/src/client/panel/ConfigTab.tsx +141 -86
- package/src/client/panel/StatusTab.tsx +1 -0
- package/src/index.ts +40 -20
- package/src/observe-mcp.ts +121 -0
- package/src/protocol.ts +23 -0
- package/src/routes.ts +32 -4
- package/src/store.ts +37 -1
package/src/store.ts
CHANGED
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs'
|
|
9
9
|
import { homedir } from 'node:os'
|
|
10
10
|
import { dirname, join, resolve } from 'node:path'
|
|
11
|
+
import {
|
|
12
|
+
REZ_CREDENTIAL_REFS,
|
|
13
|
+
REZ_DEFAULT_CONNECTIONS,
|
|
14
|
+
mergeConnections,
|
|
15
|
+
secretConfigured,
|
|
16
|
+
} from '@rezti/dsh-rez-sso'
|
|
11
17
|
import type { RezConfig, RezMcpServerSpec, RezPublicConfig } from './protocol.ts'
|
|
12
18
|
|
|
13
19
|
/** File format version. */
|
|
@@ -36,13 +42,14 @@ export function expandHome(path: string): string {
|
|
|
36
42
|
return resolve(path)
|
|
37
43
|
}
|
|
38
44
|
|
|
39
|
-
/** Defaults:
|
|
45
|
+
/** Defaults: company MCP endpoints. Secrets live in credentials.yaml / env. */
|
|
40
46
|
export function defaultConfig(): RezConfig {
|
|
41
47
|
return {
|
|
42
48
|
enabled: true,
|
|
43
49
|
announceToAgent: true,
|
|
44
50
|
role: 'all',
|
|
45
51
|
servers: {},
|
|
52
|
+
connections: JSON.parse(JSON.stringify(REZ_DEFAULT_CONNECTIONS)) as RezConfig['connections'],
|
|
46
53
|
billing: {
|
|
47
54
|
inputCostPer1k: 0.001,
|
|
48
55
|
outputCostPer1k: 0.002,
|
|
@@ -74,10 +81,37 @@ export function publicConfig(config: RezConfig): RezPublicConfig {
|
|
|
74
81
|
for (const [id, server] of Object.entries(config.servers)) {
|
|
75
82
|
servers[id] = maskServer(server)
|
|
76
83
|
}
|
|
84
|
+
const connections = mergeConnections(config.connections)
|
|
77
85
|
return {
|
|
78
86
|
enabled: config.enabled,
|
|
79
87
|
role: config.role,
|
|
80
88
|
servers,
|
|
89
|
+
connections: {
|
|
90
|
+
odoo: {
|
|
91
|
+
enabled: connections.odoo.enabled,
|
|
92
|
+
url: connections.odoo.url,
|
|
93
|
+
secretConfigured: secretConfigured('odoo'),
|
|
94
|
+
secretRef: REZ_CREDENTIAL_REFS.odoo,
|
|
95
|
+
},
|
|
96
|
+
nextcloud: {
|
|
97
|
+
enabled: connections.nextcloud.enabled,
|
|
98
|
+
url: connections.nextcloud.url,
|
|
99
|
+
username: connections.nextcloud.username,
|
|
100
|
+
secretConfigured: secretConfigured('nextcloud'),
|
|
101
|
+
secretRef: REZ_CREDENTIAL_REFS.nextcloud,
|
|
102
|
+
},
|
|
103
|
+
wechat: {
|
|
104
|
+
enabled: connections.wechat.enabled,
|
|
105
|
+
secretConfigured: secretConfigured('wechat'),
|
|
106
|
+
secretRef: REZ_CREDENTIAL_REFS.wechat,
|
|
107
|
+
},
|
|
108
|
+
homeassistant: {
|
|
109
|
+
enabled: connections.homeassistant.enabled,
|
|
110
|
+
url: connections.homeassistant.url,
|
|
111
|
+
secretConfigured: secretConfigured('homeassistant'),
|
|
112
|
+
secretRef: REZ_CREDENTIAL_REFS.homeassistant,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
81
115
|
billing: { ...config.billing },
|
|
82
116
|
}
|
|
83
117
|
}
|
|
@@ -96,6 +130,8 @@ export function mergeConfig(base: RezConfig, override: unknown): RezConfig {
|
|
|
96
130
|
if (typeof value.announceToAgent === 'boolean') result.announceToAgent = value.announceToAgent
|
|
97
131
|
if (value.role === 'engineer' || value.role === 'sales' || value.role === 'operations' || value.role === 'all') result.role = value.role
|
|
98
132
|
|
|
133
|
+
result.connections = mergeConnections(value.connections ?? result.connections)
|
|
134
|
+
|
|
99
135
|
if (typeof value.servers === 'object' && value.servers !== null) {
|
|
100
136
|
for (const [id, raw] of Object.entries(value.servers as Record<string, unknown>)) {
|
|
101
137
|
if (typeof raw !== 'object' || raw === null) continue
|