@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.mjs CHANGED
@@ -1166,6 +1166,68 @@ const AgentMessageSummarySchema = z.object({
1166
1166
  updatedAt: z.number()
1167
1167
  });
1168
1168
 
1169
+ const CODEX_APP_SERVER_BACKEND = "codex-app-server";
1170
+ const CODEX_MCP_LEGACY_BACKEND = "codex-mcp-legacy";
1171
+ const CodexBackendModeSchema = z.enum([
1172
+ "auto",
1173
+ CODEX_APP_SERVER_BACKEND,
1174
+ CODEX_MCP_LEGACY_BACKEND
1175
+ ]);
1176
+ const CodexRequestedBackendSchema = CodexBackendModeSchema;
1177
+ const CodexResolvedBackendSchema = z.enum([
1178
+ CODEX_APP_SERVER_BACKEND,
1179
+ CODEX_MCP_LEGACY_BACKEND
1180
+ ]);
1181
+ const CodexConfigModeSchema = z.enum([
1182
+ "inherit",
1183
+ "managed-profile",
1184
+ "managed-overrides"
1185
+ ]);
1186
+ const CODEX_REQUESTED_BACKEND_ALIASES = {
1187
+ auto: ["", "auto"],
1188
+ [CODEX_APP_SERVER_BACKEND]: ["app-server", "appserver", CODEX_APP_SERVER_BACKEND],
1189
+ [CODEX_MCP_LEGACY_BACKEND]: [
1190
+ "legacy",
1191
+ "mcp",
1192
+ "mcp-legacy",
1193
+ CODEX_MCP_LEGACY_BACKEND
1194
+ ]
1195
+ };
1196
+ const CODEX_REQUESTED_BACKEND_ALIAS_TO_VALUE = new Map(
1197
+ Object.entries(CODEX_REQUESTED_BACKEND_ALIASES).flatMap(
1198
+ ([backend, aliases]) => aliases.map((alias) => [alias, backend])
1199
+ )
1200
+ );
1201
+ function resolveRequestedCodexBackend(rawValue) {
1202
+ const normalizedAlias = (rawValue || "").trim().toLowerCase();
1203
+ return CODEX_REQUESTED_BACKEND_ALIAS_TO_VALUE.get(normalizedAlias) ?? "auto";
1204
+ }
1205
+ function isCodexAppServerBackend(value) {
1206
+ return value === CODEX_APP_SERVER_BACKEND;
1207
+ }
1208
+ function isCodexLegacyBackend(value) {
1209
+ return value === CODEX_MCP_LEGACY_BACKEND;
1210
+ }
1211
+ function resolveCodexResolvedBackend(requestedBackend, appServerSupported) {
1212
+ if (isCodexLegacyBackend(requestedBackend)) {
1213
+ return CODEX_MCP_LEGACY_BACKEND;
1214
+ }
1215
+ if (isCodexAppServerBackend(requestedBackend)) {
1216
+ return CODEX_APP_SERVER_BACKEND;
1217
+ }
1218
+ return appServerSupported ? CODEX_APP_SERVER_BACKEND : CODEX_MCP_LEGACY_BACKEND;
1219
+ }
1220
+ function resolveCodexResumableThreadId(value) {
1221
+ const threadId = value?.threadId;
1222
+ if (!threadId) {
1223
+ return null;
1224
+ }
1225
+ if (isCodexLegacyBackend(value?.resolvedBackend)) {
1226
+ return null;
1227
+ }
1228
+ return threadId;
1229
+ }
1230
+
1169
1231
  function isTemplateAwareUrl(value) {
1170
1232
  if (!value) return true;
1171
1233
  if (/^\$\{[A-Z_][A-Z0-9_]*(:-[^}]*)?\}$/.test(value)) return true;
@@ -1224,8 +1286,8 @@ const TogetherAIConfigSchema = z$1.object({
1224
1286
  model: z$1.string().optional()
1225
1287
  });
