@super-pocock-ai/suite 2.0.12 → 2.0.18

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.
Files changed (2) hide show
  1. package/index.js +102 -0
  2. package/package.json +5 -5
package/index.js CHANGED
@@ -37,6 +37,62 @@ export const SuperPocockSuite = async ({ project, client, $, directory, worktree
37
37
  }
38
38
  }
39
39
 
40
+ // Helper: remove directory recursively
41
+ const removeDir = (dir) => {
42
+ if (existsSync(dir)) {
43
+ for (const item of readdirSync(dir)) {
44
+ const itemPath = join(dir, item)
45
+ if (statSync(itemPath).isDirectory()) {
46
+ removeDir(itemPath)
47
+ } else {
48
+ require('fs').unlinkSync(itemPath)
49
+ }
50
+ }
51
+ require('fs').rmdirSync(dir)
52
+ }
53
+ }
54
+
55
+ // Check cache version and clear if outdated
56
+ const checkCacheVersion = async () => {
57
+ const cacheSuitePackageJson = join(cacheDir, 'suite', 'package.json')
58
+ if (existsSync(cacheSuitePackageJson)) {
59
+ const cached = JSON.parse(readFileSync(cacheSuitePackageJson, 'utf-8'))
60
+ if (cached.version !== SUITE_VERSION) {
61
+ await client.app.log({
62
+ body: {
63
+ service: 'super-pocock-suite',
64
+ level: 'info',
65
+ message: `Cache outdated (v${cached.version}), clearing...`
66
+ }
67
+ })
68
+
69
+ // Clear outdated cache
70
+ const cachePackagesDir = join(process.env.HOME, '.cache', 'opencode', 'packages', '@super-pocock-ai')
71
+ if (existsSync(cachePackagesDir)) {
72
+ removeDir(cachePackagesDir)
73
+ }
74
+
75
+ // Clear config dependencies to force reinstall
76
+ const configPackagesDir = join(configDir, '@super-pocock-ai')
77
+ if (existsSync(configPackagesDir)) {
78
+ removeDir(configPackagesDir)
79
+ }
80
+
81
+ // Trigger reinstall by running npm update
82
+ try {
83
+ execSync('npm update @super-pocock-ai/suite', {
84
+ cwd: join(process.env.HOME, '.config', 'opencode'),
85
+ stdio: 'pipe'
86
+ })
87
+ } catch (e) {
88
+ // Ignore errors, will be handled by checkAndUpdate
89
+ }
90
+ }
91
+ }
92
+ }
93
+
94
+ await checkCacheVersion()
95
+
40
96
  // Ensure dependencies are copied from cache to config
41
97
  const ensureDependencies = async () => {
42
98
  const packages = ['suite', 'compose-agents', 'compose-workflow', 'memory-agents', 'memory-core']
@@ -180,6 +236,31 @@ export const SuperPocockSuite = async ({ project, client, $, directory, worktree
180
236
  const composeSkillsDir = join(configDir, '@super-pocock-ai', 'compose-workflow', 'skills', 'compose')
181
237
  await installSkills(composeSkillsDir, 'compose')
182
238
 
239
+ // Initialize memory-core plugin
240
+ let memoryPlugin = null
241
+ try {
242
+ const memoryCorePath = join(configDir, '@super-pocock-ai', 'memory-core', 'dist', 'index.mjs')
243
+ if (existsSync(memoryCorePath)) {
244
+ const { MemoryCorePlugin } = await import(memoryCorePath)
245
+ memoryPlugin = await MemoryCorePlugin({ project, client, $, directory, worktree })
246
+ await client.app.log({
247
+ body: {
248
+ service: 'super-pocock-suite',
249
+ level: 'info',
250
+ message: 'Memory system initialized'
251
+ }
252
+ })
253
+ }
254
+ } catch (e) {
255
+ await client.app.log({
256
+ body: {
257
+ service: 'super-pocock-suite',
258
+ level: 'warn',
259
+ message: `Memory system initialization failed: ${e.message}`
260
+ }
261
+ })
262
+ }
263
+
183
264
  return {
184
265
  "session.created": async ({ event }) => {
185
266
  await client.app.log({
@@ -189,6 +270,27 @@ export const SuperPocockSuite = async ({ project, client, $, directory, worktree
189
270
  message: `Superpocock Suite v${SUITE_VERSION} loaded`
190
271
  }
191
272
  })
273
+ // Forward to memory plugin
274
+ if (memoryPlugin?.event) {
275
+ await memoryPlugin.event({ event })
276
+ }
277
+ },
278
+ "event": async (input) => {
279
+ // Forward all events to memory plugin
280
+ if (memoryPlugin?.event) {
281
+ await memoryPlugin.event(input)
282
+ }
283
+ },
284
+ "tool": memoryPlugin?.tool || {},
285
+ "experimental.chat.system.transform": async (input, output) => {
286
+ if (memoryPlugin?.["experimental.chat.system.transform"]) {
287
+ await memoryPlugin["experimental.chat.system.transform"](input, output)
288
+ }
289
+ },
290
+ "experimental.session.compacting": async (input, output) => {
291
+ if (memoryPlugin?.["experimental.session.compacting"]) {
292
+ await memoryPlugin["experimental.session.compacting"](input, output)
293
+ }
192
294
  }
193
295
  }
194
296
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@super-pocock-ai/suite",
3
- "version": "2.0.12",
3
+ "version": "2.0.18",
4
4
  "description": "Superpocock 完整套件,包含记忆系统和工作流",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -13,10 +13,10 @@
13
13
  "postinstall": "node postinstall.js"
14
14
  },
15
15
  "dependencies": {
16
- "@super-pocock-ai/memory-core": "2.0.12",
17
- "@super-pocock-ai/memory-agents": "2.0.12",
18
- "@super-pocock-ai/compose-workflow": "2.0.12",
19
- "@super-pocock-ai/compose-agents": "2.0.12"
16
+ "@super-pocock-ai/memory-core": "2.0.18",
17
+ "@super-pocock-ai/memory-agents": "2.0.18",
18
+ "@super-pocock-ai/compose-workflow": "2.0.18",
19
+ "@super-pocock-ai/compose-agents": "2.0.18"
20
20
  },
21
21
  "keywords": [
22
22
  "opencode",