@caplets/core 0.18.8 → 0.19.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 +10 -0
- package/dist/attach/server.d.ts +5 -0
- package/dist/caplet-files-bundle.d.ts +415 -0
- package/dist/caplet-files.d.ts +3 -266
- package/dist/caplet-source/bundle.d.ts +7 -0
- package/dist/caplet-source/filesystem.d.ts +7 -0
- package/dist/caplet-source/filesystem.js +2 -0
- package/dist/caplet-source/index.d.ts +4 -0
- package/dist/caplet-source/parse.d.ts +35 -0
- package/dist/caplet-source/types.d.ts +9 -0
- package/dist/caplet-source.js +11231 -0
- package/dist/cli/commands.d.ts +9 -2
- package/dist/cli/doctor.d.ts +18 -0
- package/dist/cli/setup-caplet.d.ts +12 -0
- package/dist/cli/setup.d.ts +23 -0
- package/dist/cli.d.ts +9 -1
- package/dist/cloud/apply.d.ts +36 -0
- package/dist/cloud/client.d.ts +30 -0
- package/dist/cloud/presence.d.ts +29 -0
- package/dist/cloud/project-root.d.ts +2 -0
- package/dist/cloud/runtime-adapter.d.ts +23 -0
- package/dist/cloud/runtime-http.d.ts +6 -0
- package/dist/cloud/sync.d.ts +10 -0
- package/dist/cloud-auth/client.d.ts +42 -0
- package/dist/cloud-auth/errors.d.ts +11 -0
- package/dist/cloud-auth/open-url.d.ts +7 -0
- package/dist/cloud-auth/store.d.ts +35 -0
- package/dist/cloud-auth/types.d.ts +66 -0
- package/dist/{completion-DvWQk5qR.js → completion-brgziz4L.js} +32 -6
- package/dist/config-runtime.d.ts +174 -0
- package/dist/config-runtime.js +392 -0
- package/dist/config.d.ts +42 -0
- package/dist/filesystem-Kkg32TOJ.js +66 -0
- package/dist/generated-tool-input-schema.d.ts +9 -9
- package/dist/generated-tool-input-schema.js +161 -1
- package/dist/index.d.ts +35 -0
- package/dist/index.js +6132 -3196
- package/dist/native/options.d.ts +22 -3
- package/dist/native/remote.d.ts +2 -1
- package/dist/native/service.d.ts +7 -3
- package/dist/native.js +2 -430
- package/dist/project-binding/attach.d.ts +46 -0
- package/dist/project-binding/errors.d.ts +17 -0
- package/dist/project-binding/gitignore.d.ts +5 -0
- package/dist/project-binding/mutagen.d.ts +65 -0
- package/dist/project-binding/routes.d.ts +9 -0
- package/dist/project-binding/session.d.ts +82 -0
- package/dist/project-binding/sync-filter.d.ts +19 -0
- package/dist/project-binding/sync-size.d.ts +27 -0
- package/dist/project-binding/transport.d.ts +21 -0
- package/dist/project-binding/types.d.ts +31 -0
- package/dist/project-binding/workspaces.d.ts +60 -0
- package/dist/remote/options.d.ts +42 -0
- package/dist/remote/selection.d.ts +26 -0
- package/dist/remote-control/types.d.ts +1 -1
- package/dist/runtime-plan/features.d.ts +7 -0
- package/dist/runtime-plan/index.d.ts +4 -0
- package/dist/runtime-plan/planner.d.ts +5 -0
- package/dist/runtime-plan/resources.d.ts +11 -0
- package/dist/runtime-plan/types.d.ts +82 -0
- package/dist/runtime-plan.js +275 -0
- package/dist/{generated-tool-input-schema-MbYF5jMW.js → schemas-BZ6BBrh7.js} +1 -161
- package/dist/serve/daemon/config.d.ts +8 -0
- package/dist/serve/daemon/index.d.ts +16 -0
- package/dist/serve/daemon/paths.d.ts +3 -0
- package/dist/serve/daemon/platform-darwin.d.ts +2 -0
- package/dist/serve/daemon/platform-linux.d.ts +2 -0
- package/dist/serve/daemon/platform-windows.d.ts +2 -0
- package/dist/serve/daemon/platform.d.ts +9 -0
- package/dist/serve/daemon/process.d.ts +5 -0
- package/dist/serve/daemon/types.d.ts +86 -0
- package/dist/serve/http.d.ts +8 -0
- package/dist/serve/index.d.ts +5 -1
- package/dist/serve/native-session.d.ts +19 -0
- package/dist/serve/options.d.ts +1 -0
- package/dist/server/options.d.ts +1 -1
- package/dist/{options--RoZwWjs.js → service-BXcE4Rv8.js} +9932 -2218
- package/dist/setup/hash.d.ts +3 -0
- package/dist/setup/local-store.d.ts +34 -0
- package/dist/setup/runner.d.ts +40 -0
- package/dist/setup/types.d.ts +52 -0
- package/dist/tools.d.ts +17 -2
- package/dist/validation-BBG4skZf.js +153 -0
- package/package.json +21 -5
package/dist/cli/commands.d.ts
CHANGED
|
@@ -4,11 +4,15 @@ export declare const cliCommands: {
|
|
|
4
4
|
readonly completion: "completion";
|
|
5
5
|
readonly completeHidden: "__complete";
|
|
6
6
|
readonly serve: "serve";
|
|
7
|
+
readonly attach: "attach";
|
|
8
|
+
readonly cloud: "cloud";
|
|
7
9
|
readonly init: "init";
|
|
10
|
+
readonly setup: "setup";
|
|
11
|
+
readonly doctor: "doctor";
|
|
8
12
|
readonly list: "list";
|
|
9
13
|
readonly install: "install";
|
|
10
14
|
readonly add: "add";
|
|
11
|
-
readonly
|
|
15
|
+
readonly inspect: "inspect";
|
|
12
16
|
readonly checkBackend: "check-backend";
|
|
13
17
|
readonly listTools: "list-tools";
|
|
14
18
|
readonly searchTools: "search-tools";
|
|
@@ -25,12 +29,15 @@ export declare const cliCommands: {
|
|
|
25
29
|
readonly config: "config";
|
|
26
30
|
readonly auth: "auth";
|
|
27
31
|
};
|
|
28
|
-
export declare const topLevelCommandNames: readonly ["serve", "init", "list", "install", "add", "
|
|
32
|
+
export declare const topLevelCommandNames: readonly ["serve", "attach", "cloud", "init", "setup", "doctor", "list", "install", "add", "inspect", "check-backend", "list-tools", "search-tools", "get-tool", "call-tool", "list-resources", "search-resources", "list-resource-templates", "read-resource", "list-prompts", "search-prompts", "get-prompt", "complete", "config", "auth", "completion"];
|
|
29
33
|
export declare const cliSubcommands: {
|
|
30
34
|
readonly add: readonly ["cli", "mcp", "openapi", "graphql", "http"];
|
|
31
35
|
readonly auth: readonly ["login", "logout", "list"];
|
|
36
|
+
readonly cloud: readonly ["auth"];
|
|
32
37
|
readonly completion: readonly ["bash", "zsh", "fish", "powershell", "cmd"];
|
|
33
38
|
readonly config: readonly ["path", "paths"];
|
|
39
|
+
readonly serve: readonly ["start", "stop", "status", "restart", "enable", "disable"];
|
|
40
|
+
readonly setup: readonly ["codex", "claude-code", "opencode", "pi", "mcp-client"];
|
|
34
41
|
};
|
|
35
42
|
export declare const capletIdCommands: Set<string>;
|
|
36
43
|
export declare const qualifiedToolCommands: Set<string>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CloudAuthStore } from "../cloud-auth/store";
|
|
2
|
+
import type { MutagenProjectSyncDoctorData } from "../project-binding/mutagen";
|
|
3
|
+
export type DoctorOptions = {
|
|
4
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
5
|
+
cwd?: string;
|
|
6
|
+
syncStatus?: MutagenProjectSyncDoctorData;
|
|
7
|
+
cloudAuthStore?: CloudAuthStore;
|
|
8
|
+
};
|
|
9
|
+
export type DoctorJsonReport = {
|
|
10
|
+
server: Record<string, unknown>;
|
|
11
|
+
remote: Record<string, unknown>;
|
|
12
|
+
projectBinding: Record<string, unknown>;
|
|
13
|
+
sync: Record<string, unknown>;
|
|
14
|
+
daemon: Record<string, unknown>;
|
|
15
|
+
cloudAuth: Record<string, unknown>;
|
|
16
|
+
};
|
|
17
|
+
export declare function doctorJsonReport(options?: DoctorOptions): Promise<DoctorJsonReport>;
|
|
18
|
+
export declare function formatDoctorReport(options?: DoctorOptions): Promise<string>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type SetupSpawn } from "../setup/runner";
|
|
2
|
+
import type { SetupTargetKind } from "../setup/types";
|
|
3
|
+
export type CapletSetupCliOptions = {
|
|
4
|
+
yes?: boolean;
|
|
5
|
+
target?: SetupTargetKind;
|
|
6
|
+
remote?: boolean;
|
|
7
|
+
configPath?: string | undefined;
|
|
8
|
+
projectConfigPath?: string | undefined;
|
|
9
|
+
baseDir?: string | undefined;
|
|
10
|
+
spawn?: SetupSpawn;
|
|
11
|
+
};
|
|
12
|
+
export declare function runCapletSetupCli(capletId: string, options?: CapletSetupCliOptions): Promise<string>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type SetupTargetKind } from "../setup/types";
|
|
2
|
+
export declare const setupIntegrationIds: readonly ["codex", "claude-code", "opencode", "pi", "mcp-client"];
|
|
3
|
+
export type SetupIntegrationId = (typeof setupIntegrationIds)[number];
|
|
4
|
+
export type SetupFormat = "plain" | "json";
|
|
5
|
+
export type SetupTargetOption = SetupTargetKind | "local" | "remote" | "cloud" | "hosted_worker";
|
|
6
|
+
export type SetupCommandResult = {
|
|
7
|
+
stdout: string;
|
|
8
|
+
stderr: string;
|
|
9
|
+
};
|
|
10
|
+
export type SetupCommandRunner = (command: string, args: string[]) => Promise<SetupCommandResult>;
|
|
11
|
+
export type SetupOptions = {
|
|
12
|
+
remote?: boolean;
|
|
13
|
+
serverUrl?: string;
|
|
14
|
+
output?: string;
|
|
15
|
+
dryRun?: boolean;
|
|
16
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
17
|
+
format?: SetupFormat;
|
|
18
|
+
runCommand?: SetupCommandRunner;
|
|
19
|
+
yes?: boolean;
|
|
20
|
+
target?: SetupTargetOption;
|
|
21
|
+
};
|
|
22
|
+
export declare function formatSetupMenu(): string;
|
|
23
|
+
export declare function runSetup(integration: string, options?: SetupOptions): Promise<string>;
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
import { type
|
|
2
|
+
import { type SetupCommandRunner } from "./cli/setup";
|
|
3
|
+
import { type AttachServeOptions } from "./attach/options";
|
|
4
|
+
import type { ProjectBindingWebSocketFactory } from "./project-binding/transport";
|
|
5
|
+
import { type ServeDaemonOperationOptions, type ServeOptions } from "./serve";
|
|
3
6
|
export { initConfig, starterConfig } from "./cli/init";
|
|
4
7
|
export { installCaplets, normalizeGitRepo } from "./cli/install";
|
|
5
8
|
export { addCliCaplet, addGraphqlCaplet, addHttpCaplet, addMcpCaplet, addOpenApiCaplet, } from "./cli/add";
|
|
@@ -8,10 +11,15 @@ type CliIO = {
|
|
|
8
11
|
writeErr?: (value: string) => void;
|
|
9
12
|
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
10
13
|
fetch?: typeof fetch;
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
projectBindingWebSocketFactory?: ProjectBindingWebSocketFactory;
|
|
11
16
|
authDir?: string;
|
|
12
17
|
version?: string;
|
|
13
18
|
setExitCode?: (code: number) => void;
|
|
14
19
|
serve?: (options: ServeOptions) => Promise<void>;
|
|
20
|
+
attachServe?: (options: AttachServeOptions) => Promise<void>;
|
|
21
|
+
daemon?: ServeDaemonOperationOptions;
|
|
22
|
+
runSetupCommand?: SetupCommandRunner;
|
|
15
23
|
};
|
|
16
24
|
export declare function runCli(args: string[], io?: CliIO): Promise<void>;
|
|
17
25
|
export declare function createProgram(io?: CliIO): Command;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type ApplyReceiptInput = {
|
|
2
|
+
projectFingerprint: string;
|
|
3
|
+
filesChanged: string[];
|
|
4
|
+
skipped: string[];
|
|
5
|
+
policyWarnings: string[];
|
|
6
|
+
};
|
|
7
|
+
export type ApplyReceipt = ApplyReceiptInput & {
|
|
8
|
+
status: "applied";
|
|
9
|
+
};
|
|
10
|
+
export type ApplyConflict = {
|
|
11
|
+
path: string;
|
|
12
|
+
kind: "content" | "delete_modify" | "binary";
|
|
13
|
+
message?: string;
|
|
14
|
+
};
|
|
15
|
+
export type RemoteFileChange = {
|
|
16
|
+
path: string;
|
|
17
|
+
baseSha256?: string;
|
|
18
|
+
content: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function createApplyReceipt(input: ApplyReceiptInput): ApplyReceipt;
|
|
21
|
+
export declare function classifyApplyResult(input: {
|
|
22
|
+
conflicts: ApplyConflict[];
|
|
23
|
+
}): {
|
|
24
|
+
status: "applied";
|
|
25
|
+
recoverable: false;
|
|
26
|
+
} | {
|
|
27
|
+
status: "apply_conflict";
|
|
28
|
+
recoverable: true;
|
|
29
|
+
conflicts: ApplyConflict[];
|
|
30
|
+
};
|
|
31
|
+
export declare function applyRemoteFileChanges(projectRoot: string, changes: RemoteFileChange[]): ApplyReceipt | {
|
|
32
|
+
status: "apply_conflict";
|
|
33
|
+
recoverable: true;
|
|
34
|
+
conflicts: ApplyConflict[];
|
|
35
|
+
};
|
|
36
|
+
export declare function sha256(value: string): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ProjectSyncFile } from "./sync";
|
|
2
|
+
export type CapletsCloudClientOptions = {
|
|
3
|
+
baseUrl: URL;
|
|
4
|
+
accessToken: string;
|
|
5
|
+
fetch?: typeof fetch;
|
|
6
|
+
};
|
|
7
|
+
export type RegisterPresenceInput = {
|
|
8
|
+
workspaceId: string;
|
|
9
|
+
projectRoot: string;
|
|
10
|
+
projectFingerprint: string;
|
|
11
|
+
allowedCapletIds: string[];
|
|
12
|
+
projectFiles?: ProjectSyncFile[] | undefined;
|
|
13
|
+
fallbackConsent?: "allow" | "deny" | undefined;
|
|
14
|
+
};
|
|
15
|
+
export type RegisterPresenceResult = {
|
|
16
|
+
presenceId: string;
|
|
17
|
+
expiresAt: string;
|
|
18
|
+
};
|
|
19
|
+
export type HeartbeatPresenceResult = RegisterPresenceResult;
|
|
20
|
+
export declare class CapletsCloudClient {
|
|
21
|
+
private readonly options;
|
|
22
|
+
private readonly fetchImpl;
|
|
23
|
+
constructor(options: CapletsCloudClientOptions);
|
|
24
|
+
registerPresence(input: RegisterPresenceInput): Promise<RegisterPresenceResult>;
|
|
25
|
+
stopPresence(presenceId: string): Promise<void>;
|
|
26
|
+
heartbeatPresence(presenceId: string): Promise<HeartbeatPresenceResult>;
|
|
27
|
+
updatePresenceCaplets(presenceId: string, allowedCapletIds: string[]): Promise<void>;
|
|
28
|
+
private headers;
|
|
29
|
+
private endpoint;
|
|
30
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { CapletsCloudClient, RegisterPresenceInput } from "./client";
|
|
2
|
+
type PresenceClient = Pick<CapletsCloudClient, "registerPresence"> & {
|
|
3
|
+
heartbeatPresence?: (presenceId: string) => Promise<unknown>;
|
|
4
|
+
stopPresence?: (presenceId: string) => Promise<void>;
|
|
5
|
+
updatePresenceCaplets?: (presenceId: string, allowedCapletIds: string[]) => Promise<void>;
|
|
6
|
+
};
|
|
7
|
+
export type ProjectBindingSessionManagerOptions = RegisterPresenceInput & {
|
|
8
|
+
client: PresenceClient;
|
|
9
|
+
heartbeatIntervalMs?: number;
|
|
10
|
+
setInterval?: typeof setInterval;
|
|
11
|
+
clearInterval?: typeof clearInterval;
|
|
12
|
+
onError?: (error: unknown) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare class ProjectBindingSessionManager {
|
|
15
|
+
private readonly options;
|
|
16
|
+
private presenceId;
|
|
17
|
+
private heartbeatTimer;
|
|
18
|
+
private startPromise;
|
|
19
|
+
constructor(options: ProjectBindingSessionManagerOptions);
|
|
20
|
+
start(): Promise<void>;
|
|
21
|
+
private register;
|
|
22
|
+
close(): Promise<void>;
|
|
23
|
+
updateAllowedCapletIds(allowedCapletIds: string[]): Promise<void>;
|
|
24
|
+
private startHeartbeat;
|
|
25
|
+
private stopHeartbeat;
|
|
26
|
+
}
|
|
27
|
+
export type LocalPresenceManagerOptions = ProjectBindingSessionManagerOptions;
|
|
28
|
+
export declare const LocalPresenceManager: typeof ProjectBindingSessionManager;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LocalSetupStore } from "../setup/local-store";
|
|
2
|
+
import type { SetupActor, SetupAttempt, SetupPlan } from "../setup/types";
|
|
3
|
+
export type CloudRuntimeAdapterOptions = {
|
|
4
|
+
configPath?: string;
|
|
5
|
+
projectConfigPath?: string;
|
|
6
|
+
authDir?: string;
|
|
7
|
+
runtimeId: string;
|
|
8
|
+
sandboxId?: string;
|
|
9
|
+
executionKind: "cloud" | "local-fallback";
|
|
10
|
+
setupStore?: LocalSetupStore;
|
|
11
|
+
};
|
|
12
|
+
export type CloudRuntimeAdapter = {
|
|
13
|
+
listTools(): Promise<unknown>;
|
|
14
|
+
callTool(name: string, args: unknown): Promise<unknown>;
|
|
15
|
+
checkBackend(capletId: string): Promise<unknown>;
|
|
16
|
+
setupPlan(capletId: string): Promise<SetupPlan>;
|
|
17
|
+
runSetup(capletId: string, input: {
|
|
18
|
+
approved: boolean;
|
|
19
|
+
actor: SetupActor;
|
|
20
|
+
}): Promise<SetupAttempt[]>;
|
|
21
|
+
close(): Promise<void>;
|
|
22
|
+
};
|
|
23
|
+
export declare function createCloudRuntimeAdapter(options: CloudRuntimeAdapterOptions): CloudRuntimeAdapter;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { type CloudRuntimeAdapterOptions } from "./runtime-adapter";
|
|
3
|
+
export type RuntimeHttpOptions = CloudRuntimeAdapterOptions & {
|
|
4
|
+
token: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function createRuntimeHttpApp(options: RuntimeHttpOptions): Hono;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ProjectSyncFile = {
|
|
2
|
+
path: string;
|
|
3
|
+
content: string;
|
|
4
|
+
};
|
|
5
|
+
export declare class ProjectSyncCoordinator {
|
|
6
|
+
private readonly queues;
|
|
7
|
+
runMutating<T>(projectId: string, task: () => Promise<T>): Promise<T>;
|
|
8
|
+
}
|
|
9
|
+
export declare function projectSyncManifest(projectRoot: string): string[];
|
|
10
|
+
export declare function projectSyncFiles(projectRoot: string): ProjectSyncFile[];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { CloudAuthLoginPollResult, CloudAuthLoginStart, CloudAuthTokenResponse, CloudAuthWorkspace } from "./types";
|
|
2
|
+
export type CloudAuthClientOptions = {
|
|
3
|
+
cloudUrl: string;
|
|
4
|
+
fetch?: typeof fetch;
|
|
5
|
+
};
|
|
6
|
+
export type StartLoginInput = {
|
|
7
|
+
requestedWorkspace?: string | undefined;
|
|
8
|
+
deviceName?: string | undefined;
|
|
9
|
+
scope?: string[] | undefined;
|
|
10
|
+
};
|
|
11
|
+
export type ExchangeTokenInput = {
|
|
12
|
+
loginId: string;
|
|
13
|
+
oneTimeCode: string;
|
|
14
|
+
};
|
|
15
|
+
export type RefreshTokenInput = {
|
|
16
|
+
refreshToken: string;
|
|
17
|
+
};
|
|
18
|
+
export type CloudAuthClientCredentials = Required<Pick<CloudAuthTokenResponse, "workspaceId" | "accessToken" | "expiresAt" | "tokenType" | "credentialFamilyId">> & Pick<CloudAuthTokenResponse, "workspaceSlug" | "refreshToken" | "deviceName" | "requestId"> & {
|
|
19
|
+
cloudUrl: string;
|
|
20
|
+
scope: string[];
|
|
21
|
+
redacted: Record<string, unknown>;
|
|
22
|
+
};
|
|
23
|
+
export declare class CloudAuthClient {
|
|
24
|
+
private readonly cloudUrl;
|
|
25
|
+
private readonly fetchImpl;
|
|
26
|
+
constructor(options: CloudAuthClientOptions);
|
|
27
|
+
startLogin(input?: StartLoginInput): Promise<CloudAuthLoginStart>;
|
|
28
|
+
pollLogin(loginId: string): Promise<CloudAuthLoginPollResult>;
|
|
29
|
+
exchangeToken(input: ExchangeTokenInput): Promise<CloudAuthClientCredentials>;
|
|
30
|
+
refresh(input: RefreshTokenInput): Promise<CloudAuthClientCredentials>;
|
|
31
|
+
logout(refreshToken: string): Promise<void>;
|
|
32
|
+
workspaces(accessToken: string): Promise<{
|
|
33
|
+
workspaces: CloudAuthWorkspace[];
|
|
34
|
+
}>;
|
|
35
|
+
switchWorkspace(input: {
|
|
36
|
+
accessToken: string;
|
|
37
|
+
workspace: string;
|
|
38
|
+
refreshToken?: string | undefined;
|
|
39
|
+
deviceName?: string | undefined;
|
|
40
|
+
}): Promise<CloudAuthClientCredentials>;
|
|
41
|
+
private requestJson;
|
|
42
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CapletsError } from "../errors";
|
|
2
|
+
export type CloudAuthErrorCode = "cloud_auth_required" | "cloud_auth_expired" | "cloud_auth_revoked" | "workspace_selection_required" | "workspace_switch_required" | "workspace_forbidden" | "endpoint_unavailable";
|
|
3
|
+
export type CloudAuthRecovery = {
|
|
4
|
+
code: CloudAuthErrorCode;
|
|
5
|
+
message: string;
|
|
6
|
+
recoveryCommand: string;
|
|
7
|
+
requestId?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
export declare function redactCloudAuthSecrets(value: unknown): unknown;
|
|
10
|
+
export declare function cloudAuthRecovery(code: CloudAuthErrorCode, detail?: string): CloudAuthRecovery;
|
|
11
|
+
export declare function cloudAuthError(code: CloudAuthErrorCode, detail?: string): CapletsError;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { RedactedCloudAuthStatus } from "./types";
|
|
2
|
+
type CloudAuthPathEnv = Partial<Record<"CAPLETS_CLOUD_AUTH_PATH" | "XDG_CONFIG_HOME" | "APPDATA", string>>;
|
|
3
|
+
export type CloudAuthCredentials = {
|
|
4
|
+
version?: 1 | 2 | undefined;
|
|
5
|
+
cloudUrl: string;
|
|
6
|
+
workspaceId: string;
|
|
7
|
+
workspaceSlug?: string | undefined;
|
|
8
|
+
accessToken: string;
|
|
9
|
+
refreshToken: string;
|
|
10
|
+
expiresAt: string;
|
|
11
|
+
scope?: string[] | undefined;
|
|
12
|
+
tokenType?: string | undefined;
|
|
13
|
+
credentialFamilyId?: string | undefined;
|
|
14
|
+
deviceName?: string | undefined;
|
|
15
|
+
createdAt?: string | undefined;
|
|
16
|
+
lastRefreshAt?: string | undefined;
|
|
17
|
+
selectedWorkspaceSwitchedAt?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
export type CloudAuthStoreOptions = {
|
|
20
|
+
path?: string;
|
|
21
|
+
env?: CloudAuthPathEnv;
|
|
22
|
+
home?: string;
|
|
23
|
+
platform?: NodeJS.Platform;
|
|
24
|
+
};
|
|
25
|
+
export declare class CloudAuthStore {
|
|
26
|
+
readonly path: string;
|
|
27
|
+
constructor(options?: CloudAuthStoreOptions);
|
|
28
|
+
load(): Promise<CloudAuthCredentials | undefined>;
|
|
29
|
+
save(credentials: CloudAuthCredentials): Promise<void>;
|
|
30
|
+
clear(): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
export declare function migrateCredentials(value: unknown): CloudAuthCredentials;
|
|
33
|
+
export declare function redactedCloudAuthStatus(credentials: CloudAuthCredentials | undefined, now?: Date): RedactedCloudAuthStatus;
|
|
34
|
+
export declare function cloudAuthPath(options?: CloudAuthStoreOptions): string;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export declare const CLOUD_AUTH_STATES: readonly ["unauthenticated", "login_pending", "workspace_selection_required", "authenticated", "refreshable", "switch_required", "expired", "revoked"];
|
|
2
|
+
export type CloudAuthState = (typeof CLOUD_AUTH_STATES)[number];
|
|
3
|
+
export type CloudAuthScope = "project_binding:read" | "project_binding:write" | string;
|
|
4
|
+
export type CloudAuthWorkspace = {
|
|
5
|
+
workspaceId: string;
|
|
6
|
+
slug?: string | undefined;
|
|
7
|
+
displayName?: string | undefined;
|
|
8
|
+
name?: string | undefined;
|
|
9
|
+
role?: string | undefined;
|
|
10
|
+
selected?: boolean | undefined;
|
|
11
|
+
};
|
|
12
|
+
export type CloudAuthLoginStart = {
|
|
13
|
+
loginId: string;
|
|
14
|
+
loginUrl: string;
|
|
15
|
+
userCode: string;
|
|
16
|
+
expiresAt: string;
|
|
17
|
+
requestId?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
export type CloudAuthLoginPollResult = {
|
|
20
|
+
status: "pending";
|
|
21
|
+
expiresAt?: string | undefined;
|
|
22
|
+
requestId?: string | undefined;
|
|
23
|
+
} | {
|
|
24
|
+
status: "workspace_selection_required";
|
|
25
|
+
workspaces: CloudAuthWorkspace[];
|
|
26
|
+
expiresAt?: string | undefined;
|
|
27
|
+
requestId?: string | undefined;
|
|
28
|
+
} | {
|
|
29
|
+
status: "completed";
|
|
30
|
+
selectedWorkspace?: Pick<CloudAuthWorkspace, "workspaceId" | "slug"> | undefined;
|
|
31
|
+
oneTimeCode: string;
|
|
32
|
+
requestId?: string | undefined;
|
|
33
|
+
} | {
|
|
34
|
+
status: "expired" | "denied" | "consumed";
|
|
35
|
+
message?: string | undefined;
|
|
36
|
+
requestId?: string | undefined;
|
|
37
|
+
};
|
|
38
|
+
export type CloudAuthTokenResponse = {
|
|
39
|
+
status?: "authenticated" | undefined;
|
|
40
|
+
cloudUrl?: string | undefined;
|
|
41
|
+
workspaceId: string;
|
|
42
|
+
workspaceSlug?: string | undefined;
|
|
43
|
+
accessToken: string;
|
|
44
|
+
refreshToken?: string | undefined;
|
|
45
|
+
expiresAt: string;
|
|
46
|
+
scope?: CloudAuthScope[] | string | undefined;
|
|
47
|
+
tokenType?: "Bearer" | string | undefined;
|
|
48
|
+
credentialFamilyId?: string | undefined;
|
|
49
|
+
deviceName?: string | undefined;
|
|
50
|
+
requestId?: string | undefined;
|
|
51
|
+
};
|
|
52
|
+
export type RedactedCloudAuthStatus = {
|
|
53
|
+
authenticated: boolean;
|
|
54
|
+
status: CloudAuthState;
|
|
55
|
+
cloudUrl?: string | undefined;
|
|
56
|
+
workspaceId?: string | undefined;
|
|
57
|
+
workspaceSlug?: string | undefined;
|
|
58
|
+
expiresAt?: string | undefined;
|
|
59
|
+
scope?: CloudAuthScope[] | undefined;
|
|
60
|
+
tokenType?: string | undefined;
|
|
61
|
+
credentialFamilyId?: string | undefined;
|
|
62
|
+
deviceName?: string | undefined;
|
|
63
|
+
createdAt?: string | undefined;
|
|
64
|
+
lastRefreshAt?: string | undefined;
|
|
65
|
+
selectedWorkspaceSwitchedAt?: string | undefined;
|
|
66
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bt as DEFAULT_COMPLETION_CACHE_DIR, Gt as resolveConfigPath, Pt as loadConfigWithSources, Wt as resolveCapletsRoot, en as __exportAll, qt as resolveProjectConfigPath, zt as DEFAULT_AUTH_DIR } from "./service-BXcE4Rv8.js";
|
|
2
|
+
import { u as CapletsError } from "./validation-BBG4skZf.js";
|
|
2
3
|
import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
3
4
|
import { dirname, join } from "node:path";
|
|
4
5
|
import { createHash } from "node:crypto";
|
|
@@ -14,11 +15,15 @@ const cliCommands = {
|
|
|
14
15
|
completion: "completion",
|
|
15
16
|
completeHidden: "__complete",
|
|
16
17
|
serve: "serve",
|
|
18
|
+
attach: "attach",
|
|
19
|
+
cloud: "cloud",
|
|
17
20
|
init: "init",
|
|
21
|
+
setup: "setup",
|
|
22
|
+
doctor: "doctor",
|
|
18
23
|
list: "list",
|
|
19
24
|
install: "install",
|
|
20
25
|
add: "add",
|
|
21
|
-
|
|
26
|
+
inspect: "inspect",
|
|
22
27
|
checkBackend: "check-backend",
|
|
23
28
|
listTools: "list-tools",
|
|
24
29
|
searchTools: "search-tools",
|
|
@@ -37,11 +42,15 @@ const cliCommands = {
|
|
|
37
42
|
};
|
|
38
43
|
const topLevelCommandNames = [
|
|
39
44
|
cliCommands.serve,
|
|
45
|
+
cliCommands.attach,
|
|
46
|
+
cliCommands.cloud,
|
|
40
47
|
cliCommands.init,
|
|
48
|
+
cliCommands.setup,
|
|
49
|
+
cliCommands.doctor,
|
|
41
50
|
cliCommands.list,
|
|
42
51
|
cliCommands.install,
|
|
43
52
|
cliCommands.add,
|
|
44
|
-
cliCommands.
|
|
53
|
+
cliCommands.inspect,
|
|
45
54
|
cliCommands.checkBackend,
|
|
46
55
|
cliCommands.listTools,
|
|
47
56
|
cliCommands.searchTools,
|
|
@@ -72,11 +81,27 @@ const cliSubcommands = {
|
|
|
72
81
|
"logout",
|
|
73
82
|
"list"
|
|
74
83
|
],
|
|
84
|
+
[cliCommands.cloud]: ["auth"],
|
|
75
85
|
[cliCommands.completion]: [...completionShells],
|
|
76
|
-
[cliCommands.config]: ["path", "paths"]
|
|
86
|
+
[cliCommands.config]: ["path", "paths"],
|
|
87
|
+
[cliCommands.serve]: [
|
|
88
|
+
"start",
|
|
89
|
+
"stop",
|
|
90
|
+
"status",
|
|
91
|
+
"restart",
|
|
92
|
+
"enable",
|
|
93
|
+
"disable"
|
|
94
|
+
],
|
|
95
|
+
[cliCommands.setup]: [
|
|
96
|
+
"codex",
|
|
97
|
+
"claude-code",
|
|
98
|
+
"opencode",
|
|
99
|
+
"pi",
|
|
100
|
+
"mcp-client"
|
|
101
|
+
]
|
|
77
102
|
};
|
|
78
103
|
const capletIdCommands = new Set([
|
|
79
|
-
cliCommands.
|
|
104
|
+
cliCommands.inspect,
|
|
80
105
|
cliCommands.checkBackend,
|
|
81
106
|
cliCommands.listTools,
|
|
82
107
|
cliCommands.searchTools,
|
|
@@ -439,6 +464,7 @@ const optionValueSuggestions = {
|
|
|
439
464
|
"json"
|
|
440
465
|
] },
|
|
441
466
|
serve: { "--transport": ["stdio", "http"] },
|
|
467
|
+
setup: { "--format": ["plain", "json"] },
|
|
442
468
|
"add:mcp": { "--transport": ["http", "sse"] },
|
|
443
469
|
"add:cli": { "--include": [
|
|
444
470
|
"git",
|
|
@@ -562,7 +588,7 @@ function cmdCompletionScript() {
|
|
|
562
588
|
REM caplets cmd completion helper
|
|
563
589
|
REM cmd.exe has no native programmable completion API. This doskey macro prints suggestions for the current words.
|
|
564
590
|
doskey caplets-complete=caplets __complete --shell cmd -- $* 2^>nul
|
|
565
|
-
REM Usage: caplets-complete
|
|
591
|
+
REM Usage: caplets-complete inspect
|
|
566
592
|
`;
|
|
567
593
|
}
|
|
568
594
|
//#endregion
|