@caplets/core 0.24.1 → 0.25.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/dist/attach/options.d.ts +1 -0
- package/dist/attach/server.d.ts +3 -0
- package/dist/cli/commands.d.ts +10 -2
- package/dist/cli/doctor.d.ts +4 -1
- package/dist/cli.d.ts +3 -2
- package/dist/{completion-BeVXdm9q.js → completion-DrPr2vYw.js} +27 -5
- package/dist/daemon/config.d.ts +8 -0
- package/dist/daemon/env.d.ts +2 -0
- package/dist/daemon/index.d.ts +18 -0
- package/dist/daemon/logs.d.ts +15 -0
- package/dist/daemon/manager.d.ts +2 -0
- package/dist/daemon/paths.d.ts +2 -0
- package/dist/daemon/platform-darwin.d.ts +3 -0
- package/dist/daemon/platform-linux.d.ts +3 -0
- package/dist/daemon/platform-windows.d.ts +3 -0
- package/dist/daemon/process.d.ts +11 -0
- package/dist/daemon/shell.d.ts +20 -0
- package/dist/daemon/types.d.ts +178 -0
- package/dist/daemon/validation.d.ts +13 -0
- package/dist/daemon/xml.d.ts +1 -0
- package/dist/index.js +5857 -3604
- package/dist/native/options.d.ts +5 -2
- package/dist/native/remote.d.ts +6 -1
- package/dist/native.js +1 -1
- package/dist/project-binding/attach.d.ts +1 -3
- package/dist/project-binding/session.d.ts +1 -0
- package/dist/remote/credential-store.d.ts +12 -0
- package/dist/remote/options.d.ts +2 -7
- package/dist/remote/pairing.d.ts +13 -0
- package/dist/remote/profile-store.d.ts +94 -0
- package/dist/remote/profiles.d.ts +47 -0
- package/dist/remote/selection.d.ts +4 -4
- package/dist/remote/server-credential-store.d.ts +84 -0
- package/dist/remote/server-credentials.d.ts +21 -0
- package/dist/remote-control/client.d.ts +4 -1
- package/dist/serve/http.d.ts +5 -0
- package/dist/serve/index.d.ts +1 -3
- package/dist/serve/options.d.ts +7 -12
- package/dist/server/options.d.ts +2 -9
- package/dist/{service-Cvnuu9wr.js → service-DjwB8aiW.js} +1084 -254
- package/package.json +1 -1
- package/dist/serve/daemon/config.d.ts +0 -8
- package/dist/serve/daemon/index.d.ts +0 -16
- package/dist/serve/daemon/paths.d.ts +0 -3
- package/dist/serve/daemon/platform-darwin.d.ts +0 -2
- package/dist/serve/daemon/platform-linux.d.ts +0 -2
- package/dist/serve/daemon/platform-windows.d.ts +0 -2
- package/dist/serve/daemon/platform.d.ts +0 -9
- package/dist/serve/daemon/process.d.ts +0 -5
- package/dist/serve/daemon/types.d.ts +0 -86
package/dist/native/options.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { type CapletsRemoteEnv
|
|
1
|
+
import { type CapletsRemoteEnv } from "../remote/options";
|
|
2
2
|
type CapletsMode = "auto" | "local" | "remote" | "cloud";
|
|
3
3
|
export type NativeCapletsMode = CapletsMode;
|
|
4
|
-
export type NativeRemoteCapletsOptions =
|
|
4
|
+
export type NativeRemoteCapletsOptions = {
|
|
5
|
+
url?: string;
|
|
6
|
+
workspace?: string;
|
|
7
|
+
fetch?: typeof fetch;
|
|
5
8
|
pollIntervalMs?: number;
|
|
6
9
|
cloud?: NativeCloudPresenceInput;
|
|
7
10
|
};
|
package/dist/native/remote.d.ts
CHANGED
|
@@ -23,6 +23,11 @@ export type RemoteCapletsClient = {
|
|
|
23
23
|
export type RemoteCapletsClientOptions = ResolvedNativeCapletsServiceOptions & {
|
|
24
24
|
mode: "remote" | "cloud";
|
|
25
25
|
};
|
|
26
|
+
export type SdkRemoteCapletsClientOptions = RemoteCapletsClientOptions["remote"] & {
|
|
27
|
+
resolveRuntimeOptions?: () => Promise<RemoteCapletsClientOptions["remote"]>;
|
|
28
|
+
authKind?: "self_hosted_remote" | "hosted_cloud";
|
|
29
|
+
writeErr?: (value: string) => void;
|
|
30
|
+
};
|
|
26
31
|
export type RemoteNativeCapletsServiceOptions = {
|
|
27
32
|
client: RemoteCapletsClient;
|
|
28
33
|
clientFactory?: () => RemoteCapletsClient;
|
|
@@ -30,7 +35,7 @@ export type RemoteNativeCapletsServiceOptions = {
|
|
|
30
35
|
authKind?: "self_hosted_remote" | "hosted_cloud";
|
|
31
36
|
writeErr?: (value: string) => void;
|
|
32
37
|
};
|
|
33
|
-
export declare function createSdkRemoteCapletsClient(options:
|
|
38
|
+
export declare function createSdkRemoteCapletsClient(options: SdkRemoteCapletsClientOptions): RemoteCapletsClient;
|
|
34
39
|
export declare class RemoteNativeCapletsService implements NativeCapletsService {
|
|
35
40
|
private readonly options;
|
|
36
41
|
private tools;
|
package/dist/native.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as nativeCapletToolDescription, M as nativeCapletsSystemGuidance, N as nativeCodeModeToolId, P as nativeCodeModeToolName, _ as resolveNativeCapletsServiceOptions, h as createSdkRemoteCapletsClient, j as nativeCapletToolName, k as nativeCapletPromptGuidance, m as RemoteNativeCapletsService, t as createNativeCapletsService } from "./service-DjwB8aiW.js";
|
|
2
2
|
import { generatedToolInputJsonSchema, generatedToolInputSchema } from "./generated-tool-input-schema.js";
|
|
3
3
|
//#region src/native/process-cleanup.ts
|
|
4
4
|
function registerNativeCapletsProcessCleanup(service, options = {}) {
|
|
@@ -3,15 +3,13 @@ import { type ProjectBindingSessionEvent } from "./session";
|
|
|
3
3
|
import type { ProjectBindingWebSocketFactory } from "./transport";
|
|
4
4
|
export type RawAttachOptions = {
|
|
5
5
|
remoteUrl?: string;
|
|
6
|
-
user?: string;
|
|
7
|
-
password?: string;
|
|
8
|
-
token?: string;
|
|
9
6
|
workspace?: string;
|
|
10
7
|
json?: boolean;
|
|
11
8
|
verbose?: boolean;
|
|
12
9
|
once?: boolean;
|
|
13
10
|
projectRoot?: string;
|
|
14
11
|
fetch?: typeof fetch;
|
|
12
|
+
authDir?: string;
|
|
15
13
|
};
|
|
16
14
|
export type ResolvedAttachOptions = {
|
|
17
15
|
projectRoot: string;
|
|
@@ -65,6 +65,7 @@ export type ProjectBindingSocketClientMessage = {
|
|
|
65
65
|
export type RunProjectBindingSessionInput = {
|
|
66
66
|
projectRoot: string;
|
|
67
67
|
remote: ResolvedCapletsRemote;
|
|
68
|
+
remoteResolver?: (() => Promise<ResolvedCapletsRemote>) | undefined;
|
|
68
69
|
fetch?: typeof fetch | undefined;
|
|
69
70
|
webSocketFactory?: ProjectBindingWebSocketFactory | undefined;
|
|
70
71
|
signal?: AbortSignal | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RemoteProfileCredential } from "./profiles";
|
|
2
|
+
export type RemoteCredentialStoreOptions = {
|
|
3
|
+
root?: string | undefined;
|
|
4
|
+
};
|
|
5
|
+
export declare class FileRemoteCredentialStore {
|
|
6
|
+
readonly root: string;
|
|
7
|
+
constructor(options?: RemoteCredentialStoreOptions);
|
|
8
|
+
pathForKey(key: string): string;
|
|
9
|
+
load(key: string): Promise<RemoteProfileCredential | undefined>;
|
|
10
|
+
save(key: string, credential: RemoteProfileCredential): Promise<void>;
|
|
11
|
+
delete(key: string): Promise<boolean>;
|
|
12
|
+
}
|
package/dist/remote/options.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type CapletsRemoteEnv = Partial<Record<"CAPLETS_MODE" | "CAPLETS_REMOTE_URL" | "
|
|
1
|
+
export type CapletsRemoteEnv = Partial<Record<"CAPLETS_MODE" | "CAPLETS_REMOTE_URL" | "CAPLETS_REMOTE_WORKSPACE", string>>;
|
|
2
2
|
export type CapletsRemoteModeInput = {
|
|
3
3
|
mode?: string;
|
|
4
4
|
remoteUrl?: string;
|
|
@@ -6,8 +6,6 @@ export type CapletsRemoteModeInput = {
|
|
|
6
6
|
export type CapletsRemoteMode = "local" | "remote" | "cloud";
|
|
7
7
|
export type CapletsRemoteInput = {
|
|
8
8
|
url?: string;
|
|
9
|
-
user?: string;
|
|
10
|
-
password?: string;
|
|
11
9
|
token?: string;
|
|
12
10
|
workspace?: string;
|
|
13
11
|
fetch?: typeof fetch;
|
|
@@ -15,10 +13,6 @@ export type CapletsRemoteInput = {
|
|
|
15
13
|
export type CapletsRemoteAuth = {
|
|
16
14
|
type: "none";
|
|
17
15
|
user: string;
|
|
18
|
-
} | {
|
|
19
|
-
type: "basic";
|
|
20
|
-
user: string;
|
|
21
|
-
password: string;
|
|
22
16
|
} | {
|
|
23
17
|
type: "bearer";
|
|
24
18
|
token: string;
|
|
@@ -41,5 +35,6 @@ export declare function resolveRemoteMode(input?: CapletsRemoteModeInput, env?:
|
|
|
41
35
|
export declare function resolveCapletsRemote(input?: CapletsRemoteInput, env?: CapletsRemoteEnv): ResolvedCapletsRemote;
|
|
42
36
|
export declare function resolveHostedCloudRemote(input?: CapletsRemoteInput, env?: CapletsRemoteEnv): ResolvedCapletsRemote;
|
|
43
37
|
export declare function hostedCloudWorkspaceFromRemoteUrl(value: string): string | undefined;
|
|
38
|
+
export declare function normalizeRemoteProfileHostUrl(value: string): string;
|
|
44
39
|
export declare function projectBindingWebSocketUrlForBase(baseUrl: URL): URL;
|
|
45
40
|
export declare function isCapletsCloudUrl(value: string): boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ParsedPairingCode = {
|
|
2
|
+
codeId: string;
|
|
3
|
+
secret: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function createPairingCode(): {
|
|
6
|
+
codeId: string;
|
|
7
|
+
code: string;
|
|
8
|
+
secret: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function createPairingCodeVerifier(codeId: string, secret: string): string;
|
|
11
|
+
export declare function parsePairingCode(value: string): ParsedPairingCode | undefined;
|
|
12
|
+
export declare function isPairingCodeFormat(value: string): boolean;
|
|
13
|
+
export declare function randomToken(bytes?: number): string;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { CloudAuthStore } from "../cloud-auth/store";
|
|
2
|
+
import type { CloudAuthCredentials } from "../cloud-auth/store";
|
|
3
|
+
import { FileRemoteCredentialStore } from "./credential-store";
|
|
4
|
+
import { type RemoteProfileCredential, type RemoteProfileStatus } from "./profiles";
|
|
5
|
+
export type SaveCloudProfileInput = {
|
|
6
|
+
hostUrl: string;
|
|
7
|
+
workspaceId: string;
|
|
8
|
+
workspaceSlug?: string | undefined;
|
|
9
|
+
clientLabel?: string | undefined;
|
|
10
|
+
credentials: RemoteProfileCredential;
|
|
11
|
+
now?: Date | undefined;
|
|
12
|
+
};
|
|
13
|
+
export type CloudProfileLookup = {
|
|
14
|
+
hostUrl: string;
|
|
15
|
+
workspace?: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
export type SaveSelfHostedProfileInput = {
|
|
18
|
+
hostUrl: string;
|
|
19
|
+
clientId: string;
|
|
20
|
+
clientLabel?: string | undefined;
|
|
21
|
+
credentials: RemoteProfileCredential;
|
|
22
|
+
now?: Date | undefined;
|
|
23
|
+
};
|
|
24
|
+
export type SelfHostedProfileLookup = {
|
|
25
|
+
hostUrl: string;
|
|
26
|
+
};
|
|
27
|
+
export type RefreshSelfHostedProfileInput = SelfHostedProfileLookup & {
|
|
28
|
+
needsRefresh: (credential: RemoteProfileCredential) => boolean;
|
|
29
|
+
refresh: (status: RemoteProfileStatus, credential: RemoteProfileCredential) => Promise<SaveSelfHostedProfileInput>;
|
|
30
|
+
};
|
|
31
|
+
export type RefreshCloudProfileInput = CloudProfileLookup & {
|
|
32
|
+
needsRefresh: (credential: RemoteProfileCredential) => boolean;
|
|
33
|
+
refresh: (status: RemoteProfileStatus, credential: RemoteProfileCredential) => Promise<SaveCloudProfileInput>;
|
|
34
|
+
};
|
|
35
|
+
export type RemoteProfileStoreOptions = {
|
|
36
|
+
root?: string | undefined;
|
|
37
|
+
credentials?: FileRemoteCredentialStore | undefined;
|
|
38
|
+
legacyCloudAuthStore?: CloudAuthStore | undefined;
|
|
39
|
+
};
|
|
40
|
+
export type CreateRemoteProfileStoreOptions = {
|
|
41
|
+
authDir?: string | undefined;
|
|
42
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined> | undefined;
|
|
43
|
+
legacyCloudAuthStore?: CloudAuthStore | undefined;
|
|
44
|
+
};
|
|
45
|
+
export declare function createRemoteProfileStore(options?: CreateRemoteProfileStoreOptions): FileRemoteProfileStore;
|
|
46
|
+
export declare function cloudCredentialsFromRemoteProfile(status: RemoteProfileStatus, credential: RemoteProfileCredential): CloudAuthCredentials;
|
|
47
|
+
export declare class FileRemoteProfileStore {
|
|
48
|
+
readonly root: string;
|
|
49
|
+
readonly credentials: FileRemoteCredentialStore;
|
|
50
|
+
readonly legacyCloudAuthStore?: CloudAuthStore | undefined;
|
|
51
|
+
constructor(options?: RemoteProfileStoreOptions);
|
|
52
|
+
saveSelfHostedProfile(input: SaveSelfHostedProfileInput): Promise<RemoteProfileStatus>;
|
|
53
|
+
getSelfHostedProfileStatus(input: SelfHostedProfileLookup): Promise<RemoteProfileStatus | undefined>;
|
|
54
|
+
logoutSelfHostedProfile(input: SelfHostedProfileLookup): Promise<boolean>;
|
|
55
|
+
refreshSelfHostedProfileIfNeeded(input: RefreshSelfHostedProfileInput): Promise<{
|
|
56
|
+
status: RemoteProfileStatus;
|
|
57
|
+
credential: RemoteProfileCredential;
|
|
58
|
+
} | undefined>;
|
|
59
|
+
refreshCloudProfileIfNeeded(input: RefreshCloudProfileInput): Promise<{
|
|
60
|
+
status: RemoteProfileStatus;
|
|
61
|
+
credential: RemoteProfileCredential;
|
|
62
|
+
} | undefined>;
|
|
63
|
+
saveCloudProfile(input: SaveCloudProfileInput): Promise<RemoteProfileStatus>;
|
|
64
|
+
getCloudProfileStatus(input: CloudProfileLookup): Promise<RemoteProfileStatus | undefined>;
|
|
65
|
+
listCloudProfileStatuses(hostUrlInput: string): Promise<RemoteProfileStatus[]>;
|
|
66
|
+
listProfileStatuses(): Promise<RemoteProfileStatus[]>;
|
|
67
|
+
logoutCloudProfile(input: CloudProfileLookup): Promise<boolean>;
|
|
68
|
+
clearSelectedCloudWorkspace(hostUrlInput: string): Promise<boolean>;
|
|
69
|
+
private selfHostedRefreshSnapshot;
|
|
70
|
+
private cloudRefreshSnapshot;
|
|
71
|
+
private findCloudStatus;
|
|
72
|
+
private migrateLegacyCloudProfile;
|
|
73
|
+
private clearMatchingLegacyCloudAuth;
|
|
74
|
+
private statusByKey;
|
|
75
|
+
private statusFor;
|
|
76
|
+
private writeSelfHostedProfile;
|
|
77
|
+
private writeCloudProfile;
|
|
78
|
+
private listProfilesForHost;
|
|
79
|
+
private readProfile;
|
|
80
|
+
private readProfileFile;
|
|
81
|
+
private readSelectedWorkspace;
|
|
82
|
+
private profilePath;
|
|
83
|
+
private selectedWorkspacePath;
|
|
84
|
+
private profilesDir;
|
|
85
|
+
private selectionsDir;
|
|
86
|
+
private writeJson;
|
|
87
|
+
private withMutationLock;
|
|
88
|
+
private withRefreshLock;
|
|
89
|
+
private acquireLock;
|
|
90
|
+
private releaseLock;
|
|
91
|
+
private clearStaleLock;
|
|
92
|
+
private lockPath;
|
|
93
|
+
private refreshLockPath;
|
|
94
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export type RemoteProfileKind = "cloud" | "self-hosted";
|
|
2
|
+
export type RemoteProfileKeyInput = {
|
|
3
|
+
kind: RemoteProfileKind;
|
|
4
|
+
hostUrl: string;
|
|
5
|
+
workspace?: string | undefined;
|
|
6
|
+
};
|
|
7
|
+
export type RemoteProfileCredential = {
|
|
8
|
+
accessToken?: string | undefined;
|
|
9
|
+
refreshToken?: string | undefined;
|
|
10
|
+
tokenType?: string | undefined;
|
|
11
|
+
expiresAt?: string | undefined;
|
|
12
|
+
scope?: string[] | undefined;
|
|
13
|
+
clientSecret?: string | undefined;
|
|
14
|
+
pairingCode?: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
export type RemoteProfileStatusInput = {
|
|
17
|
+
kind: RemoteProfileKind;
|
|
18
|
+
hostUrl: string;
|
|
19
|
+
key?: string | undefined;
|
|
20
|
+
workspaceId?: string | undefined;
|
|
21
|
+
workspaceSlug?: string | undefined;
|
|
22
|
+
clientId?: string | undefined;
|
|
23
|
+
selected?: boolean | undefined;
|
|
24
|
+
clientLabel?: string | undefined;
|
|
25
|
+
createdAt?: string | undefined;
|
|
26
|
+
updatedAt?: string | undefined;
|
|
27
|
+
credential?: RemoteProfileCredential | undefined;
|
|
28
|
+
};
|
|
29
|
+
export type RemoteProfileStatus = {
|
|
30
|
+
authenticated: boolean;
|
|
31
|
+
kind: RemoteProfileKind;
|
|
32
|
+
key: string;
|
|
33
|
+
hostUrl: string;
|
|
34
|
+
workspaceId?: string | undefined;
|
|
35
|
+
workspaceSlug?: string | undefined;
|
|
36
|
+
clientId?: string | undefined;
|
|
37
|
+
selected: boolean;
|
|
38
|
+
clientLabel?: string | undefined;
|
|
39
|
+
createdAt?: string | undefined;
|
|
40
|
+
updatedAt?: string | undefined;
|
|
41
|
+
expiresAt?: string | undefined;
|
|
42
|
+
scope?: string[] | undefined;
|
|
43
|
+
tokenType?: string | undefined;
|
|
44
|
+
};
|
|
45
|
+
export declare function remoteProfileKey(input: RemoteProfileKeyInput): string;
|
|
46
|
+
export declare function selectedWorkspaceKey(hostUrl: string): string;
|
|
47
|
+
export declare function remoteProfileStatus(input: RemoteProfileStatusInput): RemoteProfileStatus;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CloudAuthCredentials } from "../cloud-auth/store";
|
|
2
2
|
import { type ResolvedCapletsRemote } from "./options";
|
|
3
3
|
export type RemoteSelectionInput = {
|
|
4
4
|
mode?: string;
|
|
5
5
|
remoteUrl?: string;
|
|
6
|
-
user?: string;
|
|
7
|
-
password?: string;
|
|
8
|
-
token?: string;
|
|
9
6
|
workspace?: string;
|
|
10
7
|
fetch?: typeof fetch;
|
|
8
|
+
authDir?: string;
|
|
11
9
|
};
|
|
12
10
|
export type ResolvedRemoteSelection = {
|
|
13
11
|
kind: "self_hosted_remote";
|
|
14
12
|
remote: ResolvedCapletsRemote;
|
|
13
|
+
credentialExpiresAt?: string | undefined;
|
|
15
14
|
} | {
|
|
16
15
|
kind: "hosted_cloud";
|
|
17
16
|
remote: ResolvedCapletsRemote;
|
|
18
17
|
selectedWorkspace: string;
|
|
19
18
|
credentials: CloudAuthCredentials;
|
|
19
|
+
credentialExpiresAt?: string | undefined;
|
|
20
20
|
cloudPresence: {
|
|
21
21
|
url: URL;
|
|
22
22
|
accessToken: string;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { IssuedRemoteClientCredentials, RemoteClientStatus, ValidatedRemoteClient } from "./server-credentials";
|
|
2
|
+
export type RemoteServerCredentialStoreOptions = {
|
|
3
|
+
dir: string;
|
|
4
|
+
};
|
|
5
|
+
export type CreatePairingCodeInput = {
|
|
6
|
+
hostUrl: string;
|
|
7
|
+
clientLabel?: string | undefined;
|
|
8
|
+
ttlMs?: number | undefined;
|
|
9
|
+
maxAttempts?: number | undefined;
|
|
10
|
+
now?: Date | undefined;
|
|
11
|
+
};
|
|
12
|
+
export type ExchangePairingCodeInput = {
|
|
13
|
+
hostUrl: string;
|
|
14
|
+
code: string;
|
|
15
|
+
clientLabel?: string | undefined;
|
|
16
|
+
now?: Date | undefined;
|
|
17
|
+
};
|
|
18
|
+
export type ValidateAccessTokenInput = {
|
|
19
|
+
hostUrl: string;
|
|
20
|
+
accessToken: string;
|
|
21
|
+
now?: Date | undefined;
|
|
22
|
+
};
|
|
23
|
+
export type RefreshClientCredentialsInput = {
|
|
24
|
+
hostUrl: string;
|
|
25
|
+
refreshToken: string;
|
|
26
|
+
now?: Date | undefined;
|
|
27
|
+
};
|
|
28
|
+
type StoredPairingCode = {
|
|
29
|
+
codeId: string;
|
|
30
|
+
hostUrl: string;
|
|
31
|
+
secretHash: string;
|
|
32
|
+
clientLabel?: string | undefined;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
expiresAt: string;
|
|
35
|
+
attempts: number;
|
|
36
|
+
maxAttempts: number;
|
|
37
|
+
usedAt?: string | undefined;
|
|
38
|
+
};
|
|
39
|
+
type StoredRemoteClient = {
|
|
40
|
+
clientId: string;
|
|
41
|
+
clientLabel: string;
|
|
42
|
+
hostUrl: string;
|
|
43
|
+
accessTokenHash: string;
|
|
44
|
+
accessExpiresAt: string;
|
|
45
|
+
refreshTokenHash: string;
|
|
46
|
+
supersededRefreshTokenHashes: SupersededRefreshToken[];
|
|
47
|
+
refreshFamilyId: string;
|
|
48
|
+
createdAt: string;
|
|
49
|
+
lastUsedAt?: string | undefined;
|
|
50
|
+
revokedAt?: string | undefined;
|
|
51
|
+
};
|
|
52
|
+
type SupersededRefreshToken = {
|
|
53
|
+
hash: string;
|
|
54
|
+
supersededAt: string;
|
|
55
|
+
};
|
|
56
|
+
type RemoteServerCredentialState = {
|
|
57
|
+
version: 1;
|
|
58
|
+
pairingCodes: StoredPairingCode[];
|
|
59
|
+
clients: StoredRemoteClient[];
|
|
60
|
+
};
|
|
61
|
+
export declare class RemoteServerCredentialStore {
|
|
62
|
+
readonly dir: string;
|
|
63
|
+
constructor(options: RemoteServerCredentialStoreOptions);
|
|
64
|
+
createPairingCode(input: CreatePairingCodeInput): {
|
|
65
|
+
codeId: string;
|
|
66
|
+
code: string;
|
|
67
|
+
expiresAt: string;
|
|
68
|
+
};
|
|
69
|
+
exchangePairingCode(input: ExchangePairingCodeInput): IssuedRemoteClientCredentials;
|
|
70
|
+
listClients(): RemoteClientStatus[];
|
|
71
|
+
revokeClient(clientId: string, now?: Date): boolean;
|
|
72
|
+
validateAccessToken(input: ValidateAccessTokenInput): ValidatedRemoteClient;
|
|
73
|
+
refreshClientCredentials(input: RefreshClientCredentialsInput): IssuedRemoteClientCredentials;
|
|
74
|
+
dumpForTest(): RemoteServerCredentialState;
|
|
75
|
+
private loadState;
|
|
76
|
+
private saveState;
|
|
77
|
+
private statePath;
|
|
78
|
+
private lockPath;
|
|
79
|
+
private withStateLock;
|
|
80
|
+
private acquireLock;
|
|
81
|
+
private releaseLock;
|
|
82
|
+
private clearStaleLock;
|
|
83
|
+
}
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type IssuedRemoteClientCredentials = {
|
|
2
|
+
hostUrl: string;
|
|
3
|
+
clientId: string;
|
|
4
|
+
clientLabel: string;
|
|
5
|
+
accessToken: string;
|
|
6
|
+
refreshToken: string;
|
|
7
|
+
tokenType: "Bearer";
|
|
8
|
+
expiresAt: string;
|
|
9
|
+
createdAt: string;
|
|
10
|
+
};
|
|
11
|
+
export type RemoteClientStatus = {
|
|
12
|
+
clientId: string;
|
|
13
|
+
clientLabel: string;
|
|
14
|
+
hostUrl: string;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
lastUsedAt?: string | undefined;
|
|
17
|
+
revokedAt?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
export type ValidatedRemoteClient = RemoteClientStatus & {
|
|
20
|
+
tokenType: "Bearer";
|
|
21
|
+
};
|
|
@@ -4,8 +4,11 @@ export type RemoteControlClientOptions = {
|
|
|
4
4
|
requestInit: RequestInit;
|
|
5
5
|
fetch?: typeof fetch;
|
|
6
6
|
};
|
|
7
|
+
export type ResolvedRemoteControlClientOptions = RemoteControlClientOptions;
|
|
7
8
|
export declare class RemoteControlClient {
|
|
8
9
|
#private;
|
|
9
|
-
constructor(options: RemoteControlClientOptions
|
|
10
|
+
constructor(options: RemoteControlClientOptions | {
|
|
11
|
+
resolve: () => Promise<ResolvedRemoteControlClientOptions>;
|
|
12
|
+
});
|
|
10
13
|
request(command: RemoteCliCommand, args: RemoteCliRequest["arguments"]): Promise<unknown>;
|
|
11
14
|
}
|
package/dist/serve/http.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Hono } from "hono";
|
|
|
3
3
|
import { CapletsEngine, type CapletsEngineOptions } from "../engine";
|
|
4
4
|
import { type RemoteControlDispatchContext } from "../remote-control/dispatch";
|
|
5
5
|
import { RemoteAuthFlowStore } from "../remote-control/auth-flow";
|
|
6
|
+
import { RemoteServerCredentialStore } from "../remote/server-credential-store";
|
|
6
7
|
import type { HttpServeOptions } from "./options";
|
|
7
8
|
type HttpServeIo = {
|
|
8
9
|
writeErr?: (value: string) => void;
|
|
@@ -10,6 +11,7 @@ type HttpServeIo = {
|
|
|
10
11
|
authFlowStore?: RemoteAuthFlowStore;
|
|
11
12
|
sessionFactory?: HttpMcpSessionFactory;
|
|
12
13
|
exposeAttach?: boolean;
|
|
14
|
+
remoteCredentialStore?: RemoteServerCredentialStore;
|
|
13
15
|
};
|
|
14
16
|
type HttpMcpSession = {
|
|
15
17
|
connect(transport: StreamableHTTPTransport): Promise<void>;
|
|
@@ -32,6 +34,9 @@ export declare function servicePaths(base: string): {
|
|
|
32
34
|
attachEvents: string;
|
|
33
35
|
attachInvoke: string;
|
|
34
36
|
projectBindings: string;
|
|
37
|
+
pairingExchange: string;
|
|
38
|
+
remoteRefresh: string;
|
|
39
|
+
remoteClient: string;
|
|
35
40
|
health: string;
|
|
36
41
|
};
|
|
37
42
|
export {};
|
package/dist/serve/index.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type { CapletsEngineOptions } from "../engine";
|
|
2
2
|
import { type RawServeOptions, type ServeOptions } from "./options";
|
|
3
3
|
export { serveHttp } from "./http";
|
|
4
|
-
export {
|
|
4
|
+
export { resolveServeOptions } from "./options";
|
|
5
5
|
export type { HttpServeOptions, RawServeOptions, ServeOptions, StdioServeOptions } from "./options";
|
|
6
6
|
export { NativeCapletsMcpSession } from "./native-session";
|
|
7
7
|
export type { NativeCapletsMcpSessionOptions, NativeToolServer } from "./native-session";
|
|
8
8
|
export { serveStdio } from "./stdio";
|
|
9
|
-
export { buildDaemonPlatformDescriptor, daemonStatus, disableDaemon, enableDaemon, resolveServeDaemonPaths, restartDaemon, startDaemon, stopDaemon, } from "./daemon";
|
|
10
|
-
export type { DaemonPlatformDescriptor, DaemonProcessRunner, ServeDaemonConfig, ServeDaemonOperationOptions, ServeDaemonPaths, ServeDaemonState, ServeDaemonStatus, } from "./daemon";
|
|
11
9
|
export type ServeCapletsOptions = {
|
|
12
10
|
raw: RawServeOptions;
|
|
13
11
|
engine?: CapletsEngineOptions;
|
package/dist/serve/options.d.ts
CHANGED
|
@@ -4,8 +4,7 @@ export type RawServeOptions = {
|
|
|
4
4
|
host?: string;
|
|
5
5
|
port?: string | number;
|
|
6
6
|
path?: string;
|
|
7
|
-
|
|
8
|
-
password?: string;
|
|
7
|
+
remoteStatePath?: string;
|
|
9
8
|
allowUnauthenticatedHttp?: boolean;
|
|
10
9
|
trustProxy?: boolean;
|
|
11
10
|
};
|
|
@@ -18,22 +17,18 @@ export type HttpServeOptions = {
|
|
|
18
17
|
port: number;
|
|
19
18
|
path: string;
|
|
20
19
|
publicOrigin?: string | undefined;
|
|
21
|
-
auth:
|
|
20
|
+
auth: HttpServeAuthOptions;
|
|
21
|
+
remoteCredentialStateDir?: string | undefined;
|
|
22
22
|
allowUnauthenticatedHttp: boolean;
|
|
23
23
|
warnUnauthenticatedNetwork: boolean;
|
|
24
24
|
loopback: boolean;
|
|
25
25
|
trustProxy: boolean;
|
|
26
26
|
};
|
|
27
|
-
export type
|
|
28
|
-
|
|
29
|
-
user: string;
|
|
27
|
+
export type HttpServeAuthOptions = {
|
|
28
|
+
type: "remote_credentials";
|
|
30
29
|
} | {
|
|
31
|
-
|
|
32
|
-
user: string;
|
|
33
|
-
password: string;
|
|
30
|
+
type: "development_unauthenticated";
|
|
34
31
|
};
|
|
35
32
|
export type ServeOptions = StdioServeOptions | HttpServeOptions;
|
|
36
|
-
export type ServeEnv = Partial<Record<"CAPLETS_SERVER_URL" | "
|
|
33
|
+
export type ServeEnv = Partial<Record<"CAPLETS_SERVER_URL" | "CAPLETS_REMOTE_SERVER_STATE_DIR", string>>;
|
|
37
34
|
export declare function resolveServeOptions(raw: RawServeOptions, env?: ServeEnv): ServeOptions;
|
|
38
|
-
export declare function resolveDaemonServeOptions(raw: RawServeOptions, env?: ServeEnv): HttpServeOptions;
|
|
39
|
-
export declare function isLoopbackHost(host: string): boolean;
|
package/dist/server/options.d.ts
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
export type CapletsMode = "auto" | "local" | "remote";
|
|
2
|
-
export type CapletsServerEnv = Partial<Record<"CAPLETS_MODE" | "CAPLETS_SERVER_URL" | "
|
|
2
|
+
export type CapletsServerEnv = Partial<Record<"CAPLETS_MODE" | "CAPLETS_SERVER_URL" | "CAPLETS_CLOUD_URL" | "CAPLETS_CLOUD_TOKEN" | "CAPLETS_CLOUD_WORKSPACE_ID" | "CAPLETS_PROJECT_ROOT", string>>;
|
|
3
3
|
export type CapletsModeInput = {
|
|
4
4
|
mode?: string;
|
|
5
5
|
serverUrl?: string;
|
|
6
6
|
};
|
|
7
7
|
export type CapletsServerInput = {
|
|
8
8
|
url?: string;
|
|
9
|
-
user?: string;
|
|
10
|
-
password?: string;
|
|
11
9
|
fetch?: typeof fetch;
|
|
12
10
|
};
|
|
13
11
|
export type CapletsServerAuth = {
|
|
14
|
-
|
|
15
|
-
user: string;
|
|
16
|
-
} | {
|
|
17
|
-
enabled: true;
|
|
18
|
-
user: string;
|
|
19
|
-
password: string;
|
|
12
|
+
type: "none";
|
|
20
13
|
};
|
|
21
14
|
export type ResolvedCapletsServer = {
|
|
22
15
|
baseUrl: URL;
|