@caplets/core 0.25.1 → 0.26.1

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/native.js CHANGED
@@ -1,4 +1,4 @@
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-Ut6dN9M8.js";
1
+ import { A as nativeCapletPromptGuidance, F as nativeCodeModeToolName, M as nativeCapletToolName, N as nativeCapletsSystemGuidance, P as nativeCodeModeToolId, h as createSdkRemoteCapletsClient, j as nativeCapletToolDescription, m as RemoteNativeCapletsService, t as createNativeCapletsService, v as resolveNativeCapletsServiceOptions } from "./service-aBIn4nrw.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 = {}) {
@@ -1,5 +1,5 @@
1
1
  import { CapletsError } from "../errors";
2
- export declare const PROJECT_BINDING_ERROR_CODES: readonly ["cloud_auth_required", "cloud_auth_expired", "cloud_auth_revoked", "workspace_selection_required", "workspace_switch_required", "workspace_forbidden", "project_binding_forbidden", "endpoint_unavailable", "websocket_upgrade_required", "sync_required", "sync_failed", "sync_size_limit_exceeded", "lease_conflict", "lease_expired", "policy_denied", "usage_limit_reached", "billing_required", "subscription_past_due", "email_verification_required", "remote_credentials_required", "remote_auth_failed"];
2
+ export declare const PROJECT_BINDING_ERROR_CODES: readonly ["cloud_auth_required", "cloud_auth_expired", "cloud_auth_revoked", "workspace_selection_required", "workspace_switch_required", "workspace_forbidden", "project_binding_forbidden", "endpoint_unavailable", "websocket_upgrade_required", "sync_required", "sync_failed", "sync_size_limit_exceeded", "lease_conflict", "lease_expired", "policy_denied", "usage_limit_reached", "billing_required", "subscription_past_due", "email_verification_required", "remote_credentials_required", "remote_credentials_revoked", "remote_auth_failed"];
3
3
  export type ProjectBindingErrorCode = (typeof PROJECT_BINDING_ERROR_CODES)[number];
