@artil-ai/openclaw 0.1.14 → 0.2.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 +3 -3
- package/dist/index.js +77 -17
- package/openclaw.plugin.json +8 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Artil for OpenClaw
|
|
2
2
|
|
|
3
|
-
Install the
|
|
4
|
-
`artil auth login`, then install the plugin:
|
|
3
|
+
Install the plugin, which brings the Artil CLI, then sign in as your agent:
|
|
5
4
|
|
|
6
5
|
```sh
|
|
7
|
-
|
|
6
|
+
openclaw plugins install npm:@artil-ai/openclaw
|
|
7
|
+
openclaw artil auth login
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
Read more in the [Artil docs](https://docs.artil.ai/openclaw).
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// index.ts
|
|
2
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
3
|
+
|
|
1
4
|
// ../../packages/channel/listen.ts
|
|
2
5
|
import { spawn } from "node:child_process";
|
|
3
6
|
import { createInterface } from "node:readline";
|
|
@@ -25,6 +28,23 @@ function listen({ channel, restart, deliver, stopped }) {
|
|
|
25
28
|
};
|
|
26
29
|
}
|
|
27
30
|
|
|
31
|
+
// ../../packages/channel/bundled-artil.ts
|
|
32
|
+
import { createRequire } from "node:module";
|
|
33
|
+
import { delimiter, dirname } from "node:path";
|
|
34
|
+
function bundledArtil(pluginUrl) {
|
|
35
|
+
try {
|
|
36
|
+
return dirname(createRequire(pluginUrl).resolve("artil-ai/package.json"));
|
|
37
|
+
} catch {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function addBundledArtil(pluginUrl) {
|
|
42
|
+
const artil = bundledArtil(pluginUrl);
|
|
43
|
+
const path = process.env.PATH?.split(delimiter) ?? [];
|
|
44
|
+
if (artil && !path.includes(artil))
|
|
45
|
+
process.env.PATH = [...path, artil].join(delimiter);
|
|
46
|
+
}
|
|
47
|
+
|
|
28
48
|
// index.ts
|
|
29
49
|
import { resolveDefaultAgentId } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
30
50
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
@@ -34,36 +54,76 @@ var hint = [
|
|
|
34
54
|
"Answer only through artil, never with OpenClaw's own Telegram or other channels, which are other accounts.",
|
|
35
55
|
"Nobody outside reads what you write in this session."
|
|
36
56
|
].join(" ");
|
|
57
|
+
var retryAfter = 30000;
|
|
58
|
+
var artilCommand = {
|
|
59
|
+
name: "artil",
|
|
60
|
+
description: "Run the artil command the Artil plugin brings, like: openclaw artil auth login",
|
|
61
|
+
hasSubcommands: false
|
|
62
|
+
};
|
|
63
|
+
function runArtil(args) {
|
|
64
|
+
const { promise, resolve } = Promise.withResolvers();
|
|
65
|
+
addBundledArtil(import.meta.url);
|
|
66
|
+
const artil = spawn2("artil", args, { stdio: "inherit" });
|
|
67
|
+
artil.on("error", (error) => {
|
|
68
|
+
console.error(error.message);
|
|
69
|
+
process.exitCode = 1;
|
|
70
|
+
resolve();
|
|
71
|
+
});
|
|
72
|
+
artil.on("close", (code) => {
|
|
73
|
+
process.exitCode = code ?? 1;
|
|
74
|
+
resolve();
|
|
75
|
+
});
|
|
76
|
+
return promise;
|
|
77
|
+
}
|
|
37
78
|
var openclaw_default = definePluginEntry({
|
|
38
79
|
id: "artil",
|
|
39
80
|
name: "Artil",
|
|
40
81
|
description: "Email, SMS and Telegram for OpenClaw. Your agent gets its own Artil inbox and phone number to read and answer messages.",
|
|
41
82
|
register(api) {
|
|
83
|
+
if (["cli-metadata", "discovery", "full"].includes(api.registrationMode)) {
|
|
84
|
+
api.registerCli(({ program }) => {
|
|
85
|
+
program.command(artilCommand.name).description(artilCommand.description).argument("[args...]").allowUnknownOption().helpOption(false).action(runArtil);
|
|
86
|
+
}, { descriptors: [artilCommand] });
|
|
87
|
+
}
|
|
42
88
|
if (api.registrationMode !== "full")
|
|
43
89
|
return;
|
|
44
90
|
let listening;
|
|
91
|
+
let retrying;
|
|
92
|
+
function stopListening() {
|
|
93
|
+
clearTimeout(retrying);
|
|
94
|
+
listening?.();
|
|
95
|
+
listening = undefined;
|
|
96
|
+
}
|
|
97
|
+
addBundledArtil(import.meta.url);
|
|
45
98
|
api.registerService({
|
|
46
99
|
id: "artil-messages",
|
|
47
100
|
start({ config, logger }) {
|
|
48
101
|
const sessionKey = `agent:${resolveDefaultAgentId(config)}:artil`;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
102
|
+
let reported = "";
|
|
103
|
+
function hear() {
|
|
104
|
+
listening = listen({
|
|
105
|
+
channel: "openclaw-channel",
|
|
106
|
+
restart: "restart the gateway",
|
|
107
|
+
deliver: ({ content, meta }) => void api.runtime.subagent.run({
|
|
108
|
+
sessionKey,
|
|
109
|
+
message: content,
|
|
110
|
+
extraSystemPrompt: hint,
|
|
111
|
+
deliver: false,
|
|
112
|
+
...meta && { idempotencyKey: meta.message_id }
|
|
113
|
+
}).catch((error) => logger.error(`Could not hand OpenClaw a notice: ${error}`)),
|
|
114
|
+
stopped: (problem) => {
|
|
115
|
+
if (problem !== reported) {
|
|
116
|
+
logger.error(`OpenClaw does not hear about new messages and tries again every 30 seconds. ${problem}`);
|
|
117
|
+
}
|
|
118
|
+
reported = problem;
|
|
119
|
+
retrying = setTimeout(hear, retryAfter);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
stopListening();
|
|
124
|
+
hear();
|
|
62
125
|
},
|
|
63
|
-
stop
|
|
64
|
-
listening?.();
|
|
65
|
-
listening = undefined;
|
|
66
|
-
}
|
|
126
|
+
stop: stopListening
|
|
67
127
|
});
|
|
68
128
|
}
|
|
69
129
|
});
|
package/openclaw.plugin.json
CHANGED
|
@@ -5,5 +5,12 @@
|
|
|
5
5
|
"categories": ["channels"],
|
|
6
6
|
"activation": { "onStartup": true },
|
|
7
7
|
"skills": ["./skills"],
|
|
8
|
-
"configSchema": { "type": "object", "additionalProperties": false, "properties": {} }
|
|
8
|
+
"configSchema": { "type": "object", "additionalProperties": false, "properties": {} },
|
|
9
|
+
"cliCommands": [
|
|
10
|
+
{
|
|
11
|
+
"name": "artil",
|
|
12
|
+
"description": "Run the artil command the Artil plugin brings, like: openclaw artil auth login",
|
|
13
|
+
"hasSubcommands": false
|
|
14
|
+
}
|
|
15
|
+
]
|
|
9
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artil-ai/openclaw",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Email, SMS and Telegram for OpenClaw. Your agent gets its own Artil inbox and phone number to read and answer messages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-agents",
|
|
@@ -35,6 +35,9 @@
|
|
|
35
35
|
"build": "bun build index.ts --outdir dist --target node --external openclaw && rm -rf skills && cp -R ../../skills skills",
|
|
36
36
|
"prepack": "bun run build"
|
|
37
37
|
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"artil-ai": "0.23.1"
|
|
40
|
+
},
|
|
38
41
|
"devDependencies": {
|
|
39
42
|
"@artil-ai/channel": "workspace:*",
|
|
40
43
|
"openclaw": "2026.9.8"
|