@kmmao/happy-wire 0.9.1 → 0.10.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 +277 -2
- package/dist/index.d.cts +432 -4
- package/dist/index.d.mts +432 -4
- package/dist/index.mjs +254 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -380,7 +380,7 @@ const TunnelStateSchema = z.object({
|
|
|
380
380
|
providers: z.array(TunnelProviderInfoSchema)
|
|
381
381
|
});
|
|
382
382
|
const AutomationPrioritySchema = z.enum(["urgent", "user", "background"]);
|
|
383
|
-
const AutomationJobKindSchema = z.enum(["supervisor", "webhook", "agent_loop"]);
|
|
383
|
+
const AutomationJobKindSchema = z.enum(["supervisor", "webhook", "agent_loop", "task"]);
|
|
384
384
|
const AutomationJobStatusSchema = z.enum([
|
|
385
385
|
"queued",
|
|
386
386
|
"dispatching",
|
|
@@ -474,6 +474,49 @@ const AutomationCountsSchema = z.object({
|
|
|
474
474
|
failed: z.number(),
|
|
475
475
|
cancelled: z.number()
|
|
476
476
|
});
|
|
477
|
+
const AgentLoopSummarySchema = z.object({
|
|
478
|
+
id: z.string(),
|
|
479
|
+
name: z.string().optional(),
|
|
480
|
+
directory: z.string(),
|
|
481
|
+
enabled: z.boolean(),
|
|
482
|
+
intervalMs: z.number(),
|
|
483
|
+
cronExpression: z.string().optional(),
|
|
484
|
+
iteration: z.number(),
|
|
485
|
+
nextRunAt: z.number(),
|
|
486
|
+
runtimeState: z.string(),
|
|
487
|
+
phase: z.string(),
|
|
488
|
+
lastTriggerSource: z.string().optional(),
|
|
489
|
+
lastBriefSummary: z.string().optional(),
|
|
490
|
+
lastError: z.string().optional(),
|
|
491
|
+
agent: z.string()
|
|
492
|
+
});
|
|
493
|
+
const BootstrapProfileSummarySchema = z.object({
|
|
494
|
+
id: z.string(),
|
|
495
|
+
name: z.string().optional(),
|
|
496
|
+
rootDirectory: z.string(),
|
|
497
|
+
intervalMs: z.number(),
|
|
498
|
+
enabled: z.boolean(),
|
|
499
|
+
status: z.string(),
|
|
500
|
+
statusUpdatedAt: z.number(),
|
|
501
|
+
lastRunAt: z.number().optional(),
|
|
502
|
+
lastRepoCount: z.number().optional(),
|
|
503
|
+
lastSuggestionCount: z.number().optional(),
|
|
504
|
+
lastError: z.string().optional()
|
|
505
|
+
});
|
|
506
|
+
const AutoDreamProfileSummarySchema = z.object({
|
|
507
|
+
id: z.string(),
|
|
508
|
+
name: z.string().optional(),
|
|
509
|
+
rootDirectory: z.string(),
|
|
510
|
+
intervalMs: z.number(),
|
|
511
|
+
enabled: z.boolean(),
|
|
512
|
+
nextRunAt: z.number(),
|
|
513
|
+
status: z.string(),
|
|
514
|
+
stage: z.string(),
|
|
515
|
+
statusUpdatedAt: z.number(),
|
|
516
|
+
lastRunAt: z.number().optional(),
|
|
517
|
+
lastMemoryFiles: z.number().optional(),
|
|
518
|
+
lastError: z.string().optional()
|
|
519
|
+
});
|
|
477
520
|
const AutomationStateSchema = z.object({
|
|
478
521
|
updatedAt: z.number(),
|
|
479
522
|
counts: AutomationCountsSchema,
|
|
@@ -481,7 +524,10 @@ const AutomationStateSchema = z.object({
|
|
|
481
524
|
guardians: z.array(AutomationGuardianSummarySchema).optional(),
|
|
482
525
|
guardianUsage: z.array(AutomationGuardianUsageSummarySchema).optional(),
|
|
483
526
|
auditStats: AutomationAuditStatsSchema.optional(),
|
|
484
|
-
recentAuditEvents: z.array(AutomationAuditEventSummarySchema).optional()
|
|
527
|
+
recentAuditEvents: z.array(AutomationAuditEventSummarySchema).optional(),
|
|
528
|
+
loops: z.array(AgentLoopSummarySchema).optional(),
|
|
529
|
+
bootstrapProfiles: z.array(BootstrapProfileSummarySchema).optional(),
|
|
530
|
+
autoDreamProfiles: z.array(AutoDreamProfileSummarySchema).optional()
|
|
485
531
|
});
|
|
486
532
|
const BriefMessageSchema = z.object({
|
|
487
533
|
loopId: z.string(),
|
|
@@ -695,4 +741,209 @@ const VoiceTokenResponseSchema = z.discriminatedUnion("allowed", [
|
|
|
695
741
|
VoiceTokenDeniedSchema
|
|
696
742
|
]);
|
|
697
743
|
|
|
698
|
-
|
|
744
|
+
const TaskPrioritySchema = z.enum([
|
|
745
|
+
"urgent",
|
|
746
|
+
// User-initiated, needs immediate execution
|
|
747
|
+
"user",
|
|
748
|
+
// Normal user-created task (default)
|
|
749
|
+
"background"
|
|
750
|
+
// Automated / scheduled tasks
|
|
751
|
+
]);
|
|
752
|
+
const TaskStatusSchema = z.enum([
|
|
753
|
+
"queued",
|
|
754
|
+
// Waiting in queue
|
|
755
|
+
"dispatching",
|
|
756
|
+
// Being sent to CLI daemon
|
|
757
|
+
"running",
|
|
758
|
+
// Executing on CLI
|
|
759
|
+
"completed",
|
|
760
|
+
// Finished successfully
|
|
761
|
+
"failed",
|
|
762
|
+
// Execution failed
|
|
763
|
+
"cancelled"
|
|
764
|
+
// Cancelled by user
|
|
765
|
+
]);
|
|
766
|
+
const TaskTriggerTypeSchema = z.enum([
|
|
767
|
+
"manual",
|
|
768
|
+
// Created from App by user
|
|
769
|
+
"cron",
|
|
770
|
+
// Created by TriggerSchedule
|
|
771
|
+
"webhook"
|
|
772
|
+
// Created by WebhookTrigger
|
|
773
|
+
]);
|
|
774
|
+
const TaskSummarySchema = z.object({
|
|
775
|
+
id: z.string(),
|
|
776
|
+
projectId: z.string().nullable(),
|
|
777
|
+
machineId: z.string(),
|
|
778
|
+
priority: TaskPrioritySchema,
|
|
779
|
+
status: TaskStatusSchema,
|
|
780
|
+
triggerType: TaskTriggerTypeSchema,
|
|
781
|
+
triggerRef: z.string().optional(),
|
|
782
|
+
attempt: z.number(),
|
|
783
|
+
maxAttempts: z.number(),
|
|
784
|
+
sessionId: z.string().optional(),
|
|
785
|
+
errorMessage: z.string().optional(),
|
|
786
|
+
dispatchedAt: z.number().optional(),
|
|
787
|
+
completedAt: z.number().optional(),
|
|
788
|
+
createdAt: z.number(),
|
|
789
|
+
updatedAt: z.number(),
|
|
790
|
+
// Encrypted prompt preview (first 100 chars)
|
|
791
|
+
promptPreview: z.string().optional(),
|
|
792
|
+
// Names of bound skills for display
|
|
793
|
+
skillNames: z.array(z.string()).optional()
|
|
794
|
+
});
|
|
795
|
+
const CreateTaskBodySchema = z.object({
|
|
796
|
+
projectId: z.string().optional(),
|
|
797
|
+
machineId: z.string(),
|
|
798
|
+
prompt: z.string().min(1),
|
|
799
|
+
// Encrypted by App
|
|
800
|
+
priority: TaskPrioritySchema.default("user"),
|
|
801
|
+
maxAttempts: z.number().int().min(1).max(10).default(3),
|
|
802
|
+
skillIds: z.array(z.string()).max(10).default([])
|
|
803
|
+
});
|
|
804
|
+
const TaskTriggerDataSchema = z.object({
|
|
805
|
+
type: z.literal("task-trigger"),
|
|
806
|
+
taskId: z.string(),
|
|
807
|
+
prompt: z.string(),
|
|
808
|
+
// Encrypted prompt
|
|
809
|
+
directory: z.string(),
|
|
810
|
+
// Project directory on machine
|
|
811
|
+
priority: TaskPrioritySchema,
|
|
812
|
+
projectId: z.string().optional(),
|
|
813
|
+
skillContents: z.array(z.object({
|
|
814
|
+
name: z.string(),
|
|
815
|
+
content: z.string()
|
|
816
|
+
})).optional()
|
|
817
|
+
});
|
|
818
|
+
const TaskStatusReportSchema = z.object({
|
|
819
|
+
taskId: z.string(),
|
|
820
|
+
status: TaskStatusSchema,
|
|
821
|
+
sessionId: z.string().optional(),
|
|
822
|
+
errorMessage: z.string().optional()
|
|
823
|
+
});
|
|
824
|
+
const TaskStatusChangedSchema = z.object({
|
|
825
|
+
type: z.literal("task-status-changed"),
|
|
826
|
+
taskId: z.string(),
|
|
827
|
+
status: TaskStatusSchema,
|
|
828
|
+
sessionId: z.string().optional(),
|
|
829
|
+
errorMessage: z.string().optional(),
|
|
830
|
+
completedAt: z.number().optional()
|
|
831
|
+
});
|
|
832
|
+
|
|
833
|
+
const SkillSummarySchema = z.object({
|
|
834
|
+
id: z.string(),
|
|
835
|
+
projectId: z.string().nullable(),
|
|
836
|
+
name: z.string(),
|
|
837
|
+
description: z.string().optional(),
|
|
838
|
+
content: z.string(),
|
|
839
|
+
attachments: z.array(z.string()),
|
|
840
|
+
sourceKnowledgeId: z.string().optional(),
|
|
841
|
+
archived: z.boolean(),
|
|
842
|
+
createdAt: z.number(),
|
|
843
|
+
updatedAt: z.number()
|
|
844
|
+
});
|
|
845
|
+
const CreateSkillBodySchema = z.object({
|
|
846
|
+
projectId: z.string().optional(),
|
|
847
|
+
name: z.string().min(1).max(100),
|
|
848
|
+
description: z.string().max(500).optional(),
|
|
849
|
+
content: z.string().min(1).max(5e4),
|
|
850
|
+
attachments: z.array(z.string()).max(10).default([]),
|
|
851
|
+
sourceKnowledgeId: z.string().optional()
|
|
852
|
+
});
|
|
853
|
+
const UpdateSkillBodySchema = z.object({
|
|
854
|
+
name: z.string().min(1).max(100).optional(),
|
|
855
|
+
description: z.string().max(500).optional(),
|
|
856
|
+
content: z.string().min(1).max(5e4).optional(),
|
|
857
|
+
attachments: z.array(z.string()).max(10).optional(),
|
|
858
|
+
archived: z.boolean().optional()
|
|
859
|
+
});
|
|
860
|
+
const SkillContentSchema = z.object({
|
|
861
|
+
name: z.string(),
|
|
862
|
+
content: z.string()
|
|
863
|
+
});
|
|
864
|
+
|
|
865
|
+
const InboxCategorySchema = z.enum([
|
|
866
|
+
"task",
|
|
867
|
+
// Task queue events (completed, failed, cancelled)
|
|
868
|
+
"trigger",
|
|
869
|
+
// Cron/webhook trigger fired
|
|
870
|
+
"supervisor",
|
|
871
|
+
// Supervisor run results
|
|
872
|
+
"session",
|
|
873
|
+
// Session lifecycle events
|
|
874
|
+
"knowledge",
|
|
875
|
+
// Knowledge base changes
|
|
876
|
+
"system"
|
|
877
|
+
// System notifications
|
|
878
|
+
]);
|
|
879
|
+
const InboxSeveritySchema = z.enum([
|
|
880
|
+
"info",
|
|
881
|
+
"warning",
|
|
882
|
+
"error"
|
|
883
|
+
]);
|
|
884
|
+
const InboxItemSummarySchema = z.object({
|
|
885
|
+
id: z.string(),
|
|
886
|
+
category: InboxCategorySchema,
|
|
887
|
+
eventType: z.string(),
|
|
888
|
+
// e.g. "task.completed", "trigger.cron.fired"
|
|
889
|
+
severity: InboxSeveritySchema,
|
|
890
|
+
title: z.string(),
|
|
891
|
+
body: z.string().optional(),
|
|
892
|
+
read: z.boolean(),
|
|
893
|
+
referenceUrl: z.string().optional(),
|
|
894
|
+
// Deep link, e.g. "/machine/xxx/tasks"
|
|
895
|
+
refType: z.string().optional(),
|
|
896
|
+
// Polymorphic ref: "task" | "trigger" | "session" | ...
|
|
897
|
+
refId: z.string().optional(),
|
|
898
|
+
// ID of referenced entity
|
|
899
|
+
groupKey: z.string().optional(),
|
|
900
|
+
// Dedup key (same source within 1h → skip)
|
|
901
|
+
createdAt: z.number()
|
|
902
|
+
});
|
|
903
|
+
const InboxNewItemSchema = z.object({
|
|
904
|
+
type: z.literal("inbox-new-item"),
|
|
905
|
+
item: InboxItemSummarySchema
|
|
906
|
+
});
|
|
907
|
+
const InboxUnreadCountSchema = z.object({
|
|
908
|
+
type: z.literal("inbox-unread-count"),
|
|
909
|
+
count: z.number()
|
|
910
|
+
});
|
|
911
|
+
|
|
912
|
+
const SessionEventTypeSchema = z.enum([
|
|
913
|
+
"file_edit",
|
|
914
|
+
// File created/modified/deleted
|
|
915
|
+
"bash_command",
|
|
916
|
+
// Shell command executed
|
|
917
|
+
"tool_call",
|
|
918
|
+
// Tool invocation (Read, Grep, etc.)
|
|
919
|
+
"git_operation",
|
|
920
|
+
// Git commit, push, branch, etc.
|
|
921
|
+
"error",
|
|
922
|
+
// Error occurred during session
|
|
923
|
+
"session_start",
|
|
924
|
+
// Session started
|
|
925
|
+
"session_end"
|
|
926
|
+
// Session ended
|
|
927
|
+
]);
|
|
928
|
+
const SessionEventSummarySchema = z.object({
|
|
929
|
+
id: z.string(),
|
|
930
|
+
sessionId: z.string(),
|
|
931
|
+
eventType: SessionEventTypeSchema,
|
|
932
|
+
summary: z.string(),
|
|
933
|
+
// Human-readable one-liner
|
|
934
|
+
detail: z.record(z.string(), z.unknown()).optional(),
|
|
935
|
+
// Structured metadata (JSON)
|
|
936
|
+
createdAt: z.number()
|
|
937
|
+
});
|
|
938
|
+
const SessionEventReportSchema = z.object({
|
|
939
|
+
sessionId: z.string(),
|
|
940
|
+
eventType: SessionEventTypeSchema,
|
|
941
|
+
summary: z.string().max(500),
|
|
942
|
+
detail: z.record(z.string(), z.unknown()).optional()
|
|
943
|
+
});
|
|
944
|
+
const SessionEventCreatedSchema = z.object({
|
|
945
|
+
type: z.literal("session-event-created"),
|
|
946
|
+
event: SessionEventSummarySchema
|
|
947
|
+
});
|
|
948
|
+
|
|
949
|
+
export { AgentLoopSummarySchema, AgentMessageSchema, ApiMessageSchema, ApiUpdateMachineStateSchema, ApiUpdateNewMessageSchema, ApiUpdateSessionStateSchema, AutoDreamProfileSummarySchema, AutomationAuditEventSummarySchema, AutomationAuditStatsSchema, AutomationCountsSchema, AutomationGuardianSummarySchema, AutomationGuardianUsageSummarySchema, AutomationJobKindSchema, AutomationJobStatusSchema, AutomationJobSummarySchema, AutomationPrioritySchema, AutomationStateSchema, BootstrapProfileSummarySchema, BriefMessageSchema, CoreUpdateBodySchema, CoreUpdateContainerSchema, CreateKnowledgeEntryBodySchema, CreateSkillBodySchema, CreateTaskBodySchema, CrossProjectSearchResponseSchema, CrossProjectSearchResultSchema, DaemonStateSchema, InboxCategorySchema, InboxItemSummarySchema, InboxNewItemSchema, InboxSeveritySchema, InboxUnreadCountSchema, KnowledgeActionSchema, KnowledgeChainEntrySchema, KnowledgeChainRelationSchema, KnowledgeChainResponseSchema, KnowledgeConfidenceSchema, KnowledgeContributorTypeSchema, KnowledgeEntryTypeSchema, KnowledgeInjectionModeSchema, KnowledgeInjectionRequestSchema, KnowledgeInjectionResponseSchema, KnowledgeStatusSchema, LegacyMessageContentSchema, MachineMetadataSchema, MessageContentSchema, MessageMetaSchema, ProjectProfileSchema, QueryKnowledgeParamsSchema, SessionEventCreatedSchema, SessionEventReportSchema, SessionEventSummarySchema, SessionEventTypeSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, SkillContentSchema, SkillSummarySchema, TailscaleInfoSchema, TailscaleServeEntrySchema, TaskPrioritySchema, TaskStatusChangedSchema, TaskStatusReportSchema, TaskStatusSchema, TaskSummarySchema, TaskTriggerDataSchema, TaskTriggerTypeSchema, TunnelEntrySchema, TunnelProviderInfoSchema, TunnelStateSchema, TurnKnowledgeExtractionSchema, UpdateBodySchema, UpdateKnowledgeEntryBodySchema, UpdateMachineBodySchema, UpdateNewMessageBodySchema, UpdateSchema, UpdateSessionBodySchema, UpdateSkillBodySchema, UserMessageSchema, VersionedEncryptedValueSchema, VersionedMachineEncryptedValueSchema, VersionedNullableEncryptedValueSchema, VoiceTokenAllowedSchema, VoiceTokenDeniedSchema, VoiceTokenResponseSchema, createEnvelope, sessionContextUsageCategorySchema, sessionContextUsageEventSchema, sessionEnvelopeSchema, sessionEventSchema, sessionFileEventSchema, sessionModelUsageSchema, sessionNeedsContinueEventSchema, sessionPromptSuggestionEventSchema, sessionRoleSchema, sessionServiceMessageEventSchema, sessionStartEventSchema, sessionStateChangedEventSchema, sessionStopEventSchema, sessionTaskEndEventSchema, sessionTaskLogEventSchema, sessionTaskProgressEventSchema, sessionTaskStartEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionToolProgressEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, sessionUsageUpdateEventSchema };
|