@2en/clawly-plugins 1.34.0-beta.0 → 1.34.0-beta.2

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/gateway/info.ts CHANGED
@@ -11,8 +11,12 @@ import type {PluginApi} from '../types'
11
11
  // @ts-expect-error — JSON import
12
12
  import pkg from '../package.json'
13
13
 
14
+ export function getInfoPayload(): {version: string} {
15
+ return {version: pkg.version}
16
+ }
17
+
14
18
  export function registerInfo(api: PluginApi) {
15
19
  api.registerGatewayMethod('clawly.info', async ({respond}) => {
16
- respond(true, {version: pkg.version})
20
+ respond(true, getInfoPayload())
17
21
  })
18
22
  }
package/http/info.ts ADDED
@@ -0,0 +1,28 @@
1
+ /**
2
+ * HTTP route for plugin package info.
3
+ *
4
+ * Route: GET /clawly/info → { version: string }
5
+ * Auth: plugin (HMAC access token or gateway Bearer token)
6
+ */
7
+
8
+ import type {IncomingMessage, ServerResponse} from 'node:http'
9
+
10
+ import {getInfoPayload} from '../gateway/info'
11
+ import {guardHttpAuth, handleCors, sendJson} from '../lib/httpAuth'
12
+ import type {PluginApi} from '../types'
13
+
14
+ export function registerInfoHttpRoute(api: PluginApi) {
15
+ api.registerHttpRoute({
16
+ path: '/clawly/info',
17
+ auth: 'plugin',
18
+ handler: async (req: IncomingMessage, res: ServerResponse) => {
19
+ const url = new URL(req.url ?? '/', `http://${req.headers.host ?? 'localhost'}`)
20
+ if (handleCors(req, res)) return
21
+ if (!guardHttpAuth(api, req, res, url)) return
22
+
23
+ sendJson(res, 200, getInfoPayload())
24
+ },
25
+ })
26
+
27
+ api.logger.info('http: registered /clawly/info route')
28
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * HTTP route for OpenClaw server version.
3
+ *
4
+ * Route: GET /clawly/version → { version: string }
5
+ * Auth: plugin (HMAC access token or gateway Bearer token)
6
+ */
7
+
8
+ import type {IncomingMessage, ServerResponse} from 'node:http'
9
+
10
+ import {getOpenClawEnvPromise} from '../lib/resolveOpenClawEnv'
11
+ import {guardHttpAuth, handleCors, sendJson} from '../lib/httpAuth'
12
+ import type {PluginApi} from '../types'
13
+
14
+ export function registerVersionHttpRoute(api: PluginApi) {
15
+ api.registerHttpRoute({
16
+ path: '/clawly/version',
17
+ auth: 'plugin',
18
+ handler: async (req: IncomingMessage, res: ServerResponse) => {
19
+ const url = new URL(req.url ?? '/', `http://${req.headers.host ?? 'localhost'}`)
20
+ if (handleCors(req, res)) return
21
+ if (!guardHttpAuth(api, req, res, url)) return
22
+
23
+ const env = await getOpenClawEnvPromise()
24
+ sendJson(res, 200, {version: env.version})
25
+ },
26
+ })
27
+
28
+ api.logger.info('http: registered /clawly/version route')
29
+ }
package/index.ts CHANGED
@@ -26,6 +26,8 @@
26
26
  *
27
27
  * HTTP routes:
28
28
  * - GET /clawly/file/outbound — serve files (hash lookup first, then direct path with allowlist)
29
+ * - GET /clawly/version — OpenClaw server version
30
+ * - GET /clawly/info — plugin package version
29
31
  *
30
32
  * Hooks:
31
33
  * - before_message_write — restores original /skill command in user messages (undoes gateway rewrite)
@@ -49,6 +51,7 @@ import {setupConfig} from './config-setup'
49
51
  import {registerCronHistory} from './cron-history'
50
52
  import {registerCronHook} from './cron-hook'
51
53
  import {registerEmail} from './email'
54
+ import {registerGitHub} from './github'
52
55
  import {registerGateway} from './gateway'
53
56
  import {getGatewayConfig} from './gateway-fetch'
54
57
  import {
@@ -56,6 +59,8 @@ import {
56
59
  registerOutboundHttpRoute,
57
60
  registerOutboundMethods,
58
61
  } from './http/file/outbound'
62
+ import {registerInfoHttpRoute} from './http/info'
63
+ import {registerVersionHttpRoute} from './http/version'
59
64
  import {registerMediaUnderstanding} from './media-understanding'
60
65
  import {registerSkillCommandRestore} from './skill-command-restore'
61
66
  import {registerTools} from './tools'
@@ -78,6 +83,8 @@ export default {
78
83
  registerOutboundHook(api)
79
84
  registerOutboundMethods(api)
80
85
  registerOutboundHttpRoute(api)
86
+ registerVersionHttpRoute(api)
87
+ registerInfoHttpRoute(api)
81
88
  registerCommands(api)
82
89
  registerTools(api)
83
90
  registerCronHook(api)
@@ -93,6 +100,7 @@ export default {
93
100
  if (gw.baseUrl && gw.token) {
94
101
  registerEmail(api, gw)
95
102
  registerCalendar(api, gw)
103
+ registerGitHub(api, gw)
96
104
  }
97
105
 
98
106
  api.logger.info(`Loaded ${api.id} plugin. (debug-instrumented build)`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2en/clawly-plugins",
3
- "version": "1.34.0-beta.0",
3
+ "version": "1.34.0-beta.2",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "repository": {