openclaw-workflowskill 0.3.3 → 0.4.0

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 CHANGED
@@ -26,7 +26,11 @@ Requires [OpenClaw](https://openclaw.ai).
26
26
 
27
27
  ### 1. Set your profile to Coding
28
28
 
29
- In OpenClaw settings, change your profile from `messaging` (the default) to `coding`. The `coding` profile grants the agent filesystem access, which is required to read and write workflow files. For more granular access configuration, refer to the [OpenClaw documentation](https://docs.openclaw.ai/).
29
+ ```bash
30
+ openclaw config set tools.profile coding
31
+ ```
32
+
33
+ The `coding` profile grants the agent filesystem access, which is required to read and write workflow files. For more granular access configuration, refer to the [OpenClaw documentation](https://docs.openclaw.ai/).
30
34
 
31
35
  ### 2. Install the plugin
32
36
 
@@ -41,7 +45,7 @@ openclaw config set plugins.allow '["openclaw-workflowskill"]'
41
45
  openclaw config set tools.alsoAllow '["openclaw-workflowskill"]'
42
46
  ```
43
47
 
44
- The first command allowlists the plugin for loading. The second makes its tools available in all sessions (including cron).
48
+ The first command allowlists the plugin so the gateway loads it. The second makes its tools available in every session including cron jobs — so agents can invoke `workflowskill_run` to execute workflows autonomously.
45
49
 
46
50
  ### 4. Restart the gateway
47
51
 
@@ -49,6 +53,8 @@ The first command allowlists the plugin for loading. The second makes its tools
49
53
  openclaw gateway restart
50
54
  ```
51
55
 
56
+ The gateway loads plugins and config at startup. A restart is required to pick up the plugin installation and config changes from the previous steps.
57
+
52
58
  ### 5. Verify
53
59
 
54
60
  ```bash
@@ -131,7 +137,7 @@ Workflow `tool` steps are forwarded to the **OpenClaw gateway** via `POST /tools
131
137
 
132
138
  The `workflowskill_llm` tool is built-in: it calls Anthropic directly using the API key from OpenClaw's credential store, and is always available.
133
139
 
134
- The plugin's own four tools (`workflowskill_validate`, `workflowskill_run`, `workflowskill_runs`, `workflowskill_llm`) are blocked from being forwarded to the gateway to prevent infinite recursion.
140
+ Only `workflowskill_run` is blocked from gateway forwarding — it is self-referencing and would create infinite recursion. The other three plugin tools (`workflowskill_validate`, `workflowskill_runs`, `workflowskill_llm`) are leaf operations and are forwarded normally.
135
141
 
136
142
  ## Tool Reference
137
143
 
@@ -178,7 +184,7 @@ Call Anthropic directly and return the text response. Uses the API key from Open
178
184
  | `prompt` | string | yes | The prompt to send to the LLM |
179
185
  | `model` | string | no | Model alias (`haiku`, `sonnet`, `opus`) or full model ID — omit to use the default |
180
186
 
181
- Returns `{ text: string }`.
187
+ Returns the LLM response as a plain text string.
182
188
 
183
189
  ## Development
184
190
 
package/index.ts CHANGED
@@ -208,7 +208,7 @@ export default {
208
208
  registerTool({
209
209
  name: 'workflowskill_llm',
210
210
  description:
211
- 'Call the Anthropic LLM and return { text }. ' +
211
+ 'Call the Anthropic LLM and return the response as plain text. ' +
212
212
  'Uses the API key from OpenClaw\'s credential store. ' +
213
213
  'Use in workflow tool steps when you need LLM reasoning inline. ' +
214
214
  'model is optional (haiku / sonnet / opus or full model ID); omit for haiku.',
package/lib/adapters.ts CHANGED
@@ -4,18 +4,30 @@
4
4
 
5
5
  import type { ToolAdapter, ToolDescriptor, ToolResult } from 'workflowskill';
6
6
 
7
+ /** Unwrap MCP text-content envelope so workflows see actual tool output. */
8
+ function unwrapMcpContent(body: unknown): unknown {
9
+ if (body !== null && typeof body === 'object' && 'content' in body) {
10
+ const { content } = body as { content: unknown };
11
+ if (Array.isArray(content) && content.length === 1
12
+ && content[0]?.type === 'text' && typeof content[0]?.text === 'string') {
13
+ try { return JSON.parse(content[0].text); }
14
+ catch { return content[0].text; }
15
+ }
16
+ }
17
+ return body;
18
+ }
19
+
7
20
  export interface GatewayConfig {
8
21
  baseUrl: string;
9
22
  token: string;
10
23
  timeoutMs?: number;
11
24
  }
12
25
 
13
- // Tools this plugin registersmust not be forwarded to the gateway to prevent infinite recursion.
26
+ // Only workflowskill_run is truly recursive a workflow step calling it
27
+ // would launch another workflow with the same adapter, risking infinite loops.
28
+ // The other plugin tools (validate, runs, llm) are leaf operations and safe.
14
29
  const SELF_REFERENCING_TOOLS = new Set([
15
- 'workflowskill_validate',
16
30
  'workflowskill_run',
17
- 'workflowskill_runs',
18
- 'workflowskill_llm',
19
31
  ]);
20
32
 
21
33
  /** ToolAdapter that delegates to the Gateway HTTP API via POST /tools/invoke. */
@@ -62,7 +74,7 @@ export class HostToolAdapter implements ToolAdapter {
62
74
 
63
75
  if (response.status === 200) {
64
76
  const result = (await response.json()) as unknown;
65
- return { output: result };
77
+ return { output: unwrapMcpContent(result) };
66
78
  }
67
79
  if (response.status === 404) {
68
80
  return { output: null, error: `Tool '${toolName}' not found or blocked by the gateway.` };
@@ -2,7 +2,7 @@
2
2
  "id": "openclaw-workflowskill",
3
3
  "name": "WorkflowSkill",
4
4
  "description": "Author, validate, run, and review WorkflowSkill YAML workflows",
5
- "version": "0.3.3",
5
+ "version": "0.4.0",
6
6
  "skills": ["skills/workflowskill-author"],
7
7
  "configSchema": {
8
8
  "type": "object",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-workflowskill",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "description": "WorkflowSkill plugin for OpenClaw — author, validate, run, and review YAML workflows",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -35,7 +35,7 @@
35
35
  ]
36
36
  },
37
37
  "dependencies": {
38
- "workflowskill": "^0.3.2"
38
+ "workflowskill": "^0.4.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "^25.3.0",
@@ -44,7 +44,6 @@
44
44
  },
45
45
  "scripts": {
46
46
  "typecheck": "tsc --noEmit --project tsconfig.json",
47
- "reset": "bash scripts/reset.sh",
48
47
  "prepublishOnly": "tsc --noEmit --project tsconfig.json"
49
48
  }
50
49
  }
package/tools/llm.ts CHANGED
@@ -9,10 +9,6 @@ export interface LlmParams {
9
9
  model?: string;
10
10
  }
11
11
 
12
- export interface LlmResult {
13
- text: string;
14
- }
15
-
16
12
  const MODEL_ALIASES: Record<string, string> = {
17
13
  haiku: 'claude-haiku-4-5-20251001',
18
14
  sonnet: 'claude-sonnet-4-6',
@@ -73,9 +69,8 @@ async function callAnthropic(apiKey: string, model: string, prompt: string): Pro
73
69
  return data.content.find((b) => b.type === 'text')?.text ?? '';
74
70
  }
75
71
 
76
- export async function llmHandler(params: LlmParams): Promise<LlmResult> {
72
+ export async function llmHandler(params: LlmParams): Promise<string> {
77
73
  const { prompt, model = DEFAULT_MODEL } = params;
78
74
  const apiKey = readAnthropicApiKey();
79
- const text = await callAnthropic(apiKey, model, prompt);
80
- return { text };
75
+ return callAnthropic(apiKey, model, prompt);
81
76
  }