4
4
  export type ProjectBindingRecovery = {
5
5
  code: ProjectBindingErrorCode;
@@ -16,6 +16,7 @@ export type CloudProfileLookup = {
16
16
  };
17
17
  export type SaveSelfHostedProfileInput = {
18
18
  hostUrl: string;
19
+ hostIdentity?: string | undefined;
19
20
  clientId: string;
20
21
  clientLabel?: string | undefined;
21
22
  credentials: RemoteProfileCredential;
@@ -23,6 +24,7 @@ export type SaveSelfHostedProfileInput = {
23
24
  };
24
25
  export type SelfHostedProfileLookup = {
25
26
  hostUrl: string;
27
+ hostIdentity?: string | undefined;
26
28
  };
27
29
  export type RefreshSelfHostedProfileInput = SelfHostedProfileLookup & {
28
30
  needsRefresh: (credential: RemoteProfileCredential) => boolean;
@@ -16,6 +16,7 @@ export type RemoteProfileCredential = {
16
16
  export type RemoteProfileStatusInput = {
17
17
  kind: RemoteProfileKind;
18
18
  hostUrl: string;
19
+ hostIdentity?: string | undefined;
19
20
  key?: string | undefined;
20
21
  workspaceId?: string | undefined;
21
22
  workspaceSlug?: string | undefined;
@@ -31,6 +32,7 @@ export type RemoteProfileStatus = {
31
32
  kind: RemoteProfileKind;
32
33
  key: string;
33
34
  hostUrl: string;
35
+ hostIdentity?: string | undefined;
34
36
  workspaceId?: string | undefined;
35
37
  workspaceSlug?: string | undefined;
36
38
  clientId?: string | undefined;
@@ -1,4 +1,5 @@
1
- import type { IssuedRemoteClientCredentials, RemoteClientStatus, ValidatedRemoteClient } from "./server-credentials";
1
+ import { type VaultEncryptedRecord } from "../vault/crypto";
2
+ import type { IssuedRemoteClientCredentials, RemoteClientStatus, RemotePendingLoginStatus, RemotePendingLoginState, ValidatedRemoteClient } from "./server-credentials";
2
3
  export type RemoteServerCredentialStoreOptions = {
3
4
  dir: string;
4
5
  };
@@ -25,6 +26,29 @@ export type RefreshClientCredentialsInput = {
25
26
  refreshToken: string;
26
27
  now?: Date | undefined;
27
28
  };
29
+ export type CreatePendingLoginInput = {
30
+ hostUrl: string;
31
+ hostIdentity?: string | undefined;
32
+ clientLabel?: string | undefined;
33
+ clientFingerprint?: string | undefined;
34
+ sourceHint?: string | undefined;
35
+ now?: Date | undefined;
36
+ };
37
+ export type PendingLoginPossessionInput = {
38
+ flowId: string;
39
+ pendingCompletionSecret: string;
40
+ now?: Date | undefined;
41
+ };
42
+ export type RefreshPendingLoginInput = PendingLoginPossessionInput & {
43
+ pendingRefreshSecret: string;
44
+ };
45
+ export type ApprovePendingLoginInput = {
46
+ operatorCode: string;
47
+ now?: Date | undefined;
48
+ };
49
+ export type CompletePendingLoginInput = PendingLoginPossessionInput & {
50
+ hostUrl: string;
51
+ };
28
52
  type StoredPairingCode = {
29
53
  codeId: string;
30
54
  hostUrl: string;
@@ -49,18 +73,91 @@ type StoredRemoteClient = {
49
73
  lastUsedAt?: string | undefined;
50
74
  revokedAt?: string | undefined;
51
75
  };
76
+ type PendingLoginStatus = RemotePendingLoginState;
77
+ type StoredPendingLogin = {
78
+ flowId: string;
79
+ hostUrl: string;
80
+ hostIdentity?: string | undefined;
81
+ operatorCodeHash: string;
82
+ pendingRefreshHash: string;
83
+ supersededPendingRefreshHashes: SupersededRefreshToken[];
84
+ pendingRefreshReplay?: PendingRefreshReplay | undefined;
85
+ pendingCompletionHash: string;
86
+ completionReplay?: CompletionReplay | undefined;
87
+ clientLabel: string;
88
+ clientFingerprint?: string | undefined;
89
+ sourceHint?: string | undefined;
90
+ createdAt: string;
91
+ codeExpiresAt: string;
92
+ flowExpiresAt: string;
93
+ status: PendingLoginStatus;
94
+ operatorCodeFingerprint?: string | undefined;
95
+ approvedAt?: string | undefined;
96
+ deniedAt?: string | undefined;
97
+ cancelledAt?: string | undefined;
98
+ exchangedAt?: string | undefined;
99
+ };
52
100
  type SupersededRefreshToken = {
53
101
  hash: string;
54
102
  supersededAt: string;
55
103
  };
104
+ type PendingRefreshReplay = {
105
+ refreshHash: string;
106
+ expiresAt: string;
107
+ encryptedResponse: VaultEncryptedRecord;
108
+ };
109
+ type CompletionReplay = {
110
+ expiresAt: string;
111
+ encryptedCredentials: VaultEncryptedRecord;
112
+ };
56
113
  type RemoteServerCredentialState = {
57
114
  version: 1;
58
115
  pairingCodes: StoredPairingCode[];
116
+ pendingLogins: StoredPendingLogin[];
59
117
  clients: StoredRemoteClient[];
60
118
  };
61
119
  export declare class RemoteServerCredentialStore {
62
120
  readonly dir: string;
63
121
  constructor(options: RemoteServerCredentialStoreOptions);
122
+ createPendingLogin(input: CreatePendingLoginInput): {
123
+ flowId: string;
124
+ operatorCode: string;
125
+ operatorCodeFingerprint: string;
126
+ pendingRefreshSecret: string;
127
+ pendingCompletionSecret: string;
128
+ codeExpiresAt: string;
129
+ flowExpiresAt: string;
130
+ intervalSeconds: number;
131
+ };
132
+ pollPendingLogin(input: PendingLoginPossessionInput): {
133
+ flowId: string;
134
+ status: PendingLoginStatus;
135
+ };
136
+ refreshPendingLogin(input: RefreshPendingLoginInput): {
137
+ flowId: string;
138
+ operatorCode: string;
139
+ operatorCodeFingerprint: string;
140
+ pendingRefreshSecret: string;
141
+ codeExpiresAt: string;
142
+ flowExpiresAt: string;
143
+ intervalSeconds: number;
144
+ };
145
+ denyPendingLogin(input: ApprovePendingLoginInput): {
146
+ flowId: string;
147
+ status: "denied";
148
+ };
149
+ cancelPendingLogin(input: PendingLoginPossessionInput): {
150
+ flowId: string;
151
+ status: "cancelled";
152
+ };
153
+ approvePendingLogin(input: ApprovePendingLoginInput): {
154
+ flowId: string;
155
+ status: "approved";
156
+ clientLabel: string;
157
+ clientFingerprint?: string | undefined;
158
+ sourceHint?: string | undefined;
159
+ };
160
+ completePendingLogin(input: CompletePendingLoginInput): IssuedRemoteClientCredentials;
64
161
  createPairingCode(input: CreatePairingCodeInput): {
65
162
  codeId: string;
66
163
  code: string;
@@ -68,6 +165,7 @@ export declare class RemoteServerCredentialStore {
68
165
  };
69
166
  exchangePairingCode(input: ExchangePairingCodeInput): IssuedRemoteClientCredentials;
70
167
  listClients(): RemoteClientStatus[];
168
+ listPendingLogins(now?: Date): RemotePendingLoginStatus[];
71
169
  revokeClient(clientId: string, now?: Date): boolean;
72
170
  validateAccessToken(input: ValidateAccessTokenInput): ValidatedRemoteClient;
73
171
  refreshClientCredentials(input: RefreshClientCredentialsInput): IssuedRemoteClientCredentials;
@@ -80,5 +178,6 @@ export declare class RemoteServerCredentialStore {
80
178
  private acquireLock;
81
179
  private releaseLock;
82
180
  private clearStaleLock;
181
+ private pendingLoginForCompletion;
83
182
  }
84
183
  export {};
@@ -16,6 +16,24 @@ export type RemoteClientStatus = {
16
16
  lastUsedAt?: string | undefined;
17
17
  revokedAt?: string | undefined;
18
18
  };
19
+ export type RemotePendingLoginState = "pending" | "approved" | "denied" | "cancelled" | "expired" | "exchanged";
20
+ export type RemotePendingLoginStatus = {
21
+ flowId: string;
22
+ hostUrl: string;
23
+ hostIdentity?: string | undefined;
24
+ status: RemotePendingLoginState;
25
+ operatorCodeFingerprint?: string | undefined;
26
+ clientLabel: string;
27
+ clientFingerprint?: string | undefined;
28
+ sourceHint?: string | undefined;
29
+ createdAt: string;
30
+ codeExpiresAt: string;
31
+ flowExpiresAt: string;
32
+ approvedAt?: string | undefined;
33
+ deniedAt?: string | undefined;
34
+ cancelledAt?: string | undefined;
35
+ exchangedAt?: string | undefined;
36
+ };
19
37
  export type ValidatedRemoteClient = RemoteClientStatus & {
20
38
  tokenType: "Bearer";
21
39
  };
@@ -1,5 +1,5 @@
1
1
  import type { CapletsErrorCode } from "../errors";
2
- export type RemoteCliCommand = "list" | "inspect" | "check" | "tools" | "search_tools" | "describe_tool" | "call_tool" | "resources" | "search_resources" | "resource_templates" | "read_resource" | "prompts" | "search_prompts" | "get_prompt" | "complete" | "init" | "add" | "install" | "complete_cli" | "auth_login_start" | "auth_login_complete" | "auth_logout" | "auth_refresh" | "auth_list";
2
+ export type RemoteCliCommand = "list" | "inspect" | "check" | "tools" | "search_tools" | "describe_tool" | "call_tool" | "resources" | "search_resources" | "resource_templates" | "read_resource" | "prompts" | "search_prompts" | "get_prompt" | "complete" | "init" | "add" | "install" | "complete_cli" | "auth_login_start" | "auth_login_complete" | "auth_logout" | "auth_refresh" | "auth_list" | "vault_set" | "vault_list" | "vault_get" | "vault_delete" | "vault_access_grant" | "vault_access_revoke" | "vault_access_list";
3
3
  export type RemoteCliRequest = {
4
4
  command: RemoteCliCommand;
5
5
  arguments: Record<string, unknown>;
@@ -35,6 +35,11 @@ export declare function servicePaths(base: string): {
35
35
  attachInvoke: string;
36
36
  projectBindings: string;
37
37
  pairingExchange: string;
38
+ remoteLoginStart: string;
39
+ remoteLoginPoll: string;
40
+ remoteLoginRefresh: string;
41
+ remoteLoginComplete: string;
42
+ remoteLoginCancel: string;
38
43
  remoteRefresh: string;
39
44
  remoteClient: string;
40
45
  health: string;