@inkeep/agents-cli 0.22.12 → 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/index.js +705 -555
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -2846,7 +2846,8 @@ var init_schemas = __esm({
|
|
|
2846
2846
|
status: ToolStatusSchema.default("unknown"),
|
|
2847
2847
|
version: z2.string().optional(),
|
|
2848
2848
|
createdAt: z2.date(),
|
|
2849
|
-
updatedAt: z2.date()
|
|
2849
|
+
updatedAt: z2.date(),
|
|
2850
|
+
expiresAt: z2.date().optional()
|
|
2850
2851
|
});
|
|
2851
2852
|
MCPToolConfigSchema = McpToolSchema.omit({
|
|
2852
2853
|
config: true,
|
|
@@ -217960,190 +217961,21 @@ var init_apiKeys = __esm({
|
|
|
217960
217961
|
}
|
|
217961
217962
|
});
|
|
217962
217963
|
|
|
217963
|
-
// ../
|
|
217964
|
-
var
|
|
217965
|
-
|
|
217966
|
-
|
|
217967
|
-
init_esm_shims();
|
|
217968
|
-
}
|
|
217969
|
-
});
|
|
217970
|
-
|
|
217971
|
-
// ../packages/agents-core/src/utils/error.ts
|
|
217972
|
-
function getTitleFromCode(code) {
|
|
217973
|
-
switch (code) {
|
|
217974
|
-
case "bad_request":
|
|
217975
|
-
return "Bad Request";
|
|
217976
|
-
case "unauthorized":
|
|
217977
|
-
return "Unauthorized";
|
|
217978
|
-
case "forbidden":
|
|
217979
|
-
return "Forbidden";
|
|
217980
|
-
case "not_found":
|
|
217981
|
-
return "Not Found";
|
|
217982
|
-
case "conflict":
|
|
217983
|
-
return "Conflict";
|
|
217984
|
-
case "unprocessable_entity":
|
|
217985
|
-
return "Unprocessable Entity";
|
|
217986
|
-
case "internal_server_error":
|
|
217987
|
-
return "Internal Server Error";
|
|
217988
|
-
default:
|
|
217989
|
-
return "Error";
|
|
217990
|
-
}
|
|
217991
|
-
}
|
|
217992
|
-
var ErrorCode, errorCodeToHttpStatus, problemDetailsSchema, errorResponseSchema, toTitleCase, errorSchemaFactory, commonCreateErrorResponses, commonUpdateErrorResponses, commonGetErrorResponses, commonDeleteErrorResponses;
|
|
217993
|
-
var init_error = __esm({
|
|
217994
|
-
"../packages/agents-core/src/utils/error.ts"() {
|
|
217995
|
-
"use strict";
|
|
217996
|
-
init_esm_shims();
|
|
217997
|
-
init_dist4();
|
|
217998
|
-
init_http_exception();
|
|
217999
|
-
init_logger();
|
|
218000
|
-
ErrorCode = z2.enum([
|
|
218001
|
-
"bad_request",
|
|
218002
|
-
"unauthorized",
|
|
218003
|
-
"forbidden",
|
|
218004
|
-
"not_found",
|
|
218005
|
-
"conflict",
|
|
218006
|
-
"internal_server_error",
|
|
218007
|
-
"unprocessable_entity"
|
|
218008
|
-
]);
|
|
218009
|
-
errorCodeToHttpStatus = {
|
|
218010
|
-
bad_request: 400,
|
|
218011
|
-
unauthorized: 401,
|
|
218012
|
-
forbidden: 403,
|
|
218013
|
-
not_found: 404,
|
|
218014
|
-
conflict: 409,
|
|
218015
|
-
unprocessable_entity: 422,
|
|
218016
|
-
internal_server_error: 500
|
|
218017
|
-
};
|
|
218018
|
-
problemDetailsSchema = z2.object({
|
|
218019
|
-
// type: z.string().url().openapi({
|
|
218020
|
-
// description: "A URI reference that identifies the problem type.",
|
|
218021
|
-
// example: `${ERROR_DOCS_BASE_URL}#not-found`,
|
|
218022
|
-
// }),
|
|
218023
|
-
title: z2.string().openapi({
|
|
218024
|
-
description: "A short, human-readable summary of the problem type.",
|
|
218025
|
-
example: "Resource Not Found"
|
|
218026
|
-
}),
|
|
218027
|
-
status: z2.number().int().openapi({
|
|
218028
|
-
description: "The HTTP status code.",
|
|
218029
|
-
example: 404
|
|
218030
|
-
}),
|
|
218031
|
-
detail: z2.string().openapi({
|
|
218032
|
-
description: "A human-readable explanation specific to this occurrence of the problem.",
|
|
218033
|
-
example: "The requested resource was not found."
|
|
218034
|
-
}),
|
|
218035
|
-
instance: z2.string().optional().openapi({
|
|
218036
|
-
description: "A URI reference that identifies the specific occurrence of the problem.",
|
|
218037
|
-
example: "/conversations/123"
|
|
218038
|
-
}),
|
|
218039
|
-
requestId: z2.string().optional().openapi({
|
|
218040
|
-
description: "A unique identifier for the request, useful for troubleshooting.",
|
|
218041
|
-
example: "req_1234567890"
|
|
218042
|
-
}),
|
|
218043
|
-
code: ErrorCode.openapi({
|
|
218044
|
-
description: "A short code indicating the error code returned.",
|
|
218045
|
-
example: "not_found"
|
|
218046
|
-
})
|
|
218047
|
-
}).openapi("ProblemDetails");
|
|
218048
|
-
errorResponseSchema = z2.object({
|
|
218049
|
-
error: z2.object({
|
|
218050
|
-
code: ErrorCode.openapi({
|
|
218051
|
-
description: "A short code indicating the error code returned.",
|
|
218052
|
-
example: "not_found"
|
|
218053
|
-
}),
|
|
218054
|
-
message: z2.string().openapi({
|
|
218055
|
-
description: "A human readable error message.",
|
|
218056
|
-
example: "The requested resource was not found."
|
|
218057
|
-
})
|
|
218058
|
-
})
|
|
218059
|
-
}).openapi("ErrorResponse");
|
|
218060
|
-
toTitleCase = (str) => str?.replace(/\w+/g, (word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).replace(/\s+/g, "") ?? "";
|
|
218061
|
-
errorSchemaFactory = (code, description) => ({
|
|
218062
|
-
description,
|
|
218063
|
-
content: {
|
|
218064
|
-
"application/problem+json": {
|
|
218065
|
-
schema: problemDetailsSchema.extend({
|
|
218066
|
-
code: z2.literal(code).openapi({
|
|
218067
|
-
description: "A short code indicating the error code returned.",
|
|
218068
|
-
example: code
|
|
218069
|
-
}),
|
|
218070
|
-
detail: z2.string().openapi({
|
|
218071
|
-
description: "A detailed explanation specific to this occurrence of the problem, providing context and specifics about what went wrong.",
|
|
218072
|
-
example: description
|
|
218073
|
-
}),
|
|
218074
|
-
title: z2.string().openapi({
|
|
218075
|
-
description: "A short, human-readable summary of the problem type.",
|
|
218076
|
-
example: getTitleFromCode(code)
|
|
218077
|
-
}),
|
|
218078
|
-
// type: z.string().url().openapi({
|
|
218079
|
-
// description: "A URI reference that identifies the problem type.",
|
|
218080
|
-
// example: `${ERROR_DOCS_BASE_URL}#${code}`,
|
|
218081
|
-
// }),
|
|
218082
|
-
status: z2.literal(errorCodeToHttpStatus[code]).openapi({
|
|
218083
|
-
description: "The HTTP status code.",
|
|
218084
|
-
example: errorCodeToHttpStatus[code]
|
|
218085
|
-
}),
|
|
218086
|
-
error: z2.object({
|
|
218087
|
-
code: z2.literal(code).openapi({
|
|
218088
|
-
description: "A short code indicating the error code returned.",
|
|
218089
|
-
example: code
|
|
218090
|
-
}),
|
|
218091
|
-
message: z2.string().openapi({
|
|
218092
|
-
description: "A concise error message suitable for display to end users. May be truncated if the full detail is long.",
|
|
218093
|
-
example: description.length > 100 ? `${description.substring(0, 97)}...` : description
|
|
218094
|
-
})
|
|
218095
|
-
}).openapi({
|
|
218096
|
-
description: "Legacy error format for backward compatibility."
|
|
218097
|
-
})
|
|
218098
|
-
}).openapi(toTitleCase(description))
|
|
218099
|
-
}
|
|
218100
|
-
}
|
|
218101
|
-
});
|
|
218102
|
-
commonCreateErrorResponses = {
|
|
218103
|
-
400: errorSchemaFactory("bad_request", "Bad Request"),
|
|
218104
|
-
401: errorSchemaFactory("unauthorized", "Unauthorized"),
|
|
218105
|
-
403: errorSchemaFactory("forbidden", "Forbidden"),
|
|
218106
|
-
422: errorSchemaFactory("unprocessable_entity", "Unprocessable Entity"),
|
|
218107
|
-
500: errorSchemaFactory("internal_server_error", "Internal Server Error")
|
|
218108
|
-
};
|
|
218109
|
-
commonUpdateErrorResponses = {
|
|
218110
|
-
400: errorSchemaFactory("bad_request", "Bad Request"),
|
|
218111
|
-
401: errorSchemaFactory("unauthorized", "Unauthorized"),
|
|
218112
|
-
403: errorSchemaFactory("forbidden", "Forbidden"),
|
|
218113
|
-
404: errorSchemaFactory("not_found", "Not Found"),
|
|
218114
|
-
422: errorSchemaFactory("unprocessable_entity", "Unprocessable Entity"),
|
|
218115
|
-
500: errorSchemaFactory("internal_server_error", "Internal Server Error")
|
|
218116
|
-
};
|
|
218117
|
-
commonGetErrorResponses = {
|
|
218118
|
-
400: errorSchemaFactory("bad_request", "Bad Request"),
|
|
218119
|
-
401: errorSchemaFactory("unauthorized", "Unauthorized"),
|
|
218120
|
-
403: errorSchemaFactory("forbidden", "Forbidden"),
|
|
218121
|
-
404: errorSchemaFactory("not_found", "Not Found"),
|
|
218122
|
-
422: errorSchemaFactory("unprocessable_entity", "Unprocessable Entity"),
|
|
218123
|
-
500: errorSchemaFactory("internal_server_error", "Internal Server Error")
|
|
218124
|
-
};
|
|
218125
|
-
commonDeleteErrorResponses = {
|
|
218126
|
-
400: errorSchemaFactory("bad_request", "Bad Request"),
|
|
218127
|
-
401: errorSchemaFactory("unauthorized", "Unauthorized"),
|
|
218128
|
-
403: errorSchemaFactory("forbidden", "Forbidden"),
|
|
218129
|
-
404: errorSchemaFactory("not_found", "Not Found"),
|
|
218130
|
-
422: errorSchemaFactory("unprocessable_entity", "Unprocessable Entity"),
|
|
218131
|
-
500: errorSchemaFactory("internal_server_error", "Internal Server Error")
|
|
218132
|
-
};
|
|
218133
|
-
}
|
|
218134
|
-
});
|
|
218135
|
-
|
|
218136
|
-
// ../packages/agents-core/src/utils/execution.ts
|
|
218137
|
-
var init_execution = __esm({
|
|
218138
|
-
"../packages/agents-core/src/utils/execution.ts"() {
|
|
217964
|
+
// ../node_modules/.pnpm/pkce-challenge@5.0.0/node_modules/pkce-challenge/dist/index.node.js
|
|
217965
|
+
var crypto3;
|
|
217966
|
+
var init_index_node = __esm({
|
|
217967
|
+
"../node_modules/.pnpm/pkce-challenge@5.0.0/node_modules/pkce-challenge/dist/index.node.js"() {
|
|
218139
217968
|
"use strict";
|
|
218140
217969
|
init_esm_shims();
|
|
217970
|
+
crypto3 = globalThis.crypto?.webcrypto ?? // Node.js [18-16] REPL
|
|
217971
|
+
globalThis.crypto ?? // Node.js >18
|
|
217972
|
+
import("crypto").then((m2) => m2.webcrypto);
|
|
218141
217973
|
}
|
|
218142
217974
|
});
|
|
218143
217975
|
|
|
218144
217976
|
// ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
|
|
218145
217977
|
import { z as z5 } from "zod";
|
|
218146
|
-
var JSONRPC_VERSION, ProgressTokenSchema, CursorSchema, RequestMetaSchema, BaseRequestParamsSchema, RequestSchema, BaseNotificationParamsSchema, NotificationSchema, ResultSchema, RequestIdSchema, JSONRPCRequestSchema, JSONRPCNotificationSchema, JSONRPCResponseSchema,
|
|
217978
|
+
var JSONRPC_VERSION, ProgressTokenSchema, CursorSchema, RequestMetaSchema, BaseRequestParamsSchema, RequestSchema, BaseNotificationParamsSchema, NotificationSchema, ResultSchema, RequestIdSchema, JSONRPCRequestSchema, JSONRPCNotificationSchema, JSONRPCResponseSchema, ErrorCode, JSONRPCErrorSchema, JSONRPCMessageSchema, EmptyResultSchema, CancelledNotificationSchema, IconSchema, IconsSchema, BaseMetadataSchema, ImplementationSchema, ClientCapabilitiesSchema, InitializeRequestSchema, ServerCapabilitiesSchema, InitializeResultSchema, InitializedNotificationSchema, PingRequestSchema, ProgressSchema, ProgressNotificationSchema, PaginatedRequestSchema, PaginatedResultSchema, ResourceContentsSchema, TextResourceContentsSchema, Base64Schema, BlobResourceContentsSchema, ResourceSchema, ResourceTemplateSchema, ListResourcesRequestSchema, ListResourcesResultSchema, ListResourceTemplatesRequestSchema, ListResourceTemplatesResultSchema, ReadResourceRequestSchema, ReadResourceResultSchema, ResourceListChangedNotificationSchema, SubscribeRequestSchema, UnsubscribeRequestSchema, ResourceUpdatedNotificationSchema, PromptArgumentSchema, PromptSchema, ListPromptsRequestSchema, ListPromptsResultSchema, GetPromptRequestSchema, TextContentSchema, ImageContentSchema, AudioContentSchema, EmbeddedResourceSchema, ResourceLinkSchema, ContentBlockSchema, PromptMessageSchema, GetPromptResultSchema, PromptListChangedNotificationSchema, ToolAnnotationsSchema, ToolSchema, ListToolsRequestSchema, ListToolsResultSchema, CallToolResultSchema, CompatibilityCallToolResultSchema, CallToolRequestSchema, ToolListChangedNotificationSchema, LoggingLevelSchema, SetLevelRequestSchema, LoggingMessageNotificationSchema, ModelHintSchema, ModelPreferencesSchema, SamplingMessageSchema, CreateMessageRequestSchema, CreateMessageResultSchema, BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema, EnumSchemaSchema, PrimitiveSchemaDefinitionSchema, ElicitRequestSchema, ElicitResultSchema, ResourceTemplateReferenceSchema, PromptReferenceSchema, CompleteRequestSchema, CompleteResultSchema, RootSchema, ListRootsRequestSchema, ListRootsResultSchema, RootsListChangedNotificationSchema, ClientRequestSchema, ClientNotificationSchema, ClientResultSchema, ServerRequestSchema, ServerNotificationSchema, ServerResultSchema;
|
|
218147
217979
|
var init_types2 = __esm({
|
|
218148
217980
|
"../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js"() {
|
|
218149
217981
|
"use strict";
|
|
@@ -218203,7 +218035,7 @@ var init_types2 = __esm({
|
|
|
218203
218035
|
ErrorCode3[ErrorCode3["MethodNotFound"] = -32601] = "MethodNotFound";
|
|
218204
218036
|
ErrorCode3[ErrorCode3["InvalidParams"] = -32602] = "InvalidParams";
|
|
218205
218037
|
ErrorCode3[ErrorCode3["InternalError"] = -32603] = "InternalError";
|
|
218206
|
-
})(
|
|
218038
|
+
})(ErrorCode || (ErrorCode = {}));
|
|
218207
218039
|
JSONRPCErrorSchema = z5.object({
|
|
218208
218040
|
jsonrpc: z5.literal(JSONRPC_VERSION),
|
|
218209
218041
|
id: RequestIdSchema,
|
|
@@ -219081,6 +218913,454 @@ var init_types2 = __esm({
|
|
|
219081
218913
|
}
|
|
219082
218914
|
});
|
|
219083
218915
|
|
|
218916
|
+
// ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
|
|
218917
|
+
import { z as z6 } from "zod";
|
|
218918
|
+
var SafeUrlSchema, OAuthProtectedResourceMetadataSchema, OAuthMetadataSchema, OpenIdProviderMetadataSchema, OpenIdProviderDiscoveryMetadataSchema, OAuthTokensSchema, OAuthErrorResponseSchema, OAuthClientMetadataSchema, OAuthClientInformationSchema, OAuthClientInformationFullSchema, OAuthClientRegistrationErrorSchema, OAuthTokenRevocationRequestSchema;
|
|
218919
|
+
var init_auth = __esm({
|
|
218920
|
+
"../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js"() {
|
|
218921
|
+
"use strict";
|
|
218922
|
+
init_esm_shims();
|
|
218923
|
+
SafeUrlSchema = z6.string().url().superRefine((val, ctx) => {
|
|
218924
|
+
if (!URL.canParse(val)) {
|
|
218925
|
+
ctx.addIssue({
|
|
218926
|
+
code: z6.ZodIssueCode.custom,
|
|
218927
|
+
message: "URL must be parseable",
|
|
218928
|
+
fatal: true
|
|
218929
|
+
});
|
|
218930
|
+
return z6.NEVER;
|
|
218931
|
+
}
|
|
218932
|
+
}).refine((url) => {
|
|
218933
|
+
const u2 = new URL(url);
|
|
218934
|
+
return u2.protocol !== "javascript:" && u2.protocol !== "data:" && u2.protocol !== "vbscript:";
|
|
218935
|
+
}, { message: "URL cannot use javascript:, data:, or vbscript: scheme" });
|
|
218936
|
+
OAuthProtectedResourceMetadataSchema = z6.object({
|
|
218937
|
+
resource: z6.string().url(),
|
|
218938
|
+
authorization_servers: z6.array(SafeUrlSchema).optional(),
|
|
218939
|
+
jwks_uri: z6.string().url().optional(),
|
|
218940
|
+
scopes_supported: z6.array(z6.string()).optional(),
|
|
218941
|
+
bearer_methods_supported: z6.array(z6.string()).optional(),
|
|
218942
|
+
resource_signing_alg_values_supported: z6.array(z6.string()).optional(),
|
|
218943
|
+
resource_name: z6.string().optional(),
|
|
218944
|
+
resource_documentation: z6.string().optional(),
|
|
218945
|
+
resource_policy_uri: z6.string().url().optional(),
|
|
218946
|
+
resource_tos_uri: z6.string().url().optional(),
|
|
218947
|
+
tls_client_certificate_bound_access_tokens: z6.boolean().optional(),
|
|
218948
|
+
authorization_details_types_supported: z6.array(z6.string()).optional(),
|
|
218949
|
+
dpop_signing_alg_values_supported: z6.array(z6.string()).optional(),
|
|
218950
|
+
dpop_bound_access_tokens_required: z6.boolean().optional()
|
|
218951
|
+
}).passthrough();
|
|
218952
|
+
OAuthMetadataSchema = z6.object({
|
|
218953
|
+
issuer: z6.string(),
|
|
218954
|
+
authorization_endpoint: SafeUrlSchema,
|
|
218955
|
+
token_endpoint: SafeUrlSchema,
|
|
218956
|
+
registration_endpoint: SafeUrlSchema.optional(),
|
|
218957
|
+
scopes_supported: z6.array(z6.string()).optional(),
|
|
218958
|
+
response_types_supported: z6.array(z6.string()),
|
|
218959
|
+
response_modes_supported: z6.array(z6.string()).optional(),
|
|
218960
|
+
grant_types_supported: z6.array(z6.string()).optional(),
|
|
218961
|
+
token_endpoint_auth_methods_supported: z6.array(z6.string()).optional(),
|
|
218962
|
+
token_endpoint_auth_signing_alg_values_supported: z6.array(z6.string()).optional(),
|
|
218963
|
+
service_documentation: SafeUrlSchema.optional(),
|
|
218964
|
+
revocation_endpoint: SafeUrlSchema.optional(),
|
|
218965
|
+
revocation_endpoint_auth_methods_supported: z6.array(z6.string()).optional(),
|
|
218966
|
+
revocation_endpoint_auth_signing_alg_values_supported: z6.array(z6.string()).optional(),
|
|
218967
|
+
introspection_endpoint: z6.string().optional(),
|
|
218968
|
+
introspection_endpoint_auth_methods_supported: z6.array(z6.string()).optional(),
|
|
218969
|
+
introspection_endpoint_auth_signing_alg_values_supported: z6.array(z6.string()).optional(),
|
|
218970
|
+
code_challenge_methods_supported: z6.array(z6.string()).optional()
|
|
218971
|
+
}).passthrough();
|
|
218972
|
+
OpenIdProviderMetadataSchema = z6.object({
|
|
218973
|
+
issuer: z6.string(),
|
|
218974
|
+
authorization_endpoint: SafeUrlSchema,
|
|
218975
|
+
token_endpoint: SafeUrlSchema,
|
|
218976
|
+
userinfo_endpoint: SafeUrlSchema.optional(),
|
|
218977
|
+
jwks_uri: SafeUrlSchema,
|
|
218978
|
+
registration_endpoint: SafeUrlSchema.optional(),
|
|
218979
|
+
scopes_supported: z6.array(z6.string()).optional(),
|
|
218980
|
+
response_types_supported: z6.array(z6.string()),
|
|
218981
|
+
response_modes_supported: z6.array(z6.string()).optional(),
|
|
218982
|
+
grant_types_supported: z6.array(z6.string()).optional(),
|
|
218983
|
+
acr_values_supported: z6.array(z6.string()).optional(),
|
|
218984
|
+
subject_types_supported: z6.array(z6.string()),
|
|
218985
|
+
id_token_signing_alg_values_supported: z6.array(z6.string()),
|
|
218986
|
+
id_token_encryption_alg_values_supported: z6.array(z6.string()).optional(),
|
|
218987
|
+
id_token_encryption_enc_values_supported: z6.array(z6.string()).optional(),
|
|
218988
|
+
userinfo_signing_alg_values_supported: z6.array(z6.string()).optional(),
|
|
218989
|
+
userinfo_encryption_alg_values_supported: z6.array(z6.string()).optional(),
|
|
218990
|
+
userinfo_encryption_enc_values_supported: z6.array(z6.string()).optional(),
|
|
218991
|
+
request_object_signing_alg_values_supported: z6.array(z6.string()).optional(),
|
|
218992
|
+
request_object_encryption_alg_values_supported: z6.array(z6.string()).optional(),
|
|
218993
|
+
request_object_encryption_enc_values_supported: z6.array(z6.string()).optional(),
|
|
218994
|
+
token_endpoint_auth_methods_supported: z6.array(z6.string()).optional(),
|
|
218995
|
+
token_endpoint_auth_signing_alg_values_supported: z6.array(z6.string()).optional(),
|
|
218996
|
+
display_values_supported: z6.array(z6.string()).optional(),
|
|
218997
|
+
claim_types_supported: z6.array(z6.string()).optional(),
|
|
218998
|
+
claims_supported: z6.array(z6.string()).optional(),
|
|
218999
|
+
service_documentation: z6.string().optional(),
|
|
219000
|
+
claims_locales_supported: z6.array(z6.string()).optional(),
|
|
219001
|
+
ui_locales_supported: z6.array(z6.string()).optional(),
|
|
219002
|
+
claims_parameter_supported: z6.boolean().optional(),
|
|
219003
|
+
request_parameter_supported: z6.boolean().optional(),
|
|
219004
|
+
request_uri_parameter_supported: z6.boolean().optional(),
|
|
219005
|
+
require_request_uri_registration: z6.boolean().optional(),
|
|
219006
|
+
op_policy_uri: SafeUrlSchema.optional(),
|
|
219007
|
+
op_tos_uri: SafeUrlSchema.optional()
|
|
219008
|
+
}).passthrough();
|
|
219009
|
+
OpenIdProviderDiscoveryMetadataSchema = OpenIdProviderMetadataSchema.merge(OAuthMetadataSchema.pick({
|
|
219010
|
+
code_challenge_methods_supported: true
|
|
219011
|
+
}));
|
|
219012
|
+
OAuthTokensSchema = z6.object({
|
|
219013
|
+
access_token: z6.string(),
|
|
219014
|
+
id_token: z6.string().optional(),
|
|
219015
|
+
// Optional for OAuth 2.1, but necessary in OpenID Connect
|
|
219016
|
+
token_type: z6.string(),
|
|
219017
|
+
expires_in: z6.number().optional(),
|
|
219018
|
+
scope: z6.string().optional(),
|
|
219019
|
+
refresh_token: z6.string().optional()
|
|
219020
|
+
}).strip();
|
|
219021
|
+
OAuthErrorResponseSchema = z6.object({
|
|
219022
|
+
error: z6.string(),
|
|
219023
|
+
error_description: z6.string().optional(),
|
|
219024
|
+
error_uri: z6.string().optional()
|
|
219025
|
+
});
|
|
219026
|
+
OAuthClientMetadataSchema = z6.object({
|
|
219027
|
+
redirect_uris: z6.array(SafeUrlSchema),
|
|
219028
|
+
token_endpoint_auth_method: z6.string().optional(),
|
|
219029
|
+
grant_types: z6.array(z6.string()).optional(),
|
|
219030
|
+
response_types: z6.array(z6.string()).optional(),
|
|
219031
|
+
client_name: z6.string().optional(),
|
|
219032
|
+
client_uri: SafeUrlSchema.optional(),
|
|
219033
|
+
logo_uri: SafeUrlSchema.optional(),
|
|
219034
|
+
scope: z6.string().optional(),
|
|
219035
|
+
contacts: z6.array(z6.string()).optional(),
|
|
219036
|
+
tos_uri: SafeUrlSchema.optional(),
|
|
219037
|
+
policy_uri: z6.string().optional(),
|
|
219038
|
+
jwks_uri: SafeUrlSchema.optional(),
|
|
219039
|
+
jwks: z6.any().optional(),
|
|
219040
|
+
software_id: z6.string().optional(),
|
|
219041
|
+
software_version: z6.string().optional(),
|
|
219042
|
+
software_statement: z6.string().optional()
|
|
219043
|
+
}).strip();
|
|
219044
|
+
OAuthClientInformationSchema = z6.object({
|
|
219045
|
+
client_id: z6.string(),
|
|
219046
|
+
client_secret: z6.string().optional(),
|
|
219047
|
+
client_id_issued_at: z6.number().optional(),
|
|
219048
|
+
client_secret_expires_at: z6.number().optional()
|
|
219049
|
+
}).strip();
|
|
219050
|
+
OAuthClientInformationFullSchema = OAuthClientMetadataSchema.merge(OAuthClientInformationSchema);
|
|
219051
|
+
OAuthClientRegistrationErrorSchema = z6.object({
|
|
219052
|
+
error: z6.string(),
|
|
219053
|
+
error_description: z6.string().optional()
|
|
219054
|
+
}).strip();
|
|
219055
|
+
OAuthTokenRevocationRequestSchema = z6.object({
|
|
219056
|
+
token: z6.string(),
|
|
219057
|
+
token_type_hint: z6.string().optional()
|
|
219058
|
+
}).strip();
|
|
219059
|
+
}
|
|
219060
|
+
});
|
|
219061
|
+
|
|
219062
|
+
// ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js
|
|
219063
|
+
var init_auth_utils = __esm({
|
|
219064
|
+
"../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js"() {
|
|
219065
|
+
"use strict";
|
|
219066
|
+
init_esm_shims();
|
|
219067
|
+
}
|
|
219068
|
+
});
|
|
219069
|
+
|
|
219070
|
+
// ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
|
|
219071
|
+
var OAuthError, InvalidRequestError, InvalidClientError, InvalidGrantError, UnauthorizedClientError, UnsupportedGrantTypeError, InvalidScopeError, AccessDeniedError, ServerError, TemporarilyUnavailableError, UnsupportedResponseTypeError, UnsupportedTokenTypeError, InvalidTokenError, MethodNotAllowedError, TooManyRequestsError, InvalidClientMetadataError, InsufficientScopeError, OAUTH_ERRORS;
|
|
219072
|
+
var init_errors = __esm({
|
|
219073
|
+
"../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js"() {
|
|
219074
|
+
"use strict";
|
|
219075
|
+
init_esm_shims();
|
|
219076
|
+
OAuthError = class extends Error {
|
|
219077
|
+
constructor(message, errorUri) {
|
|
219078
|
+
super(message);
|
|
219079
|
+
this.errorUri = errorUri;
|
|
219080
|
+
this.name = this.constructor.name;
|
|
219081
|
+
}
|
|
219082
|
+
/**
|
|
219083
|
+
* Converts the error to a standard OAuth error response object
|
|
219084
|
+
*/
|
|
219085
|
+
toResponseObject() {
|
|
219086
|
+
const response = {
|
|
219087
|
+
error: this.errorCode,
|
|
219088
|
+
error_description: this.message
|
|
219089
|
+
};
|
|
219090
|
+
if (this.errorUri) {
|
|
219091
|
+
response.error_uri = this.errorUri;
|
|
219092
|
+
}
|
|
219093
|
+
return response;
|
|
219094
|
+
}
|
|
219095
|
+
get errorCode() {
|
|
219096
|
+
return this.constructor.errorCode;
|
|
219097
|
+
}
|
|
219098
|
+
};
|
|
219099
|
+
InvalidRequestError = class extends OAuthError {
|
|
219100
|
+
};
|
|
219101
|
+
InvalidRequestError.errorCode = "invalid_request";
|
|
219102
|
+
InvalidClientError = class extends OAuthError {
|
|
219103
|
+
};
|
|
219104
|
+
InvalidClientError.errorCode = "invalid_client";
|
|
219105
|
+
InvalidGrantError = class extends OAuthError {
|
|
219106
|
+
};
|
|
219107
|
+
InvalidGrantError.errorCode = "invalid_grant";
|
|
219108
|
+
UnauthorizedClientError = class extends OAuthError {
|
|
219109
|
+
};
|
|
219110
|
+
UnauthorizedClientError.errorCode = "unauthorized_client";
|
|
219111
|
+
UnsupportedGrantTypeError = class extends OAuthError {
|
|
219112
|
+
};
|
|
219113
|
+
UnsupportedGrantTypeError.errorCode = "unsupported_grant_type";
|
|
219114
|
+
InvalidScopeError = class extends OAuthError {
|
|
219115
|
+
};
|
|
219116
|
+
InvalidScopeError.errorCode = "invalid_scope";
|
|
219117
|
+
AccessDeniedError = class extends OAuthError {
|
|
219118
|
+
};
|
|
219119
|
+
AccessDeniedError.errorCode = "access_denied";
|
|
219120
|
+
ServerError = class extends OAuthError {
|
|
219121
|
+
};
|
|
219122
|
+
ServerError.errorCode = "server_error";
|
|
219123
|
+
TemporarilyUnavailableError = class extends OAuthError {
|
|
219124
|
+
};
|
|
219125
|
+
TemporarilyUnavailableError.errorCode = "temporarily_unavailable";
|
|
219126
|
+
UnsupportedResponseTypeError = class extends OAuthError {
|
|
219127
|
+
};
|
|
219128
|
+
UnsupportedResponseTypeError.errorCode = "unsupported_response_type";
|
|
219129
|
+
UnsupportedTokenTypeError = class extends OAuthError {
|
|
219130
|
+
};
|
|
219131
|
+
UnsupportedTokenTypeError.errorCode = "unsupported_token_type";
|
|
219132
|
+
InvalidTokenError = class extends OAuthError {
|
|
219133
|
+
};
|
|
219134
|
+
InvalidTokenError.errorCode = "invalid_token";
|
|
219135
|
+
MethodNotAllowedError = class extends OAuthError {
|
|
219136
|
+
};
|
|
219137
|
+
MethodNotAllowedError.errorCode = "method_not_allowed";
|
|
219138
|
+
TooManyRequestsError = class extends OAuthError {
|
|
219139
|
+
};
|
|
219140
|
+
TooManyRequestsError.errorCode = "too_many_requests";
|
|
219141
|
+
InvalidClientMetadataError = class extends OAuthError {
|
|
219142
|
+
};
|
|
219143
|
+
InvalidClientMetadataError.errorCode = "invalid_client_metadata";
|
|
219144
|
+
InsufficientScopeError = class extends OAuthError {
|
|
219145
|
+
};
|
|
219146
|
+
InsufficientScopeError.errorCode = "insufficient_scope";
|
|
219147
|
+
OAUTH_ERRORS = {
|
|
219148
|
+
[InvalidRequestError.errorCode]: InvalidRequestError,
|
|
219149
|
+
[InvalidClientError.errorCode]: InvalidClientError,
|
|
219150
|
+
[InvalidGrantError.errorCode]: InvalidGrantError,
|
|
219151
|
+
[UnauthorizedClientError.errorCode]: UnauthorizedClientError,
|
|
219152
|
+
[UnsupportedGrantTypeError.errorCode]: UnsupportedGrantTypeError,
|
|
219153
|
+
[InvalidScopeError.errorCode]: InvalidScopeError,
|
|
219154
|
+
[AccessDeniedError.errorCode]: AccessDeniedError,
|
|
219155
|
+
[ServerError.errorCode]: ServerError,
|
|
219156
|
+
[TemporarilyUnavailableError.errorCode]: TemporarilyUnavailableError,
|
|
219157
|
+
[UnsupportedResponseTypeError.errorCode]: UnsupportedResponseTypeError,
|
|
219158
|
+
[UnsupportedTokenTypeError.errorCode]: UnsupportedTokenTypeError,
|
|
219159
|
+
[InvalidTokenError.errorCode]: InvalidTokenError,
|
|
219160
|
+
[MethodNotAllowedError.errorCode]: MethodNotAllowedError,
|
|
219161
|
+
[TooManyRequestsError.errorCode]: TooManyRequestsError,
|
|
219162
|
+
[InvalidClientMetadataError.errorCode]: InvalidClientMetadataError,
|
|
219163
|
+
[InsufficientScopeError.errorCode]: InsufficientScopeError
|
|
219164
|
+
};
|
|
219165
|
+
}
|
|
219166
|
+
});
|
|
219167
|
+
|
|
219168
|
+
// ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
|
|
219169
|
+
var init_auth2 = __esm({
|
|
219170
|
+
"../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js"() {
|
|
219171
|
+
"use strict";
|
|
219172
|
+
init_esm_shims();
|
|
219173
|
+
init_index_node();
|
|
219174
|
+
init_types2();
|
|
219175
|
+
init_auth();
|
|
219176
|
+
init_auth();
|
|
219177
|
+
init_auth_utils();
|
|
219178
|
+
init_errors();
|
|
219179
|
+
}
|
|
219180
|
+
});
|
|
219181
|
+
|
|
219182
|
+
// ../packages/agents-core/src/utils/auth-detection.ts
|
|
219183
|
+
var init_auth_detection = __esm({
|
|
219184
|
+
"../packages/agents-core/src/utils/auth-detection.ts"() {
|
|
219185
|
+
"use strict";
|
|
219186
|
+
init_esm_shims();
|
|
219187
|
+
init_auth2();
|
|
219188
|
+
}
|
|
219189
|
+
});
|
|
219190
|
+
|
|
219191
|
+
// ../packages/agents-core/src/utils/error.ts
|
|
219192
|
+
function getTitleFromCode(code) {
|
|
219193
|
+
switch (code) {
|
|
219194
|
+
case "bad_request":
|
|
219195
|
+
return "Bad Request";
|
|
219196
|
+
case "unauthorized":
|
|
219197
|
+
return "Unauthorized";
|
|
219198
|
+
case "forbidden":
|
|
219199
|
+
return "Forbidden";
|
|
219200
|
+
case "not_found":
|
|
219201
|
+
return "Not Found";
|
|
219202
|
+
case "conflict":
|
|
219203
|
+
return "Conflict";
|
|
219204
|
+
case "unprocessable_entity":
|
|
219205
|
+
return "Unprocessable Entity";
|
|
219206
|
+
case "internal_server_error":
|
|
219207
|
+
return "Internal Server Error";
|
|
219208
|
+
default:
|
|
219209
|
+
return "Error";
|
|
219210
|
+
}
|
|
219211
|
+
}
|
|
219212
|
+
var ErrorCode2, errorCodeToHttpStatus, problemDetailsSchema, errorResponseSchema, toTitleCase, errorSchemaFactory, commonCreateErrorResponses, commonUpdateErrorResponses, commonGetErrorResponses, commonDeleteErrorResponses;
|
|
219213
|
+
var init_error = __esm({
|
|
219214
|
+
"../packages/agents-core/src/utils/error.ts"() {
|
|
219215
|
+
"use strict";
|
|
219216
|
+
init_esm_shims();
|
|
219217
|
+
init_dist4();
|
|
219218
|
+
init_http_exception();
|
|
219219
|
+
init_logger();
|
|
219220
|
+
ErrorCode2 = z2.enum([
|
|
219221
|
+
"bad_request",
|
|
219222
|
+
"unauthorized",
|
|
219223
|
+
"forbidden",
|
|
219224
|
+
"not_found",
|
|
219225
|
+
"conflict",
|
|
219226
|
+
"internal_server_error",
|
|
219227
|
+
"unprocessable_entity"
|
|
219228
|
+
]);
|
|
219229
|
+
errorCodeToHttpStatus = {
|
|
219230
|
+
bad_request: 400,
|
|
219231
|
+
unauthorized: 401,
|
|
219232
|
+
forbidden: 403,
|
|
219233
|
+
not_found: 404,
|
|
219234
|
+
conflict: 409,
|
|
219235
|
+
unprocessable_entity: 422,
|
|
219236
|
+
internal_server_error: 500
|
|
219237
|
+
};
|
|
219238
|
+
problemDetailsSchema = z2.object({
|
|
219239
|
+
// type: z.string().url().openapi({
|
|
219240
|
+
// description: "A URI reference that identifies the problem type.",
|
|
219241
|
+
// example: `${ERROR_DOCS_BASE_URL}#not-found`,
|
|
219242
|
+
// }),
|
|
219243
|
+
title: z2.string().openapi({
|
|
219244
|
+
description: "A short, human-readable summary of the problem type.",
|
|
219245
|
+
example: "Resource Not Found"
|
|
219246
|
+
}),
|
|
219247
|
+
status: z2.number().int().openapi({
|
|
219248
|
+
description: "The HTTP status code.",
|
|
219249
|
+
example: 404
|
|
219250
|
+
}),
|
|
219251
|
+
detail: z2.string().openapi({
|
|
219252
|
+
description: "A human-readable explanation specific to this occurrence of the problem.",
|
|
219253
|
+
example: "The requested resource was not found."
|
|
219254
|
+
}),
|
|
219255
|
+
instance: z2.string().optional().openapi({
|
|
219256
|
+
description: "A URI reference that identifies the specific occurrence of the problem.",
|
|
219257
|
+
example: "/conversations/123"
|
|
219258
|
+
}),
|
|
219259
|
+
requestId: z2.string().optional().openapi({
|
|
219260
|
+
description: "A unique identifier for the request, useful for troubleshooting.",
|
|
219261
|
+
example: "req_1234567890"
|
|
219262
|
+
}),
|
|
219263
|
+
code: ErrorCode2.openapi({
|
|
219264
|
+
description: "A short code indicating the error code returned.",
|
|
219265
|
+
example: "not_found"
|
|
219266
|
+
})
|
|
219267
|
+
}).openapi("ProblemDetails");
|
|
219268
|
+
errorResponseSchema = z2.object({
|
|
219269
|
+
error: z2.object({
|
|
219270
|
+
code: ErrorCode2.openapi({
|
|
219271
|
+
description: "A short code indicating the error code returned.",
|
|
219272
|
+
example: "not_found"
|
|
219273
|
+
}),
|
|
219274
|
+
message: z2.string().openapi({
|
|
219275
|
+
description: "A human readable error message.",
|
|
219276
|
+
example: "The requested resource was not found."
|
|
219277
|
+
})
|
|
219278
|
+
})
|
|
219279
|
+
}).openapi("ErrorResponse");
|
|
219280
|
+
toTitleCase = (str) => str?.replace(/\w+/g, (word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).replace(/\s+/g, "") ?? "";
|
|
219281
|
+
errorSchemaFactory = (code, description) => ({
|
|
219282
|
+
description,
|
|
219283
|
+
content: {
|
|
219284
|
+
"application/problem+json": {
|
|
219285
|
+
schema: problemDetailsSchema.extend({
|
|
219286
|
+
code: z2.literal(code).openapi({
|
|
219287
|
+
description: "A short code indicating the error code returned.",
|
|
219288
|
+
example: code
|
|
219289
|
+
}),
|
|
219290
|
+
detail: z2.string().openapi({
|
|
219291
|
+
description: "A detailed explanation specific to this occurrence of the problem, providing context and specifics about what went wrong.",
|
|
219292
|
+
example: description
|
|
219293
|
+
}),
|
|
219294
|
+
title: z2.string().openapi({
|
|
219295
|
+
description: "A short, human-readable summary of the problem type.",
|
|
219296
|
+
example: getTitleFromCode(code)
|
|
219297
|
+
}),
|
|
219298
|
+
// type: z.string().url().openapi({
|
|
219299
|
+
// description: "A URI reference that identifies the problem type.",
|
|
219300
|
+
// example: `${ERROR_DOCS_BASE_URL}#${code}`,
|
|
219301
|
+
// }),
|
|
219302
|
+
status: z2.literal(errorCodeToHttpStatus[code]).openapi({
|
|
219303
|
+
description: "The HTTP status code.",
|
|
219304
|
+
example: errorCodeToHttpStatus[code]
|
|
219305
|
+
}),
|
|
219306
|
+
error: z2.object({
|
|
219307
|
+
code: z2.literal(code).openapi({
|
|
219308
|
+
description: "A short code indicating the error code returned.",
|
|
219309
|
+
example: code
|
|
219310
|
+
}),
|
|
219311
|
+
message: z2.string().openapi({
|
|
219312
|
+
description: "A concise error message suitable for display to end users. May be truncated if the full detail is long.",
|
|
219313
|
+
example: description.length > 100 ? `${description.substring(0, 97)}...` : description
|
|
219314
|
+
})
|
|
219315
|
+
}).openapi({
|
|
219316
|
+
description: "Legacy error format for backward compatibility."
|
|
219317
|
+
})
|
|
219318
|
+
}).openapi(toTitleCase(description))
|
|
219319
|
+
}
|
|
219320
|
+
}
|
|
219321
|
+
});
|
|
219322
|
+
commonCreateErrorResponses = {
|
|
219323
|
+
400: errorSchemaFactory("bad_request", "Bad Request"),
|
|
219324
|
+
401: errorSchemaFactory("unauthorized", "Unauthorized"),
|
|
219325
|
+
403: errorSchemaFactory("forbidden", "Forbidden"),
|
|
219326
|
+
422: errorSchemaFactory("unprocessable_entity", "Unprocessable Entity"),
|
|
219327
|
+
500: errorSchemaFactory("internal_server_error", "Internal Server Error")
|
|
219328
|
+
};
|
|
219329
|
+
commonUpdateErrorResponses = {
|
|
219330
|
+
400: errorSchemaFactory("bad_request", "Bad Request"),
|
|
219331
|
+
401: errorSchemaFactory("unauthorized", "Unauthorized"),
|
|
219332
|
+
403: errorSchemaFactory("forbidden", "Forbidden"),
|
|
219333
|
+
404: errorSchemaFactory("not_found", "Not Found"),
|
|
219334
|
+
422: errorSchemaFactory("unprocessable_entity", "Unprocessable Entity"),
|
|
219335
|
+
500: errorSchemaFactory("internal_server_error", "Internal Server Error")
|
|
219336
|
+
};
|
|
219337
|
+
commonGetErrorResponses = {
|
|
219338
|
+
400: errorSchemaFactory("bad_request", "Bad Request"),
|
|
219339
|
+
401: errorSchemaFactory("unauthorized", "Unauthorized"),
|
|
219340
|
+
403: errorSchemaFactory("forbidden", "Forbidden"),
|
|
219341
|
+
404: errorSchemaFactory("not_found", "Not Found"),
|
|
219342
|
+
422: errorSchemaFactory("unprocessable_entity", "Unprocessable Entity"),
|
|
219343
|
+
500: errorSchemaFactory("internal_server_error", "Internal Server Error")
|
|
219344
|
+
};
|
|
219345
|
+
commonDeleteErrorResponses = {
|
|
219346
|
+
400: errorSchemaFactory("bad_request", "Bad Request"),
|
|
219347
|
+
401: errorSchemaFactory("unauthorized", "Unauthorized"),
|
|
219348
|
+
403: errorSchemaFactory("forbidden", "Forbidden"),
|
|
219349
|
+
404: errorSchemaFactory("not_found", "Not Found"),
|
|
219350
|
+
422: errorSchemaFactory("unprocessable_entity", "Unprocessable Entity"),
|
|
219351
|
+
500: errorSchemaFactory("internal_server_error", "Internal Server Error")
|
|
219352
|
+
};
|
|
219353
|
+
}
|
|
219354
|
+
});
|
|
219355
|
+
|
|
219356
|
+
// ../packages/agents-core/src/utils/execution.ts
|
|
219357
|
+
var init_execution = __esm({
|
|
219358
|
+
"../packages/agents-core/src/utils/execution.ts"() {
|
|
219359
|
+
"use strict";
|
|
219360
|
+
init_esm_shims();
|
|
219361
|
+
}
|
|
219362
|
+
});
|
|
219363
|
+
|
|
219084
219364
|
// ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
|
|
219085
219365
|
var init_protocol = __esm({
|
|
219086
219366
|
"../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js"() {
|
|
@@ -225363,284 +225643,6 @@ var init_client2 = __esm({
|
|
|
225363
225643
|
}
|
|
225364
225644
|
});
|
|
225365
225645
|
|
|
225366
|
-
// ../node_modules/.pnpm/pkce-challenge@5.0.0/node_modules/pkce-challenge/dist/index.node.js
|
|
225367
|
-
var crypto3;
|
|
225368
|
-
var init_index_node = __esm({
|
|
225369
|
-
"../node_modules/.pnpm/pkce-challenge@5.0.0/node_modules/pkce-challenge/dist/index.node.js"() {
|
|
225370
|
-
"use strict";
|
|
225371
|
-
init_esm_shims();
|
|
225372
|
-
crypto3 = globalThis.crypto?.webcrypto ?? // Node.js [18-16] REPL
|
|
225373
|
-
globalThis.crypto ?? // Node.js >18
|
|
225374
|
-
import("crypto").then((m2) => m2.webcrypto);
|
|
225375
|
-
}
|
|
225376
|
-
});
|
|
225377
|
-
|
|
225378
|
-
// ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
|
|
225379
|
-
import { z as z6 } from "zod";
|
|
225380
|
-
var SafeUrlSchema, OAuthProtectedResourceMetadataSchema, OAuthMetadataSchema, OpenIdProviderMetadataSchema, OpenIdProviderDiscoveryMetadataSchema, OAuthTokensSchema, OAuthErrorResponseSchema, OAuthClientMetadataSchema, OAuthClientInformationSchema, OAuthClientInformationFullSchema, OAuthClientRegistrationErrorSchema, OAuthTokenRevocationRequestSchema;
|
|
225381
|
-
var init_auth = __esm({
|
|
225382
|
-
"../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js"() {
|
|
225383
|
-
"use strict";
|
|
225384
|
-
init_esm_shims();
|
|
225385
|
-
SafeUrlSchema = z6.string().url().superRefine((val, ctx) => {
|
|
225386
|
-
if (!URL.canParse(val)) {
|
|
225387
|
-
ctx.addIssue({
|
|
225388
|
-
code: z6.ZodIssueCode.custom,
|
|
225389
|
-
message: "URL must be parseable",
|
|
225390
|
-
fatal: true
|
|
225391
|
-
});
|
|
225392
|
-
return z6.NEVER;
|
|
225393
|
-
}
|
|
225394
|
-
}).refine((url) => {
|
|
225395
|
-
const u2 = new URL(url);
|
|
225396
|
-
return u2.protocol !== "javascript:" && u2.protocol !== "data:" && u2.protocol !== "vbscript:";
|
|
225397
|
-
}, { message: "URL cannot use javascript:, data:, or vbscript: scheme" });
|
|
225398
|
-
OAuthProtectedResourceMetadataSchema = z6.object({
|
|
225399
|
-
resource: z6.string().url(),
|
|
225400
|
-
authorization_servers: z6.array(SafeUrlSchema).optional(),
|
|
225401
|
-
jwks_uri: z6.string().url().optional(),
|
|
225402
|
-
scopes_supported: z6.array(z6.string()).optional(),
|
|
225403
|
-
bearer_methods_supported: z6.array(z6.string()).optional(),
|
|
225404
|
-
resource_signing_alg_values_supported: z6.array(z6.string()).optional(),
|
|
225405
|
-
resource_name: z6.string().optional(),
|
|
225406
|
-
resource_documentation: z6.string().optional(),
|
|
225407
|
-
resource_policy_uri: z6.string().url().optional(),
|
|
225408
|
-
resource_tos_uri: z6.string().url().optional(),
|
|
225409
|
-
tls_client_certificate_bound_access_tokens: z6.boolean().optional(),
|
|
225410
|
-
authorization_details_types_supported: z6.array(z6.string()).optional(),
|
|
225411
|
-
dpop_signing_alg_values_supported: z6.array(z6.string()).optional(),
|
|
225412
|
-
dpop_bound_access_tokens_required: z6.boolean().optional()
|
|
225413
|
-
}).passthrough();
|
|
225414
|
-
OAuthMetadataSchema = z6.object({
|
|
225415
|
-
issuer: z6.string(),
|
|
225416
|
-
authorization_endpoint: SafeUrlSchema,
|
|
225417
|
-
token_endpoint: SafeUrlSchema,
|
|
225418
|
-
registration_endpoint: SafeUrlSchema.optional(),
|
|
225419
|
-
scopes_supported: z6.array(z6.string()).optional(),
|
|
225420
|
-
response_types_supported: z6.array(z6.string()),
|
|
225421
|
-
response_modes_supported: z6.array(z6.string()).optional(),
|
|
225422
|
-
grant_types_supported: z6.array(z6.string()).optional(),
|
|
225423
|
-
token_endpoint_auth_methods_supported: z6.array(z6.string()).optional(),
|
|
225424
|
-
token_endpoint_auth_signing_alg_values_supported: z6.array(z6.string()).optional(),
|
|
225425
|
-
service_documentation: SafeUrlSchema.optional(),
|
|
225426
|
-
revocation_endpoint: SafeUrlSchema.optional(),
|
|
225427
|
-
revocation_endpoint_auth_methods_supported: z6.array(z6.string()).optional(),
|
|
225428
|
-
revocation_endpoint_auth_signing_alg_values_supported: z6.array(z6.string()).optional(),
|
|
225429
|
-
introspection_endpoint: z6.string().optional(),
|
|
225430
|
-
introspection_endpoint_auth_methods_supported: z6.array(z6.string()).optional(),
|
|
225431
|
-
introspection_endpoint_auth_signing_alg_values_supported: z6.array(z6.string()).optional(),
|
|
225432
|
-
code_challenge_methods_supported: z6.array(z6.string()).optional()
|
|
225433
|
-
}).passthrough();
|
|
225434
|
-
OpenIdProviderMetadataSchema = z6.object({
|
|
225435
|
-
issuer: z6.string(),
|
|
225436
|
-
authorization_endpoint: SafeUrlSchema,
|
|
225437
|
-
token_endpoint: SafeUrlSchema,
|
|
225438
|
-
userinfo_endpoint: SafeUrlSchema.optional(),
|
|
225439
|
-
jwks_uri: SafeUrlSchema,
|
|
225440
|
-
registration_endpoint: SafeUrlSchema.optional(),
|
|
225441
|
-
scopes_supported: z6.array(z6.string()).optional(),
|
|
225442
|
-
response_types_supported: z6.array(z6.string()),
|
|
225443
|
-
response_modes_supported: z6.array(z6.string()).optional(),
|
|
225444
|
-
grant_types_supported: z6.array(z6.string()).optional(),
|
|
225445
|
-
acr_values_supported: z6.array(z6.string()).optional(),
|
|
225446
|
-
subject_types_supported: z6.array(z6.string()),
|
|
225447
|
-
id_token_signing_alg_values_supported: z6.array(z6.string()),
|
|
225448
|
-
id_token_encryption_alg_values_supported: z6.array(z6.string()).optional(),
|
|
225449
|
-
id_token_encryption_enc_values_supported: z6.array(z6.string()).optional(),
|
|
225450
|
-
userinfo_signing_alg_values_supported: z6.array(z6.string()).optional(),
|
|
225451
|
-
userinfo_encryption_alg_values_supported: z6.array(z6.string()).optional(),
|
|
225452
|
-
userinfo_encryption_enc_values_supported: z6.array(z6.string()).optional(),
|
|
225453
|
-
request_object_signing_alg_values_supported: z6.array(z6.string()).optional(),
|
|
225454
|
-
request_object_encryption_alg_values_supported: z6.array(z6.string()).optional(),
|
|
225455
|
-
request_object_encryption_enc_values_supported: z6.array(z6.string()).optional(),
|
|
225456
|
-
token_endpoint_auth_methods_supported: z6.array(z6.string()).optional(),
|
|
225457
|
-
token_endpoint_auth_signing_alg_values_supported: z6.array(z6.string()).optional(),
|
|
225458
|
-
display_values_supported: z6.array(z6.string()).optional(),
|
|
225459
|
-
claim_types_supported: z6.array(z6.string()).optional(),
|
|
225460
|
-
claims_supported: z6.array(z6.string()).optional(),
|
|
225461
|
-
service_documentation: z6.string().optional(),
|
|
225462
|
-
claims_locales_supported: z6.array(z6.string()).optional(),
|
|
225463
|
-
ui_locales_supported: z6.array(z6.string()).optional(),
|
|
225464
|
-
claims_parameter_supported: z6.boolean().optional(),
|
|
225465
|
-
request_parameter_supported: z6.boolean().optional(),
|
|
225466
|
-
request_uri_parameter_supported: z6.boolean().optional(),
|
|
225467
|
-
require_request_uri_registration: z6.boolean().optional(),
|
|
225468
|
-
op_policy_uri: SafeUrlSchema.optional(),
|
|
225469
|
-
op_tos_uri: SafeUrlSchema.optional()
|
|
225470
|
-
}).passthrough();
|
|
225471
|
-
OpenIdProviderDiscoveryMetadataSchema = OpenIdProviderMetadataSchema.merge(OAuthMetadataSchema.pick({
|
|
225472
|
-
code_challenge_methods_supported: true
|
|
225473
|
-
}));
|
|
225474
|
-
OAuthTokensSchema = z6.object({
|
|
225475
|
-
access_token: z6.string(),
|
|
225476
|
-
id_token: z6.string().optional(),
|
|
225477
|
-
// Optional for OAuth 2.1, but necessary in OpenID Connect
|
|
225478
|
-
token_type: z6.string(),
|
|
225479
|
-
expires_in: z6.number().optional(),
|
|
225480
|
-
scope: z6.string().optional(),
|
|
225481
|
-
refresh_token: z6.string().optional()
|
|
225482
|
-
}).strip();
|
|
225483
|
-
OAuthErrorResponseSchema = z6.object({
|
|
225484
|
-
error: z6.string(),
|
|
225485
|
-
error_description: z6.string().optional(),
|
|
225486
|
-
error_uri: z6.string().optional()
|
|
225487
|
-
});
|
|
225488
|
-
OAuthClientMetadataSchema = z6.object({
|
|
225489
|
-
redirect_uris: z6.array(SafeUrlSchema),
|
|
225490
|
-
token_endpoint_auth_method: z6.string().optional(),
|
|
225491
|
-
grant_types: z6.array(z6.string()).optional(),
|
|
225492
|
-
response_types: z6.array(z6.string()).optional(),
|
|
225493
|
-
client_name: z6.string().optional(),
|
|
225494
|
-
client_uri: SafeUrlSchema.optional(),
|
|
225495
|
-
logo_uri: SafeUrlSchema.optional(),
|
|
225496
|
-
scope: z6.string().optional(),
|
|
225497
|
-
contacts: z6.array(z6.string()).optional(),
|
|
225498
|
-
tos_uri: SafeUrlSchema.optional(),
|
|
225499
|
-
policy_uri: z6.string().optional(),
|
|
225500
|
-
jwks_uri: SafeUrlSchema.optional(),
|
|
225501
|
-
jwks: z6.any().optional(),
|
|
225502
|
-
software_id: z6.string().optional(),
|
|
225503
|
-
software_version: z6.string().optional(),
|
|
225504
|
-
software_statement: z6.string().optional()
|
|
225505
|
-
}).strip();
|
|
225506
|
-
OAuthClientInformationSchema = z6.object({
|
|
225507
|
-
client_id: z6.string(),
|
|
225508
|
-
client_secret: z6.string().optional(),
|
|
225509
|
-
client_id_issued_at: z6.number().optional(),
|
|
225510
|
-
client_secret_expires_at: z6.number().optional()
|
|
225511
|
-
}).strip();
|
|
225512
|
-
OAuthClientInformationFullSchema = OAuthClientMetadataSchema.merge(OAuthClientInformationSchema);
|
|
225513
|
-
OAuthClientRegistrationErrorSchema = z6.object({
|
|
225514
|
-
error: z6.string(),
|
|
225515
|
-
error_description: z6.string().optional()
|
|
225516
|
-
}).strip();
|
|
225517
|
-
OAuthTokenRevocationRequestSchema = z6.object({
|
|
225518
|
-
token: z6.string(),
|
|
225519
|
-
token_type_hint: z6.string().optional()
|
|
225520
|
-
}).strip();
|
|
225521
|
-
}
|
|
225522
|
-
});
|
|
225523
|
-
|
|
225524
|
-
// ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js
|
|
225525
|
-
var init_auth_utils = __esm({
|
|
225526
|
-
"../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js"() {
|
|
225527
|
-
"use strict";
|
|
225528
|
-
init_esm_shims();
|
|
225529
|
-
}
|
|
225530
|
-
});
|
|
225531
|
-
|
|
225532
|
-
// ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
|
|
225533
|
-
var OAuthError, InvalidRequestError, InvalidClientError, InvalidGrantError, UnauthorizedClientError, UnsupportedGrantTypeError, InvalidScopeError, AccessDeniedError, ServerError, TemporarilyUnavailableError, UnsupportedResponseTypeError, UnsupportedTokenTypeError, InvalidTokenError, MethodNotAllowedError, TooManyRequestsError, InvalidClientMetadataError, InsufficientScopeError, OAUTH_ERRORS;
|
|
225534
|
-
var init_errors = __esm({
|
|
225535
|
-
"../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js"() {
|
|
225536
|
-
"use strict";
|
|
225537
|
-
init_esm_shims();
|
|
225538
|
-
OAuthError = class extends Error {
|
|
225539
|
-
constructor(message, errorUri) {
|
|
225540
|
-
super(message);
|
|
225541
|
-
this.errorUri = errorUri;
|
|
225542
|
-
this.name = this.constructor.name;
|
|
225543
|
-
}
|
|
225544
|
-
/**
|
|
225545
|
-
* Converts the error to a standard OAuth error response object
|
|
225546
|
-
*/
|
|
225547
|
-
toResponseObject() {
|
|
225548
|
-
const response = {
|
|
225549
|
-
error: this.errorCode,
|
|
225550
|
-
error_description: this.message
|
|
225551
|
-
};
|
|
225552
|
-
if (this.errorUri) {
|
|
225553
|
-
response.error_uri = this.errorUri;
|
|
225554
|
-
}
|
|
225555
|
-
return response;
|
|
225556
|
-
}
|
|
225557
|
-
get errorCode() {
|
|
225558
|
-
return this.constructor.errorCode;
|
|
225559
|
-
}
|
|
225560
|
-
};
|
|
225561
|
-
InvalidRequestError = class extends OAuthError {
|
|
225562
|
-
};
|
|
225563
|
-
InvalidRequestError.errorCode = "invalid_request";
|
|
225564
|
-
InvalidClientError = class extends OAuthError {
|
|
225565
|
-
};
|
|
225566
|
-
InvalidClientError.errorCode = "invalid_client";
|
|
225567
|
-
InvalidGrantError = class extends OAuthError {
|
|
225568
|
-
};
|
|
225569
|
-
InvalidGrantError.errorCode = "invalid_grant";
|
|
225570
|
-
UnauthorizedClientError = class extends OAuthError {
|
|
225571
|
-
};
|
|
225572
|
-
UnauthorizedClientError.errorCode = "unauthorized_client";
|
|
225573
|
-
UnsupportedGrantTypeError = class extends OAuthError {
|
|
225574
|
-
};
|
|
225575
|
-
UnsupportedGrantTypeError.errorCode = "unsupported_grant_type";
|
|
225576
|
-
InvalidScopeError = class extends OAuthError {
|
|
225577
|
-
};
|
|
225578
|
-
InvalidScopeError.errorCode = "invalid_scope";
|
|
225579
|
-
AccessDeniedError = class extends OAuthError {
|
|
225580
|
-
};
|
|
225581
|
-
AccessDeniedError.errorCode = "access_denied";
|
|
225582
|
-
ServerError = class extends OAuthError {
|
|
225583
|
-
};
|
|
225584
|
-
ServerError.errorCode = "server_error";
|
|
225585
|
-
TemporarilyUnavailableError = class extends OAuthError {
|
|
225586
|
-
};
|
|
225587
|
-
TemporarilyUnavailableError.errorCode = "temporarily_unavailable";
|
|
225588
|
-
UnsupportedResponseTypeError = class extends OAuthError {
|
|
225589
|
-
};
|
|
225590
|
-
UnsupportedResponseTypeError.errorCode = "unsupported_response_type";
|
|
225591
|
-
UnsupportedTokenTypeError = class extends OAuthError {
|
|
225592
|
-
};
|
|
225593
|
-
UnsupportedTokenTypeError.errorCode = "unsupported_token_type";
|
|
225594
|
-
InvalidTokenError = class extends OAuthError {
|
|
225595
|
-
};
|
|
225596
|
-
InvalidTokenError.errorCode = "invalid_token";
|
|
225597
|
-
MethodNotAllowedError = class extends OAuthError {
|
|
225598
|
-
};
|
|
225599
|
-
MethodNotAllowedError.errorCode = "method_not_allowed";
|
|
225600
|
-
TooManyRequestsError = class extends OAuthError {
|
|
225601
|
-
};
|
|
225602
|
-
TooManyRequestsError.errorCode = "too_many_requests";
|
|
225603
|
-
InvalidClientMetadataError = class extends OAuthError {
|
|
225604
|
-
};
|
|
225605
|
-
InvalidClientMetadataError.errorCode = "invalid_client_metadata";
|
|
225606
|
-
InsufficientScopeError = class extends OAuthError {
|
|
225607
|
-
};
|
|
225608
|
-
InsufficientScopeError.errorCode = "insufficient_scope";
|
|
225609
|
-
OAUTH_ERRORS = {
|
|
225610
|
-
[InvalidRequestError.errorCode]: InvalidRequestError,
|
|
225611
|
-
[InvalidClientError.errorCode]: InvalidClientError,
|
|
225612
|
-
[InvalidGrantError.errorCode]: InvalidGrantError,
|
|
225613
|
-
[UnauthorizedClientError.errorCode]: UnauthorizedClientError,
|
|
225614
|
-
[UnsupportedGrantTypeError.errorCode]: UnsupportedGrantTypeError,
|
|
225615
|
-
[InvalidScopeError.errorCode]: InvalidScopeError,
|
|
225616
|
-
[AccessDeniedError.errorCode]: AccessDeniedError,
|
|
225617
|
-
[ServerError.errorCode]: ServerError,
|
|
225618
|
-
[TemporarilyUnavailableError.errorCode]: TemporarilyUnavailableError,
|
|
225619
|
-
[UnsupportedResponseTypeError.errorCode]: UnsupportedResponseTypeError,
|
|
225620
|
-
[UnsupportedTokenTypeError.errorCode]: UnsupportedTokenTypeError,
|
|
225621
|
-
[InvalidTokenError.errorCode]: InvalidTokenError,
|
|
225622
|
-
[MethodNotAllowedError.errorCode]: MethodNotAllowedError,
|
|
225623
|
-
[TooManyRequestsError.errorCode]: TooManyRequestsError,
|
|
225624
|
-
[InvalidClientMetadataError.errorCode]: InvalidClientMetadataError,
|
|
225625
|
-
[InsufficientScopeError.errorCode]: InsufficientScopeError
|
|
225626
|
-
};
|
|
225627
|
-
}
|
|
225628
|
-
});
|
|
225629
|
-
|
|
225630
|
-
// ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
|
|
225631
|
-
var init_auth2 = __esm({
|
|
225632
|
-
"../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js"() {
|
|
225633
|
-
"use strict";
|
|
225634
|
-
init_esm_shims();
|
|
225635
|
-
init_index_node();
|
|
225636
|
-
init_types2();
|
|
225637
|
-
init_auth();
|
|
225638
|
-
init_auth();
|
|
225639
|
-
init_auth_utils();
|
|
225640
|
-
init_errors();
|
|
225641
|
-
}
|
|
225642
|
-
});
|
|
225643
|
-
|
|
225644
225646
|
// ../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js
|
|
225645
225647
|
var init_sse = __esm({
|
|
225646
225648
|
"../node_modules/.pnpm/@modelcontextprotocol+sdk@1.19.1/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js"() {
|
|
@@ -233680,27 +233682,27 @@ var init_memory_store = __esm({
|
|
|
233680
233682
|
}
|
|
233681
233683
|
});
|
|
233682
233684
|
|
|
233683
|
-
// ../node_modules/.pnpm/@nangohq+node@0.
|
|
233685
|
+
// ../node_modules/.pnpm/@nangohq+node@0.69.3/node_modules/@nangohq/node/dist/version.js
|
|
233684
233686
|
var init_version2 = __esm({
|
|
233685
|
-
"../node_modules/.pnpm/@nangohq+node@0.
|
|
233687
|
+
"../node_modules/.pnpm/@nangohq+node@0.69.3/node_modules/@nangohq/node/dist/version.js"() {
|
|
233686
233688
|
"use strict";
|
|
233687
233689
|
init_esm_shims();
|
|
233688
233690
|
}
|
|
233689
233691
|
});
|
|
233690
233692
|
|
|
233691
|
-
// ../node_modules/.pnpm/@nangohq+node@0.
|
|
233693
|
+
// ../node_modules/.pnpm/@nangohq+node@0.69.3/node_modules/@nangohq/node/dist/utils.js
|
|
233692
233694
|
var init_utils2 = __esm({
|
|
233693
|
-
"../node_modules/.pnpm/@nangohq+node@0.
|
|
233695
|
+
"../node_modules/.pnpm/@nangohq+node@0.69.3/node_modules/@nangohq/node/dist/utils.js"() {
|
|
233694
233696
|
"use strict";
|
|
233695
233697
|
init_esm_shims();
|
|
233696
233698
|
init_version2();
|
|
233697
233699
|
}
|
|
233698
233700
|
});
|
|
233699
233701
|
|
|
233700
|
-
// ../node_modules/.pnpm/@nangohq+node@0.
|
|
233702
|
+
// ../node_modules/.pnpm/@nangohq+node@0.69.3/node_modules/@nangohq/node/dist/types.js
|
|
233701
233703
|
var SyncConfigType;
|
|
233702
233704
|
var init_types4 = __esm({
|
|
233703
|
-
"../node_modules/.pnpm/@nangohq+node@0.
|
|
233705
|
+
"../node_modules/.pnpm/@nangohq+node@0.69.3/node_modules/@nangohq/node/dist/types.js"() {
|
|
233704
233706
|
"use strict";
|
|
233705
233707
|
init_esm_shims();
|
|
233706
233708
|
(function(SyncConfigType2) {
|
|
@@ -233710,12 +233712,12 @@ var init_types4 = __esm({
|
|
|
233710
233712
|
}
|
|
233711
233713
|
});
|
|
233712
233714
|
|
|
233713
|
-
// ../node_modules/.pnpm/@nangohq+node@0.
|
|
233715
|
+
// ../node_modules/.pnpm/@nangohq+node@0.69.3/node_modules/@nangohq/node/dist/index.js
|
|
233714
233716
|
import crypto5 from "crypto";
|
|
233715
233717
|
import https from "https";
|
|
233716
233718
|
var defaultHttpsAgent;
|
|
233717
233719
|
var init_dist6 = __esm({
|
|
233718
|
-
"../node_modules/.pnpm/@nangohq+node@0.
|
|
233720
|
+
"../node_modules/.pnpm/@nangohq+node@0.69.3/node_modules/@nangohq/node/dist/index.js"() {
|
|
233719
233721
|
"use strict";
|
|
233720
233722
|
init_esm_shims();
|
|
233721
233723
|
init_utils2();
|
|
@@ -233998,6 +234000,41 @@ var init_src = __esm({
|
|
|
233998
234000
|
}
|
|
233999
234001
|
});
|
|
234000
234002
|
|
|
234003
|
+
// src/env.ts
|
|
234004
|
+
import { z as z12 } from "zod";
|
|
234005
|
+
var envSchema2, parseEnv2, env2;
|
|
234006
|
+
var init_env2 = __esm({
|
|
234007
|
+
"src/env.ts"() {
|
|
234008
|
+
"use strict";
|
|
234009
|
+
init_esm_shims();
|
|
234010
|
+
init_src();
|
|
234011
|
+
loadEnvironmentFiles();
|
|
234012
|
+
envSchema2 = z12.object({
|
|
234013
|
+
DEBUG: z12.string().optional(),
|
|
234014
|
+
// Secrets loaded from .env files (relative to where CLI is executed)
|
|
234015
|
+
ANTHROPIC_API_KEY: z12.string().optional(),
|
|
234016
|
+
OPENAI_API_KEY: z12.string().optional(),
|
|
234017
|
+
GOOGLE_API_KEY: z12.string().optional()
|
|
234018
|
+
});
|
|
234019
|
+
parseEnv2 = () => {
|
|
234020
|
+
try {
|
|
234021
|
+
const parsedEnv = envSchema2.parse(process.env);
|
|
234022
|
+
return parsedEnv;
|
|
234023
|
+
} catch (error) {
|
|
234024
|
+
if (error instanceof z12.ZodError) {
|
|
234025
|
+
const missingVars = error.issues.map((issue) => issue.path.join("."));
|
|
234026
|
+
throw new Error(
|
|
234027
|
+
`\u274C Invalid environment variables: ${missingVars.join(", ")}
|
|
234028
|
+
${error.message}`
|
|
234029
|
+
);
|
|
234030
|
+
}
|
|
234031
|
+
throw error;
|
|
234032
|
+
}
|
|
234033
|
+
};
|
|
234034
|
+
env2 = parseEnv2();
|
|
234035
|
+
}
|
|
234036
|
+
});
|
|
234037
|
+
|
|
234001
234038
|
// src/utils/tsx-loader.ts
|
|
234002
234039
|
import { extname } from "path";
|
|
234003
234040
|
import { pathToFileURL } from "url";
|
|
@@ -234401,6 +234438,7 @@ __export(pull_llm_generate_exports, {
|
|
|
234401
234438
|
NAMING_CONVENTION_RULES: () => NAMING_CONVENTION_RULES,
|
|
234402
234439
|
cleanGeneratedCode: () => cleanGeneratedCode,
|
|
234403
234440
|
createModel: () => createModel,
|
|
234441
|
+
detectAvailableProvider: () => detectAvailableProvider,
|
|
234404
234442
|
generateAgentFile: () => generateAgentFile,
|
|
234405
234443
|
generateArtifactComponentFile: () => generateArtifactComponentFile,
|
|
234406
234444
|
generateDataComponentFile: () => generateDataComponentFile,
|
|
@@ -234410,12 +234448,15 @@ __export(pull_llm_generate_exports, {
|
|
|
234410
234448
|
generateTextWithPlaceholders: () => generateTextWithPlaceholders,
|
|
234411
234449
|
generateToolFile: () => generateToolFile,
|
|
234412
234450
|
generateTypeScriptFileWithLLM: () => generateTypeScriptFileWithLLM,
|
|
234451
|
+
getDefaultModelForProvider: () => getDefaultModelForProvider,
|
|
234452
|
+
getModelConfigWithReasoning: () => getModelConfigWithReasoning,
|
|
234413
234453
|
getTypeDefinitions: () => getTypeDefinitions
|
|
234414
234454
|
});
|
|
234415
234455
|
import { readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
234416
234456
|
import { createRequire as createRequire2 } from "module";
|
|
234417
234457
|
import { join as join7 } from "path";
|
|
234418
234458
|
import { anthropic, createAnthropic } from "@ai-sdk/anthropic";
|
|
234459
|
+
import { google } from "@ai-sdk/google";
|
|
234419
234460
|
import { createOpenAI, openai } from "@ai-sdk/openai";
|
|
234420
234461
|
import { generateText } from "ai";
|
|
234421
234462
|
function getTypeDefinitions() {
|
|
@@ -234440,6 +234481,54 @@ ${dtsContent}
|
|
|
234440
234481
|
`;
|
|
234441
234482
|
}
|
|
234442
234483
|
}
|
|
234484
|
+
function detectAvailableProvider() {
|
|
234485
|
+
const anthropicKey = env2.ANTHROPIC_API_KEY?.trim();
|
|
234486
|
+
const openaiKey = env2.OPENAI_API_KEY?.trim();
|
|
234487
|
+
const googleKey = env2.GOOGLE_API_KEY?.trim();
|
|
234488
|
+
if (anthropicKey) {
|
|
234489
|
+
return "anthropic";
|
|
234490
|
+
}
|
|
234491
|
+
if (openaiKey) {
|
|
234492
|
+
return "openai";
|
|
234493
|
+
}
|
|
234494
|
+
if (googleKey) {
|
|
234495
|
+
return "google";
|
|
234496
|
+
}
|
|
234497
|
+
throw new Error("No LLM provider API key found. Please set ANTHROPIC_API_KEY, OPENAI_API_KEY, or GOOGLE_API_KEY");
|
|
234498
|
+
}
|
|
234499
|
+
function getDefaultModelForProvider(provider) {
|
|
234500
|
+
switch (provider) {
|
|
234501
|
+
case "anthropic":
|
|
234502
|
+
return ANTHROPIC_MODELS.CLAUDE_SONNET_4_5;
|
|
234503
|
+
case "openai":
|
|
234504
|
+
return OPENAI_MODELS.GPT_4_1;
|
|
234505
|
+
case "google":
|
|
234506
|
+
return GOOGLE_MODELS.GEMINI_2_5_PRO;
|
|
234507
|
+
default:
|
|
234508
|
+
throw new Error(`Unknown provider: ${provider}`);
|
|
234509
|
+
}
|
|
234510
|
+
}
|
|
234511
|
+
function getModelConfigWithReasoning(provider) {
|
|
234512
|
+
switch (provider) {
|
|
234513
|
+
case "anthropic":
|
|
234514
|
+
return {
|
|
234515
|
+
thinking: {
|
|
234516
|
+
type: "enabled",
|
|
234517
|
+
budget: {}
|
|
234518
|
+
}
|
|
234519
|
+
};
|
|
234520
|
+
case "google":
|
|
234521
|
+
return {
|
|
234522
|
+
thinkingConfig: {
|
|
234523
|
+
mode: "thinking"
|
|
234524
|
+
}
|
|
234525
|
+
};
|
|
234526
|
+
case "openai":
|
|
234527
|
+
return {};
|
|
234528
|
+
default:
|
|
234529
|
+
return {};
|
|
234530
|
+
}
|
|
234531
|
+
}
|
|
234443
234532
|
function createModel(config) {
|
|
234444
234533
|
if (!config.model) {
|
|
234445
234534
|
throw new Error("Model configuration is required for pull command");
|
|
@@ -234460,6 +234549,8 @@ function createModel(config) {
|
|
|
234460
234549
|
return provider2(modelName);
|
|
234461
234550
|
}
|
|
234462
234551
|
return openai(modelName);
|
|
234552
|
+
case "google":
|
|
234553
|
+
return google(modelName);
|
|
234463
234554
|
default:
|
|
234464
234555
|
throw new Error(`Unsupported provider: ${provider}`);
|
|
234465
234556
|
}
|
|
@@ -234467,7 +234558,7 @@ function createModel(config) {
|
|
|
234467
234558
|
function cleanGeneratedCode(text2) {
|
|
234468
234559
|
return text2.replace(/^```(?:typescript|ts)?\n?/, "").replace(/\n?```$/, "").trim();
|
|
234469
234560
|
}
|
|
234470
|
-
async function generateTextWithPlaceholders(model, data, promptTemplate, options, debug = false, context) {
|
|
234561
|
+
async function generateTextWithPlaceholders(model, data, promptTemplate, options, debug = false, context, reasoningConfig) {
|
|
234471
234562
|
const { processedData, replacements } = context ? createPlaceholders(data, context) : createPlaceholders(data);
|
|
234472
234563
|
if (debug && Object.keys(replacements).length > 0) {
|
|
234473
234564
|
const savings = calculateTokenSavings(data, processedData);
|
|
@@ -234486,7 +234577,9 @@ async function generateTextWithPlaceholders(model, data, promptTemplate, options
|
|
|
234486
234577
|
const { text: text2 } = await generateText({
|
|
234487
234578
|
model,
|
|
234488
234579
|
prompt,
|
|
234489
|
-
...options
|
|
234580
|
+
...options,
|
|
234581
|
+
...reasoningConfig
|
|
234582
|
+
// Merge in reasoning/thinking config if provided
|
|
234490
234583
|
});
|
|
234491
234584
|
const restoredText = restorePlaceholders(text2, replacements);
|
|
234492
234585
|
if (debug && Object.keys(replacements).length > 0) {
|
|
@@ -234507,7 +234600,7 @@ function parseModelString(modelString) {
|
|
|
234507
234600
|
modelName: modelString
|
|
234508
234601
|
};
|
|
234509
234602
|
}
|
|
234510
|
-
async function generateIndexFile(projectData, outputPath, modelSettings) {
|
|
234603
|
+
async function generateIndexFile(projectData, outputPath, modelSettings, reasoningConfig) {
|
|
234511
234604
|
const model = createModel(modelSettings);
|
|
234512
234605
|
const promptTemplate = `Generate a TypeScript index.ts file for an Inkeep project with the following data:
|
|
234513
234606
|
|
|
@@ -234543,12 +234636,23 @@ export const myProject = project({
|
|
|
234543
234636
|
});
|
|
234544
234637
|
|
|
234545
234638
|
Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
234546
|
-
const text2 = await generateTextWithPlaceholders(
|
|
234547
|
-
|
|
234548
|
-
|
|
234549
|
-
|
|
234550
|
-
|
|
234551
|
-
|
|
234639
|
+
const text2 = await generateTextWithPlaceholders(
|
|
234640
|
+
model,
|
|
234641
|
+
projectData,
|
|
234642
|
+
promptTemplate,
|
|
234643
|
+
{
|
|
234644
|
+
temperature: 0.1,
|
|
234645
|
+
maxOutputTokens: 4e3,
|
|
234646
|
+
abortSignal: AbortSignal.timeout(9e4)
|
|
234647
|
+
// 90 second timeout (increased for reasoning)
|
|
234648
|
+
},
|
|
234649
|
+
false,
|
|
234650
|
+
// debug
|
|
234651
|
+
void 0,
|
|
234652
|
+
// context
|
|
234653
|
+
reasoningConfig
|
|
234654
|
+
// reasoning config
|
|
234655
|
+
);
|
|
234552
234656
|
writeFileSync3(outputPath, cleanGeneratedCode(text2));
|
|
234553
234657
|
}
|
|
234554
234658
|
function generateImportMappings(toolFilenames, componentFilenames) {
|
|
@@ -234578,7 +234682,7 @@ function generateImportMappings(toolFilenames, componentFilenames) {
|
|
|
234578
234682
|
}
|
|
234579
234683
|
return result;
|
|
234580
234684
|
}
|
|
234581
|
-
async function generateAgentFile(agentData, agentId, outputPath, modelSettings, toolFilenames, componentFilenames, debug = false) {
|
|
234685
|
+
async function generateAgentFile(agentData, agentId, outputPath, modelSettings, toolFilenames, componentFilenames, debug = false, reasoningConfig) {
|
|
234582
234686
|
const model = createModel(modelSettings);
|
|
234583
234687
|
const promptTemplate = `Generate a TypeScript file for an Inkeep agent.
|
|
234584
234688
|
|
|
@@ -234795,11 +234899,15 @@ Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
|
234795
234899
|
{
|
|
234796
234900
|
temperature: 0.1,
|
|
234797
234901
|
maxOutputTokens: 16e3,
|
|
234798
|
-
abortSignal: AbortSignal.timeout(
|
|
234799
|
-
//
|
|
234902
|
+
abortSignal: AbortSignal.timeout(3e5)
|
|
234903
|
+
// 300 second timeout for complex agent (5 min, increased for reasoning)
|
|
234800
234904
|
},
|
|
234801
|
-
debug
|
|
234905
|
+
debug,
|
|
234802
234906
|
// Pass debug flag to show placeholder optimization info
|
|
234907
|
+
void 0,
|
|
234908
|
+
// context
|
|
234909
|
+
reasoningConfig
|
|
234910
|
+
// reasoning config
|
|
234803
234911
|
);
|
|
234804
234912
|
const duration = Date.now() - startTime;
|
|
234805
234913
|
if (debug) {
|
|
@@ -234832,7 +234940,7 @@ Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
|
234832
234940
|
throw error;
|
|
234833
234941
|
}
|
|
234834
234942
|
}
|
|
234835
|
-
async function generateToolFile(toolData, toolId, outputPath, modelSettings) {
|
|
234943
|
+
async function generateToolFile(toolData, toolId, outputPath, modelSettings, reasoningConfig) {
|
|
234836
234944
|
const model = createModel(modelSettings);
|
|
234837
234945
|
const promptTemplate = `Generate a TypeScript file for an Inkeep tool.
|
|
234838
234946
|
|
|
@@ -234881,15 +234989,26 @@ export const transportTool = mcpTool({
|
|
|
234881
234989
|
});
|
|
234882
234990
|
|
|
234883
234991
|
Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
234884
|
-
const text2 = await generateTextWithPlaceholders(
|
|
234885
|
-
|
|
234886
|
-
|
|
234887
|
-
|
|
234888
|
-
|
|
234889
|
-
|
|
234992
|
+
const text2 = await generateTextWithPlaceholders(
|
|
234993
|
+
model,
|
|
234994
|
+
toolData,
|
|
234995
|
+
promptTemplate,
|
|
234996
|
+
{
|
|
234997
|
+
temperature: 0.1,
|
|
234998
|
+
maxOutputTokens: 4e3,
|
|
234999
|
+
abortSignal: AbortSignal.timeout(9e4)
|
|
235000
|
+
// 90 second timeout (increased for reasoning)
|
|
235001
|
+
},
|
|
235002
|
+
false,
|
|
235003
|
+
// debug
|
|
235004
|
+
void 0,
|
|
235005
|
+
// context
|
|
235006
|
+
reasoningConfig
|
|
235007
|
+
// reasoning config
|
|
235008
|
+
);
|
|
234890
235009
|
writeFileSync3(outputPath, cleanGeneratedCode(text2));
|
|
234891
235010
|
}
|
|
234892
|
-
async function generateDataComponentFile(componentData, componentId, outputPath, modelSettings) {
|
|
235011
|
+
async function generateDataComponentFile(componentData, componentId, outputPath, modelSettings, reasoningConfig) {
|
|
234893
235012
|
const model = createModel(modelSettings);
|
|
234894
235013
|
const promptTemplate = `Generate a TypeScript file for an Inkeep data component.
|
|
234895
235014
|
|
|
@@ -234948,15 +235067,26 @@ export const userProfile = dataComponent({
|
|
|
234948
235067
|
});
|
|
234949
235068
|
|
|
234950
235069
|
Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
234951
|
-
const text2 = await generateTextWithPlaceholders(
|
|
234952
|
-
|
|
234953
|
-
|
|
234954
|
-
|
|
234955
|
-
|
|
234956
|
-
|
|
235070
|
+
const text2 = await generateTextWithPlaceholders(
|
|
235071
|
+
model,
|
|
235072
|
+
componentData,
|
|
235073
|
+
promptTemplate,
|
|
235074
|
+
{
|
|
235075
|
+
temperature: 0.1,
|
|
235076
|
+
maxOutputTokens: 4e3,
|
|
235077
|
+
abortSignal: AbortSignal.timeout(9e4)
|
|
235078
|
+
// 90 second timeout (increased for reasoning)
|
|
235079
|
+
},
|
|
235080
|
+
false,
|
|
235081
|
+
// debug
|
|
235082
|
+
void 0,
|
|
235083
|
+
// context
|
|
235084
|
+
reasoningConfig
|
|
235085
|
+
// reasoning config
|
|
235086
|
+
);
|
|
234957
235087
|
writeFileSync3(outputPath, cleanGeneratedCode(text2));
|
|
234958
235088
|
}
|
|
234959
|
-
async function generateArtifactComponentFile(componentData, componentId, outputPath, modelSettings) {
|
|
235089
|
+
async function generateArtifactComponentFile(componentData, componentId, outputPath, modelSettings, reasoningConfig) {
|
|
234960
235090
|
const model = createModel(modelSettings);
|
|
234961
235091
|
const promptTemplate = `Generate a TypeScript file for an Inkeep artifact component.
|
|
234962
235092
|
|
|
@@ -235020,15 +235150,26 @@ export const orderSummary = artifactComponent({
|
|
|
235020
235150
|
});
|
|
235021
235151
|
|
|
235022
235152
|
Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
235023
|
-
const text2 = await generateTextWithPlaceholders(
|
|
235024
|
-
|
|
235025
|
-
|
|
235026
|
-
|
|
235027
|
-
|
|
235028
|
-
|
|
235153
|
+
const text2 = await generateTextWithPlaceholders(
|
|
235154
|
+
model,
|
|
235155
|
+
componentData,
|
|
235156
|
+
promptTemplate,
|
|
235157
|
+
{
|
|
235158
|
+
temperature: 0.1,
|
|
235159
|
+
maxOutputTokens: 4e3,
|
|
235160
|
+
abortSignal: AbortSignal.timeout(9e4)
|
|
235161
|
+
// 90 second timeout (increased for reasoning)
|
|
235162
|
+
},
|
|
235163
|
+
false,
|
|
235164
|
+
// debug
|
|
235165
|
+
void 0,
|
|
235166
|
+
// context
|
|
235167
|
+
reasoningConfig
|
|
235168
|
+
// reasoning config
|
|
235169
|
+
);
|
|
235029
235170
|
writeFileSync3(outputPath, cleanGeneratedCode(text2));
|
|
235030
235171
|
}
|
|
235031
|
-
async function generateStatusComponentFile(componentData, componentId, outputPath, modelSettings) {
|
|
235172
|
+
async function generateStatusComponentFile(componentData, componentId, outputPath, modelSettings, reasoningConfig) {
|
|
235032
235173
|
const model = createModel(modelSettings);
|
|
235033
235174
|
const promptTemplate = `Generate a TypeScript file for an Inkeep status component.
|
|
235034
235175
|
|
|
@@ -235090,11 +235231,23 @@ export const simpleStatus = statusComponent({
|
|
|
235090
235231
|
});
|
|
235091
235232
|
|
|
235092
235233
|
Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
235093
|
-
const text2 = await generateTextWithPlaceholders(
|
|
235094
|
-
|
|
235095
|
-
|
|
235096
|
-
|
|
235097
|
-
|
|
235234
|
+
const text2 = await generateTextWithPlaceholders(
|
|
235235
|
+
model,
|
|
235236
|
+
componentData,
|
|
235237
|
+
promptTemplate,
|
|
235238
|
+
{
|
|
235239
|
+
temperature: 0.1,
|
|
235240
|
+
maxOutputTokens: 4e3,
|
|
235241
|
+
abortSignal: AbortSignal.timeout(9e4)
|
|
235242
|
+
// 90 second timeout (increased for reasoning)
|
|
235243
|
+
},
|
|
235244
|
+
false,
|
|
235245
|
+
// debug
|
|
235246
|
+
void 0,
|
|
235247
|
+
// context
|
|
235248
|
+
reasoningConfig
|
|
235249
|
+
// reasoning config
|
|
235250
|
+
);
|
|
235098
235251
|
writeFileSync3(outputPath, cleanGeneratedCode(text2));
|
|
235099
235252
|
}
|
|
235100
235253
|
async function generateEnvironmentFiles(environmentsDir, credentials, environment = "development") {
|
|
@@ -235315,6 +235468,7 @@ var init_pull_llm_generate = __esm({
|
|
|
235315
235468
|
"use strict";
|
|
235316
235469
|
init_esm_shims();
|
|
235317
235470
|
init_src();
|
|
235471
|
+
init_env2();
|
|
235318
235472
|
init_pull_placeholder_system();
|
|
235319
235473
|
require3 = createRequire2(import.meta.url);
|
|
235320
235474
|
PROJECT_JSON_EXAMPLE = `
|
|
@@ -236759,13 +236913,13 @@ __export(unified_generator_exports, {
|
|
|
236759
236913
|
generateFilesFromPlan: () => generateFilesFromPlan
|
|
236760
236914
|
});
|
|
236761
236915
|
import { writeFileSync as writeFileSync4 } from "fs";
|
|
236762
|
-
async function generateFilesFromPlan(plan, projectData, dirs, modelSettings, debug = false) {
|
|
236916
|
+
async function generateFilesFromPlan(plan, projectData, dirs, modelSettings, debug = false, reasoningConfig) {
|
|
236763
236917
|
const startTime = Date.now();
|
|
236764
236918
|
if (debug) {
|
|
236765
236919
|
console.log(`[DEBUG] Starting parallel generation of ${plan.files.length} files...`);
|
|
236766
236920
|
}
|
|
236767
236921
|
const tasks2 = plan.files.map(
|
|
236768
|
-
(fileInfo, index2) => generateFile(fileInfo, projectData, plan, dirs, modelSettings, debug).then(() => {
|
|
236922
|
+
(fileInfo, index2) => generateFile(fileInfo, projectData, plan, dirs, modelSettings, debug, reasoningConfig).then(() => {
|
|
236769
236923
|
if (debug) {
|
|
236770
236924
|
const elapsed = ((Date.now() - startTime) / 1e3).toFixed(1);
|
|
236771
236925
|
console.log(
|
|
@@ -236782,7 +236936,7 @@ async function generateFilesFromPlan(plan, projectData, dirs, modelSettings, deb
|
|
|
236782
236936
|
);
|
|
236783
236937
|
}
|
|
236784
236938
|
}
|
|
236785
|
-
async function generateFile(fileInfo, projectData, plan, dirs, modelSettings, debug) {
|
|
236939
|
+
async function generateFile(fileInfo, projectData, plan, dirs, modelSettings, debug, reasoningConfig) {
|
|
236786
236940
|
const fileStartTime = Date.now();
|
|
236787
236941
|
const model = createModel(modelSettings);
|
|
236788
236942
|
const outputPath = `${dirs.projectRoot}/${fileInfo.path}`;
|
|
@@ -236808,10 +236962,13 @@ async function generateFile(fileInfo, projectData, plan, dirs, modelSettings, de
|
|
|
236808
236962
|
{
|
|
236809
236963
|
temperature: 0.1,
|
|
236810
236964
|
maxOutputTokens: fileInfo.type === "agent" ? 16e3 : 4e3,
|
|
236811
|
-
abortSignal: AbortSignal.timeout(fileInfo.type === "agent" ?
|
|
236965
|
+
abortSignal: AbortSignal.timeout(fileInfo.type === "agent" ? 3e5 : 9e4)
|
|
236966
|
+
// Increased for reasoning (5 min for agents, 90s for others)
|
|
236812
236967
|
},
|
|
236813
236968
|
debug,
|
|
236814
|
-
{ fileType: fileInfo.type }
|
|
236969
|
+
{ fileType: fileInfo.type },
|
|
236970
|
+
reasoningConfig
|
|
236971
|
+
// Pass reasoning config
|
|
236815
236972
|
);
|
|
236816
236973
|
const llmDuration = ((Date.now() - llmStartTime) / 1e3).toFixed(1);
|
|
236817
236974
|
const cleanedCode = cleanGeneratedCode(text2);
|
|
@@ -237771,35 +237928,7 @@ var init_plan_storage = __esm({
|
|
|
237771
237928
|
|
|
237772
237929
|
// src/index.ts
|
|
237773
237930
|
init_esm_shims();
|
|
237774
|
-
|
|
237775
|
-
// src/env.ts
|
|
237776
|
-
init_esm_shims();
|
|
237777
|
-
init_src();
|
|
237778
|
-
import { z as z12 } from "zod";
|
|
237779
|
-
loadEnvironmentFiles();
|
|
237780
|
-
var envSchema2 = z12.object({
|
|
237781
|
-
DEBUG: z12.string().optional(),
|
|
237782
|
-
// Secrets loaded from .env files (relative to where CLI is executed)
|
|
237783
|
-
ANTHROPIC_API_KEY: z12.string().optional()
|
|
237784
|
-
});
|
|
237785
|
-
var parseEnv2 = () => {
|
|
237786
|
-
try {
|
|
237787
|
-
const parsedEnv = envSchema2.parse(process.env);
|
|
237788
|
-
return parsedEnv;
|
|
237789
|
-
} catch (error) {
|
|
237790
|
-
if (error instanceof z12.ZodError) {
|
|
237791
|
-
const missingVars = error.issues.map((issue) => issue.path.join("."));
|
|
237792
|
-
throw new Error(
|
|
237793
|
-
`\u274C Invalid environment variables: ${missingVars.join(", ")}
|
|
237794
|
-
${error.message}`
|
|
237795
|
-
);
|
|
237796
|
-
}
|
|
237797
|
-
throw error;
|
|
237798
|
-
}
|
|
237799
|
-
};
|
|
237800
|
-
var env2 = parseEnv2();
|
|
237801
|
-
|
|
237802
|
-
// src/index.ts
|
|
237931
|
+
init_env2();
|
|
237803
237932
|
import { readFileSync as readFileSync7 } from "fs";
|
|
237804
237933
|
import { dirname as dirname6, join as join13 } from "path";
|
|
237805
237934
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
@@ -238837,7 +238966,6 @@ ${table.toString()}`);
|
|
|
238837
238966
|
|
|
238838
238967
|
// src/commands/pull.ts
|
|
238839
238968
|
init_esm_shims();
|
|
238840
|
-
init_src();
|
|
238841
238969
|
import { existsSync as existsSync9, mkdirSync as mkdirSync2, readFileSync as readFileSync6, writeFileSync as writeFileSync6 } from "fs";
|
|
238842
238970
|
import { dirname as dirname5, join as join10, resolve as resolve4 } from "path";
|
|
238843
238971
|
import chalk9 from "chalk";
|
|
@@ -239208,24 +239336,30 @@ function createProjectStructure(projectDir, projectId, useCurrentDirectory = fal
|
|
|
239208
239336
|
}
|
|
239209
239337
|
async function pullProjectCommand(options) {
|
|
239210
239338
|
performBackgroundVersionCheck();
|
|
239211
|
-
|
|
239212
|
-
|
|
239339
|
+
let provider;
|
|
239340
|
+
try {
|
|
239341
|
+
const { detectAvailableProvider: detectAvailableProvider2 } = await Promise.resolve().then(() => (init_pull_llm_generate(), pull_llm_generate_exports));
|
|
239342
|
+
provider = detectAvailableProvider2();
|
|
239343
|
+
console.log(chalk9.gray(`
|
|
239344
|
+
\u{1F916} Using ${provider.charAt(0).toUpperCase() + provider.slice(1)} for code generation`));
|
|
239345
|
+
} catch (error) {
|
|
239213
239346
|
console.error(
|
|
239214
|
-
chalk9.red("\n\u274C Error:
|
|
239347
|
+
chalk9.red("\n\u274C Error: No LLM provider API key found")
|
|
239215
239348
|
);
|
|
239216
239349
|
console.error(
|
|
239217
239350
|
chalk9.yellow(
|
|
239218
|
-
"\nThe pull command
|
|
239351
|
+
"\nThe pull command requires AI to generate TypeScript files from your project configuration."
|
|
239219
239352
|
)
|
|
239220
239353
|
);
|
|
239221
|
-
console.error(chalk9.yellow("
|
|
239222
|
-
console.error(chalk9.cyan("
|
|
239223
|
-
console.error(chalk9.gray("
|
|
239224
|
-
console.error(chalk9.gray("
|
|
239225
|
-
console.error(chalk9.gray("
|
|
239226
|
-
console.error(chalk9.gray("
|
|
239227
|
-
console.error(chalk9.gray("
|
|
239228
|
-
console.error(chalk9.
|
|
239354
|
+
console.error(chalk9.yellow("You must provide an API key for one of these providers:\n"));
|
|
239355
|
+
console.error(chalk9.cyan("Options:"));
|
|
239356
|
+
console.error(chalk9.gray(" \u2022 Anthropic: https://console.anthropic.com/"));
|
|
239357
|
+
console.error(chalk9.gray(" Set: ANTHROPIC_API_KEY=your_api_key_here\n"));
|
|
239358
|
+
console.error(chalk9.gray(" \u2022 OpenAI: https://platform.openai.com/"));
|
|
239359
|
+
console.error(chalk9.gray(" Set: OPENAI_API_KEY=your_api_key_here\n"));
|
|
239360
|
+
console.error(chalk9.gray(" \u2022 Google: https://ai.google.dev/"));
|
|
239361
|
+
console.error(chalk9.gray(" Set: GOOGLE_API_KEY=your_api_key_here\n"));
|
|
239362
|
+
console.error(chalk9.yellow("\u{1F4A1} Note: Set the key in your environment or .env file"));
|
|
239229
239363
|
process.exit(1);
|
|
239230
239364
|
}
|
|
239231
239365
|
const spinner = ora5("Loading configuration...").start();
|
|
@@ -239486,10 +239620,17 @@ async function pullProjectCommand(options) {
|
|
|
239486
239620
|
}
|
|
239487
239621
|
spinner.start("Generating file structure plan...");
|
|
239488
239622
|
const { generatePlan: generatePlan2 } = await Promise.resolve().then(() => (init_plan_builder(), plan_builder_exports));
|
|
239489
|
-
const { createModel: createModel2 } = await Promise.resolve().then(() => (init_pull_llm_generate(), pull_llm_generate_exports));
|
|
239623
|
+
const { createModel: createModel2, getDefaultModelForProvider: getDefaultModelForProvider2, getModelConfigWithReasoning: getModelConfigWithReasoning2 } = await Promise.resolve().then(() => (init_pull_llm_generate(), pull_llm_generate_exports));
|
|
239624
|
+
const selectedModel = getDefaultModelForProvider2(provider);
|
|
239625
|
+
const reasoningConfig = getModelConfigWithReasoning2(provider);
|
|
239490
239626
|
const modelSettings = {
|
|
239491
|
-
model:
|
|
239627
|
+
model: selectedModel
|
|
239492
239628
|
};
|
|
239629
|
+
if (options.debug) {
|
|
239630
|
+
console.log(chalk9.gray(`
|
|
239631
|
+
\u{1F4CD} Debug: Model selected: ${selectedModel}`));
|
|
239632
|
+
console.log(chalk9.gray(`\u{1F4CD} Debug: Reasoning enabled: ${Object.keys(reasoningConfig).length > 0 ? "Yes" : "No"}`));
|
|
239633
|
+
}
|
|
239493
239634
|
const targetEnvironment = options.env || "development";
|
|
239494
239635
|
const plan = await generatePlan2(projectData, patterns, modelSettings, createModel2, targetEnvironment);
|
|
239495
239636
|
spinner.succeed("Generation plan created");
|
|
@@ -239499,7 +239640,15 @@ async function pullProjectCommand(options) {
|
|
|
239499
239640
|
spinner.start("Generating project files with LLM...");
|
|
239500
239641
|
const { generateFilesFromPlan: generateFilesFromPlan2 } = await Promise.resolve().then(() => (init_unified_generator(), unified_generator_exports));
|
|
239501
239642
|
const generationStart = Date.now();
|
|
239502
|
-
await generateFilesFromPlan2(
|
|
239643
|
+
await generateFilesFromPlan2(
|
|
239644
|
+
plan,
|
|
239645
|
+
projectData,
|
|
239646
|
+
dirs,
|
|
239647
|
+
modelSettings,
|
|
239648
|
+
options.debug || false,
|
|
239649
|
+
reasoningConfig
|
|
239650
|
+
// Pass reasoning config for enhanced code generation
|
|
239651
|
+
);
|
|
239503
239652
|
const generationDuration = Date.now() - generationStart;
|
|
239504
239653
|
spinner.succeed("Project files generated");
|
|
239505
239654
|
const { displayGenerationComplete: displayGenerationComplete2 } = await Promise.resolve().then(() => (init_display_utils(), display_utils_exports));
|
|
@@ -239599,6 +239748,7 @@ async function pullProjectCommand(options) {
|
|
|
239599
239748
|
|
|
239600
239749
|
// src/commands/push.ts
|
|
239601
239750
|
init_esm_shims();
|
|
239751
|
+
init_env2();
|
|
239602
239752
|
import { existsSync as existsSync11 } from "fs";
|
|
239603
239753
|
import { join as join12, resolve as resolve5 } from "path";
|
|
239604
239754
|
import chalk10 from "chalk";
|