@akanjs/devkit 3.0.0-beta.10 → 3.0.0-beta.12
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/cloud/cloudApi.ts +35 -0
- package/executors.ts +1 -0
- package/package.json +2 -2
package/cloud/cloudApi.ts
CHANGED
|
@@ -43,6 +43,30 @@ class HttpClient {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* A share the control plane just issued. `token` is the connector credential — whoever holds it can become the
|
|
48
|
+
* origin behind `hostname`, so it is never written to disk or logged, only handed to the agent in memory.
|
|
49
|
+
*/
|
|
50
|
+
export interface TunnelGrant {
|
|
51
|
+
code: string;
|
|
52
|
+
hostname: string;
|
|
53
|
+
url: string;
|
|
54
|
+
/** The gateway to dial, as `wss://tunnel.akanjs.com`. The control plane names it; the CLI never assumes one. */
|
|
55
|
+
gatewayUrl: string;
|
|
56
|
+
token: string;
|
|
57
|
+
expiresAt: string | null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface TunnelSummary {
|
|
61
|
+
code: string;
|
|
62
|
+
hostname: string;
|
|
63
|
+
url: string;
|
|
64
|
+
name: string | null;
|
|
65
|
+
createdAt: string;
|
|
66
|
+
expiresAt: string | null;
|
|
67
|
+
connected: boolean;
|
|
68
|
+
}
|
|
69
|
+
|
|
46
70
|
export class CloudApi {
|
|
47
71
|
readonly #api: HttpClient;
|
|
48
72
|
#accessToken: AccessToken | null = null;
|
|
@@ -108,6 +132,17 @@ export class CloudApi {
|
|
|
108
132
|
this.#api.setHeaders({ Authorization: `Bearer ${this.#accessToken.jwt}` });
|
|
109
133
|
return this.#accessToken;
|
|
110
134
|
}
|
|
135
|
+
async requestTunnel(input: { name: string; ttlMinutes?: number }): Promise<TunnelGrant> {
|
|
136
|
+
return await this.#api.post<TunnelGrant>(`/requestTunnel`, input);
|
|
137
|
+
}
|
|
138
|
+
/** The generated name of the model's own `inSelf` slice: a hand-written `listTunnels` would collide with it. */
|
|
139
|
+
async tunnelListInSelf(): Promise<TunnelSummary[]> {
|
|
140
|
+
return await this.#api.get<TunnelSummary[]>(`/tunnelListInSelf`);
|
|
141
|
+
}
|
|
142
|
+
/** Hands the grant back. The CLI calls this "stop", which is what the operator is doing, not what it does. */
|
|
143
|
+
async revokeTunnel(code: string): Promise<boolean> {
|
|
144
|
+
return await this.#api.post<boolean>(`/revokeTunnel`, { code });
|
|
145
|
+
}
|
|
111
146
|
async getRemoteSelf(): Promise<{ id: string; nickname: string } | null> {
|
|
112
147
|
try {
|
|
113
148
|
const data = await this.#api.get<{ id: string; nickname: string }>(`/getRemoteSelf`);
|
package/executors.ts
CHANGED
|
@@ -1714,6 +1714,7 @@ export class AppExecutor extends SysExecutor {
|
|
|
1714
1714
|
executor: this,
|
|
1715
1715
|
getPath: (rel) => this.getPath(rel),
|
|
1716
1716
|
fileExists: (rel) => FileSys.fileExists(this.getPath(rel)),
|
|
1717
|
+
readFile: (rel) => this.readFile(rel),
|
|
1717
1718
|
writeFile: async (rel, content, opts) => {
|
|
1718
1719
|
await this.writeFile(rel, content, opts);
|
|
1719
1720
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/devkit",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.12",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@langchain/openai": "^1.4.6",
|
|
45
45
|
"@tailwindcss/node": "^4.3.0",
|
|
46
46
|
"@trapezedev/project": "^7.1.4",
|
|
47
|
-
"akanjs": "3.0.0-beta.
|
|
47
|
+
"akanjs": "3.0.0-beta.12",
|
|
48
48
|
"chalk": "^5.6.2",
|
|
49
49
|
"commander": "^14.0.3",
|
|
50
50
|
"dayjs": "^1.11.20",
|