@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
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { ResolvedCapletsRemote } from "../remote/options";
|
|
2
|
+
import type { BindingTerminalReason, ProjectBindingState, ProjectBindingSyncState } from "./types";
|
|
3
|
+
import { type ProjectBindingWebSocketFactory } from "./transport";
|
|
4
|
+
export type ProjectBindingSessionEvent = {
|
|
5
|
+
type: "state";
|
|
6
|
+
state: ProjectBindingState;
|
|
7
|
+
message?: string | undefined;
|
|
8
|
+
requestId?: string;
|
|
9
|
+
} | {
|
|
10
|
+
type: "ready";
|
|
11
|
+
bindingId: string;
|
|
12
|
+
sessionId: string;
|
|
13
|
+
projectRoot: string;
|
|
14
|
+
projectFingerprint: string;
|
|
15
|
+
webSocketUrl: string;
|
|
16
|
+
requestId?: string | undefined;
|
|
17
|
+
} | {
|
|
18
|
+
type: "reconnecting";
|
|
19
|
+
bindingId: string;
|
|
20
|
+
sessionId: string;
|
|
21
|
+
attempt: number;
|
|
22
|
+
reason: string;
|
|
23
|
+
requestId?: string | undefined;
|
|
24
|
+
} | {
|
|
25
|
+
type: "heartbeat";
|
|
26
|
+
bindingId: string;
|
|
27
|
+
sessionId: string;
|
|
28
|
+
state: ProjectBindingState;
|
|
29
|
+
} | {
|
|
30
|
+
type: "ended";
|
|
31
|
+
bindingId?: string;
|
|
32
|
+
sessionId?: string;
|
|
33
|
+
reason: BindingTerminalReason;
|
|
34
|
+
};
|
|
35
|
+
export type ProjectBindingSocketServerMessage = {
|
|
36
|
+
type: "state";
|
|
37
|
+
state: ProjectBindingState;
|
|
38
|
+
syncState: ProjectBindingSyncState;
|
|
39
|
+
requestId?: string | undefined;
|
|
40
|
+
} | {
|
|
41
|
+
type: "ready";
|
|
42
|
+
bindingId: string;
|
|
43
|
+
sessionId: string;
|
|
44
|
+
syncState: ProjectBindingSyncState;
|
|
45
|
+
requestId?: string | undefined;
|
|
46
|
+
} | {
|
|
47
|
+
type: "blocked";
|
|
48
|
+
reason: BindingTerminalReason;
|
|
49
|
+
} | {
|
|
50
|
+
type: "ended";
|
|
51
|
+
reason: BindingTerminalReason;
|
|
52
|
+
};
|
|
53
|
+
export type ProjectBindingSocketClientMessage = {
|
|
54
|
+
type: "heartbeat";
|
|
55
|
+
bindingId: string;
|
|
56
|
+
sessionId: string;
|
|
57
|
+
state: ProjectBindingState;
|
|
58
|
+
syncState: ProjectBindingSyncState;
|
|
59
|
+
} | {
|
|
60
|
+
type: "end";
|
|
61
|
+
bindingId: string;
|
|
62
|
+
sessionId: string;
|
|
63
|
+
reason: BindingTerminalReason;
|
|
64
|
+
};
|
|
65
|
+
export type RunProjectBindingSessionInput = {
|
|
66
|
+
projectRoot: string;
|
|
67
|
+
remote: ResolvedCapletsRemote;
|
|
68
|
+
fetch?: typeof fetch | undefined;
|
|
69
|
+
webSocketFactory?: ProjectBindingWebSocketFactory | undefined;
|
|
70
|
+
signal?: AbortSignal | undefined;
|
|
71
|
+
heartbeatIntervalMs?: number | undefined;
|
|
72
|
+
onEvent?: ((event: ProjectBindingSessionEvent) => void) | undefined;
|
|
73
|
+
};
|
|
74
|
+
export declare function runProjectBindingSession(input: RunProjectBindingSessionInput): Promise<{
|
|
75
|
+
ok: true;
|
|
76
|
+
bindingId: string;
|
|
77
|
+
sessionId: string;
|
|
78
|
+
projectRoot: string;
|
|
79
|
+
projectFingerprint: string;
|
|
80
|
+
webSocketUrl: string;
|
|
81
|
+
ended: true;
|
|
82
|
+
}>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type ProjectSyncExclusionSource = "hard_denylist" | "gitignore" | "capletsignore";
|
|
2
|
+
export type ProjectSyncExclusionSummary = {
|
|
3
|
+
source: ProjectSyncExclusionSource;
|
|
4
|
+
pattern: string;
|
|
5
|
+
count: number;
|
|
6
|
+
};
|
|
7
|
+
export type ProjectSyncManifestFile = {
|
|
8
|
+
relativePath: string;
|
|
9
|
+
sizeBytes: number;
|
|
10
|
+
};
|
|
11
|
+
export type ProjectSyncManifest = {
|
|
12
|
+
projectRoot: string;
|
|
13
|
+
files: ProjectSyncManifestFile[];
|
|
14
|
+
totalBytes: number;
|
|
15
|
+
exclusionSummary: ProjectSyncExclusionSummary[];
|
|
16
|
+
};
|
|
17
|
+
export declare function buildProjectSyncManifest(input: {
|
|
18
|
+
projectRoot: string;
|
|
19
|
+
}): ProjectSyncManifest;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ProjectBindingErrorCode } from "./errors";
|
|
2
|
+
import type { ProjectSyncManifestFile } from "./sync-filter";
|
|
3
|
+
export type ProjectSyncTier = "free" | "plus" | "pro" | "enterprise" | "self_hosted";
|
|
4
|
+
export type ProjectSyncLimits = {
|
|
5
|
+
maxSingleFileBytes: number;
|
|
6
|
+
maxProjectBytes: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const DEFAULT_SYNC_LIMITS: Record<ProjectSyncTier, ProjectSyncLimits>;
|
|
9
|
+
export type ProjectSyncSizeResult = {
|
|
10
|
+
ok: true;
|
|
11
|
+
totalBytes: number;
|
|
12
|
+
maxSingleFileBytes: number;
|
|
13
|
+
maxProjectBytes: number;
|
|
14
|
+
} | {
|
|
15
|
+
ok: false;
|
|
16
|
+
code: ProjectBindingErrorCode;
|
|
17
|
+
totalBytes: number;
|
|
18
|
+
maxSingleFileBytes: number;
|
|
19
|
+
maxProjectBytes: number;
|
|
20
|
+
largestFileBytes?: number | undefined;
|
|
21
|
+
recoveryCommand: string;
|
|
22
|
+
};
|
|
23
|
+
export declare function enforceProjectSyncSizeLimits(input: {
|
|
24
|
+
tier: ProjectSyncTier;
|
|
25
|
+
files: ProjectSyncManifestFile[];
|
|
26
|
+
limits?: Partial<ProjectSyncLimits> | undefined;
|
|
27
|
+
}): ProjectSyncSizeResult;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type ProjectBindingSocketEvent = {
|
|
2
|
+
data?: unknown;
|
|
3
|
+
code?: number | undefined;
|
|
4
|
+
reason?: string | undefined;
|
|
5
|
+
};
|
|
6
|
+
export type ProjectBindingWebSocket = {
|
|
7
|
+
readonly readyState?: number;
|
|
8
|
+
send(data: string): void;
|
|
9
|
+
close(code?: number, reason?: string): void;
|
|
10
|
+
addEventListener?: (type: "open" | "message" | "close" | "error", listener: (event: ProjectBindingSocketEvent) => void, options?: {
|
|
11
|
+
once?: boolean;
|
|
12
|
+
}) => void;
|
|
13
|
+
removeEventListener?: (type: "open" | "message" | "close" | "error", listener: (event: ProjectBindingSocketEvent) => void) => void;
|
|
14
|
+
onopen?: ((event: ProjectBindingSocketEvent) => void) | null;
|
|
15
|
+
onmessage?: ((event: ProjectBindingSocketEvent) => void) | null;
|
|
16
|
+
onclose?: ((event: ProjectBindingSocketEvent) => void) | null;
|
|
17
|
+
onerror?: ((event: ProjectBindingSocketEvent) => void) | null;
|
|
18
|
+
};
|
|
19
|
+
export type ProjectBindingWebSocketFactory = (url: string, protocols?: string | string[] | undefined) => ProjectBindingWebSocket;
|
|
20
|
+
export declare const PROJECT_BINDING_SOCKET_OPEN = 1;
|
|
21
|
+
export declare function defaultProjectBindingWebSocketFactory(url: string, protocols?: string | string[] | undefined): ProjectBindingWebSocket;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type ProjectBindingState = "not_attached" | "attaching" | "syncing" | "ready" | "degraded" | "blocked" | "offline" | "cleaning_up" | "ended" | "expired";
|
|
2
|
+
export declare const PROJECT_BINDING_STATES: readonly ProjectBindingState[];
|
|
3
|
+
export declare const PROJECT_BINDING_SYNC_STATES: readonly ["not_started", "pending", "syncing", "idle", "failed"];
|
|
4
|
+
export type ProjectBindingSyncState = (typeof PROJECT_BINDING_SYNC_STATES)[number];
|
|
5
|
+
export type BindingTerminalReason = {
|
|
6
|
+
code: import("./errors").ProjectBindingErrorCode | "interrupted" | "completed";
|
|
7
|
+
message: string;
|
|
8
|
+
recoveryCommand?: string | undefined;
|
|
9
|
+
requestId?: string | undefined;
|
|
10
|
+
};
|
|
11
|
+
export type ProjectBindingLease = {
|
|
12
|
+
bindingId: string;
|
|
13
|
+
projectFingerprint: string;
|
|
14
|
+
state: ProjectBindingState;
|
|
15
|
+
active: boolean;
|
|
16
|
+
updatedAt: string;
|
|
17
|
+
expiresAt?: string;
|
|
18
|
+
diagnosticCode?: string;
|
|
19
|
+
};
|
|
20
|
+
export type ProjectBindingWorkspaceMetadata = {
|
|
21
|
+
projectFingerprint: string;
|
|
22
|
+
projectRoot: string;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
lastActiveAt: string;
|
|
25
|
+
};
|
|
26
|
+
export type ProjectBindingSetupReceipt = {
|
|
27
|
+
capletId: string;
|
|
28
|
+
status: "succeeded" | "failed" | "skipped";
|
|
29
|
+
recordedAt?: string;
|
|
30
|
+
contentHash?: string;
|
|
31
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ProjectBindingLease, ProjectBindingSetupReceipt } from "./types";
|
|
2
|
+
type PathEnv = Partial<Record<"XDG_STATE_HOME" | "LOCALAPPDATA", string>>;
|
|
3
|
+
export type ProjectBindingWorkspaceRootOptions = {
|
|
4
|
+
env?: PathEnv;
|
|
5
|
+
platform?: NodeJS.Platform;
|
|
6
|
+
homedir?: string;
|
|
7
|
+
root?: string;
|
|
8
|
+
};
|
|
9
|
+
export type ProjectBindingWorkspacePaths = {
|
|
10
|
+
projectFingerprint: string;
|
|
11
|
+
root: string;
|
|
12
|
+
project: string;
|
|
13
|
+
metadata: string;
|
|
14
|
+
leases: string;
|
|
15
|
+
setup: string;
|
|
16
|
+
setupReceipts: string;
|
|
17
|
+
lease(bindingId: string): string;
|
|
18
|
+
};
|
|
19
|
+
export type ProjectBindingWorkspaceStoreOptions = ProjectBindingWorkspaceRootOptions & {
|
|
20
|
+
now?: () => Date;
|
|
21
|
+
staleLeaseTtlMs?: number;
|
|
22
|
+
inactiveWorkspaceTtlMs?: number;
|
|
23
|
+
softDiskCapBytes?: number;
|
|
24
|
+
workspaceSizeBytes?: (paths: ProjectBindingWorkspacePaths) => number;
|
|
25
|
+
};
|
|
26
|
+
export type EnsureProjectBindingWorkspaceInput = {
|
|
27
|
+
projectFingerprint: string;
|
|
28
|
+
projectRoot: string;
|
|
29
|
+
lastActiveAt?: string;
|
|
30
|
+
createdAt?: string;
|
|
31
|
+
};
|
|
32
|
+
export type ProjectBindingCleanupResult = {
|
|
33
|
+
expiredLeases: string[];
|
|
34
|
+
deletedWorkspaces: string[];
|
|
35
|
+
retainedWorkspaces: string[];
|
|
36
|
+
};
|
|
37
|
+
export declare function projectBindingWorkspaceRoot(options?: ProjectBindingWorkspaceRootOptions): string;
|
|
38
|
+
export declare function projectBindingWorkspacePaths(projectFingerprint: string, options?: ProjectBindingWorkspaceRootOptions): ProjectBindingWorkspacePaths;
|
|
39
|
+
export declare class ProjectBindingWorkspaceStore {
|
|
40
|
+
private readonly options;
|
|
41
|
+
private readonly root;
|
|
42
|
+
private readonly now;
|
|
43
|
+
private readonly staleLeaseTtlMs;
|
|
44
|
+
private readonly inactiveWorkspaceTtlMs;
|
|
45
|
+
private readonly softDiskCapBytes;
|
|
46
|
+
private readonly workspaceSizeBytes;
|
|
47
|
+
constructor(options?: ProjectBindingWorkspaceStoreOptions);
|
|
48
|
+
paths(projectFingerprint: string): ProjectBindingWorkspacePaths;
|
|
49
|
+
ensureWorkspace(input: EnsureProjectBindingWorkspaceInput): Promise<ProjectBindingWorkspacePaths>;
|
|
50
|
+
writeLease(lease: ProjectBindingLease): Promise<void>;
|
|
51
|
+
listLeases(projectFingerprint: string): Promise<ProjectBindingLease[]>;
|
|
52
|
+
writeSetupReceipts(projectFingerprint: string, receipts: ProjectBindingSetupReceipt[]): Promise<void>;
|
|
53
|
+
cleanup(): Promise<ProjectBindingCleanupResult>;
|
|
54
|
+
private readMetadata;
|
|
55
|
+
private workspacePaths;
|
|
56
|
+
private leasesFor;
|
|
57
|
+
private isStaleLease;
|
|
58
|
+
private isInactiveWorkspace;
|
|
59
|
+
}
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type CapletsRemoteEnv = Partial<Record<"CAPLETS_MODE" | "CAPLETS_REMOTE_URL" | "CAPLETS_REMOTE_USER" | "CAPLETS_REMOTE_PASSWORD" | "CAPLETS_REMOTE_TOKEN" | "CAPLETS_REMOTE_WORKSPACE" | "CAPLETS_SERVER_URL", string>>;
|
|
2
|
+
export type CapletsRemoteModeInput = {
|
|
3
|
+
mode?: string;
|
|
4
|
+
remoteUrl?: string;
|
|
5
|
+
};
|
|
6
|
+
export type CapletsRemoteMode = "local" | "remote" | "cloud";
|
|
7
|
+
export type CapletsRemoteInput = {
|
|
8
|
+
url?: string;
|
|
9
|
+
user?: string;
|
|
10
|
+
password?: string;
|
|
11
|
+
token?: string;
|
|
12
|
+
workspace?: string;
|
|
13
|
+
fetch?: typeof fetch;
|
|
14
|
+
};
|
|
15
|
+
export type CapletsRemoteAuth = {
|
|
16
|
+
type: "none";
|
|
17
|
+
user: string;
|
|
18
|
+
} | {
|
|
19
|
+
type: "basic";
|
|
20
|
+
user: string;
|
|
21
|
+
password: string;
|
|
22
|
+
} | {
|
|
23
|
+
type: "bearer";
|
|
24
|
+
token: string;
|
|
25
|
+
};
|
|
26
|
+
export type ResolvedCapletsRemote = {
|
|
27
|
+
baseUrl: URL;
|
|
28
|
+
mcpUrl: URL;
|
|
29
|
+
controlUrl: URL;
|
|
30
|
+
healthUrl: URL;
|
|
31
|
+
projectBindingWebSocketUrl: URL;
|
|
32
|
+
auth: CapletsRemoteAuth;
|
|
33
|
+
requestInit: RequestInit;
|
|
34
|
+
workspace?: string | undefined;
|
|
35
|
+
fetch?: typeof fetch;
|
|
36
|
+
};
|
|
37
|
+
export declare function resolveRemoteMode(input?: CapletsRemoteModeInput, env?: CapletsRemoteEnv): {
|
|
38
|
+
mode: CapletsRemoteMode;
|
|
39
|
+
};
|
|
40
|
+
export declare function resolveCapletsRemote(input?: CapletsRemoteInput, env?: CapletsRemoteEnv): ResolvedCapletsRemote;
|
|
41
|
+
export declare function projectBindingWebSocketUrlForBase(baseUrl: URL): URL;
|
|
42
|
+
export declare function isCapletsCloudUrl(value: string): boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type CloudAuthCredentials } from "../cloud-auth/store";
|
|
2
|
+
import { type ResolvedCapletsRemote } from "./options";
|
|
3
|
+
export type RemoteSelectionInput = {
|
|
4
|
+
mode?: string;
|
|
5
|
+
remoteUrl?: string;
|
|
6
|
+
user?: string;
|
|
7
|
+
password?: string;
|
|
8
|
+
token?: string;
|
|
9
|
+
workspace?: string;
|
|
10
|
+
fetch?: typeof fetch;
|
|
11
|
+
};
|
|
12
|
+
export type ResolvedRemoteSelection = {
|
|
13
|
+
kind: "self_hosted_remote";
|
|
14
|
+
remote: ResolvedCapletsRemote;
|
|
15
|
+
} | {
|
|
16
|
+
kind: "hosted_cloud";
|
|
17
|
+
remote: ResolvedCapletsRemote;
|
|
18
|
+
selectedWorkspace: string;
|
|
19
|
+
credentials: CloudAuthCredentials;
|
|
20
|
+
cloudPresence: {
|
|
21
|
+
url: URL;
|
|
22
|
+
accessToken: string;
|
|
23
|
+
workspaceId: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare function resolveRemoteSelection(input?: RemoteSelectionInput, env?: Record<string, string | undefined>): Promise<ResolvedRemoteSelection>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CapletsErrorCode } from "../errors";
|
|
2
|
-
export type RemoteCliCommand = "list" | "
|
|
2
|
+
export type RemoteCliCommand = "list" | "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" | "init" | "add" | "install" | "complete_cli" | "auth_login_start" | "auth_login_complete" | "auth_logout" | "auth_list";
|
|
3
3
|
export type RemoteCliRequest = {
|
|
4
4
|
command: RemoteCliCommand;
|
|
5
5
|
arguments: Record<string, unknown>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CapletConfig, RuntimeFeature } from "../config-runtime";
|
|
2
|
+
import type { RuntimeFeatureProvenance } from "./types";
|
|
3
|
+
export type RuntimeFeatureInference = {
|
|
4
|
+
features: RuntimeFeature[];
|
|
5
|
+
provenance: RuntimeFeatureProvenance[];
|
|
6
|
+
};
|
|
7
|
+
export declare function inferRuntimeFeatures(caplet: CapletConfig | Record<string, unknown>): RuntimeFeatureInference;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CapletConfig } from "../config-runtime";
|
|
2
|
+
import type { CapletRuntimePlan, RuntimePlanOptions, RuntimeRouteKind } from "./types";
|
|
3
|
+
export declare function planCapletRuntimeRoutes(caplets: Array<CapletConfig | Record<string, unknown>>, options?: RuntimePlanOptions): CapletRuntimePlan[];
|
|
4
|
+
export declare function planCapletRuntimeRoute(caplet: CapletConfig | Record<string, unknown>, options?: RuntimePlanOptions): CapletRuntimePlan;
|
|
5
|
+
export declare function classifyCapletRuntimeRoute(caplet: Record<string, unknown>): RuntimeRouteKind;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HostedRuntimeResourceClass, RuntimeResourcePolicy, RuntimeResourceResolution } from "./types";
|
|
2
|
+
type ResourceInput = {
|
|
3
|
+
backend?: string | undefined;
|
|
4
|
+
features: string[];
|
|
5
|
+
explicitClass?: HostedRuntimeResourceClass | undefined;
|
|
6
|
+
setupRequired?: boolean | undefined;
|
|
7
|
+
policy?: RuntimeResourcePolicy | undefined;
|
|
8
|
+
};
|
|
9
|
+
export declare function resolveRuntimeResources(input: ResourceInput): RuntimeResourceResolution;
|
|
10
|
+
export declare function resolveRuntimeResources(caplet: Record<string, unknown>, features: string[], policy?: RuntimeResourcePolicy | undefined): RuntimeResourceResolution;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { CapletConfig, RuntimeFeature, RuntimeResourceClass } from "../config-runtime";
|
|
2
|
+
export type HostedRuntimeResourceClass = RuntimeResourceClass | "small" | "medium";
|
|
3
|
+
export type { RuntimeFeature, RuntimeResourceClass };
|
|
4
|
+
export type RuntimeRouteKind = "worker_safe" | "process" | "project_bound_process" | "local_only";
|
|
5
|
+
export type SetupTargetKind = "local_host" | "remote_host" | "hosted_sandbox";
|
|
6
|
+
export type HostedSetupState = "not_required" | "approval_required" | "approved" | "queued" | "running" | "verifying" | "ready" | "failed" | "expired";
|
|
7
|
+
export type HostedBackendCheckState = "not_run" | "queued" | "running" | "passed" | "failed" | "stale";
|
|
8
|
+
export type HostedSandboxState = "not_started" | "preparing" | "uploading_bundle" | "running_setup" | "starting_adapter" | "ready" | "busy" | "degraded" | "stopping" | "stopped" | "failed";
|
|
9
|
+
export declare const HIDDEN_REASON_CODES: readonly ["setup_required", "setup_running", "setup_failed", "verify_failed", "backend_auth_required", "backend_check_failed", "project_binding_required", "project_binding_syncing", "project_binding_blocked", "project_binding_stale", "provider_unavailable", "provider_capacity_exhausted", "provider_queue_timeout", "policy_denied", "billing_required", "subscription_past_due", "usage_limit_reached", "email_verification_required", "docker_required", "docker_denied", "browser_required", "browser_denied", "resource_class_denied", "local_only", "invalid_bundle", "unsupported_backend"];
|
|
10
|
+
export type HiddenReasonCode = (typeof HIDDEN_REASON_CODES)[number];
|
|
11
|
+
export type RuntimePlanDeployment = "hosted" | "self_hosted" | "local";
|
|
12
|
+
export type RuntimePlanOptions = {
|
|
13
|
+
deployment?: RuntimePlanDeployment | undefined;
|
|
14
|
+
resourcePolicy?: RuntimeResourcePolicy | undefined;
|
|
15
|
+
};
|
|
16
|
+
export type RuntimeFeatureProvenanceSource = "explicit" | "setup.commands" | "setup.verify" | "mcp.command" | "cli.command" | "cli.action";
|
|
17
|
+
export type RuntimeFeatureProvenance = {
|
|
18
|
+
feature: RuntimeFeature;
|
|
19
|
+
source: RuntimeFeatureProvenanceSource;
|
|
20
|
+
matched: string;
|
|
21
|
+
command?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
export type RuntimeResourcePolicy = {
|
|
24
|
+
maxClass?: HostedRuntimeResourceClass | undefined;
|
|
25
|
+
};
|
|
26
|
+
export type RuntimeResourceResolution = {
|
|
27
|
+
class: HostedRuntimeResourceClass;
|
|
28
|
+
cpu: number;
|
|
29
|
+
memoryMb: number;
|
|
30
|
+
diskMb: number;
|
|
31
|
+
cappedByPolicy?: HostedRuntimeResourceClass | undefined;
|
|
32
|
+
};
|
|
33
|
+
export type RuntimeRequirementsResolution = {
|
|
34
|
+
features: RuntimeFeature[];
|
|
35
|
+
featureProvenance: RuntimeFeatureProvenance[];
|
|
36
|
+
resources: RuntimeResourceResolution;
|
|
37
|
+
};
|
|
38
|
+
export type CapletRuntimePlan = {
|
|
39
|
+
id: string;
|
|
40
|
+
backend: CapletConfig["backend"] | string;
|
|
41
|
+
route: RuntimeRouteKind;
|
|
42
|
+
setupTarget?: SetupTargetKind | undefined;
|
|
43
|
+
setupRequired: boolean;
|
|
44
|
+
authRequired: boolean;
|
|
45
|
+
projectBindingRequired: boolean;
|
|
46
|
+
runtime: RuntimeRequirementsResolution;
|
|
47
|
+
caplet: CapletConfig | Record<string, unknown>;
|
|
48
|
+
};
|
|
49
|
+
export type HostedRoutePlan = {
|
|
50
|
+
workspaceId: string;
|
|
51
|
+
capletId: string;
|
|
52
|
+
contentHash: string;
|
|
53
|
+
bundleRevision: string;
|
|
54
|
+
route: RuntimeRouteKind;
|
|
55
|
+
backend: string;
|
|
56
|
+
runtimeFeatures: string[];
|
|
57
|
+
resourceClass: HostedRuntimeResourceClass;
|
|
58
|
+
setupState: HostedSetupState;
|
|
59
|
+
checkState: HostedBackendCheckState;
|
|
60
|
+
projectBindingRequired: boolean;
|
|
61
|
+
projectFingerprint?: string | undefined;
|
|
62
|
+
hiddenReasons: HiddenReasonCode[];
|
|
63
|
+
primaryHiddenReason?: HiddenReasonCode | undefined;
|
|
64
|
+
policyDecision: "allowed" | "denied" | "not_evaluated";
|
|
65
|
+
provenanceSource: "bundle_validation" | "install" | "runtime_refresh" | "call";
|
|
66
|
+
updatedAt: string;
|
|
67
|
+
};
|
|
68
|
+
export type HostedCallProvenance = {
|
|
69
|
+
requestId: string;
|
|
70
|
+
workspaceId: string;
|
|
71
|
+
capletId: string;
|
|
72
|
+
contentHash: string;
|
|
73
|
+
route: RuntimeRouteKind;
|
|
74
|
+
backend: string;
|
|
75
|
+
provider?: "daytona" | undefined;
|
|
76
|
+
sandboxId?: string | undefined;
|
|
77
|
+
snapshotId?: string | undefined;
|
|
78
|
+
runtimeFeatures: string[];
|
|
79
|
+
projectFingerprint?: string | undefined;
|
|
80
|
+
usageEventIds: string[];
|
|
81
|
+
auditEventId?: string | undefined;
|
|
82
|
+
};
|