@kmmao/happy-wire 0.13.1 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -785,261 +785,6 @@ const VoiceTokenResponseSchema = z__namespace.discriminatedUnion("allowed", [
785
785
  VoiceTokenDeniedSchema
786
786
  ]);
787
787
 
788
- const TaskPrioritySchema = z__namespace.enum([
789
- "urgent",
790
- // User-initiated, needs immediate execution
791
- "user",
792
- // Normal user-created task (default)
793
- "background"
794
- // Automated / scheduled tasks
795
- ]);
796
- const TaskStatusSchema = z__namespace.enum([
797
- "queued",
798
- // Waiting in queue
799
- "dispatching",
800
- // Being sent to CLI daemon
801
- "running",
802
- // Executing on CLI
803
- "completed",
804
- // Finished successfully
805
- "failed",
806
- // Execution failed
807
- "cancelled"
808
- // Cancelled by user
809
- ]);
810
- const TaskTriggerTypeSchema = z__namespace.enum([
811
- "manual",
812
- // Created from App by user
813
- "cron",
814
- // Created by TriggerSchedule
815
- "webhook"
816
- // Created by WebhookTrigger
817
- ]);
818
- const TaskSummarySchema = z__namespace.object({
819
- id: z__namespace.string(),
820
- projectId: z__namespace.string().nullable(),
821
- machineId: z__namespace.string(),
822
- priority: TaskPrioritySchema,
823
- status: TaskStatusSchema,
824
- triggerType: TaskTriggerTypeSchema,
825
- triggerRef: z__namespace.string().optional(),
826
- attempt: z__namespace.number(),
827
- maxAttempts: z__namespace.number(),
828
- sessionId: z__namespace.string().optional(),
829
- errorMessage: z__namespace.string().optional(),
830
- dispatchedAt: z__namespace.number().optional(),
831
- completedAt: z__namespace.number().optional(),
832
- createdAt: z__namespace.number(),
833
- updatedAt: z__namespace.number(),
834
- // Encrypted prompt preview (first 100 chars)
835
- promptPreview: z__namespace.string().optional(),
836
- // Names of bound skills for display
837
- skillNames: z__namespace.array(z__namespace.string()).optional()
838
- });
839
- const CreateTaskBodySchema = z__namespace.object({
840
- projectId: z__namespace.string().optional(),
841
- machineId: z__namespace.string(),
842
- prompt: z__namespace.string().min(1),
843
- // Encrypted by App
844
- priority: TaskPrioritySchema.default("user"),
845
- maxAttempts: z__namespace.number().int().min(1).max(10).default(3),
846
- skillIds: z__namespace.array(z__namespace.string()).max(10).default([])
847
- });
848
- const TaskTriggerDataSchema = z__namespace.object({
849
- type: z__namespace.literal("task-trigger"),
850
- taskId: z__namespace.string(),
851
- prompt: z__namespace.string(),
852
- // Encrypted prompt
853
- directory: z__namespace.string(),
854
- // Project directory on machine
855
- priority: TaskPrioritySchema,
856
- projectId: z__namespace.string().optional(),
857
- resultToken: z__namespace.string().optional(),
858
- skillContents: z__namespace.array(z__namespace.object({
859
- name: z__namespace.string(),
860
- content: z__namespace.string()
861
- })).optional(),
862
- agentType: z__namespace.string().nullable().optional(),
863
- // "claude" | "codex" | "gemini" — null = inherit CLI default
864
- modelOverride: z__namespace.string().nullable().optional()
865
- // e.g. "claude-sonnet-4-20250514" — null = agent default
866
- });
867
- const TaskOutcomeSchema = z__namespace.enum([
868
- "completed",
869
- "failed",
870
- "blocked"
871
- ]);
872
- const TaskStatusReportSchema = z__namespace.object({
873
- taskId: z__namespace.string(),
874
- status: TaskStatusSchema,
875
- outcome: TaskOutcomeSchema.optional(),
876
- sessionId: z__namespace.string().optional(),
877
- errorMessage: z__namespace.string().optional()
878
- });
879
- const TaskStatusChangedSchema = z__namespace.object({
880
- type: z__namespace.literal("task-status-changed"),
881
- taskId: z__namespace.string(),
882
- machineId: z__namespace.string().optional(),
883
- status: TaskStatusSchema,
884
- sessionId: z__namespace.string().optional(),
885
- errorMessage: z__namespace.string().optional(),
886
- completedAt: z__namespace.number().optional()
887
- });
888
-
889
- const SkillSummarySchema = z__namespace.object({
890
- id: z__namespace.string(),
891
- projectId: z__namespace.string().nullable(),
892
- name: z__namespace.string(),
893
- description: z__namespace.string().optional(),
894
- content: z__namespace.string(),
895
- attachments: z__namespace.array(z__namespace.string()),
896
- sourceKnowledgeId: z__namespace.string().optional(),
897
- archived: z__namespace.boolean(),
898
- createdAt: z__namespace.number(),
899
- updatedAt: z__namespace.number()
900
- });
901
- const CreateSkillBodySchema = z__namespace.object({
902
- projectId: z__namespace.string().optional(),
903
- name: z__namespace.string().min(1).max(100),
904
- description: z__namespace.string().max(500).optional(),
905
- content: z__namespace.string().min(1).max(5e4),
906
- attachments: z__namespace.array(z__namespace.string()).max(10).default([]),
907
- sourceKnowledgeId: z__namespace.string().optional()
908
- });
909
- const UpdateSkillBodySchema = z__namespace.object({
910
- name: z__namespace.string().min(1).max(100).optional(),
911
- description: z__namespace.string().max(500).optional(),
912
- content: z__namespace.string().min(1).max(5e4).optional(),
913
- attachments: z__namespace.array(z__namespace.string()).max(10).optional(),
914
- archived: z__namespace.boolean().optional()
915
- });
916
- const SkillContentSchema = z__namespace.object({
917
- name: z__namespace.string(),
918
- content: z__namespace.string()
919
- });
920
-
921
- const InboxCategorySchema = z__namespace.enum([
922
- "task",
923
- // Task queue events (completed, failed, cancelled)
924
- "trigger",
925
- // Cron/webhook trigger fired
926
- "supervisor",
927
- // Supervisor run results
928
- "session",
929
- // Session lifecycle events
930
- "knowledge",
931
- // Knowledge base changes
932
- "system"
933
- // System notifications
934
- ]);
935
- const InboxSeveritySchema = z__namespace.enum([
936
- "info",
937
- "warning",
938
- "error"
939
- ]);
940
- const InboxItemSummarySchema = z__namespace.object({
941
- id: z__namespace.string(),
942
- category: InboxCategorySchema,
943
- eventType: z__namespace.string(),
944
- // e.g. "task.completed", "trigger.cron.fired"
945
- severity: InboxSeveritySchema,
946
- title: z__namespace.string(),
947
- body: z__namespace.string().optional(),
948
- read: z__namespace.boolean(),
949
- referenceUrl: z__namespace.string().optional(),
950
- // Deep link, e.g. "/machine/xxx/tasks"
951
- refType: z__namespace.string().optional(),
952
- // Polymorphic ref: "task" | "trigger" | "session" | ...
953
- refId: z__namespace.string().optional(),
954
- // ID of referenced entity
955
- groupKey: z__namespace.string().optional(),
956
- // Dedup key (same source within 1h → skip)
957
- createdAt: z__namespace.number()
958
- });
959
- const InboxNewItemSchema = z__namespace.object({
960
- type: z__namespace.literal("inbox-new-item"),
961
- item: InboxItemSummarySchema
962
- });
963
- const InboxUnreadCountSchema = z__namespace.object({
964
- type: z__namespace.literal("inbox-unread-count"),
965
- count: z__namespace.number()
966
- });
967
-
968
- const SessionEventTypeSchema = z__namespace.enum([
969
- "file_edit",
970
- // File created/modified/deleted
971
- "bash_command",
972
- // Shell command executed
973
- "tool_call",
974
- // Tool invocation (Read, Grep, etc.)
975
- "git_operation",
976
- // Git commit, push, branch, etc.
977
- "error",
978
- // Error occurred during session
979
- "session_start",
980
- // Session started
981
- "session_end"
982
- // Session ended
983
- ]);
984
- const SessionEventSummarySchema = z__namespace.object({
985
- id: z__namespace.string(),
986
- sessionId: z__namespace.string(),
987
- eventType: SessionEventTypeSchema,
988
- summary: z__namespace.string(),
989
- // Human-readable one-liner
990
- detail: z__namespace.record(z__namespace.string(), z__namespace.unknown()).optional(),
991
- // Structured metadata (JSON)
992
- createdAt: z__namespace.number()
993
- });
994
- const SessionEventReportSchema = z__namespace.object({
995
- sessionId: z__namespace.string(),
996
- eventType: SessionEventTypeSchema,
997
- summary: z__namespace.string().max(500),
998
- detail: z__namespace.record(z__namespace.string(), z__namespace.unknown()).optional()
999
- });
1000
- const SessionEventCreatedSchema = z__namespace.object({
1001
- type: z__namespace.literal("session-event-created"),
1002
- event: SessionEventSummarySchema
1003
- });
1004
-
1005
- const terminalSpawnRequestSchema = z__namespace.object({
1006
- /** Shell to use (defaults to user's default shell) */
1007
- shell: z__namespace.string().optional(),
1008
- /** Working directory */
1009
- cwd: z__namespace.string().optional(),
1010
- /** Initial terminal dimensions */
1011
- cols: z__namespace.number().int().min(1).max(500).optional(),
1012
- rows: z__namespace.number().int().min(1).max(200).optional()
1013
- });
1014
- const terminalSpawnResponseSchema = z__namespace.object({
1015
- success: z__namespace.boolean(),
1016
- terminalId: z__namespace.string().optional(),
1017
- error: z__namespace.string().optional()
1018
- });
1019
- const terminalResizeRequestSchema = z__namespace.object({
1020
- terminalId: z__namespace.string(),
1021
- cols: z__namespace.number().int().min(1).max(500),
1022
- rows: z__namespace.number().int().min(1).max(200)
1023
- });
1024
- const terminalCloseRequestSchema = z__namespace.object({
1025
- terminalId: z__namespace.string()
1026
- });
1027
- const terminalInputPayloadSchema = z__namespace.object({
1028
- machineId: z__namespace.string(),
1029
- terminalId: z__namespace.string(),
1030
- data: z__namespace.string()
1031
- });
1032
- const terminalOutputPayloadSchema = z__namespace.object({
1033
- machineId: z__namespace.string(),
1034
- terminalId: z__namespace.string(),
1035
- data: z__namespace.string()
1036
- });
1037
- const terminalExitPayloadSchema = z__namespace.object({
1038
- machineId: z__namespace.string(),
1039
- terminalId: z__namespace.string(),
1040
- exitCode: z__namespace.number()
1041
- });
1042
-
1043
788
  const CODEX_APP_SERVER_BACKEND = "codex-app-server";
