@timeatlas/openclaw-timeatlas 0.1.1 → 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 +13 -11
- package/dist/src/channel.js +5 -3
- package/dist/src/link.js +10 -6
- package/openclaw.plugin.json +16 -3
- package/package.json +1 -1
- package/src/channel.ts +6 -3
- package/src/link.ts +12 -6
package/README.md
CHANGED
|
@@ -3,17 +3,19 @@
|
|
|
3
3
|
Makes Pat, the Time Atlas chat, an agent: the user's chat messages go to
|
|
4
4
|
their OpenClaw, and its answers come back to the app.
|
|
5
5
|
|
|
6
|
-
1. The app asks the proxy for a
|
|
7
|
-
2. The user
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
1. The app asks the proxy for a code (Make Pat an Agent).
|
|
7
|
+
2. The user runs `time-atlas-skills/setup.py CODE` where OpenClaw runs. It
|
|
8
|
+
trades the code at `POST /agent/setup` for a token for the MCP server
|
|
9
|
+
and one for this channel, and configures OpenClaw: the MCP server, this
|
|
10
|
+
plugin, and `channels.timeatlas.token`.
|
|
11
|
+
3. The plugin long polls `GET /agent/poll` with the token for the user's
|
|
12
|
+
messages, hands each to the agent, and posts typing, text and done to
|
|
13
|
+
`POST /agent/events`.
|
|
14
|
+
|
|
15
|
+
Without setup.py, the plugin can pair by itself: set
|
|
16
|
+
`channels.timeatlas.pairingCode` to the code, and it trades it at
|
|
17
|
+
`POST /agent/pair` for a token, kept in OpenClaw's state directory
|
|
18
|
+
(`timeatlas/<account>.json`). This gives no MCP access.
|
|
17
19
|
|
|
18
20
|
`channels.timeatlas.proxyUrl` points it at another proxy, for testing.
|
|
19
21
|
|
package/dist/src/channel.js
CHANGED
|
@@ -9,6 +9,7 @@ function resolveAccount(cfg, accountId) {
|
|
|
9
9
|
const config = section(cfg);
|
|
10
10
|
return {
|
|
11
11
|
accountId: accountId ?? DEFAULT_ACCOUNT_ID,
|
|
12
|
+
token: (config.token ?? "").trim(),
|
|
12
13
|
pairingCode: (config.pairingCode ?? "").trim().toUpperCase(),
|
|
13
14
|
proxyUrl: (config.proxyUrl ?? DEFAULT_PROXY_URL).replace(/\/+$/, ""),
|
|
14
15
|
};
|
|
@@ -19,11 +20,12 @@ const config = {
|
|
|
19
20
|
resolveAccount,
|
|
20
21
|
inspectAccount(cfg) {
|
|
21
22
|
const config = section(cfg);
|
|
23
|
+
const configured = Boolean(config.token || config.pairingCode);
|
|
22
24
|
return {
|
|
23
25
|
enabled: true,
|
|
24
|
-
//
|
|
25
|
-
configured
|
|
26
|
-
tokenStatus:
|
|
26
|
+
// Set up with a token, or about to pair with a code.
|
|
27
|
+
configured,
|
|
28
|
+
tokenStatus: configured ? "available" : "missing",
|
|
27
29
|
};
|
|
28
30
|
},
|
|
29
31
|
};
|
package/dist/src/link.js
CHANGED
|
@@ -53,8 +53,8 @@ export class ProxyLink {
|
|
|
53
53
|
if (!this.token) {
|
|
54
54
|
this.token = await this.pairedToken();
|
|
55
55
|
if (!this.token) {
|
|
56
|
-
this.log.warn("timeatlas:
|
|
57
|
-
"the Time Atlas app and
|
|
56
|
+
this.log.warn("timeatlas: not set up. Get a code from Make Pat an Agent in " +
|
|
57
|
+
"the Time Atlas app and run Time Atlas setup with it.");
|
|
58
58
|
await this.stopped();
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
@@ -70,8 +70,8 @@ export class ProxyLink {
|
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
if (err instanceof Unauthorized) {
|
|
73
|
-
this.log.error("timeatlas: disconnected from Time Atlas.
|
|
74
|
-
"code from the app.");
|
|
73
|
+
this.log.error("timeatlas: disconnected from Time Atlas. Set up again with a " +
|
|
74
|
+
"new code from the app.");
|
|
75
75
|
this.token = undefined;
|
|
76
76
|
await forgetToken(this.account.accountId);
|
|
77
77
|
await this.stopped();
|
|
@@ -84,10 +84,14 @@ export class ProxyLink {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
|
-
* The token to poll with: the one
|
|
88
|
-
*
|
|
87
|
+
* The token to poll with: the one in the config, given by Time Atlas
|
|
88
|
+
* setup, or else the one kept, unless the config has a code it was not
|
|
89
|
+
* paired with, which is traded for a new one.
|
|
89
90
|
*/
|
|
90
91
|
async pairedToken() {
|
|
92
|
+
if (this.account.token) {
|
|
93
|
+
return this.account.token;
|
|
94
|
+
}
|
|
91
95
|
const accountId = this.account.accountId;
|
|
92
96
|
const code = this.account.pairingCode;
|
|
93
97
|
const stored = await loadToken(accountId);
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "timeatlas",
|
|
3
|
-
"channels": [
|
|
3
|
+
"channels": [
|
|
4
|
+
"timeatlas"
|
|
5
|
+
],
|
|
4
6
|
"name": "Time Atlas",
|
|
5
7
|
"description": "Time Atlas channel: your Time Atlas chat answered by your agent",
|
|
6
8
|
"configSchema": {
|
|
@@ -14,11 +16,22 @@
|
|
|
14
16
|
"type": "object",
|
|
15
17
|
"additionalProperties": false,
|
|
16
18
|
"properties": {
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
+
"token": {
|
|
20
|
+
"type": "string"
|
|
21
|
+
},
|
|
22
|
+
"pairingCode": {
|
|
23
|
+
"type": "string"
|
|
24
|
+
},
|
|
25
|
+
"proxyUrl": {
|
|
26
|
+
"type": "string"
|
|
27
|
+
}
|
|
19
28
|
}
|
|
20
29
|
},
|
|
21
30
|
"uiHints": {
|
|
31
|
+
"token": {
|
|
32
|
+
"label": "Token from Time Atlas setup",
|
|
33
|
+
"sensitive": true
|
|
34
|
+
},
|
|
22
35
|
"pairingCode": {
|
|
23
36
|
"label": "Pairing code from the Time Atlas app",
|
|
24
37
|
"sensitive": true
|
package/package.json
CHANGED
package/src/channel.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
const DEFAULT_ACCOUNT_ID = "default";
|
|
15
15
|
|
|
16
16
|
type TimeAtlasSection = {
|
|
17
|
+
token?: string;
|
|
17
18
|
pairingCode?: string;
|
|
18
19
|
proxyUrl?: string;
|
|
19
20
|
};
|
|
@@ -30,6 +31,7 @@ function resolveAccount(
|
|
|
30
31
|
const config = section(cfg);
|
|
31
32
|
return {
|
|
32
33
|
accountId: accountId ?? DEFAULT_ACCOUNT_ID,
|
|
34
|
+
token: (config.token ?? "").trim(),
|
|
33
35
|
pairingCode: (config.pairingCode ?? "").trim().toUpperCase(),
|
|
34
36
|
proxyUrl: (config.proxyUrl ?? DEFAULT_PROXY_URL).replace(/\/+$/, ""),
|
|
35
37
|
};
|
|
@@ -41,11 +43,12 @@ const config = {
|
|
|
41
43
|
resolveAccount,
|
|
42
44
|
inspectAccount(cfg: OpenClawConfig) {
|
|
43
45
|
const config = section(cfg);
|
|
46
|
+
const configured = Boolean(config.token || config.pairingCode);
|
|
44
47
|
return {
|
|
45
48
|
enabled: true,
|
|
46
|
-
//
|
|
47
|
-
configured
|
|
48
|
-
tokenStatus:
|
|
49
|
+
// Set up with a token, or about to pair with a code.
|
|
50
|
+
configured,
|
|
51
|
+
tokenStatus: configured ? "available" : "missing",
|
|
49
52
|
};
|
|
50
53
|
},
|
|
51
54
|
};
|
package/src/link.ts
CHANGED
|
@@ -15,6 +15,8 @@ const POLL_TIMEOUT_MS = 40_000;
|
|
|
15
15
|
|
|
16
16
|
export type ResolvedAccount = {
|
|
17
17
|
accountId: string;
|
|
18
|
+
/** Given by Time Atlas setup, which paired already. */
|
|
19
|
+
token: string;
|
|
18
20
|
pairingCode: string;
|
|
19
21
|
proxyUrl: string;
|
|
20
22
|
};
|
|
@@ -85,8 +87,8 @@ export class ProxyLink {
|
|
|
85
87
|
this.token = await this.pairedToken();
|
|
86
88
|
if (!this.token) {
|
|
87
89
|
this.log.warn(
|
|
88
|
-
"timeatlas:
|
|
89
|
-
"the Time Atlas app and
|
|
90
|
+
"timeatlas: not set up. Get a code from Make Pat an Agent in " +
|
|
91
|
+
"the Time Atlas app and run Time Atlas setup with it.",
|
|
90
92
|
);
|
|
91
93
|
await this.stopped();
|
|
92
94
|
return;
|
|
@@ -103,8 +105,8 @@ export class ProxyLink {
|
|
|
103
105
|
}
|
|
104
106
|
if (err instanceof Unauthorized) {
|
|
105
107
|
this.log.error(
|
|
106
|
-
"timeatlas: disconnected from Time Atlas.
|
|
107
|
-
"code from the app.",
|
|
108
|
+
"timeatlas: disconnected from Time Atlas. Set up again with a " +
|
|
109
|
+
"new code from the app.",
|
|
108
110
|
);
|
|
109
111
|
this.token = undefined;
|
|
110
112
|
await forgetToken(this.account.accountId);
|
|
@@ -119,10 +121,14 @@ export class ProxyLink {
|
|
|
119
121
|
}
|
|
120
122
|
|
|
121
123
|
/**
|
|
122
|
-
* The token to poll with: the one
|
|
123
|
-
*
|
|
124
|
+
* The token to poll with: the one in the config, given by Time Atlas
|
|
125
|
+
* setup, or else the one kept, unless the config has a code it was not
|
|
126
|
+
* paired with, which is traded for a new one.
|
|
124
127
|
*/
|
|
125
128
|
private async pairedToken(): Promise<string | undefined> {
|
|
129
|
+
if (this.account.token) {
|
|
130
|
+
return this.account.token;
|
|
131
|
+
}
|
|
126
132
|
const accountId = this.account.accountId;
|
|
127
133
|
const code = this.account.pairingCode;
|
|
128
134
|
const stored = await loadToken(accountId);
|