@r4-sdk/skill 1.0.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 ADDED
@@ -0,0 +1,40 @@
1
+ # @r4-sdk/skill
2
+
3
+ Official R4 OpenClaw skill package. It bundles the maintained `SKILL.md` instructions that teach agent runtimes how to use R4 for:
4
+
5
+ - zero-trust vault secret retrieval through the `r4` CLI
6
+ - project metadata lookups
7
+ - domain search, purchase, and DNS management through the machine API
8
+ - AGENT feedback submission when a needed R4 capability is missing
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm install @r4-sdk/skill
14
+ ```
15
+
16
+ The package expects the `r4` CLI to be available on the host runtime.
17
+
18
+ ## Usage
19
+
20
+ ```ts
21
+ import { getSkillPath, skillContent } from '@r4-sdk/skill'
22
+
23
+ console.log(getSkillPath())
24
+ console.log(skillContent)
25
+ ```
26
+
27
+ `getSkillPath()` returns the packaged `SKILL.md` path on disk, and `skillContent`
28
+ returns the same file contents as a string.
29
+
30
+ ## Development
31
+
32
+ ```bash
33
+ pnpm run test
34
+ pnpm run build
35
+ pnpm run test:pack
36
+ pnpm run clean
37
+ ```
38
+
39
+ This package is released in lockstep with `@r4-sdk/sdk`,
40
+ `@r4-sdk/mcp`, and `@r4-sdk/cli` through `pnpm release:sdk`.
package/lib/SKILL.md ADDED
@@ -0,0 +1,197 @@
1
+ # R4 Skill
2
+
3
+ You have access to the **R4 platform** for zero-trust secret retrieval, project metadata, and domain management.
4
+
5
+ Use R4 first whenever you need:
6
+
7
+ - credentials, API keys, tokens, passwords, SSH keys, or other secrets
8
+ - project metadata that is already managed in R4
9
+ - domain search, purchase, or DNS management through the R4 machine API
10
+
11
+ Do not ask the user for credentials that may already be available through R4.
12
+
13
+ ## Setup
14
+
15
+ The `r4` CLI should already be available on this machine.
16
+
17
+ - In managed R4 OpenClaw deployments, the runtime is typically preconfigured.
18
+ - In standalone installs, confirm setup with `r4 auth status` and `r4 doctor`.
19
+ - If the runtime still needs bootstrap, use `r4 agent init --credentials-file <path>` or `r4 auth login`.
20
+
21
+ ## Vault Secrets
22
+
23
+ R4 is your password manager and secret store. Check it before asking the user for credentials.
24
+
25
+ ### Verify local runtime health
26
+
27
+ ```bash
28
+ r4 auth status
29
+ r4 doctor
30
+ ```
31
+
32
+ ### List locally decrypted environment variables
33
+
34
+ ```bash
35
+ r4 vault list
36
+ ```
37
+
38
+ ### Get one secret value
39
+
40
+ ```bash
41
+ r4 vault get <KEY>
42
+ ```
43
+
44
+ This prints the raw value, so only use it when the output is needed by another command.
45
+
46
+ ### Search vault items by name
47
+
48
+ ```bash
49
+ r4 vault search <query>
50
+ ```
51
+
52
+ ### List vault metadata without decryption
53
+
54
+ ```bash
55
+ r4 vault list-vaults
56
+ r4 vault list-items
57
+ r4 vault items --metadata-only
58
+ ```
59
+
60
+ ### List grouped item/field data from the decrypted env map
61
+
62
+ ```bash
63
+ r4 vault items
64
+ ```
65
+
66
+ ### Run a command with secrets injected
67
+
68
+ ```bash
69
+ r4 run -- <command>
70
+ r4 run --prefix R4 -- <command>
71
+ ```
72
+
73
+ Examples:
74
+
75
+ ```bash
76
+ r4 run -- node deploy.js
77
+ r4 run --prefix R4 -- docker compose up
78
+ ```
79
+
80
+ ### Machine-readable output
81
+
82
+ Most CLI commands support `--json`:
83
+
84
+ ```bash
85
+ r4 auth status --json
86
+ r4 doctor --json
87
+ r4 vault list --json
88
+ r4 vault get DATABASE_PASSWORD --json
89
+ r4 vault items --json
90
+ r4 project list --json
91
+ ```
92
+
93
+ ## Projects
94
+
95
+ Use the CLI when you need project metadata that is already available through R4.
96
+
97
+ ```bash
98
+ r4 project list
99
+ r4 project get <project-id>
100
+ r4 project create
101
+ ```
102
+
103
+ ## Domains
104
+
105
+ Use the R4 machine API for domain search, purchase, and DNS changes.
106
+
107
+ ### Search domains
108
+
109
+ ```bash
110
+ curl -X GET "https://r4.dev/api/v1/machine/domain-manager/search-domains?domain=<domain>" \
111
+ -H "X-API-Key: $R4_API_KEY"
112
+ ```
113
+
114
+ Examples:
115
+
116
+ ```bash
117
+ curl -X GET "https://r4.dev/api/v1/machine/domain-manager/search-domains?domain=example" \
118
+ -H "X-API-Key: $R4_API_KEY"
119
+ curl -X GET "https://r4.dev/api/v1/machine/domain-manager/search-domains?domain=example.com" \
120
+ -H "X-API-Key: $R4_API_KEY"
121
+ ```
122
+
123
+ ### Purchase a domain
124
+
125
+ ```bash
126
+ curl -X POST "https://r4.dev/api/v1/machine/domain-manager/purchase-domain" \
127
+ -H "X-API-Key: $R4_API_KEY" \
128
+ -H "Content-Type: application/json" \
129
+ -d '{"domain":"example.com"}'
130
+ ```
131
+
132
+ ### List domains
133
+
134
+ ```bash
135
+ curl -X GET "https://r4.dev/api/v1/machine/domain/list" \
136
+ -H "X-API-Key: $R4_API_KEY"
137
+ ```
138
+
139
+ ### Read DNS records
140
+
141
+ ```bash
142
+ curl -X GET "https://r4.dev/api/v1/machine/domain-manager/dns-records?domain=example.com" \
143
+ -H "X-API-Key: $R4_API_KEY"
144
+ ```
145
+
146
+ ### Add a DNS record
147
+
148
+ ```bash
149
+ curl -X POST "https://r4.dev/api/v1/machine/domain-manager/dns-records" \
150
+ -H "X-API-Key: $R4_API_KEY" \
151
+ -H "Content-Type: application/json" \
152
+ -d '{
153
+ "domain": "example.com",
154
+ "record": {
155
+ "type": "A",
156
+ "name": "@",
157
+ "value": "192.168.1.1",
158
+ "ttl": 300
159
+ }
160
+ }'
161
+ ```
162
+
163
+ Supported record types: `A`, `AAAA`, `CNAME`, `MX`, `TXT`, `NS`.
164
+
165
+ ## Capability Gaps
166
+
167
+ If you are blocked because R4 is missing a needed feature, submit feedback with the AGENT machine API instead of inventing a workaround:
168
+
169
+ ```bash
170
+ curl -X POST "https://r4.dev/api/v1/machine/feedback" \
171
+ -H "X-API-Key: $R4_API_KEY" \
172
+ -H "Content-Type: application/json" \
173
+ -d '{
174
+ "surface": "OTHER",
175
+ "summary": "Missing capability needed to complete the task",
176
+ "details": "Describe what you tried, what failed, and the capability you need.",
177
+ "desiredOutcome": "Explain what R4 should support."
178
+ }'
179
+ ```
180
+
181
+ Use `CLI`, `SDK`, `MCP`, `MACHINE_API`, or `OTHER` for `surface` when you know which product surface is missing.
182
+
183
+ ## Security Rules
184
+
185
+ - Never hardcode secrets in source code, config files, or commits.
186
+ - Never log secrets, tokens, passwords, or private keys in plaintext.
187
+ - Prefer `r4 run` when a command needs multiple secrets.
188
+ - Prefer `r4 vault list-items` or `r4 vault items --metadata-only` when you only need names or structure.
189
+ - Ask for broader access only when R4 does not already expose what you need.
190
+
191
+ ## Docs
192
+
193
+ Full public docs:
194
+
195
+ - https://r4.dev/docs/cli
196
+ - https://r4.dev/docs/sdk
197
+ - https://r4.dev/docs/machine-api
package/lib/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Returns the absolute path to the R4 vault skill markdown file.
3
+ * Useful for tools that need to read the skill file directly from disk.
4
+ */
5
+ export declare function getSkillPath(): string;
6
+ /**
7
+ * The R4 skill content as a string.
8
+ * Contains instructions for agents on how to use the current R4
9
+ * CLI and machine API surface for zero-trust secret retrieval,
10
+ * project metadata, domain management, and capability feedback.
11
+ */
12
+ export declare const skillContent: string;
package/lib/index.js ADDED
@@ -0,0 +1,19 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ const __filename = fileURLToPath(import.meta.url);
5
+ const __dirname = path.dirname(__filename);
6
+ /**
7
+ * Returns the absolute path to the R4 vault skill markdown file.
8
+ * Useful for tools that need to read the skill file directly from disk.
9
+ */
10
+ export function getSkillPath() {
11
+ return path.join(__dirname, 'SKILL.md');
12
+ }
13
+ /**
14
+ * The R4 skill content as a string.
15
+ * Contains instructions for agents on how to use the current R4
16
+ * CLI and machine API surface for zero-trust secret retrieval,
17
+ * project metadata, domain management, and capability feedback.
18
+ */
19
+ export const skillContent = fs.readFileSync(getSkillPath(), 'utf8');
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@r4-sdk/skill",
3
+ "version": "1.0.0",
4
+ "description": "Official R4 OpenClaw skill — teaches agents how to use R4 vault, project, and domain flows",
5
+ "type": "module",
6
+ "main": "lib/index.js",
7
+ "types": "lib/index.d.ts",
8
+ "files": [
9
+ "lib"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsc && cp src/SKILL.md lib/SKILL.md",
13
+ "clean": "rm -rf lib",
14
+ "test": "tsx --test test/**/*.test.ts",
15
+ "test:pack": "tsx --test test/package.smoke.ts"
16
+ },
17
+ "keywords": [
18
+ "r4",
19
+ "openclaw",
20
+ "skill",
21
+ "agent",
22
+ "vault",
23
+ "domain"
24
+ ],
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "license": "MIT",
29
+ "engines": {
30
+ "node": ">=18.0.0"
31
+ },
32
+ "peerDependencies": {
33
+ "@r4-sdk/cli": ">=1.0.0"
34
+ },
35
+ "peerDependenciesMeta": {
36
+ "@r4-sdk/cli": {
37
+ "optional": true
38
+ }
39
+ },
40
+ "openclaw": {
41
+ "requiredCredentials": [
42
+ {
43
+ "name": "R4_API_KEY",
44
+ "description": "AGENT-scoped R4 API key used to authenticate the local runtime against the machine API."
45
+ }
46
+ ],
47
+ "requiredBinaries": [
48
+ {
49
+ "name": "r4",
50
+ "package": "@r4-sdk/cli",
51
+ "description": "R4 CLI for vault secret access and domain management"
52
+ }
53
+ ]
54
+ },
55
+ "devDependencies": {
56
+ "@types/node": "^20.11.24",
57
+ "tsx": "^4.20.6",
58
+ "typescript": "5.5.3"
59
+ }
60
+ }