@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 +391 -262
- package/dist/index.d.cts +175 -4
- package/dist/index.d.mts +175 -4
- package/dist/index.mjs +379 -263
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -765,261 +765,6 @@ const VoiceTokenResponseSchema = z.discriminatedUnion("allowed", [
|
|
|
765
765
|
VoiceTokenDeniedSchema
|
|
766
766
|
]);
|
|
767
767
|
|
|
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
768
|
const CODEX_APP_SERVER_BACKEND = "codex-app-server";
|
|
1024
769
|
const CODEX_MCP_LEGACY_BACKEND = "codex-mcp-legacy";
|
|
1025
770
|
const CodexBackendModeSchema = z.enum([
|
|
@@ -1310,15 +1055,15 @@ function getBuiltInAIBackendProfile(id) {
|
|
|
1310
1055
|
case "openai":
|
|
1311
1056
|
return {
|
|
1312
1057
|
id: "openai",
|
|
1313
|
-
name: "OpenAI (GPT-5.
|
|
1058
|
+
name: "OpenAI (GPT-5.5)",
|
|
1314
1059
|
openaiConfig: {},
|
|
1315
1060
|
environmentVariables: [
|
|
1316
1061
|
{ name: "OPENAI_BASE_URL", value: "https://api.openai.com/v1" },
|
|
1317
|
-
{ name: "OPENAI_MODEL", value: "gpt-5.
|
|
1062
|
+
{ name: "OPENAI_MODEL", value: "gpt-5.5" },
|
|
1318
1063
|
{ name: "OPENAI_API_TIMEOUT_MS", value: "600000" },
|
|
1319
|
-
{ name: "OPENAI_SMALL_FAST_MODEL", value: "gpt-5.4" },
|
|
1064
|
+
{ name: "OPENAI_SMALL_FAST_MODEL", value: "gpt-5.4-mini" },
|
|
1320
1065
|
{ name: "API_TIMEOUT_MS", value: "600000" },
|
|
1321
|
-
{ name: "CODEX_SMALL_FAST_MODEL", value: "gpt-5.4" }
|
|
1066
|
+
{ name: "CODEX_SMALL_FAST_MODEL", value: "gpt-5.4-mini" }
|
|
1322
1067
|
],
|
|
1323
1068
|
compatibility: { claude: false, codex: true, gemini: false },
|
|
1324
1069
|
isBuiltIn: true,
|
|
@@ -1614,9 +1359,288 @@ function isTrustedRuntimeProfile(runtimeProfile) {
|
|
|
1614
1359
|
return runtimeProfile?.trust === "trusted";
|
|
1615
1360
|
}
|
|
1616
1361
|
|
|
1617
|
-
const
|
|
1618
|
-
"
|
|
1619
|
-
|
|
1362
|
+
const TaskPrioritySchema = z.enum([
|
|
1363
|
+
"urgent",
|
|
1364
|
+
// User-initiated, needs immediate execution
|
|
1365
|
+
"user",
|
|
1366
|
+
// Normal user-created task (default)
|
|
1367
|
+
"background"
|
|
1368
|
+
// Automated / scheduled tasks
|
|
1369
|
+
]);
|
|
1370
|
+
const TaskStatusSchema = z.enum([
|
|
1371
|
+
"queued",
|
|
1372
|
+
// Waiting in queue
|
|
1373
|
+
"dispatching",
|
|
1374
|
+
// Being sent to CLI daemon
|
|
1375
|
+
"running",
|
|
1376
|
+
// Executing on CLI
|
|
1377
|
+
"completed",
|
|
1378
|
+
// Finished successfully
|
|
1379
|
+
"failed",
|
|
1380
|
+
// Execution failed
|
|
1381
|
+
"cancelled"
|
|
1382
|
+
// Cancelled by user
|
|
1383
|
+
]);
|
|
1384
|
+
const TaskTriggerTypeSchema = z.enum([
|
|
1385
|
+
"manual",
|
|
1386
|
+
// Created from App by user
|
|
1387
|
+
"cron",
|
|
1388
|
+
// Created by TriggerSchedule
|
|
1389
|
+
"webhook"
|
|
1390
|
+
// Created by WebhookTrigger
|
|
1391
|
+
]);
|
|
1392
|
+
const TaskSummarySchema = z.object({
|
|
1393
|
+
id: z.string(),
|
|
1394
|
+
projectId: z.string().nullable(),
|
|
1395
|
+
machineId: z.string(),
|
|
1396
|
+
priority: TaskPrioritySchema,
|
|
1397
|
+
status: TaskStatusSchema,
|
|
1398
|
+
triggerType: TaskTriggerTypeSchema,
|
|
1399
|
+
triggerRef: z.string().optional(),
|
|
1400
|
+
attempt: z.number(),
|
|
1401
|
+
maxAttempts: z.number(),
|
|
1402
|
+
sessionId: z.string().optional(),
|
|
1403
|
+
errorMessage: z.string().optional(),
|
|
1404
|
+
dispatchedAt: z.number().optional(),
|
|
1405
|
+
completedAt: z.number().optional(),
|
|
1406
|
+
createdAt: z.number(),
|
|
1407
|
+
updatedAt: z.number(),
|
|
1408
|
+
// Encrypted prompt preview (first 100 chars)
|
|
1409
|
+
promptPreview: z.string().optional(),
|
|
1410
|
+
// Names of bound skills for display
|
|
1411
|
+
skillNames: z.array(z.string()).optional()
|
|
1412
|
+
});
|
|
1413
|
+
const CreateTaskBodySchema = z.object({
|
|
1414
|
+
projectId: z.string().optional(),
|
|
1415
|
+
machineId: z.string(),
|
|
1416
|
+
prompt: z.string().min(1),
|
|
1417
|
+
// Encrypted by App
|
|
1418
|
+
priority: TaskPrioritySchema.default("user"),
|
|
1419
|
+
maxAttempts: z.number().int().min(1).max(10).default(3),
|
|
1420
|
+
skillIds: z.array(z.string()).max(10).default([]),
|
|
1421
|
+
// Profile binding (wire 0.15.0). Business key — built-in id like
|
|
1422
|
+
// "anthropic" or AiBackendProfile.profileKey for the account. Optional:
|
|
1423
|
+
// when omitted the server falls back to Project.supervisorConfig.defaultProfileId
|
|
1424
|
+
// via the unified runtimeProfileResolver (feature-flagged).
|
|
1425
|
+
profileId: z.string().optional()
|
|
1426
|
+
});
|
|
1427
|
+
const TaskTriggerDataSchema = z.object({
|
|
1428
|
+
type: z.literal("task-trigger"),
|
|
1429
|
+
taskId: z.string(),
|
|
1430
|
+
prompt: z.string(),
|
|
1431
|
+
// Encrypted prompt
|
|
1432
|
+
directory: z.string(),
|
|
1433
|
+
// Project directory on machine
|
|
1434
|
+
priority: TaskPrioritySchema,
|
|
1435
|
+
projectId: z.string().optional(),
|
|
1436
|
+
resultToken: z.string().optional(),
|
|
1437
|
+
skillContents: z.array(z.object({
|
|
1438
|
+
name: z.string(),
|
|
1439
|
+
content: z.string()
|
|
1440
|
+
})).optional(),
|
|
1441
|
+
agentType: z.string().nullable().optional(),
|
|
1442
|
+
// "claude" | "codex" | "gemini" — null = inherit CLI default
|
|
1443
|
+
modelOverride: z.string().nullable().optional(),
|
|
1444
|
+
// e.g. "claude-sonnet-4-20250514" — null = agent default
|
|
1445
|
+
// Profile binding for this task. `profileId` references the AIBackendProfile
|
|
1446
|
+
// selected when the task was created (Task.profileId column). `runtimeProfile`
|
|
1447
|
+
// is the resolved snapshot (env vars, startup script, permission mode, etc.)
|
|
1448
|
+
// that the CLI should honor when spawning the session. Both optional for
|
|
1449
|
+
// backward compatibility; starting from wire 0.14.0 + server unified resolver
|
|
1450
|
+
// these are always populated for scheduled/webhook/manual tasks.
|
|
1451
|
+
profileId: z.string().optional(),
|
|
1452
|
+
runtimeProfile: ResolvedRuntimeProfileSchema.optional()
|
|
1453
|
+
});
|
|
1454
|
+
const TaskOutcomeSchema = z.enum([
|
|
1455
|
+
"completed",
|
|
1456
|
+
"failed",
|
|
1457
|
+
"blocked"
|
|
1458
|
+
]);
|
|
1459
|
+
const TaskStatusReportSchema = z.object({
|
|
1460
|
+
taskId: z.string(),
|
|
1461
|
+
status: TaskStatusSchema,
|
|
1462
|
+
outcome: TaskOutcomeSchema.optional(),
|
|
1463
|
+
sessionId: z.string().optional(),
|
|
1464
|
+
errorMessage: z.string().optional()
|
|
1465
|
+
});
|
|
1466
|
+
const TaskStatusChangedSchema = z.object({
|
|
1467
|
+
type: z.literal("task-status-changed"),
|
|
1468
|
+
taskId: z.string(),
|
|
1469
|
+
machineId: z.string().optional(),
|
|
1470
|
+
status: TaskStatusSchema,
|
|
1471
|
+
sessionId: z.string().optional(),
|
|
1472
|
+
errorMessage: z.string().optional(),
|
|
1473
|
+
completedAt: z.number().optional()
|
|
1474
|
+
});
|
|
1475
|
+
|
|
1476
|
+
const SkillSummarySchema = z.object({
|
|
1477
|
+
id: z.string(),
|
|
1478
|
+
projectId: z.string().nullable(),
|
|
1479
|
+
name: z.string(),
|
|
1480
|
+
description: z.string().optional(),
|
|
1481
|
+
content: z.string(),
|
|
1482
|
+
attachments: z.array(z.string()),
|
|
1483
|
+
sourceKnowledgeId: z.string().optional(),
|
|
1484
|
+
archived: z.boolean(),
|
|
1485
|
+
createdAt: z.number(),
|
|
1486
|
+
updatedAt: z.number()
|
|
1487
|
+
});
|
|
1488
|
+
const CreateSkillBodySchema = z.object({
|
|
1489
|
+
projectId: z.string().optional(),
|
|
1490
|
+
name: z.string().min(1).max(100),
|
|
1491
|
+
description: z.string().max(500).optional(),
|
|
1492
|
+
content: z.string().min(1).max(5e4),
|
|
1493
|
+
attachments: z.array(z.string()).max(10).default([]),
|
|
1494
|
+
sourceKnowledgeId: z.string().optional()
|
|
1495
|
+
});
|
|
1496
|
+
const UpdateSkillBodySchema = z.object({
|
|
1497
|
+
name: z.string().min(1).max(100).optional(),
|
|
1498
|
+
description: z.string().max(500).optional(),
|
|
1499
|
+
content: z.string().min(1).max(5e4).optional(),
|
|
1500
|
+
attachments: z.array(z.string()).max(10).optional(),
|
|
1501
|
+
archived: z.boolean().optional()
|
|
1502
|
+
});
|
|
1503
|
+
const SkillContentSchema = z.object({
|
|
1504
|
+
name: z.string(),
|
|
1505
|
+
content: z.string()
|
|
1506
|
+
});
|
|
1507
|
+
|
|
1508
|
+
const InboxCategorySchema = z.enum([
|
|
1509
|
+
"task",
|
|
1510
|
+
// Task queue events (completed, failed, cancelled)
|
|
1511
|
+
"trigger",
|
|
1512
|
+
// Cron/webhook trigger fired
|
|
1513
|
+
"supervisor",
|
|
1514
|
+
// Supervisor run results
|
|
1515
|
+
"session",
|
|
1516
|
+
// Session lifecycle events
|
|
1517
|
+
"knowledge",
|
|
1518
|
+
// Knowledge base changes
|
|
1519
|
+
"system"
|
|
1520
|
+
// System notifications
|
|
1521
|
+
]);
|
|
1522
|
+
const InboxSeveritySchema = z.enum([
|
|
1523
|
+
"info",
|
|
1524
|
+
"warning",
|
|
1525
|
+
"error"
|
|
1526
|
+
]);
|
|
1527
|
+
const InboxItemSummarySchema = z.object({
|
|
1528
|
+
id: z.string(),
|
|
1529
|
+
category: InboxCategorySchema,
|
|
1530
|
+
eventType: z.string(),
|
|
1531
|
+
// e.g. "task.completed", "trigger.cron.fired"
|
|
1532
|
+
severity: InboxSeveritySchema,
|
|
1533
|
+
title: z.string(),
|
|
1534
|
+
body: z.string().optional(),
|
|
1535
|
+
read: z.boolean(),
|
|
1536
|
+
referenceUrl: z.string().optional(),
|
|
1537
|
+
// Deep link, e.g. "/machine/xxx/tasks"
|
|
1538
|
+
refType: z.string().optional(),
|
|
1539
|
+
// Polymorphic ref: "task" | "trigger" | "session" | ...
|
|
1540
|
+
refId: z.string().optional(),
|
|
1541
|
+
// ID of referenced entity
|
|
1542
|
+
groupKey: z.string().optional(),
|
|
1543
|
+
// Dedup key (same source within 1h → skip)
|
|
1544
|
+
createdAt: z.number()
|
|
1545
|
+
});
|
|
1546
|
+
const InboxNewItemSchema = z.object({
|
|
1547
|
+
type: z.literal("inbox-new-item"),
|
|
1548
|
+
item: InboxItemSummarySchema
|
|
1549
|
+
});
|
|
1550
|
+
const InboxUnreadCountSchema = z.object({
|
|
1551
|
+
type: z.literal("inbox-unread-count"),
|
|
1552
|
+
count: z.number()
|
|
1553
|
+
});
|
|
1554
|
+
|
|
1555
|
+
const SessionEventTypeSchema = z.enum([
|
|
1556
|
+
"file_edit",
|
|
1557
|
+
// File created/modified/deleted
|
|
1558
|
+
"bash_command",
|
|
1559
|
+
// Shell command executed
|
|
1560
|
+
"tool_call",
|
|
1561
|
+
// Tool invocation (Read, Grep, etc.)
|
|
1562
|
+
"git_operation",
|
|
1563
|
+
// Git commit, push, branch, etc.
|
|
1564
|
+
"error",
|
|
1565
|
+
// Error occurred during session
|
|
1566
|
+
"session_start",
|
|
1567
|
+
// Session started
|
|
1568
|
+
"session_end"
|
|
1569
|
+
// Session ended
|
|
1570
|
+
]);
|
|
1571
|
+
const SessionEventSummarySchema = z.object({
|
|
1572
|
+
id: z.string(),
|
|
1573
|
+
sessionId: z.string(),
|
|
1574
|
+
eventType: SessionEventTypeSchema,
|
|
1575
|
+
summary: z.string(),
|
|
1576
|
+
// Human-readable one-liner
|
|
1577
|
+
detail: z.record(z.string(), z.unknown()).optional(),
|
|
1578
|
+
// Structured metadata (JSON)
|
|
1579
|
+
createdAt: z.number()
|
|
1580
|
+
});
|
|
1581
|
+
const SessionEventReportSchema = z.object({
|
|
1582
|
+
sessionId: z.string(),
|
|
1583
|
+
eventType: SessionEventTypeSchema,
|
|
1584
|
+
summary: z.string().max(500),
|
|
1585
|
+
detail: z.record(z.string(), z.unknown()).optional()
|
|
1586
|
+
});
|
|
1587
|
+
const SessionEventCreatedSchema = z.object({
|
|
1588
|
+
type: z.literal("session-event-created"),
|
|
1589
|
+
event: SessionEventSummarySchema
|
|
1590
|
+
});
|
|
1591
|
+
|
|
1592
|
+
const terminalSpawnRequestSchema = z.object({
|
|
1593
|
+
/** Shell to use (defaults to user's default shell) */
|
|
1594
|
+
shell: z.string().optional(),
|
|
1595
|
+
/** Working directory */
|
|
1596
|
+
cwd: z.string().optional(),
|
|
1597
|
+
/** Initial terminal dimensions */
|
|
1598
|
+
cols: z.number().int().min(1).max(500).optional(),
|
|
1599
|
+
rows: z.number().int().min(1).max(200).optional()
|
|
1600
|
+
});
|
|
1601
|
+
const terminalSpawnResponseSchema = z.object({
|
|
1602
|
+
success: z.boolean(),
|
|
1603
|
+
terminalId: z.string().optional(),
|
|
1604
|
+
error: z.string().optional()
|
|
1605
|
+
});
|
|
1606
|
+
const terminalResizeRequestSchema = z.object({
|
|
1607
|
+
terminalId: z.string(),
|
|
1608
|
+
cols: z.number().int().min(1).max(500),
|
|
1609
|
+
rows: z.number().int().min(1).max(200)
|
|
1610
|
+
});
|
|
1611
|
+
const terminalCloseRequestSchema = z.object({
|
|
1612
|
+
terminalId: z.string()
|
|
1613
|
+
});
|
|
1614
|
+
const terminalInputPayloadSchema = z.object({
|
|
1615
|
+
machineId: z.string(),
|
|
1616
|
+
terminalId: z.string(),
|
|
1617
|
+
data: z.string()
|
|
1618
|
+
});
|
|
1619
|
+
const terminalOutputPayloadSchema = z.object({
|
|
1620
|
+
machineId: z.string(),
|
|
1621
|
+
terminalId: z.string(),
|
|
1622
|
+
data: z.string()
|
|
1623
|
+
});
|
|
1624
|
+
const terminalExitPayloadSchema = z.object({
|
|
1625
|
+
machineId: z.string(),
|
|
1626
|
+
terminalId: z.string(),
|
|
1627
|
+
exitCode: z.number()
|
|
1628
|
+
});
|
|
1629
|
+
|
|
1630
|
+
const HAPPY_PROFILE_ENV_KEYS = {
|
|
1631
|
+
/** `"true" | "false"` — toggle Claude extended thinking */
|
|
1632
|
+
claudeThinkingEnabled: "HAPPY_CLAUDE_THINKING_ENABLED",
|
|
1633
|
+
/** integer as string — Claude extended thinking budget tokens */
|
|
1634
|
+
claudeThinkingBudgetTokens: "HAPPY_CLAUDE_THINKING_BUDGET_TOKENS",
|
|
1635
|
+
/** integer as string — max conversation turns before stop */
|
|
1636
|
+
maxTurns: "HAPPY_MAX_TURNS",
|
|
1637
|
+
/** DefaultPermissionMode literal — permission mode override */
|
|
1638
|
+
permissionMode: "HAPPY_PERMISSION_MODE"
|
|
1639
|
+
};
|
|
1640
|
+
|
|
1641
|
+
const sessionProgressTodoStatusSchema = z.enum([
|
|
1642
|
+
"pending",
|
|
1643
|
+
"in_progress",
|
|
1620
1644
|
"completed"
|
|
1621
1645
|
]);
|
|
1622
1646
|
const sessionProgressTodoSchema = z.object({
|
|
@@ -1935,4 +1959,96 @@ const CodexMetadataSchema = z.object({
|
|
|
1935
1959
|
mcpServers: z.array(CodexMcpServerSummarySchema).optional()
|
|
1936
1960
|
});
|
|
1937
1961
|
|
|
1938
|
-
|
|
1962
|
+
const CLAUDE_CONTROL_SCOPE = "claude-control";
|
|
1963
|
+
const GetSessionCostRequestSchema = z$1.object({}).strict();
|
|
1964
|
+
const GetSessionCostResponseSchema = z$1.object({
|
|
1965
|
+
/** Pre-formatted single-line summary (same text `/usage` prints in non-interactive mode). */
|
|
1966
|
+
formatted: z$1.string(),
|
|
1967
|
+
/** Total USD spent on this session so far. */
|
|
1968
|
+
totalUsd: z$1.number().nonnegative(),
|
|
1969
|
+
/** Optional breakdown by model. */
|
|
1970
|
+
byModel: z$1.record(z$1.string(), z$1.object({
|
|
1971
|
+
inputTokens: z$1.number().int().nonnegative(),
|
|
1972
|
+
outputTokens: z$1.number().int().nonnegative(),
|
|
1973
|
+
cacheCreationInputTokens: z$1.number().int().nonnegative().optional(),
|
|
1974
|
+
cacheReadInputTokens: z$1.number().int().nonnegative().optional(),
|
|
1975
|
+
costUsd: z$1.number().nonnegative()
|
|
1976
|
+
})).optional()
|
|
1977
|
+
}).strict();
|
|
1978
|
+
const GetBinaryVersionRequestSchema = z$1.object({}).strict();
|
|
1979
|
+
const GetBinaryVersionResponseSchema = z$1.object({
|
|
1980
|
+
/** Remote Claude Code binary version string, e.g. "2.1.119". */
|
|
1981
|
+
version: z$1.string(),
|
|
1982
|
+
/** Path to the binary if resolvable, informational only. */
|
|
1983
|
+
binaryPath: z$1.string().optional(),
|
|
1984
|
+
/** Happy-cli package version for context. */
|
|
1985
|
+
happyCliVersion: z$1.string().optional()
|
|
1986
|
+
}).strict();
|
|
1987
|
+
const SetColorRequestSchema = z$1.object({
|
|
1988
|
+
/** Agent color name or the literal "default" to reset. */
|
|
1989
|
+
color: z$1.string().min(1).max(64)
|
|
1990
|
+
}).strict();
|
|
1991
|
+
const SetColorResponseSchema = z$1.object({
|
|
1992
|
+
success: z$1.literal(true),
|
|
1993
|
+
color: z$1.string()
|
|
1994
|
+
}).strict();
|
|
1995
|
+
const ReadFileRequestSchema = z$1.object({
|
|
1996
|
+
/** Path relative to cwd or absolute. CLI applies path blacklist + Read-tool permission gating. */
|
|
1997
|
+
path: z$1.string().min(1).max(4096),
|
|
1998
|
+
/** Optional max bytes to return; server-side hard cap enforces <= 1 MiB. */
|
|
1999
|
+
maxBytes: z$1.number().int().positive().max(1024 * 1024).optional()
|
|
2000
|
+
}).strict();
|
|
2001
|
+
const ReadFileResponseSchema = z$1.object({
|
|
2002
|
+
/** Null when permission denied / missing / blocked by CLI path blacklist. */
|
|
2003
|
+
result: z$1.object({
|
|
2004
|
+
contents: z$1.string(),
|
|
2005
|
+
absPath: z$1.string(),
|
|
2006
|
+
truncated: z$1.boolean().optional()
|
|
2007
|
+
}).nullable(),
|
|
2008
|
+
/** Machine-readable reason when result is null. */
|
|
2009
|
+
deniedReason: z$1.enum(["not_found", "permission_denied", "blacklisted_path", "too_large", "error"]).optional()
|
|
2010
|
+
}).strict();
|
|
2011
|
+
const McpCallRequestSchema = z$1.object({
|
|
2012
|
+
/** Fully-qualified MCP tool name, e.g. `mcp__fs__read`. Must pass CLI whitelist. */
|
|
2013
|
+
tool: z$1.string().regex(/^mcp__[a-z0-9_-]+__[a-z0-9_.-]+$/i, "must be of form mcp__<server>__<tool>"),
|
|
2014
|
+
/** Tool arguments; schema-free, CLI passes through to MCP server. */
|
|
2015
|
+
arguments: z$1.record(z$1.string(), z$1.unknown()).optional(),
|
|
2016
|
+
/**
|
|
2017
|
+
* Client-nonce that App must have displayed to the user in a 2-step
|
|
2018
|
+
* confirm dialog. CLI uses this only for audit logging — the actual
|
|
2019
|
+
* confirmation happens on App side and is logged for security review.
|
|
2020
|
+
*/
|
|
2021
|
+
clientConfirmToken: z$1.string().min(8).max(128)
|
|
2022
|
+
}).strict();
|
|
2023
|
+
const McpCallResponseSchema = z$1.object({
|
|
2024
|
+
success: z$1.boolean(),
|
|
2025
|
+
/** Tool response payload, shape defined by each MCP tool. */
|
|
2026
|
+
result: z$1.unknown().optional(),
|
|
2027
|
+
/** Error code for UI to localize; see CLI handler for enum values. */
|
|
2028
|
+
errorCode: z$1.enum([
|
|
2029
|
+
"not_whitelisted",
|
|
2030
|
+
"server_unavailable",
|
|
2031
|
+
"tool_not_found",
|
|
2032
|
+
"invalid_arguments",
|
|
2033
|
+
"permission_denied",
|
|
2034
|
+
/**
|
|
2035
|
+
* SDK 0.2.119 defines the `mcp_call` control protocol type but does
|
|
2036
|
+
* not expose a public runtime method on the `Query` interface. Until
|
|
2037
|
+
* upstream lands a `callMcpTool()` / equivalent, the CLI handler
|
|
2038
|
+
* returns this code so the App can surface an honest "waiting on
|
|
2039
|
+
* SDK" state instead of masking the gap as a server error.
|
|
2040
|
+
*/
|
|
2041
|
+
"sdk_not_implemented",
|
|
2042
|
+
"unknown"
|
|
2043
|
+
]).optional(),
|
|
2044
|
+
errorMessage: z$1.string().optional()
|
|
2045
|
+
}).strict();
|
|
2046
|
+
const CLAUDE_CONTROL_METHODS = [
|
|
2047
|
+
"get_session_cost",
|
|
2048
|
+
"get_binary_version",
|
|
2049
|
+
"set_color",
|
|
2050
|
+
"read_file",
|
|
2051
|
+
"mcp_call"
|
|
2052
|
+
];
|
|
2053
|
+
|
|
2054
|
+
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 };
|