1226
1288
  const CodexConfigSchema = z$1.object({
1227
- backendMode: z$1.enum(["auto", "codex-app-server", "codex-mcp-legacy"]).optional(),
1228
- configMode: z$1.enum(["inherit", "managed-profile", "managed-overrides"]).optional(),
1289
+ backendMode: CodexBackendModeSchema.optional(),
1290
+ configMode: CodexConfigModeSchema.optional(),
1229
1291
  codexProfileName: z$1.string().optional(),
1230
1292
  model: z$1.string().optional(),
1231
1293
  reasoningEffort: z$1.string().optional(),
@@ -1931,4 +1993,70 @@ function shouldAutoApproveHappyMcpReason(reason) {
1931
1993
  );
1932
1994
  }
1933
1995
 
1934
- export { AGENT_MSG_PRIORITIES, AGENT_MSG_STATUSES, AGENT_MSG_TYPES, AIBackendProfileSchema, AcceptBodySchema, AgentLoopSummarySchema, AgentMessageSchema, AgentMessageSummarySchema, AgentMsgTypeSchema, AnthropicConfigSchema, ApiMessageSchema, ApiUpdateMachineStateSchema, ApiUpdateNewMessageSchema, ApiUpdateSessionStateSchema, AutoDreamProfileSummarySchema, AutomationAuditEventSummarySchema, AutomationAuditStatsSchema, AutomationCountsSchema, AutomationGuardianSummarySchema, AutomationGuardianUsageSummarySchema, AutomationJobKindSchema, AutomationJobStatusSchema, AutomationJobSummarySchema, AutomationPrioritySchema, AutomationStateSchema, AutonomyStatsRecentActionSchema, AutonomyStatsSchema, AzureOpenAIConfigSchema, BUILT_IN_AI_BACKEND_PROFILE_IDS, BootstrapProfileSummarySchema, BriefMessageSchema, BuiltInAIBackendProfileIdSchema, CliInstallInfoSchema, CliInstallSourceSchema, CodexConfigSchema, CoreUpdateBodySchema, CoreUpdateContainerSchema, CreateKnowledgeEntryBodySchema, CreateSkillBodySchema, CreateTaskBodySchema, CrossProjectSearchResponseSchema, CrossProjectSearchResultSchema, CustomModelSchema, DaemonStateSchema, DefaultPermissionModeSchema, EVIDENCE_KINDS, EnvironmentVariableSchema, HAPPY_MCP_AUTO_APPROVE_TOOL_NAMES, HAPPY_MCP_SILENT_SUCCESS_TOOL_NAMES, HAPPY_MCP_TOOL_NAMES, HAPPY_MCP_TOOL_SPECS, InboxCategorySchema, InboxItemSummarySchema, InboxNewItemSchema, InboxSeveritySchema, InboxUnreadCountSchema, KnowledgeActionSchema, KnowledgeChainEntrySchema, KnowledgeChainRelationSchema, KnowledgeChainResponseSchema, KnowledgeConfidenceSchema, KnowledgeContributorTypeSchema, KnowledgeEntryTypeSchema, KnowledgeInjectionModeSchema, KnowledgeInjectionRequestSchema, KnowledgeInjectionResponseSchema, KnowledgeStatusSchema, LegacyMessageContentSchema, MachineMetadataSchema, MessageContentSchema, MessageMetaSchema, OpenAIConfigSchema, ProfileCompatibilitySchema, ProjectProfileSchema, QueryKnowledgeParamsSchema, RESOLVED_RUNTIME_PROFILE_SCHEMA_VERSION, ResolvedRuntimeProfileSchema, RuntimeProfileSourceSchema, RuntimeProfileTrustSchema, SUGGESTION_ACCEPT_AUDIT_RULES, SUGGESTION_ACCEPT_SOURCES, SUGGESTION_AUTO_ACCEPT_FAILURE_DETAILS, SUGGESTION_AUTO_ACCEPT_REASON_CODES, SUGGESTION_AUTO_ACCEPT_STATUSES, SUGGESTION_BUCKETS, SUGGESTION_STATUSES, SUGGESTION_TYPES, SUPERVISOR_MODES, SessionEventCreatedSchema, SessionEventReportSchema, SessionEventSummarySchema, SessionEventTypeSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, SkillContentSchema, SkillSummarySchema, SuggestionAcceptAuditSchema, SuggestionDecisionPayloadSchema, SuggestionEvidenceSchema, SuggestionGoalPayloadSchema, SuggestionPayloadSchema, SuggestionSkillPayloadSchema, SuggestionTaskPayloadSchema, TailscaleInfoSchema, TailscaleServeEntrySchema, TaskOutcomeSchema, TaskPrioritySchema, TaskStatusChangedSchema, TaskStatusReportSchema, TaskStatusSchema, TaskSummarySchema, TaskTriggerDataSchema, TaskTriggerTypeSchema, TmuxConfigSchema, TogetherAIConfigSchema, TunnelEntrySchema, TunnelProviderInfoSchema, TunnelStateSchema, TurnKnowledgeExtractionSchema, UpdateBodySchema, UpdateKnowledgeEntryBodySchema, UpdateMachineBodySchema, UpdateNewMessageBodySchema, UpdateSchema, UpdateSessionBodySchema, UpdateSkillBodySchema, UserMessageSchema, VersionedEncryptedValueSchema, VersionedMachineEncryptedValueSchema, VersionedNullableEncryptedValueSchema, VoiceTokenAllowedSchema, VoiceTokenDeniedSchema, VoiceTokenResponseSchema, WorldAutonomyPolicySchema, WorldSuggestionUpdatedSchema, createEnvelope, createResolvedRuntimeProfile, getBuiltInAIBackendProfile, getHappyMcpToolAction, getHappyMcpToolAliases, getHappyMcpToolTitle, getProfileEnvironmentVariables, getSuggestionPayloadSchema, isHappyMcpToolAlias, isHappyMcpToolName, isTrustedRuntimeProfile, normalizeHappyMcpToolName, normalizeResolvedRuntimeProfile, sessionContextUsageCategorySchema, sessionContextUsageEventSchema, sessionEnvelopeSchema, sessionEventSchema, sessionFileEventSchema, sessionModelUsageSchema, sessionNeedsContinueEventSchema, sessionProgressListSchema, sessionProgressStateSchema, sessionProgressTodoSchema, sessionProgressTodoStatusSchema, sessionPromptSuggestionEventSchema, sessionRoleSchema, sessionServiceMessageEventSchema, sessionStartEventSchema, sessionStateChangedEventSchema, sessionStopEventSchema, sessionSummaryStateSchema, sessionTaskEndEventSchema, sessionTaskLogEventSchema, sessionTaskProgressEventSchema, sessionTaskStartEventSchema, sessionTextDeltaEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionToolProgressEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, sessionUsageUpdateEventSchema, shouldAutoApproveHappyMcpReason, shouldAutoApproveHappyMcpToolName, shouldHideSuccessfulHappyMcpTool, terminalCloseRequestSchema, terminalExitPayloadSchema, terminalInputPayloadSchema, terminalOutputPayloadSchema, terminalResizeRequestSchema, terminalSpawnRequestSchema, terminalSpawnResponseSchema, validateProfileForAgent };
1996
+ const CodexRuntimeConfigSchema = z.object({
1997
+ model: z.string().nullish(),
1998
+ profile: z.string().nullish(),
1999
+ approvalPolicy: z.string().nullish(),
2000
+ sandboxMode: z.string().nullish(),
2001
+ serviceTier: z.string().nullish(),
2002
+ reasoningEffort: z.string().nullish(),
2003
+ reasoningSummary: z.string().nullish(),
2004
+ verbosity: z.string().nullish(),
2005
+ webSearch: z.string().nullish()
2006
+ });
2007
+ const CodexAccountSchema = z.object({
2008
+ type: z.enum(["apiKey", "chatgpt"]).nullable().optional(),
2009
+ email: z.string().nullish(),
2010
+ planType: z.string().nullish(),
2011
+ requiresOpenaiAuth: z.boolean().optional()
2012
+ });
2013
+ const CodexRateLimitsSchema = z.object({
2014
+ limitId: z.string().nullish(),
2015
+ limitName: z.string().nullish(),
2016
+ planType: z.string().nullish(),
2017
+ hasCredits: z.boolean().optional()
2018
+ });
2019
+ const CodexExperimentalFeatureSchema = z.object({
2020
+ name: z.string(),
2021
+ stage: z.string(),
2022
+ enabled: z.boolean(),
2023
+ defaultEnabled: z.boolean()
2024
+ });
2025
+ const CodexSkillSummarySchema = z.object({
2026
+ name: z.string(),
2027
+ description: z.string(),
2028
+ path: z.string(),
2029
+ enabled: z.boolean()
2030
+ });
2031
+ const CodexPromptSummarySchema = z.object({
2032
+ name: z.string(),
2033
+ path: z.string(),
2034
+ description: z.string().nullish()
2035
+ });
2036
+ const CodexAgentSummarySchema = z.object({
2037
+ name: z.string(),
2038
+ path: z.string()
2039
+ });
2040
+ const CodexMcpServerSummarySchema = z.object({
2041
+ name: z.string(),
2042
+ authStatus: z.string(),
2043
+ toolCount: z.number()
2044
+ });
2045
+ const CodexMetadataSchema = z.object({
2046
+ requestedBackend: CodexRequestedBackendSchema.optional(),
2047
+ resolvedBackend: CodexResolvedBackendSchema.optional(),
2048
+ configMode: CodexConfigModeSchema.optional(),
2049
+ fallbackReason: z.string().optional(),
2050
+ backendVersion: z.string().optional(),
2051
+ threadId: z.string().optional(),
2052
+ config: CodexRuntimeConfigSchema.optional(),
2053
+ account: CodexAccountSchema.optional(),
2054
+ rateLimits: CodexRateLimitsSchema.optional(),
2055
+ experimentalFeatures: z.array(CodexExperimentalFeatureSchema).optional(),
2056
+ skills: z.array(CodexSkillSummarySchema).optional(),
2057
+ prompts: z.array(CodexPromptSummarySchema).optional(),
2058
+ agents: z.array(CodexAgentSummarySchema).optional(),
2059
+ mcpServers: z.array(CodexMcpServerSummarySchema).optional()
2060
+ });
2061
+
2062
+ export { AGENT_MSG_PRIORITIES, AGENT_MSG_STATUSES, AGENT_MSG_TYPES, AIBackendProfileSchema, AcceptBodySchema, AgentLoopSummarySchema, AgentMessageSchema, AgentMessageSummarySchema, AgentMsgTypeSchema, AnthropicConfigSchema, ApiMessageSchema, ApiUpdateMachineStateSchema, ApiUpdateNewMessageSchema, ApiUpdateSessionStateSchema, AutoDreamProfileSummarySchema, AutomationAuditEventSummarySchema, AutomationAuditStatsSchema, AutomationCountsSchema, AutomationGuardianSummarySchema, AutomationGuardianUsageSummarySchema, AutomationJobKindSchema, AutomationJobStatusSchema, AutomationJobSummarySchema, AutomationPrioritySchema, AutomationStateSchema, AutonomyStatsRecentActionSchema, AutonomyStatsSchema, AzureOpenAIConfigSchema, BUILT_IN_AI_BACKEND_PROFILE_IDS, BootstrapProfileSummarySchema, BriefMessageSchema, BuiltInAIBackendProfileIdSchema, CODEX_APP_SERVER_BACKEND, CODEX_MCP_LEGACY_BACKEND, CODEX_REQUESTED_BACKEND_ALIASES, CliInstallInfoSchema, CliInstallSourceSchema, CodexAccountSchema, CodexAgentSummarySchema, CodexBackendModeSchema, CodexConfigModeSchema, CodexConfigSchema, CodexExperimentalFeatureSchema, CodexMcpServerSummarySchema, CodexMetadataSchema, CodexPromptSummarySchema, CodexRateLimitsSchema, CodexRequestedBackendSchema, CodexResolvedBackendSchema, CodexRuntimeConfigSchema, CodexSkillSummarySchema, CoreUpdateBodySchema, CoreUpdateContainerSchema, CreateKnowledgeEntryBodySchema, CreateSkillBodySchema, CreateTaskBodySchema, CrossProjectSearchResponseSchema, CrossProjectSearchResultSchema, CustomModelSchema, DaemonStateSchema, DefaultPermissionModeSchema, EVIDENCE_KINDS, EnvironmentVariableSchema, HAPPY_MCP_AUTO_APPROVE_TOOL_NAMES, HAPPY_MCP_SILENT_SUCCESS_TOOL_NAMES, HAPPY_MCP_TOOL_NAMES, HAPPY_MCP_TOOL_SPECS, InboxCategorySchema, InboxItemSummarySchema, InboxNewItemSchema, InboxSeveritySchema, InboxUnreadCountSchema, KnowledgeActionSchema, KnowledgeChainEntrySchema, KnowledgeChainRelationSchema, KnowledgeChainResponseSchema, KnowledgeConfidenceSchema, KnowledgeContributorTypeSchema, KnowledgeEntryTypeSchema, KnowledgeInjectionModeSchema, KnowledgeInjectionRequestSchema, KnowledgeInjectionResponseSchema, KnowledgeStatusSchema, LegacyMessageContentSchema, MachineMetadataSchema, MessageContentSchema, MessageMetaSchema, OpenAIConfigSchema, ProfileCompatibilitySchema, ProjectProfileSchema, QueryKnowledgeParamsSchema, RESOLVED_RUNTIME_PROFILE_SCHEMA_VERSION, ResolvedRuntimeProfileSchema, RuntimeProfileSourceSchema, RuntimeProfileTrustSchema, SUGGESTION_ACCEPT_AUDIT_RULES, SUGGESTION_ACCEPT_SOURCES, SUGGESTION_AUTO_ACCEPT_FAILURE_DETAILS, SUGGESTION_AUTO_ACCEPT_REASON_CODES, SUGGESTION_AUTO_ACCEPT_STATUSES, SUGGESTION_BUCKETS, SUGGESTION_STATUSES, SUGGESTION_TYPES, SUPERVISOR_MODES, SessionEventCreatedSchema, SessionEventReportSchema, SessionEventSummarySchema, SessionEventTypeSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, SkillContentSchema, SkillSummarySchema, SuggestionAcceptAuditSchema, SuggestionDecisionPayloadSchema, SuggestionEvidenceSchema, SuggestionGoalPayloadSchema, SuggestionPayloadSchema, SuggestionSkillPayloadSchema, SuggestionTaskPayloadSchema, TailscaleInfoSchema, TailscaleServeEntrySchema, TaskOutcomeSchema, TaskPrioritySchema, TaskStatusChangedSchema, TaskStatusReportSchema, TaskStatusSchema, TaskSummarySchema, TaskTriggerDataSchema, TaskTriggerTypeSchema, TmuxConfigSchema, TogetherAIConfigSchema, TunnelEntrySchema, TunnelProviderInfoSchema, TunnelStateSchema, TurnKnowledgeExtractionSchema, UpdateBodySchema, UpdateKnowledgeEntryBodySchema, UpdateMachineBodySchema, UpdateNewMessageBodySchema, UpdateSchema, UpdateSessionBodySchema, UpdateSkillBodySchema, UserMessageSchema, VersionedEncryptedValueSchema, VersionedMachineEncryptedValueSchema, VersionedNullableEncryptedValueSchema, VoiceTokenAllowedSchema, VoiceTokenDeniedSchema, VoiceTokenResponseSchema, WorldAutonomyPolicySchema, WorldSuggestionUpdatedSchema, createEnvelope, createResolvedRuntimeProfile, getBuiltInAIBackendProfile, getHappyMcpToolAction, getHappyMcpToolAliases, getHappyMcpToolTitle, getProfileEnvironmentVariables, getSuggestionPayloadSchema, isCodexAppServerBackend, isCodexLegacyBackend, isHappyMcpToolAlias, isHappyMcpToolName, isTrustedRuntimeProfile, normalizeHappyMcpToolName, normalizeResolvedRuntimeProfile, resolveCodexResolvedBackend, resolveCodexResumableThreadId, resolveRequestedCodexBackend, sessionContextUsageCategorySchema, sessionContextUsageEventSchema, sessionEnvelopeSchema, sessionEventSchema, sessionFileEventSchema, sessionModelUsageSchema, sessionNeedsContinueEventSchema, sessionProgressListSchema, sessionProgressStateSchema, sessionProgressTodoSchema, sessionProgressTodoStatusSchema, sessionPromptSuggestionEventSchema, sessionRoleSchema, sessionServiceMessageEventSchema, sessionStartEventSchema, sessionStateChangedEventSchema, sessionStopEventSchema, sessionSummaryStateSchema, sessionTaskEndEventSchema, sessionTaskLogEventSchema, sessionTaskProgressEventSchema, sessionTaskStartEventSchema, sessionTextDeltaEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionToolProgressEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, sessionUsageUpdateEventSchema, shouldAutoApproveHappyMcpReason, shouldAutoApproveHappyMcpToolName, shouldHideSuccessfulHappyMcpTool, terminalCloseRequestSchema, terminalExitPayloadSchema, terminalInputPayloadSchema, terminalOutputPayloadSchema, terminalResizeRequestSchema, terminalSpawnRequestSchema, terminalSpawnResponseSchema, validateProfileForAgent };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmmao/happy-wire",
3
- "version": "0.11.13",
3
+ "version": "0.12.0",
4
4
  "description": "Shared message wire types and Zod schemas for Happy clients and services",
5
5
  "author": "kmmao",
6
6
  "license": "MIT",