@neta-art/cohub-cli 10.15.0 → 10.17.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 -1
- package/dist/auth.d.ts +3 -1
- package/dist/auth.js +4 -0
- package/dist/board-kernel.js +385 -331
- package/dist/bootstrap.js +5 -0
- package/dist/commands/auth.js +12 -1
- package/dist/commands/host.d.ts +2 -0
- package/dist/commands/host.js +11 -0
- package/dist/commands/runtime.js +4 -16
- package/dist/commands/space-invitations.d.ts +3 -2
- package/dist/commands/space-invitations.js +29 -8
- package/dist/commands/spaces.js +47 -19
- package/dist/host/auth.d.ts +20 -0
- package/dist/host/auth.js +107 -0
- package/dist/host/login-env.d.ts +1 -0
- package/dist/host/login-env.js +31 -0
- package/dist/host/runtime.d.ts +25 -0
- package/dist/host/runtime.js +250 -0
- package/dist/host/runtimes.d.ts +9 -0
- package/dist/host/runtimes.js +42 -0
- package/dist/host/serve.d.ts +2 -0
- package/dist/host/serve.js +73 -0
- package/dist/index.js +2 -0
- package/dist/runtime/instance.d.ts +8 -1
- package/dist/runtime/instance.js +89 -9
- package/dist/runtime/launch.d.ts +1 -0
- package/dist/runtime/launch.js +6 -0
- package/dist/runtime/supervisor.js +4 -3
- package/dist/space.d.ts +1 -0
- package/dist/space.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -122,8 +122,10 @@ cohub spaces create --name "<name>" --checkpoint <checkpointId> --json
|
|
|
122
122
|
cohub spaces update <spaceId> --slug <space-slug>
|
|
123
123
|
cohub spaces rename <spaceId> "<new name>"
|
|
124
124
|
cohub -s <spaceId> spaces invites create --role builder --days 7
|
|
125
|
-
cohub -s <spaceId> spaces invites
|
|
125
|
+
cohub -s <spaceId> spaces invites create --role guest --never-expires
|
|
126
|
+
cohub -s <spaceId> spaces invites ls --all
|
|
126
127
|
cohub -s <spaceId> spaces invites revoke <code> --yes
|
|
128
|
+
cohub spaces config <spaceId> --guest-app <app>
|
|
127
129
|
cohub -s <spaceId> run -- git status
|
|
128
130
|
```
|
|
129
131
|
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CohubEnvironment } from "@neta-art/cohub";
|
|
2
2
|
export type AuthSource = "execution-token" | "logto" | null;
|
|
3
|
-
type DeviceCode = {
|
|
3
|
+
export type DeviceCode = {
|
|
4
4
|
deviceCode: string;
|
|
5
5
|
userCode: string;
|
|
6
6
|
verificationUri: string;
|
|
@@ -29,6 +29,7 @@ export declare class AuthRequiredError extends Error {
|
|
|
29
29
|
constructor(message?: string);
|
|
30
30
|
}
|
|
31
31
|
export declare const readAuthSession: () => AuthSession | null;
|
|
32
|
+
export declare const authSessionPath: () => string;
|
|
32
33
|
export declare const clearAuthSession: (env?: CohubEnvironment, baseUrl?: string) => void;
|
|
33
34
|
export declare const authSource: () => AuthSource;
|
|
34
35
|
export declare function resolveAccessToken(options?: {
|
|
@@ -39,5 +40,6 @@ export declare function refreshAccessToken(session?: AuthSession | null): Promis
|
|
|
39
40
|
export declare function requestDeviceCode(): Promise<DeviceCode>;
|
|
40
41
|
export declare function verifyDeviceCode(): Promise<AuthSession>;
|
|
41
42
|
export declare function loginWithDeviceFlow(onCode: (code: DeviceCode) => void, onPoll?: () => void): Promise<AuthSession>;
|
|
43
|
+
export declare function pollDeviceCode(code: DeviceCode, onPoll?: () => void): Promise<AuthSession>;
|
|
42
44
|
export declare function revokeAndClearAuthSession(): Promise<void>;
|
|
43
45
|
export {};
|
package/dist/auth.js
CHANGED
|
@@ -129,6 +129,7 @@ const toSession = (token, config, env, previous) => {
|
|
|
129
129
|
};
|
|
130
130
|
};
|
|
131
131
|
export const readAuthSession = () => readJson(sessionPath());
|
|
132
|
+
export const authSessionPath = () => sessionPath();
|
|
132
133
|
export const clearAuthSession = (env = currentEnv(), baseUrl = resolveApiBaseUrl({ env })) => {
|
|
133
134
|
removeIfExists(sessionPath(env, baseUrl));
|
|
134
135
|
removeIfExists(deviceCodePath(env, baseUrl));
|
|
@@ -262,6 +263,9 @@ export async function verifyDeviceCode() {
|
|
|
262
263
|
export async function loginWithDeviceFlow(onCode, onPoll) {
|
|
263
264
|
const code = await requestDeviceCode();
|
|
264
265
|
onCode(code);
|
|
266
|
+
return pollDeviceCode(code, onPoll);
|
|
267
|
+
}
|
|
268
|
+
export async function pollDeviceCode(code, onPoll) {
|
|
265
269
|
while (Date.now() < code.expiresAt) {
|
|
266
270
|
await delay(code.interval * 1000);
|
|
267
271
|
onPoll?.();
|