@kmmao/happy-wire 0.21.0 → 0.22.1

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 CHANGED
@@ -633,6 +633,73 @@ const DaemonStateSchema = z__namespace.object({
633
633
  killed: z__namespace.boolean().optional()
634
634
  });
635
635
 
636
+ const DISCONNECTED = Object.freeze({ status: "disconnected" });
637
+ function parseTailscaleStatus(raw, log) {
638
+ let json;
639
+ try {
640
+ json = JSON.parse(raw);
641
+ } catch {
642
+ log?.("[TAILSCALE] failed to parse status JSON");
643
+ return DISCONNECTED;
644
+ }
645
+ const backendState = json.BackendState;
646
+ if (backendState && backendState !== "Running") {
647
+ log?.(`[TAILSCALE] backend state: ${backendState}`);
648
+ return DISCONNECTED;
649
+ }
650
+ const self = json.Self;
651
+ if (!self) {
652
+ log?.("[TAILSCALE] no Self node in status output");
653
+ return DISCONNECTED;
654
+ }
655
+ const ips = self.TailscaleIPs ?? [];
656
+ const ipv4 = ips.find((ip) => ip.includes("."));
657
+ const ipv6 = ips.find((ip) => ip.includes(":"));
658
+ const dnsName = self.DNSName;
659
+ const hostname = dnsName?.replace(/\.$/, "").split(".")[0];
660
+ const tailnetName = dnsName ? dnsName.replace(/\.$/, "").split(".").slice(1).join(".") : void 0;
661
+ const version = json.Version;
662
+ log?.(`[TAILSCALE] detected: ipv4=${ipv4 ?? "none"}, hostname=${hostname ?? "none"}`);
663
+ return {
664
+ status: "connected",
665
+ ipv4,
666
+ ipv6,
667
+ hostname,
668
+ tailnetName,
669
+ version
670
+ };
671
+ }
672
+ function parseTailscaleServeStatus(raw, log) {
673
+ let json;
674
+ try {
675
+ json = JSON.parse(raw);
676
+ } catch {
677
+ log?.("[TAILSCALE] failed to parse serve status JSON");
678
+ return [];
679
+ }
680
+ const web = json.Web ?? {};
681
+ const allowFunnel = json.AllowFunnel ?? {};
682
+ const entries = [];
683
+ for (const [hostPort, config] of Object.entries(web)) {
684
+ const colonIdx = hostPort.lastIndexOf(":");
685
+ if (colonIdx === -1) continue;
686
+ const hostname = hostPort.slice(0, colonIdx);
687
+ const port = parseInt(hostPort.slice(colonIdx + 1), 10);
688
+ if (!Number.isFinite(port)) continue;
689
+ const handlers = config.Handlers ?? {};
690
+ const funnel = allowFunnel[hostPort] === true;
691
+ for (const [path, handler] of Object.entries(handlers)) {
692
+ const target = handler?.Proxy ?? "unknown";
693
+ entries.push({ port, path, protocol: "HTTPS", target, funnel, hostname });
694
+ }
695
+ }
696
+ log?.(`[TAILSCALE] detected ${entries.length} serve entries`);
697
+ return entries;
698
+ }
699
+ function isTailscaleNotFound(err) {
700
+ return typeof err === "object" && err !== null && "code" in err && err.code === "ENOENT";
701
+ }
702
+
636
703
  const KnowledgeEntryTypeSchema = z__namespace.enum([
637
704
  "discovery",
638
705
  // New insight or finding
@@ -2106,11 +2173,13 @@ const McpCallResponseSchema = z.z.object({
2106
2173
  "invalid_arguments",
2107
2174
  "permission_denied",
2108
2175
  /**
2109
- * SDK 0.2.119 defines the `mcp_call` control protocol type but does
2110
- * not expose a public runtime method on the `Query` interface. Until
2111
- * upstream lands a `callMcpTool()` / equivalent, the CLI handler
2112
- * returns this code so the App can surface an honest "waiting on
2113
- * SDK" state instead of masking the gap as a server error.
2176
+ * The agent runtime has no programmatic MCP-tool invocation surface.
2177
+ * In PTY mode the Claude TUI owns the MCP connections itself; the
2178
+ * historical Claude Agent SDK also never exposed a runtime
2179
+ * `callMcpTool()` on `Query`. The CLI handler returns this code so
2180
+ * the App can surface an honest "not supported" state instead of
2181
+ * masking the gap as a server error. Code name preserved for wire
2182
+ * compatibility across older CLI / App builds.
2114
2183
  */
2115
2184
  "sdk_not_implemented",
2116
2185
  "unknown"
@@ -2685,10 +2754,13 @@ exports.isCodexAppServerBackend = isCodexAppServerBackend;
2685
2754
  exports.isCodexLegacyBackend = isCodexLegacyBackend;
2686
2755
  exports.isHappyMcpToolAlias = isHappyMcpToolAlias;
2687
2756
  exports.isHappyMcpToolName = isHappyMcpToolName;
2757
+ exports.isTailscaleNotFound = isTailscaleNotFound;
2688
2758
  exports.isTrustedRuntimeProfile = isTrustedRuntimeProfile;
2689
2759
  exports.normalizeHappyMcpToolName = normalizeHappyMcpToolName;
2690
2760
  exports.normalizeResolvedRuntimeProfile = normalizeResolvedRuntimeProfile;
2691
2761
  exports.parseMcpRegistry = parseMcpRegistry;
2762
+ exports.parseTailscaleServeStatus = parseTailscaleServeStatus;
2763
+ exports.parseTailscaleStatus = parseTailscaleStatus;
2692
2764
  exports.registryToSdkConfig = registryToSdkConfig;
2693
2765
  exports.resolveCodexResolvedBackend = resolveCodexResolvedBackend;
2694
2766
  exports.resolveCodexResumableThreadId = resolveCodexResumableThreadId;
package/dist/index.d.cts CHANGED
@@ -1606,6 +1606,7 @@ declare const TailscaleServeEntrySchema: z.ZodObject<{
1606
1606
  hostname: z.ZodString;
1607
1607
  }, z.core.$strip>;
1608
1608
  type TailscaleServeEntry = z.infer<typeof TailscaleServeEntrySchema>;
1609
+ type TailscaleStatus = "connected" | "disconnected" | "not-installed";
1609
1610
  declare const TailscaleInfoSchema: z.ZodObject<{
1610
1611
  status: z.ZodEnum<{
1611
1612
  connected: "connected";
@@ -2289,6 +2290,31 @@ declare const DaemonStateSchema: z.ZodObject<{
2289
2290
  }, z.core.$strip>;
2290
2291
  type DaemonState = z.infer<typeof DaemonStateSchema>;
2291
2292
 
2293
+ /**
2294
+ * Pure Tailscale parsing utilities — no I/O, no Node.js built-ins.
2295
+ * Safe for all environments (Node.js, React Native, etc.).
2296
+ *
2297
+ * Shared between happy-cli and happy-agent so both packages use a
2298
+ * single implementation and never drift out of sync.
2299
+ */
2300
+
2301
+ /**
2302
+ * Parse the JSON output of `tailscale status --json`.
2303
+ *
2304
+ * @param log - Optional debug callback (called with `[TAILSCALE] …` messages).
2305
+ */
2306
+ declare function parseTailscaleStatus(raw: string, log?: (msg: string) => void): TailscaleInfo;
2307
+ /**
2308
+ * Parse the JSON output of `tailscale serve status --json`.
2309
+ *
2310
+ * @param log - Optional debug callback.
2311
+ */
2312
+ declare function parseTailscaleServeStatus(raw: string, log?: (msg: string) => void): TailscaleServeEntry[];
2313
+ /**
2314
+ * Returns true if the error indicates the tailscale binary was not found (ENOENT).
2315
+ */
2316
+ declare function isTailscaleNotFound(err: unknown): boolean;
2317
+
2292
2318
  declare const KnowledgeEntryTypeSchema: z.ZodEnum<{
2293
2319
  summary: "summary";
2294
2320
  discovery: "discovery";
@@ -2301,8 +2327,8 @@ declare const KnowledgeEntryTypeSchema: z.ZodEnum<{
2301
2327
  type KnowledgeEntryType = z.infer<typeof KnowledgeEntryTypeSchema>;
2302
2328
  declare const KnowledgeContributorTypeSchema: z.ZodEnum<{
2303
2329
  user: "user";
2304
- supervisor: "supervisor";
2305
2330
  session: "session";
2331
+ supervisor: "supervisor";
2306
2332
  }>;
2307
2333
  type KnowledgeContributorType = z.infer<typeof KnowledgeContributorTypeSchema>;
2308
2334
  declare const KnowledgeActionSchema: z.ZodEnum<{
@@ -2314,8 +2340,8 @@ declare const KnowledgeActionSchema: z.ZodEnum<{
2314
2340
  type KnowledgeAction = z.infer<typeof KnowledgeActionSchema>;
2315
2341
  declare const KnowledgeStatusSchema: z.ZodEnum<{
2316
2342
  active: "active";
2317
- archived: "archived";
2318
2343
  superseded: "superseded";
2344
+ archived: "archived";
2319
2345
  }>;
2320
2346
  type KnowledgeStatus = z.infer<typeof KnowledgeStatusSchema>;
2321
2347
  declare const KnowledgeConfidenceSchema: z.ZodEnum<{
@@ -2336,8 +2362,8 @@ declare const CreateKnowledgeEntryBodySchema: z.ZodObject<{
2336
2362
  }>;
2337
2363
  contributorType: z.ZodEnum<{
2338
2364
  user: "user";
2339
- supervisor: "supervisor";
2340
2365
  session: "session";
2366
+ supervisor: "supervisor";
2341
2367
  }>;
2342
2368
  action: z.ZodEnum<{
2343
2369
  create: "create";
@@ -2368,8 +2394,8 @@ type CreateKnowledgeEntryBody = z.infer<typeof CreateKnowledgeEntryBodySchema>;
2368
2394
  declare const UpdateKnowledgeEntryBodySchema: z.ZodObject<{
2369
2395
  status: z.ZodOptional<z.ZodEnum<{
2370
2396
  active: "active";
2371
- archived: "archived";
2372
2397
  superseded: "superseded";
2398
+ archived: "archived";
2373
2399
  }>>;
2374
2400
  pinned: z.ZodOptional<z.ZodBoolean>;
2375
2401
  title: z.ZodOptional<z.ZodString>;
@@ -2394,8 +2420,8 @@ declare const QueryKnowledgeParamsSchema: z.ZodObject<{
2394
2420
  }>>;
2395
2421
  status: z.ZodOptional<z.ZodEnum<{
2396
2422
  active: "active";
2397
- archived: "archived";
2398
2423
  superseded: "superseded";
2424
+ archived: "archived";
2399
2425
  }>>;
2400
2426
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
2401
2427
  search: z.ZodOptional<z.ZodString>;
@@ -2487,8 +2513,8 @@ declare const KnowledgeChainEntrySchema: z.ZodObject<{
2487
2513
  }>;
2488
2514
  status: z.ZodEnum<{
2489
2515
  active: "active";
2490
- archived: "archived";
2491
2516
  superseded: "superseded";
2517
+ archived: "archived";
2492
2518
  }>;
2493
2519
  title: z.ZodString;
2494
2520
  content: z.ZodString;
@@ -2522,8 +2548,8 @@ declare const KnowledgeChainResponseSchema: z.ZodObject<{
2522
2548
  }>;
2523
2549
  status: z.ZodEnum<{
2524
2550
  active: "active";
2525
- archived: "archived";
2526
2551
  superseded: "superseded";
2552
+ archived: "archived";
2527
2553
  }>;
2528
2554
  title: z.ZodString;
2529
2555
  content: z.ZodString;
@@ -2880,10 +2906,10 @@ declare const SkillContentSchema: z.ZodObject<{
2880
2906
  type SkillContent = z.infer<typeof SkillContentSchema>;
2881
2907
 
2882
2908
  declare const InboxCategorySchema: z.ZodEnum<{
2909
+ session: "session";
2883
2910
  supervisor: "supervisor";
2884
2911
  task: "task";
2885
2912
  trigger: "trigger";
2886
- session: "session";
2887
2913
  knowledge: "knowledge";
2888
2914
  system: "system";
2889
2915
  }>;
@@ -2897,10 +2923,10 @@ type InboxSeverity = z.infer<typeof InboxSeveritySchema>;
2897
2923
  declare const InboxItemSummarySchema: z.ZodObject<{
2898
2924
  id: z.ZodString;
2899
2925
  category: z.ZodEnum<{
2926
+ session: "session";
2900
2927
  supervisor: "supervisor";
2901
2928
  task: "task";
2902
2929
  trigger: "trigger";
2903
- session: "session";
2904
2930
  knowledge: "knowledge";
2905
2931
  system: "system";
2906
2932
  }>;
@@ -2925,10 +2951,10 @@ declare const InboxNewItemSchema: z.ZodObject<{
2925
2951
  item: z.ZodObject<{
2926
2952
  id: z.ZodString;
2927
2953
  category: z.ZodEnum<{
2954
+ session: "session";
2928
2955
  supervisor: "supervisor";
2929
2956
  task: "task";
2930
2957
  trigger: "trigger";
2931
- session: "session";
2932
2958
  knowledge: "knowledge";
2933
2959
  system: "system";
2934
2960
  }>;
@@ -4312,5 +4338,5 @@ declare function registryToSdkConfig(registry: McpRegistry, machineId?: string):
4312
4338
  */
4313
4339
  declare function parseMcpRegistry(raw: string | null | undefined): McpRegistry;
4314
4340
 
4315
- export { AIBackendProfileSchema, AddMcpServerRequestSchema, AddMcpServerResponseSchema, AgentLoopSummarySchema, AgentMessageSchema, AnthropicConfigSchema, ApiMessageSchema, ApiUpdateMachineStateSchema, ApiUpdateNewMessageSchema, ApiUpdateSessionStateSchema, ApplySettingsRequestSchema, ApplySettingsResponseSchema, AutoDreamProfileSummarySchema, AutomationAuditEventSummarySchema, AutomationAuditStatsSchema, AutomationCountsSchema, AutomationGuardianSummarySchema, AutomationGuardianUsageSummarySchema, AutomationJobKindSchema, AutomationJobStatusSchema, AutomationJobSummarySchema, AutomationPrioritySchema, AutomationStateSchema, AzureOpenAIConfigSchema, BUILT_IN_AI_BACKEND_PROFILE_IDS, BootstrapProfileSummarySchema, BriefMessageSchema, BuiltInAIBackendProfileIdSchema, CLAUDE_CONTROL_METHODS, CLAUDE_CONTROL_SCOPE, 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, DeleteSessionRequestSchema, DeleteSessionResponseSchema, EnvironmentVariableSchema, GetBinaryVersionRequestSchema, GetBinaryVersionResponseSchema, GetContextDetailRequestSchema, GetContextDetailResponseSchema, GetContextUsageRequestSchema, GetContextUsageResponseSchema, GetMcpServersRequestSchema, GetMcpServersResponseSchema, GetSessionCostRequestSchema, GetSessionCostResponseSchema, GetSessionInfoRequestSchema, GetSessionInfoResponseSchema, GetSessionMessagesRequestSchema, GetSessionMessagesResponseSchema, HAPPY_MCP_AUTO_APPROVE_TOOL_NAMES, HAPPY_MCP_SILENT_SUCCESS_TOOL_NAMES, HAPPY_MCP_TOOL_NAMES, HAPPY_MCP_TOOL_SPECS, HAPPY_PROFILE_ENV_KEYS, InboxCategorySchema, InboxItemSummarySchema, InboxNewItemSchema, InboxSeveritySchema, InboxUnreadCountSchema, KnowledgeActionSchema, KnowledgeChainEntrySchema, KnowledgeChainRelationSchema, KnowledgeChainResponseSchema, KnowledgeConfidenceSchema, KnowledgeContributorTypeSchema, KnowledgeEntryTypeSchema, KnowledgeInjectionModeSchema, KnowledgeInjectionRequestSchema, KnowledgeInjectionResponseSchema, KnowledgeStatusSchema, LegacyMessageContentSchema, ListSessionsRequestSchema, ListSessionsResponseSchema, LiveKitTokenResponseSchema, MCP_REGISTRY_KV_KEY, MachineMetadataSchema, McpCallRequestSchema, McpCallResponseSchema, McpRegistryEntrySchema, McpRegistrySchema, McpSseConfigSchema, McpStdioConfigSchema, McpStreamableHttpConfigSchema, McpTransportConfigSchema, McpUrlConfigSchema, MessageContentSchema, MessageMetaSchema, OpenAIConfigSchema, ProfileCompatibilitySchema, ProjectProfileSchema, QueryKnowledgeParamsSchema, RESOLVED_RUNTIME_PROFILE_SCHEMA_VERSION, ReadFileRequestSchema, ReadFileResponseSchema, ReconnectMcpServerRequestSchema, ReconnectMcpServerResponseSchema, RemoveMcpServerRequestSchema, RemoveMcpServerResponseSchema, RenameSessionRequestSchema, RenameSessionResponseSchema, ResolvedRuntimeProfileSchema, RuntimeProfileSourceSchema, RuntimeProfileTrustSchema, SdkSessionInfoSchema, SessionEventCreatedSchema, SessionEventReportSchema, SessionEventSummarySchema, SessionEventTypeSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, SetColorRequestSchema, SetColorResponseSchema, SetMcpServersRequestSchema, SetMcpServersResponseSchema, SkillContentSchema, SkillSummarySchema, TailscaleInfoSchema, TailscaleServeEntrySchema, TaskOutcomeSchema, TaskPrioritySchema, TaskStatusChangedSchema, TaskStatusReportSchema, TaskStatusSchema, TaskSummarySchema, TaskTriggerDataSchema, TaskTriggerTypeSchema, TmuxConfigSchema, TogetherAIConfigSchema, ToggleMcpServerRequestSchema, ToggleMcpServerResponseSchema, TunnelEntrySchema, TunnelProviderInfoSchema, TunnelStateSchema, TurnKnowledgeExtractionSchema, UpdateBodySchema, UpdateKnowledgeEntryBodySchema, UpdateMachineBodySchema, UpdateNewMessageBodySchema, UpdateSchema, UpdateSessionBodySchema, UpdateSkillBodySchema, UserMessageSchema, VersionedEncryptedValueSchema, VersionedMachineEncryptedValueSchema, VersionedNullableEncryptedValueSchema, VoiceTokenAllowedSchema, VoiceTokenDeniedSchema, VoiceTokenResponseSchema, createEmptyMcpRegistry, createEnvelope, createResolvedRuntimeProfile, getBuiltInAIBackendProfile, getHappyMcpToolAction, getHappyMcpToolAliases, getHappyMcpToolTitle, getProfileEnvironmentVariables, isCodexAppServerBackend, isCodexLegacyBackend, isHappyMcpToolAlias, isHappyMcpToolName, isTrustedRuntimeProfile, normalizeHappyMcpToolName, normalizeResolvedRuntimeProfile, parseMcpRegistry, registryToSdkConfig, resolveCodexResolvedBackend, resolveCodexResumableThreadId, resolveRequestedCodexBackend, sessionContextUsageCategorySchema, sessionContextUsageEventSchema, sessionEnvelopeSchema, sessionEventSchema, sessionFileEventSchema, sessionModelUsageSchema, sessionNeedsContinueEventSchema, sessionProgressListSchema, sessionProgressStateSchema, sessionProgressTodoSchema, sessionProgressTodoStatusSchema, sessionPromptSuggestionEventSchema, sessionRateLimitEventSchema, sessionRoleSchema, sessionServiceMessageEventSchema, sessionStartEventSchema, sessionStateChangedEventSchema, sessionStopEventSchema, sessionSummaryRefreshActiveRequestSchema, sessionSummaryRefreshRecentEntrySchema, sessionSummaryRefreshStateSchema, sessionSummaryStateSchema, sessionTaskEndEventSchema, sessionTaskLogEventSchema, sessionTaskProgressEventSchema, sessionTaskStartEventSchema, sessionTaskUpdatedEventSchema, sessionTextDeltaEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionToolProgressEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, sessionUsageUpdateEventSchema, shouldAutoApproveHappyMcpReason, shouldAutoApproveHappyMcpToolName, shouldHideSuccessfulHappyMcpTool, terminalCloseRequestSchema, terminalExitPayloadSchema, terminalInputPayloadSchema, terminalOutputPayloadSchema, terminalResizeRequestSchema, terminalSpawnRequestSchema, terminalSpawnResponseSchema, validateProfileForAgent };
4316
- export type { AIBackendProfile, AddMcpServerRequest, AddMcpServerResponse, AgentLoopSummary, AgentMessage, ApiMessage, ApiUpdateMachineState, ApiUpdateNewMessage, ApiUpdateSessionState, ApplySettingsRequest, ApplySettingsResponse, AutoDreamProfileSummary, AutomationAuditEventSummary, AutomationAuditStats, AutomationCounts, AutomationGuardianSummary, AutomationGuardianUsageSummary, AutomationJobKind, AutomationJobStatus, AutomationJobSummary, AutomationPriority, AutomationState, BootstrapProfileSummary, BriefMessage, BuiltInAIBackendProfileId, ClaudeControlMethod, CliInstallInfo, CliInstallSource, CodexAccount, CodexAgentSummary, CodexBackendMode, CodexConfigMode, CodexExperimentalFeature, CodexMcpServerSummary, CodexMetadata, CodexPromptSummary, CodexRateLimits, CodexRequestedBackend, CodexResolvedBackend, CodexRuntimeConfig, CodexSkillSummary, CoreUpdateBody, CoreUpdateContainer, CreateEnvelopeOptions, CreateKnowledgeEntryBody, CreateSkillBody, CreateTaskBody, CrossProjectSearchResponse, CrossProjectSearchResult, DaemonState, DeleteSessionRequest, DeleteSessionResponse, GetBinaryVersionRequest, GetBinaryVersionResponse, GetContextDetailRequest, GetContextDetailResponse, GetContextUsageRequest, GetContextUsageResponse, GetMcpServersRequest, GetMcpServersResponse, GetSessionCostRequest, GetSessionCostResponse, GetSessionInfoRequest, GetSessionInfoResponse, GetSessionMessagesRequest, GetSessionMessagesResponse, HappyMcpCanonicalToolName, HappyMcpToolActionMode, HappyProfileEnvKey, InboxCategory, InboxItemSummary, InboxNewItem, InboxSeverity, InboxUnreadCount, KnowledgeAction, KnowledgeChainEntry, KnowledgeChainRelation, KnowledgeChainResponse, KnowledgeConfidence, KnowledgeContributorType, KnowledgeEntryType, KnowledgeInjectionMode, KnowledgeInjectionRequest, KnowledgeInjectionResponse, KnowledgeStatus, LegacyMessageContent, ListSessionsRequest, ListSessionsResponse, LiveKitTokenResponse, MachineMetadata, McpCallRequest, McpCallResponse, McpRegistry, McpRegistryEntry, McpTransportConfig, MessageContent, MessageMeta, ProjectProfile, QueryKnowledgeParams, ReadFileRequest, ReadFileResponse, ReconnectMcpServerRequest, ReconnectMcpServerResponse, RemoveMcpServerRequest, RemoveMcpServerResponse, RenameSessionRequest, RenameSessionResponse, ResolvedRuntimeProfile, RuntimeProfileSource, RuntimeProfileTrust, SdkSessionInfo, SessionContextUsageEvent, SessionEnvelope, SessionEvent, SessionEventCreated, SessionEventReport, SessionEventSummary, SessionEventType, SessionMessage, SessionMessageContent, SessionModelUsage, SessionProgressList, SessionProgressState, SessionProgressTodo, SessionProgressTodoStatus, SessionProtocolMessage, SessionRole, SessionSummaryRefreshActiveRequest, SessionSummaryRefreshRecentEntry, SessionSummaryRefreshState, SessionSummaryState, SessionTurnEndStatus, SetColorRequest, SetColorResponse, SetMcpServersRequest, SetMcpServersResponse, SkillContent, SkillSummary, TailscaleInfo, TailscaleServeEntry, TaskOutcome, TaskPriority, TaskStatus, TaskStatusChanged, TaskStatusReport, TaskSummary, TaskTriggerData, TaskTriggerType, TerminalCloseRequest, TerminalExitPayload, TerminalInputPayload, TerminalOutputPayload, TerminalResizeRequest, TerminalSpawnRequest, TerminalSpawnResponse, ToggleMcpServerRequest, ToggleMcpServerResponse, TunnelEntry, TunnelProviderInfo, TunnelState, TurnKnowledgeExtraction, Update, UpdateBody, UpdateKnowledgeEntryBody, UpdateMachineBody, UpdateNewMessageBody, UpdateSessionBody, UpdateSkillBody, UserMessage, VersionedEncryptedValue, VersionedMachineEncryptedValue, VersionedNullableEncryptedValue, VoiceTokenResponse };
4341
+ export { AIBackendProfileSchema, AddMcpServerRequestSchema, AddMcpServerResponseSchema, AgentLoopSummarySchema, AgentMessageSchema, AnthropicConfigSchema, ApiMessageSchema, ApiUpdateMachineStateSchema, ApiUpdateNewMessageSchema, ApiUpdateSessionStateSchema, ApplySettingsRequestSchema, ApplySettingsResponseSchema, AutoDreamProfileSummarySchema, AutomationAuditEventSummarySchema, AutomationAuditStatsSchema, AutomationCountsSchema, AutomationGuardianSummarySchema, AutomationGuardianUsageSummarySchema, AutomationJobKindSchema, AutomationJobStatusSchema, AutomationJobSummarySchema, AutomationPrioritySchema, AutomationStateSchema, AzureOpenAIConfigSchema, BUILT_IN_AI_BACKEND_PROFILE_IDS, BootstrapProfileSummarySchema, BriefMessageSchema, BuiltInAIBackendProfileIdSchema, CLAUDE_CONTROL_METHODS, CLAUDE_CONTROL_SCOPE, 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, DeleteSessionRequestSchema, DeleteSessionResponseSchema, EnvironmentVariableSchema, GetBinaryVersionRequestSchema, GetBinaryVersionResponseSchema, GetContextDetailRequestSchema, GetContextDetailResponseSchema, GetContextUsageRequestSchema, GetContextUsageResponseSchema, GetMcpServersRequestSchema, GetMcpServersResponseSchema, GetSessionCostRequestSchema, GetSessionCostResponseSchema, GetSessionInfoRequestSchema, GetSessionInfoResponseSchema, GetSessionMessagesRequestSchema, GetSessionMessagesResponseSchema, HAPPY_MCP_AUTO_APPROVE_TOOL_NAMES, HAPPY_MCP_SILENT_SUCCESS_TOOL_NAMES, HAPPY_MCP_TOOL_NAMES, HAPPY_MCP_TOOL_SPECS, HAPPY_PROFILE_ENV_KEYS, InboxCategorySchema, InboxItemSummarySchema, InboxNewItemSchema, InboxSeveritySchema, InboxUnreadCountSchema, KnowledgeActionSchema, KnowledgeChainEntrySchema, KnowledgeChainRelationSchema, KnowledgeChainResponseSchema, KnowledgeConfidenceSchema, KnowledgeContributorTypeSchema, KnowledgeEntryTypeSchema, KnowledgeInjectionModeSchema, KnowledgeInjectionRequestSchema, KnowledgeInjectionResponseSchema, KnowledgeStatusSchema, LegacyMessageContentSchema, ListSessionsRequestSchema, ListSessionsResponseSchema, LiveKitTokenResponseSchema, MCP_REGISTRY_KV_KEY, MachineMetadataSchema, McpCallRequestSchema, McpCallResponseSchema, McpRegistryEntrySchema, McpRegistrySchema, McpSseConfigSchema, McpStdioConfigSchema, McpStreamableHttpConfigSchema, McpTransportConfigSchema, McpUrlConfigSchema, MessageContentSchema, MessageMetaSchema, OpenAIConfigSchema, ProfileCompatibilitySchema, ProjectProfileSchema, QueryKnowledgeParamsSchema, RESOLVED_RUNTIME_PROFILE_SCHEMA_VERSION, ReadFileRequestSchema, ReadFileResponseSchema, ReconnectMcpServerRequestSchema, ReconnectMcpServerResponseSchema, RemoveMcpServerRequestSchema, RemoveMcpServerResponseSchema, RenameSessionRequestSchema, RenameSessionResponseSchema, ResolvedRuntimeProfileSchema, RuntimeProfileSourceSchema, RuntimeProfileTrustSchema, SdkSessionInfoSchema, SessionEventCreatedSchema, SessionEventReportSchema, SessionEventSummarySchema, SessionEventTypeSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, SetColorRequestSchema, SetColorResponseSchema, SetMcpServersRequestSchema, SetMcpServersResponseSchema, SkillContentSchema, SkillSummarySchema, TailscaleInfoSchema, TailscaleServeEntrySchema, TaskOutcomeSchema, TaskPrioritySchema, TaskStatusChangedSchema, TaskStatusReportSchema, TaskStatusSchema, TaskSummarySchema, TaskTriggerDataSchema, TaskTriggerTypeSchema, TmuxConfigSchema, TogetherAIConfigSchema, ToggleMcpServerRequestSchema, ToggleMcpServerResponseSchema, TunnelEntrySchema, TunnelProviderInfoSchema, TunnelStateSchema, TurnKnowledgeExtractionSchema, UpdateBodySchema, UpdateKnowledgeEntryBodySchema, UpdateMachineBodySchema, UpdateNewMessageBodySchema, UpdateSchema, UpdateSessionBodySchema, UpdateSkillBodySchema, UserMessageSchema, VersionedEncryptedValueSchema, VersionedMachineEncryptedValueSchema, VersionedNullableEncryptedValueSchema, VoiceTokenAllowedSchema, VoiceTokenDeniedSchema, VoiceTokenResponseSchema, createEmptyMcpRegistry, createEnvelope, createResolvedRuntimeProfile, getBuiltInAIBackendProfile, getHappyMcpToolAction, getHappyMcpToolAliases, getHappyMcpToolTitle, getProfileEnvironmentVariables, isCodexAppServerBackend, isCodexLegacyBackend, isHappyMcpToolAlias, isHappyMcpToolName, isTailscaleNotFound, isTrustedRuntimeProfile, normalizeHappyMcpToolName, normalizeResolvedRuntimeProfile, parseMcpRegistry, parseTailscaleServeStatus, parseTailscaleStatus, registryToSdkConfig, resolveCodexResolvedBackend, resolveCodexResumableThreadId, resolveRequestedCodexBackend, sessionContextUsageCategorySchema, sessionContextUsageEventSchema, sessionEnvelopeSchema, sessionEventSchema, sessionFileEventSchema, sessionModelUsageSchema, sessionNeedsContinueEventSchema, sessionProgressListSchema, sessionProgressStateSchema, sessionProgressTodoSchema, sessionProgressTodoStatusSchema, sessionPromptSuggestionEventSchema, sessionRateLimitEventSchema, sessionRoleSchema, sessionServiceMessageEventSchema, sessionStartEventSchema, sessionStateChangedEventSchema, sessionStopEventSchema, sessionSummaryRefreshActiveRequestSchema, sessionSummaryRefreshRecentEntrySchema, sessionSummaryRefreshStateSchema, sessionSummaryStateSchema, sessionTaskEndEventSchema, sessionTaskLogEventSchema, sessionTaskProgressEventSchema, sessionTaskStartEventSchema, sessionTaskUpdatedEventSchema, sessionTextDeltaEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionToolProgressEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, sessionUsageUpdateEventSchema, shouldAutoApproveHappyMcpReason, shouldAutoApproveHappyMcpToolName, shouldHideSuccessfulHappyMcpTool, terminalCloseRequestSchema, terminalExitPayloadSchema, terminalInputPayloadSchema, terminalOutputPayloadSchema, terminalResizeRequestSchema, terminalSpawnRequestSchema, terminalSpawnResponseSchema, validateProfileForAgent };
4342
+ export type { AIBackendProfile, AddMcpServerRequest, AddMcpServerResponse, AgentLoopSummary, AgentMessage, ApiMessage, ApiUpdateMachineState, ApiUpdateNewMessage, ApiUpdateSessionState, ApplySettingsRequest, ApplySettingsResponse, AutoDreamProfileSummary, AutomationAuditEventSummary, AutomationAuditStats, AutomationCounts, AutomationGuardianSummary, AutomationGuardianUsageSummary, AutomationJobKind, AutomationJobStatus, AutomationJobSummary, AutomationPriority, AutomationState, BootstrapProfileSummary, BriefMessage, BuiltInAIBackendProfileId, ClaudeControlMethod, CliInstallInfo, CliInstallSource, CodexAccount, CodexAgentSummary, CodexBackendMode, CodexConfigMode, CodexExperimentalFeature, CodexMcpServerSummary, CodexMetadata, CodexPromptSummary, CodexRateLimits, CodexRequestedBackend, CodexResolvedBackend, CodexRuntimeConfig, CodexSkillSummary, CoreUpdateBody, CoreUpdateContainer, CreateEnvelopeOptions, CreateKnowledgeEntryBody, CreateSkillBody, CreateTaskBody, CrossProjectSearchResponse, CrossProjectSearchResult, DaemonState, DeleteSessionRequest, DeleteSessionResponse, GetBinaryVersionRequest, GetBinaryVersionResponse, GetContextDetailRequest, GetContextDetailResponse, GetContextUsageRequest, GetContextUsageResponse, GetMcpServersRequest, GetMcpServersResponse, GetSessionCostRequest, GetSessionCostResponse, GetSessionInfoRequest, GetSessionInfoResponse, GetSessionMessagesRequest, GetSessionMessagesResponse, HappyMcpCanonicalToolName, HappyMcpToolActionMode, HappyProfileEnvKey, InboxCategory, InboxItemSummary, InboxNewItem, InboxSeverity, InboxUnreadCount, KnowledgeAction, KnowledgeChainEntry, KnowledgeChainRelation, KnowledgeChainResponse, KnowledgeConfidence, KnowledgeContributorType, KnowledgeEntryType, KnowledgeInjectionMode, KnowledgeInjectionRequest, KnowledgeInjectionResponse, KnowledgeStatus, LegacyMessageContent, ListSessionsRequest, ListSessionsResponse, LiveKitTokenResponse, MachineMetadata, McpCallRequest, McpCallResponse, McpRegistry, McpRegistryEntry, McpTransportConfig, MessageContent, MessageMeta, ProjectProfile, QueryKnowledgeParams, ReadFileRequest, ReadFileResponse, ReconnectMcpServerRequest, ReconnectMcpServerResponse, RemoveMcpServerRequest, RemoveMcpServerResponse, RenameSessionRequest, RenameSessionResponse, ResolvedRuntimeProfile, RuntimeProfileSource, RuntimeProfileTrust, SdkSessionInfo, SessionContextUsageEvent, SessionEnvelope, SessionEvent, SessionEventCreated, SessionEventReport, SessionEventSummary, SessionEventType, SessionMessage, SessionMessageContent, SessionModelUsage, SessionProgressList, SessionProgressState, SessionProgressTodo, SessionProgressTodoStatus, SessionProtocolMessage, SessionRole, SessionSummaryRefreshActiveRequest, SessionSummaryRefreshRecentEntry, SessionSummaryRefreshState, SessionSummaryState, SessionTurnEndStatus, SetColorRequest, SetColorResponse, SetMcpServersRequest, SetMcpServersResponse, SkillContent, SkillSummary, TailscaleInfo, TailscaleServeEntry, TailscaleStatus, TaskOutcome, TaskPriority, TaskStatus, TaskStatusChanged, TaskStatusReport, TaskSummary, TaskTriggerData, TaskTriggerType, TerminalCloseRequest, TerminalExitPayload, TerminalInputPayload, TerminalOutputPayload, TerminalResizeRequest, TerminalSpawnRequest, TerminalSpawnResponse, ToggleMcpServerRequest, ToggleMcpServerResponse, TunnelEntry, TunnelProviderInfo, TunnelState, TurnKnowledgeExtraction, Update, UpdateBody, UpdateKnowledgeEntryBody, UpdateMachineBody, UpdateNewMessageBody, UpdateSessionBody, UpdateSkillBody, UserMessage, VersionedEncryptedValue, VersionedMachineEncryptedValue, VersionedNullableEncryptedValue, VoiceTokenResponse };
package/dist/index.d.mts CHANGED
@@ -1606,6 +1606,7 @@ declare const TailscaleServeEntrySchema: z.ZodObject<{
1606
1606
  hostname: z.ZodString;
1607
1607
  }, z.core.$strip>;
1608
1608
  type TailscaleServeEntry = z.infer<typeof TailscaleServeEntrySchema>;
1609
+ type TailscaleStatus = "connected" | "disconnected" | "not-installed";
1609
1610
  declare const TailscaleInfoSchema: z.ZodObject<{
1610
1611
  status: z.ZodEnum<{
1611
1612
  connected: "connected";
@@ -2289,6 +2290,31 @@ declare const DaemonStateSchema: z.ZodObject<{
2289
2290
  }, z.core.$strip>;
2290
2291
  type DaemonState = z.infer<typeof DaemonStateSchema>;
2291
2292
 
2293
+ /**
2294
+ * Pure Tailscale parsing utilities — no I/O, no Node.js built-ins.
2295
+ * Safe for all environments (Node.js, React Native, etc.).
2296
+ *
2297
+ * Shared between happy-cli and happy-agent so both packages use a
2298
+ * single implementation and never drift out of sync.
2299
+ */
2300
+
2301
+ /**
2302
+ * Parse the JSON output of `tailscale status --json`.
2303
+ *
2304
+ * @param log - Optional debug callback (called with `[TAILSCALE] …` messages).
2305
+ */
2306
+ declare function parseTailscaleStatus(raw: string, log?: (msg: string) => void): TailscaleInfo;
2307
+ /**
2308
+ * Parse the JSON output of `tailscale serve status --json`.
2309
+ *
2310
+ * @param log - Optional debug callback.
2311
+ */
2312
+ declare function parseTailscaleServeStatus(raw: string, log?: (msg: string) => void): TailscaleServeEntry[];
2313
+ /**
2314
+ * Returns true if the error indicates the tailscale binary was not found (ENOENT).
2315
+ */
2316
+ declare function isTailscaleNotFound(err: unknown): boolean;
2317
+
2292
2318
  declare const KnowledgeEntryTypeSchema: z.ZodEnum<{
2293
2319
  summary: "summary";
2294
2320
  discovery: "discovery";
@@ -2301,8 +2327,8 @@ declare const KnowledgeEntryTypeSchema: z.ZodEnum<{
2301
2327
  type KnowledgeEntryType = z.infer<typeof KnowledgeEntryTypeSchema>;
2302
2328
  declare const KnowledgeContributorTypeSchema: z.ZodEnum<{
2303
2329
  user: "user";
2304
- supervisor: "supervisor";
2305
2330
  session: "session";
2331
+ supervisor: "supervisor";
2306
2332
  }>;
2307
2333
  type KnowledgeContributorType = z.infer<typeof KnowledgeContributorTypeSchema>;
2308
2334
  declare const KnowledgeActionSchema: z.ZodEnum<{
@@ -2314,8 +2340,8 @@ declare const KnowledgeActionSchema: z.ZodEnum<{
2314
2340
  type KnowledgeAction = z.infer<typeof KnowledgeActionSchema>;
2315
2341
  declare const KnowledgeStatusSchema: z.ZodEnum<{
2316
2342
  active: "active";
2317
- archived: "archived";
2318
2343
  superseded: "superseded";
2344
+ archived: "archived";
2319
2345
  }>;
2320
2346
  type KnowledgeStatus = z.infer<typeof KnowledgeStatusSchema>;
2321
2347
  declare const KnowledgeConfidenceSchema: z.ZodEnum<{
@@ -2336,8 +2362,8 @@ declare const CreateKnowledgeEntryBodySchema: z.ZodObject<{
2336
2362
  }>;
2337
2363
  contributorType: z.ZodEnum<{
2338
2364
  user: "user";
2339
- supervisor: "supervisor";
2340
2365
  session: "session";
2366
+ supervisor: "supervisor";
2341
2367
  }>;
2342
2368
  action: z.ZodEnum<{
2343
2369
  create: "create";
@@ -2368,8 +2394,8 @@ type CreateKnowledgeEntryBody = z.infer<typeof CreateKnowledgeEntryBodySchema>;
2368
2394
  declare const UpdateKnowledgeEntryBodySchema: z.ZodObject<{
2369
2395
  status: z.ZodOptional<z.ZodEnum<{
2370
2396
  active: "active";
2371
- archived: "archived";
2372
2397
  superseded: "superseded";
2398
+ archived: "archived";
2373
2399
  }>>;
2374
2400
  pinned: z.ZodOptional<z.ZodBoolean>;
2375
2401
  title: z.ZodOptional<z.ZodString>;
@@ -2394,8 +2420,8 @@ declare const QueryKnowledgeParamsSchema: z.ZodObject<{
2394
2420
  }>>;
2395
2421
  status: z.ZodOptional<z.ZodEnum<{
2396
2422
  active: "active";
2397
- archived: "archived";
2398
2423
  superseded: "superseded";
2424
+ archived: "archived";
2399
2425
  }>>;
2400
2426
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
2401
2427
  search: z.ZodOptional<z.ZodString>;
@@ -2487,8 +2513,8 @@ declare const KnowledgeChainEntrySchema: z.ZodObject<{
2487
2513
  }>;
2488
2514
  status: z.ZodEnum<{
2489
2515
  active: "active";
2490
- archived: "archived";
2491
2516
  superseded: "superseded";
2517
+ archived: "archived";
2492
2518
  }>;
2493
2519
  title: z.ZodString;
2494
2520
  content: z.ZodString;
@@ -2522,8 +2548,8 @@ declare const KnowledgeChainResponseSchema: z.ZodObject<{
2522
2548
  }>;
2523
2549
  status: z.ZodEnum<{
2524
2550
  active: "active";
2525
- archived: "archived";
2526
2551
  superseded: "superseded";
2552
+ archived: "archived";
2527
2553
  }>;
2528
2554
  title: z.ZodString;
2529
2555
  content: z.ZodString;
@@ -2880,10 +2906,10 @@ declare const SkillContentSchema: z.ZodObject<{
2880
2906
  type SkillContent = z.infer<typeof SkillContentSchema>;
2881
2907
 
2882
2908
  declare const InboxCategorySchema: z.ZodEnum<{
2909
+ session: "session";
2883
2910
  supervisor: "supervisor";
2884
2911
  task: "task";
2885
2912
  trigger: "trigger";
2886
- session: "session";
2887
2913
  knowledge: "knowledge";
2888
2914
  system: "system";
2889
2915
  }>;
@@ -2897,10 +2923,10 @@ type InboxSeverity = z.infer<typeof InboxSeveritySchema>;
2897
2923
  declare const InboxItemSummarySchema: z.ZodObject<{
2898
2924
  id: z.ZodString;
2899
2925
  category: z.ZodEnum<{
2926
+ session: "session";
2900
2927
  supervisor: "supervisor";
2901
2928
  task: "task";
2902
2929
  trigger: "trigger";
2903
- session: "session";
2904
2930
  knowledge: "knowledge";
2905
2931
  system: "system";
2906
2932
  }>;
@@ -2925,10 +2951,10 @@ declare const InboxNewItemSchema: z.ZodObject<{
2925
2951
  item: z.ZodObject<{
2926
2952
  id: z.ZodString;
2927
2953
  category: z.ZodEnum<{
2954
+ session: "session";
2928
2955
  supervisor: "supervisor";
2929
2956
  task: "task";
2930
2957
  trigger: "trigger";
2931
- session: "session";
2932
2958
  knowledge: "knowledge";
2933
2959
  system: "system";
2934
2960
  }>;
@@ -4312,5 +4338,5 @@ declare function registryToSdkConfig(registry: McpRegistry, machineId?: string):
4312
4338
  */
4313
4339
  declare function parseMcpRegistry(raw: string | null | undefined): McpRegistry;
4314
4340
 
4315
- export { AIBackendProfileSchema, AddMcpServerRequestSchema, AddMcpServerResponseSchema, AgentLoopSummarySchema, AgentMessageSchema, AnthropicConfigSchema, ApiMessageSchema, ApiUpdateMachineStateSchema, ApiUpdateNewMessageSchema, ApiUpdateSessionStateSchema, ApplySettingsRequestSchema, ApplySettingsResponseSchema, AutoDreamProfileSummarySchema, AutomationAuditEventSummarySchema, AutomationAuditStatsSchema, AutomationCountsSchema, AutomationGuardianSummarySchema, AutomationGuardianUsageSummarySchema, AutomationJobKindSchema, AutomationJobStatusSchema, AutomationJobSummarySchema, AutomationPrioritySchema, AutomationStateSchema, AzureOpenAIConfigSchema, BUILT_IN_AI_BACKEND_PROFILE_IDS, BootstrapProfileSummarySchema, BriefMessageSchema, BuiltInAIBackendProfileIdSchema, CLAUDE_CONTROL_METHODS, CLAUDE_CONTROL_SCOPE, 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, DeleteSessionRequestSchema, DeleteSessionResponseSchema, EnvironmentVariableSchema, GetBinaryVersionRequestSchema, GetBinaryVersionResponseSchema, GetContextDetailRequestSchema, GetContextDetailResponseSchema, GetContextUsageRequestSchema, GetContextUsageResponseSchema, GetMcpServersRequestSchema, GetMcpServersResponseSchema, GetSessionCostRequestSchema, GetSessionCostResponseSchema, GetSessionInfoRequestSchema, GetSessionInfoResponseSchema, GetSessionMessagesRequestSchema, GetSessionMessagesResponseSchema, HAPPY_MCP_AUTO_APPROVE_TOOL_NAMES, HAPPY_MCP_SILENT_SUCCESS_TOOL_NAMES, HAPPY_MCP_TOOL_NAMES, HAPPY_MCP_TOOL_SPECS, HAPPY_PROFILE_ENV_KEYS, InboxCategorySchema, InboxItemSummarySchema, InboxNewItemSchema, InboxSeveritySchema, InboxUnreadCountSchema, KnowledgeActionSchema, KnowledgeChainEntrySchema, KnowledgeChainRelationSchema, KnowledgeChainResponseSchema, KnowledgeConfidenceSchema, KnowledgeContributorTypeSchema, KnowledgeEntryTypeSchema, KnowledgeInjectionModeSchema, KnowledgeInjectionRequestSchema, KnowledgeInjectionResponseSchema, KnowledgeStatusSchema, LegacyMessageContentSchema, ListSessionsRequestSchema, ListSessionsResponseSchema, LiveKitTokenResponseSchema, MCP_REGISTRY_KV_KEY, MachineMetadataSchema, McpCallRequestSchema, McpCallResponseSchema, McpRegistryEntrySchema, McpRegistrySchema, McpSseConfigSchema, McpStdioConfigSchema, McpStreamableHttpConfigSchema, McpTransportConfigSchema, McpUrlConfigSchema, MessageContentSchema, MessageMetaSchema, OpenAIConfigSchema, ProfileCompatibilitySchema, ProjectProfileSchema, QueryKnowledgeParamsSchema, RESOLVED_RUNTIME_PROFILE_SCHEMA_VERSION, ReadFileRequestSchema, ReadFileResponseSchema, ReconnectMcpServerRequestSchema, ReconnectMcpServerResponseSchema, RemoveMcpServerRequestSchema, RemoveMcpServerResponseSchema, RenameSessionRequestSchema, RenameSessionResponseSchema, ResolvedRuntimeProfileSchema, RuntimeProfileSourceSchema, RuntimeProfileTrustSchema, SdkSessionInfoSchema, SessionEventCreatedSchema, SessionEventReportSchema, SessionEventSummarySchema, SessionEventTypeSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, SetColorRequestSchema, SetColorResponseSchema, SetMcpServersRequestSchema, SetMcpServersResponseSchema, SkillContentSchema, SkillSummarySchema, TailscaleInfoSchema, TailscaleServeEntrySchema, TaskOutcomeSchema, TaskPrioritySchema, TaskStatusChangedSchema, TaskStatusReportSchema, TaskStatusSchema, TaskSummarySchema, TaskTriggerDataSchema, TaskTriggerTypeSchema, TmuxConfigSchema, TogetherAIConfigSchema, ToggleMcpServerRequestSchema, ToggleMcpServerResponseSchema, TunnelEntrySchema, TunnelProviderInfoSchema, TunnelStateSchema, TurnKnowledgeExtractionSchema, UpdateBodySchema, UpdateKnowledgeEntryBodySchema, UpdateMachineBodySchema, UpdateNewMessageBodySchema, UpdateSchema, UpdateSessionBodySchema, UpdateSkillBodySchema, UserMessageSchema, VersionedEncryptedValueSchema, VersionedMachineEncryptedValueSchema, VersionedNullableEncryptedValueSchema, VoiceTokenAllowedSchema, VoiceTokenDeniedSchema, VoiceTokenResponseSchema, createEmptyMcpRegistry, createEnvelope, createResolvedRuntimeProfile, getBuiltInAIBackendProfile, getHappyMcpToolAction, getHappyMcpToolAliases, getHappyMcpToolTitle, getProfileEnvironmentVariables, isCodexAppServerBackend, isCodexLegacyBackend, isHappyMcpToolAlias, isHappyMcpToolName, isTrustedRuntimeProfile, normalizeHappyMcpToolName, normalizeResolvedRuntimeProfile, parseMcpRegistry, registryToSdkConfig, resolveCodexResolvedBackend, resolveCodexResumableThreadId, resolveRequestedCodexBackend, sessionContextUsageCategorySchema, sessionContextUsageEventSchema, sessionEnvelopeSchema, sessionEventSchema, sessionFileEventSchema, sessionModelUsageSchema, sessionNeedsContinueEventSchema, sessionProgressListSchema, sessionProgressStateSchema, sessionProgressTodoSchema, sessionProgressTodoStatusSchema, sessionPromptSuggestionEventSchema, sessionRateLimitEventSchema, sessionRoleSchema, sessionServiceMessageEventSchema, sessionStartEventSchema, sessionStateChangedEventSchema, sessionStopEventSchema, sessionSummaryRefreshActiveRequestSchema, sessionSummaryRefreshRecentEntrySchema, sessionSummaryRefreshStateSchema, sessionSummaryStateSchema, sessionTaskEndEventSchema, sessionTaskLogEventSchema, sessionTaskProgressEventSchema, sessionTaskStartEventSchema, sessionTaskUpdatedEventSchema, sessionTextDeltaEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionToolProgressEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, sessionUsageUpdateEventSchema, shouldAutoApproveHappyMcpReason, shouldAutoApproveHappyMcpToolName, shouldHideSuccessfulHappyMcpTool, terminalCloseRequestSchema, terminalExitPayloadSchema, terminalInputPayloadSchema, terminalOutputPayloadSchema, terminalResizeRequestSchema, terminalSpawnRequestSchema, terminalSpawnResponseSchema, validateProfileForAgent };
4316
- export type { AIBackendProfile, AddMcpServerRequest, AddMcpServerResponse, AgentLoopSummary, AgentMessage, ApiMessage, ApiUpdateMachineState, ApiUpdateNewMessage, ApiUpdateSessionState, ApplySettingsRequest, ApplySettingsResponse, AutoDreamProfileSummary, AutomationAuditEventSummary, AutomationAuditStats, AutomationCounts, AutomationGuardianSummary, AutomationGuardianUsageSummary, AutomationJobKind, AutomationJobStatus, AutomationJobSummary, AutomationPriority, AutomationState, BootstrapProfileSummary, BriefMessage, BuiltInAIBackendProfileId, ClaudeControlMethod, CliInstallInfo, CliInstallSource, CodexAccount, CodexAgentSummary, CodexBackendMode, CodexConfigMode, CodexExperimentalFeature, CodexMcpServerSummary, CodexMetadata, CodexPromptSummary, CodexRateLimits, CodexRequestedBackend, CodexResolvedBackend, CodexRuntimeConfig, CodexSkillSummary, CoreUpdateBody, CoreUpdateContainer, CreateEnvelopeOptions, CreateKnowledgeEntryBody, CreateSkillBody, CreateTaskBody, CrossProjectSearchResponse, CrossProjectSearchResult, DaemonState, DeleteSessionRequest, DeleteSessionResponse, GetBinaryVersionRequest, GetBinaryVersionResponse, GetContextDetailRequest, GetContextDetailResponse, GetContextUsageRequest, GetContextUsageResponse, GetMcpServersRequest, GetMcpServersResponse, GetSessionCostRequest, GetSessionCostResponse, GetSessionInfoRequest, GetSessionInfoResponse, GetSessionMessagesRequest, GetSessionMessagesResponse, HappyMcpCanonicalToolName, HappyMcpToolActionMode, HappyProfileEnvKey, InboxCategory, InboxItemSummary, InboxNewItem, InboxSeverity, InboxUnreadCount, KnowledgeAction, KnowledgeChainEntry, KnowledgeChainRelation, KnowledgeChainResponse, KnowledgeConfidence, KnowledgeContributorType, KnowledgeEntryType, KnowledgeInjectionMode, KnowledgeInjectionRequest, KnowledgeInjectionResponse, KnowledgeStatus, LegacyMessageContent, ListSessionsRequest, ListSessionsResponse, LiveKitTokenResponse, MachineMetadata, McpCallRequest, McpCallResponse, McpRegistry, McpRegistryEntry, McpTransportConfig, MessageContent, MessageMeta, ProjectProfile, QueryKnowledgeParams, ReadFileRequest, ReadFileResponse, ReconnectMcpServerRequest, ReconnectMcpServerResponse, RemoveMcpServerRequest, RemoveMcpServerResponse, RenameSessionRequest, RenameSessionResponse, ResolvedRuntimeProfile, RuntimeProfileSource, RuntimeProfileTrust, SdkSessionInfo, SessionContextUsageEvent, SessionEnvelope, SessionEvent, SessionEventCreated, SessionEventReport, SessionEventSummary, SessionEventType, SessionMessage, SessionMessageContent, SessionModelUsage, SessionProgressList, SessionProgressState, SessionProgressTodo, SessionProgressTodoStatus, SessionProtocolMessage, SessionRole, SessionSummaryRefreshActiveRequest, SessionSummaryRefreshRecentEntry, SessionSummaryRefreshState, SessionSummaryState, SessionTurnEndStatus, SetColorRequest, SetColorResponse, SetMcpServersRequest, SetMcpServersResponse, SkillContent, SkillSummary, TailscaleInfo, TailscaleServeEntry, TaskOutcome, TaskPriority, TaskStatus, TaskStatusChanged, TaskStatusReport, TaskSummary, TaskTriggerData, TaskTriggerType, TerminalCloseRequest, TerminalExitPayload, TerminalInputPayload, TerminalOutputPayload, TerminalResizeRequest, TerminalSpawnRequest, TerminalSpawnResponse, ToggleMcpServerRequest, ToggleMcpServerResponse, TunnelEntry, TunnelProviderInfo, TunnelState, TurnKnowledgeExtraction, Update, UpdateBody, UpdateKnowledgeEntryBody, UpdateMachineBody, UpdateNewMessageBody, UpdateSessionBody, UpdateSkillBody, UserMessage, VersionedEncryptedValue, VersionedMachineEncryptedValue, VersionedNullableEncryptedValue, VoiceTokenResponse };
4341
+ export { AIBackendProfileSchema, AddMcpServerRequestSchema, AddMcpServerResponseSchema, AgentLoopSummarySchema, AgentMessageSchema, AnthropicConfigSchema, ApiMessageSchema, ApiUpdateMachineStateSchema, ApiUpdateNewMessageSchema, ApiUpdateSessionStateSchema, ApplySettingsRequestSchema, ApplySettingsResponseSchema, AutoDreamProfileSummarySchema, AutomationAuditEventSummarySchema, AutomationAuditStatsSchema, AutomationCountsSchema, AutomationGuardianSummarySchema, AutomationGuardianUsageSummarySchema, AutomationJobKindSchema, AutomationJobStatusSchema, AutomationJobSummarySchema, AutomationPrioritySchema, AutomationStateSchema, AzureOpenAIConfigSchema, BUILT_IN_AI_BACKEND_PROFILE_IDS, BootstrapProfileSummarySchema, BriefMessageSchema, BuiltInAIBackendProfileIdSchema, CLAUDE_CONTROL_METHODS, CLAUDE_CONTROL_SCOPE, 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, DeleteSessionRequestSchema, DeleteSessionResponseSchema, EnvironmentVariableSchema, GetBinaryVersionRequestSchema, GetBinaryVersionResponseSchema, GetContextDetailRequestSchema, GetContextDetailResponseSchema, GetContextUsageRequestSchema, GetContextUsageResponseSchema, GetMcpServersRequestSchema, GetMcpServersResponseSchema, GetSessionCostRequestSchema, GetSessionCostResponseSchema, GetSessionInfoRequestSchema, GetSessionInfoResponseSchema, GetSessionMessagesRequestSchema, GetSessionMessagesResponseSchema, HAPPY_MCP_AUTO_APPROVE_TOOL_NAMES, HAPPY_MCP_SILENT_SUCCESS_TOOL_NAMES, HAPPY_MCP_TOOL_NAMES, HAPPY_MCP_TOOL_SPECS, HAPPY_PROFILE_ENV_KEYS, InboxCategorySchema, InboxItemSummarySchema, InboxNewItemSchema, InboxSeveritySchema, InboxUnreadCountSchema, KnowledgeActionSchema, KnowledgeChainEntrySchema, KnowledgeChainRelationSchema, KnowledgeChainResponseSchema, KnowledgeConfidenceSchema, KnowledgeContributorTypeSchema, KnowledgeEntryTypeSchema, KnowledgeInjectionModeSchema, KnowledgeInjectionRequestSchema, KnowledgeInjectionResponseSchema, KnowledgeStatusSchema, LegacyMessageContentSchema, ListSessionsRequestSchema, ListSessionsResponseSchema, LiveKitTokenResponseSchema, MCP_REGISTRY_KV_KEY, MachineMetadataSchema, McpCallRequestSchema, McpCallResponseSchema, McpRegistryEntrySchema, McpRegistrySchema, McpSseConfigSchema, McpStdioConfigSchema, McpStreamableHttpConfigSchema, McpTransportConfigSchema, McpUrlConfigSchema, MessageContentSchema, MessageMetaSchema, OpenAIConfigSchema, ProfileCompatibilitySchema, ProjectProfileSchema, QueryKnowledgeParamsSchema, RESOLVED_RUNTIME_PROFILE_SCHEMA_VERSION, ReadFileRequestSchema, ReadFileResponseSchema, ReconnectMcpServerRequestSchema, ReconnectMcpServerResponseSchema, RemoveMcpServerRequestSchema, RemoveMcpServerResponseSchema, RenameSessionRequestSchema, RenameSessionResponseSchema, ResolvedRuntimeProfileSchema, RuntimeProfileSourceSchema, RuntimeProfileTrustSchema, SdkSessionInfoSchema, SessionEventCreatedSchema, SessionEventReportSchema, SessionEventSummarySchema, SessionEventTypeSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, SetColorRequestSchema, SetColorResponseSchema, SetMcpServersRequestSchema, SetMcpServersResponseSchema, SkillContentSchema, SkillSummarySchema, TailscaleInfoSchema, TailscaleServeEntrySchema, TaskOutcomeSchema, TaskPrioritySchema, TaskStatusChangedSchema, TaskStatusReportSchema, TaskStatusSchema, TaskSummarySchema, TaskTriggerDataSchema, TaskTriggerTypeSchema, TmuxConfigSchema, TogetherAIConfigSchema, ToggleMcpServerRequestSchema, ToggleMcpServerResponseSchema, TunnelEntrySchema, TunnelProviderInfoSchema, TunnelStateSchema, TurnKnowledgeExtractionSchema, UpdateBodySchema, UpdateKnowledgeEntryBodySchema, UpdateMachineBodySchema, UpdateNewMessageBodySchema, UpdateSchema, UpdateSessionBodySchema, UpdateSkillBodySchema, UserMessageSchema, VersionedEncryptedValueSchema, VersionedMachineEncryptedValueSchema, VersionedNullableEncryptedValueSchema, VoiceTokenAllowedSchema, VoiceTokenDeniedSchema, VoiceTokenResponseSchema, createEmptyMcpRegistry, createEnvelope, createResolvedRuntimeProfile, getBuiltInAIBackendProfile, getHappyMcpToolAction, getHappyMcpToolAliases, getHappyMcpToolTitle, getProfileEnvironmentVariables, isCodexAppServerBackend, isCodexLegacyBackend, isHappyMcpToolAlias, isHappyMcpToolName, isTailscaleNotFound, isTrustedRuntimeProfile, normalizeHappyMcpToolName, normalizeResolvedRuntimeProfile, parseMcpRegistry, parseTailscaleServeStatus, parseTailscaleStatus, registryToSdkConfig, resolveCodexResolvedBackend, resolveCodexResumableThreadId, resolveRequestedCodexBackend, sessionContextUsageCategorySchema, sessionContextUsageEventSchema, sessionEnvelopeSchema, sessionEventSchema, sessionFileEventSchema, sessionModelUsageSchema, sessionNeedsContinueEventSchema, sessionProgressListSchema, sessionProgressStateSchema, sessionProgressTodoSchema, sessionProgressTodoStatusSchema, sessionPromptSuggestionEventSchema, sessionRateLimitEventSchema, sessionRoleSchema, sessionServiceMessageEventSchema, sessionStartEventSchema, sessionStateChangedEventSchema, sessionStopEventSchema, sessionSummaryRefreshActiveRequestSchema, sessionSummaryRefreshRecentEntrySchema, sessionSummaryRefreshStateSchema, sessionSummaryStateSchema, sessionTaskEndEventSchema, sessionTaskLogEventSchema, sessionTaskProgressEventSchema, sessionTaskStartEventSchema, sessionTaskUpdatedEventSchema, sessionTextDeltaEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionToolProgressEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, sessionUsageUpdateEventSchema, shouldAutoApproveHappyMcpReason, shouldAutoApproveHappyMcpToolName, shouldHideSuccessfulHappyMcpTool, terminalCloseRequestSchema, terminalExitPayloadSchema, terminalInputPayloadSchema, terminalOutputPayloadSchema, terminalResizeRequestSchema, terminalSpawnRequestSchema, terminalSpawnResponseSchema, validateProfileForAgent };
4342
+ export type { AIBackendProfile, AddMcpServerRequest, AddMcpServerResponse, AgentLoopSummary, AgentMessage, ApiMessage, ApiUpdateMachineState, ApiUpdateNewMessage, ApiUpdateSessionState, ApplySettingsRequest, ApplySettingsResponse, AutoDreamProfileSummary, AutomationAuditEventSummary, AutomationAuditStats, AutomationCounts, AutomationGuardianSummary, AutomationGuardianUsageSummary, AutomationJobKind, AutomationJobStatus, AutomationJobSummary, AutomationPriority, AutomationState, BootstrapProfileSummary, BriefMessage, BuiltInAIBackendProfileId, ClaudeControlMethod, CliInstallInfo, CliInstallSource, CodexAccount, CodexAgentSummary, CodexBackendMode, CodexConfigMode, CodexExperimentalFeature, CodexMcpServerSummary, CodexMetadata, CodexPromptSummary, CodexRateLimits, CodexRequestedBackend, CodexResolvedBackend, CodexRuntimeConfig, CodexSkillSummary, CoreUpdateBody, CoreUpdateContainer, CreateEnvelopeOptions, CreateKnowledgeEntryBody, CreateSkillBody, CreateTaskBody, CrossProjectSearchResponse, CrossProjectSearchResult, DaemonState, DeleteSessionRequest, DeleteSessionResponse, GetBinaryVersionRequest, GetBinaryVersionResponse, GetContextDetailRequest, GetContextDetailResponse, GetContextUsageRequest, GetContextUsageResponse, GetMcpServersRequest, GetMcpServersResponse, GetSessionCostRequest, GetSessionCostResponse, GetSessionInfoRequest, GetSessionInfoResponse, GetSessionMessagesRequest, GetSessionMessagesResponse, HappyMcpCanonicalToolName, HappyMcpToolActionMode, HappyProfileEnvKey, InboxCategory, InboxItemSummary, InboxNewItem, InboxSeverity, InboxUnreadCount, KnowledgeAction, KnowledgeChainEntry, KnowledgeChainRelation, KnowledgeChainResponse, KnowledgeConfidence, KnowledgeContributorType, KnowledgeEntryType, KnowledgeInjectionMode, KnowledgeInjectionRequest, KnowledgeInjectionResponse, KnowledgeStatus, LegacyMessageContent, ListSessionsRequest, ListSessionsResponse, LiveKitTokenResponse, MachineMetadata, McpCallRequest, McpCallResponse, McpRegistry, McpRegistryEntry, McpTransportConfig, MessageContent, MessageMeta, ProjectProfile, QueryKnowledgeParams, ReadFileRequest, ReadFileResponse, ReconnectMcpServerRequest, ReconnectMcpServerResponse, RemoveMcpServerRequest, RemoveMcpServerResponse, RenameSessionRequest, RenameSessionResponse, ResolvedRuntimeProfile, RuntimeProfileSource, RuntimeProfileTrust, SdkSessionInfo, SessionContextUsageEvent, SessionEnvelope, SessionEvent, SessionEventCreated, SessionEventReport, SessionEventSummary, SessionEventType, SessionMessage, SessionMessageContent, SessionModelUsage, SessionProgressList, SessionProgressState, SessionProgressTodo, SessionProgressTodoStatus, SessionProtocolMessage, SessionRole, SessionSummaryRefreshActiveRequest, SessionSummaryRefreshRecentEntry, SessionSummaryRefreshState, SessionSummaryState, SessionTurnEndStatus, SetColorRequest, SetColorResponse, SetMcpServersRequest, SetMcpServersResponse, SkillContent, SkillSummary, TailscaleInfo, TailscaleServeEntry, TailscaleStatus, TaskOutcome, TaskPriority, TaskStatus, TaskStatusChanged, TaskStatusReport, TaskSummary, TaskTriggerData, TaskTriggerType, TerminalCloseRequest, TerminalExitPayload, TerminalInputPayload, TerminalOutputPayload, TerminalResizeRequest, TerminalSpawnRequest, TerminalSpawnResponse, ToggleMcpServerRequest, ToggleMcpServerResponse, TunnelEntry, TunnelProviderInfo, TunnelState, TurnKnowledgeExtraction, Update, UpdateBody, UpdateKnowledgeEntryBody, UpdateMachineBody, UpdateNewMessageBody, UpdateSessionBody, UpdateSkillBody, UserMessage, VersionedEncryptedValue, VersionedMachineEncryptedValue, VersionedNullableEncryptedValue, VoiceTokenResponse };
package/dist/index.mjs CHANGED
@@ -613,6 +613,73 @@ const DaemonStateSchema = z.object({
613
613
  killed: z.boolean().optional()
614
614
  });
615
615
 
616
+ const DISCONNECTED = Object.freeze({ status: "disconnected" });
617
+ function parseTailscaleStatus(raw, log) {
618
+ let json;
619
+ try {
620
+ json = JSON.parse(raw);
621
+ } catch {
622
+ log?.("[TAILSCALE] failed to parse status JSON");
623
+ return DISCONNECTED;
624
+ }
625
+ const backendState = json.BackendState;
626
+ if (backendState && backendState !== "Running") {
627
+ log?.(`[TAILSCALE] backend state: ${backendState}`);
628
+ return DISCONNECTED;
629
+ }
630
+ const self = json.Self;
631
+ if (!self) {
632
+ log?.("[TAILSCALE] no Self node in status output");
633
+ return DISCONNECTED;
634
+ }
635
+ const ips = self.TailscaleIPs ?? [];
636
+ const ipv4 = ips.find((ip) => ip.includes("."));
637
+ const ipv6 = ips.find((ip) => ip.includes(":"));
638
+ const dnsName = self.DNSName;
639
+ const hostname = dnsName?.replace(/\.$/, "").split(".")[0];
640
+ const tailnetName = dnsName ? dnsName.replace(/\.$/, "").split(".").slice(1).join(".") : void 0;
641
+ const version = json.Version;
642
+ log?.(`[TAILSCALE] detected: ipv4=${ipv4 ?? "none"}, hostname=${hostname ?? "none"}`);
643
+ return {
644
+ status: "connected",
645
+ ipv4,
646
+ ipv6,
647
+ hostname,
648
+ tailnetName,
649
+ version
650
+ };
651
+ }
652
+ function parseTailscaleServeStatus(raw, log) {
653
+ let json;
654
+ try {
655
+ json = JSON.parse(raw);
656
+ } catch {
657
+ log?.("[TAILSCALE] failed to parse serve status JSON");
658
+ return [];
659
+ }
660
+ const web = json.Web ?? {};
661
+ const allowFunnel = json.AllowFunnel ?? {};
662
+ const entries = [];
663
+ for (const [hostPort, config] of Object.entries(web)) {
664
+ const colonIdx = hostPort.lastIndexOf(":");
665
+ if (colonIdx === -1) continue;
666
+ const hostname = hostPort.slice(0, colonIdx);
667
+ const port = parseInt(hostPort.slice(colonIdx + 1), 10);
668
+ if (!Number.isFinite(port)) continue;
669
+ const handlers = config.Handlers ?? {};
670
+ const funnel = allowFunnel[hostPort] === true;
671
+ for (const [path, handler] of Object.entries(handlers)) {
672
+ const target = handler?.Proxy ?? "unknown";
673
+ entries.push({ port, path, protocol: "HTTPS", target, funnel, hostname });
674
+ }
675
+ }
676
+ log?.(`[TAILSCALE] detected ${entries.length} serve entries`);
677
+ return entries;
678
+ }
679
+ function isTailscaleNotFound(err) {
680
+ return typeof err === "object" && err !== null && "code" in err && err.code === "ENOENT";
681
+ }
682
+
616
683
  const KnowledgeEntryTypeSchema = z.enum([
617
684
  "discovery",
618
685
  // New insight or finding
@@ -2086,11 +2153,13 @@ const McpCallResponseSchema = z$1.object({
2086
2153
  "invalid_arguments",
2087
2154
  "permission_denied",
2088
2155
  /**
2089
- * SDK 0.2.119 defines the `mcp_call` control protocol type but does
2090
- * not expose a public runtime method on the `Query` interface. Until
2091
- * upstream lands a `callMcpTool()` / equivalent, the CLI handler
2092
- * returns this code so the App can surface an honest "waiting on
2093
- * SDK" state instead of masking the gap as a server error.
2156
+ * The agent runtime has no programmatic MCP-tool invocation surface.
2157
+ * In PTY mode the Claude TUI owns the MCP connections itself; the
2158
+ * historical Claude Agent SDK also never exposed a runtime
2159
+ * `callMcpTool()` on `Query`. The CLI handler returns this code so
2160
+ * the App can surface an honest "not supported" state instead of
2161
+ * masking the gap as a server error. Code name preserved for wire
2162
+ * compatibility across older CLI / App builds.
2094
2163
  */
2095
2164
  "sdk_not_implemented",
2096
2165
  "unknown"
@@ -2477,4 +2546,4 @@ function parseMcpRegistry(raw) {
2477
2546
  }
2478
2547
  }
2479
2548
 
2480
- export { AIBackendProfileSchema, AddMcpServerRequestSchema, AddMcpServerResponseSchema, AgentLoopSummarySchema, AgentMessageSchema, AnthropicConfigSchema, ApiMessageSchema, ApiUpdateMachineStateSchema, ApiUpdateNewMessageSchema, ApiUpdateSessionStateSchema, ApplySettingsRequestSchema, ApplySettingsResponseSchema, AutoDreamProfileSummarySchema, AutomationAuditEventSummarySchema, AutomationAuditStatsSchema, AutomationCountsSchema, AutomationGuardianSummarySchema, AutomationGuardianUsageSummarySchema, AutomationJobKindSchema, AutomationJobStatusSchema, AutomationJobSummarySchema, AutomationPrioritySchema, AutomationStateSchema, AzureOpenAIConfigSchema, BUILT_IN_AI_BACKEND_PROFILE_IDS, BootstrapProfileSummarySchema, BriefMessageSchema, BuiltInAIBackendProfileIdSchema, CLAUDE_CONTROL_METHODS, CLAUDE_CONTROL_SCOPE, 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, DeleteSessionRequestSchema, DeleteSessionResponseSchema, EnvironmentVariableSchema, GetBinaryVersionRequestSchema, GetBinaryVersionResponseSchema, GetContextDetailRequestSchema, GetContextDetailResponseSchema, GetContextUsageRequestSchema, GetContextUsageResponseSchema, GetMcpServersRequestSchema, GetMcpServersResponseSchema, GetSessionCostRequestSchema, GetSessionCostResponseSchema, GetSessionInfoRequestSchema, GetSessionInfoResponseSchema, GetSessionMessagesRequestSchema, GetSessionMessagesResponseSchema, HAPPY_MCP_AUTO_APPROVE_TOOL_NAMES, HAPPY_MCP_SILENT_SUCCESS_TOOL_NAMES, HAPPY_MCP_TOOL_NAMES, HAPPY_MCP_TOOL_SPECS, HAPPY_PROFILE_ENV_KEYS, InboxCategorySchema, InboxItemSummarySchema, InboxNewItemSchema, InboxSeveritySchema, InboxUnreadCountSchema, KnowledgeActionSchema, KnowledgeChainEntrySchema, KnowledgeChainRelationSchema, KnowledgeChainResponseSchema, KnowledgeConfidenceSchema, KnowledgeContributorTypeSchema, KnowledgeEntryTypeSchema, KnowledgeInjectionModeSchema, KnowledgeInjectionRequestSchema, KnowledgeInjectionResponseSchema, KnowledgeStatusSchema, LegacyMessageContentSchema, ListSessionsRequestSchema, ListSessionsResponseSchema, LiveKitTokenResponseSchema, MCP_REGISTRY_KV_KEY, MachineMetadataSchema, McpCallRequestSchema, McpCallResponseSchema, McpRegistryEntrySchema, McpRegistrySchema, McpSseConfigSchema, McpStdioConfigSchema, McpStreamableHttpConfigSchema, McpTransportConfigSchema, McpUrlConfigSchema, MessageContentSchema, MessageMetaSchema, OpenAIConfigSchema, ProfileCompatibilitySchema, ProjectProfileSchema, QueryKnowledgeParamsSchema, RESOLVED_RUNTIME_PROFILE_SCHEMA_VERSION, ReadFileRequestSchema, ReadFileResponseSchema, ReconnectMcpServerRequestSchema, ReconnectMcpServerResponseSchema, RemoveMcpServerRequestSchema, RemoveMcpServerResponseSchema, RenameSessionRequestSchema, RenameSessionResponseSchema, ResolvedRuntimeProfileSchema, RuntimeProfileSourceSchema, RuntimeProfileTrustSchema, SdkSessionInfoSchema, SessionEventCreatedSchema, SessionEventReportSchema, SessionEventSummarySchema, SessionEventTypeSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, SetColorRequestSchema, SetColorResponseSchema, SetMcpServersRequestSchema, SetMcpServersResponseSchema, SkillContentSchema, SkillSummarySchema, TailscaleInfoSchema, TailscaleServeEntrySchema, TaskOutcomeSchema, TaskPrioritySchema, TaskStatusChangedSchema, TaskStatusReportSchema, TaskStatusSchema, TaskSummarySchema, TaskTriggerDataSchema, TaskTriggerTypeSchema, TmuxConfigSchema, TogetherAIConfigSchema, ToggleMcpServerRequestSchema, ToggleMcpServerResponseSchema, TunnelEntrySchema, TunnelProviderInfoSchema, TunnelStateSchema, TurnKnowledgeExtractionSchema, UpdateBodySchema, UpdateKnowledgeEntryBodySchema, UpdateMachineBodySchema, UpdateNewMessageBodySchema, UpdateSchema, UpdateSessionBodySchema, UpdateSkillBodySchema, UserMessageSchema, VersionedEncryptedValueSchema, VersionedMachineEncryptedValueSchema, VersionedNullableEncryptedValueSchema, VoiceTokenAllowedSchema, VoiceTokenDeniedSchema, VoiceTokenResponseSchema, createEmptyMcpRegistry, createEnvelope, createResolvedRuntimeProfile, getBuiltInAIBackendProfile, getHappyMcpToolAction, getHappyMcpToolAliases, getHappyMcpToolTitle, getProfileEnvironmentVariables, isCodexAppServerBackend, isCodexLegacyBackend, isHappyMcpToolAlias, isHappyMcpToolName, isTrustedRuntimeProfile, normalizeHappyMcpToolName, normalizeResolvedRuntimeProfile, parseMcpRegistry, registryToSdkConfig, resolveCodexResolvedBackend, resolveCodexResumableThreadId, resolveRequestedCodexBackend, sessionContextUsageCategorySchema, sessionContextUsageEventSchema, sessionEnvelopeSchema, sessionEventSchema, sessionFileEventSchema, sessionModelUsageSchema, sessionNeedsContinueEventSchema, sessionProgressListSchema, sessionProgressStateSchema, sessionProgressTodoSchema, sessionProgressTodoStatusSchema, sessionPromptSuggestionEventSchema, sessionRateLimitEventSchema, sessionRoleSchema, sessionServiceMessageEventSchema, sessionStartEventSchema, sessionStateChangedEventSchema, sessionStopEventSchema, sessionSummaryRefreshActiveRequestSchema, sessionSummaryRefreshRecentEntrySchema, sessionSummaryRefreshStateSchema, sessionSummaryStateSchema, sessionTaskEndEventSchema, sessionTaskLogEventSchema, sessionTaskProgressEventSchema, sessionTaskStartEventSchema, sessionTaskUpdatedEventSchema, sessionTextDeltaEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionToolProgressEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, sessionUsageUpdateEventSchema, shouldAutoApproveHappyMcpReason, shouldAutoApproveHappyMcpToolName, shouldHideSuccessfulHappyMcpTool, terminalCloseRequestSchema, terminalExitPayloadSchema, terminalInputPayloadSchema, terminalOutputPayloadSchema, terminalResizeRequestSchema, terminalSpawnRequestSchema, terminalSpawnResponseSchema, validateProfileForAgent };
2549
+ export { AIBackendProfileSchema, AddMcpServerRequestSchema, AddMcpServerResponseSchema, AgentLoopSummarySchema, AgentMessageSchema, AnthropicConfigSchema, ApiMessageSchema, ApiUpdateMachineStateSchema, ApiUpdateNewMessageSchema, ApiUpdateSessionStateSchema, ApplySettingsRequestSchema, ApplySettingsResponseSchema, AutoDreamProfileSummarySchema, AutomationAuditEventSummarySchema, AutomationAuditStatsSchema, AutomationCountsSchema, AutomationGuardianSummarySchema, AutomationGuardianUsageSummarySchema, AutomationJobKindSchema, AutomationJobStatusSchema, AutomationJobSummarySchema, AutomationPrioritySchema, AutomationStateSchema, AzureOpenAIConfigSchema, BUILT_IN_AI_BACKEND_PROFILE_IDS, BootstrapProfileSummarySchema, BriefMessageSchema, BuiltInAIBackendProfileIdSchema, CLAUDE_CONTROL_METHODS, CLAUDE_CONTROL_SCOPE, 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, DeleteSessionRequestSchema, DeleteSessionResponseSchema, EnvironmentVariableSchema, GetBinaryVersionRequestSchema, GetBinaryVersionResponseSchema, GetContextDetailRequestSchema, GetContextDetailResponseSchema, GetContextUsageRequestSchema, GetContextUsageResponseSchema, GetMcpServersRequestSchema, GetMcpServersResponseSchema, GetSessionCostRequestSchema, GetSessionCostResponseSchema, GetSessionInfoRequestSchema, GetSessionInfoResponseSchema, GetSessionMessagesRequestSchema, GetSessionMessagesResponseSchema, HAPPY_MCP_AUTO_APPROVE_TOOL_NAMES, HAPPY_MCP_SILENT_SUCCESS_TOOL_NAMES, HAPPY_MCP_TOOL_NAMES, HAPPY_MCP_TOOL_SPECS, HAPPY_PROFILE_ENV_KEYS, InboxCategorySchema, InboxItemSummarySchema, InboxNewItemSchema, InboxSeveritySchema, InboxUnreadCountSchema, KnowledgeActionSchema, KnowledgeChainEntrySchema, KnowledgeChainRelationSchema, KnowledgeChainResponseSchema, KnowledgeConfidenceSchema, KnowledgeContributorTypeSchema, KnowledgeEntryTypeSchema, KnowledgeInjectionModeSchema, KnowledgeInjectionRequestSchema, KnowledgeInjectionResponseSchema, KnowledgeStatusSchema, LegacyMessageContentSchema, ListSessionsRequestSchema, ListSessionsResponseSchema, LiveKitTokenResponseSchema, MCP_REGISTRY_KV_KEY, MachineMetadataSchema, McpCallRequestSchema, McpCallResponseSchema, McpRegistryEntrySchema, McpRegistrySchema, McpSseConfigSchema, McpStdioConfigSchema, McpStreamableHttpConfigSchema, McpTransportConfigSchema, McpUrlConfigSchema, MessageContentSchema, MessageMetaSchema, OpenAIConfigSchema, ProfileCompatibilitySchema, ProjectProfileSchema, QueryKnowledgeParamsSchema, RESOLVED_RUNTIME_PROFILE_SCHEMA_VERSION, ReadFileRequestSchema, ReadFileResponseSchema, ReconnectMcpServerRequestSchema, ReconnectMcpServerResponseSchema, RemoveMcpServerRequestSchema, RemoveMcpServerResponseSchema, RenameSessionRequestSchema, RenameSessionResponseSchema, ResolvedRuntimeProfileSchema, RuntimeProfileSourceSchema, RuntimeProfileTrustSchema, SdkSessionInfoSchema, SessionEventCreatedSchema, SessionEventReportSchema, SessionEventSummarySchema, SessionEventTypeSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, SetColorRequestSchema, SetColorResponseSchema, SetMcpServersRequestSchema, SetMcpServersResponseSchema, SkillContentSchema, SkillSummarySchema, TailscaleInfoSchema, TailscaleServeEntrySchema, TaskOutcomeSchema, TaskPrioritySchema, TaskStatusChangedSchema, TaskStatusReportSchema, TaskStatusSchema, TaskSummarySchema, TaskTriggerDataSchema, TaskTriggerTypeSchema, TmuxConfigSchema, TogetherAIConfigSchema, ToggleMcpServerRequestSchema, ToggleMcpServerResponseSchema, TunnelEntrySchema, TunnelProviderInfoSchema, TunnelStateSchema, TurnKnowledgeExtractionSchema, UpdateBodySchema, UpdateKnowledgeEntryBodySchema, UpdateMachineBodySchema, UpdateNewMessageBodySchema, UpdateSchema, UpdateSessionBodySchema, UpdateSkillBodySchema, UserMessageSchema, VersionedEncryptedValueSchema, VersionedMachineEncryptedValueSchema, VersionedNullableEncryptedValueSchema, VoiceTokenAllowedSchema, VoiceTokenDeniedSchema, VoiceTokenResponseSchema, createEmptyMcpRegistry, createEnvelope, createResolvedRuntimeProfile, getBuiltInAIBackendProfile, getHappyMcpToolAction, getHappyMcpToolAliases, getHappyMcpToolTitle, getProfileEnvironmentVariables, isCodexAppServerBackend, isCodexLegacyBackend, isHappyMcpToolAlias, isHappyMcpToolName, isTailscaleNotFound, isTrustedRuntimeProfile, normalizeHappyMcpToolName, normalizeResolvedRuntimeProfile, parseMcpRegistry, parseTailscaleServeStatus, parseTailscaleStatus, registryToSdkConfig, resolveCodexResolvedBackend, resolveCodexResumableThreadId, resolveRequestedCodexBackend, sessionContextUsageCategorySchema, sessionContextUsageEventSchema, sessionEnvelopeSchema, sessionEventSchema, sessionFileEventSchema, sessionModelUsageSchema, sessionNeedsContinueEventSchema, sessionProgressListSchema, sessionProgressStateSchema, sessionProgressTodoSchema, sessionProgressTodoStatusSchema, sessionPromptSuggestionEventSchema, sessionRateLimitEventSchema, sessionRoleSchema, sessionServiceMessageEventSchema, sessionStartEventSchema, sessionStateChangedEventSchema, sessionStopEventSchema, sessionSummaryRefreshActiveRequestSchema, sessionSummaryRefreshRecentEntrySchema, sessionSummaryRefreshStateSchema, sessionSummaryStateSchema, sessionTaskEndEventSchema, sessionTaskLogEventSchema, sessionTaskProgressEventSchema, sessionTaskStartEventSchema, sessionTaskUpdatedEventSchema, 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.21.0",
3
+ "version": "0.22.1",
4
4
  "description": "Shared message wire types and Zod schemas for Happy clients and services",
5
5
  "author": "kmmao",
6
6
  "license": "MIT",