@caplets/core 0.18.9 → 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.
Files changed (82) hide show
  1. package/dist/attach/options.d.ts +10 -0
  2. package/dist/attach/server.d.ts +5 -0
  3. package/dist/caplet-files-bundle.d.ts +415 -0
  4. package/dist/caplet-files.d.ts +3 -266
  5. package/dist/caplet-source/bundle.d.ts +7 -0
  6. package/dist/caplet-source/filesystem.d.ts +7 -0
  7. package/dist/caplet-source/filesystem.js +2 -0
  8. package/dist/caplet-source/index.d.ts +4 -0
  9. package/dist/caplet-source/parse.d.ts +35 -0
  10. package/dist/caplet-source/types.d.ts +9 -0
  11. package/dist/caplet-source.js +11231 -0
  12. package/dist/cli/commands.d.ts +6 -1
  13. package/dist/cli/doctor.d.ts +18 -0
  14. package/dist/cli/setup-caplet.d.ts +12 -0
  15. package/dist/cli/setup.d.ts +4 -0
  16. package/dist/cli.d.ts +7 -1
  17. package/dist/cloud/apply.d.ts +36 -0
  18. package/dist/cloud/client.d.ts +30 -0
  19. package/dist/cloud/presence.d.ts +29 -0
  20. package/dist/cloud/project-root.d.ts +2 -0
  21. package/dist/cloud/runtime-adapter.d.ts +23 -0
  22. package/dist/cloud/runtime-http.d.ts +6 -0
  23. package/dist/cloud/sync.d.ts +10 -0
  24. package/dist/cloud-auth/client.d.ts +42 -0
  25. package/dist/cloud-auth/errors.d.ts +11 -0
  26. package/dist/cloud-auth/open-url.d.ts +7 -0
  27. package/dist/cloud-auth/store.d.ts +35 -0
  28. package/dist/cloud-auth/types.d.ts +66 -0
  29. package/dist/{completion-RqzHpHRY.js → completion-brgziz4L.js} +17 -1
  30. package/dist/config-runtime.d.ts +174 -0
  31. package/dist/config-runtime.js +392 -0
  32. package/dist/config.d.ts +42 -0
  33. package/dist/filesystem-Kkg32TOJ.js +66 -0
  34. package/dist/generated-tool-input-schema.js +161 -1
  35. package/dist/index.d.ts +35 -0
  36. package/dist/index.js +2999 -266
  37. package/dist/native/options.d.ts +22 -3
  38. package/dist/native/remote.d.ts +2 -1
  39. package/dist/native/service.d.ts +7 -3
  40. package/dist/native.js +2 -430
  41. package/dist/project-binding/attach.d.ts +46 -0
  42. package/dist/project-binding/errors.d.ts +17 -0
  43. package/dist/project-binding/gitignore.d.ts +5 -0
  44. package/dist/project-binding/mutagen.d.ts +65 -0
  45. package/dist/project-binding/routes.d.ts +9 -0
  46. package/dist/project-binding/session.d.ts +82 -0
  47. package/dist/project-binding/sync-filter.d.ts +19 -0
  48. package/dist/project-binding/sync-size.d.ts +27 -0
  49. package/dist/project-binding/transport.d.ts +21 -0
  50. package/dist/project-binding/types.d.ts +31 -0
  51. package/dist/project-binding/workspaces.d.ts +60 -0
  52. package/dist/remote/options.d.ts +42 -0
  53. package/dist/remote/selection.d.ts +26 -0
  54. package/dist/runtime-plan/features.d.ts +7 -0
  55. package/dist/runtime-plan/index.d.ts +4 -0
  56. package/dist/runtime-plan/planner.d.ts +5 -0
  57. package/dist/runtime-plan/resources.d.ts +11 -0
  58. package/dist/runtime-plan/types.d.ts +82 -0
  59. package/dist/runtime-plan.js +275 -0
  60. package/dist/{generated-tool-input-schema--kVuUNc5.js → schemas-BZ6BBrh7.js} +1 -161
  61. package/dist/serve/daemon/config.d.ts +8 -0
  62. package/dist/serve/daemon/index.d.ts +16 -0
  63. package/dist/serve/daemon/paths.d.ts +3 -0
  64. package/dist/serve/daemon/platform-darwin.d.ts +2 -0
  65. package/dist/serve/daemon/platform-linux.d.ts +2 -0
  66. package/dist/serve/daemon/platform-windows.d.ts +2 -0
  67. package/dist/serve/daemon/platform.d.ts +9 -0
  68. package/dist/serve/daemon/process.d.ts +5 -0
  69. package/dist/serve/daemon/types.d.ts +86 -0
  70. package/dist/serve/http.d.ts +8 -0
  71. package/dist/serve/index.d.ts +5 -1
  72. package/dist/serve/native-session.d.ts +19 -0
  73. package/dist/serve/options.d.ts +1 -0
  74. package/dist/server/options.d.ts +1 -1
  75. package/dist/{options-DnOUjft1.js → service-BXcE4Rv8.js} +9891 -2182
  76. package/dist/setup/hash.d.ts +3 -0
  77. package/dist/setup/local-store.d.ts +34 -0
  78. package/dist/setup/runner.d.ts +40 -0
  79. package/dist/setup/types.d.ts +52 -0
  80. package/dist/tools.d.ts +16 -1
  81. package/dist/validation-BBG4skZf.js +153 -0
  82. package/package.json +20 -4
