@surph_ai/cli 0.0.6 → 0.0.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/package.json +1 -1
- package/toolserver/ensure-chat.js +12 -7
package/package.json
CHANGED
|
@@ -8,11 +8,11 @@ const CLI_NODE_MODULES = path.join(__dirname, '..', 'node_modules')
|
|
|
8
8
|
const BUNDLED_FALLBACK = path.join(__dirname, 'chat.js')
|
|
9
9
|
|
|
10
10
|
const cachePaths = () => {
|
|
11
|
-
const cacheDir = path.join(process.cwd(), '
|
|
11
|
+
const cacheDir = path.join(process.cwd(), 'node_modules', '@surph_ai', 'cache')
|
|
12
12
|
return {
|
|
13
13
|
cacheDir,
|
|
14
|
-
cacheFile: path.join(cacheDir, 'chat.
|
|
15
|
-
cacheMeta: path.join(cacheDir, '
|
|
14
|
+
cacheFile: path.join(cacheDir, 'chat.js'),
|
|
15
|
+
cacheMeta: path.join(cacheDir, 'manifest.json')
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -96,11 +96,16 @@ const downloadChat = async (manifest) => {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
const { cacheDir, cacheFile, cacheMeta } = cachePaths()
|
|
99
|
-
fs.mkdirSync(cacheDir, { recursive: true
|
|
99
|
+
fs.mkdirSync(cacheDir, { recursive: true })
|
|
100
|
+
fs.writeFileSync(path.join(cacheDir, 'package.json'), JSON.stringify({
|
|
101
|
+
name: '@surph_ai/cache',
|
|
102
|
+
private: true,
|
|
103
|
+
type: 'commonjs'
|
|
104
|
+
}, null, 2) + '\n')
|
|
100
105
|
const tmp = `${cacheFile}.tmp`
|
|
101
|
-
fs.writeFileSync(tmp, buf
|
|
106
|
+
fs.writeFileSync(tmp, buf)
|
|
102
107
|
fs.renameSync(tmp, cacheFile)
|
|
103
|
-
fs.writeFileSync(cacheMeta, JSON.stringify(manifest, null, 2) + '\n'
|
|
108
|
+
fs.writeFileSync(cacheMeta, JSON.stringify(manifest, null, 2) + '\n')
|
|
104
109
|
}
|
|
105
110
|
|
|
106
111
|
const fallbackPath = () => {
|
|
@@ -134,7 +139,7 @@ const ensureChat = async ({ cliVersion, log } = {}) => {
|
|
|
134
139
|
return cacheFile
|
|
135
140
|
}
|
|
136
141
|
|
|
137
|
-
if (log) log('Downloading latest chat server...')
|
|
142
|
+
// if (log) log('Downloading latest chat server...')
|
|
138
143
|
try {
|
|
139
144
|
await downloadChat(manifest)
|
|
140
145
|
return cacheFile
|