@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.cjs +394 -256
- package/dist/index.d.cts +253 -46
- package/dist/index.d.mts +253 -46
- package/dist/index.mjs +382 -257
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -273,7 +273,16 @@ const MessageMetaSchema = z__namespace.object({
|
|
|
273
273
|
* an assistant turn. Requires @anthropic-ai/claude-agent-sdk 0.2.110+ on CLI.
|
|
274
274
|
* Defaults to true when unset (normal turn-triggering message).
|
|
275
275
|
*/
|
|
276
|
-
shouldQuery: z__namespace.boolean().optional()
|
|
276
|
+
shouldQuery: z__namespace.boolean().optional(),
|
|
277
|
+
/**
|
|
278
|
+
* Worktree context for sessions running in a git worktree branch.
|
|
279
|
+
* Injected by the CLI when the session directory is inside a git worktree.
|
|
280
|
+
* Used by the server to enrich push notification titles with branch info.
|
|
281
|
+
*/
|
|
282
|
+
worktree: z__namespace.object({
|
|
283
|
+
branch: z__namespace.string(),
|
|
284
|
+
path: z__namespace.string().optional()
|
|
285
|
+
}).optional()
|
|
277
286
|
});
|
|
278
287
|
|
|
279
288
|
const UserMessageSchema = z__namespace.object({
|
|
@@ -785,261 +794,6 @@ const VoiceTokenResponseSchema = z__namespace.discriminatedUnion("allowed", [
|
|
|
785
794
|
VoiceTokenDeniedSchema
|
|
786
795
|
]);
|
|
787
796
|
|
|
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
797
|
const CODEX_APP_SERVER_BACKEND = "codex-app-server";
|
|
1044
798
|
const CODEX_MCP_LEGACY_BACKEND = "codex-mcp-legacy";
|
|
1045
799
|
const CodexBackendModeSchema = z__namespace.enum([
|
|
@@ -1634,6 +1388,285 @@ function isTrustedRuntimeProfile(runtimeProfile) {
|
|
|
1634
1388
|
return runtimeProfile?.trust === "trusted";
|
|
1635
1389
|
}
|
|
1636
1390
|
|
|
1391
|
+
const TaskPrioritySchema = z__namespace.enum([
|
|
1392
|
+
"urgent",
|
|
1393
|
+
// User-initiated, needs immediate execution
|
|
1394
|
+
"user",
|
|
1395
|
+
// Normal user-created task (default)
|
|
1396
|
+
"background"
|
|
1397
|
+
// Automated / scheduled tasks
|
|
1398
|
+
]);
|
|
1399
|
+
const TaskStatusSchema = z__namespace.enum([
|
|
1400
|
+
"queued",
|
|
1401
|
+
// Waiting in queue
|
|
1402
|
+
"dispatching",
|
|
1403
|
+
// Being sent to CLI daemon
|
|
1404
|
+
"running",
|
|
1405
|
+
// Executing on CLI
|
|
1406
|
+
"completed",
|
|
1407
|
+
// Finished successfully
|
|
1408
|
+
"failed",
|
|
1409
|
+
// Execution failed
|
|
1410
|
+
"cancelled"
|
|
1411
|
+
// Cancelled by user
|
|
1412
|
+
]);
|
|
1413
|
+
const TaskTriggerTypeSchema = z__namespace.enum([
|
|
1414
|
+
"manual",
|
|
1415
|
+
// Created from App by user
|
|
1416
|
+
"cron",
|
|
1417
|
+
// Created by TriggerSchedule
|
|
1418
|
+
"webhook"
|
|
1419
|
+
// Created by WebhookTrigger
|
|
1420
|
+
]);
|
|
1421
|
+
const TaskSummarySchema = z__namespace.object({
|
|
1422
|
+
id: z__namespace.string(),
|
|
1423
|
+
projectId: z__namespace.string().nullable(),
|
|
1424
|
+
machineId: z__namespace.string(),
|
|
1425
|
+
priority: TaskPrioritySchema,
|
|
1426
|
+
status: TaskStatusSchema,
|
|
1427
|
+
triggerType: TaskTriggerTypeSchema,
|
|
1428
|
+
triggerRef: z__namespace.string().optional(),
|
|
1429
|
+
attempt: z__namespace.number(),
|
|
1430
|
+
maxAttempts: z__namespace.number(),
|
|
1431
|
+
sessionId: z__namespace.string().optional(),
|
|
1432
|
+
errorMessage: z__namespace.string().optional(),
|
|
1433
|
+
dispatchedAt: z__namespace.number().optional(),
|
|
1434
|
+
completedAt: z__namespace.number().optional(),
|
|
1435
|
+
createdAt: z__namespace.number(),
|
|
1436
|
+
updatedAt: z__namespace.number(),
|
|
1437
|
+
// Encrypted prompt preview (first 100 chars)
|
|
1438
|
+
promptPreview: z__namespace.string().optional(),
|
|
1439
|
+
// Names of bound skills for display
|
|
1440
|
+
skillNames: z__namespace.array(z__namespace.string()).optional()
|
|
1441
|
+
});
|
|
1442
|
+
const CreateTaskBodySchema = z__namespace.object({
|
|
1443
|
+
projectId: z__namespace.string().optional(),
|
|
1444
|
+
machineId: z__namespace.string(),
|
|
1445
|
+
prompt: z__namespace.string().min(1),
|
|
1446
|
+
// Encrypted by App
|
|
1447
|
+
priority: TaskPrioritySchema.default("user"),
|
|
1448
|
+
maxAttempts: z__namespace.number().int().min(1).max(10).default(3),
|
|
1449
|
+
skillIds: z__namespace.array(z__namespace.string()).max(10).default([]),
|
|
1450
|
+
// Profile binding (wire 0.15.0). Business key — built-in id like
|
|
1451
|
+
// "anthropic" or AiBackendProfile.profileKey for the account. Optional:
|
|
1452
|
+
// when omitted the server falls back to Project.supervisorConfig.defaultProfileId
|
|
1453
|
+
// via the unified runtimeProfileResolver (feature-flagged).
|
|
1454
|
+
profileId: z__namespace.string().optional()
|
|
1455
|
+
});
|
|
1456
|
+
const TaskTriggerDataSchema = z__namespace.object({
|
|
1457
|
+
type: z__namespace.literal("task-trigger"),
|
|
1458
|
+
taskId: z__namespace.string(),
|
|
1459
|
+
prompt: z__namespace.string(),
|
|
1460
|
+
// Encrypted prompt
|
|
1461
|
+
directory: z__namespace.string(),
|
|
1462
|
+
// Project directory on machine
|
|
1463
|
+
priority: TaskPrioritySchema,
|
|
1464
|
+
projectId: z__namespace.string().optional(),
|
|
1465
|
+
resultToken: z__namespace.string().optional(),
|
|
1466
|
+
skillContents: z__namespace.array(z__namespace.object({
|
|
1467
|
+
name: z__namespace.string(),
|
|
1468
|
+
content: z__namespace.string()
|
|
1469
|
+
})).optional(),
|
|
1470
|
+
agentType: z__namespace.string().nullable().optional(),
|
|
1471
|
+
// "claude" | "codex" | "gemini" — null = inherit CLI default
|
|
1472
|
+
modelOverride: z__namespace.string().nullable().optional(),
|
|
1473
|
+
// e.g. "claude-sonnet-4-20250514" — null = agent default
|
|
1474
|
+
// Profile binding for this task. `profileId` references the AIBackendProfile
|
|
1475
|
+
// selected when the task was created (Task.profileId column). `runtimeProfile`
|
|
1476
|
+
// is the resolved snapshot (env vars, startup script, permission mode, etc.)
|
|
1477
|
+
// that the CLI should honor when spawning the session. Both optional for
|
|
1478
|
+
// backward compatibility; starting from wire 0.14.0 + server unified resolver
|
|
1479
|
+
// these are always populated for scheduled/webhook/manual tasks.
|
|
1480
|
+
profileId: z__namespace.string().optional(),
|
|
1481
|
+
runtimeProfile: ResolvedRuntimeProfileSchema.optional()
|
|
1482
|
+
});
|
|
1483
|
+
const TaskOutcomeSchema = z__namespace.enum([
|
|
1484
|
+
"completed",
|
|
1485
|
+
"failed",
|
|
1486
|
+
"blocked"
|
|
1487
|
+
]);
|
|
1488
|
+
const TaskStatusReportSchema = z__namespace.object({
|
|
1489
|
+
taskId: z__namespace.string(),
|
|
1490
|
+
status: TaskStatusSchema,
|
|
1491
|
+
outcome: TaskOutcomeSchema.optional(),
|
|
1492
|
+
sessionId: z__namespace.string().optional(),
|
|
1493
|
+
errorMessage: z__namespace.string().optional()
|
|
1494
|
+
});
|
|
1495
|
+
const TaskStatusChangedSchema = z__namespace.object({
|
|
1496
|
+
type: z__namespace.literal("task-status-changed"),
|
|
1497
|
+
taskId: z__namespace.string(),
|
|
1498
|
+
machineId: z__namespace.string().optional(),
|
|
1499
|
+
status: TaskStatusSchema,
|
|
1500
|
+
sessionId: z__namespace.string().optional(),
|
|
1501
|
+
errorMessage: z__namespace.string().optional(),
|
|
1502
|
+
completedAt: z__namespace.number().optional()
|
|
1503
|
+
});
|
|
1504
|
+
|
|
1505
|
+
const SkillSummarySchema = z__namespace.object({
|
|
1506
|
+
id: z__namespace.string(),
|
|
1507
|
+
projectId: z__namespace.string().nullable(),
|
|
1508
|
+
name: z__namespace.string(),
|
|
1509
|
+
description: z__namespace.string().optional(),
|
|
1510
|
+
content: z__namespace.string(),
|
|
1511
|
+
attachments: z__namespace.array(z__namespace.string()),
|
|
1512
|
+
sourceKnowledgeId: z__namespace.string().optional(),
|
|
1513
|
+
archived: z__namespace.boolean(),
|
|
1514
|
+
createdAt: z__namespace.number(),
|
|
1515
|
+
updatedAt: z__namespace.number()
|
|
1516
|
+
});
|
|
1517
|
+
const CreateSkillBodySchema = z__namespace.object({
|
|
1518
|
+
projectId: z__namespace.string().optional(),
|
|
1519
|
+
name: z__namespace.string().min(1).max(100),
|
|
1520
|
+
description: z__namespace.string().max(500).optional(),
|
|
1521
|
+
content: z__namespace.string().min(1).max(5e4),
|
|
1522
|
+
attachments: z__namespace.array(z__namespace.string()).max(10).default([]),
|
|
1523
|
+
sourceKnowledgeId: z__namespace.string().optional()
|
|
1524
|
+
});
|
|
1525
|
+
const UpdateSkillBodySchema = z__namespace.object({
|
|
1526
|
+
name: z__namespace.string().min(1).max(100).optional(),
|
|
1527
|
+
description: z__namespace.string().max(500).optional(),
|
|
1528
|
+
content: z__namespace.string().min(1).max(5e4).optional(),
|
|
1529
|
+
attachments: z__namespace.array(z__namespace.string()).max(10).optional(),
|
|
1530
|
+
archived: z__namespace.boolean().optional()
|
|
1531
|
+
});
|
|
1532
|
+
const SkillContentSchema = z__namespace.object({
|
|
1533
|
+
name: z__namespace.string(),
|
|
1534
|
+
content: z__namespace.string()
|
|
1535
|
+
});
|
|
1536
|
+
|
|
1537
|
+
const InboxCategorySchema = z__namespace.enum([
|
|
1538
|
+
"task",
|
|
1539
|
+
// Task queue events (completed, failed, cancelled)
|
|
1540
|
+
"trigger",
|
|
1541
|
+
// Cron/webhook trigger fired
|
|
1542
|
+
"supervisor",
|
|
1543
|
+
// Supervisor run results
|
|
1544
|
+
"session",
|
|
1545
|
+
// Session lifecycle events
|
|
1546
|
+
"knowledge",
|
|
1547
|
+
// Knowledge base changes
|
|
1548
|
+
"system"
|
|
1549
|
+
// System notifications
|
|
1550
|
+
]);
|
|
1551
|
+
const InboxSeveritySchema = z__namespace.enum([
|
|
1552
|
+
"info",
|
|
1553
|
+
"warning",
|
|
1554
|
+
"error"
|
|
1555
|
+
]);
|
|
1556
|
+
const InboxItemSummarySchema = z__namespace.object({
|
|
1557
|
+
id: z__namespace.string(),
|
|
1558
|
+
category: InboxCategorySchema,
|
|
1559
|
+
eventType: z__namespace.string(),
|
|
1560
|
+
// e.g. "task.completed", "trigger.cron.fired"
|
|
1561
|
+
severity: InboxSeveritySchema,
|
|
1562
|
+
title: z__namespace.string(),
|
|
1563
|
+
body: z__namespace.string().optional(),
|
|
1564
|
+
read: z__namespace.boolean(),
|
|
1565
|
+
referenceUrl: z__namespace.string().optional(),
|
|
1566
|
+
// Deep link, e.g. "/machine/xxx/tasks"
|
|
1567
|
+
refType: z__namespace.string().optional(),
|
|
1568
|
+
// Polymorphic ref: "task" | "trigger" | "session" | ...
|
|
1569
|
+
refId: z__namespace.string().optional(),
|
|
1570
|
+
// ID of referenced entity
|
|
1571
|
+
groupKey: z__namespace.string().optional(),
|
|
1572
|
+
// Dedup key (same source within 1h → skip)
|
|
1573
|
+
createdAt: z__namespace.number()
|
|
1574
|
+
});
|
|
1575
|
+
const InboxNewItemSchema = z__namespace.object({
|
|
1576
|
+
type: z__namespace.literal("inbox-new-item"),
|
|
1577
|
+
item: InboxItemSummarySchema
|
|
1578
|
+
});
|
|
1579
|
+
const InboxUnreadCountSchema = z__namespace.object({
|
|
1580
|
+
type: z__namespace.literal("inbox-unread-count"),
|
|
1581
|
+
count: z__namespace.number()
|
|
1582
|
+
});
|
|
1583
|
+
|
|
1584
|
+
const SessionEventTypeSchema = z__namespace.enum([
|
|
1585
|
+
"file_edit",
|
|
1586
|
+
// File created/modified/deleted
|
|
1587
|
+
"bash_command",
|
|
1588
|
+
// Shell command executed
|
|
1589
|
+
"tool_call",
|
|
1590
|
+
// Tool invocation (Read, Grep, etc.)
|
|
1591
|
+
"git_operation",
|
|
1592
|
+
// Git commit, push, branch, etc.
|
|
1593
|
+
"error",
|
|
1594
|
+
// Error occurred during session
|
|
1595
|
+
"session_start",
|
|
1596
|
+
// Session started
|
|
1597
|
+
"session_end"
|
|
1598
|
+
// Session ended
|
|
1599
|
+
]);
|
|
1600
|
+
const SessionEventSummarySchema = z__namespace.object({
|
|
1601
|
+
id: z__namespace.string(),
|
|
1602
|
+
sessionId: z__namespace.string(),
|
|
1603
|
+
eventType: SessionEventTypeSchema,
|
|
1604
|
+
summary: z__namespace.string(),
|
|
1605
|
+
// Human-readable one-liner
|
|
1606
|
+
detail: z__namespace.record(z__namespace.string(), z__namespace.unknown()).optional(),
|
|
1607
|
+
// Structured metadata (JSON)
|
|
1608
|
+
createdAt: z__namespace.number()
|
|
1609
|
+
});
|
|
1610
|
+
const SessionEventReportSchema = z__namespace.object({
|
|
1611
|
+
sessionId: z__namespace.string(),
|
|
1612
|
+
eventType: SessionEventTypeSchema,
|
|
1613
|
+
summary: z__namespace.string().max(500),
|
|
1614
|
+
detail: z__namespace.record(z__namespace.string(), z__namespace.unknown()).optional()
|
|
1615
|
+
});
|
|
1616
|
+
const SessionEventCreatedSchema = z__namespace.object({
|
|
1617
|
+
type: z__namespace.literal("session-event-created"),
|
|
1618
|
+
event: SessionEventSummarySchema
|
|
1619
|
+
});
|
|
1620
|
+
|
|
1621
|
+
const terminalSpawnRequestSchema = z__namespace.object({
|
|
1622
|
+
/** Shell to use (defaults to user's default shell) */
|
|
1623
|
+
shell: z__namespace.string().optional(),
|
|
1624
|
+
/** Working directory */
|
|
1625
|
+
cwd: z__namespace.string().optional(),
|
|
1626
|
+
/** Initial terminal dimensions */
|
|
1627
|
+
cols: z__namespace.number().int().min(1).max(500).optional(),
|
|
1628
|
+
rows: z__namespace.number().int().min(1).max(200).optional()
|
|
1629
|
+
});
|
|
1630
|
+
const terminalSpawnResponseSchema = z__namespace.object({
|
|
1631
|
+
success: z__namespace.boolean(),
|
|
1632
|
+
terminalId: z__namespace.string().optional(),
|
|
1633
|
+
error: z__namespace.string().optional()
|
|
1634
|
+
});
|
|
1635
|
+
const terminalResizeRequestSchema = z__namespace.object({
|
|
1636
|
+
terminalId: z__namespace.string(),
|
|
1637
|
+
cols: z__namespace.number().int().min(1).max(500),
|
|
1638
|
+
rows: z__namespace.number().int().min(1).max(200)
|
|
1639
|
+
});
|
|
1640
|
+
const terminalCloseRequestSchema = z__namespace.object({
|
|
1641
|
+
terminalId: z__namespace.string()
|
|
1642
|
+
});
|
|
1643
|
+
const terminalInputPayloadSchema = z__namespace.object({
|
|
1644
|
+
machineId: z__namespace.string(),
|
|
1645
|
+
terminalId: z__namespace.string(),
|
|
1646
|
+
data: z__namespace.string()
|
|
1647
|
+
});
|
|
1648
|
+
const terminalOutputPayloadSchema = z__namespace.object({
|
|
1649
|
+
machineId: z__namespace.string(),
|
|
1650
|
+
terminalId: z__namespace.string(),
|
|
1651
|
+
data: z__namespace.string()
|
|
1652
|
+
});
|
|
1653
|
+
const terminalExitPayloadSchema = z__namespace.object({
|
|
1654
|
+
machineId: z__namespace.string(),
|
|
1655
|
+
terminalId: z__namespace.string(),
|
|
1656
|
+
exitCode: z__namespace.number()
|
|
1657
|
+
});
|
|
1658
|
+
|
|
1659
|
+
const HAPPY_PROFILE_ENV_KEYS = {
|
|
1660
|
+
/** `"true" | "false"` — toggle Claude extended thinking */
|
|
1661
|
+
claudeThinkingEnabled: "HAPPY_CLAUDE_THINKING_ENABLED",
|
|
1662
|
+
/** integer as string — Claude extended thinking budget tokens */
|
|
1663
|
+
claudeThinkingBudgetTokens: "HAPPY_CLAUDE_THINKING_BUDGET_TOKENS",
|
|
1664
|
+
/** integer as string — max conversation turns before stop */
|
|
1665
|
+
maxTurns: "HAPPY_MAX_TURNS",
|
|
1666
|
+
/** DefaultPermissionMode literal — permission mode override */
|
|
1667
|
+
permissionMode: "HAPPY_PERMISSION_MODE"
|
|
1668
|
+
};
|
|
1669
|
+
|
|
1637
1670
|
const sessionProgressTodoStatusSchema = z__namespace.enum([
|
|
1638
1671
|
"pending",
|
|
1639
1672
|
"in_progress",
|
|
@@ -1955,6 +1988,98 @@ const CodexMetadataSchema = z__namespace.object({
|
|
|
1955
1988
|
mcpServers: z__namespace.array(CodexMcpServerSummarySchema).optional()
|
|
1956
1989
|
});
|
|
1957
1990
|
|
|
1991
|
+
const CLAUDE_CONTROL_SCOPE = "claude-control";
|
|
1992
|
+
const GetSessionCostRequestSchema = z.z.object({}).strict();
|
|
1993
|
+
const GetSessionCostResponseSchema = z.z.object({
|
|
1994
|
+
/** Pre-formatted single-line summary (same text `/usage` prints in non-interactive mode). */
|
|
1995
|
+
formatted: z.z.string(),
|
|
1996
|
+
/** Total USD spent on this session so far. */
|
|
1997
|
+
totalUsd: z.z.number().nonnegative(),
|
|
1998
|
+
/** Optional breakdown by model. */
|
|
1999
|
+
byModel: z.z.record(z.z.string(), z.z.object({
|
|
2000
|
+
inputTokens: z.z.number().int().nonnegative(),
|
|
2001
|
+
outputTokens: z.z.number().int().nonnegative(),
|
|
2002
|
+
cacheCreationInputTokens: z.z.number().int().nonnegative().optional(),
|
|
2003
|
+
cacheReadInputTokens: z.z.number().int().nonnegative().optional(),
|
|
2004
|
+
costUsd: z.z.number().nonnegative()
|
|
2005
|
+
})).optional()
|
|
2006
|
+
}).strict();
|
|
2007
|
+
const GetBinaryVersionRequestSchema = z.z.object({}).strict();
|
|
2008
|
+
const GetBinaryVersionResponseSchema = z.z.object({
|
|
2009
|
+
/** Remote Claude Code binary version string, e.g. "2.1.119". */
|
|
2010
|
+
version: z.z.string(),
|
|
2011
|
+
/** Path to the binary if resolvable, informational only. */
|
|
2012
|
+
binaryPath: z.z.string().optional(),
|
|
2013
|
+
/** Happy-cli package version for context. */
|
|
2014
|
+
happyCliVersion: z.z.string().optional()
|
|
2015
|
+
}).strict();
|
|
2016
|
+
const SetColorRequestSchema = z.z.object({
|
|
2017
|
+
/** Agent color name or the literal "default" to reset. */
|
|
2018
|
+
color: z.z.string().min(1).max(64)
|
|
2019
|
+
}).strict();
|
|
2020
|
+
const SetColorResponseSchema = z.z.object({
|
|
2021
|
+
success: z.z.literal(true),
|
|
2022
|
+
color: z.z.string()
|
|
2023
|
+
}).strict();
|
|
2024
|
+
const ReadFileRequestSchema = z.z.object({
|
|
2025
|
+
/** Path relative to cwd or absolute. CLI applies path blacklist + Read-tool permission gating. */
|
|
2026
|
+
path: z.z.string().min(1).max(4096),
|
|
2027
|
+
/** Optional max bytes to return; server-side hard cap enforces <= 1 MiB. */
|
|
2028
|
+
maxBytes: z.z.number().int().positive().max(1024 * 1024).optional()
|
|
2029
|
+
}).strict();
|
|
2030
|
+
const ReadFileResponseSchema = z.z.object({
|
|
2031
|
+
/** Null when permission denied / missing / blocked by CLI path blacklist. */
|
|
2032
|
+
result: z.z.object({
|
|
2033
|
+
contents: z.z.string(),
|
|
2034
|
+
absPath: z.z.string(),
|
|
2035
|
+
truncated: z.z.boolean().optional()
|
|
2036
|
+
}).nullable(),
|
|
2037
|
+
/** Machine-readable reason when result is null. */
|
|
2038
|
+
deniedReason: z.z.enum(["not_found", "permission_denied", "blacklisted_path", "too_large", "error"]).optional()
|
|
2039
|
+
}).strict();
|
|
2040
|
+
const McpCallRequestSchema = z.z.object({
|
|
2041
|
+
/** Fully-qualified MCP tool name, e.g. `mcp__fs__read`. Must pass CLI whitelist. */
|
|
2042
|
+
tool: z.z.string().regex(/^mcp__[a-z0-9_-]+__[a-z0-9_.-]+$/i, "must be of form mcp__<server>__<tool>"),
|
|
2043
|
+
/** Tool arguments; schema-free, CLI passes through to MCP server. */
|
|
2044
|
+
arguments: z.z.record(z.z.string(), z.z.unknown()).optional(),
|
|
2045
|
+
/**
|
|
2046
|
+
* Client-nonce that App must have displayed to the user in a 2-step
|
|
2047
|
+
* confirm dialog. CLI uses this only for audit logging — the actual
|
|
2048
|
+
* confirmation happens on App side and is logged for security review.
|
|
2049
|
+
*/
|
|
2050
|
+
clientConfirmToken: z.z.string().min(8).max(128)
|
|
2051
|
+
}).strict();
|
|
2052
|
+
const McpCallResponseSchema = z.z.object({
|
|
2053
|
+
success: z.z.boolean(),
|
|
2054
|
+
/** Tool response payload, shape defined by each MCP tool. */
|
|
2055
|
+
result: z.z.unknown().optional(),
|
|
2056
|
+
/** Error code for UI to localize; see CLI handler for enum values. */
|
|
2057
|
+
errorCode: z.z.enum([
|
|
2058
|
+
"not_whitelisted",
|
|
2059
|
+
"server_unavailable",
|
|
2060
|
+
"tool_not_found",
|
|
2061
|
+
"invalid_arguments",
|
|
2062
|
+
"permission_denied",
|
|
2063
|
+
/**
|
|
2064
|
+
* SDK 0.2.119 defines the `mcp_call` control protocol type but does
|
|
2065
|
+
* not expose a public runtime method on the `Query` interface. Until
|
|
2066
|
+
* upstream lands a `callMcpTool()` / equivalent, the CLI handler
|
|
2067
|
+
* returns this code so the App can surface an honest "waiting on
|
|
2068
|
+
* SDK" state instead of masking the gap as a server error.
|
|
2069
|
+
*/
|
|
2070
|
+
"sdk_not_implemented",
|
|
2071
|
+
"unknown"
|
|
2072
|
+
]).optional(),
|
|
2073
|
+
errorMessage: z.z.string().optional()
|
|
2074
|
+
}).strict();
|
|
2075
|
+
const CLAUDE_CONTROL_METHODS = [
|
|
2076
|
+
"get_session_cost",
|
|
2077
|
+
"get_binary_version",
|
|
2078
|
+
"set_color",
|
|
2079
|
+
"read_file",
|
|
2080
|
+
"mcp_call"
|
|
2081
|
+
];
|
|
2082
|
+
|
|
1958
2083
|
exports.AIBackendProfileSchema = AIBackendProfileSchema;
|
|
1959
2084
|
exports.AgentLoopSummarySchema = AgentLoopSummarySchema;
|
|
1960
2085
|
exports.AgentMessageSchema = AgentMessageSchema;
|
|
@@ -1979,6 +2104,8 @@ exports.BUILT_IN_AI_BACKEND_PROFILE_IDS = BUILT_IN_AI_BACKEND_PROFILE_IDS;
|
|
|
1979
2104
|
exports.BootstrapProfileSummarySchema = BootstrapProfileSummarySchema;
|
|
1980
2105
|
exports.BriefMessageSchema = BriefMessageSchema;
|
|
1981
2106
|
exports.BuiltInAIBackendProfileIdSchema = BuiltInAIBackendProfileIdSchema;
|
|
2107
|
+
exports.CLAUDE_CONTROL_METHODS = CLAUDE_CONTROL_METHODS;
|
|
2108
|
+
exports.CLAUDE_CONTROL_SCOPE = CLAUDE_CONTROL_SCOPE;
|
|
1982
2109
|
exports.CODEX_APP_SERVER_BACKEND = CODEX_APP_SERVER_BACKEND;
|
|
1983
2110
|
exports.CODEX_MCP_LEGACY_BACKEND = CODEX_MCP_LEGACY_BACKEND;
|
|
1984
2111
|
exports.CODEX_REQUESTED_BACKEND_ALIASES = CODEX_REQUESTED_BACKEND_ALIASES;
|
|
@@ -2009,10 +2136,15 @@ exports.CustomModelSchema = CustomModelSchema;
|
|
|
2009
2136
|
exports.DaemonStateSchema = DaemonStateSchema;
|
|
2010
2137
|
exports.DefaultPermissionModeSchema = DefaultPermissionModeSchema;
|
|
2011
2138
|
exports.EnvironmentVariableSchema = EnvironmentVariableSchema;
|
|
2139
|
+
exports.GetBinaryVersionRequestSchema = GetBinaryVersionRequestSchema;
|
|
2140
|
+
exports.GetBinaryVersionResponseSchema = GetBinaryVersionResponseSchema;
|
|
2141
|
+
exports.GetSessionCostRequestSchema = GetSessionCostRequestSchema;
|
|
2142
|
+
exports.GetSessionCostResponseSchema = GetSessionCostResponseSchema;
|
|
2012
2143
|
exports.HAPPY_MCP_AUTO_APPROVE_TOOL_NAMES = HAPPY_MCP_AUTO_APPROVE_TOOL_NAMES;
|
|
2013
2144
|
exports.HAPPY_MCP_SILENT_SUCCESS_TOOL_NAMES = HAPPY_MCP_SILENT_SUCCESS_TOOL_NAMES;
|
|
2014
2145
|
exports.HAPPY_MCP_TOOL_NAMES = HAPPY_MCP_TOOL_NAMES;
|
|
2015
2146
|
exports.HAPPY_MCP_TOOL_SPECS = HAPPY_MCP_TOOL_SPECS;
|
|
2147
|
+
exports.HAPPY_PROFILE_ENV_KEYS = HAPPY_PROFILE_ENV_KEYS;
|
|
2016
2148
|
exports.InboxCategorySchema = InboxCategorySchema;
|
|
2017
2149
|
exports.InboxItemSummarySchema = InboxItemSummarySchema;
|
|
2018
2150
|
exports.InboxNewItemSchema = InboxNewItemSchema;
|
|
@@ -2031,6 +2163,8 @@ exports.KnowledgeInjectionResponseSchema = KnowledgeInjectionResponseSchema;
|
|
|
2031
2163
|
exports.KnowledgeStatusSchema = KnowledgeStatusSchema;
|
|
2032
2164
|
exports.LegacyMessageContentSchema = LegacyMessageContentSchema;
|
|
2033
2165
|
exports.MachineMetadataSchema = MachineMetadataSchema;
|
|
2166
|
+
exports.McpCallRequestSchema = McpCallRequestSchema;
|
|
2167
|
+
exports.McpCallResponseSchema = McpCallResponseSchema;
|
|
2034
2168
|
exports.MessageContentSchema = MessageContentSchema;
|
|
2035
2169
|
exports.MessageMetaSchema = MessageMetaSchema;
|
|
2036
2170
|
exports.OpenAIConfigSchema = OpenAIConfigSchema;
|
|
@@ -2038,6 +2172,8 @@ exports.ProfileCompatibilitySchema = ProfileCompatibilitySchema;
|
|
|
2038
2172
|
exports.ProjectProfileSchema = ProjectProfileSchema;
|
|
2039
2173
|
exports.QueryKnowledgeParamsSchema = QueryKnowledgeParamsSchema;
|
|
2040
2174
|
exports.RESOLVED_RUNTIME_PROFILE_SCHEMA_VERSION = RESOLVED_RUNTIME_PROFILE_SCHEMA_VERSION;
|
|
2175
|
+
exports.ReadFileRequestSchema = ReadFileRequestSchema;
|
|
2176
|
+
exports.ReadFileResponseSchema = ReadFileResponseSchema;
|
|
2041
2177
|
exports.ResolvedRuntimeProfileSchema = ResolvedRuntimeProfileSchema;
|
|
2042
2178
|
exports.RuntimeProfileSourceSchema = RuntimeProfileSourceSchema;
|
|
2043
2179
|
exports.RuntimeProfileTrustSchema = RuntimeProfileTrustSchema;
|
|
@@ -2048,6 +2184,8 @@ exports.SessionEventTypeSchema = SessionEventTypeSchema;
|
|
|
2048
2184
|
exports.SessionMessageContentSchema = SessionMessageContentSchema;
|
|
2049
2185
|
exports.SessionMessageSchema = SessionMessageSchema;
|
|
2050
2186
|
exports.SessionProtocolMessageSchema = SessionProtocolMessageSchema;
|
|
2187
|
+
exports.SetColorRequestSchema = SetColorRequestSchema;
|
|
2188
|
+
exports.SetColorResponseSchema = SetColorResponseSchema;
|
|
2051
2189
|
exports.SkillContentSchema = SkillContentSchema;
|
|
2052
2190
|
exports.SkillSummarySchema = SkillSummarySchema;
|
|
2053
2191
|
exports.TailscaleInfoSchema = TailscaleInfoSchema;
|