kairos-cli 0.0.3 → 0.0.5
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 +51 -18
- package/dist/auth/loopback.d.ts +1 -1
- package/dist/auth/loopback.js +12 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,48 +1,81 @@
|
|
|
1
1
|
# kairos-cli
|
|
2
2
|
|
|
3
|
-
Local
|
|
3
|
+
Local command-line bridge for KairOS AI tools.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**AI agents** need this CLI **and** the **kairos-skill** skill on [skills.sh](https://skills.sh):
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install -g kairos-cli
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Add **kairos-skill** using the `npx skills add …` command from the user's KairOS **Dashboard → Connect your AI agent** (each host includes the correct GitHub source).
|
|
12
|
+
|
|
13
|
+
## Authenticate
|
|
12
14
|
|
|
13
15
|
```bash
|
|
14
16
|
kairos login --api-url https://your-kairos-url.com
|
|
15
|
-
kairos whoami
|
|
17
|
+
kairos whoami # expect: Token valid: yes
|
|
16
18
|
```
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
`kairos login` opens a browser consent flow (or prints a URL with `--no-open`) and stores credentials at `~/.config/kairos/credentials.json`.
|
|
21
|
+
|
|
22
|
+
| Flag | Purpose |
|
|
23
|
+
| ----------------- | --------------------------------------------------- |
|
|
24
|
+
| `--api-url <url>` | KairOS app URL; stored in credentials |
|
|
25
|
+
| `--no-open` | Print URL only — for agents / headless environments |
|
|
26
|
+
| `--timeout <sec>` | Max wait for authorize (default 300, minimum 30) |
|
|
27
|
+
|
|
28
|
+
Default API URL: `KAIROS_API_URL` env, else `https://kairos.querobines.com`. Stored `api_url` in credentials wins for later commands.
|
|
29
|
+
|
|
30
|
+
## Commands
|
|
19
31
|
|
|
20
32
|
```bash
|
|
33
|
+
kairos logout
|
|
21
34
|
kairos tools
|
|
22
35
|
kairos call query_today '{}'
|
|
23
36
|
kairos call query_tasks '{"activeOnly":true}'
|
|
37
|
+
kairos call create_task '{"title":"Follow up","status":"todo"}'
|
|
24
38
|
```
|
|
25
39
|
|
|
26
|
-
|
|
40
|
+
- `kairos call <toolName> '<json>'` — invoke a tool (requires valid token)
|
|
41
|
+
- Tool names and payloads: in **kairos-skill** (`references/tools.md` after install)
|
|
27
42
|
|
|
28
|
-
|
|
43
|
+
## Credentials
|
|
29
44
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
45
|
+
`~/.config/kairos/credentials.json` (file mode `600`):
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"api_url": "https://your-kairos-url.com",
|
|
50
|
+
"access_token": "<jwt>",
|
|
51
|
+
"expires_at": "2026-05-18T12:00:00.000Z"
|
|
52
|
+
}
|
|
33
53
|
```
|
|
34
54
|
|
|
35
|
-
|
|
55
|
+
v1 has **no refresh token** (~1 hour JWT). Re-run `kairos login` when `Token valid: no` or tools return **401**.
|
|
56
|
+
|
|
57
|
+
## Troubleshooting
|
|
58
|
+
|
|
59
|
+
| Symptom | Fix |
|
|
60
|
+
| -------------------------------------- | --------------------------------------------------- |
|
|
61
|
+
| `Not authenticated. Run: kairos login` | Missing or expired credentials — login again |
|
|
62
|
+
| `Token valid: no` | JWT past `expires_at` — `kairos login` |
|
|
63
|
+
| Login silent after URL | Waiting for **Authorize** in browser — check stderr |
|
|
64
|
+
| `Login timed out after Ns` | Re-run login; authorize within timeout |
|
|
65
|
+
| `fetch failed` / wrong data | Wrong host — `kairos login --api-url <correct>` |
|
|
66
|
+
| Redirect to `/login` on consent page | Sign in on the web app first, then authorize |
|
|
67
|
+
| `CODE_EXPIRED` / `PKCE_INVALID` | Fresh login; use the **latest** printed URL only |
|
|
68
|
+
| Tool **401** | `kairos login` |
|
|
36
69
|
|
|
37
|
-
|
|
70
|
+
Agent-driven login (`--no-open`, do not background): see `references/auth.md` in **kairos-skill**.
|
|
38
71
|
|
|
39
|
-
|
|
40
|
-
- Current publish step also supports token-based auth via `NPM_TOKEN`.
|
|
41
|
-
- A `403 Forbidden` during publish means the npm credentials lack publish rights for the package/account.
|
|
72
|
+
## Local development (monorepo)
|
|
42
73
|
|
|
43
|
-
|
|
74
|
+
> **Maintainers:** Keep customer-facing sections free of repo-internal links (`docs/`, monorepo paths). Monorepo notes below only.
|
|
75
|
+
|
|
76
|
+
Skill source (before skills.sh publish): `packages/kairos-skill/` · sync with `pnpm skill:sync` from repo root.
|
|
44
77
|
|
|
45
78
|
```bash
|
|
46
|
-
|
|
47
|
-
pnpm
|
|
79
|
+
pnpm cli:build
|
|
80
|
+
pnpm kairos --help
|
|
48
81
|
```
|
package/dist/auth/loopback.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Default wait for browser consent (matches server auth code TTL). */
|
|
2
2
|
export declare const DEFAULT_LOGIN_TIMEOUT_MS: number;
|
|
3
|
-
/** stderr heartbeat while waiting for loopback callback (
|
|
3
|
+
/** stderr heartbeat while waiting for loopback callback (`kairos login --no-open`). */
|
|
4
4
|
export declare const LOGIN_HEARTBEAT_MS = 15000;
|
|
5
5
|
/** Minimum `kairos login --timeout` value (seconds). */
|
|
6
6
|
export declare const MIN_LOGIN_TIMEOUT_SEC = 30;
|
package/dist/auth/loopback.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createPkcePair } from "./pkce.js";
|
|
|
4
4
|
import { exchangeDeviceTokenAtApi } from "./device-token-client.js";
|
|
5
5
|
/** Default wait for browser consent (matches server auth code TTL). */
|
|
6
6
|
export const DEFAULT_LOGIN_TIMEOUT_MS = 5 * 60 * 1000;
|
|
7
|
-
/** stderr heartbeat while waiting for loopback callback (
|
|
7
|
+
/** stderr heartbeat while waiting for loopback callback (`kairos login --no-open`). */
|
|
8
8
|
export const LOGIN_HEARTBEAT_MS = 15_000;
|
|
9
9
|
/** Minimum `kairos login --timeout` value (seconds). */
|
|
10
10
|
export const MIN_LOGIN_TIMEOUT_SEC = 30;
|
|
@@ -85,6 +85,17 @@ function waitForAuthorizationCode(server, timeoutMs) {
|
|
|
85
85
|
res.end();
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
|
+
const error = urlObj.searchParams.get("error");
|
|
89
|
+
const errorDescription = urlObj.searchParams.get("error_description");
|
|
90
|
+
if (error) {
|
|
91
|
+
res.writeHead(400, {
|
|
92
|
+
"Content-Type": "text/html",
|
|
93
|
+
Connection: "close",
|
|
94
|
+
});
|
|
95
|
+
res.end(`<h1>Auth failed: ${error}</h1><p>${errorDescription || ""}</p>`);
|
|
96
|
+
finish(() => reject(new Error(`Authorization failed: ${error}${errorDescription ? ` - ${errorDescription}` : ""}`)));
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
88
99
|
const code = urlObj.searchParams.get("code");
|
|
89
100
|
if (!code) {
|
|
90
101
|
res.writeHead(400, {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kairos-cli",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "KairOS Agent CLI —
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "KairOS Agent CLI — pair with kairos-skill on skills.sh (install via KairOS dashboard)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"kairos": "./dist/bin.js"
|