@@ -4,8 +4,11 @@ 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";
8
10
  readonly setup: "setup";
11
+ readonly doctor: "doctor";
9
12
  readonly list: "list";
10
13
  readonly install: "install";
11
14
  readonly add: "add";
@@ -26,12 +29,14 @@ export declare const cliCommands: {
26
29
  readonly config: "config";
27
30
  readonly auth: "auth";
28
31
  };
29
- export declare const topLevelCommandNames: readonly ["serve", "init", "setup", "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"];
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"];
30
33
  export declare const cliSubcommands: {
31
34
  readonly add: readonly ["cli", "mcp", "openapi", "graphql", "http"];
32
35
  readonly auth: readonly ["login", "logout", "list"];
36
+ readonly cloud: readonly ["auth"];
33
37
  readonly completion: readonly ["bash", "zsh", "fish", "powershell", "cmd"];
34
38
  readonly config: readonly ["path", "paths"];
39
+ readonly serve: readonly ["start", "stop", "status", "restart", "enable", "disable"];
35
40
  readonly setup: readonly ["codex", "claude-code", "opencode", "pi", "mcp-client"];
36
41
  };
37
42
  export declare const capletIdCommands: 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>;
@@ -1,6 +1,8 @@
1
+ import { type SetupTargetKind } from "../setup/types";
1
2
  export declare const setupIntegrationIds: readonly ["codex", "claude-code", "opencode", "pi", "mcp-client"];
2
3
  export type SetupIntegrationId = (typeof setupIntegrationIds)[number];
3
4
  export type SetupFormat = "plain" | "json";
