@kodelyth/lobster 2026.5.39 → 2026.5.42
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 +74 -0
- package/SKILL.md +97 -0
- package/dist/index.js +654 -0
- package/dist/runtime-api.js +3 -0
- package/index.ts +24 -0
- package/klaw.plugin.json +1 -3
- package/package.json +2 -2
- package/runtime-api.ts +12 -0
- package/src/lobster-ajv-cache.ts +142 -0
- package/src/lobster-core.d.ts +60 -0
- package/src/lobster-runner.test.ts +597 -0
- package/src/lobster-runner.ts +395 -0
- package/src/lobster-taskflow.test.ts +227 -0
- package/src/lobster-taskflow.ts +279 -0
- package/src/lobster-tool.test.ts +352 -0
- package/src/lobster-tool.ts +320 -0
- package/src/taskflow-test-helpers.ts +48 -0
- package/tsconfig.json +16 -0
- package/index.js +0 -7
- package/runtime-api.js +0 -7
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Lobster (plugin)
|
|
2
|
+
|
|
3
|
+
Adds the `lobster` agent tool as an **optional** plugin tool.
|
|
4
|
+
|
|
5
|
+
## What this is
|
|
6
|
+
|
|
7
|
+
- Lobster is a standalone workflow shell (typed JSON-first pipelines + approvals/resume).
|
|
8
|
+
- This plugin integrates Lobster with Klaw _without core changes_.
|
|
9
|
+
|
|
10
|
+
## Enable
|
|
11
|
+
|
|
12
|
+
Because this tool can trigger side effects (via workflows), it is registered with `optional: true`.
|
|
13
|
+
|
|
14
|
+
Enable it in an agent allowlist:
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"agents": {
|
|
19
|
+
"list": [
|
|
20
|
+
{
|
|
21
|
+
"id": "main",
|
|
22
|
+
"tools": {
|
|
23
|
+
"allow": [
|
|
24
|
+
"lobster" // plugin id (enables all tools from this plugin)
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Using `klaw.invoke` (Lobster → Klaw tools)
|
|
34
|
+
|
|
35
|
+
Some Lobster pipelines may include a `klaw.invoke` step to call back into Klaw tools/plugins (for example: `gog` for Google Workspace, `gh` for GitHub, `message.send`, etc.).
|
|
36
|
+
|
|
37
|
+
For this to work, the Klaw Gateway must expose the tool bridge endpoint and the target tool must be allowed by policy:
|
|
38
|
+
|
|
39
|
+
- Klaw provides an HTTP endpoint: `POST /tools/invoke`.
|
|
40
|
+
- The request is gated by **gateway auth** (e.g. `Authorization: Bearer …` when token auth is enabled).
|
|
41
|
+
- The invoked tool is gated by **tool policy** (global + per-agent + provider + group policy). If the tool is not allowed, Klaw returns `404 Tool not available`.
|
|
42
|
+
|
|
43
|
+
### Allowlisting recommended
|
|
44
|
+
|
|
45
|
+
To avoid letting workflows call arbitrary tools, set a tight allowlist on the agent that will be used by `klaw.invoke`.
|
|
46
|
+
|
|
47
|
+
Example (allow only a small set of tools):
|
|
48
|
+
|
|
49
|
+
```jsonc
|
|
50
|
+
{
|
|
51
|
+
"agents": {
|
|
52
|
+
"list": [
|
|
53
|
+
{
|
|
54
|
+
"id": "main",
|
|
55
|
+
"tools": {
|
|
56
|
+
"allow": ["lobster", "web_fetch", "web_search", "gog", "gh"],
|
|
57
|
+
"deny": ["gateway"],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Notes:
|
|
66
|
+
|
|
67
|
+
- If `tools.allow` is omitted or empty, it behaves like "allow everything (except denied)". For a real allowlist, set a **non-empty** `allow`.
|
|
68
|
+
- Tool names depend on which plugins you have installed/enabled.
|
|
69
|
+
|
|
70
|
+
## Security
|
|
71
|
+
|
|
72
|
+
- Runs Lobster in process via the published `@clawdbot/lobster/core` runtime.
|
|
73
|
+
- Does not manage OAuth/tokens.
|
|
74
|
+
- Uses timeouts, stdout caps, and strict JSON envelope parsing.
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Lobster
|
|
2
|
+
|
|
3
|
+
Lobster executes multi-step workflows with approval checkpoints. Use it when:
|
|
4
|
+
|
|
5
|
+
- User wants a repeatable automation (triage, monitor, sync)
|
|
6
|
+
- Actions need human approval before executing (send, post, delete)
|
|
7
|
+
- Multiple tool calls should run as one deterministic operation
|
|
8
|
+
|
|
9
|
+
## When to use Lobster
|
|
10
|
+
|
|
11
|
+
| User intent | Use Lobster? |
|
|
12
|
+
| ------------------------------------------------------ | --------------------------------------------- |
|
|
13
|
+
| "Triage my email" | Yes — multi-step, may send replies |
|
|
14
|
+
| "Send a message" | No — single action, use message tool directly |
|
|
15
|
+
| "Check my email every morning and ask before replying" | Yes — scheduled workflow with approval |
|
|
16
|
+
| "What's the weather?" | No — simple query |
|
|
17
|
+
| "Monitor this PR and notify me of changes" | Yes — stateful, recurring |
|
|
18
|
+
|
|
19
|
+
## Basic usage
|
|
20
|
+
|
|
21
|
+
### Run a pipeline
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"action": "run",
|
|
26
|
+
"pipeline": "gog.gmail.search --query 'newer_than:1d' --max 20 | email.triage"
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Returns structured result:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"protocolVersion": 1,
|
|
35
|
+
"ok": true,
|
|
36
|
+
"status": "ok",
|
|
37
|
+
"output": [{ "summary": {...}, "items": [...] }],
|
|
38
|
+
"requiresApproval": null
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Handle approval
|
|
43
|
+
|
|
44
|
+
If the workflow needs approval:
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"status": "needs_approval",
|
|
49
|
+
"output": [],
|
|
50
|
+
"requiresApproval": {
|
|
51
|
+
"prompt": "Send 3 draft replies?",
|
|
52
|
+
"items": [...],
|
|
53
|
+
"resumeToken": "..."
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Present the prompt to the user. If they approve:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"action": "resume",
|
|
63
|
+
"token": "<resumeToken>",
|
|
64
|
+
"approve": true
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Example workflows
|
|
69
|
+
|
|
70
|
+
### Email triage
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
gog.gmail.search --query 'newer_than:1d' --max 20 | email.triage
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Fetches recent emails, classifies into buckets (needs_reply, needs_action, fyi).
|
|
77
|
+
|
|
78
|
+
### Email triage with approval gate
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
gog.gmail.search --query 'newer_than:1d' | email.triage | approve --prompt 'Process these?'
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Same as above, but halts for approval before returning.
|
|
85
|
+
|
|
86
|
+
## Key behaviors
|
|
87
|
+
|
|
88
|
+
- **Deterministic**: Same input → same output (no LLM variance in pipeline execution)
|
|
89
|
+
- **Approval gates**: `approve` command halts execution, returns token
|
|
90
|
+
- **Resumable**: Use `resume` action with token to continue
|
|
91
|
+
- **Structured output**: Always returns JSON envelope with `protocolVersion`
|
|
92
|
+
|
|
93
|
+
## Don't use Lobster for
|
|
94
|
+
|
|
95
|
+
- Simple single-action requests (just use the tool directly)
|
|
96
|
+
- Queries that need LLM interpretation mid-flow
|
|
97
|
+
- One-off tasks that won't be repeated
|