@kmmao/happy-wire 0.11.13 → 0.12.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.cjs +151 -2
- package/dist/index.d.cts +217 -45
- package/dist/index.d.mts +217 -45
- package/dist/index.mjs +131 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1186,6 +1186,68 @@ const AgentMessageSummarySchema = z__namespace.object({
|
|
|
1186
1186
|
updatedAt: z__namespace.number()
|
|
1187
1187
|
});
|
|
1188
1188
|
|
|
1189
|
+
const CODEX_APP_SERVER_BACKEND = "codex-app-server";
|
|
1190
|
+
const CODEX_MCP_LEGACY_BACKEND = "codex-mcp-legacy";
|
|
1191
|
+
const CodexBackendModeSchema = z__namespace.enum([
|
|
1192
|
+
"auto",
|
|
1193
|
+
CODEX_APP_SERVER_BACKEND,
|
|
1194
|
+
CODEX_MCP_LEGACY_BACKEND
|
|
1195
|
+
]);
|
|
1196
|
+
const CodexRequestedBackendSchema = CodexBackendModeSchema;
|
|
1197
|
+
const CodexResolvedBackendSchema = z__namespace.enum([
|
|
1198
|
+
CODEX_APP_SERVER_BACKEND,
|
|
1199
|
+
CODEX_MCP_LEGACY_BACKEND
|
|
1200
|
+
]);
|
|
1201
|
+
const CodexConfigModeSchema = z__namespace.enum([
|
|
1202
|
+
"inherit",
|
|
1203
|
+
"managed-profile",
|
|
1204
|
+
"managed-overrides"
|
|
1205
|
+
]);
|
|
1206
|
+
const CODEX_REQUESTED_BACKEND_ALIASES = {
|
|
1207
|
+
auto: ["", "auto"],
|
|
1208
|
+
[CODEX_APP_SERVER_BACKEND]: ["app-server", "appserver", CODEX_APP_SERVER_BACKEND],
|
|
1209
|
+
[CODEX_MCP_LEGACY_BACKEND]: [
|
|
1210
|
+
"legacy",
|
|
1211
|
+
"mcp",
|
|
1212
|
+
"mcp-legacy",
|
|
1213
|
+
CODEX_MCP_LEGACY_BACKEND
|
|
1214
|
+
]
|
|
1215
|
+
};
|
|
1216
|
+
const CODEX_REQUESTED_BACKEND_ALIAS_TO_VALUE = new Map(
|
|
1217
|
+
Object.entries(CODEX_REQUESTED_BACKEND_ALIASES).flatMap(
|
|
1218
|
+
([backend, aliases]) => aliases.map((alias) => [alias, backend])
|
|
1219
|
+
)
|
|
1220
|
+
);
|
|
1221
|
+
function resolveRequestedCodexBackend(rawValue) {
|
|
1222
|
+
const normalizedAlias = (rawValue || "").trim().toLowerCase();
|
|
1223
|
+
return CODEX_REQUESTED_BACKEND_ALIAS_TO_VALUE.get(normalizedAlias) ?? "auto";
|
|
1224
|
+
}
|
|
1225
|
+
function isCodexAppServerBackend(value) {
|
|
1226
|
+
return value === CODEX_APP_SERVER_BACKEND;
|
|
1227
|
+
}
|
|
1228
|
+
function isCodexLegacyBackend(value) {
|
|
1229
|
+
return value === CODEX_MCP_LEGACY_BACKEND;
|
|
1230
|
+
}
|
|
1231
|
+
function resolveCodexResolvedBackend(requestedBackend, appServerSupported) {
|
|
1232
|
+
if (isCodexLegacyBackend(requestedBackend)) {
|
|
1233
|
+
return CODEX_MCP_LEGACY_BACKEND;
|
|
1234
|
+
}
|
|
1235
|
+
if (isCodexAppServerBackend(requestedBackend)) {
|
|
1236
|
+
return CODEX_APP_SERVER_BACKEND;
|
|
1237
|
+
}
|
|
1238
|
+
return appServerSupported ? CODEX_APP_SERVER_BACKEND : CODEX_MCP_LEGACY_BACKEND;
|
|
1239
|
+
}
|
|
1240
|
+
function resolveCodexResumableThreadId(value) {
|
|
1241
|
+
const threadId = value?.threadId;
|
|
1242
|
+
if (!threadId) {
|
|
1243
|
+
return null;
|
|
1244
|
+
}
|
|
1245
|
+
if (isCodexLegacyBackend(value?.resolvedBackend)) {
|
|
1246
|
+
return null;
|
|
1247
|
+
}
|
|
1248
|
+
return threadId;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1189
1251
|
function isTemplateAwareUrl(value) {
|
|
1190
1252
|
if (!value) return true;
|
|
1191
1253
|
if (/^\$\{[A-Z_][A-Z0-9_]*(:-[^}]*)?\}$/.test(value)) return true;
|
|
@@ -1244,8 +1306,8 @@ const TogetherAIConfigSchema = z.z.object({
|
|
|
1244
1306
|
model: z.z.string().optional()
|
|
1245
1307
|
});
|
|
1246
1308
|
const CodexConfigSchema = z.z.object({
|
|
1247
|
-
backendMode:
|
|
1248
|
-
configMode:
|
|
1309
|
+
backendMode: CodexBackendModeSchema.optional(),
|
|
1310
|
+
configMode: CodexConfigModeSchema.optional(),
|
|
1249
1311
|
codexProfileName: z.z.string().optional(),
|
|
1250
1312
|
model: z.z.string().optional(),
|
|
1251
1313
|
reasoningEffort: z.z.string().optional(),
|
|
@@ -1951,6 +2013,72 @@ function shouldAutoApproveHappyMcpReason(reason) {
|
|
|
1951
2013
|
);
|
|
1952
2014
|
}
|
|
1953
2015
|
|
|
2016
|
+
const CodexRuntimeConfigSchema = z__namespace.object({
|
|
2017
|
+
model: z__namespace.string().nullish(),
|
|
2018
|
+
profile: z__namespace.string().nullish(),
|
|
2019
|
+
approvalPolicy: z__namespace.string().nullish(),
|
|
2020
|
+
sandboxMode: z__namespace.string().nullish(),
|
|
2021
|
+
serviceTier: z__namespace.string().nullish(),
|
|
2022
|
+
reasoningEffort: z__namespace.string().nullish(),
|
|
2023
|
+
reasoningSummary: z__namespace.string().nullish(),
|
|
2024
|
+
verbosity: z__namespace.string().nullish(),
|
|
2025
|
+
webSearch: z__namespace.string().nullish()
|
|
2026
|
+
});
|
|
2027
|
+
const CodexAccountSchema = z__namespace.object({
|
|
2028
|
+
type: z__namespace.enum(["apiKey", "chatgpt"]).nullable().optional(),
|
|
2029
|
+
email: z__namespace.string().nullish(),
|
|
2030
|
+
planType: z__namespace.string().nullish(),
|
|
2031
|
+
requiresOpenaiAuth: z__namespace.boolean().optional()
|
|
2032
|
+
});
|
|
2033
|
+
const CodexRateLimitsSchema = z__namespace.object({
|
|
2034
|
+
limitId: z__namespace.string().nullish(),
|
|
2035
|
+
limitName: z__namespace.string().nullish(),
|
|
2036
|
+
planType: z__namespace.string().nullish(),
|
|
2037
|
+
hasCredits: z__namespace.boolean().optional()
|
|
2038
|
+
});
|
|
2039
|
+
const CodexExperimentalFeatureSchema = z__namespace.object({
|
|
2040
|
+
name: z__namespace.string(),
|
|
2041
|
+
stage: z__namespace.string(),
|
|
2042
|
+
enabled: z__namespace.boolean(),
|
|
2043
|
+
defaultEnabled: z__namespace.boolean()
|
|
2044
|
+
});
|
|
2045
|
+
const CodexSkillSummarySchema = z__namespace.object({
|
|
2046
|
+
name: z__namespace.string(),
|
|
2047
|
+
description: z__namespace.string(),
|
|
2048
|
+
path: z__namespace.string(),
|
|
2049
|
+
enabled: z__namespace.boolean()
|
|
2050
|
+
});
|
|
2051
|
+
const CodexPromptSummarySchema = z__namespace.object({
|
|
2052
|
+
name: z__namespace.string(),
|
|
2053
|
+
path: z__namespace.string(),
|
|
2054
|
+
description: z__namespace.string().nullish()
|
|
2055
|
+
});
|
|
2056
|
+
const CodexAgentSummarySchema = z__namespace.object({
|
|
2057
|
+
name: z__namespace.string(),
|
|
2058
|
+
path: z__namespace.string()
|
|
2059
|
+
});
|
|
2060
|
+
const CodexMcpServerSummarySchema = z__namespace.object({
|
|
2061
|
+
name: z__namespace.string(),
|
|
2062
|
+
authStatus: z__namespace.string(),
|
|
2063
|
+
toolCount: z__namespace.number()
|
|
2064
|
+
});
|
|
2065
|
+
const CodexMetadataSchema = z__namespace.object({
|
|
2066
|
+
requestedBackend: CodexRequestedBackendSchema.optional(),
|
|
2067
|
+
resolvedBackend: CodexResolvedBackendSchema.optional(),
|
|
2068
|
+
configMode: CodexConfigModeSchema.optional(),
|
|
2069
|
+
fallbackReason: z__namespace.string().optional(),
|
|
2070
|
+
backendVersion: z__namespace.string().optional(),
|
|
2071
|
+
threadId: z__namespace.string().optional(),
|
|
2072
|
+
config: CodexRuntimeConfigSchema.optional(),
|
|
2073
|
+
account: CodexAccountSchema.optional(),
|
|
2074
|
+
rateLimits: CodexRateLimitsSchema.optional(),
|
|
2075
|
+
experimentalFeatures: z__namespace.array(CodexExperimentalFeatureSchema).optional(),
|
|
2076
|
+
skills: z__namespace.array(CodexSkillSummarySchema).optional(),
|
|
2077
|
+
prompts: z__namespace.array(CodexPromptSummarySchema).optional(),
|
|
2078
|
+
agents: z__namespace.array(CodexAgentSummarySchema).optional(),
|
|
2079
|
+
mcpServers: z__namespace.array(CodexMcpServerSummarySchema).optional()
|
|
2080
|
+
});
|
|
2081
|
+
|
|
1954
2082
|
exports.AGENT_MSG_PRIORITIES = AGENT_MSG_PRIORITIES;
|
|
1955
2083
|
exports.AGENT_MSG_STATUSES = AGENT_MSG_STATUSES;
|
|
1956
2084
|
exports.AGENT_MSG_TYPES = AGENT_MSG_TYPES;
|
|
@@ -1983,9 +2111,25 @@ exports.BUILT_IN_AI_BACKEND_PROFILE_IDS = BUILT_IN_AI_BACKEND_PROFILE_IDS;
|
|
|
1983
2111
|
exports.BootstrapProfileSummarySchema = BootstrapProfileSummarySchema;
|
|
1984
2112
|
exports.BriefMessageSchema = BriefMessageSchema;
|
|
1985
2113
|
exports.BuiltInAIBackendProfileIdSchema = BuiltInAIBackendProfileIdSchema;
|
|
2114
|
+
exports.CODEX_APP_SERVER_BACKEND = CODEX_APP_SERVER_BACKEND;
|
|
2115
|
+
exports.CODEX_MCP_LEGACY_BACKEND = CODEX_MCP_LEGACY_BACKEND;
|
|
2116
|
+
exports.CODEX_REQUESTED_BACKEND_ALIASES = CODEX_REQUESTED_BACKEND_ALIASES;
|
|
1986
2117
|
exports.CliInstallInfoSchema = CliInstallInfoSchema;
|
|
1987
2118
|
exports.CliInstallSourceSchema = CliInstallSourceSchema;
|
|
2119
|
+
exports.CodexAccountSchema = CodexAccountSchema;
|
|
2120
|
+
exports.CodexAgentSummarySchema = CodexAgentSummarySchema;
|
|
2121
|
+
exports.CodexBackendModeSchema = CodexBackendModeSchema;
|
|
2122
|
+
exports.CodexConfigModeSchema = CodexConfigModeSchema;
|
|
1988
2123
|
exports.CodexConfigSchema = CodexConfigSchema;
|
|
2124
|
+
exports.CodexExperimentalFeatureSchema = CodexExperimentalFeatureSchema;
|
|
2125
|
+
exports.CodexMcpServerSummarySchema = CodexMcpServerSummarySchema;
|
|
2126
|
+
exports.CodexMetadataSchema = CodexMetadataSchema;
|
|
2127
|
+
exports.CodexPromptSummarySchema = CodexPromptSummarySchema;
|
|
2128
|
+
exports.CodexRateLimitsSchema = CodexRateLimitsSchema;
|
|
2129
|
+
exports.CodexRequestedBackendSchema = CodexRequestedBackendSchema;
|
|
2130
|
+
exports.CodexResolvedBackendSchema = CodexResolvedBackendSchema;
|
|
2131
|
+
exports.CodexRuntimeConfigSchema = CodexRuntimeConfigSchema;
|
|
2132
|
+
exports.CodexSkillSummarySchema = CodexSkillSummarySchema;
|
|
1989
2133
|
exports.CoreUpdateBodySchema = CoreUpdateBodySchema;
|
|
1990
2134
|
exports.CoreUpdateContainerSchema = CoreUpdateContainerSchema;
|
|
1991
2135
|
exports.CreateKnowledgeEntryBodySchema = CreateKnowledgeEntryBodySchema;
|
|
@@ -2095,11 +2239,16 @@ exports.getHappyMcpToolAliases = getHappyMcpToolAliases;
|
|
|
2095
2239
|
exports.getHappyMcpToolTitle = getHappyMcpToolTitle;
|
|
2096
2240
|
exports.getProfileEnvironmentVariables = getProfileEnvironmentVariables;
|
|
2097
2241
|
exports.getSuggestionPayloadSchema = getSuggestionPayloadSchema;
|
|
2242
|
+
exports.isCodexAppServerBackend = isCodexAppServerBackend;
|
|
2243
|
+
exports.isCodexLegacyBackend = isCodexLegacyBackend;
|
|
2098
2244
|
exports.isHappyMcpToolAlias = isHappyMcpToolAlias;
|
|
2099
2245
|
exports.isHappyMcpToolName = isHappyMcpToolName;
|
|
2100
2246
|
exports.isTrustedRuntimeProfile = isTrustedRuntimeProfile;
|
|
2101
2247
|
exports.normalizeHappyMcpToolName = normalizeHappyMcpToolName;
|
|
2102
2248
|
exports.normalizeResolvedRuntimeProfile = normalizeResolvedRuntimeProfile;
|
|
2249
|
+
exports.resolveCodexResolvedBackend = resolveCodexResolvedBackend;
|
|
2250
|
+
exports.resolveCodexResumableThreadId = resolveCodexResumableThreadId;
|
|
2251
|
+
exports.resolveRequestedCodexBackend = resolveRequestedCodexBackend;
|
|
2103
2252
|
exports.sessionContextUsageCategorySchema = sessionContextUsageCategorySchema;
|
|
2104
2253
|
exports.sessionContextUsageEventSchema = sessionContextUsageEventSchema;
|
|
2105
2254
|
exports.sessionEnvelopeSchema = sessionEnvelopeSchema;
|