1044
789
  const CODEX_MCP_LEGACY_BACKEND = "codex-mcp-legacy";
1045
790
  const CodexBackendModeSchema = z__namespace.enum([
@@ -1330,15 +1075,15 @@ function getBuiltInAIBackendProfile(id) {
1330
1075
  case "openai":
1331
1076
  return {
1332
1077
  id: "openai",
1333
- name: "OpenAI (GPT-5.4)",
1078
+ name: "OpenAI (GPT-5.5)",
1334
1079
  openaiConfig: {},
1335
1080
  environmentVariables: [
1336
1081
  { name: "OPENAI_BASE_URL", value: "https://api.openai.com/v1" },
1337
- { name: "OPENAI_MODEL", value: "gpt-5.4" },
1082
+ { name: "OPENAI_MODEL", value: "gpt-5.5" },
1338
1083
  { name: "OPENAI_API_TIMEOUT_MS", value: "600000" },
1339
- { name: "OPENAI_SMALL_FAST_MODEL", value: "gpt-5.4" },
1084
+ { name: "OPENAI_SMALL_FAST_MODEL", value: "gpt-5.4-mini" },
1340
1085
  { name: "API_TIMEOUT_MS", value: "600000" },
1341
- { name: "CODEX_SMALL_FAST_MODEL", value: "gpt-5.4" }
1086
+ { name: "CODEX_SMALL_FAST_MODEL", value: "gpt-5.4-mini" }
1342
1087
  ],
1343
1088
  compatibility: { claude: false, codex: true, gemini: false },
1344
1089
  isBuiltIn: true,
@@ -1634,9 +1379,288 @@ function isTrustedRuntimeProfile(runtimeProfile) {
1634
1379
  return runtimeProfile?.trust === "trusted";
1635
1380
  }
1636
1381
 
1637
- const sessionProgressTodoStatusSchema = z__namespace.enum([
1638
- "pending",
1639
- "in_progress",
1382
+ const TaskPrioritySchema = z__namespace.enum([
1383
+ "urgent",
1384
+ // User-initiated, needs immediate execution
1385
+ "user",
1386
+ // Normal user-created task (default)
1387
+ "background"
1388
+ // Automated / scheduled tasks
1389
+ ]);
1390
+ const TaskStatusSchema = z__namespace.enum([
1391
+ "queued",
1392
+ // Waiting in queue
1393
+ "dispatching",
1394
+ // Being sent to CLI daemon
1395
+ "running",
1396
+ // Executing on CLI
1397
+ "completed",
1398
+ // Finished successfully
1399
+ "failed",
1400
+ // Execution failed
1401
+ "cancelled"
1402
+ // Cancelled by user
1403
+ ]);
1404
+ const TaskTriggerTypeSchema = z__namespace.enum([
1405
+ "manual",
1406
+ // Created from App by user
1407
+ "cron",
1408
+ // Created by TriggerSchedule
1409
+ "webhook"
1410
+ // Created by WebhookTrigger
1411
+ ]);
1412
+ const TaskSummarySchema = z__namespace.object({
1413
+ id: z__namespace.string(),
1414
+ projectId: z__namespace.string().nullable(),
1415
+ machineId: z__namespace.string(),
1416
+ priority: TaskPrioritySchema,
1417
+ status: TaskStatusSchema,
1418
+ triggerType: TaskTriggerTypeSchema,
1419
+ triggerRef: z__namespace.string().optional(),
1420
+ attempt: z__namespace.number(),
1421
+ maxAttempts: z__namespace.number(),
1422
+ sessionId: z__namespace.string().optional(),
1423
+ errorMessage: z__namespace.string().optional(),
1424
+ dispatchedAt: z__namespace.number().optional(),
1425
+ completedAt: z__namespace.number().optional(),
1426
+ createdAt: z__namespace.number(),
1427
+ updatedAt: z__namespace.number(),
1428
+ // Encrypted prompt preview (first 100 chars)
1429
+ promptPreview: z__namespace.string().optional(),
1430
+ // Names of bound skills for display
1431
+ skillNames: z__namespace.array(z__namespace.string()).optional()
1432
+ });
1433
+ const CreateTaskBodySchema = z__namespace.object({
1434
+ projectId: z__namespace.string().optional(),
1435
+ machineId: z__namespace.string(),
1436
+ prompt: z__namespace.string().min(1),
1437
+ // Encrypted by App
1438
+ priority: TaskPrioritySchema.default("user"),
1439
+ maxAttempts: z__namespace.number().int().min(1).max(10).default(3),
1440
+ skillIds: z__namespace.array(z__namespace.string()).max(10).default([]),
1441
+ // Profile binding (wire 0.15.0). Business key — built-in id like
1442
+ // "anthropic" or AiBackendProfile.profileKey for the account. Optional:
1443
+ // when omitted the server falls back to Project.supervisorConfig.defaultProfileId
1444
+ // via the unified runtimeProfileResolver (feature-flagged).
1445
+ profileId: z__namespace.string().optional()
1446
+ });
1447
+ const TaskTriggerDataSchema = z__namespace.object({
1448
+ type: z__namespace.literal("task-trigger"),
1449
+ taskId: z__namespace.string(),
1450
+ prompt: z__namespace.string(),
1451
+ // Encrypted prompt
1452
+ directory: z__namespace.string(),
1453
+ // Project directory on machine
1454
+ priority: TaskPrioritySchema,
1455
+ projectId: z__namespace.string().optional(),
1456
+ resultToken: z__namespace.string().optional(),
1457
+ skillContents: z__namespace.array(z__namespace.object({
1458
+ name: z__namespace.string(),
1459
+ content: z__namespace.string()
1460
+ })).optional(),
1461
+ agentType: z__namespace.string().nullable().optional(),
1462
+ // "claude" | "codex" | "gemini" — null = inherit CLI default
1463
+ modelOverride: z__namespace.string().nullable().optional(),
1464
+ // e.g. "claude-sonnet-4-20250514" — null = agent default
1465
+ // Profile binding for this task. `profileId` references the AIBackendProfile
1466
+ // selected when the task was created (Task.profileId column). `runtimeProfile`
1467
+ // is the resolved snapshot (env vars, startup script, permission mode, etc.)
1468
+ // that the CLI should honor when spawning the session. Both optional for
1469
+ // backward compatibility; starting from wire 0.14.0 + server unified resolver
1470
+ // these are always populated for scheduled/webhook/manual tasks.
1471
+ profileId: z__namespace.string().optional(),
1472
+ runtimeProfile: ResolvedRuntimeProfileSchema.optional()
1473
+ });
1474
+ const TaskOutcomeSchema = z__namespace.enum([
1475
+ "completed",
1476
+ "failed",
1477
+ "blocked"
1478
+ ]);
1479
+ const TaskStatusReportSchema = z__namespace.object({
1480
+ taskId: z__namespace.string(),
1481
+ status: TaskStatusSchema,
1482
+ outcome: TaskOutcomeSchema.optional(),
1483
+ sessionId: z__namespace.string().optional(),
1484
+ errorMessage: z__namespace.string().optional()
1485
+ });
1486
+ const TaskStatusChangedSchema = z__namespace.object({
1487
+ type: z__namespace.literal("task-status-changed"),
1488
+ taskId: z__namespace.string(),
1489
+ machineId: z__namespace.string().optional(),
1490
+ status: TaskStatusSchema,
1491
+ sessionId: z__namespace.string().optional(),
1492
+ errorMessage: z__namespace.string().optional(),
1493
+ completedAt: z__namespace.number().optional()
1494
+ });
1495
+
1496
+ const SkillSummarySchema = z__namespace.object({
1497
+ id: z__namespace.string(),
1498
+ projectId: z__namespace.string().nullable(),
1499
+ name: z__namespace.string(),
1500
+ description: z__namespace.string().optional(),
1501
+ content: z__namespace.string(),
1502
+ attachments: z__namespace.array(z__namespace.string()),
1503
+ sourceKnowledgeId: z__namespace.string().optional(),
1504
+ archived: z__namespace.boolean(),
1505
+ createdAt: z__namespace.number(),
1506
+ updatedAt: z__namespace.number()
1507
+ });
1508
+ const CreateSkillBodySchema = z__namespace.object({
1509
+ projectId: z__namespace.string().optional(),
1510
+ name: z__namespace.string().min(1).max(100),
1511
+ description: z__namespace.string().max(500).optional(),
1512
+ content: z__namespace.string().min(1).max(5e4),
1513
+ attachments: z__namespace.array(z__namespace.string()).max(10).default([]),
1514
+ sourceKnowledgeId: z__namespace.string().optional()
1515
+ });
1516
+ const UpdateSkillBodySchema = z__namespace.object({
1517
+ name: z__namespace.string().min(1).max(100).optional(),
1518
+ description: z__namespace.string().max(500).optional(),
1519
+ content: z__namespace.string().min(1).max(5e4).optional(),
1520
+ attachments: z__namespace.array(z__namespace.string()).max(10).optional(),
1521
+ archived: z__namespace.boolean().optional()
1522
+ });
1523
+ const SkillContentSchema = z__namespace.object({
1524
+ name: z__namespace.string(),
1525
+ content: z__namespace.string()
1526
+ });
1527
+
1528
+ const InboxCategorySchema = z__namespace.enum([
1529
+ "task",
1530
+ // Task queue events (completed, failed, cancelled)
1531
+ "trigger",
1532
+ // Cron/webhook trigger fired
1533
+ "supervisor",
1534
+ // Supervisor run results
1535
+ "session",
1536
+ // Session lifecycle events
1537
+ "knowledge",
1538
+ // Knowledge base changes
1539
+ "system"
1540
+ // System notifications
1541
+ ]);
1542
+ const InboxSeveritySchema = z__namespace.enum([
1543
+ "info",
1544
+ "warning",
1545
+ "error"
1546
+ ]);
1547
+ const InboxItemSummarySchema = z__namespace.object({
1548
+ id: z__namespace.string(),
1549
+ category: InboxCategorySchema,
1550
+ eventType: z__namespace.string(),
1551
+ // e.g. "task.completed", "trigger.cron.fired"
1552
+ severity: InboxSeveritySchema,
1553
+ title: z__namespace.string(),
1554
+ body: z__namespace.string().optional(),
1555
+ read: z__namespace.boolean(),
1556
+ referenceUrl: z__namespace.string().optional(),
1557
+ // Deep link, e.g. "/machine/xxx/tasks"
1558
+ refType: z__namespace.string().optional(),
1559
+ // Polymorphic ref: "task" | "trigger" | "session" | ...
1560
+ refId: z__namespace.string().optional(),
1561
+ // ID of referenced entity
1562
+ groupKey: z__namespace.string().optional(),
1563
+ // Dedup key (same source within 1h → skip)
1564
+ createdAt: z__namespace.number()
1565
+ });
1566
+ const InboxNewItemSchema = z__namespace.object({
1567
+ type: z__namespace.literal("inbox-new-item"),
1568
+ item: InboxItemSummarySchema
1569
+ });
1570
+ const InboxUnreadCountSchema = z__namespace.object({
1571
+ type: z__namespace.literal("inbox-unread-count"),
1572
+ count: z__namespace.number()
1573
+ });
1574
+
1575
+ const SessionEventTypeSchema = z__namespace.enum([
1576
+ "file_edit",
1577
+ // File created/modified/deleted
1578
+ "bash_command",
1579
+ // Shell command executed
1580
+ "tool_call",
1581
+ // Tool invocation (Read, Grep, etc.)
1582
+ "git_operation",
1583
+ // Git commit, push, branch, etc.
1584
+ "error",
1585
+ // Error occurred during session
1586
+ "session_start",
1587
+ // Session started
1588
+ "session_end"
1589
+ // Session ended
1590
+ ]);
1591
+ const SessionEventSummarySchema = z__namespace.object({
1592
+ id: z__namespace.string(),
1593
+ sessionId: z__namespace.string(),
1594
+ eventType: SessionEventTypeSchema,
1595
+ summary: z__namespace.string(),
1596
+ // Human-readable one-liner
1597
+ detail: z__namespace.record(z__namespace.string(), z__namespace.unknown()).optional(),
1598
+ // Structured metadata (JSON)
1599
+ createdAt: z__namespace.number()
1600
+ });
1601
+ const SessionEventReportSchema = z__namespace.object({
1602
+ sessionId: z__namespace.string(),
1603
+ eventType: SessionEventTypeSchema,
1604
+ summary: z__namespace.string().max(500),
1605
+ detail: z__namespace.record(z__namespace.string(), z__namespace.unknown()).optional()
1606
+ });
1607
+ const SessionEventCreatedSchema = z__namespace.object({
1608
+ type: z__namespace.literal("session-event-created"),
1609
+ event: SessionEventSummarySchema
1610
+ });
1611
+
1612
+ const terminalSpawnRequestSchema = z__namespace.object({
1613
+ /** Shell to use (defaults to user's default shell) */
1614
+ shell: z__namespace.string().optional(),
1615
+ /** Working directory */
1616
+ cwd: z__namespace.string().optional(),
1617
+ /** Initial terminal dimensions */
1618
+ cols: z__namespace.number().int().min(1).max(500).optional(),
1619
+ rows: z__namespace.number().int().min(1).max(200).optional()
1620
+ });
1621
+ const terminalSpawnResponseSchema = z__namespace.object({
1622
+ success: z__namespace.boolean(),
1623
+ terminalId: z__namespace.string().optional(),
1624
+ error: z__namespace.string().optional()
1625
+ });
1626
+ const terminalResizeRequestSchema = z__namespace.object({
1627
+ terminalId: z__namespace.string(),
1628
+ cols: z__namespace.number().int().min(1).max(500),
1629
+ rows: z__namespace.number().int().min(1).max(200)
1630
+ });
1631
+ const terminalCloseRequestSchema = z__namespace.object({
1632
+ terminalId: z__namespace.string()
1633
+ });
1634
+ const terminalInputPayloadSchema = z__namespace.object({
1635
+ machineId: z__namespace.string(),
1636
+ terminalId: z__namespace.string(),
1637
+ data: z__namespace.string()
1638
+ });
1639
+ const terminalOutputPayloadSchema = z__namespace.object({
1640
+ machineId: z__namespace.string(),
1641
+ terminalId: z__namespace.string(),
1642
+ data: z__namespace.string()
1643
+ });
1644
+ const terminalExitPayloadSchema = z__namespace.object({
1645
+ machineId: z__namespace.string(),
1646
+ terminalId: z__namespace.string(),
1647
+ exitCode: z__namespace.number()
1648
+ });
1649
+
1650
+ const HAPPY_PROFILE_ENV_KEYS = {
1651
+ /** `"true" | "false"` — toggle Claude extended thinking */
1652
+ claudeThinkingEnabled: "HAPPY_CLAUDE_THINKING_ENABLED",
1653
+ /** integer as string — Claude extended thinking budget tokens */
1654
+ claudeThinkingBudgetTokens: "HAPPY_CLAUDE_THINKING_BUDGET_TOKENS",
1655
+ /** integer as string — max conversation turns before stop */
1656
+ maxTurns: "HAPPY_MAX_TURNS",
1657
+ /** DefaultPermissionMode literal — permission mode override */
1658
+ permissionMode: "HAPPY_PERMISSION_MODE"
1659
+ };
1660
+
1661
+ const sessionProgressTodoStatusSchema = z__namespace.enum([
1662
+ "pending",
1663
+ "in_progress",
1640
1664
  "completed"
1641
1665
  ]);
1642
1666
  const sessionProgressTodoSchema = z__namespace.object({
@@ -1955,6 +1979,98 @@ const CodexMetadataSchema = z__namespace.object({
1955
1979
  mcpServers: z__namespace.array(CodexMcpServerSummarySchema).optional()
1956
1980
  });
1957
1981
 
1982
+ const CLAUDE_CONTROL_SCOPE = "claude-control";
1983
+ const GetSessionCostRequestSchema = z.z.object({}).strict();
1984
+ const GetSessionCostResponseSchema = z.z.object({
1985
+ /** Pre-formatted single-line summary (same text `/usage` prints in non-interactive mode). */
1986
+ formatted: z.z.string(),
1987
+ /** Total USD spent on this session so far. */
1988
+ totalUsd: z.z.number().nonnegative(),
1989
+ /** Optional breakdown by model. */
1990
+ byModel: z.z.record(z.z.string(), z.z.object({
1991
+ inputTokens: z.z.number().int().nonnegative(),
1992
+ outputTokens: z.z.number().int().nonnegative(),
1993
+ cacheCreationInputTokens: z.z.number().int().nonnegative().optional(),
1994
+ cacheReadInputTokens: z.z.number().int().nonnegative().optional(),
1995
+ costUsd: z.z.number().nonnegative()
1996
+ })).optional()
1997
+ }).strict();
1998
+ const GetBinaryVersionRequestSchema = z.z.object({}).strict();
1999
+ const GetBinaryVersionResponseSchema = z.z.object({
2000
+ /** Remote Claude Code binary version string, e.g. "2.1.119". */
2001
+ version: z.z.string(),
2002
+ /** Path to the binary if resolvable, informational only. */
2003
+ binaryPath: z.z.string().optional(),
2004
+ /** Happy-cli package version for context. */
2005
+ happyCliVersion: z.z.string().optional()
2006
+ }).strict();
2007
+ const SetColorRequestSchema = z.z.object({
2008
+ /** Agent color name or the literal "default" to reset. */
2009
+ color: z.z.string().min(1).max(64)
2010
+ }).strict();
2011
+ const SetColorResponseSchema = z.z.object({
2012
+ success: z.z.literal(true),
2013
+ color: z.z.string()
2014
+ }).strict();
2015
+ const ReadFileRequestSchema = z.z.object({
2016
+ /** Path relative to cwd or absolute. CLI applies path blacklist + Read-tool permission gating. */
2017
+ path: z.z.string().min(1).max(4096),
2018
+ /** Optional max bytes to return; server-side hard cap enforces <= 1 MiB. */
2019
+ maxBytes: z.z.number().int().positive().max(1024 * 1024).optional()
2020
+ }).strict();
2021
+ const ReadFileResponseSchema = z.z.object({
2022
+ /** Null when permission denied / missing / blocked by CLI path blacklist. */
2023
+ result: z.z.object({
2024
+ contents: z.z.string(),
2025
+ absPath: z.z.string(),
2026
+ truncated: z.z.boolean().optional()
2027
+ }).nullable(),
2028
+ /** Machine-readable reason when result is null. */
2029
+ deniedReason: z.z.enum(["not_found", "permission_denied", "blacklisted_path", "too_large", "error"]).optional()
2030
+ }).strict();
2031
+ const McpCallRequestSchema = z.z.object({
2032
+ /** Fully-qualified MCP tool name, e.g. `mcp__fs__read`. Must pass CLI whitelist. */
2033
+ tool: z.z.string().regex(/^mcp__[a-z0-9_-]+__[a-z0-9_.-]+$/i, "must be of form mcp__<server>__<tool>"),
2034
+ /** Tool arguments; schema-free, CLI passes through to MCP server. */
2035
+ arguments: z.z.record(z.z.string(), z.z.unknown()).optional(),
2036
+ /**
2037
+ * Client-nonce that App must have displayed to the user in a 2-step
2038
+ * confirm dialog. CLI uses this only for audit logging — the actual
2039
+ * confirmation happens on App side and is logged for security review.
2040
+ */
2041
+ clientConfirmToken: z.z.string().min(8).max(128)
2042
+ }).strict();
2043
+ const McpCallResponseSchema = z.z.object({
2044
+ success: z.z.boolean(),
2045
+ /** Tool response payload, shape defined by each MCP tool. */
2046
+ result: z.z.unknown().optional(),
2047
+ /** Error code for UI to localize; see CLI handler for enum values. */
2048
+ errorCode: z.z.enum([
2049
+ "not_whitelisted",
2050
+ "server_unavailable",
2051
+ "tool_not_found",
2052
+ "invalid_arguments",
2053
+ "permission_denied",
2054
+ /**
2055
+ * SDK 0.2.119 defines the `mcp_call` control protocol type but does
2056
+ * not expose a public runtime method on the `Query` interface. Until
2057
+ * upstream lands a `callMcpTool()` / equivalent, the CLI handler
2058
+ * returns this code so the App can surface an honest "waiting on
2059
+ * SDK" state instead of masking the gap as a server error.
2060
+ */
2061
+ "sdk_not_implemented",
2062
+ "unknown"
2063
+ ]).optional(),
2064
+ errorMessage: z.z.string().optional()
2065
+ }).strict();
2066
+ const CLAUDE_CONTROL_METHODS = [
2067
+ "get_session_cost",
2068
+ "get_binary_version",
2069
+ "set_color",
2070
+ "read_file",
2071
+ "mcp_call"
2072
+ ];
2073
+
1958
2074
  exports.AIBackendProfileSchema = AIBackendProfileSchema;
1959
2075
  exports.AgentLoopSummarySchema = AgentLoopSummarySchema;
1960
2076
  exports.AgentMessageSchema = AgentMessageSchema;
@@ -1979,6 +2095,8 @@ exports.BUILT_IN_AI_BACKEND_PROFILE_IDS = BUILT_IN_AI_BACKEND_PROFILE_IDS;
1979
2095
  exports.BootstrapProfileSummarySchema = BootstrapProfileSummarySchema;
1980
2096
  exports.BriefMessageSchema = BriefMessageSchema;
1981
2097
  exports.BuiltInAIBackendProfileIdSchema = BuiltInAIBackendProfileIdSchema;
2098
+ exports.CLAUDE_CONTROL_METHODS = CLAUDE_CONTROL_METHODS;
2099
+ exports.CLAUDE_CONTROL_SCOPE = CLAUDE_CONTROL_SCOPE;
1982
2100
  exports.CODEX_APP_SERVER_BACKEND = CODEX_APP_SERVER_BACKEND;
1983
2101
  exports.CODEX_MCP_LEGACY_BACKEND = CODEX_MCP_LEGACY_BACKEND;
1984
2102
  exports.CODEX_REQUESTED_BACKEND_ALIASES = CODEX_REQUESTED_BACKEND_ALIASES;
@@ -2009,10 +2127,15 @@ exports.CustomModelSchema = CustomModelSchema;
2009
2127
  exports.DaemonStateSchema = DaemonStateSchema;
2010
2128
  exports.DefaultPermissionModeSchema = DefaultPermissionModeSchema;
2011
2129
  exports.EnvironmentVariableSchema = EnvironmentVariableSchema;
2130
+ exports.GetBinaryVersionRequestSchema = GetBinaryVersionRequestSchema;
2131
+ exports.GetBinaryVersionResponseSchema = GetBinaryVersionResponseSchema;
2132
+ exports.GetSessionCostRequestSchema = GetSessionCostRequestSchema;
2133
+ exports.GetSessionCostResponseSchema = GetSessionCostResponseSchema;
2012
2134
  exports.HAPPY_MCP_AUTO_APPROVE_TOOL_NAMES = HAPPY_MCP_AUTO_APPROVE_TOOL_NAMES;
2013
2135
  exports.HAPPY_MCP_SILENT_SUCCESS_TOOL_NAMES = HAPPY_MCP_SILENT_SUCCESS_TOOL_NAMES;
2014
2136
  exports.HAPPY_MCP_TOOL_NAMES = HAPPY_MCP_TOOL_NAMES;
2015
2137
  exports.HAPPY_MCP_TOOL_SPECS = HAPPY_MCP_TOOL_SPECS;
2138
+ exports.HAPPY_PROFILE_ENV_KEYS = HAPPY_PROFILE_ENV_KEYS;
2016
2139
  exports.InboxCategorySchema = InboxCategorySchema;
2017
2140
  exports.InboxItemSummarySchema = InboxItemSummarySchema;
2018
2141
  exports.InboxNewItemSchema = InboxNewItemSchema;
@@ -2031,6 +2154,8 @@ exports.KnowledgeInjectionResponseSchema = KnowledgeInjectionResponseSchema;
2031
2154
  exports.KnowledgeStatusSchema = KnowledgeStatusSchema;
2032
2155
  exports.LegacyMessageContentSchema = LegacyMessageContentSchema;
2033
2156
  exports.MachineMetadataSchema = MachineMetadataSchema;
2157
+ exports.McpCallRequestSchema = McpCallRequestSchema;
2158
+ exports.McpCallResponseSchema = McpCallResponseSchema;
2034
2159
  exports.MessageContentSchema = MessageContentSchema;
2035
2160
  exports.MessageMetaSchema = MessageMetaSchema;
2036
2161
  exports.OpenAIConfigSchema = OpenAIConfigSchema;
@@ -2038,6 +2163,8 @@ exports.ProfileCompatibilitySchema = ProfileCompatibilitySchema;
2038
2163
  exports.ProjectProfileSchema = ProjectProfileSchema;
2039
2164
  exports.QueryKnowledgeParamsSchema = QueryKnowledgeParamsSchema;
2040
2165
  exports.RESOLVED_RUNTIME_PROFILE_SCHEMA_VERSION = RESOLVED_RUNTIME_PROFILE_SCHEMA_VERSION;
2166
+ exports.ReadFileRequestSchema = ReadFileRequestSchema;
2167
+ exports.ReadFileResponseSchema = ReadFileResponseSchema;
2041
2168
  exports.ResolvedRuntimeProfileSchema = ResolvedRuntimeProfileSchema;
2042
2169
  exports.RuntimeProfileSourceSchema = RuntimeProfileSourceSchema;
2043
2170
  exports.RuntimeProfileTrustSchema = RuntimeProfileTrustSchema;
@@ -2048,6 +2175,8 @@ exports.SessionEventTypeSchema = SessionEventTypeSchema;
2048
2175
  exports.SessionMessageContentSchema = SessionMessageContentSchema;
2049
2176
  exports.SessionMessageSchema = SessionMessageSchema;
2050
2177
  exports.SessionProtocolMessageSchema = SessionProtocolMessageSchema;
2178
+ exports.SetColorRequestSchema = SetColorRequestSchema;
2179
+ exports.SetColorResponseSchema = SetColorResponseSchema;
2051
2180
  exports.SkillContentSchema = SkillContentSchema;
2052
2181
  exports.SkillSummarySchema = SkillSummarySchema;
2053
2182
  exports.TailscaleInfoSchema = TailscaleInfoSchema;