@wakeshift/openclaw 0.0.0-stage → 1.4.24
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/LICENSE +202 -0
- package/README.md +55 -2
- package/dist/beacon.js +287 -0
- package/dist/control.js +150 -0
- package/dist/deliveries.js +507 -0
- package/dist/framing.js +200 -0
- package/dist/hooks.js +249 -0
- package/dist/index.js +287 -0
- package/dist/plugin.js +523 -0
- package/dist/reset.js +95 -0
- package/dist/store.js +202 -0
- package/dist/transport.js +474 -0
- package/dist/version.js +12 -0
- package/dist/wake.js +66 -0
- package/openclaw.plugin.json +42 -0
- package/package.json +43 -4
package/dist/wake.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Waking a conversation: one POST to the gateway's own <hooks.path>/agent
|
|
2
|
+
// (OpenClaw 2026.10.4, docs/gateway/config-hooks.md), persistent, into the
|
|
3
|
+
// conversation's session, waiting for the run to finish. OpenClaw wraps
|
|
4
|
+
// the message as outside content; ours is framed as outside data too
|
|
5
|
+
// (framing.ts).
|
|
6
|
+
/** The JSON body for POST <hooks.path>/agent. */
|
|
7
|
+
export function wakeBody(r) {
|
|
8
|
+
const body = {
|
|
9
|
+
message: r.message,
|
|
10
|
+
name: "Wakeshift",
|
|
11
|
+
sessionKey: r.sessionKey,
|
|
12
|
+
sessionMode: "persistent",
|
|
13
|
+
waitForCompletion: true,
|
|
14
|
+
};
|
|
15
|
+
if (r.agentId)
|
|
16
|
+
body.agentId = r.agentId;
|
|
17
|
+
if (r.route) {
|
|
18
|
+
body.channel = r.route.channel;
|
|
19
|
+
body.to = r.route.to;
|
|
20
|
+
if (r.route.accountId)
|
|
21
|
+
body.accountId = r.route.accountId;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
// No channel to answer on (a TUI or CLI session): the reply stays in
|
|
25
|
+
// the session's transcript, with no announcement in the main session.
|
|
26
|
+
body.deliver = false;
|
|
27
|
+
}
|
|
28
|
+
return body;
|
|
29
|
+
}
|
|
30
|
+
/** What an answer from OpenClaw means (status 0: the gateway couldn't be reached). */
|
|
31
|
+
export function wakeResult(status, body, routed) {
|
|
32
|
+
const b = (body && typeof body === "object" ? body : {});
|
|
33
|
+
const err = typeof b.error === "string" ? b.error : typeof body === "string" ? body.slice(0, 200) : "";
|
|
34
|
+
if (status === 200) {
|
|
35
|
+
const s = b.completion?.status;
|
|
36
|
+
if (s === undefined || s === "ok")
|
|
37
|
+
return { kind: "ran" };
|
|
38
|
+
return { kind: "retry", fresh: true, why: `the woken turn ended ${String(s)}` };
|
|
39
|
+
}
|
|
40
|
+
switch (status) {
|
|
41
|
+
case 0:
|
|
42
|
+
return { kind: "broken", why: "the OpenClaw gateway's hooks endpoint couldn't be reached on this computer" };
|
|
43
|
+
case 401:
|
|
44
|
+
return { kind: "broken", why: "OpenClaw refused the hooks token (401): hooks.token changed since Wakeshift's plugin set it up" };
|
|
45
|
+
case 404:
|
|
46
|
+
return { kind: "broken", why: "OpenClaw's hooks endpoint isn't on (404): hooks.enabled is false, or hooks.path changed" };
|
|
47
|
+
case 400:
|
|
48
|
+
if (routed)
|
|
49
|
+
return { kind: "route", why: err || "the reply's channel was refused" };
|
|
50
|
+
return { kind: "broken", why: `OpenClaw refused the wake (400${err ? `: ${err}` : ""})` };
|
|
51
|
+
case 409:
|
|
52
|
+
case 408:
|
|
53
|
+
case 429:
|
|
54
|
+
case 502:
|
|
55
|
+
case 503:
|
|
56
|
+
// Busy, restarting, or throttled: nothing ran, or the replay key covers it.
|
|
57
|
+
return { kind: "retry", fresh: false, why: `OpenClaw answered ${status}${err ? ` (${err})` : ""}` };
|
|
58
|
+
}
|
|
59
|
+
return { kind: "retry", fresh: false, why: `OpenClaw answered ${status}` };
|
|
60
|
+
}
|
|
61
|
+
/** hooks.path as OpenClaw normalizes it: a leading slash, no trailing ones. */
|
|
62
|
+
export function hooksPath(p) {
|
|
63
|
+
const s = typeof p === "string" && p.trim() ? p.trim() : "/hooks";
|
|
64
|
+
const out = ("/" + s.replace(/^\/+/, "")).replace(/\/+$/, "");
|
|
65
|
+
return out === "" ? "/hooks" : out;
|
|
66
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "wakeshift",
|
|
3
|
+
"name": "Wakeshift",
|
|
4
|
+
"description": "Wakes OpenClaw sessions when an app they watch through Wakeshift sends something. Messages arrive as outside information, never as the user.",
|
|
5
|
+
"categories": [
|
|
6
|
+
"integrations"
|
|
7
|
+
],
|
|
8
|
+
"contracts": {
|
|
9
|
+
"agentToolResultMiddleware": [
|
|
10
|
+
"openclaw",
|
|
11
|
+
"codex"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"activation": {
|
|
15
|
+
"onStartup": true
|
|
16
|
+
},
|
|
17
|
+
"cliCommands": [
|
|
18
|
+
{
|
|
19
|
+
"name": "wakeshift",
|
|
20
|
+
"description": "Wakeshift's plugin: undo what it turned on (reset)",
|
|
21
|
+
"hasSubcommands": true
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"configSchema": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"additionalProperties": false,
|
|
27
|
+
"properties": {
|
|
28
|
+
"issuer": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "The Wakeshift whose beacons the plugin trusts. Unset: Wakeshift's own service, https://app.wakeshift.ai; the install command for another Wakeshift sets it."
|
|
31
|
+
},
|
|
32
|
+
"allowNetworkHooks": {
|
|
33
|
+
"type": "boolean",
|
|
34
|
+
"description": "The user agreed to OpenClaw's hooks endpoint while the gateway listens beyond this computer (its bind isn't loopback): the hooks share its listener. Without it the plugin doesn't turn hooks on there. The install command sets it after the user's yes; openclaw wakeshift reset removes it."
|
|
35
|
+
},
|
|
36
|
+
"heartbeatTarget": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"description": "Unused: from the earlier heartbeat wake. A woken turn's reply now goes to the channel the conversation last spoke on."
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wakeshift/openclaw",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.4.24",
|
|
4
|
+
"description": "Wakeshift for OpenClaw: wakes an OpenClaw session when an app it watches through Wakeshift sends something.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/wakeshift/connectors.git",
|
|
9
|
+
"directory": "plugins/openclaw"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://wakeshift.ai/docs/agents",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/wakeshift/connectors/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"openclaw",
|
|
17
|
+
"openclaw-plugin",
|
|
18
|
+
"wakeshift"
|
|
19
|
+
],
|
|
20
|
+
"type": "module",
|
|
21
|
+
"main": "./dist/index.js",
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"openclaw.plugin.json"
|
|
25
|
+
],
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=22"
|
|
28
|
+
},
|
|
29
|
+
"openclaw": {
|
|
30
|
+
"extensions": [
|
|
31
|
+
"./dist/index.js"
|
|
32
|
+
],
|
|
33
|
+
"compat": {
|
|
34
|
+
"pluginApi": ">=2026.10.4",
|
|
35
|
+
"minGatewayVersion": "2026.10.4"
|
|
36
|
+
},
|
|
37
|
+
"build": {
|
|
38
|
+
"openclawVersion": "2026.10.4"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public",
|
|
43
|
+
"provenance": true
|
|
44
|
+
}
|
|
45
|
+
}
|