@workclaw/openclaw-workclaw 1.0.17 → 1.0.19

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 (147) hide show
  1. package/README.md +364 -325
  2. package/dist/api.d.ts +3 -0
  3. package/dist/api.js +3 -0
  4. package/dist/index.d.ts +11 -0
  5. package/dist/index.js +263 -0
  6. package/dist/setup-entry.d.ts +2 -0
  7. package/dist/setup-entry.js +12 -0
  8. package/dist/src/accounts.d.ts +66 -0
  9. package/dist/src/accounts.js +279 -0
  10. package/dist/src/api/accounts-api.d.ts +2 -0
  11. package/dist/src/api/accounts-api.js +130 -0
  12. package/dist/src/api/prompts-api.d.ts +2 -0
  13. package/dist/src/api/prompts-api.js +103 -0
  14. package/dist/src/api/session-api.d.ts +2 -0
  15. package/dist/src/api/session-api.js +207 -0
  16. package/dist/src/api/skills-api.d.ts +2 -0
  17. package/dist/src/api/skills-api.js +64 -0
  18. package/dist/src/api/workspace.d.ts +3 -0
  19. package/dist/src/api/workspace.js +28 -0
  20. package/dist/src/channel.d.ts +11 -0
  21. package/dist/src/channel.js +198 -0
  22. package/dist/src/config-schema.d.ts +93 -0
  23. package/dist/src/config-schema.js +56 -0
  24. package/dist/src/connection/workclaw-client.d.ts +147 -0
  25. package/dist/src/connection/workclaw-client.js +351 -0
  26. package/dist/src/gateway/agent-handlers.d.ts +12 -0
  27. package/dist/src/gateway/agent-handlers.js +433 -0
  28. package/dist/src/gateway/config-writer.d.ts +71 -0
  29. package/dist/src/gateway/config-writer.js +312 -0
  30. package/dist/src/gateway/message-context.d.ts +76 -0
  31. package/dist/src/gateway/message-context.js +499 -0
  32. package/dist/src/gateway/message-dispatcher.d.ts +19 -0
  33. package/dist/src/gateway/message-dispatcher.js +512 -0
  34. package/dist/src/gateway/reconnect.d.ts +27 -0
  35. package/dist/src/gateway/reconnect.js +206 -0
  36. package/dist/src/gateway/skills-handler.d.ts +29 -0
  37. package/dist/src/gateway/skills-handler.js +576 -0
  38. package/dist/src/gateway/skills-list-handler.d.ts +27 -0
  39. package/dist/src/gateway/skills-list-handler.js +233 -0
  40. package/dist/src/gateway/tools-list-handler.d.ts +30 -0
  41. package/dist/src/gateway/tools-list-handler.js +101 -0
  42. package/dist/src/gateway/workclaw-gateway.d.ts +14 -0
  43. package/dist/src/gateway/workclaw-gateway.js +223 -0
  44. package/dist/src/media/upload.d.ts +13 -0
  45. package/dist/src/media/upload.js +125 -0
  46. package/dist/src/outbound/index.d.ts +36 -0
  47. package/dist/src/outbound/index.js +123 -0
  48. package/dist/src/outbound/workclaw-sender.d.ts +36 -0
  49. package/dist/src/outbound/workclaw-sender.js +95 -0
  50. package/dist/src/runtime.d.ts +116 -0
  51. package/dist/src/runtime.js +374 -0
  52. package/dist/src/secret-contract-api.d.ts +4 -0
  53. package/dist/src/secret-contract-api.js +4 -0
  54. package/dist/src/send.d.ts +1 -0
  55. package/dist/src/send.js +1 -0
  56. package/dist/src/setup-api.d.ts +3 -0
  57. package/dist/src/setup-api.js +3 -0
  58. package/dist/src/setup-core.d.ts +3 -0
  59. package/dist/src/setup-core.js +13 -0
  60. package/dist/src/setup-surface.d.ts +7 -0
  61. package/dist/src/setup-surface.js +363 -0
  62. package/dist/src/tools/openclaw-workclaw-cron/api/index.d.ts +93 -0
  63. package/dist/src/tools/openclaw-workclaw-cron/api/index.js +209 -0
  64. package/dist/src/tools/openclaw-workclaw-cron/index.d.ts +10 -0
  65. package/{src/tools/openclaw-workclaw-cron/index.ts → dist/src/tools/openclaw-workclaw-cron/index.js} +33 -39
  66. package/dist/src/tools/openclaw-workclaw-cron/src/add/params.d.ts +16 -0
  67. package/dist/src/tools/openclaw-workclaw-cron/src/add/params.js +152 -0
  68. package/dist/src/tools/openclaw-workclaw-cron/src/add/sync.d.ts +18 -0
  69. package/dist/src/tools/openclaw-workclaw-cron/src/add/sync.js +162 -0
  70. package/dist/src/tools/openclaw-workclaw-cron/src/disable/params.d.ts +14 -0
  71. package/dist/src/tools/openclaw-workclaw-cron/src/disable/params.js +80 -0
  72. package/dist/src/tools/openclaw-workclaw-cron/src/disable/sync.d.ts +14 -0
  73. package/dist/src/tools/openclaw-workclaw-cron/src/disable/sync.js +107 -0
  74. package/dist/src/tools/openclaw-workclaw-cron/src/enable/params.d.ts +14 -0
  75. package/dist/src/tools/openclaw-workclaw-cron/src/enable/params.js +80 -0
  76. package/dist/src/tools/openclaw-workclaw-cron/src/enable/sync.d.ts +14 -0
  77. package/dist/src/tools/openclaw-workclaw-cron/src/enable/sync.js +107 -0
  78. package/dist/src/tools/openclaw-workclaw-cron/src/notify/sync.d.ts +17 -0
  79. package/dist/src/tools/openclaw-workclaw-cron/src/notify/sync.js +127 -0
  80. package/dist/src/tools/openclaw-workclaw-cron/src/remove/params.d.ts +14 -0
  81. package/dist/src/tools/openclaw-workclaw-cron/src/remove/params.js +87 -0
  82. package/dist/src/tools/openclaw-workclaw-cron/src/remove/sync.d.ts +14 -0
  83. package/dist/src/tools/openclaw-workclaw-cron/src/remove/sync.js +107 -0
  84. package/dist/src/tools/openclaw-workclaw-cron/src/update/params.d.ts +17 -0
  85. package/dist/src/tools/openclaw-workclaw-cron/src/update/params.js +164 -0
  86. package/dist/src/tools/openclaw-workclaw-cron/src/update/sync.d.ts +18 -0
  87. package/dist/src/tools/openclaw-workclaw-cron/src/update/sync.js +135 -0
  88. package/dist/src/tools/openclaw-workclaw-cron/types/index.d.ts +52 -0
  89. package/dist/src/tools/openclaw-workclaw-cron/types/index.js +4 -0
  90. package/dist/src/tools/openclaw-workclaw-cron/utils/index.d.ts +40 -0
  91. package/dist/src/tools/openclaw-workclaw-cron/utils/index.js +122 -0
  92. package/dist/src/tools/openclaw-workclaw-system/index.d.ts +10 -0
  93. package/{src/tools/openclaw-workclaw-system/index.ts → dist/src/tools/openclaw-workclaw-system/index.js} +15 -17
  94. package/dist/src/tools/openclaw-workclaw-system/src/get/index.d.ts +8 -0
  95. package/dist/src/tools/openclaw-workclaw-system/src/get/index.js +64 -0
  96. package/dist/src/tools/openclaw-workclaw-system/src/token/index.d.ts +8 -0
  97. package/dist/src/tools/openclaw-workclaw-system/src/token/index.js +78 -0
  98. package/dist/src/types.d.ts +39 -0
  99. package/dist/src/types.js +1 -0
  100. package/dist/src/utils/content.d.ts +15 -0
  101. package/dist/src/utils/content.js +38 -0
  102. package/openclaw.plugin.json +1 -0
  103. package/package.json +62 -42
  104. package/skills/openclaw-workclaw-cron/SKILL.md +45 -28
  105. package/index.ts +0 -302
  106. package/src/accounts.ts +0 -287
  107. package/src/api/accounts-api.ts +0 -157
  108. package/src/api/prompts-api.ts +0 -123
  109. package/src/api/session-api.ts +0 -247
  110. package/src/api/skills-api.ts +0 -74
  111. package/src/api/workspace.ts +0 -43
  112. package/src/channel.ts +0 -227
  113. package/src/config-schema.ts +0 -110
  114. package/src/connection/workclaw-client.ts +0 -656
  115. package/src/gateway/agent-handlers.ts +0 -557
  116. package/src/gateway/config-writer.ts +0 -311
  117. package/src/gateway/message-context.ts +0 -422
  118. package/src/gateway/message-dispatcher.ts +0 -601
  119. package/src/gateway/reconnect.ts +0 -149
  120. package/src/gateway/skills-handler.ts +0 -805
  121. package/src/gateway/skills-list-handler.ts +0 -332
  122. package/src/gateway/tools-list-handler.ts +0 -162
  123. package/src/gateway/workclaw-gateway.ts +0 -525
  124. package/src/media/upload.ts +0 -168
  125. package/src/outbound/index.ts +0 -183
  126. package/src/outbound/workclaw-sender.ts +0 -157
  127. package/src/runtime.ts +0 -400
  128. package/src/send.ts +0 -1
  129. package/src/tools/openclaw-workclaw-cron/api/index.ts +0 -326
  130. package/src/tools/openclaw-workclaw-cron/src/add/params.ts +0 -176
  131. package/src/tools/openclaw-workclaw-cron/src/add/sync.ts +0 -188
  132. package/src/tools/openclaw-workclaw-cron/src/disable/params.ts +0 -100
  133. package/src/tools/openclaw-workclaw-cron/src/disable/sync.ts +0 -127
  134. package/src/tools/openclaw-workclaw-cron/src/enable/params.ts +0 -100
  135. package/src/tools/openclaw-workclaw-cron/src/enable/sync.ts +0 -127
  136. package/src/tools/openclaw-workclaw-cron/src/notify/sync.ts +0 -148
  137. package/src/tools/openclaw-workclaw-cron/src/remove/params.ts +0 -109
  138. package/src/tools/openclaw-workclaw-cron/src/remove/sync.ts +0 -127
  139. package/src/tools/openclaw-workclaw-cron/src/update/params.ts +0 -197
  140. package/src/tools/openclaw-workclaw-cron/src/update/sync.ts +0 -161
  141. package/src/tools/openclaw-workclaw-cron/types/index.ts +0 -55
  142. package/src/tools/openclaw-workclaw-cron/utils/index.ts +0 -141
  143. package/src/tools/openclaw-workclaw-system/src/get/index.ts +0 -77
  144. package/src/tools/openclaw-workclaw-system/src/token/index.ts +0 -93
  145. package/src/types.ts +0 -60
  146. package/src/utils/content.ts +0 -40
  147. package/tsconfig.json +0 -11
