@kmmao/happy-wire 0.13.2 → 0.16.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.mjs CHANGED
@@ -253,7 +253,16 @@ const MessageMetaSchema = z.object({
253
253
  * an assistant turn. Requires @anthropic-ai/claude-agent-sdk 0.2.110+ on CLI.
254
254
  * Defaults to true when unset (normal turn-triggering message).
255
255
  */
256
- shouldQuery: z.boolean().optional()
256
+ shouldQuery: z.boolean().optional(),
257
+ /**
258
+ * Worktree context for sessions running in a git worktree branch.
259
+ * Injected by the CLI when the session directory is inside a git worktree.
260
+ * Used by the server to enrich push notification titles with branch info.
261
+ */
262
+ worktree: z.object({
263
+ branch: z.string(),
264
+ path: z.string().optional()
265
+ }).optional()
257
266
  });
258
267
 
259
268
  const UserMessageSchema = z.object({
@@ -765,261 +774,6 @@ const VoiceTokenResponseSchema = z.discriminatedUnion("allowed", [
765
774
  VoiceTokenDeniedSchema
766
775
  ]);
767
776
 
768
- const TaskPrioritySchema = z.enum([
769
- "urgent",
770
- // User-initiated, needs immediate execution
771
- "user",
772
- // Normal user-created task (default)
773
- "background"
774
- // Automated / scheduled tasks
775
- ]);
776
- const TaskStatusSchema = z.enum([
777
- "queued",
778
- // Waiting in queue
779
- "dispatching",
780
- // Being sent to CLI daemon
781
- "running",
782
- // Executing on CLI
783
- "completed",
784
- // Finished successfully
785
- "failed",
786
- // Execution failed
787
- "cancelled"
788
- // Cancelled by user
789
- ]);
790
- const TaskTriggerTypeSchema = z.enum([
791
- "manual",
792
- // Created from App by user
793
- "cron",
794
- // Created by TriggerSchedule
795
- "webhook"
796
- // Created by WebhookTrigger
797
- ]);
798
- const TaskSummarySchema = z.object({
799
- id: z.string(),
800
- projectId: z.string().nullable(),
801
- machineId: z.string(),
802
- priority: TaskPrioritySchema,
803
- status: TaskStatusSchema,
804
- triggerType: TaskTriggerTypeSchema,
805
- triggerRef: z.string().optional(),
806
- attempt: z.number(),
807
- maxAttempts: z.number(),
808
- sessionId: z.string().optional(),
809
- errorMessage: z.string().optional(),
810
- dispatchedAt: z.number().optional(),
811
- completedAt: z.number().optional(),
812
- createdAt: z.number(),
813
- updatedAt: z.number(),
814
- // Encrypted prompt preview (first 100 chars)
815
- promptPreview: z.string().optional(),
816
- // Names of bound skills for display
817
- skillNames: z.array(z.string()).optional()
818
- });
819
- const CreateTaskBodySchema = z.object({
820
- projectId: z.string().optional(),
821
- machineId: z.string(),
822
- prompt: z.string().min(1),
823
- // Encrypted by App
824
- priority: TaskPrioritySchema.default("user"),
825
- maxAttempts: z.number().int().min(1).max(10).default(3),
826
- skillIds: z.array(z.string()).max(10).default([])
827
- });
828
- const TaskTriggerDataSchema = z.object({
829
- type: z.literal("task-trigger"),
830
- taskId: z.string(),
831
- prompt: z.string(),
832
- // Encrypted prompt
833
- directory: z.string(),
834
- // Project directory on machine
835
- priority: TaskPrioritySchema,
836
- projectId: z.string().optional(),
837
- resultToken: z.string().optional(),
838
- skillContents: z.array(z.object({
839
- name: z.string(),
840
- content: z.string()
841
- })).optional(),
842
- agentType: z.string().nullable().optional(),
843
- // "claude" | "codex" | "gemini" — null = inherit CLI default
844
- modelOverride: z.string().nullable().optional()
845
- // e.g. "claude-sonnet-4-20250514" — null = agent default
846
- });
847
- const TaskOutcomeSchema = z.enum([
848
- "completed",
849
- "failed",
850
- "blocked"
851
- ]);
852
- const TaskStatusReportSchema = z.object({
853
- taskId: z.string(),
854
- status: TaskStatusSchema,
855
- outcome: TaskOutcomeSchema.optional(),
856
- sessionId: z.string().optional(),
857
- errorMessage: z.string().optional()
858
- });
859
- const TaskStatusChangedSchema = z.object({
860
- type: z.literal("task-status-changed"),
861
- taskId: z.string(),
862
- machineId: z.string().optional(),
863
- status: TaskStatusSchema,
864
- sessionId: z.string().optional(),
865
- errorMessage: z.string().optional(),
866
- completedAt: z.number().optional()
867
- });
868
-
869
- const SkillSummarySchema = z.object({
870
- id: z.string(),
871
- projectId: z.string().nullable(),
872
- name: z.string(),
873
- description: z.string().optional(),
874
- content: z.string(),
875
- attachments: z.array(z.string()),
876
- sourceKnowledgeId: z.string().optional(),
877
- archived: z.boolean(),
878
- createdAt: z.number(),
879
- updatedAt: z.number()
880
- });
881
- const CreateSkillBodySchema = z.object({
882
- projectId: z.string().optional(),
883
- name: z.string().min(1).max(100),
884
- description: z.string().max(500).optional(),
885
- content: z.string().min(1).max(5e4),
886
- attachments: z.array(z.string()).max(10).default([]),
887
- sourceKnowledgeId: z.string().optional()
888
- });
889
- const UpdateSkillBodySchema = z.object({
890
- name: z.string().min(1).max(100).optional(),
891
- description: z.string().max(500).optional(),
892
- content: z.string().min(1).max(5e4).optional(),
893
- attachments: z.array(z.string()).max(10).optional(),
894
- archived: z.boolean().optional()
895
- });
896
- const SkillContentSchema = z.object({
897
- name: z.string(),
898
- content: z.string()
899
- });
900
-
901
- const InboxCategorySchema = z.enum([
902
- "task",
903
- // Task queue events (completed, failed, cancelled)
904
- "trigger",
905
- // Cron/webhook trigger fired
906
- "supervisor",
907
- // Supervisor run results
908
- "session",
909
- // Session lifecycle events
910
- "knowledge",
911
- // Knowledge base changes
912
- "system"
913
- // System notifications
914
- ]);
915
- const InboxSeveritySchema = z.enum([
916
- "info",
917
- "warning",
918
- "error"
919
- ]);
920
- const InboxItemSummarySchema = z.object({
921
- id: z.string(),
922
- category: InboxCategorySchema,
923
- eventType: z.string(),
924
- // e.g. "task.completed", "trigger.cron.fired"
925
- severity: InboxSeveritySchema,
926
- title: z.string(),
927
- body: z.string().optional(),
928
- read: z.boolean(),
929
- referenceUrl: z.string().optional(),
930
- // Deep link, e.g. "/machine/xxx/tasks"
931
- refType: z.string().optional(),
932
- // Polymorphic ref: "task" | "trigger" | "session" | ...
933
- refId: z.string().optional(),
934
- // ID of referenced entity
935
- groupKey: z.string().optional(),
936
- // Dedup key (same source within 1h → skip)
937
- createdAt: z.number()
938
- });
939
- const InboxNewItemSchema = z.object({
940
- type: z.literal("inbox-new-item"),
941
- item: InboxItemSummarySchema
942
- });
943
- const InboxUnreadCountSchema = z.object({
944
- type: z.literal("inbox-unread-count"),
945
- count: z.number()
946
- });
947
-
948
- const SessionEventTypeSchema = z.enum([
949
- "file_edit",
950
- // File created/modified/deleted
951
- "bash_command",
952
- // Shell command executed
953
- "tool_call",
954
- // Tool invocation (Read, Grep, etc.)
955
- "git_operation",
956
- // Git commit, push, branch, etc.
957
- "error",
958
- // Error occurred during session
959
- "session_start",
960
- // Session started
961
- "session_end"
962
- // Session ended
963
- ]);
964
- const SessionEventSummarySchema = z.object({
965
- id: z.string(),
966
- sessionId: z.string(),
967
- eventType: SessionEventTypeSchema,
968
- summary: z.string(),
969
- // Human-readable one-liner
970
- detail: z.record(z.string(), z.unknown()).optional(),
971
- // Structured metadata (JSON)
972
- createdAt: z.number()
973
- });
974
- const SessionEventReportSchema = z.object({
975
- sessionId: z.string(),
976
- eventType: SessionEventTypeSchema,
977
- summary: z.string().max(500),
978
- detail: z.record(z.string(), z.unknown()).optional()
979
- });
980
- const SessionEventCreatedSchema = z.object({
981
- type: z.literal("session-event-created"),
982
- event: SessionEventSummarySchema
983
- });
984
-
985
- const terminalSpawnRequestSchema = z.object({
986
- /** Shell to use (defaults to user's default shell) */
987
- shell: z.string().optional(),
988
- /** Working directory */
989
- cwd: z.string().optional(),
990
- /** Initial terminal dimensions */
991
- cols: z.number().int().min(1).max(500).optional(),
992
- rows: z.number().int().min(1).max(200).optional()
993
- });
994
- const terminalSpawnResponseSchema = z.object({
995
- success: z.boolean(),
996
- terminalId: z.string().optional(),
997
- error: z.string().optional()
998
- });
999
- const terminalResizeRequestSchema = z.object({
1000
- terminalId: z.string(),
1001
- cols: z.number().int().min(1).max(500),
1002
- rows: z.number().int().min(1).max(200)
1003
- });
1004
- const terminalCloseRequestSchema = z.object({
1005
- terminalId: z.string()
1006
- });
1007
- const terminalInputPayloadSchema = z.object({
1008
- machineId: z.string(),
1009
- terminalId: z.string(),
1010
- data: z.string()
1011
- });
1012
- const terminalOutputPayloadSchema = z.object({
1013
- machineId: z.string(),
1014
- terminalId: z.string(),
1015
- data: z.string()
1016
- });
1017
- const terminalExitPayloadSchema = z.object({
1018
- machineId: z.string(),
1019
- terminalId: z.string(),
1020
- exitCode: z.number()
1021
- });
1022
-
1023
777
  const CODEX_APP_SERVER_BACKEND = "codex-app-server";
1024
778
  const CODEX_MCP_LEGACY_BACKEND = "codex-mcp-legacy";
1025
779
  const CodexBackendModeSchema = z.enum([
@@ -1614,6 +1368,285 @@ function isTrustedRuntimeProfile(runtimeProfile) {
1614
1368
  return runtimeProfile?.trust === "trusted";
1615
1369
  }
1616
1370
 
1371
+ const TaskPrioritySchema = z.enum([
1372
+ "urgent",
1373
+ // User-initiated, needs immediate execution
1374
+ "user",
1375
+ // Normal user-created task (default)
1376
+ "background"
1377
+ // Automated / scheduled tasks
1378
+ ]);
1379
+ const TaskStatusSchema = z.enum([
1380
+ "queued",
1381
+ // Waiting in queue
1382
+ "dispatching",
1383
+ // Being sent to CLI daemon
1384
+ "running",
1385
+ // Executing on CLI
1386
+ "completed",
1387
+ // Finished successfully
1388
+ "failed",
1389
+ // Execution failed
1390
+ "cancelled"
1391
+ // Cancelled by user
1392
+ ]);
1393
+ const TaskTriggerTypeSchema = z.enum([
1394
+ "manual",
1395
+ // Created from App by user
1396
+ "cron",
1397
+ // Created by TriggerSchedule
1398
+ "webhook"
1399
+ // Created by WebhookTrigger
1400
+ ]);
1401
+ const TaskSummarySchema = z.object({
1402
+ id: z.string(),
1403
+ projectId: z.string().nullable(),
1404
+ machineId: z.string(),
1405
+ priority: TaskPrioritySchema,
1406
+ status: TaskStatusSchema,
1407
+ triggerType: TaskTriggerTypeSchema,
1408
+ triggerRef: z.string().optional(),
1409
+ attempt: z.number(),
1410
+ maxAttempts: z.number(),
1411
+ sessionId: z.string().optional(),
1412
+ errorMessage: z.string().optional(),
1413
+ dispatchedAt: z.number().optional(),
1414
+ completedAt: z.number().optional(),
1415
+ createdAt: z.number(),
1416
+ updatedAt: z.number(),
1417
+ // Encrypted prompt preview (first 100 chars)
1418
+ promptPreview: z.string().optional(),
1419
+ // Names of bound skills for display
1420
+ skillNames: z.array(z.string()).optional()
1421
+ });
1422
+ const CreateTaskBodySchema = z.object({
1423
+ projectId: z.string().optional(),
1424
+ machineId: z.string(),
1425
+ prompt: z.string().min(1),
1426
+ // Encrypted by App
1427
+ priority: TaskPrioritySchema.default("user"),
1428
+ maxAttempts: z.number().int().min(1).max(10).default(3),
1429
+ skillIds: z.array(z.string()).max(10).default([]),
1430
+ // Profile binding (wire 0.15.0). Business key — built-in id like
1431
+ // "anthropic" or AiBackendProfile.profileKey for the account. Optional:
1432
+ // when omitted the server falls back to Project.supervisorConfig.defaultProfileId
1433
+ // via the unified runtimeProfileResolver (feature-flagged).
1434
+ profileId: z.string().optional()
1435
+ });
1436
+ const TaskTriggerDataSchema = z.object({
1437
+ type: z.literal("task-trigger"),
1438
+ taskId: z.string(),
1439
+ prompt: z.string(),
1440
+ // Encrypted prompt
1441
+ directory: z.string(),
1442
+ // Project directory on machine
1443
+ priority: TaskPrioritySchema,
1444
+ projectId: z.string().optional(),
1445
+ resultToken: z.string().optional(),
1446
+ skillContents: z.array(z.object({
1447
+ name: z.string(),
1448
+ content: z.string()
1449
+ })).optional(),
1450
+ agentType: z.string().nullable().optional(),
1451
+ // "claude" | "codex" | "gemini" — null = inherit CLI default
1452
+ modelOverride: z.string().nullable().optional(),
1453
+ // e.g. "claude-sonnet-4-20250514" — null = agent default
1454
+ // Profile binding for this task. `profileId` references the AIBackendProfile
1455
+ // selected when the task was created (Task.profileId column). `runtimeProfile`
1456
+ // is the resolved snapshot (env vars, startup script, permission mode, etc.)
1457
+ // that the CLI should honor when spawning the session. Both optional for
1458
+ // backward compatibility; starting from wire 0.14.0 + server unified resolver
1459
+ // these are always populated for scheduled/webhook/manual tasks.
1460
+ profileId: z.string().optional(),
1461
+ runtimeProfile: ResolvedRuntimeProfileSchema.optional()
1462
+ });
1463
+ const TaskOutcomeSchema = z.enum([
1464
+ "completed",
1465
+ "failed",
1466
+ "blocked"
1467
+ ]);
1468
+ const TaskStatusReportSchema = z.object({
1469
+ taskId: z.string(),
1470
+ status: TaskStatusSchema,
1471
+ outcome: TaskOutcomeSchema.optional(),
1472
+ sessionId: z.string().optional(),
1473
+ errorMessage: z.string().optional()
1474
+ });
1475
+ const TaskStatusChangedSchema = z.object({
1476
+ type: z.literal("task-status-changed"),
1477
+ taskId: z.string(),
1478
+ machineId: z.string().optional(),
1479
+ status: TaskStatusSchema,
1480
+ sessionId: z.string().optional(),
1481
+ errorMessage: z.string().optional(),
1482
+ completedAt: z.number().optional()
1483
+ });
1484
+
1485
+ const SkillSummarySchema = z.object({
1486
+ id: z.string(),
1487
+ projectId: z.string().nullable(),
1488
+ name: z.string(),
1489
+ description: z.string().optional(),
1490
+ content: z.string(),
1491
+ attachments: z.array(z.string()),
1492
+ sourceKnowledgeId: z.string().optional(),
1493
+ archived: z.boolean(),
1494
+ createdAt: z.number(),
1495
+ updatedAt: z.number()
1496
+ });
1497
+ const CreateSkillBodySchema = z.object({
1498
+ projectId: z.string().optional(),
1499
+ name: z.string().min(1).max(100),
1500
+ description: z.string().max(500).optional(),
1501
+ content: z.string().min(1).max(5e4),
1502
+ attachments: z.array(z.string()).max(10).default([]),
1503
+ sourceKnowledgeId: z.string().optional()
1504
+ });
1505
+ const UpdateSkillBodySchema = z.object({
1506
+ name: z.string().min(1).max(100).optional(),
1507
+ description: z.string().max(500).optional(),
1508
+ content: z.string().min(1).max(5e4).optional(),
1509
+ attachments: z.array(z.string()).max(10).optional(),
1510
+ archived: z.boolean().optional()
1511
+ });
1512
+ const SkillContentSchema = z.object({
1513
+ name: z.string(),
1514
+ content: z.string()
1515
+ });
1516
+
1517
+ const InboxCategorySchema = z.enum([
1518
+ "task",
1519
+ // Task queue events (completed, failed, cancelled)
1520
+ "trigger",
1521
+ // Cron/webhook trigger fired
1522
+ "supervisor",
1523
+ // Supervisor run results
1524
+ "session",
1525
+ // Session lifecycle events
1526
+ "knowledge",
1527
+ // Knowledge base changes
1528
+ "system"
1529
+ // System notifications
1530
+ ]);
1531
+ const InboxSeveritySchema = z.enum([
1532
+ "info",
1533
+ "warning",
1534
+ "error"
1535
+ ]);
1536
+ const InboxItemSummarySchema = z.object({
1537
+ id: z.string(),
1538
+ category: InboxCategorySchema,
1539
+ eventType: z.string(),
1540
+ // e.g. "task.completed", "trigger.cron.fired"
1541
+ severity: InboxSeveritySchema,
1542
+ title: z.string(),
1543
+ body: z.string().optional(),
1544
+ read: z.boolean(),
1545
+ referenceUrl: z.string().optional(),
1546
+ // Deep link, e.g. "/machine/xxx/tasks"
1547
+ refType: z.string().optional(),
1548
+ // Polymorphic ref: "task" | "trigger" | "session" | ...
1549
+ refId: z.string().optional(),
1550
+ // ID of referenced entity
1551
+ groupKey: z.string().optional(),
1552
+ // Dedup key (same source within 1h → skip)
1553
+ createdAt: z.number()
1554
+ });
1555
+ const InboxNewItemSchema = z.object({
1556
+ type: z.literal("inbox-new-item"),
1557
+ item: InboxItemSummarySchema
1558
+ });
1559
+ const InboxUnreadCountSchema = z.object({
1560
+ type: z.literal("inbox-unread-count"),
1561
+ count: z.number()
1562
+ });
1563
+
1564
+ const SessionEventTypeSchema = z.enum([
1565
+ "file_edit",
1566
+ // File created/modified/deleted
1567
+ "bash_command",
1568
+ // Shell command executed
1569
+ "tool_call",
1570
+ // Tool invocation (Read, Grep, etc.)
1571
+ "git_operation",
1572
+ // Git commit, push, branch, etc.
1573
+ "error",
1574
+ // Error occurred during session
1575
+ "session_start",
1576
+ // Session started
1577
+ "session_end"
1578
+ // Session ended
1579
+ ]);
1580
+ const SessionEventSummarySchema = z.object({
1581
+ id: z.string(),
1582
+ sessionId: z.string(),
1583
+ eventType: SessionEventTypeSchema,
1584
+ summary: z.string(),
1585
+ // Human-readable one-liner
1586
+ detail: z.record(z.string(), z.unknown()).optional(),
1587
+ // Structured metadata (JSON)
1588
+ createdAt: z.number()
1589
+ });
1590
+ const SessionEventReportSchema = z.object({
1591
+ sessionId: z.string(),
1592
+ eventType: SessionEventTypeSchema,
1593
+ summary: z.string().max(500),
1594
+ detail: z.record(z.string(), z.unknown()).optional()
1595
+ });
1596
+ const SessionEventCreatedSchema = z.object({
1597
+ type: z.literal("session-event-created"),
1598
+ event: SessionEventSummarySchema
1599
+ });
1600
+
1601
+ const terminalSpawnRequestSchema = z.object({
1602
+ /** Shell to use (defaults to user's default shell) */
1603
+ shell: z.string().optional(),
1604
+ /** Working directory */
1605
+ cwd: z.string().optional(),
1606
+ /** Initial terminal dimensions */
1607
+ cols: z.number().int().min(1).max(500).optional(),
1608
+ rows: z.number().int().min(1).max(200).optional()
1609
+ });
1610
+ const terminalSpawnResponseSchema = z.object({
1611
+ success: z.boolean(),
1612
+ terminalId: z.string().optional(),
1613
+ error: z.string().optional()
1614
+ });
1615
+ const terminalResizeRequestSchema = z.object({
1616
+ terminalId: z.string(),
1617
+ cols: z.number().int().min(1).max(500),
1618
+ rows: z.number().int().min(1).max(200)
1619
+ });
1620
+ const terminalCloseRequestSchema = z.object({
1621
+ terminalId: z.string()
1622
+ });
1623
+ const terminalInputPayloadSchema = z.object({
1624
+ machineId: z.string(),
1625
+ terminalId: z.string(),
1626
+ data: z.string()
1627
+ });
1628
+ const terminalOutputPayloadSchema = z.object({
1629
+ machineId: z.string(),
1630
+ terminalId: z.string(),
1631
+ data: z.string()
1632
+ });
1633
+ const terminalExitPayloadSchema = z.object({
1634
+ machineId: z.string(),
1635
+ terminalId: z.string(),
1636
+ exitCode: z.number()
1637
+ });
1638
+
1639
+ const HAPPY_PROFILE_ENV_KEYS = {
1640
+ /** `"true" | "false"` — toggle Claude extended thinking */
1641
+ claudeThinkingEnabled: "HAPPY_CLAUDE_THINKING_ENABLED",
1642
+ /** integer as string — Claude extended thinking budget tokens */
1643
+ claudeThinkingBudgetTokens: "HAPPY_CLAUDE_THINKING_BUDGET_TOKENS",
1644
+ /** integer as string — max conversation turns before stop */
1645
+ maxTurns: "HAPPY_MAX_TURNS",
1646
+ /** DefaultPermissionMode literal — permission mode override */
1647
+ permissionMode: "HAPPY_PERMISSION_MODE"
1648
+ };
1649
+
1617
1650
  const sessionProgressTodoStatusSchema = z.enum([
1618
1651
  "pending",
1619
1652
  "in_progress",
@@ -1935,4 +1968,96 @@ const CodexMetadataSchema = z.object({
1935
1968
  mcpServers: z.array(CodexMcpServerSummarySchema).optional()
1936
1969
  });
1937
1970
 
1938
- 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, sessionSummaryRefreshActiveRequestSchema, sessionSummaryRefreshRecentEntrySchema, sessionSummaryRefreshStateSchema, 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 };
1971
+ const CLAUDE_CONTROL_SCOPE = "claude-control";
1972
+ const GetSessionCostRequestSchema = z$1.object({}).strict();
1973
+ const GetSessionCostResponseSchema = z$1.object({
1974
+ /** Pre-formatted single-line summary (same text `/usage` prints in non-interactive mode). */
1975
+ formatted: z$1.string(),
1976
+ /** Total USD spent on this session so far. */
1977
+ totalUsd: z$1.number().nonnegative(),
1978
+ /** Optional breakdown by model. */
1979
+ byModel: z$1.record(z$1.string(), z$1.object({
1980
+ inputTokens: z$1.number().int().nonnegative(),
1981
+ outputTokens: z$1.number().int().nonnegative(),
1982
+ cacheCreationInputTokens: z$1.number().int().nonnegative().optional(),
1983
+ cacheReadInputTokens: z$1.number().int().nonnegative().optional(),
1984
+ costUsd: z$1.number().nonnegative()
1985
+ })).optional()
1986
+ }).strict();
1987
+ const GetBinaryVersionRequestSchema = z$1.object({}).strict();
1988
+ const GetBinaryVersionResponseSchema = z$1.object({
1989
+ /** Remote Claude Code binary version string, e.g. "2.1.119". */
1990
+ version: z$1.string(),
1991
+ /** Path to the binary if resolvable, informational only. */
1992
+ binaryPath: z$1.string().optional(),
1993
+ /** Happy-cli package version for context. */
1994
+ happyCliVersion: z$1.string().optional()
1995
+ }).strict();
1996
+ const SetColorRequestSchema = z$1.object({
1997
+ /** Agent color name or the literal "default" to reset. */
1998
+ color: z$1.string().min(1).max(64)
1999
+ }).strict();
2000
+ const SetColorResponseSchema = z$1.object({
2001
+ success: z$1.literal(true),
2002
+ color: z$1.string()
2003
+ }).strict();
2004
+ const ReadFileRequestSchema = z$1.object({
2005
+ /** Path relative to cwd or absolute. CLI applies path blacklist + Read-tool permission gating. */
2006
+ path: z$1.string().min(1).max(4096),
2007
+ /** Optional max bytes to return; server-side hard cap enforces <= 1 MiB. */
2008
+ maxBytes: z$1.number().int().positive().max(1024 * 1024).optional()
2009
+ }).strict();
2010
+ const ReadFileResponseSchema = z$1.object({
2011
+ /** Null when permission denied / missing / blocked by CLI path blacklist. */
2012
+ result: z$1.object({
2013
+ contents: z$1.string(),
2014
+ absPath: z$1.string(),
2015
+ truncated: z$1.boolean().optional()
2016
+ }).nullable(),
2017
+ /** Machine-readable reason when result is null. */
2018
+ deniedReason: z$1.enum(["not_found", "permission_denied", "blacklisted_path", "too_large", "error"]).optional()
2019
+ }).strict();
2020
+ const McpCallRequestSchema = z$1.object({
2021
+ /** Fully-qualified MCP tool name, e.g. `mcp__fs__read`. Must pass CLI whitelist. */
2022
+ tool: z$1.string().regex(/^mcp__[a-z0-9_-]+__[a-z0-9_.-]+$/i, "must be of form mcp__<server>__<tool>"),
2023
+ /** Tool arguments; schema-free, CLI passes through to MCP server. */
2024
+ arguments: z$1.record(z$1.string(), z$1.unknown()).optional(),
2025
+ /**
2026
+ * Client-nonce that App must have displayed to the user in a 2-step
2027
+ * confirm dialog. CLI uses this only for audit logging — the actual
2028
+ * confirmation happens on App side and is logged for security review.
2029
+ */
2030
+ clientConfirmToken: z$1.string().min(8).max(128)
2031
+ }).strict();
2032
+ const McpCallResponseSchema = z$1.object({
2033
+ success: z$1.boolean(),
2034
+ /** Tool response payload, shape defined by each MCP tool. */
2035
+ result: z$1.unknown().optional(),
2036
+ /** Error code for UI to localize; see CLI handler for enum values. */
2037
+ errorCode: z$1.enum([
2038
+ "not_whitelisted",
2039
+ "server_unavailable",
2040
+ "tool_not_found",
2041
+ "invalid_arguments",
2042
+ "permission_denied",
2043
+ /**
2044
+ * SDK 0.2.119 defines the `mcp_call` control protocol type but does
2045
+ * not expose a public runtime method on the `Query` interface. Until
2046
+ * upstream lands a `callMcpTool()` / equivalent, the CLI handler
2047
+ * returns this code so the App can surface an honest "waiting on
2048
+ * SDK" state instead of masking the gap as a server error.
2049
+ */
2050
+ "sdk_not_implemented",
2051
+ "unknown"
2052
+ ]).optional(),
2053
+ errorMessage: z$1.string().optional()
2054
+ }).strict();
2055
+ const CLAUDE_CONTROL_METHODS = [
2056
+ "get_session_cost",
2057
+ "get_binary_version",
2058
+ "set_color",
2059
+ "read_file",
2060
+ "mcp_call"
2061
+ ];
2062
+
2063
+ 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, 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, EnvironmentVariableSchema, GetBinaryVersionRequestSchema, GetBinaryVersionResponseSchema, GetSessionCostRequestSchema, GetSessionCostResponseSchema, 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, MachineMetadataSchema, McpCallRequestSchema, McpCallResponseSchema, MessageContentSchema, MessageMetaSchema, OpenAIConfigSchema, ProfileCompatibilitySchema, ProjectProfileSchema, QueryKnowledgeParamsSchema, RESOLVED_RUNTIME_PROFILE_SCHEMA_VERSION, ReadFileRequestSchema, ReadFileResponseSchema, ResolvedRuntimeProfileSchema, RuntimeProfileSourceSchema, RuntimeProfileTrustSchema, SessionEventCreatedSchema, SessionEventReportSchema, SessionEventSummarySchema, SessionEventTypeSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, SetColorRequestSchema, SetColorResponseSchema, 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, sessionSummaryRefreshActiveRequestSchema, sessionSummaryRefreshRecentEntrySchema, sessionSummaryRefreshStateSchema, 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.13.2",
3
+ "version": "0.16.1",
4
4
  "description": "Shared message wire types and Zod schemas for Happy clients and services",
5
5
  "author": "kmmao",
6
6
  "license": "MIT",