5
+ export type SetupTargetOption = SetupTargetKind | "local" | "remote" | "cloud" | "hosted_worker";
4
6
  export type SetupCommandResult = {
5
7
  stdout: string;
6
8
  stderr: string;
@@ -14,6 +16,8 @@ export type SetupOptions = {
14
16
  env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
15
17
  format?: SetupFormat;
16
18
  runCommand?: SetupCommandRunner;
19
+ yes?: boolean;
20
+ target?: SetupTargetOption;
17
21
  };
18
22
  export declare function formatSetupMenu(): string;
19
23
  export declare function runSetup(integration: string, options?: SetupOptions): Promise<string>;
package/dist/cli.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { Command } from "commander";
2
2
  import { type SetupCommandRunner } from "./cli/setup";
3
- import { type ServeOptions } from "./serve";
3
+ import { type AttachServeOptions } from "./attach/options";
4
+ import type { ProjectBindingWebSocketFactory } from "./project-binding/transport";
5
+ import { type ServeDaemonOperationOptions, type ServeOptions } from "./serve";
4
6
  export { initConfig, starterConfig } from "./cli/init";
5
7
  export { installCaplets, normalizeGitRepo } from "./cli/install";
6
8
  export { addCliCaplet, addGraphqlCaplet, addHttpCaplet, addMcpCaplet, addOpenApiCaplet, } from "./cli/add";
@@ -9,10 +11,14 @@ type CliIO = {
9
11
  writeErr?: (value: string) => void;
10
12
  env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
11
13
  fetch?: typeof fetch;
14
+ signal?: AbortSignal;
15
+ projectBindingWebSocketFactory?: ProjectBindingWebSocketFactory;
12
16
  authDir?: string;
13
17
  version?: string;
14
18
  setExitCode?: (code: number) => void;
15
19
  serve?: (options: ServeOptions) => Promise<void>;
20
+ attachServe?: (options: AttachServeOptions) => Promise<void>;
21
+ daemon?: ServeDaemonOperationOptions;
16
22
  runSetupCommand?: SetupCommandRunner;
17
23
  };
18
24
  export declare function runCli(args: string[], io?: CliIO): Promise<void>;
@@ -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,2 @@
1
+ export declare function findProjectRoot(start?: string): string;
2
+ export declare function fingerprintProjectRoot(root: string): string;
@@ -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,7 @@
1
+ export type OpenUrlResult = {
2
+ opened: boolean;
3
+ command?: string | undefined;
4
+ };
5
+ export declare function openBrowserUrl(url: string, options?: {
6
+ opener?: (url: string) => Promise<OpenUrlResult> | OpenUrlResult;
7
+ }): Promise<OpenUrlResult>;
@@ -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 { Ct as resolveCapletsRoot, Et as resolveProjectConfigPath, Lt as __exportAll, Pt as CapletsError, St as DEFAULT_COMPLETION_CACHE_DIR, gt as loadConfigWithSources, wt as resolveConfigPath, xt as DEFAULT_AUTH_DIR } from "./options-DnOUjft1.js";
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,8 +15,11 @@ const cliCommands = {
14
15
  completion: "completion",
15
16
  completeHidden: "__complete",
16
17
  serve: "serve",
18
+ attach: "attach",
19
+ cloud: "cloud",
17
20
  init: "init",
18
21
  setup: "setup",
22
+ doctor: "doctor",
19
23
  list: "list",
20
24
  install: "install",
21
25
  add: "add",
@@ -38,8 +42,11 @@ const cliCommands = {
38
42
  };
39
43
  const topLevelCommandNames = [
40
44
  cliCommands.serve,
45
+ cliCommands.attach,
46
+ cliCommands.cloud,
41
47
  cliCommands.init,
42
48
  cliCommands.setup,
49
+ cliCommands.doctor,
43
50
  cliCommands.list,
44
51
  cliCommands.install,
45
52
  cliCommands.add,
@@ -74,8 +81,17 @@ const cliSubcommands = {
74
81
  "logout",
75
82
  "list"
76
83
  ],
84
+ [cliCommands.cloud]: ["auth"],
77
85
  [cliCommands.completion]: [...completionShells],
78
86
  [cliCommands.config]: ["path", "paths"],
87
+ [cliCommands.serve]: [
88
+ "start",
89
+ "stop",
90
+ "status",
91
+ "restart",
92
+ "enable",
93
+ "disable"
94
+ ],
79
95
  [cliCommands.setup]: [
80
96
  "codex",
81
97
  "claude-code",
@@ -0,0 +1,174 @@
1
+ export type RemoteAuthConfig = {
2
+ type: "none";
3
+ } | {
4
+ type: "bearer";
5
+ token: string;
6
+ } | {
7
+ type: "headers";
8
+ headers: Record<string, string>;
9
+ } | {
10
+ type: "oauth2" | "oidc";
11
+ authorizationUrl?: string | undefined;
12
+ tokenUrl?: string | undefined;
13
+ issuer?: string | undefined;
14
+ resourceMetadataUrl?: string | undefined;
15
+ authorizationServerMetadataUrl?: string | undefined;
16
+ openidConfigurationUrl?: string | undefined;
17
+ clientMetadataUrl?: string | undefined;
18
+ clientId?: string | undefined;
19
+ clientSecret?: string | undefined;
20
+ scopes?: string[] | undefined;
21
+ redirectUri?: string | undefined;
22
+ };
23
+ export type CapletSetupCommandConfig = {
24
+ label: string;
25
+ command: string;
26
+ args?: string[] | undefined;
27
+ env?: Record<string, string> | undefined;
28
+ cwd?: string | undefined;
29
+ timeoutMs?: number | undefined;
30
+ maxOutputBytes?: number | undefined;
31
+ };
32
+ export type CapletSetupConfig = {
33
+ commands?: CapletSetupCommandConfig[] | undefined;
34
+ verify?: CapletSetupCommandConfig[] | undefined;
35
+ };
36
+ export type ProjectBindingConfig = {
37
+ required: true;
38
+ };
39
+ export type RuntimeFeature = "docker" | "browser";
40
+ export type RuntimeResourceClass = "standard" | "large" | "heavy";
41
+ export type RuntimeRequirementsConfig = {
42
+ features?: RuntimeFeature[] | undefined;
43
+ resources?: {
44
+ class?: RuntimeResourceClass | undefined;
45
+ } | undefined;
46
+ };
47
+ export type CapletServerConfig = CommonCapletConfig & {
48
+ backend: "mcp";
49
+ transport: "stdio" | "http" | "sse";
50
+ command?: string | undefined;
51
+ args?: string[] | undefined;
52
+ env?: Record<string, string> | undefined;
53
+ cwd?: string | undefined;
54
+ url?: string | undefined;
55
+ auth?: RemoteAuthConfig | undefined;
56
+ startupTimeoutMs: number;
57
+ callTimeoutMs: number;
58
+ toolCacheTtlMs: number;
59
+ };
60
+ export type OpenApiAuthConfig = RemoteAuthConfig;
61
+ export type OpenApiEndpointConfig = CommonCapletConfig & {
62
+ backend: "openapi";
63
+ specPath?: string | undefined;
64
+ specUrl?: string | undefined;
65
+ baseUrl?: string | undefined;
66
+ auth: OpenApiAuthConfig;
67
+ requestTimeoutMs: number;
68
+ operationCacheTtlMs: number;
69
+ };
70
+ export type GraphQlOperationConfig = {
71
+ document?: string | undefined;
72
+ documentPath?: string | undefined;
73
+ operationName?: string | undefined;
74
+ description?: string | undefined;
75
+ };
76
+ export type GraphQlEndpointConfig = CommonCapletConfig & {
77
+ backend: "graphql";
78
+ endpointUrl: string;
79
+ schemaPath?: string | undefined;
80
+ schemaUrl?: string | undefined;
81
+ introspection?: true | undefined;
82
+ operations?: Record<string, GraphQlOperationConfig> | undefined;
83
+ auth: OpenApiAuthConfig;
84
+ requestTimeoutMs: number;
85
+ operationCacheTtlMs: number;
86
+ selectionDepth: number;
87
+ };
88
+ export type HttpActionConfig = {
89
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
90
+ path: string;
91
+ description?: string | undefined;
92
+ inputSchema?: Record<string, unknown> | undefined;
93
+ outputSchema?: Record<string, unknown> | undefined;
94
+ query?: Record<string, string | number | boolean> | undefined;
95
+ headers?: Record<string, string | number | boolean> | undefined;
96
+ jsonBody?: unknown;
97
+ };
98
+ export type HttpApiConfig = CommonCapletConfig & {
99
+ backend: "http";
100
+ baseUrl: string;
101
+ auth: OpenApiAuthConfig;
102
+ actions: Record<string, HttpActionConfig>;
103
+ requestTimeoutMs: number;
104
+ maxResponseBytes: number;
105
+ };
106
+ export type CliToolActionConfig = {
107
+ description?: string | undefined;
108
+ inputSchema?: Record<string, unknown> | undefined;
109
+ outputSchema?: Record<string, unknown> | undefined;
110
+ command: string;
111
+ args?: string[] | undefined;
112
+ env?: Record<string, string> | undefined;
113
+ cwd?: string | undefined;
114
+ timeoutMs?: number | undefined;
115
+ maxOutputBytes?: number | undefined;
116
+ output?: {
117
+ type: "text" | "json";
118
+ } | undefined;
119
+ annotations?: {
120
+ readOnlyHint?: boolean | undefined;
121
+ destructiveHint?: boolean | undefined;
122
+ idempotentHint?: boolean | undefined;
123
+ openWorldHint?: boolean | undefined;
124
+ } | undefined;
125
+ };
126
+ export type CliToolsConfig = CommonCapletConfig & {
127
+ backend: "cli";
128
+ actions: Record<string, CliToolActionConfig>;
129
+ cwd?: string | undefined;
130
+ env?: Record<string, string> | undefined;
131
+ timeoutMs: number;
132
+ maxOutputBytes: number;
133
+ };
134
+ export type CapletSetConfig = CommonCapletConfig & {
135
+ backend: "caplets";
136
+ configPath?: string | undefined;
137
+ capletsRoot?: string | undefined;
138
+ defaultSearchLimit: number;
139
+ maxSearchLimit: number;
140
+ toolCacheTtlMs: number;
141
+ };
142
+ export type CapletConfig = CapletServerConfig | OpenApiEndpointConfig | GraphQlEndpointConfig | HttpApiConfig | CliToolsConfig | CapletSetConfig;
143
+ export type CapletsConfig = {
144
+ version: 1;
145
+ options: {
146
+ defaultSearchLimit: number;
147
+ maxSearchLimit: number;
148
+ completion: {
149
+ discoveryTimeoutMs: number;
150
+ overallTimeoutMs: number;
151
+ cacheTtlMs: number;
152
+ negativeCacheTtlMs: number;
153
+ };
154
+ };
155
+ mcpServers: Record<string, CapletServerConfig>;
156
+ openapiEndpoints: Record<string, OpenApiEndpointConfig>;
157
+ graphqlEndpoints: Record<string, GraphQlEndpointConfig>;
158
+ httpApis: Record<string, HttpApiConfig>;
159
+ cliTools: Record<string, CliToolsConfig>;
160
+ capletSets: Record<string, CapletSetConfig>;
161
+ };
162
+ type CommonCapletConfig = {
163
+ server: string;
164
+ name: string;
165
+ description: string;
166
+ tags?: string[] | undefined;
167
+ body?: string | undefined;
168
+ setup?: CapletSetupConfig | undefined;
169
+ projectBinding?: ProjectBindingConfig | undefined;
170
+ runtime?: RuntimeRequirementsConfig | undefined;
171
+ disabled: boolean;
172
+ };
173
+ export declare function parseConfig(input: unknown): CapletsConfig;
174
+ export {};