@@ -1,77 +0,0 @@
1
- /**
2
- * 智小途系统信息工具 - 获取系统配置信息
3
- */
4
-
5
- import type { OpenClawPluginApi } from 'openclaw/plugin-sdk'
6
- import { resolveOpenclawWorkclawAccount } from '../../../../accounts.js'
7
-
8
- /**
9
- * 构造工具返回结果
10
- */
11
- function json(data: unknown): any {
12
- return {
13
- content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],
14
- details: data,
15
- }
16
- }
17
-
18
- /**
19
- * 获取系统配置信息工具
20
- */
21
- function getOpenclawWorkclawSystemConfigTool(api: OpenClawPluginApi) {
22
- return (ctx: any) => {
23
- return {
24
- name: 'openclaw-workclaw-system-config',
25
- label: '智小途获取系统信息',
26
- description: '获取当前渠道的系统配置信息,包括 appKey、appSecret、agentId、userId 等',
27
- execute: async () => {
28
- api.logger.info('[智小途-系统信息] 开始获取系统配置信息')
29
-
30
- const accountId = ctx?.agentAccountId
31
- if (!accountId) {
32
- api.logger.warn('[智小途-系统信息] 无法获取账户 ID')
33
- return json({ error: '无法获取账户 ID(accountId),请确保已配置账户' })
34
- }
35
-
36
- api.logger.info(`[智小途-系统信息] accountId=${accountId}`)
37
-
38
- const accountConfig = resolveOpenclawWorkclawAccount({
39
- cfg: ctx.config,
40
- accountId,
41
- })
42
-
43
- if (!accountConfig.configured) {
44
- api.logger.error('[智小途-系统信息] 账户未配置')
45
- return json({ error: '账户未配置,请检查账户配置' })
46
- }
47
-
48
- const accConfig = accountConfig.config
49
-
50
- const result = {
51
- accountId,
52
- appKey: accConfig.appKey,
53
- appSecret: accConfig.appSecret,
54
- agentId: accConfig.agentId,
55
- userId: accConfig.userId,
56
- }
57
-
58
- api.logger.info(`[智小途-系统信息] 获取成功${JSON.stringify(result)}`)
59
-
60
- return json({
61
- code: 0,
62
- message: '系统信息获取成功',
63
- data: result,
64
- })
65
- },
66
- }
67
- }
68
- }
69
-
70
- /**
71
- * 注册获取系统配置信息工具
72
- */
73
- export function registerOpenclawWorkclawSystemConfigTool(api: OpenClawPluginApi): void {
74
- (api.registerTool as any)(getOpenclawWorkclawSystemConfigTool(api), {
75
- name: 'openclaw-workclaw-system-config',
76
- })
77
- }
@@ -1,93 +0,0 @@
1
- /**
2
- * 智小途系统信息工具 - 获取用户 AccessToken
3
- */
4
-
5
- import type { OpenClawPluginApi } from 'openclaw/plugin-sdk'
6
- import { resolveOpenclawWorkclawAccount } from '../../../../accounts.js'
7
- import { getOpenclawWorkclawAccessToken } from '../../../../connection/workclaw-client.js'
8
-
9
- /**
10
- * 构造工具返回结果
11
- */
12
- function json(data: unknown): any {
13
- return {
14
- content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],
15
- details: data,
16
- }
17
- }
18
-
19
- /**
20
- * 获取用户 AccessToken 工具
21
- */
22
- function getOpenclawWorkclawSystemTokenTool(api: OpenClawPluginApi) {
23
- return (ctx: any) => {
24
- return {
25
- name: 'openclaw-workclaw-system-token',
26
- label: '智小途获取 AccessToken',
27
- description: '获取用户的 AccessToken',
28
- execute: async () => {
29
- api.logger.info('[智小途-系统信息] 开始获取 AccessToken')
30
-
31
- const accountId = ctx?.agentAccountId
32
- if (!accountId) {
33
- api.logger.warn('[智小途-系统信息] 无法获取账户 ID')
34
- return json({ error: '无法获取账户 ID(accountId),请确保已配置账户' })
35
- }
36
-
37
- api.logger.info(`[智小途-系统信息] accountId=${accountId}`)
38
-
39
- const accountConfig = resolveOpenclawWorkclawAccount({
40
- cfg: ctx.config,
41
- accountId,
42
- })
43
-
44
- if (!accountConfig.configured) {
45
- api.logger.error('[智小途-系统信息] 账户未配置')
46
- return json({ error: '账户未配置,请检查账户配置' })
47
- }
48
-
49
- const accConfig = accountConfig.config
50
-
51
- try {
52
- const tokenCacheKey = accConfig.appKey || accountId
53
-
54
- api.logger.info(`[智小途-系统信息] 正在获取 AccessToken,accountId=${accountId}`)
55
-
56
- const accessToken = await getOpenclawWorkclawAccessToken(tokenCacheKey, {
57
- baseUrl: accConfig.baseUrl,
58
- appKey: accConfig.appKey,
59
- appSecret: accConfig.appSecret,
60
- allowInsecureTls: accConfig.allowInsecureTls,
61
- requestTimeout: accConfig.requestTimeout,
62
- })
63
-
64
- api.logger.info('[智小途-系统信息] AccessToken 获取成功')
65
-
66
- return json({
67
- code: 0,
68
- message: 'AccessToken 获取成功',
69
- data: {
70
- accessToken,
71
- },
72
- })
73
- }
74
- catch (error: any) {
75
- api.logger.error(`[智小途-系统信息] AccessToken 获取失败 ${error.message}`)
76
- return json({
77
- code: -1,
78
- error: error.message || 'AccessToken 获取失败',
79
- })
80
- }
81
- },
82
- }
83
- }
84
- }
85
-
86
- /**
87
- * 注册获取用户 AccessToken 工具
88
- */
89
- export function registerOpenclawWorkclawSystemTokenTool(api: OpenClawPluginApi): void {
90
- (api.registerTool as any)(getOpenclawWorkclawSystemTokenTool(api), {
91
- name: 'openclaw-workclaw-system-token',
92
- })
93
- }
package/src/types.ts DELETED
@@ -1,60 +0,0 @@
1
- import type {
2
- openclawWorkclawAccountConfigSchema,
3
- openclawWorkclawConfigSchema,
4
- z,
5
- } from './config-schema.js'
6
-
7
- export type OpenclawWorkclawConfig = z.infer<typeof openclawWorkclawConfigSchema>
8
- export type OpenclawWorkclawAccountConfig = z.infer<typeof openclawWorkclawAccountConfigSchema>
9
-
10
- export type OpenclawWorkclawConnectionMode = 'websocket' | 'webhook'
11
- export type WsConnectionStrategy = 'per-account' | 'per-appKey'
12
-
13
- export interface ResolvedOpenclawWorkclawAccount {
14
- accountId: string
15
- enabled: boolean
16
- configured: boolean
17
- name?: string
18
- /** Merged config (top-level defaults + account-specific overrides) */
19
- config: OpenclawWorkclawFullAccountConfig
20
- }
21
- export type ResolvedOpenClawWorkclawAccount = ResolvedOpenclawWorkclawAccount
22
-
23
- export type OpenclawWorkclawIdType = 'open_id' | 'user_id' | 'union_id' | 'chat_id'
24
-
25
- export interface OpenclawWorkclawSendResult {
26
- messageId: string
27
- chatId: string
28
- }
29
-
30
- /** WorkClaw plugin base config (shared across all accounts) */
31
- export interface WorkClawBaseConfig {
32
- baseUrl?: string
33
- websocketUrl?: string
34
- appKey?: string
35
- appSecret?: string
36
- localIp?: string
37
- allowInsecureTls?: boolean
38
- requestTimeout?: number
39
- userId?: string | number
40
- replyEndpoint?: string
41
- pushEndpoint?: string
42
- }
43
-
44
- /** Per-account WorkClaw fields */
45
- export interface WorkClawAccountConfig {
46
- agentId?: string | number
47
- userId?: string | number
48
- openConversationId?: string
49
- }
50
-
51
- export type WorkClawConfig = WorkClawBaseConfig & WorkClawAccountConfig
52
-
53
- /**
54
- * account.config is typed as OpenclawWorkclawConfig (top-level) but at runtime
55
- * also contains all OpenclawWorkclawAccountConfig fields (merged).
56
- */
57
- export type OpenclawWorkclawFullAccountConfig = OpenclawWorkclawConfig & Partial<OpenclawWorkclawAccountConfig>
58
-
59
- /** Resolved account's config - merge of top-level defaults + account overrides */
60
- export type ResolvedOpenclawWorkclawAccountConfig = OpenclawWorkclawFullAccountConfig
@@ -1,40 +0,0 @@
1
- /**
2
- * Content extraction utilities - copied from SDK's internal implementations
3
- * node_modules/openclaw/dist/plugin-sdk/thread-bindings-SYAnWHuW.js (collectTextContentBlocks)
4
- * node_modules/openclaw/dist/auth-profiles-DRjqKE3G.js (extractToolResultText)
5
- */
6
-
7
- /**
8
- * Extract text blocks from chat content array.
9
- * Handles content format: [{ type: "text", text: "..." }]
10
- */
11
- export function collectTextContentBlocks(content: unknown): string[] {
12
- if (!Array.isArray(content))
13
- return []
14
- const parts: string[] = []
15
- for (const block of content) {
16
- if (!block || typeof block !== 'object')
17
- continue
18
- const rec = block as { type?: string, text?: string }
19
- if (rec.type === 'text' && typeof rec.text === 'string')
20
- parts.push(rec.text)
21
- }
22
- return parts
23
- }
24
-
25
- /**
26
- * Extract plain text from a tool result object.
27
- * Handles result.content as array of text blocks or direct text fields.
28
- */
29
- export function extractToolResultText(result: unknown): string | undefined {
30
- if (!result || typeof result !== 'object')
31
- return
32
- const record = result as { content?: unknown }
33
- const texts = collectTextContentBlocks(record.content).map((item) => {
34
- const trimmed = item.trim()
35
- return trimmed || void 0
36
- }).filter(value => Boolean(value))
37
- if (texts.length === 0)
38
- return
39
- return texts.join('\n')
40
- }
package/tsconfig.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "rootDir": "./src",
5
- "declaration": true,
6
- "declarationMap": true,
7
- "outDir": "./dist"
8
- },
9
- "include": ["src/**/*"],
10
- "exclude": ["node_modules", "dist"]
11
- }