@caplets/core 0.21.1 → 0.23.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 +66 -0
- package/dist/caplet-sets.d.ts +2 -0
- package/dist/caplet-source.js +101 -4
- package/dist/cli/add.d.ts +10 -0
- package/dist/cli/auth.d.ts +24 -0
- package/dist/cli/commands.d.ts +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/code-mode/diagnostics-builtins.generated.d.ts +1 -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/types.d.ts +1 -0
- package/dist/code-mode.js +18 -13
- package/dist/{completion-Cb-pshjL.js → completion-BC4BNWo0.js} +14 -2
- package/dist/config/paths.d.ts +2 -0
- package/dist/config-runtime.d.ts +15 -1
- package/dist/config-runtime.js +46 -0
- package/dist/config.d.ts +32 -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 +111 -26
- 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/remote.d.ts +1 -0
- package/dist/native/service.d.ts +2 -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/runtime-plan.js +1 -1
- package/dist/runtime.d.ts +2 -0
- package/dist/{service-lkrQheFA.js → service-CSRCJfpA.js} +1776 -215
- 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>;
|
|
@@ -390,11 +451,16 @@ export declare const capletFileSchema: z.ZodObject<{
|
|
|
390
451
|
direct_and_code_mode: "direct_and_code_mode";
|
|
391
452
|
progressive_and_code_mode: "progressive_and_code_mode";
|
|
392
453
|
}>>;
|
|
454
|
+
shadowing: z.ZodOptional<z.ZodEnum<{
|
|
455
|
+
forbid: "forbid";
|
|
456
|
+
allow: "allow";
|
|
457
|
+
}>>;
|
|
393
458
|
}, z.core.$strict>;
|
|
394
459
|
export declare function capletJsonSchema(): unknown;
|
|
395
460
|
export type CapletFileConfig = {
|
|
396
461
|
mcpServers?: Record<string, unknown>;
|
|
397
462
|
openapiEndpoints?: Record<string, unknown>;
|
|
463
|
+
googleDiscoveryApis?: Record<string, unknown>;
|
|
398
464
|
graphqlEndpoints?: Record<string, unknown>;
|
|
399
465
|
httpApis?: Record<string, unknown>;
|
|
400
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
|
@@ -10166,6 +10166,7 @@ const capletExposureSchema = _enum([
|
|
|
10166
10166
|
"direct_and_code_mode",
|
|
10167
10167
|
"progressive_and_code_mode"
|
|
10168
10168
|
]).describe("How this Caplet is exposed to agents.");
|
|
10169
|
+
const capletShadowingSchema = _enum(["forbid", "allow"]).describe("Whether attached local Caplets may shadow this remote Caplet ID.");
|
|
10169
10170
|
const capletEndpointAuthSchema = discriminatedUnion("type", [
|
|
10170
10171
|
object({ type: literal("none") }).strict(),
|
|
10171
10172
|
object({
|
|
@@ -10298,6 +10299,36 @@ const capletOpenApiEndpointSchema = object({
|
|
|
10298
10299
|
});
|
|
10299
10300
|
validateEndpointAuthHeaders(endpoint.auth, ctx);
|
|
10300
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
|
+
});
|
|
10301
10332
|
const capletGraphQlOperationSchema = object({
|
|
10302
10333
|
document: string().min(1).optional().describe("Inline GraphQL operation document."),
|
|
10303
10334
|
documentPath: string().min(1).optional().describe("Path to a GraphQL operation document."),
|
|
@@ -10441,25 +10472,27 @@ const capletSetSchema$1 = object({
|
|
|
10441
10472
|
});
|
|
10442
10473
|
});
|
|
10443
10474
|
const capletFileSchema = object({
|
|
10444
|
-
$schema: string().
|
|
10475
|
+
$schema: string().optional().describe("Optional JSON Schema for editor validation."),
|
|
10445
10476
|
name: string().trim().min(1).max(80).describe("Human-readable Caplet display name."),
|
|
10446
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"),
|
|
10447
10478
|
tags: array(string().trim().min(1).max(80)).optional().describe("Optional tags for grouping or searching Caplets."),
|
|
10448
10479
|
exposure: capletExposureSchema.optional(),
|
|
10480
|
+
shadowing: capletShadowingSchema.optional(),
|
|
10449
10481
|
...capletAgentSelectionHintsSchema,
|
|
10450
10482
|
setup: capletSetupSchema.optional(),
|
|
10451
10483
|
projectBinding: capletProjectBindingSchema.optional(),
|
|
10452
10484
|
runtime: capletRuntimeRequirementsSchema.optional(),
|
|
10453
10485
|
mcpServer: capletMcpServerSchema.describe("MCP server backend configuration for this Caplet.").optional(),
|
|
10454
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(),
|
|
10455
10488
|
graphqlEndpoint: capletGraphQlEndpointSchema.describe("GraphQL endpoint backend configuration for this Caplet.").optional(),
|
|
10456
10489
|
httpApi: capletHttpApiSchema.describe("HTTP API backend configuration for this Caplet.").optional(),
|
|
10457
10490
|
cliTools: capletCliToolsSchema.describe("CLI tools backend configuration for this Caplet.").optional(),
|
|
10458
10491
|
capletSet: capletSetSchema$1.describe("Nested Caplet collection backend configuration for this Caplet.").optional()
|
|
10459
10492
|
}).strict().superRefine((frontmatter, ctx) => {
|
|
10460
|
-
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({
|
|
10461
10494
|
code: "custom",
|
|
10462
|
-
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"
|
|
10463
10496
|
});
|
|
10464
10497
|
});
|
|
10465
10498
|
function loadCapletFilesFromMap(input) {
|
|
@@ -10478,13 +10511,14 @@ function loadCapletFilesFromMap(input) {
|
|
|
10478
10511
|
function buildCapletFileLoadResultFromEntries(root, candidates, readConfig, warnings) {
|
|
10479
10512
|
const servers = {};
|
|
10480
10513
|
const openapiEndpoints = {};
|
|
10514
|
+
const googleDiscoveryApis = {};
|
|
10481
10515
|
const graphqlEndpoints = {};
|
|
10482
10516
|
const httpApis = {};
|
|
10483
10517
|
const cliTools = {};
|
|
10484
10518
|
const capletSets = {};
|
|
10485
10519
|
const paths = {};
|
|
10486
10520
|
function hasId(id) {
|
|
10487
|
-
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]);
|
|
10488
10522
|
}
|
|
10489
10523
|
for (const candidate of candidates) {
|
|
10490
10524
|
if (hasId(candidate.id)) {
|
|
@@ -10511,6 +10545,9 @@ function buildCapletFileLoadResultFromEntries(root, candidates, readConfig, warn
|
|
|
10511
10545
|
if (isPlainObject(config) && config.backend === "openapi") {
|
|
10512
10546
|
const { backend: _backend, ...endpoint } = config;
|
|
10513
10547
|
openapiEndpoints[candidate.id] = endpoint;
|
|
10548
|
+
} else if (isPlainObject(config) && config.backend === "googleDiscovery") {
|
|
10549
|
+
const { backend: _backend, ...api } = config;
|
|
10550
|
+
googleDiscoveryApis[candidate.id] = api;
|
|
10514
10551
|
} else if (isPlainObject(config) && config.backend === "graphql") {
|
|
10515
10552
|
const { backend: _backend, ...endpoint } = config;
|
|
10516
10553
|
graphqlEndpoints[candidate.id] = endpoint;
|
|
@@ -10527,6 +10564,7 @@ function buildCapletFileLoadResultFromEntries(root, candidates, readConfig, warn
|
|
|
10527
10564
|
}
|
|
10528
10565
|
const hasServers = Object.keys(servers).length > 0;
|
|
10529
10566
|
const hasOpenApi = Object.keys(openapiEndpoints).length > 0;
|
|
10567
|
+
const hasGoogleDiscovery = Object.keys(googleDiscoveryApis).length > 0;
|
|
10530
10568
|
const hasGraphQl = Object.keys(graphqlEndpoints).length > 0;
|
|
10531
10569
|
const hasHttpApis = Object.keys(httpApis).length > 0;
|
|
10532
10570
|
const hasCliTools = Object.keys(cliTools).length > 0;
|
|
@@ -10534,6 +10572,7 @@ function buildCapletFileLoadResultFromEntries(root, candidates, readConfig, warn
|
|
|
10534
10572
|
const config = {
|
|
10535
10573
|
...hasServers ? { mcpServers: servers } : {},
|
|
10536
10574
|
...hasOpenApi ? { openapiEndpoints } : {},
|
|
10575
|
+
...hasGoogleDiscovery ? { googleDiscoveryApis } : {},
|
|
10537
10576
|
...hasGraphQl ? { graphqlEndpoints } : {},
|
|
10538
10577
|
...hasHttpApis ? { httpApis } : {},
|
|
10539
10578
|
...hasCliTools ? { cliTools } : {},
|
|
@@ -10593,6 +10632,15 @@ function capletToServerConfig(frontmatter, body, baseDir, normalizePath) {
|
|
|
10593
10632
|
...sharedCapletFields(frontmatter),
|
|
10594
10633
|
body
|
|
10595
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
|
+
};
|
|
10596
10644
|
if (frontmatter.graphqlEndpoint) return {
|
|
10597
10645
|
...frontmatter.graphqlEndpoint,
|
|
10598
10646
|
schemaPath: normalizePath(frontmatter.graphqlEndpoint.schemaPath, baseDir),
|
|
@@ -10643,6 +10691,7 @@ function sharedCapletFields(frontmatter) {
|
|
|
10643
10691
|
return {
|
|
10644
10692
|
...frontmatter.tags ? { tags: frontmatter.tags } : {},
|
|
10645
10693
|
...frontmatter.exposure ? { exposure: frontmatter.exposure } : {},
|
|
10694
|
+
...frontmatter.shadowing ? { shadowing: frontmatter.shadowing } : {},
|
|
10646
10695
|
...frontmatter.useWhen ? { useWhen: frontmatter.useWhen } : {},
|
|
10647
10696
|
...frontmatter.avoidWhen ? { avoidWhen: frontmatter.avoidWhen } : {},
|
|
10648
10697
|
...frontmatter.setup ? { setup: frontmatter.setup } : {},
|
|
@@ -10797,11 +10846,13 @@ const exposureSchema = _enum([
|
|
|
10797
10846
|
"direct_and_code_mode",
|
|
10798
10847
|
"progressive_and_code_mode"
|
|
10799
10848
|
]);
|
|
10849
|
+
const shadowingSchema = _enum(["forbid", "allow"]).default("forbid");
|
|
10800
10850
|
const commonSchema = {
|
|
10801
10851
|
name: string().trim().min(1).max(80),
|
|
10802
10852
|
description: string().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"),
|
|
10803
10853
|
tags: array(string().trim().min(1).max(80)).optional(),
|
|
10804
10854
|
exposure: exposureSchema.optional(),
|
|
10855
|
+
shadowing: shadowingSchema,
|
|
10805
10856
|
...agentSelectionHintsSchema,
|
|
10806
10857
|
body: string().optional(),
|
|
10807
10858
|
setup: setupSchema.optional(),
|
|
@@ -10835,6 +10886,18 @@ const openApiEndpointSchema = object({
|
|
|
10835
10886
|
requestTimeoutMs: number().int().positive().default(6e4),
|
|
10836
10887
|
operationCacheTtlMs: number().int().nonnegative().default(3e4)
|
|
10837
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();
|
|
10838
10901
|
const graphQlOperationSchema = object({
|
|
10839
10902
|
document: string().min(1).optional(),
|
|
10840
10903
|
documentPath: string().min(1).optional(),
|
|
@@ -10948,6 +11011,7 @@ const configSchema = object({
|
|
|
10948
11011
|
}),
|
|
10949
11012
|
mcpServers: record(string().regex(SERVER_ID_PATTERN), mcpServerSchema).default({}),
|
|
10950
11013
|
openapiEndpoints: record(string().regex(SERVER_ID_PATTERN), openApiEndpointSchema).default({}),
|
|
11014
|
+
googleDiscoveryApis: record(string().regex(SERVER_ID_PATTERN), googleDiscoveryApiSchema).default({}),
|
|
10951
11015
|
graphqlEndpoints: record(string().regex(SERVER_ID_PATTERN), graphQlEndpointSchema).default({}),
|
|
10952
11016
|
httpApis: record(string().regex(SERVER_ID_PATTERN), httpApiSchema).default({}),
|
|
10953
11017
|
cliTools: record(string().regex(SERVER_ID_PATTERN), cliToolsSchema).default({}),
|
|
@@ -10983,6 +11047,7 @@ function parseConfig(input) {
|
|
|
10983
11047
|
};
|
|
10984
11048
|
}),
|
|
10985
11049
|
openapiEndpoints: mapBackend(config.openapiEndpoints, "openapi"),
|
|
11050
|
+
googleDiscoveryApis: mapBackend(config.googleDiscoveryApis, "googleDiscovery"),
|
|
10986
11051
|
graphqlEndpoints: mapBackend(config.graphqlEndpoints, "graphql"),
|
|
10987
11052
|
httpApis: mapBackend(config.httpApis, "http"),
|
|
10988
11053
|
cliTools: mapBackend(config.cliTools, "cli"),
|
|
@@ -11076,6 +11141,36 @@ function validateBackends(config, ctx) {
|
|
|
11076
11141
|
"auth"
|
|
11077
11142
|
]);
|
|
11078
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
|
+
}
|
|
11079
11174
|
for (const [server, raw] of Object.entries(config.graphqlEndpoints)) {
|
|
11080
11175
|
if (Number(Boolean(raw.schemaPath)) + Number(Boolean(raw.schemaUrl)) + Number(raw.introspection === true) !== 1) ctx.addIssue({
|
|
11081
11176
|
code: "custom",
|
|
@@ -11251,6 +11346,7 @@ function capletsFromConfig(config) {
|
|
|
11251
11346
|
return [
|
|
11252
11347
|
...Object.values(config.mcpServers),
|
|
11253
11348
|
...Object.values(config.openapiEndpoints),
|
|
11349
|
+
...Object.values(config.googleDiscoveryApis ?? {}),
|
|
11254
11350
|
...Object.values(config.graphqlEndpoints),
|
|
11255
11351
|
...Object.values(config.httpApis),
|
|
11256
11352
|
...Object.values(config.cliTools),
|
|
@@ -11259,6 +11355,7 @@ function capletsFromConfig(config) {
|
|
|
11259
11355
|
}
|
|
11260
11356
|
function localReferencePaths(caplet) {
|
|
11261
11357
|
if (caplet.backend === "openapi") return filterLocalReferences([caplet.specPath]);
|
|
11358
|
+
if (caplet.backend === "googleDiscovery") return filterLocalReferences([caplet.discoveryPath]);
|
|
11262
11359
|
if (caplet.backend === "graphql") return filterLocalReferences([caplet.schemaPath, ...Object.values(caplet.operations ?? {}).map((operation) => operation.documentPath)]);
|
|
11263
11360
|
if (caplet.backend === "caplets") return filterLocalReferences([caplet.configPath]);
|
|
11264
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,12 +76,35 @@ 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;
|
|
83
105
|
description: string;
|
|
84
106
|
exposure?: import("../config").CapletExposure | undefined;
|
|
107
|
+
shadowing?: import("../config").CapletShadowingPolicy | undefined;
|
|
85
108
|
tags?: string[] | undefined;
|
|
86
109
|
body?: string | undefined;
|
|
87
110
|
endpointUrl: string;
|
|
@@ -103,6 +126,7 @@ declare function authTargets(config: ReturnType<typeof loadConfig>): (import("..
|
|
|
103
126
|
name: string;
|
|
104
127
|
description: string;
|
|
105
128
|
exposure?: import("../config").CapletExposure | undefined;
|
|
129
|
+
shadowing?: import("../config").CapletShadowingPolicy | undefined;
|
|
106
130
|
tags?: string[] | undefined;
|
|
107
131
|
body?: string | undefined;
|
|
108
132
|
baseUrl: 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;
|
|
@@ -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;";
|
|
@@ -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;
|