@kmmao/happy-wire 0.11.13 → 0.13.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 +146 -171
- package/dist/index.d.cts +174 -380
- package/dist/index.d.mts +174 -380
- package/dist/index.mjs +126 -144
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1020,151 +1020,67 @@ const terminalExitPayloadSchema = z.object({
|
|
|
1020
1020
|
exitCode: z.number()
|
|
1021
1021
|
});
|
|
1022
1022
|
|
|
1023
|
-
const
|
|
1024
|
-
const
|
|
1025
|
-
const
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
"
|
|
1037
|
-
"
|
|
1038
|
-
"
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
]
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
"
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
prompt: z$1.string(),
|
|
1072
|
-
roleType: z$1.string().optional(),
|
|
1073
|
-
goalId: z$1.string().optional(),
|
|
1074
|
-
priority: z$1.string().optional()
|
|
1075
|
-
});
|
|
1076
|
-
const SuggestionSkillPayloadSchema = z$1.object({
|
|
1077
|
-
title: z$1.string(),
|
|
1078
|
-
content: z$1.string(),
|
|
1079
|
-
sourceTaskId: z$1.string().optional()
|
|
1080
|
-
});
|
|
1081
|
-
const SuggestionDecisionPayloadSchema = z$1.object({
|
|
1082
|
-
question: z$1.string(),
|
|
1083
|
-
context: z$1.string().optional(),
|
|
1084
|
-
goalId: z$1.string().optional(),
|
|
1085
|
-
existingDecisionId: z$1.string().optional(),
|
|
1086
|
-
options: z$1.array(z$1.object({
|
|
1087
|
-
id: z$1.string(),
|
|
1088
|
-
description: z$1.string(),
|
|
1089
|
-
pros: z$1.string().optional(),
|
|
1090
|
-
cons: z$1.string().optional()
|
|
1091
|
-
})).min(2).max(10),
|
|
1092
|
-
precedentKey: z$1.string().optional()
|
|
1093
|
-
});
|
|
1094
|
-
function getSuggestionPayloadSchema(type) {
|
|
1095
|
-
if (type === "suggested_goal") {
|
|
1096
|
-
return z$1.object({ goal: SuggestionGoalPayloadSchema });
|
|
1023
|
+
const CODEX_APP_SERVER_BACKEND = "codex-app-server";
|
|
1024
|
+
const CODEX_MCP_LEGACY_BACKEND = "codex-mcp-legacy";
|
|
1025
|
+
const CodexBackendModeSchema = z.enum([
|
|
1026
|
+
"auto",
|
|
1027
|
+
CODEX_APP_SERVER_BACKEND,
|
|
1028
|
+
CODEX_MCP_LEGACY_BACKEND
|
|
1029
|
+
]);
|
|
1030
|
+
const CodexRequestedBackendSchema = CodexBackendModeSchema;
|
|
1031
|
+
const CodexResolvedBackendSchema = z.enum([
|
|
1032
|
+
CODEX_APP_SERVER_BACKEND,
|
|
1033
|
+
CODEX_MCP_LEGACY_BACKEND
|
|
1034
|
+
]);
|
|
1035
|
+
const CodexConfigModeSchema = z.enum([
|
|
1036
|
+
"inherit",
|
|
1037
|
+
"managed-profile",
|
|
1038
|
+
"managed-overrides"
|
|
1039
|
+
]);
|
|
1040
|
+
const CODEX_REQUESTED_BACKEND_ALIASES = {
|
|
1041
|
+
auto: ["", "auto"],
|
|
1042
|
+
[CODEX_APP_SERVER_BACKEND]: ["app-server", "appserver", CODEX_APP_SERVER_BACKEND],
|
|
1043
|
+
[CODEX_MCP_LEGACY_BACKEND]: [
|
|
1044
|
+
"legacy",
|
|
1045
|
+
"mcp",
|
|
1046
|
+
"mcp-legacy",
|
|
1047
|
+
CODEX_MCP_LEGACY_BACKEND
|
|
1048
|
+
]
|
|
1049
|
+
};
|
|
1050
|
+
const CODEX_REQUESTED_BACKEND_ALIAS_TO_VALUE = new Map(
|
|
1051
|
+
Object.entries(CODEX_REQUESTED_BACKEND_ALIASES).flatMap(
|
|
1052
|
+
([backend, aliases]) => aliases.map((alias) => [alias, backend])
|
|
1053
|
+
)
|
|
1054
|
+
);
|
|
1055
|
+
function resolveRequestedCodexBackend(rawValue) {
|
|
1056
|
+
const normalizedAlias = (rawValue || "").trim().toLowerCase();
|
|
1057
|
+
return CODEX_REQUESTED_BACKEND_ALIAS_TO_VALUE.get(normalizedAlias) ?? "auto";
|
|
1058
|
+
}
|
|
1059
|
+
function isCodexAppServerBackend(value) {
|
|
1060
|
+
return value === CODEX_APP_SERVER_BACKEND;
|
|
1061
|
+
}
|
|
1062
|
+
function isCodexLegacyBackend(value) {
|
|
1063
|
+
return value === CODEX_MCP_LEGACY_BACKEND;
|
|
1064
|
+
}
|
|
1065
|
+
function resolveCodexResolvedBackend(requestedBackend, appServerSupported) {
|
|
1066
|
+
if (isCodexLegacyBackend(requestedBackend)) {
|
|
1067
|
+
return CODEX_MCP_LEGACY_BACKEND;
|
|
1068
|
+
}
|
|
1069
|
+
if (isCodexAppServerBackend(requestedBackend)) {
|
|
1070
|
+
return CODEX_APP_SERVER_BACKEND;
|
|
1097
1071
|
}
|
|
1098
|
-
|
|
1099
|
-
|
|
1072
|
+
return appServerSupported ? CODEX_APP_SERVER_BACKEND : CODEX_MCP_LEGACY_BACKEND;
|
|
1073
|
+
}
|
|
1074
|
+
function resolveCodexResumableThreadId(value) {
|
|
1075
|
+
const threadId = value?.threadId;
|
|
1076
|
+
if (!threadId) {
|
|
1077
|
+
return null;
|
|
1100
1078
|
}
|
|
1101
|
-
if (
|
|
1102
|
-
return
|
|
1079
|
+
if (isCodexLegacyBackend(value?.resolvedBackend)) {
|
|
1080
|
+
return null;
|
|
1103
1081
|
}
|
|
1104
|
-
return
|
|
1082
|
+
return threadId;
|
|
1105
1083
|
}
|
|
1106
|
-
const SuggestionPayloadSchema = z$1.union([
|
|
1107
|
-
z$1.object({ goal: SuggestionGoalPayloadSchema }),
|
|
1108
|
-
z$1.object({ task: SuggestionTaskPayloadSchema }),
|
|
1109
|
-
z$1.object({ skill: SuggestionSkillPayloadSchema }),
|
|
1110
|
-
z$1.object({ decision: SuggestionDecisionPayloadSchema })
|
|
1111
|
-
]);
|
|
1112
|
-
const AcceptBodySchema = z$1.object({
|
|
1113
|
-
machineId: z$1.string().optional(),
|
|
1114
|
-
priorityOverride: z$1.string().optional(),
|
|
1115
|
-
roleOverride: z$1.string().optional()
|
|
1116
|
-
});
|
|
1117
|
-
const WorldSuggestionUpdatedSchema = z$1.object({
|
|
1118
|
-
type: z$1.literal("world-suggestion-updated"),
|
|
1119
|
-
projectId: z$1.string(),
|
|
1120
|
-
suggestionId: z$1.string(),
|
|
1121
|
-
status: z$1.enum(SUGGESTION_STATUSES)
|
|
1122
|
-
});
|
|
1123
|
-
const AutonomyStatsRecentActionSchema = z$1.object({
|
|
1124
|
-
suggestionId: z$1.string(),
|
|
1125
|
-
title: z$1.string(),
|
|
1126
|
-
type: z$1.enum(SUGGESTION_TYPES),
|
|
1127
|
-
acceptedAt: z$1.number(),
|
|
1128
|
-
rule: z$1.string()
|
|
1129
|
-
});
|
|
1130
|
-
const AutonomyStatsSchema = z$1.object({
|
|
1131
|
-
mode: z$1.enum(SUPERVISOR_MODES),
|
|
1132
|
-
todayAutoAccepted: z$1.number().int(),
|
|
1133
|
-
todayQuota: z$1.number().int().nullable(),
|
|
1134
|
-
concurrentAutoTasks: z$1.number().int(),
|
|
1135
|
-
maxConcurrent: z$1.number().int().nullable(),
|
|
1136
|
-
recentAutoActions: z$1.array(AutonomyStatsRecentActionSchema)
|
|
1137
|
-
});
|
|
1138
|
-
|
|
1139
|
-
const AGENT_MSG_TYPES = [
|
|
1140
|
-
"request",
|
|
1141
|
-
"report",
|
|
1142
|
-
"conflict",
|
|
1143
|
-
"law_suggestion",
|
|
1144
|
-
"dependency_blocked",
|
|
1145
|
-
"handoff",
|
|
1146
|
-
"review_request",
|
|
1147
|
-
"decision_request"
|
|
1148
|
-
];
|
|
1149
|
-
const AgentMsgTypeSchema = z.enum(AGENT_MSG_TYPES);
|
|
1150
|
-
const AGENT_MSG_STATUSES = ["unread", "read", "resolved"];
|
|
1151
|
-
const AGENT_MSG_PRIORITIES = ["urgent", "normal", "low"];
|
|
1152
|
-
const AgentMessageSummarySchema = z.object({
|
|
1153
|
-
id: z.string(),
|
|
1154
|
-
projectId: z.string(),
|
|
1155
|
-
fromRole: z.string(),
|
|
1156
|
-
toRole: z.string().nullable(),
|
|
1157
|
-
msgType: AgentMsgTypeSchema,
|
|
1158
|
-
content: z.string(),
|
|
1159
|
-
status: z.enum(AGENT_MSG_STATUSES),
|
|
1160
|
-
sessionId: z.string().nullable(),
|
|
1161
|
-
decisionId: z.string().nullable(),
|
|
1162
|
-
relatedGoalId: z.string().nullable(),
|
|
1163
|
-
relatedTaskId: z.string().nullable(),
|
|
1164
|
-
priority: z.enum(AGENT_MSG_PRIORITIES),
|
|
1165
|
-
createdAt: z.number(),
|
|
1166
|
-
updatedAt: z.number()
|
|
1167
|
-
});
|
|
1168
1084
|
|
|
1169
1085
|
function isTemplateAwareUrl(value) {
|
|
1170
1086
|
if (!value) return true;
|
|
@@ -1224,8 +1140,8 @@ const TogetherAIConfigSchema = z$1.object({
|
|
|
1224
1140
|
model: z$1.string().optional()
|
|
1225
1141
|
});
|
|
1226
1142
|
const CodexConfigSchema = z$1.object({
|
|
1227
|
-
backendMode:
|
|
1228
|
-
configMode:
|
|
1143
|
+
backendMode: CodexBackendModeSchema.optional(),
|
|
1144
|
+
configMode: CodexConfigModeSchema.optional(),
|
|
1229
1145
|
codexProfileName: z$1.string().optional(),
|
|
1230
1146
|
model: z$1.string().optional(),
|
|
1231
1147
|
reasoningEffort: z$1.string().optional(),
|
|
@@ -1931,4 +1847,70 @@ function shouldAutoApproveHappyMcpReason(reason) {
|
|
|
1931
1847
|
);
|
|
1932
1848
|
}
|
|
1933
1849
|
|
|
1934
|
-
|
|
1850
|
+
const CodexRuntimeConfigSchema = z.object({
|
|
1851
|
+
model: z.string().nullish(),
|
|
1852
|
+
profile: z.string().nullish(),
|
|
1853
|
+
approvalPolicy: z.string().nullish(),
|
|
1854
|
+
sandboxMode: z.string().nullish(),
|
|
1855
|
+
serviceTier: z.string().nullish(),
|
|
1856
|
+
reasoningEffort: z.string().nullish(),
|
|
1857
|
+
reasoningSummary: z.string().nullish(),
|
|
1858
|
+
verbosity: z.string().nullish(),
|
|
1859
|
+
webSearch: z.string().nullish()
|
|
1860
|
+
});
|
|
1861
|
+
const CodexAccountSchema = z.object({
|
|
1862
|
+
type: z.enum(["apiKey", "chatgpt"]).nullable().optional(),
|
|
1863
|
+
email: z.string().nullish(),
|
|
1864
|
+
planType: z.string().nullish(),
|
|
1865
|
+
requiresOpenaiAuth: z.boolean().optional()
|
|
1866
|
+
});
|
|
1867
|
+
const CodexRateLimitsSchema = z.object({
|
|
1868
|
+
limitId: z.string().nullish(),
|
|
1869
|
+
limitName: z.string().nullish(),
|
|
1870
|
+
planType: z.string().nullish(),
|
|
1871
|
+
hasCredits: z.boolean().optional()
|
|
1872
|
+
});
|
|
1873
|
+
const CodexExperimentalFeatureSchema = z.object({
|
|
1874
|
+
name: z.string(),
|
|
1875
|
+
stage: z.string(),
|
|
1876
|
+
enabled: z.boolean(),
|
|
1877
|
+
defaultEnabled: z.boolean()
|
|
1878
|
+
});
|
|
1879
|
+
const CodexSkillSummarySchema = z.object({
|
|
1880
|
+
name: z.string(),
|
|
1881
|
+
description: z.string(),
|
|
1882
|
+
path: z.string(),
|
|
1883
|
+
enabled: z.boolean()
|
|
1884
|
+
});
|
|
1885
|
+
const CodexPromptSummarySchema = z.object({
|
|
1886
|
+
name: z.string(),
|
|
1887
|
+
path: z.string(),
|
|
1888
|
+
description: z.string().nullish()
|
|
1889
|
+
});
|
|
1890
|
+
const CodexAgentSummarySchema = z.object({
|
|
1891
|
+
name: z.string(),
|
|
1892
|
+
path: z.string()
|
|
1893
|
+
});
|
|
1894
|
+
const CodexMcpServerSummarySchema = z.object({
|
|
1895
|
+
name: z.string(),
|
|
1896
|
+
authStatus: z.string(),
|
|
1897
|
+
toolCount: z.number()
|
|
1898
|
+
});
|
|
1899
|
+
const CodexMetadataSchema = z.object({
|
|
1900
|
+
requestedBackend: CodexRequestedBackendSchema.optional(),
|
|
1901
|
+
resolvedBackend: CodexResolvedBackendSchema.optional(),
|
|
1902
|
+
configMode: CodexConfigModeSchema.optional(),
|
|
1903
|
+
fallbackReason: z.string().optional(),
|
|
1904
|
+
backendVersion: z.string().optional(),
|
|
1905
|
+
threadId: z.string().optional(),
|
|
1906
|
+
config: CodexRuntimeConfigSchema.optional(),
|
|
1907
|
+
account: CodexAccountSchema.optional(),
|
|
1908
|
+
rateLimits: CodexRateLimitsSchema.optional(),
|
|
1909
|
+
experimentalFeatures: z.array(CodexExperimentalFeatureSchema).optional(),
|
|
1910
|
+
skills: z.array(CodexSkillSummarySchema).optional(),
|
|
1911
|
+
prompts: z.array(CodexPromptSummarySchema).optional(),
|
|
1912
|
+
agents: z.array(CodexAgentSummarySchema).optional(),
|
|
1913
|
+
mcpServers: z.array(CodexMcpServerSummarySchema).optional()
|
|
1914
|
+
});
|
|
1915
|
+
|
|
1916
|
+
export { AIBackendProfileSchema, AgentLoopSummarySchema, AgentMessageSchema, AnthropicConfigSchema, ApiMessageSchema, ApiUpdateMachineStateSchema, ApiUpdateNewMessageSchema, ApiUpdateSessionStateSchema, AutoDreamProfileSummarySchema, AutomationAuditEventSummarySchema, AutomationAuditStatsSchema, AutomationCountsSchema, AutomationGuardianSummarySchema, AutomationGuardianUsageSummarySchema, AutomationJobKindSchema, AutomationJobStatusSchema, AutomationJobSummarySchema, AutomationPrioritySchema, AutomationStateSchema, 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, 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, SessionEventCreatedSchema, SessionEventReportSchema, SessionEventSummarySchema, SessionEventTypeSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, SkillContentSchema, SkillSummarySchema, 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, createEnvelope, createResolvedRuntimeProfile, getBuiltInAIBackendProfile, getHappyMcpToolAction, getHappyMcpToolAliases, getHappyMcpToolTitle, getProfileEnvironmentVariables, 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 };
|