@caplets/core 0.22.0 → 0.24.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/auth.d.ts +2 -1
- package/dist/caplet-files-bundle.d.ts +62 -0
- package/dist/caplet-sets.d.ts +2 -0
- package/dist/caplet-source.js +96 -4
- package/dist/cli/add.d.ts +10 -0
- package/dist/cli/auth.d.ts +22 -0
- package/dist/cli/code-mode.d.ts +3 -0
- package/dist/cli/commands.d.ts +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/code-mode/api.d.ts +3 -1
- package/dist/code-mode/diagnostics-builtins.generated.d.ts +1 -0
- package/dist/code-mode/diagnostics.d.ts +8 -0
- package/dist/code-mode/index.d.ts +1 -1
- package/dist/code-mode/journal.d.ts +103 -0
- package/dist/code-mode/platform-entry.d.ts +1 -0
- package/dist/code-mode/platform-host.d.ts +6 -0
- package/dist/code-mode/platform-runtime.generated.d.ts +1 -0
- package/dist/code-mode/runner.d.ts +5 -0
- package/dist/code-mode/runtime-api.generated.d.ts +1 -1
- package/dist/code-mode/sandbox.d.ts +14 -1
- package/dist/code-mode/sessions.d.ts +53 -0
- package/dist/code-mode/tool.d.ts +5 -0
- package/dist/code-mode/types.d.ts +30 -0
- package/dist/code-mode.js +21 -14
- package/dist/{completion-DnQujlrc.js → completion-CzHdM9B_.js} +14 -2
- package/dist/config/paths.d.ts +2 -0
- package/dist/config-runtime.d.ts +13 -1
- package/dist/config-runtime.js +44 -0
- package/dist/config.d.ts +25 -1
- package/dist/engine.d.ts +3 -0
- package/dist/google-discovery/index.d.ts +5 -0
- package/dist/google-discovery/manager.d.ts +37 -0
- package/dist/google-discovery/operations.d.ts +32 -0
- package/dist/google-discovery/request.d.ts +5 -0
- package/dist/google-discovery/schema.d.ts +2 -0
- package/dist/google-discovery/types.d.ts +70 -0
- package/dist/http/response.d.ts +14 -0
- package/dist/http-actions.d.ts +3 -0
- package/dist/index.js +190 -43
- package/dist/media/artifacts.d.ts +24 -0
- package/dist/media/index.d.ts +2 -0
- package/dist/media/input.d.ts +29 -0
- package/dist/native/options.d.ts +3 -6
- package/dist/native/remote.d.ts +2 -0
- package/dist/native/service.d.ts +2 -0
- package/dist/native/tools.d.ts +1 -0
- package/dist/native.js +1 -1
- package/dist/{observed-output-shapes-CL5MFXwM.js → observed-output-shapes-D2k2-q8K.js} +9 -0
- package/dist/observed-output-shapes.js +1 -1
- package/dist/openapi.d.ts +2 -0
- package/dist/registry.d.ts +6 -0
- package/dist/remote/options.d.ts +1 -1
- package/dist/runtime-plan.js +1 -1
- package/dist/runtime.d.ts +2 -0
- package/dist/serve/session.d.ts +1 -0
- package/dist/{service-4_chB2wu.js → service-BCT_Ls_3.js} +3878 -361
- package/dist/tools.d.ts +2 -1
- package/package.json +9 -2
package/dist/auth.d.ts
CHANGED
|
@@ -20,10 +20,11 @@ type OAuthLikeAuthConfig = {
|
|
|
20
20
|
};
|
|
21
21
|
export type GenericAuthTarget = {
|
|
22
22
|
server: string;
|
|
23
|
-
backend: "openapi" | "graphql" | "http";
|
|
23
|
+
backend: "openapi" | "googleDiscovery" | "graphql" | "http";
|
|
24
24
|
url?: string | undefined;
|
|
25
25
|
baseUrl?: string | undefined;
|
|
26
26
|
specUrl?: string | undefined;
|
|
27
|
+
resolvedScopes?: string[] | undefined;
|
|
27
28
|
auth?: OAuthLikeAuthConfig | {
|
|
28
29
|
type: string;
|
|
29
30
|
} | undefined;
|
|
@@ -162,6 +162,67 @@ export declare const capletFileSchema: z.ZodObject<{
|
|
|
162
162
|
}, z.core.$strict>>;
|
|
163
163
|
}, z.core.$strict>>;
|
|
164
164
|
}, z.core.$strict>>;
|
|
165
|
+
googleDiscoveryApi: z.ZodOptional<z.ZodObject<{
|
|
166
|
+
discoveryPath: z.ZodOptional<z.ZodString>;
|
|
167
|
+
discoveryUrl: z.ZodOptional<z.ZodString>;
|
|
168
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
169
|
+
auth: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
170
|
+
type: z.ZodLiteral<"none">;
|
|
171
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
172
|
+
type: z.ZodLiteral<"bearer">;
|
|
173
|
+
token: z.ZodString;
|
|
174
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
175
|
+
type: z.ZodLiteral<"headers">;
|
|
176
|
+
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
177
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
178
|
+
type: z.ZodLiteral<"oauth2">;
|
|
179
|
+
authorizationUrl: z.ZodOptional<z.ZodString>;
|
|
180
|
+
tokenUrl: z.ZodOptional<z.ZodString>;
|
|
181
|
+
issuer: z.ZodOptional<z.ZodString>;
|
|
182
|
+
resourceMetadataUrl: z.ZodOptional<z.ZodString>;
|
|
183
|
+
authorizationServerMetadataUrl: z.ZodOptional<z.ZodString>;
|
|
184
|
+
openidConfigurationUrl: z.ZodOptional<z.ZodString>;
|
|
185
|
+
clientMetadataUrl: z.ZodOptional<z.ZodString>;
|
|
186
|
+
clientId: z.ZodOptional<z.ZodString>;
|
|
187
|
+
clientSecret: z.ZodOptional<z.ZodString>;
|
|
188
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
189
|
+
redirectUri: z.ZodOptional<z.ZodString>;
|
|
190
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
191
|
+
type: z.ZodLiteral<"oidc">;
|
|
192
|
+
authorizationUrl: z.ZodOptional<z.ZodString>;
|
|
193
|
+
tokenUrl: z.ZodOptional<z.ZodString>;
|
|
194
|
+
issuer: z.ZodOptional<z.ZodString>;
|
|
195
|
+
resourceMetadataUrl: z.ZodOptional<z.ZodString>;
|
|
196
|
+
authorizationServerMetadataUrl: z.ZodOptional<z.ZodString>;
|
|
197
|
+
openidConfigurationUrl: z.ZodOptional<z.ZodString>;
|
|
198
|
+
clientMetadataUrl: z.ZodOptional<z.ZodString>;
|
|
199
|
+
clientId: z.ZodOptional<z.ZodString>;
|
|
200
|
+
clientSecret: z.ZodOptional<z.ZodString>;
|
|
201
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
202
|
+
redirectUri: z.ZodOptional<z.ZodString>;
|
|
203
|
+
}, z.core.$strict>], "type">;
|
|
204
|
+
requestTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
205
|
+
operationCacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
206
|
+
includeOperations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
207
|
+
excludeOperations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
208
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
209
|
+
projectBinding: z.ZodOptional<z.ZodObject<{
|
|
210
|
+
required: z.ZodLiteral<true>;
|
|
211
|
+
}, z.core.$strict>>;
|
|
212
|
+
runtime: z.ZodOptional<z.ZodObject<{
|
|
213
|
+
features: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
214
|
+
docker: "docker";
|
|
215
|
+
browser: "browser";
|
|
216
|
+
}>>>;
|
|
217
|
+
resources: z.ZodOptional<z.ZodObject<{
|
|
218
|
+
class: z.ZodOptional<z.ZodEnum<{
|
|
219
|
+
standard: "standard";
|
|
220
|
+
large: "large";
|
|
221
|
+
heavy: "heavy";
|
|
222
|
+
}>>;
|
|
223
|
+
}, z.core.$strict>>;
|
|
224
|
+
}, z.core.$strict>>;
|
|
225
|
+
}, z.core.$strict>>;
|
|
165
226
|
graphqlEndpoint: z.ZodOptional<z.ZodObject<{
|
|
166
227
|
endpointUrl: z.ZodString;
|
|
167
228
|
schemaPath: z.ZodOptional<z.ZodString>;
|
|
@@ -399,6 +460,7 @@ export declare function capletJsonSchema(): unknown;
|
|
|
399
460
|
export type CapletFileConfig = {
|
|
400
461
|
mcpServers?: Record<string, unknown>;
|
|
401
462
|
openapiEndpoints?: Record<string, unknown>;
|
|
463
|
+
googleDiscoveryApis?: Record<string, unknown>;
|
|
402
464
|
graphqlEndpoints?: Record<string, unknown>;
|
|
403
465
|
httpApis?: Record<string, unknown>;
|
|
404
466
|
cliTools?: Record<string, unknown>;
|
package/dist/caplet-sets.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export declare class CapletSetManager {
|
|
|
9
9
|
private readonly childRefreshLocks;
|
|
10
10
|
constructor(registry: ServerRegistry, options?: {
|
|
11
11
|
authDir?: string;
|
|
12
|
+
artifactDir?: string;
|
|
13
|
+
exposeLocalArtifactPaths?: boolean;
|
|
12
14
|
ancestry?: Set<string>;
|
|
13
15
|
});
|
|
14
16
|
updateRegistry(registry: ServerRegistry): void;
|
package/dist/caplet-source.js
CHANGED
|
@@ -10299,6 +10299,36 @@ const capletOpenApiEndpointSchema = object({
|
|
|
10299
10299
|
});
|
|
10300
10300
|
validateEndpointAuthHeaders(endpoint.auth, ctx);
|
|
10301
10301
|
});
|
|
10302
|
+
const capletGoogleDiscoveryOperationFilterSchema = array(string().trim().min(1).max(160));
|
|
10303
|
+
const capletGoogleDiscoveryApiSchema = object({
|
|
10304
|
+
discoveryPath: string().min(1).optional().describe("Local Google Discovery document path."),
|
|
10305
|
+
discoveryUrl: string().min(1).optional().describe("Remote Google Discovery document URL."),
|
|
10306
|
+
baseUrl: string().min(1).optional().describe("Override base URL for Google API requests."),
|
|
10307
|
+
auth: capletEndpointAuthSchema.describe("Explicit Google API request auth config. Use {\"type\":\"none\"} for public APIs."),
|
|
10308
|
+
requestTimeoutMs: number().int().positive().optional().describe("Timeout in milliseconds for Google API HTTP requests."),
|
|
10309
|
+
operationCacheTtlMs: number().int().nonnegative().optional().describe("Milliseconds Google Discovery operation metadata stays fresh. Set 0 to refresh every time."),
|
|
10310
|
+
includeOperations: capletGoogleDiscoveryOperationFilterSchema.optional(),
|
|
10311
|
+
excludeOperations: capletGoogleDiscoveryOperationFilterSchema.optional(),
|
|
10312
|
+
disabled: boolean().optional().describe("When true, omit this Caplet from discovery."),
|
|
10313
|
+
projectBinding: capletProjectBindingSchema.optional(),
|
|
10314
|
+
runtime: capletRuntimeRequirementsSchema.optional()
|
|
10315
|
+
}).strict().superRefine((api, ctx) => {
|
|
10316
|
+
if (Boolean(api.discoveryPath) === Boolean(api.discoveryUrl)) ctx.addIssue({
|
|
10317
|
+
code: "custom",
|
|
10318
|
+
message: "googleDiscoveryApi must define exactly one discovery source: discoveryPath or discoveryUrl"
|
|
10319
|
+
});
|
|
10320
|
+
if (api.discoveryUrl && !hasEnvReference$2(api.discoveryUrl) && !isAllowedRemoteUrl(api.discoveryUrl)) ctx.addIssue({
|
|
10321
|
+
code: "custom",
|
|
10322
|
+
path: ["discoveryUrl"],
|
|
10323
|
+
message: "Google Discovery discoveryUrl must use https except loopback development urls"
|
|
10324
|
+
});
|
|
10325
|
+
if (api.baseUrl && !hasEnvReference$2(api.baseUrl) && !isAllowedHttpBaseUrl(api.baseUrl)) ctx.addIssue({
|
|
10326
|
+
code: "custom",
|
|
10327
|
+
path: ["baseUrl"],
|
|
10328
|
+
message: "Google Discovery baseUrl must use https except loopback development urls and must not include credentials, query, or fragment"
|
|
10329
|
+
});
|
|
10330
|
+
validateEndpointAuthHeaders(api.auth, ctx);
|
|
10331
|
+
});
|
|
10302
10332
|
const capletGraphQlOperationSchema = object({
|
|
10303
10333
|
document: string().min(1).optional().describe("Inline GraphQL operation document."),
|
|
10304
10334
|
documentPath: string().min(1).optional().describe("Path to a GraphQL operation document."),
|
|
@@ -10442,7 +10472,7 @@ const capletSetSchema$1 = object({
|
|
|
10442
10472
|
});
|
|
10443
10473
|
});
|
|
10444
10474
|
const capletFileSchema = object({
|
|
10445
|
-
$schema: string().
|
|
10475
|
+
$schema: string().optional().describe("Optional JSON Schema for editor validation."),
|
|
10446
10476
|
name: string().trim().min(1).max(80).describe("Human-readable Caplet display name."),
|
|
10447
10477
|
description: string().describe("Compact capability description shown before the full Caplet card is disclosed.").refine((value) => value.trim().length >= 10, "description must contain at least 10 non-whitespace characters").refine((value) => value.length <= 1500, "description must be at most 1500 characters"),
|
|
10448
10478
|
tags: array(string().trim().min(1).max(80)).optional().describe("Optional tags for grouping or searching Caplets."),
|
|
@@ -10454,14 +10484,15 @@ const capletFileSchema = object({
|
|
|
10454
10484
|
runtime: capletRuntimeRequirementsSchema.optional(),
|
|
10455
10485
|
mcpServer: capletMcpServerSchema.describe("MCP server backend configuration for this Caplet.").optional(),
|
|
10456
10486
|
openapiEndpoint: capletOpenApiEndpointSchema.describe("OpenAPI endpoint backend configuration for this Caplet.").optional(),
|
|
10487
|
+
googleDiscoveryApi: capletGoogleDiscoveryApiSchema.describe("Google Discovery API backend configuration for this Caplet.").optional(),
|
|
10457
10488
|
graphqlEndpoint: capletGraphQlEndpointSchema.describe("GraphQL endpoint backend configuration for this Caplet.").optional(),
|
|
10458
10489
|
httpApi: capletHttpApiSchema.describe("HTTP API backend configuration for this Caplet.").optional(),
|
|
10459
10490
|
cliTools: capletCliToolsSchema.describe("CLI tools backend configuration for this Caplet.").optional(),
|
|
10460
10491
|
capletSet: capletSetSchema$1.describe("Nested Caplet collection backend configuration for this Caplet.").optional()
|
|
10461
10492
|
}).strict().superRefine((frontmatter, ctx) => {
|
|
10462
|
-
if (Number(Boolean(frontmatter.mcpServer)) + Number(Boolean(frontmatter.openapiEndpoint)) + Number(Boolean(frontmatter.graphqlEndpoint)) + Number(Boolean(frontmatter.httpApi)) + Number(Boolean(frontmatter.cliTools)) + Number(Boolean(frontmatter.capletSet)) !== 1) ctx.addIssue({
|
|
10493
|
+
if (Number(Boolean(frontmatter.mcpServer)) + Number(Boolean(frontmatter.openapiEndpoint)) + Number(Boolean(frontmatter.googleDiscoveryApi)) + Number(Boolean(frontmatter.graphqlEndpoint)) + Number(Boolean(frontmatter.httpApi)) + Number(Boolean(frontmatter.cliTools)) + Number(Boolean(frontmatter.capletSet)) !== 1) ctx.addIssue({
|
|
10463
10494
|
code: "custom",
|
|
10464
|
-
message: "Caplet file must define exactly one backend: mcpServer, openapiEndpoint, graphqlEndpoint, httpApi, cliTools, or capletSet"
|
|
10495
|
+
message: "Caplet file must define exactly one backend: mcpServer, openapiEndpoint, googleDiscoveryApi, graphqlEndpoint, httpApi, cliTools, or capletSet"
|
|
10465
10496
|
});
|
|
10466
10497
|
});
|
|
10467
10498
|
function loadCapletFilesFromMap(input) {
|
|
@@ -10480,13 +10511,14 @@ function loadCapletFilesFromMap(input) {
|
|
|
10480
10511
|
function buildCapletFileLoadResultFromEntries(root, candidates, readConfig, warnings) {
|
|
10481
10512
|
const servers = {};
|
|
10482
10513
|
const openapiEndpoints = {};
|
|
10514
|
+
const googleDiscoveryApis = {};
|
|
10483
10515
|
const graphqlEndpoints = {};
|
|
10484
10516
|
const httpApis = {};
|
|
10485
10517
|
const cliTools = {};
|
|
10486
10518
|
const capletSets = {};
|
|
10487
10519
|
const paths = {};
|
|
10488
10520
|
function hasId(id) {
|
|
10489
|
-
return Boolean(servers[id] || openapiEndpoints[id] || graphqlEndpoints[id] || httpApis[id] || cliTools[id] || capletSets[id]);
|
|
10521
|
+
return Boolean(servers[id] || openapiEndpoints[id] || googleDiscoveryApis[id] || graphqlEndpoints[id] || httpApis[id] || cliTools[id] || capletSets[id]);
|
|
10490
10522
|
}
|
|
10491
10523
|
for (const candidate of candidates) {
|
|
10492
10524
|
if (hasId(candidate.id)) {
|
|
@@ -10513,6 +10545,9 @@ function buildCapletFileLoadResultFromEntries(root, candidates, readConfig, warn
|
|
|
10513
10545
|
if (isPlainObject(config) && config.backend === "openapi") {
|
|
10514
10546
|
const { backend: _backend, ...endpoint } = config;
|
|
10515
10547
|
openapiEndpoints[candidate.id] = endpoint;
|
|
10548
|
+
} else if (isPlainObject(config) && config.backend === "googleDiscovery") {
|
|
10549
|
+
const { backend: _backend, ...api } = config;
|
|
10550
|
+
googleDiscoveryApis[candidate.id] = api;
|
|
10516
10551
|
} else if (isPlainObject(config) && config.backend === "graphql") {
|
|
10517
10552
|
const { backend: _backend, ...endpoint } = config;
|
|
10518
10553
|
graphqlEndpoints[candidate.id] = endpoint;
|
|
@@ -10529,6 +10564,7 @@ function buildCapletFileLoadResultFromEntries(root, candidates, readConfig, warn
|
|
|
10529
10564
|
}
|
|
10530
10565
|
const hasServers = Object.keys(servers).length > 0;
|
|
10531
10566
|
const hasOpenApi = Object.keys(openapiEndpoints).length > 0;
|
|
10567
|
+
const hasGoogleDiscovery = Object.keys(googleDiscoveryApis).length > 0;
|
|
10532
10568
|
const hasGraphQl = Object.keys(graphqlEndpoints).length > 0;
|
|
10533
10569
|
const hasHttpApis = Object.keys(httpApis).length > 0;
|
|
10534
10570
|
const hasCliTools = Object.keys(cliTools).length > 0;
|
|
@@ -10536,6 +10572,7 @@ function buildCapletFileLoadResultFromEntries(root, candidates, readConfig, warn
|
|
|
10536
10572
|
const config = {
|
|
10537
10573
|
...hasServers ? { mcpServers: servers } : {},
|
|
10538
10574
|
...hasOpenApi ? { openapiEndpoints } : {},
|
|
10575
|
+
...hasGoogleDiscovery ? { googleDiscoveryApis } : {},
|
|
10539
10576
|
...hasGraphQl ? { graphqlEndpoints } : {},
|
|
10540
10577
|
...hasHttpApis ? { httpApis } : {},
|
|
10541
10578
|
...hasCliTools ? { cliTools } : {},
|
|
@@ -10595,6 +10632,15 @@ function capletToServerConfig(frontmatter, body, baseDir, normalizePath) {
|
|
|
10595
10632
|
...sharedCapletFields(frontmatter),
|
|
10596
10633
|
body
|
|
10597
10634
|
};
|
|
10635
|
+
if (frontmatter.googleDiscoveryApi) return {
|
|
10636
|
+
...frontmatter.googleDiscoveryApi,
|
|
10637
|
+
discoveryPath: normalizePath(frontmatter.googleDiscoveryApi.discoveryPath, baseDir),
|
|
10638
|
+
backend: "googleDiscovery",
|
|
10639
|
+
name: frontmatter.name,
|
|
10640
|
+
description: frontmatter.description,
|
|
10641
|
+
...sharedCapletFields(frontmatter),
|
|
10642
|
+
body
|
|
10643
|
+
};
|
|
10598
10644
|
if (frontmatter.graphqlEndpoint) return {
|
|
10599
10645
|
...frontmatter.graphqlEndpoint,
|
|
10600
10646
|
schemaPath: normalizePath(frontmatter.graphqlEndpoint.schemaPath, baseDir),
|
|
@@ -10840,6 +10886,18 @@ const openApiEndpointSchema = object({
|
|
|
10840
10886
|
requestTimeoutMs: number().int().positive().default(6e4),
|
|
10841
10887
|
operationCacheTtlMs: number().int().nonnegative().default(3e4)
|
|
10842
10888
|
}).strict();
|
|
10889
|
+
const operationFilterSchema = array(string().trim().min(1).max(160));
|
|
10890
|
+
const googleDiscoveryApiSchema = object({
|
|
10891
|
+
...commonSchema,
|
|
10892
|
+
discoveryPath: string().min(1).optional(),
|
|
10893
|
+
discoveryUrl: string().min(1).optional(),
|
|
10894
|
+
baseUrl: string().min(1).optional(),
|
|
10895
|
+
includeOperations: operationFilterSchema.optional(),
|
|
10896
|
+
excludeOperations: operationFilterSchema.optional(),
|
|
10897
|
+
auth: authSchema,
|
|
10898
|
+
requestTimeoutMs: number().int().positive().default(6e4),
|
|
10899
|
+
operationCacheTtlMs: number().int().nonnegative().default(3e4)
|
|
10900
|
+
}).strict();
|
|
10843
10901
|
const graphQlOperationSchema = object({
|
|
10844
10902
|
document: string().min(1).optional(),
|
|
10845
10903
|
documentPath: string().min(1).optional(),
|
|
@@ -10953,6 +11011,7 @@ const configSchema = object({
|
|
|
10953
11011
|
}),
|
|
10954
11012
|
mcpServers: record(string().regex(SERVER_ID_PATTERN), mcpServerSchema).default({}),
|
|
10955
11013
|
openapiEndpoints: record(string().regex(SERVER_ID_PATTERN), openApiEndpointSchema).default({}),
|
|
11014
|
+
googleDiscoveryApis: record(string().regex(SERVER_ID_PATTERN), googleDiscoveryApiSchema).default({}),
|
|
10956
11015
|
graphqlEndpoints: record(string().regex(SERVER_ID_PATTERN), graphQlEndpointSchema).default({}),
|
|
10957
11016
|
httpApis: record(string().regex(SERVER_ID_PATTERN), httpApiSchema).default({}),
|
|
10958
11017
|
cliTools: record(string().regex(SERVER_ID_PATTERN), cliToolsSchema).default({}),
|
|
@@ -10988,6 +11047,7 @@ function parseConfig(input) {
|
|
|
10988
11047
|
};
|
|
10989
11048
|
}),
|
|
10990
11049
|
openapiEndpoints: mapBackend(config.openapiEndpoints, "openapi"),
|
|
11050
|
+
googleDiscoveryApis: mapBackend(config.googleDiscoveryApis, "googleDiscovery"),
|
|
10991
11051
|
graphqlEndpoints: mapBackend(config.graphqlEndpoints, "graphql"),
|
|
10992
11052
|
httpApis: mapBackend(config.httpApis, "http"),
|
|
10993
11053
|
cliTools: mapBackend(config.cliTools, "cli"),
|
|
@@ -11081,6 +11141,36 @@ function validateBackends(config, ctx) {
|
|
|
11081
11141
|
"auth"
|
|
11082
11142
|
]);
|
|
11083
11143
|
}
|
|
11144
|
+
for (const [server, raw] of Object.entries(config.googleDiscoveryApis)) {
|
|
11145
|
+
if (Boolean(raw.discoveryPath) === Boolean(raw.discoveryUrl)) ctx.addIssue({
|
|
11146
|
+
code: "custom",
|
|
11147
|
+
path: ["googleDiscoveryApis", server],
|
|
11148
|
+
message: "Google Discovery API must define exactly one discovery source"
|
|
11149
|
+
});
|
|
11150
|
+
if (raw.discoveryUrl && !hasEnvReference$1(raw.discoveryUrl) && !isAllowedRemoteUrl(raw.discoveryUrl)) ctx.addIssue({
|
|
11151
|
+
code: "custom",
|
|
11152
|
+
path: [
|
|
11153
|
+
"googleDiscoveryApis",
|
|
11154
|
+
server,
|
|
11155
|
+
"discoveryUrl"
|
|
11156
|
+
],
|
|
11157
|
+
message: "Google Discovery API discoveryUrl must use https except loopback development urls"
|
|
11158
|
+
});
|
|
11159
|
+
if (raw.baseUrl && !hasEnvReference$1(raw.baseUrl) && !isAllowedHttpBaseUrl(raw.baseUrl)) ctx.addIssue({
|
|
11160
|
+
code: "custom",
|
|
11161
|
+
path: [
|
|
11162
|
+
"googleDiscoveryApis",
|
|
11163
|
+
server,
|
|
11164
|
+
"baseUrl"
|
|
11165
|
+
],
|
|
11166
|
+
message: "Google Discovery API baseUrl must use https except loopback development urls and must not include credentials, query, or fragment"
|
|
11167
|
+
});
|
|
11168
|
+
validateAuthHeaders(raw.auth, ctx, [
|
|
11169
|
+
"googleDiscoveryApis",
|
|
11170
|
+
server,
|
|
11171
|
+
"auth"
|
|
11172
|
+
]);
|
|
11173
|
+
}
|
|
11084
11174
|
for (const [server, raw] of Object.entries(config.graphqlEndpoints)) {
|
|
11085
11175
|
if (Number(Boolean(raw.schemaPath)) + Number(Boolean(raw.schemaUrl)) + Number(raw.introspection === true) !== 1) ctx.addIssue({
|
|
11086
11176
|
code: "custom",
|
|
@@ -11256,6 +11346,7 @@ function capletsFromConfig(config) {
|
|
|
11256
11346
|
return [
|
|
11257
11347
|
...Object.values(config.mcpServers),
|
|
11258
11348
|
...Object.values(config.openapiEndpoints),
|
|
11349
|
+
...Object.values(config.googleDiscoveryApis ?? {}),
|
|
11259
11350
|
...Object.values(config.graphqlEndpoints),
|
|
11260
11351
|
...Object.values(config.httpApis),
|
|
11261
11352
|
...Object.values(config.cliTools),
|
|
@@ -11264,6 +11355,7 @@ function capletsFromConfig(config) {
|
|
|
11264
11355
|
}
|
|
11265
11356
|
function localReferencePaths(caplet) {
|
|
11266
11357
|
if (caplet.backend === "openapi") return filterLocalReferences([caplet.specPath]);
|
|
11358
|
+
if (caplet.backend === "googleDiscovery") return filterLocalReferences([caplet.discoveryPath]);
|
|
11267
11359
|
if (caplet.backend === "graphql") return filterLocalReferences([caplet.schemaPath, ...Object.values(caplet.operations ?? {}).map((operation) => operation.documentPath)]);
|
|
11268
11360
|
if (caplet.backend === "caplets") return filterLocalReferences([caplet.configPath]);
|
|
11269
11361
|
return [];
|
package/dist/cli/add.d.ts
CHANGED
|
@@ -27,6 +27,12 @@ type AddOpenApiOptions = AddDestinationOptions & {
|
|
|
27
27
|
baseUrl?: string;
|
|
28
28
|
tokenEnv?: string;
|
|
29
29
|
};
|
|
30
|
+
type AddGoogleDiscoveryOptions = AddDestinationOptions & {
|
|
31
|
+
discovery?: string;
|
|
32
|
+
discoveryUrl?: string;
|
|
33
|
+
baseUrl?: string;
|
|
34
|
+
tokenEnv?: string;
|
|
35
|
+
};
|
|
30
36
|
type AddGraphqlOptions = AddDestinationOptions & {
|
|
31
37
|
endpointUrl?: string;
|
|
32
38
|
schema?: string;
|
|
@@ -50,6 +56,10 @@ export declare function addOpenApiCaplet(id: string, options: AddOpenApiOptions)
|
|
|
50
56
|
path?: string;
|
|
51
57
|
text: string;
|
|
52
58
|
};
|
|
59
|
+
export declare function addGoogleDiscoveryCaplet(id: string, options: AddGoogleDiscoveryOptions): {
|
|
60
|
+
path?: string;
|
|
61
|
+
text: string;
|
|
62
|
+
};
|
|
53
63
|
export declare function addGraphqlCaplet(id: string, options: AddGraphqlOptions): {
|
|
54
64
|
path?: string;
|
|
55
65
|
text: string;
|
package/dist/cli/auth.d.ts
CHANGED
|
@@ -76,7 +76,29 @@ export declare function localAuthConfigForTarget(options: {
|
|
|
76
76
|
}): CapletsConfig;
|
|
77
77
|
export declare function formatAuthRows(rows: AuthStatusRow[], format: Exclude<AuthListFormat, "json">): string;
|
|
78
78
|
export declare function findAuthTarget(serverId: string, config?: CapletsConfig): AuthTarget | undefined;
|
|
79
|
+
export declare function resolveAuthTarget(serverId: string, config: CapletsConfig, authDir?: string): Promise<AuthTarget | undefined>;
|
|
79
80
|
declare function authTargets(config: ReturnType<typeof loadConfig>): (import("../config").CapletServerConfig | import("../config").OpenApiEndpointConfig | (import("../config").AgentSelectionHintsConfig & {
|
|
81
|
+
server: string;
|
|
82
|
+
backend: "googleDiscovery";
|
|
83
|
+
name: string;
|
|
84
|
+
description: string;
|
|
85
|
+
exposure?: import("../config").CapletExposure | undefined;
|
|
86
|
+
shadowing?: import("../config").CapletShadowingPolicy | undefined;
|
|
87
|
+
tags?: string[] | undefined;
|
|
88
|
+
body?: string | undefined;
|
|
89
|
+
discoveryPath?: string | undefined;
|
|
90
|
+
discoveryUrl?: string | undefined;
|
|
91
|
+
baseUrl?: string | undefined;
|
|
92
|
+
includeOperations?: string[] | undefined;
|
|
93
|
+
excludeOperations?: string[] | undefined;
|
|
94
|
+
auth: import("../config").OpenApiAuthConfig;
|
|
95
|
+
requestTimeoutMs: number;
|
|
96
|
+
operationCacheTtlMs: number;
|
|
97
|
+
disabled: boolean;
|
|
98
|
+
setup?: import("..").CapletSetupConfig | undefined;
|
|
99
|
+
projectBinding?: import("../config").ProjectBindingConfig | undefined;
|
|
100
|
+
runtime?: import("../config").RuntimeRequirementsConfig | undefined;
|
|
101
|
+
} & GenericAuthTarget) | (import("../config").AgentSelectionHintsConfig & {
|
|
80
102
|
server: string;
|
|
81
103
|
backend: "graphql";
|
|
82
104
|
name: string;
|
package/dist/cli/code-mode.d.ts
CHANGED
|
@@ -6,11 +6,14 @@ export type CodeModeCliOptions = {
|
|
|
6
6
|
inlineCode?: string | undefined;
|
|
7
7
|
file?: string | undefined;
|
|
8
8
|
timeoutMs?: number | undefined;
|
|
9
|
+
sessionId?: string | undefined;
|
|
10
|
+
recoveryRef?: string | undefined;
|
|
9
11
|
json?: boolean | undefined;
|
|
10
12
|
readStdin?: (() => Promise<string>) | undefined;
|
|
11
13
|
writeOut: (value: string) => void;
|
|
12
14
|
setExitCode: (code: number) => void;
|
|
13
15
|
};
|
|
14
16
|
export declare function runCodeModeCli(options: CodeModeCliOptions): Promise<void>;
|
|
17
|
+
export declare function runCodeModeReplCli(options: Pick<CodeModeCliOptions, "env" | "configPath" | "projectConfigPath" | "authDir" | "sessionId" | "recoveryRef" | "json" | "writeOut" | "setExitCode">): Promise<void>;
|
|
15
18
|
export declare function codeModeTypesCli(options: Pick<CodeModeCliOptions, "env" | "configPath" | "projectConfigPath" | "authDir" | "json" | "writeOut">): Promise<void>;
|
|
16
19
|
export declare function readCodeModeCliCode(options: Pick<CodeModeCliOptions, "inlineCode" | "file" | "readStdin">): Promise<string>;
|
package/dist/cli/commands.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare const cliCommands: {
|
|
|
32
32
|
};
|
|
33
33
|
export declare const topLevelCommandNames: readonly ["serve", "code-mode", "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"];
|
|
34
34
|
export declare const cliSubcommands: {
|
|
35
|
-
readonly add: readonly ["cli", "mcp", "openapi", "graphql", "http"];
|
|
35
|
+
readonly add: readonly ["cli", "mcp", "openapi", "google-discovery", "graphql", "http"];
|
|
36
36
|
readonly auth: readonly ["login", "logout", "list", "refresh"];
|
|
37
37
|
readonly cloud: readonly ["auth"];
|
|
38
38
|
readonly "code-mode": readonly ["types"];
|
package/dist/cli.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { ProjectBindingWebSocketFactory } from "./project-binding/transport
|
|
|
5
5
|
import { type ServeDaemonOperationOptions, type ServeOptions } from "./serve";
|
|
6
6
|
export { initConfig, starterConfig } from "./cli/init";
|
|
7
7
|
export { installCaplets, normalizeGitRepo } from "./cli/install";
|
|
8
|
-
export { addCliCaplet, addGraphqlCaplet, addHttpCaplet, addMcpCaplet, addOpenApiCaplet, } from "./cli/add";
|
|
8
|
+
export { addCliCaplet, addGoogleDiscoveryCaplet, addGraphqlCaplet, addHttpCaplet, addMcpCaplet, addOpenApiCaplet, } from "./cli/add";
|
|
9
9
|
type CliIO = {
|
|
10
10
|
writeOut?: (value: string) => void;
|
|
11
11
|
writeErr?: (value: string) => void;
|
package/dist/code-mode/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NativeCapletsService } from "../native/service";
|
|
2
|
-
import type { CapletsResult, CodeModeCallableCaplet, Page, PageInput, ReadLogsInput, ReadLogsResult, ToolCallResult } from "./types";
|
|
2
|
+
import type { CapletsResult, CodeModeCallableCaplet, Page, PageInput, ReadCodeModeRecoveryInput, ReadCodeModeRecoveryResult, ReadLogsInput, ReadLogsResult, ToolCallResult } from "./types";
|
|
3
3
|
export type CodeModeCapletHandle = {
|
|
4
4
|
readonly id: string;
|
|
5
5
|
inspect(): Promise<unknown>;
|
|
@@ -19,6 +19,7 @@ export type CodeModeCapletHandle = {
|
|
|
19
19
|
};
|
|
20
20
|
export type CodeModeDebugApi = {
|
|
21
21
|
readLogs(input: ReadLogsInput): Promise<ReadLogsResult>;
|
|
22
|
+
readRecovery(input: ReadCodeModeRecoveryInput): Promise<ReadCodeModeRecoveryResult>;
|
|
22
23
|
};
|
|
23
24
|
export type CodeModeCapletsApi = {
|
|
24
25
|
[capletId: string]: CodeModeCapletHandle | CodeModeDebugApi | (CodeModeCapletHandle & CodeModeDebugApi);
|
|
@@ -27,6 +28,7 @@ export type CodeModeCapletsApi = {
|
|
|
27
28
|
export type CreateCodeModeCapletsApiInput = {
|
|
28
29
|
service: NativeCapletsService;
|
|
29
30
|
readLogs?: (input: ReadLogsInput) => Promise<ReadLogsResult>;
|
|
31
|
+
readRecovery?: (input: ReadCodeModeRecoveryInput) => Promise<ReadCodeModeRecoveryResult>;
|
|
30
32
|
};
|
|
31
33
|
export declare function listCodeModeCallableCaplets(service: NativeCapletsService): CodeModeCallableCaplet[];
|
|
32
34
|
export declare function createCodeModeCapletsApi(input: CreateCodeModeCapletsApiInput): CodeModeCapletsApi;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CODE_MODE_DIAGNOSTICS_BUILTINS_DECLARATION: "type CodeModeBufferEncoding=\"utf8\"|\"utf-8\"|\"base64\"|\"base64url\"|\"hex\";interface CodeModeBuffer{readonly byteLength:number;readonly length:number;toString(encoding?:CodeModeBufferEncoding):string;toUint8Array():Uint8Array;}interface CodeModeBufferConstructor{from(input:string|ArrayLike<number>|ArrayBuffer|ArrayBufferView|CodeModeBuffer,encoding?:CodeModeBufferEncoding,):CodeModeBuffer;isBuffer(value:unknown):value is CodeModeBuffer;byteLength(input:string|ArrayLike<number>|ArrayBuffer|ArrayBufferView|CodeModeBuffer,encoding?:CodeModeBufferEncoding,):number;}declare const Buffer:CodeModeBufferConstructor;declare function atob(input:string):string;declare function btoa(input:string):string;type CodeModeURLSearchParamsInit=|string|Array<[string,string]>|Record<string,string>|URLSearchParams;declare class URLSearchParams{constructor(init?:CodeModeURLSearchParamsInit);append(name:string,value:string):void;delete(name:string):void;entries():IterableIterator<[string,string]>;forEach(callback:(value:string,key:string,parent:URLSearchParams)=>void):void;get(name:string):string|null;getAll(name:string):string[];has(name:string):boolean;keys():IterableIterator<string>;set(name:string,value:string):void;toString():string;values():IterableIterator<string>;[Symbol.iterator]():IterableIterator<[string,string]>;}declare class URL{constructor(input:string|URL,base?:string|URL);readonly hash:string;readonly host:string;readonly hostname:string;readonly href:string;readonly origin:string;readonly password:string;readonly pathname:string;readonly port:string;readonly protocol:string;readonly search:string;readonly searchParams:URLSearchParams;readonly username:string;toJSON():string;toString():string;}declare class TextEncoder{readonly encoding:\"utf-8\";encode(input?:string):Uint8Array;}declare class TextDecoder{readonly encoding:\"utf-8\";constructor(label?:string);decode(input?:ArrayBuffer|ArrayBufferView):string;}interface CodeModeCrypto{randomUUID():string;getRandomValues<T extends ArrayBufferView>(typedArray:T):T;}declare const crypto:CodeModeCrypto;declare function structuredClone<T>(value:T):T;type CodeModeHeadersInit=Headers|Record<string,string>|Array<[string,string]>;declare class Headers{constructor(init?:CodeModeHeadersInit);append(name:string,value:string):void;delete(name:string):void;entries():IterableIterator<[string,string]>;forEach(callback:(value:string,key:string,parent:Headers)=>void):void;get(name:string):string|null;has(name:string):boolean;keys():IterableIterator<string>;set(name:string,value:string):void;values():IterableIterator<string>;[Symbol.iterator]():IterableIterator<[string,string]>;}type CodeModeBlobPart=string|ArrayBuffer|ArrayBufferView|Blob;type CodeModeEndingType=\"transparent\"|\"native\";declare class Blob{constructor(parts?:CodeModeBlobPart[],options?:{type?:string;endings?:CodeModeEndingType},);readonly size:number;readonly type:string;arrayBuffer():Promise<ArrayBuffer>;slice(start?:number,end?:number,type?:string):Blob;text():Promise<string>;}declare class File extends Blob{constructor(parts:CodeModeBlobPart[],name:string,options?:{type?:string;lastModified?:number},);readonly lastModified:number;readonly name:string;}declare class FormData{constructor();append(name:string,value:string|Blob,filename?:string):void;delete(name:string):void;entries():IterableIterator<[string,string|File]>;get(name:string):string|File|null;getAll(name:string):Array<string|File>;has(name:string):boolean;keys():IterableIterator<string>;set(name:string,value:string|Blob,filename?:string):void;values():IterableIterator<string|File>;[Symbol.iterator]():IterableIterator<[string,string|File]>;}type CodeModeReadableStreamReadResult<T>=|{done:false;value:T}|{done:true;value?:undefined};interface ReadableStreamDefaultController<T>{enqueue(value:T):void;close():void;}interface ReadableStreamDefaultReader<T>{read():Promise<CodeModeReadableStreamReadResult<T>>;}declare class ReadableStream<T=unknown>{constructor(source?:{start?:(controller:ReadableStreamDefaultController<T>)=>void});getReader():ReadableStreamDefaultReader<T>;}interface WritableStreamDefaultWriter<T>{write(chunk:T):Promise<void>;close():Promise<void>;}declare class WritableStream<T=unknown>{constructor(sink?:{write?:(chunk:T)=>unknown;close?:()=>unknown});getWriter():WritableStreamDefaultWriter<T>;}interface TransformStreamDefaultController<T>{enqueue(value:T):void;}declare class TransformStream<I=unknown,O=unknown>{constructor(transformer?:{transform?:(chunk:I,controller:TransformStreamDefaultController<O>)=>void;flush?:(controller:ReadableStreamDefaultController<O>)=>void;});readonly readable:ReadableStream<O>;readonly writable:WritableStream<I>;}type CodeModeAbortListener=(event:{type:\"abort\";target:AbortSignal})=>void;declare class AbortSignal{readonly aborted:boolean;readonly reason:unknown;onabort:CodeModeAbortListener|null;addEventListener(type:\"abort\",listener:CodeModeAbortListener|null):void;removeEventListener(type:\"abort\",listener:CodeModeAbortListener|null):void;dispatchEvent(event:{type:\"abort\";target:AbortSignal}):boolean;throwIfAborted():void;static abort(reason?:unknown):AbortSignal;}declare class AbortController{readonly signal:AbortSignal;abort(reason?:unknown):void;}type CodeModeBodyInit=Blob|FormData|string|ArrayBuffer|ArrayBufferView|null|undefined;interface Body{readonly body:null;readonly bodyUsed:boolean;arrayBuffer():Promise<ArrayBuffer>;blob():Promise<Blob>;formData():Promise<FormData>;json():Promise<unknown>;text():Promise<string>;}declare class Request implements Body{constructor(input:string|URL|Request,init?:{method?:string;headers?:CodeModeHeadersInit;body?:CodeModeBodyInit;signal?:AbortSignal;},);readonly body:null;readonly bodyUsed:boolean;readonly headers:Headers;readonly method:string;readonly signal:AbortSignal;readonly url:string;arrayBuffer():Promise<ArrayBuffer>;blob():Promise<Blob>;clone():Request;formData():Promise<FormData>;json():Promise<unknown>;text():Promise<string>;}declare class Response implements Body{constructor(body?:CodeModeBodyInit,init?:{headers?:CodeModeHeadersInit;status?:number;statusText?:string},);readonly body:null;readonly bodyUsed:boolean;readonly headers:Headers;readonly ok:boolean;readonly redirected:false;readonly status:number;readonly statusText:string;readonly type:\"default\";readonly url:\"\";arrayBuffer():Promise<ArrayBuffer>;blob():Promise<Blob>;clone():Response;formData():Promise<FormData>;json():Promise<unknown>;text():Promise<string>;static json(data:unknown,init?:{headers?:CodeModeHeadersInit;status?:number;statusText?:string},):Response;}declare function queueMicrotask(callback:()=>void):void;type CodeModeTimerHandler=(...args:unknown[])=>void;declare function setTimeout(callback:CodeModeTimerHandler,delay?:number,...args:unknown[]):number;declare function clearTimeout(timerId:number):void;declare function setInterval(callback:CodeModeTimerHandler,delay?:number,...args:unknown[]):number;declare function clearInterval(timerId:number):void;";
|
|
@@ -4,5 +4,13 @@ export type DiagnoseCodeModeTypeScriptInput = {
|
|
|
4
4
|
declaration: string;
|
|
5
5
|
maxDiagnostics?: number;
|
|
6
6
|
timeoutMs?: number;
|
|
7
|
+
session?: CodeModeDiagnosticsSession;
|
|
7
8
|
};
|
|
8
9
|
export declare function diagnoseCodeModeTypeScript(input: DiagnoseCodeModeTypeScriptInput): CodeModeDiagnostic[];
|
|
10
|
+
export declare class CodeModeDiagnosticsSession {
|
|
11
|
+
#private;
|
|
12
|
+
declaration(): string;
|
|
13
|
+
recordSuccessfulCell(code: string, declaration?: string): void;
|
|
14
|
+
clear(): void;
|
|
15
|
+
private declarationExcluding;
|
|
16
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { codeModeDeclarationHash, generateCodeModeDeclarations, generateCodeModeRunToolDescription, minifyCodeModeDeclarationText, } from "./declarations";
|
|
2
2
|
export { hasDirectFetchCall, hasExecutableImport } from "./static-analysis";
|
|
3
|
-
export type { CodeModeCallableCaplet, CodeModeDeclarationInput, CodeModeDiagnostic, CodeModeLogEntry, CodeModeLogs, CodeModeRunEnvelope, CodeModeRunError, CodeModeRunMeta, CodeModeTypesJson, JsonPrimitive, JsonValue, ReadLogsInput, ReadLogsResult, ToolCallError, ToolCallMeta, ToolCallResult, } from "./types";
|
|
3
|
+
export type { CodeModeCallableCaplet, CodeModeDeclarationInput, CodeModeDiagnostic, CodeModeLogEntry, CodeModeLogs, CodeModeRecoveryClassification, CodeModeRecoveryEntry, CodeModeRunEnvelope, CodeModeRunError, CodeModeRunMeta, CodeModeSessionStatus, CodeModeTypesJson, JsonPrimitive, JsonValue, ReadCodeModeRecoveryInput, ReadCodeModeRecoveryResult, ReadLogsInput, ReadLogsResult, ToolCallError, ToolCallMeta, ToolCallResult, } from "./types";
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { CodeModeDiagnostic } from "./types";
|
|
2
|
+
export type CodeModeRecoveryClassification = "setup_like" | "side_effecting" | "unknown";
|
|
3
|
+
export type CodeModeJournalOutcome = {
|
|
4
|
+
ok: true;
|
|
5
|
+
} | {
|
|
6
|
+
ok: false;
|
|
7
|
+
code: string;
|
|
8
|
+
message: string;
|
|
9
|
+
};
|
|
10
|
+
export type CodeModeJournalEntry = {
|
|
11
|
+
timestamp: string;
|
|
12
|
+
code: string;
|
|
13
|
+
declarationHash: string;
|
|
14
|
+
outcome: CodeModeJournalOutcome;
|
|
15
|
+
diagnostics: Array<Pick<CodeModeDiagnostic, "code" | "severity" | "message">>;
|
|
16
|
+
recoveryClassification: CodeModeRecoveryClassification;
|
|
17
|
+
logsStored?: boolean;
|
|
18
|
+
summary?: string;
|
|
19
|
+
};
|
|
20
|
+
export type StoreCodeModeJournalEntryInput = {
|
|
21
|
+
sessionId: string;
|
|
22
|
+
journalScope?: string;
|
|
23
|
+
code: string;
|
|
24
|
+
declarationHash: string;
|
|
25
|
+
outcome: CodeModeJournalOutcome;
|
|
26
|
+
diagnostics: CodeModeDiagnostic[];
|
|
27
|
+
recoveryClassification: CodeModeRecoveryClassification;
|
|
28
|
+
logRef?: string;
|
|
29
|
+
summary?: string;
|
|
30
|
+
};
|
|
31
|
+
export type StoreCodeModeJournalEntryResult = {
|
|
32
|
+
recoveryRef: string;
|
|
33
|
+
expiresAt: string;
|
|
34
|
+
journalKey: string;
|
|
35
|
+
};
|
|
36
|
+
export type ReadCodeModeRecoveryInput = {
|
|
37
|
+
recoveryRef: string;
|
|
38
|
+
cursor?: string;
|
|
39
|
+
limit?: number;
|
|
40
|
+
};
|
|
41
|
+
export type ReadCodeModeRecoveryResult = {
|
|
42
|
+
entries: CodeModeJournalEntry[];
|
|
43
|
+
nextCursor?: string;
|
|
44
|
+
};
|
|
45
|
+
export type CodeModeJournalLookupResult = {
|
|
46
|
+
expiresAt: string;
|
|
47
|
+
recoveryRef?: string;
|
|
48
|
+
};
|
|
49
|
+
export type CodeModeJournalStoreOptions = {
|
|
50
|
+
stateDir?: string;
|
|
51
|
+
now?: () => Date;
|
|
52
|
+
retentionMs?: number;
|
|
53
|
+
maxEntries?: number;
|
|
54
|
+
maxCodeBytes?: number;
|
|
55
|
+
maxSummaryBytes?: number;
|
|
56
|
+
secret?: string;
|
|
57
|
+
};
|
|
58
|
+
export declare class CodeModeJournalStore {
|
|
59
|
+
private readonly stateDir;
|
|
60
|
+
private readonly now;
|
|
61
|
+
private readonly retentionMs;
|
|
62
|
+
private readonly maxEntries;
|
|
63
|
+
private readonly maxCodeBytes;
|
|
64
|
+
private readonly maxSummaryBytes;
|
|
65
|
+
private readonly configuredSecret;
|
|
66
|
+
private secret;
|
|
67
|
+
private recoveryRefs;
|
|
68
|
+
private sessionRecoveryRefs;
|
|
69
|
+
private nextPruneAt;
|
|
70
|
+
constructor(options?: CodeModeJournalStoreOptions);
|
|
71
|
+
store(input: StoreCodeModeJournalEntryInput): Promise<StoreCodeModeJournalEntryResult>;
|
|
72
|
+
lookupSession(sessionId: string): Promise<CodeModeJournalLookupResult | undefined>;
|
|
73
|
+
lookupRecoveryRef(recoveryRef: string): Promise<CodeModeJournalLookupResult | undefined>;
|
|
74
|
+
readRecovery(input: ReadCodeModeRecoveryInput): Promise<ReadCodeModeRecoveryResult>;
|
|
75
|
+
private entryFromInput;
|
|
76
|
+
private findByRecoveryRefHash;
|
|
77
|
+
private findBySessionIdHash;
|
|
78
|
+
private findByRecoveryRefHashSlow;
|
|
79
|
+
private findBySessionIdHashSlow;
|
|
80
|
+
private writeIndex;
|
|
81
|
+
private readIndexPath;
|
|
82
|
+
private readJournalPath;
|
|
83
|
+
private writeJournal;
|
|
84
|
+
private pruneExpired;
|
|
85
|
+
private isExpired;
|
|
86
|
+
private journalKey;
|
|
87
|
+
private recoveryRefHash;
|
|
88
|
+
private recoveryRefForJournalKey;
|
|
89
|
+
private sessionIdHash;
|
|
90
|
+
private hmac;
|
|
91
|
+
private loadSecret;
|
|
92
|
+
private ensureJournalDir;
|
|
93
|
+
private journalDir;
|
|
94
|
+
private journalPath;
|
|
95
|
+
private recoveryIndexPath;
|
|
96
|
+
private sessionIndexPath;
|
|
97
|
+
private secretPath;
|
|
98
|
+
}
|
|
99
|
+
export declare function classifyCodeModeRecovery(input: {
|
|
100
|
+
code: string;
|
|
101
|
+
invokedCaplet: boolean;
|
|
102
|
+
sessionDisposedAfterRun?: boolean;
|
|
103
|
+
}): CodeModeRecoveryClassification;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { QuickJSContext, QuickJSDeferredPromise } from "quickjs-emscripten";
|
|
2
|
+
export type CodeModePlatformHost = {
|
|
3
|
+
dispose(): void;
|
|
4
|
+
};
|
|
5
|
+
export type CodeModePlatformHostOptions = Record<string, never>;
|
|
6
|
+
export declare function installCodeModePlatformHost(context: QuickJSContext, pendingDeferreds: Set<QuickJSDeferredPromise>, _options: CodeModePlatformHostOptions): CodeModePlatformHost;
|