@kmmao/happy-wire 0.4.1 → 0.5.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
@@ -114,7 +114,9 @@ const sessionTaskStartEventSchema = z__namespace.object({
114
114
  taskId: z__namespace.string(),
115
115
  toolUseId: z__namespace.string().optional(),
116
116
  description: z__namespace.string(),
117
- taskType: z__namespace.string().optional()
117
+ taskType: z__namespace.string().optional(),
118
+ /** meta.name from the workflow script (e.g. 'spec'). Only set when taskType is 'local_workflow'. */
119
+ workflowName: z__namespace.string().optional()
118
120
  });
119
121
  const sessionTaskProgressEventSchema = z__namespace.object({
120
122
  t: z__namespace.literal("task-progress"),
@@ -154,6 +156,11 @@ const sessionPromptSuggestionEventSchema = z__namespace.object({
154
156
  const sessionNeedsContinueEventSchema = z__namespace.object({
155
157
  t: z__namespace.literal("needs-continue")
156
158
  });
159
+ const sessionStateChangedEventSchema = z__namespace.object({
160
+ t: z__namespace.literal("session-state-changed"),
161
+ /** Authoritative session lifecycle state from the SDK */
162
+ state: z__namespace.enum(["idle", "running", "requires_action"])
163
+ });
157
164
  const sessionEventSchema = z__namespace.discriminatedUnion("t", [
158
165
  sessionTextEventSchema,
159
166
  sessionServiceMessageEventSchema,
@@ -170,7 +177,8 @@ const sessionEventSchema = z__namespace.discriminatedUnion("t", [
170
177
  sessionTaskEndEventSchema,
171
178
  sessionToolProgressEventSchema,
172
179
  sessionPromptSuggestionEventSchema,
173
- sessionNeedsContinueEventSchema
180
+ sessionNeedsContinueEventSchema,
181
+ sessionStateChangedEventSchema
174
182
  ]);
175
183
  const sessionEnvelopeSchema = z__namespace.object({
176
184
  id: z__namespace.string(),
@@ -189,7 +197,7 @@ const sessionEnvelopeSchema = z__namespace.object({
189
197
  path: ["role"]
190
198
  });
191
199
  }
192
- if ((envelope.ev.t === "start" || envelope.ev.t === "stop" || envelope.ev.t === "usage-update" || envelope.ev.t === "task-start" || envelope.ev.t === "task-progress" || envelope.ev.t === "task-end" || envelope.ev.t === "tool-progress" || envelope.ev.t === "prompt-suggestion" || envelope.ev.t === "needs-continue") && envelope.role !== "agent") {
200
+ if ((envelope.ev.t === "start" || envelope.ev.t === "stop" || envelope.ev.t === "usage-update" || envelope.ev.t === "task-start" || envelope.ev.t === "task-progress" || envelope.ev.t === "task-end" || envelope.ev.t === "tool-progress" || envelope.ev.t === "prompt-suggestion" || envelope.ev.t === "needs-continue" || envelope.ev.t === "session-state-changed") && envelope.role !== "agent") {
193
201
  ctx.addIssue({
194
202
  code: z__namespace.ZodIssueCode.custom,
195
203
  message: `${envelope.ev.t} events must use role "agent"`,
@@ -387,6 +395,129 @@ const DaemonStateSchema = z__namespace.object({
387
395
  tunnels: TunnelStateSchema.optional()
388
396
  });
389
397
 
398
+ const KnowledgeEntryTypeSchema = z__namespace.enum([
399
+ "discovery",
400
+ // New insight or finding
401
+ "decision",
402
+ // Architecture / tech choice
403
+ "fix",
404
+ // Bug fix record
405
+ "convention",
406
+ // Code convention / process rule
407
+ "warning"
408
+ // Known pitfall or gotcha
409
+ ]);
410
+ const KnowledgeContributorTypeSchema = z__namespace.enum([
411
+ "session",
412
+ // Auto-generated by Claude session
413
+ "supervisor",
414
+ // Generated by Supervisor analysis
415
+ "user"
416
+ // Manually added by user
417
+ ]);
418
+ const KnowledgeActionSchema = z__namespace.enum([
419
+ "create",
420
+ // New entry
421
+ "amend",
422
+ // Correction / supplement
423
+ "supersede",
424
+ // Replace old knowledge
425
+ "verify"
426
+ // Confirm still valid
427
+ ]);
428
+ const KnowledgeStatusSchema = z__namespace.enum([
429
+ "active",
430
+ // Currently valid
431
+ "superseded",
432
+ // Replaced by newer knowledge
433
+ "archived"
434
+ // Manually archived by user
435
+ ]);
436
+ const KnowledgeConfidenceSchema = z__namespace.enum(["high", "medium", "low"]);
437
+ const CreateKnowledgeEntryBodySchema = z__namespace.object({
438
+ entryType: KnowledgeEntryTypeSchema,
439
+ contributorType: KnowledgeContributorTypeSchema,
440
+ action: KnowledgeActionSchema,
441
+ title: z__namespace.string().min(1).max(200),
442
+ content: z__namespace.string().min(1),
443
+ // Structured SOAP-like fields (optional)
444
+ request: z__namespace.string().optional(),
445
+ // S: What the user asked
446
+ findings: z__namespace.string().optional(),
447
+ // O: What was discovered
448
+ analysis: z__namespace.string().optional(),
449
+ // A: Root cause / assessment
450
+ outcome: z__namespace.string().optional(),
451
+ // P: What was done
452
+ nextSteps: z__namespace.string().optional(),
453
+ // Follow-up suggestions
454
+ tags: z__namespace.array(z__namespace.string().max(50)).max(20).default([]),
455
+ confidence: KnowledgeConfidenceSchema.default("medium"),
456
+ sessionId: z__namespace.string().optional(),
457
+ model: z__namespace.string().optional(),
458
+ supersedesId: z__namespace.string().optional(),
459
+ relatedIds: z__namespace.array(z__namespace.string()).max(10).default([]),
460
+ affectedFiles: z__namespace.array(z__namespace.string()).max(50).default([])
461
+ });
462
+ const UpdateKnowledgeEntryBodySchema = z__namespace.object({
463
+ status: KnowledgeStatusSchema.optional(),
464
+ pinned: z__namespace.boolean().optional(),
465
+ title: z__namespace.string().min(1).max(200).optional(),
466
+ content: z__namespace.string().min(1).optional(),
467
+ tags: z__namespace.array(z__namespace.string().max(50)).max(20).optional(),
468
+ confidence: KnowledgeConfidenceSchema.optional()
469
+ });
470
+ const QueryKnowledgeParamsSchema = z__namespace.object({
471
+ entryType: KnowledgeEntryTypeSchema.optional(),
472
+ status: KnowledgeStatusSchema.optional(),
473
+ tags: z__namespace.array(z__namespace.string()).optional(),
474
+ search: z__namespace.string().optional(),
475
+ limit: z__namespace.number().int().min(1).max(100).default(20),
476
+ offset: z__namespace.number().int().min(0).default(0)
477
+ });
478
+ const ProjectProfileSchema = z__namespace.object({
479
+ techStack: z__namespace.array(z__namespace.string()),
480
+ architectureType: z__namespace.string().optional(),
481
+ knownPitfalls: z__namespace.array(z__namespace.string()),
482
+ coreConventions: z__namespace.array(z__namespace.string()),
483
+ lastUpdatedAt: z__namespace.number(),
484
+ lastUpdatedBy: z__namespace.string().optional()
485
+ });
486
+ const KnowledgeInjectionModeSchema = z__namespace.enum(["auto", "full", "minimal"]);
487
+ const KnowledgeInjectionRequestSchema = z__namespace.object({
488
+ mode: KnowledgeInjectionModeSchema,
489
+ contextHints: z__namespace.array(z__namespace.string()).optional()
490
+ // Keywords from user message for relevance
491
+ });
492
+ const KnowledgeInjectionResponseSchema = z__namespace.object({
493
+ profile: ProjectProfileSchema.nullable(),
494
+ entries: z__namespace.array(z__namespace.object({
495
+ id: z__namespace.string(),
496
+ entryType: KnowledgeEntryTypeSchema,
497
+ title: z__namespace.string(),
498
+ content: z__namespace.string(),
499
+ tags: z__namespace.array(z__namespace.string()),
500
+ confidence: KnowledgeConfidenceSchema,
501
+ createdAt: z__namespace.string()
502
+ }))
503
+ });
504
+ const TurnKnowledgeExtractionSchema = z__namespace.object({
505
+ projectId: z__namespace.string(),
506
+ sessionId: z__namespace.string(),
507
+ model: z__namespace.string(),
508
+ turnId: z__namespace.string(),
509
+ turnData: z__namespace.object({
510
+ userMessage: z__namespace.string().max(2e3),
511
+ assistantText: z__namespace.string().max(5e3),
512
+ fileEdits: z__namespace.array(z__namespace.object({
513
+ path: z__namespace.string(),
514
+ type: z__namespace.enum(["create", "edit"])
515
+ })).max(50),
516
+ toolCallCount: z__namespace.number().int(),
517
+ outputTokens: z__namespace.number().int()
518
+ })
519
+ });
520
+
390
521
  exports.AgentMessageSchema = AgentMessageSchema;
391
522
  exports.ApiMessageSchema = ApiMessageSchema;
392
523
  exports.ApiUpdateMachineStateSchema = ApiUpdateMachineStateSchema;
@@ -394,11 +525,22 @@ exports.ApiUpdateNewMessageSchema = ApiUpdateNewMessageSchema;
394
525
  exports.ApiUpdateSessionStateSchema = ApiUpdateSessionStateSchema;
395
526
  exports.CoreUpdateBodySchema = CoreUpdateBodySchema;
396
527
  exports.CoreUpdateContainerSchema = CoreUpdateContainerSchema;
528
+ exports.CreateKnowledgeEntryBodySchema = CreateKnowledgeEntryBodySchema;
397
529
  exports.DaemonStateSchema = DaemonStateSchema;
530
+ exports.KnowledgeActionSchema = KnowledgeActionSchema;
531
+ exports.KnowledgeConfidenceSchema = KnowledgeConfidenceSchema;
532
+ exports.KnowledgeContributorTypeSchema = KnowledgeContributorTypeSchema;
533
+ exports.KnowledgeEntryTypeSchema = KnowledgeEntryTypeSchema;
534
+ exports.KnowledgeInjectionModeSchema = KnowledgeInjectionModeSchema;
535
+ exports.KnowledgeInjectionRequestSchema = KnowledgeInjectionRequestSchema;
536
+ exports.KnowledgeInjectionResponseSchema = KnowledgeInjectionResponseSchema;
537
+ exports.KnowledgeStatusSchema = KnowledgeStatusSchema;
398
538
  exports.LegacyMessageContentSchema = LegacyMessageContentSchema;
399
539
  exports.MachineMetadataSchema = MachineMetadataSchema;
400
540
  exports.MessageContentSchema = MessageContentSchema;
401
541
  exports.MessageMetaSchema = MessageMetaSchema;
542
+ exports.ProjectProfileSchema = ProjectProfileSchema;
543
+ exports.QueryKnowledgeParamsSchema = QueryKnowledgeParamsSchema;
402
544
  exports.SessionMessageContentSchema = SessionMessageContentSchema;
403
545
  exports.SessionMessageSchema = SessionMessageSchema;
404
546
  exports.SessionProtocolMessageSchema = SessionProtocolMessageSchema;
@@ -407,7 +549,9 @@ exports.TailscaleServeEntrySchema = TailscaleServeEntrySchema;
407
549
  exports.TunnelEntrySchema = TunnelEntrySchema;
408
550
  exports.TunnelProviderInfoSchema = TunnelProviderInfoSchema;
409
551
  exports.TunnelStateSchema = TunnelStateSchema;
552
+ exports.TurnKnowledgeExtractionSchema = TurnKnowledgeExtractionSchema;
410
553
  exports.UpdateBodySchema = UpdateBodySchema;
554
+ exports.UpdateKnowledgeEntryBodySchema = UpdateKnowledgeEntryBodySchema;
411
555
  exports.UpdateMachineBodySchema = UpdateMachineBodySchema;
412
556
  exports.UpdateNewMessageBodySchema = UpdateNewMessageBodySchema;
413
557
  exports.UpdateSchema = UpdateSchema;
@@ -426,6 +570,7 @@ exports.sessionPromptSuggestionEventSchema = sessionPromptSuggestionEventSchema;
426
570
  exports.sessionRoleSchema = sessionRoleSchema;
427
571
  exports.sessionServiceMessageEventSchema = sessionServiceMessageEventSchema;
428
572
  exports.sessionStartEventSchema = sessionStartEventSchema;
573
+ exports.sessionStateChangedEventSchema = sessionStateChangedEventSchema;
429
574
  exports.sessionStopEventSchema = sessionStopEventSchema;
430
575
  exports.sessionTaskEndEventSchema = sessionTaskEndEventSchema;
431
576
  exports.sessionTaskProgressEventSchema = sessionTaskProgressEventSchema;
package/dist/index.d.cts CHANGED
@@ -128,6 +128,7 @@ declare const SessionProtocolMessageSchema: z.ZodObject<{
128
128
  toolUseId: z.ZodOptional<z.ZodString>;
129
129
  description: z.ZodString;
130
130
  taskType: z.ZodOptional<z.ZodString>;
131
+ workflowName: z.ZodOptional<z.ZodString>;
131
132
  }, z.core.$strip>, z.ZodObject<{
132
133
  t: z.ZodLiteral<"task-progress">;
133
134
  taskId: z.ZodString;
@@ -164,6 +165,13 @@ declare const SessionProtocolMessageSchema: z.ZodObject<{
164
165
  suggestion: z.ZodString;
165
166
  }, z.core.$strip>, z.ZodObject<{
166
167
  t: z.ZodLiteral<"needs-continue">;
168
+ }, z.core.$strip>, z.ZodObject<{
169
+ t: z.ZodLiteral<"session-state-changed">;
170
+ state: z.ZodEnum<{
171
+ idle: "idle";
172
+ running: "running";
173
+ requires_action: "requires_action";
174
+ }>;
167
175
  }, z.core.$strip>], "t">;
168
176
  }, z.core.$strip>;
169
177
  meta: z.ZodOptional<z.ZodObject<{
@@ -326,6 +334,7 @@ declare const MessageContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
326
334
  toolUseId: z.ZodOptional<z.ZodString>;
327
335
  description: z.ZodString;
328
336
  taskType: z.ZodOptional<z.ZodString>;
337
+ workflowName: z.ZodOptional<z.ZodString>;
329
338
  }, z.core.$strip>, z.ZodObject<{
330
339
  t: z.ZodLiteral<"task-progress">;
331
340
  taskId: z.ZodString;
@@ -362,6 +371,13 @@ declare const MessageContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
362
371
  suggestion: z.ZodString;
363
372
  }, z.core.$strip>, z.ZodObject<{
364
373
  t: z.ZodLiteral<"needs-continue">;
374
+ }, z.core.$strip>, z.ZodObject<{
375
+ t: z.ZodLiteral<"session-state-changed">;
376
+ state: z.ZodEnum<{
377
+ idle: "idle";
378
+ running: "running";
379
+ requires_action: "requires_action";
380
+ }>;
365
381
  }, z.core.$strip>], "t">;
366
382
  }, z.core.$strip>;
367
383
  meta: z.ZodOptional<z.ZodObject<{
@@ -883,6 +899,7 @@ declare const sessionTaskStartEventSchema: z.ZodObject<{
883
899
  toolUseId: z.ZodOptional<z.ZodString>;
884
900
  description: z.ZodString;
885
901
  taskType: z.ZodOptional<z.ZodString>;
902
+ workflowName: z.ZodOptional<z.ZodString>;
886
903
  }, z.core.$strip>;
887
904
  declare const sessionTaskProgressEventSchema: z.ZodObject<{
888
905
  t: z.ZodLiteral<"task-progress">;
@@ -925,6 +942,14 @@ declare const sessionPromptSuggestionEventSchema: z.ZodObject<{
925
942
  declare const sessionNeedsContinueEventSchema: z.ZodObject<{
926
943
  t: z.ZodLiteral<"needs-continue">;
927
944
  }, z.core.$strip>;
945
+ declare const sessionStateChangedEventSchema: z.ZodObject<{
946
+ t: z.ZodLiteral<"session-state-changed">;
947
+ state: z.ZodEnum<{
948
+ idle: "idle";
949
+ running: "running";
950
+ requires_action: "requires_action";
951
+ }>;
952
+ }, z.core.$strip>;
928
953
  declare const sessionEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
929
954
  t: z.ZodLiteral<"text">;
930
955
  text: z.ZodString;
@@ -1003,6 +1028,7 @@ declare const sessionEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1003
1028
  toolUseId: z.ZodOptional<z.ZodString>;
1004
1029
  description: z.ZodString;
1005
1030
  taskType: z.ZodOptional<z.ZodString>;
1031
+ workflowName: z.ZodOptional<z.ZodString>;
1006
1032
  }, z.core.$strip>, z.ZodObject<{
1007
1033
  t: z.ZodLiteral<"task-progress">;
1008
1034
  taskId: z.ZodString;
@@ -1039,6 +1065,13 @@ declare const sessionEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1039
1065
  suggestion: z.ZodString;
1040
1066
  }, z.core.$strip>, z.ZodObject<{
1041
1067
  t: z.ZodLiteral<"needs-continue">;
1068
+ }, z.core.$strip>, z.ZodObject<{
1069
+ t: z.ZodLiteral<"session-state-changed">;
1070
+ state: z.ZodEnum<{
1071
+ idle: "idle";
1072
+ running: "running";
1073
+ requires_action: "requires_action";
1074
+ }>;
1042
1075
  }, z.core.$strip>], "t">;
1043
1076
  type SessionEvent = z.infer<typeof sessionEventSchema>;
1044
1077
  declare const sessionEnvelopeSchema: z.ZodObject<{
@@ -1128,6 +1161,7 @@ declare const sessionEnvelopeSchema: z.ZodObject<{
1128
1161
  toolUseId: z.ZodOptional<z.ZodString>;
1129
1162
  description: z.ZodString;
1130
1163
  taskType: z.ZodOptional<z.ZodString>;
1164
+ workflowName: z.ZodOptional<z.ZodString>;
1131
1165
  }, z.core.$strip>, z.ZodObject<{
1132
1166
  t: z.ZodLiteral<"task-progress">;
1133
1167
  taskId: z.ZodString;
@@ -1164,6 +1198,13 @@ declare const sessionEnvelopeSchema: z.ZodObject<{
1164
1198
  suggestion: z.ZodString;
1165
1199
  }, z.core.$strip>, z.ZodObject<{
1166
1200
  t: z.ZodLiteral<"needs-continue">;
1201
+ }, z.core.$strip>, z.ZodObject<{
1202
+ t: z.ZodLiteral<"session-state-changed">;
1203
+ state: z.ZodEnum<{
1204
+ idle: "idle";
1205
+ running: "running";
1206
+ requires_action: "requires_action";
1207
+ }>;
1167
1208
  }, z.core.$strip>], "t">;
1168
1209
  }, z.core.$strip>;
1169
1210
  type SessionEnvelope = z.infer<typeof sessionEnvelopeSchema>;
@@ -1360,5 +1401,188 @@ declare const DaemonStateSchema: z.ZodObject<{
1360
1401
  }, z.core.$strip>;
1361
1402
  type DaemonState = z.infer<typeof DaemonStateSchema>;
1362
1403
 
1363
- export { AgentMessageSchema, ApiMessageSchema, ApiUpdateMachineStateSchema, ApiUpdateNewMessageSchema, ApiUpdateSessionStateSchema, CoreUpdateBodySchema, CoreUpdateContainerSchema, DaemonStateSchema, LegacyMessageContentSchema, MachineMetadataSchema, MessageContentSchema, MessageMetaSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, TailscaleInfoSchema, TailscaleServeEntrySchema, TunnelEntrySchema, TunnelProviderInfoSchema, TunnelStateSchema, UpdateBodySchema, UpdateMachineBodySchema, UpdateNewMessageBodySchema, UpdateSchema, UpdateSessionBodySchema, UserMessageSchema, VersionedEncryptedValueSchema, VersionedMachineEncryptedValueSchema, VersionedNullableEncryptedValueSchema, createEnvelope, sessionEnvelopeSchema, sessionEventSchema, sessionFileEventSchema, sessionModelUsageSchema, sessionNeedsContinueEventSchema, sessionPromptSuggestionEventSchema, sessionRoleSchema, sessionServiceMessageEventSchema, sessionStartEventSchema, sessionStopEventSchema, sessionTaskEndEventSchema, sessionTaskProgressEventSchema, sessionTaskStartEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionToolProgressEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, sessionUsageUpdateEventSchema };
1364
- export type { AgentMessage, ApiMessage, ApiUpdateMachineState, ApiUpdateNewMessage, ApiUpdateSessionState, CoreUpdateBody, CoreUpdateContainer, CreateEnvelopeOptions, DaemonState, LegacyMessageContent, MachineMetadata, MessageContent, MessageMeta, SessionEnvelope, SessionEvent, SessionMessage, SessionMessageContent, SessionModelUsage, SessionProtocolMessage, SessionRole, SessionTurnEndStatus, TailscaleInfo, TailscaleServeEntry, TunnelEntry, TunnelProviderInfo, TunnelState, Update, UpdateBody, UpdateMachineBody, UpdateNewMessageBody, UpdateSessionBody, UserMessage, VersionedEncryptedValue, VersionedMachineEncryptedValue, VersionedNullableEncryptedValue };
1404
+ declare const KnowledgeEntryTypeSchema: z.ZodEnum<{
1405
+ discovery: "discovery";
1406
+ decision: "decision";
1407
+ fix: "fix";
1408
+ convention: "convention";
1409
+ warning: "warning";
1410
+ }>;
1411
+ type KnowledgeEntryType = z.infer<typeof KnowledgeEntryTypeSchema>;
1412
+ declare const KnowledgeContributorTypeSchema: z.ZodEnum<{
1413
+ user: "user";
1414
+ session: "session";
1415
+ supervisor: "supervisor";
1416
+ }>;
1417
+ type KnowledgeContributorType = z.infer<typeof KnowledgeContributorTypeSchema>;
1418
+ declare const KnowledgeActionSchema: z.ZodEnum<{
1419
+ create: "create";
1420
+ amend: "amend";
1421
+ supersede: "supersede";
1422
+ verify: "verify";
1423
+ }>;
1424
+ type KnowledgeAction = z.infer<typeof KnowledgeActionSchema>;
1425
+ declare const KnowledgeStatusSchema: z.ZodEnum<{
1426
+ active: "active";
1427
+ superseded: "superseded";
1428
+ archived: "archived";
1429
+ }>;
1430
+ type KnowledgeStatus = z.infer<typeof KnowledgeStatusSchema>;
1431
+ declare const KnowledgeConfidenceSchema: z.ZodEnum<{
1432
+ high: "high";
1433
+ medium: "medium";
1434
+ low: "low";
1435
+ }>;
1436
+ type KnowledgeConfidence = z.infer<typeof KnowledgeConfidenceSchema>;
1437
+ declare const CreateKnowledgeEntryBodySchema: z.ZodObject<{
1438
+ entryType: z.ZodEnum<{
1439
+ discovery: "discovery";
1440
+ decision: "decision";
1441
+ fix: "fix";
1442
+ convention: "convention";
1443
+ warning: "warning";
1444
+ }>;
1445
+ contributorType: z.ZodEnum<{
1446
+ user: "user";
1447
+ session: "session";
1448
+ supervisor: "supervisor";
1449
+ }>;
1450
+ action: z.ZodEnum<{
1451
+ create: "create";
1452
+ amend: "amend";
1453
+ supersede: "supersede";
1454
+ verify: "verify";
1455
+ }>;
1456
+ title: z.ZodString;
1457
+ content: z.ZodString;
1458
+ request: z.ZodOptional<z.ZodString>;
1459
+ findings: z.ZodOptional<z.ZodString>;
1460
+ analysis: z.ZodOptional<z.ZodString>;
1461
+ outcome: z.ZodOptional<z.ZodString>;
1462
+ nextSteps: z.ZodOptional<z.ZodString>;
1463
+ tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
1464
+ confidence: z.ZodDefault<z.ZodEnum<{
1465
+ high: "high";
1466
+ medium: "medium";
1467
+ low: "low";
1468
+ }>>;
1469
+ sessionId: z.ZodOptional<z.ZodString>;
1470
+ model: z.ZodOptional<z.ZodString>;
1471
+ supersedesId: z.ZodOptional<z.ZodString>;
1472
+ relatedIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
1473
+ affectedFiles: z.ZodDefault<z.ZodArray<z.ZodString>>;
1474
+ }, z.core.$strip>;
1475
+ type CreateKnowledgeEntryBody = z.infer<typeof CreateKnowledgeEntryBodySchema>;
1476
+ declare const UpdateKnowledgeEntryBodySchema: z.ZodObject<{
1477
+ status: z.ZodOptional<z.ZodEnum<{
1478
+ active: "active";
1479
+ superseded: "superseded";
1480
+ archived: "archived";
1481
+ }>>;
1482
+ pinned: z.ZodOptional<z.ZodBoolean>;
1483
+ title: z.ZodOptional<z.ZodString>;
1484
+ content: z.ZodOptional<z.ZodString>;
1485
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
1486
+ confidence: z.ZodOptional<z.ZodEnum<{
1487
+ high: "high";
1488
+ medium: "medium";
1489
+ low: "low";
1490
+ }>>;
1491
+ }, z.core.$strip>;
1492
+ type UpdateKnowledgeEntryBody = z.infer<typeof UpdateKnowledgeEntryBodySchema>;
1493
+ declare const QueryKnowledgeParamsSchema: z.ZodObject<{
1494
+ entryType: z.ZodOptional<z.ZodEnum<{
1495
+ discovery: "discovery";
1496
+ decision: "decision";
1497
+ fix: "fix";
1498
+ convention: "convention";
1499
+ warning: "warning";
1500
+ }>>;
1501
+ status: z.ZodOptional<z.ZodEnum<{
1502
+ active: "active";
1503
+ superseded: "superseded";
1504
+ archived: "archived";
1505
+ }>>;
1506
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
1507
+ search: z.ZodOptional<z.ZodString>;
1508
+ limit: z.ZodDefault<z.ZodNumber>;
1509
+ offset: z.ZodDefault<z.ZodNumber>;
1510
+ }, z.core.$strip>;
1511
+ type QueryKnowledgeParams = z.infer<typeof QueryKnowledgeParamsSchema>;
1512
+ declare const ProjectProfileSchema: z.ZodObject<{
1513
+ techStack: z.ZodArray<z.ZodString>;
1514
+ architectureType: z.ZodOptional<z.ZodString>;
1515
+ knownPitfalls: z.ZodArray<z.ZodString>;
1516
+ coreConventions: z.ZodArray<z.ZodString>;
1517
+ lastUpdatedAt: z.ZodNumber;
1518
+ lastUpdatedBy: z.ZodOptional<z.ZodString>;
1519
+ }, z.core.$strip>;
1520
+ type ProjectProfile = z.infer<typeof ProjectProfileSchema>;
1521
+ declare const KnowledgeInjectionModeSchema: z.ZodEnum<{
1522
+ auto: "auto";
1523
+ full: "full";
1524
+ minimal: "minimal";
1525
+ }>;
1526
+ type KnowledgeInjectionMode = z.infer<typeof KnowledgeInjectionModeSchema>;
1527
+ declare const KnowledgeInjectionRequestSchema: z.ZodObject<{
1528
+ mode: z.ZodEnum<{
1529
+ auto: "auto";
1530
+ full: "full";
1531
+ minimal: "minimal";
1532
+ }>;
1533
+ contextHints: z.ZodOptional<z.ZodArray<z.ZodString>>;
1534
+ }, z.core.$strip>;
1535
+ type KnowledgeInjectionRequest = z.infer<typeof KnowledgeInjectionRequestSchema>;
1536
+ declare const KnowledgeInjectionResponseSchema: z.ZodObject<{
1537
+ profile: z.ZodNullable<z.ZodObject<{
1538
+ techStack: z.ZodArray<z.ZodString>;
1539
+ architectureType: z.ZodOptional<z.ZodString>;
1540
+ knownPitfalls: z.ZodArray<z.ZodString>;
1541
+ coreConventions: z.ZodArray<z.ZodString>;
1542
+ lastUpdatedAt: z.ZodNumber;
1543
+ lastUpdatedBy: z.ZodOptional<z.ZodString>;
1544
+ }, z.core.$strip>>;
1545
+ entries: z.ZodArray<z.ZodObject<{
1546
+ id: z.ZodString;
1547
+ entryType: z.ZodEnum<{
1548
+ discovery: "discovery";
1549
+ decision: "decision";
1550
+ fix: "fix";
1551
+ convention: "convention";
1552
+ warning: "warning";
1553
+ }>;
1554
+ title: z.ZodString;
1555
+ content: z.ZodString;
1556
+ tags: z.ZodArray<z.ZodString>;
1557
+ confidence: z.ZodEnum<{
1558
+ high: "high";
1559
+ medium: "medium";
1560
+ low: "low";
1561
+ }>;
1562
+ createdAt: z.ZodString;
1563
+ }, z.core.$strip>>;
1564
+ }, z.core.$strip>;
1565
+ type KnowledgeInjectionResponse = z.infer<typeof KnowledgeInjectionResponseSchema>;
1566
+ declare const TurnKnowledgeExtractionSchema: z.ZodObject<{
1567
+ projectId: z.ZodString;
1568
+ sessionId: z.ZodString;
1569
+ model: z.ZodString;
1570
+ turnId: z.ZodString;
1571
+ turnData: z.ZodObject<{
1572
+ userMessage: z.ZodString;
1573
+ assistantText: z.ZodString;
1574
+ fileEdits: z.ZodArray<z.ZodObject<{
1575
+ path: z.ZodString;
1576
+ type: z.ZodEnum<{
1577
+ create: "create";
1578
+ edit: "edit";
1579
+ }>;
1580
+ }, z.core.$strip>>;
1581
+ toolCallCount: z.ZodNumber;
1582
+ outputTokens: z.ZodNumber;
1583
+ }, z.core.$strip>;
1584
+ }, z.core.$strip>;
1585
+ type TurnKnowledgeExtraction = z.infer<typeof TurnKnowledgeExtractionSchema>;
1586
+
1587
+ export { AgentMessageSchema, ApiMessageSchema, ApiUpdateMachineStateSchema, ApiUpdateNewMessageSchema, ApiUpdateSessionStateSchema, CoreUpdateBodySchema, CoreUpdateContainerSchema, CreateKnowledgeEntryBodySchema, DaemonStateSchema, KnowledgeActionSchema, KnowledgeConfidenceSchema, KnowledgeContributorTypeSchema, KnowledgeEntryTypeSchema, KnowledgeInjectionModeSchema, KnowledgeInjectionRequestSchema, KnowledgeInjectionResponseSchema, KnowledgeStatusSchema, LegacyMessageContentSchema, MachineMetadataSchema, MessageContentSchema, MessageMetaSchema, ProjectProfileSchema, QueryKnowledgeParamsSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, TailscaleInfoSchema, TailscaleServeEntrySchema, TunnelEntrySchema, TunnelProviderInfoSchema, TunnelStateSchema, TurnKnowledgeExtractionSchema, UpdateBodySchema, UpdateKnowledgeEntryBodySchema, UpdateMachineBodySchema, UpdateNewMessageBodySchema, UpdateSchema, UpdateSessionBodySchema, UserMessageSchema, VersionedEncryptedValueSchema, VersionedMachineEncryptedValueSchema, VersionedNullableEncryptedValueSchema, createEnvelope, sessionEnvelopeSchema, sessionEventSchema, sessionFileEventSchema, sessionModelUsageSchema, sessionNeedsContinueEventSchema, sessionPromptSuggestionEventSchema, sessionRoleSchema, sessionServiceMessageEventSchema, sessionStartEventSchema, sessionStateChangedEventSchema, sessionStopEventSchema, sessionTaskEndEventSchema, sessionTaskProgressEventSchema, sessionTaskStartEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionToolProgressEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, sessionUsageUpdateEventSchema };
1588
+ export type { AgentMessage, ApiMessage, ApiUpdateMachineState, ApiUpdateNewMessage, ApiUpdateSessionState, CoreUpdateBody, CoreUpdateContainer, CreateEnvelopeOptions, CreateKnowledgeEntryBody, DaemonState, KnowledgeAction, KnowledgeConfidence, KnowledgeContributorType, KnowledgeEntryType, KnowledgeInjectionMode, KnowledgeInjectionRequest, KnowledgeInjectionResponse, KnowledgeStatus, LegacyMessageContent, MachineMetadata, MessageContent, MessageMeta, ProjectProfile, QueryKnowledgeParams, SessionEnvelope, SessionEvent, SessionMessage, SessionMessageContent, SessionModelUsage, SessionProtocolMessage, SessionRole, SessionTurnEndStatus, TailscaleInfo, TailscaleServeEntry, TunnelEntry, TunnelProviderInfo, TunnelState, TurnKnowledgeExtraction, Update, UpdateBody, UpdateKnowledgeEntryBody, UpdateMachineBody, UpdateNewMessageBody, UpdateSessionBody, UserMessage, VersionedEncryptedValue, VersionedMachineEncryptedValue, VersionedNullableEncryptedValue };
package/dist/index.d.mts CHANGED
@@ -128,6 +128,7 @@ declare const SessionProtocolMessageSchema: z.ZodObject<{
128
128
  toolUseId: z.ZodOptional<z.ZodString>;
129
129
  description: z.ZodString;
130
130
  taskType: z.ZodOptional<z.ZodString>;
131
+ workflowName: z.ZodOptional<z.ZodString>;
131
132
  }, z.core.$strip>, z.ZodObject<{
132
133
  t: z.ZodLiteral<"task-progress">;
133
134
  taskId: z.ZodString;
@@ -164,6 +165,13 @@ declare const SessionProtocolMessageSchema: z.ZodObject<{
164
165
  suggestion: z.ZodString;
165
166
  }, z.core.$strip>, z.ZodObject<{
166
167
  t: z.ZodLiteral<"needs-continue">;
168
+ }, z.core.$strip>, z.ZodObject<{
169
+ t: z.ZodLiteral<"session-state-changed">;
170
+ state: z.ZodEnum<{
171
+ idle: "idle";
172
+ running: "running";
173
+ requires_action: "requires_action";
174
+ }>;
167
175
  }, z.core.$strip>], "t">;
168
176
  }, z.core.$strip>;
169
177
  meta: z.ZodOptional<z.ZodObject<{
@@ -326,6 +334,7 @@ declare const MessageContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
326
334
  toolUseId: z.ZodOptional<z.ZodString>;
327
335
  description: z.ZodString;
328
336
  taskType: z.ZodOptional<z.ZodString>;
337
+ workflowName: z.ZodOptional<z.ZodString>;
329
338
  }, z.core.$strip>, z.ZodObject<{
330
339
  t: z.ZodLiteral<"task-progress">;
331
340
  taskId: z.ZodString;
@@ -362,6 +371,13 @@ declare const MessageContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
362
371
  suggestion: z.ZodString;
363
372
  }, z.core.$strip>, z.ZodObject<{
364
373
  t: z.ZodLiteral<"needs-continue">;
374
+ }, z.core.$strip>, z.ZodObject<{
375
+ t: z.ZodLiteral<"session-state-changed">;
376
+ state: z.ZodEnum<{
377
+ idle: "idle";
378
+ running: "running";
379
+ requires_action: "requires_action";
380
+ }>;
365
381
  }, z.core.$strip>], "t">;
366
382
  }, z.core.$strip>;
367
383
  meta: z.ZodOptional<z.ZodObject<{
@@ -883,6 +899,7 @@ declare const sessionTaskStartEventSchema: z.ZodObject<{
883
899
  toolUseId: z.ZodOptional<z.ZodString>;
884
900
  description: z.ZodString;
885
901
  taskType: z.ZodOptional<z.ZodString>;
902
+ workflowName: z.ZodOptional<z.ZodString>;
886
903
  }, z.core.$strip>;
887
904
  declare const sessionTaskProgressEventSchema: z.ZodObject<{
888
905
  t: z.ZodLiteral<"task-progress">;
@@ -925,6 +942,14 @@ declare const sessionPromptSuggestionEventSchema: z.ZodObject<{
925
942
  declare const sessionNeedsContinueEventSchema: z.ZodObject<{
926
943
  t: z.ZodLiteral<"needs-continue">;
927
944
  }, z.core.$strip>;
945
+ declare const sessionStateChangedEventSchema: z.ZodObject<{
946
+ t: z.ZodLiteral<"session-state-changed">;
947
+ state: z.ZodEnum<{
948
+ idle: "idle";
949
+ running: "running";
950
+ requires_action: "requires_action";
951
+ }>;
952
+ }, z.core.$strip>;
928
953
  declare const sessionEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
929
954
  t: z.ZodLiteral<"text">;
930
955
  text: z.ZodString;
@@ -1003,6 +1028,7 @@ declare const sessionEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1003
1028
  toolUseId: z.ZodOptional<z.ZodString>;
1004
1029
  description: z.ZodString;
1005
1030
  taskType: z.ZodOptional<z.ZodString>;
1031
+ workflowName: z.ZodOptional<z.ZodString>;
1006
1032
  }, z.core.$strip>, z.ZodObject<{
1007
1033
  t: z.ZodLiteral<"task-progress">;
1008
1034
  taskId: z.ZodString;
@@ -1039,6 +1065,13 @@ declare const sessionEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1039
1065
  suggestion: z.ZodString;
1040
1066
  }, z.core.$strip>, z.ZodObject<{
1041
1067
  t: z.ZodLiteral<"needs-continue">;
1068
+ }, z.core.$strip>, z.ZodObject<{
1069
+ t: z.ZodLiteral<"session-state-changed">;
1070
+ state: z.ZodEnum<{
1071
+ idle: "idle";
1072
+ running: "running";
1073
+ requires_action: "requires_action";
1074
+ }>;
1042
1075
  }, z.core.$strip>], "t">;
1043
1076
  type SessionEvent = z.infer<typeof sessionEventSchema>;
1044
1077
  declare const sessionEnvelopeSchema: z.ZodObject<{
@@ -1128,6 +1161,7 @@ declare const sessionEnvelopeSchema: z.ZodObject<{
1128
1161
  toolUseId: z.ZodOptional<z.ZodString>;
1129
1162
  description: z.ZodString;
1130
1163
  taskType: z.ZodOptional<z.ZodString>;
1164
+ workflowName: z.ZodOptional<z.ZodString>;
1131
1165
  }, z.core.$strip>, z.ZodObject<{
1132
1166
  t: z.ZodLiteral<"task-progress">;
1133
1167
  taskId: z.ZodString;
@@ -1164,6 +1198,13 @@ declare const sessionEnvelopeSchema: z.ZodObject<{
1164
1198
  suggestion: z.ZodString;
1165
1199
  }, z.core.$strip>, z.ZodObject<{
1166
1200
  t: z.ZodLiteral<"needs-continue">;
1201
+ }, z.core.$strip>, z.ZodObject<{
1202
+ t: z.ZodLiteral<"session-state-changed">;
1203
+ state: z.ZodEnum<{
1204
+ idle: "idle";
1205
+ running: "running";
1206
+ requires_action: "requires_action";
1207
+ }>;
1167
1208
  }, z.core.$strip>], "t">;
1168
1209
  }, z.core.$strip>;
1169
1210
  type SessionEnvelope = z.infer<typeof sessionEnvelopeSchema>;
@@ -1360,5 +1401,188 @@ declare const DaemonStateSchema: z.ZodObject<{
1360
1401
  }, z.core.$strip>;
1361
1402
  type DaemonState = z.infer<typeof DaemonStateSchema>;
1362
1403
 
1363
- export { AgentMessageSchema, ApiMessageSchema, ApiUpdateMachineStateSchema, ApiUpdateNewMessageSchema, ApiUpdateSessionStateSchema, CoreUpdateBodySchema, CoreUpdateContainerSchema, DaemonStateSchema, LegacyMessageContentSchema, MachineMetadataSchema, MessageContentSchema, MessageMetaSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, TailscaleInfoSchema, TailscaleServeEntrySchema, TunnelEntrySchema, TunnelProviderInfoSchema, TunnelStateSchema, UpdateBodySchema, UpdateMachineBodySchema, UpdateNewMessageBodySchema, UpdateSchema, UpdateSessionBodySchema, UserMessageSchema, VersionedEncryptedValueSchema, VersionedMachineEncryptedValueSchema, VersionedNullableEncryptedValueSchema, createEnvelope, sessionEnvelopeSchema, sessionEventSchema, sessionFileEventSchema, sessionModelUsageSchema, sessionNeedsContinueEventSchema, sessionPromptSuggestionEventSchema, sessionRoleSchema, sessionServiceMessageEventSchema, sessionStartEventSchema, sessionStopEventSchema, sessionTaskEndEventSchema, sessionTaskProgressEventSchema, sessionTaskStartEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionToolProgressEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, sessionUsageUpdateEventSchema };
1364
- export type { AgentMessage, ApiMessage, ApiUpdateMachineState, ApiUpdateNewMessage, ApiUpdateSessionState, CoreUpdateBody, CoreUpdateContainer, CreateEnvelopeOptions, DaemonState, LegacyMessageContent, MachineMetadata, MessageContent, MessageMeta, SessionEnvelope, SessionEvent, SessionMessage, SessionMessageContent, SessionModelUsage, SessionProtocolMessage, SessionRole, SessionTurnEndStatus, TailscaleInfo, TailscaleServeEntry, TunnelEntry, TunnelProviderInfo, TunnelState, Update, UpdateBody, UpdateMachineBody, UpdateNewMessageBody, UpdateSessionBody, UserMessage, VersionedEncryptedValue, VersionedMachineEncryptedValue, VersionedNullableEncryptedValue };
1404
+ declare const KnowledgeEntryTypeSchema: z.ZodEnum<{
1405
+ discovery: "discovery";
1406
+ decision: "decision";
1407
+ fix: "fix";
1408
+ convention: "convention";
1409
+ warning: "warning";
1410
+ }>;
1411
+ type KnowledgeEntryType = z.infer<typeof KnowledgeEntryTypeSchema>;
1412
+ declare const KnowledgeContributorTypeSchema: z.ZodEnum<{
1413
+ user: "user";
1414
+ session: "session";
1415
+ supervisor: "supervisor";
1416
+ }>;
1417
+ type KnowledgeContributorType = z.infer<typeof KnowledgeContributorTypeSchema>;
1418
+ declare const KnowledgeActionSchema: z.ZodEnum<{
1419
+ create: "create";
1420
+ amend: "amend";
1421
+ supersede: "supersede";
1422
+ verify: "verify";
1423
+ }>;
1424
+ type KnowledgeAction = z.infer<typeof KnowledgeActionSchema>;
1425
+ declare const KnowledgeStatusSchema: z.ZodEnum<{
1426
+ active: "active";
1427
+ superseded: "superseded";
1428
+ archived: "archived";
1429
+ }>;
1430
+ type KnowledgeStatus = z.infer<typeof KnowledgeStatusSchema>;
1431
+ declare const KnowledgeConfidenceSchema: z.ZodEnum<{
1432
+ high: "high";
1433
+ medium: "medium";
1434
+ low: "low";
1435
+ }>;
1436
+ type KnowledgeConfidence = z.infer<typeof KnowledgeConfidenceSchema>;
1437
+ declare const CreateKnowledgeEntryBodySchema: z.ZodObject<{
1438
+ entryType: z.ZodEnum<{
1439
+ discovery: "discovery";
1440
+ decision: "decision";
1441
+ fix: "fix";
1442
+ convention: "convention";
1443
+ warning: "warning";
1444
+ }>;
1445
+ contributorType: z.ZodEnum<{
1446
+ user: "user";
1447
+ session: "session";
1448
+ supervisor: "supervisor";
1449
+ }>;
1450
+ action: z.ZodEnum<{
1451
+ create: "create";
1452
+ amend: "amend";
1453
+ supersede: "supersede";
1454
+ verify: "verify";
1455
+ }>;
1456
+ title: z.ZodString;
1457
+ content: z.ZodString;
1458
+ request: z.ZodOptional<z.ZodString>;
1459
+ findings: z.ZodOptional<z.ZodString>;
1460
+ analysis: z.ZodOptional<z.ZodString>;
1461
+ outcome: z.ZodOptional<z.ZodString>;
1462
+ nextSteps: z.ZodOptional<z.ZodString>;
1463
+ tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
1464
+ confidence: z.ZodDefault<z.ZodEnum<{
1465
+ high: "high";
1466
+ medium: "medium";
1467
+ low: "low";
1468
+ }>>;
1469
+ sessionId: z.ZodOptional<z.ZodString>;
1470
+ model: z.ZodOptional<z.ZodString>;
1471
+ supersedesId: z.ZodOptional<z.ZodString>;
1472
+ relatedIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
1473
+ affectedFiles: z.ZodDefault<z.ZodArray<z.ZodString>>;
1474
+ }, z.core.$strip>;
1475
+ type CreateKnowledgeEntryBody = z.infer<typeof CreateKnowledgeEntryBodySchema>;
1476
+ declare const UpdateKnowledgeEntryBodySchema: z.ZodObject<{
1477
+ status: z.ZodOptional<z.ZodEnum<{
1478
+ active: "active";
1479
+ superseded: "superseded";
1480
+ archived: "archived";
1481
+ }>>;
1482
+ pinned: z.ZodOptional<z.ZodBoolean>;
1483
+ title: z.ZodOptional<z.ZodString>;
1484
+ content: z.ZodOptional<z.ZodString>;
1485
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
1486
+ confidence: z.ZodOptional<z.ZodEnum<{
1487
+ high: "high";
1488
+ medium: "medium";
1489
+ low: "low";
1490
+ }>>;
1491
+ }, z.core.$strip>;
1492
+ type UpdateKnowledgeEntryBody = z.infer<typeof UpdateKnowledgeEntryBodySchema>;
1493
+ declare const QueryKnowledgeParamsSchema: z.ZodObject<{
1494
+ entryType: z.ZodOptional<z.ZodEnum<{
1495
+ discovery: "discovery";
1496
+ decision: "decision";
1497
+ fix: "fix";
1498
+ convention: "convention";
1499
+ warning: "warning";
1500
+ }>>;
1501
+ status: z.ZodOptional<z.ZodEnum<{
1502
+ active: "active";
1503
+ superseded: "superseded";
1504
+ archived: "archived";
1505
+ }>>;
1506
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
1507
+ search: z.ZodOptional<z.ZodString>;
1508
+ limit: z.ZodDefault<z.ZodNumber>;
1509
+ offset: z.ZodDefault<z.ZodNumber>;
1510
+ }, z.core.$strip>;
1511
+ type QueryKnowledgeParams = z.infer<typeof QueryKnowledgeParamsSchema>;
1512
+ declare const ProjectProfileSchema: z.ZodObject<{
1513
+ techStack: z.ZodArray<z.ZodString>;
1514
+ architectureType: z.ZodOptional<z.ZodString>;
1515
+ knownPitfalls: z.ZodArray<z.ZodString>;
1516
+ coreConventions: z.ZodArray<z.ZodString>;
1517
+ lastUpdatedAt: z.ZodNumber;
1518
+ lastUpdatedBy: z.ZodOptional<z.ZodString>;
1519
+ }, z.core.$strip>;
1520
+ type ProjectProfile = z.infer<typeof ProjectProfileSchema>;
1521
+ declare const KnowledgeInjectionModeSchema: z.ZodEnum<{
1522
+ auto: "auto";
1523
+ full: "full";
1524
+ minimal: "minimal";
1525
+ }>;
1526
+ type KnowledgeInjectionMode = z.infer<typeof KnowledgeInjectionModeSchema>;
1527
+ declare const KnowledgeInjectionRequestSchema: z.ZodObject<{
1528
+ mode: z.ZodEnum<{
1529
+ auto: "auto";
1530
+ full: "full";
1531
+ minimal: "minimal";
1532
+ }>;
1533
+ contextHints: z.ZodOptional<z.ZodArray<z.ZodString>>;
1534
+ }, z.core.$strip>;
1535
+ type KnowledgeInjectionRequest = z.infer<typeof KnowledgeInjectionRequestSchema>;
1536
+ declare const KnowledgeInjectionResponseSchema: z.ZodObject<{
1537
+ profile: z.ZodNullable<z.ZodObject<{
1538
+ techStack: z.ZodArray<z.ZodString>;
1539
+ architectureType: z.ZodOptional<z.ZodString>;
1540
+ knownPitfalls: z.ZodArray<z.ZodString>;
1541
+ coreConventions: z.ZodArray<z.ZodString>;
1542
+ lastUpdatedAt: z.ZodNumber;
1543
+ lastUpdatedBy: z.ZodOptional<z.ZodString>;
1544
+ }, z.core.$strip>>;
1545
+ entries: z.ZodArray<z.ZodObject<{
1546
+ id: z.ZodString;
1547
+ entryType: z.ZodEnum<{
1548
+ discovery: "discovery";
1549
+ decision: "decision";
1550
+ fix: "fix";
1551
+ convention: "convention";
1552
+ warning: "warning";
1553
+ }>;
1554
+ title: z.ZodString;
1555
+ content: z.ZodString;
1556
+ tags: z.ZodArray<z.ZodString>;
1557
+ confidence: z.ZodEnum<{
1558
+ high: "high";
1559
+ medium: "medium";
1560
+ low: "low";
1561
+ }>;
1562
+ createdAt: z.ZodString;
1563
+ }, z.core.$strip>>;
1564
+ }, z.core.$strip>;
1565
+ type KnowledgeInjectionResponse = z.infer<typeof KnowledgeInjectionResponseSchema>;
1566
+ declare const TurnKnowledgeExtractionSchema: z.ZodObject<{
1567
+ projectId: z.ZodString;
1568
+ sessionId: z.ZodString;
1569
+ model: z.ZodString;
1570
+ turnId: z.ZodString;
1571
+ turnData: z.ZodObject<{
1572
+ userMessage: z.ZodString;
1573
+ assistantText: z.ZodString;
1574
+ fileEdits: z.ZodArray<z.ZodObject<{
1575
+ path: z.ZodString;
1576
+ type: z.ZodEnum<{
1577
+ create: "create";
1578
+ edit: "edit";
1579
+ }>;
1580
+ }, z.core.$strip>>;
1581
+ toolCallCount: z.ZodNumber;
1582
+ outputTokens: z.ZodNumber;
1583
+ }, z.core.$strip>;
1584
+ }, z.core.$strip>;
1585
+ type TurnKnowledgeExtraction = z.infer<typeof TurnKnowledgeExtractionSchema>;
1586
+
1587
+ export { AgentMessageSchema, ApiMessageSchema, ApiUpdateMachineStateSchema, ApiUpdateNewMessageSchema, ApiUpdateSessionStateSchema, CoreUpdateBodySchema, CoreUpdateContainerSchema, CreateKnowledgeEntryBodySchema, DaemonStateSchema, KnowledgeActionSchema, KnowledgeConfidenceSchema, KnowledgeContributorTypeSchema, KnowledgeEntryTypeSchema, KnowledgeInjectionModeSchema, KnowledgeInjectionRequestSchema, KnowledgeInjectionResponseSchema, KnowledgeStatusSchema, LegacyMessageContentSchema, MachineMetadataSchema, MessageContentSchema, MessageMetaSchema, ProjectProfileSchema, QueryKnowledgeParamsSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, TailscaleInfoSchema, TailscaleServeEntrySchema, TunnelEntrySchema, TunnelProviderInfoSchema, TunnelStateSchema, TurnKnowledgeExtractionSchema, UpdateBodySchema, UpdateKnowledgeEntryBodySchema, UpdateMachineBodySchema, UpdateNewMessageBodySchema, UpdateSchema, UpdateSessionBodySchema, UserMessageSchema, VersionedEncryptedValueSchema, VersionedMachineEncryptedValueSchema, VersionedNullableEncryptedValueSchema, createEnvelope, sessionEnvelopeSchema, sessionEventSchema, sessionFileEventSchema, sessionModelUsageSchema, sessionNeedsContinueEventSchema, sessionPromptSuggestionEventSchema, sessionRoleSchema, sessionServiceMessageEventSchema, sessionStartEventSchema, sessionStateChangedEventSchema, sessionStopEventSchema, sessionTaskEndEventSchema, sessionTaskProgressEventSchema, sessionTaskStartEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionToolProgressEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, sessionUsageUpdateEventSchema };
1588
+ export type { AgentMessage, ApiMessage, ApiUpdateMachineState, ApiUpdateNewMessage, ApiUpdateSessionState, CoreUpdateBody, CoreUpdateContainer, CreateEnvelopeOptions, CreateKnowledgeEntryBody, DaemonState, KnowledgeAction, KnowledgeConfidence, KnowledgeContributorType, KnowledgeEntryType, KnowledgeInjectionMode, KnowledgeInjectionRequest, KnowledgeInjectionResponse, KnowledgeStatus, LegacyMessageContent, MachineMetadata, MessageContent, MessageMeta, ProjectProfile, QueryKnowledgeParams, SessionEnvelope, SessionEvent, SessionMessage, SessionMessageContent, SessionModelUsage, SessionProtocolMessage, SessionRole, SessionTurnEndStatus, TailscaleInfo, TailscaleServeEntry, TunnelEntry, TunnelProviderInfo, TunnelState, TurnKnowledgeExtraction, Update, UpdateBody, UpdateKnowledgeEntryBody, UpdateMachineBody, UpdateNewMessageBody, UpdateSessionBody, UserMessage, VersionedEncryptedValue, VersionedMachineEncryptedValue, VersionedNullableEncryptedValue };
package/dist/index.mjs CHANGED
@@ -93,7 +93,9 @@ const sessionTaskStartEventSchema = z.object({
93
93
  taskId: z.string(),
94
94
  toolUseId: z.string().optional(),
95
95
  description: z.string(),
96
- taskType: z.string().optional()
96
+ taskType: z.string().optional(),
97
+ /** meta.name from the workflow script (e.g. 'spec'). Only set when taskType is 'local_workflow'. */
98
+ workflowName: z.string().optional()
97
99
  });
98
100
  const sessionTaskProgressEventSchema = z.object({
99
101
  t: z.literal("task-progress"),
@@ -133,6 +135,11 @@ const sessionPromptSuggestionEventSchema = z.object({
133
135
  const sessionNeedsContinueEventSchema = z.object({
134
136
  t: z.literal("needs-continue")
135
137
  });
138
+ const sessionStateChangedEventSchema = z.object({
139
+ t: z.literal("session-state-changed"),
140
+ /** Authoritative session lifecycle state from the SDK */
141
+ state: z.enum(["idle", "running", "requires_action"])
142
+ });
136
143
  const sessionEventSchema = z.discriminatedUnion("t", [
137
144
  sessionTextEventSchema,
138
145
  sessionServiceMessageEventSchema,
@@ -149,7 +156,8 @@ const sessionEventSchema = z.discriminatedUnion("t", [
149
156
  sessionTaskEndEventSchema,
150
157
  sessionToolProgressEventSchema,
151
158
  sessionPromptSuggestionEventSchema,
152
- sessionNeedsContinueEventSchema
159
+ sessionNeedsContinueEventSchema,
160
+ sessionStateChangedEventSchema
153
161
  ]);
154
162
  const sessionEnvelopeSchema = z.object({
155
163
  id: z.string(),
@@ -168,7 +176,7 @@ const sessionEnvelopeSchema = z.object({
168
176
  path: ["role"]
169
177
  });
170
178
  }
171
- if ((envelope.ev.t === "start" || envelope.ev.t === "stop" || envelope.ev.t === "usage-update" || envelope.ev.t === "task-start" || envelope.ev.t === "task-progress" || envelope.ev.t === "task-end" || envelope.ev.t === "tool-progress" || envelope.ev.t === "prompt-suggestion" || envelope.ev.t === "needs-continue") && envelope.role !== "agent") {
179
+ if ((envelope.ev.t === "start" || envelope.ev.t === "stop" || envelope.ev.t === "usage-update" || envelope.ev.t === "task-start" || envelope.ev.t === "task-progress" || envelope.ev.t === "task-end" || envelope.ev.t === "tool-progress" || envelope.ev.t === "prompt-suggestion" || envelope.ev.t === "needs-continue" || envelope.ev.t === "session-state-changed") && envelope.role !== "agent") {
172
180
  ctx.addIssue({
173
181
  code: z.ZodIssueCode.custom,
174
182
  message: `${envelope.ev.t} events must use role "agent"`,
@@ -366,4 +374,127 @@ const DaemonStateSchema = z.object({
366
374
  tunnels: TunnelStateSchema.optional()
367
375
  });
368
376
 
369
- export { AgentMessageSchema, ApiMessageSchema, ApiUpdateMachineStateSchema, ApiUpdateNewMessageSchema, ApiUpdateSessionStateSchema, CoreUpdateBodySchema, CoreUpdateContainerSchema, DaemonStateSchema, LegacyMessageContentSchema, MachineMetadataSchema, MessageContentSchema, MessageMetaSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, TailscaleInfoSchema, TailscaleServeEntrySchema, TunnelEntrySchema, TunnelProviderInfoSchema, TunnelStateSchema, UpdateBodySchema, UpdateMachineBodySchema, UpdateNewMessageBodySchema, UpdateSchema, UpdateSessionBodySchema, UserMessageSchema, VersionedEncryptedValueSchema, VersionedMachineEncryptedValueSchema, VersionedNullableEncryptedValueSchema, createEnvelope, sessionEnvelopeSchema, sessionEventSchema, sessionFileEventSchema, sessionModelUsageSchema, sessionNeedsContinueEventSchema, sessionPromptSuggestionEventSchema, sessionRoleSchema, sessionServiceMessageEventSchema, sessionStartEventSchema, sessionStopEventSchema, sessionTaskEndEventSchema, sessionTaskProgressEventSchema, sessionTaskStartEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionToolProgressEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, sessionUsageUpdateEventSchema };
377
+ const KnowledgeEntryTypeSchema = z.enum([
378
+ "discovery",
379
+ // New insight or finding
380
+ "decision",
381
+ // Architecture / tech choice
382
+ "fix",
383
+ // Bug fix record
384
+ "convention",
385
+ // Code convention / process rule
386
+ "warning"
387
+ // Known pitfall or gotcha
388
+ ]);
389
+ const KnowledgeContributorTypeSchema = z.enum([
390
+ "session",
391
+ // Auto-generated by Claude session
392
+ "supervisor",
393
+ // Generated by Supervisor analysis
394
+ "user"
395
+ // Manually added by user
396
+ ]);
397
+ const KnowledgeActionSchema = z.enum([
398
+ "create",
399
+ // New entry
400
+ "amend",
401
+ // Correction / supplement
402
+ "supersede",
403
+ // Replace old knowledge
404
+ "verify"
405
+ // Confirm still valid
406
+ ]);
407
+ const KnowledgeStatusSchema = z.enum([
408
+ "active",
409
+ // Currently valid
410
+ "superseded",
411
+ // Replaced by newer knowledge
412
+ "archived"
413
+ // Manually archived by user
414
+ ]);
415
+ const KnowledgeConfidenceSchema = z.enum(["high", "medium", "low"]);
416
+ const CreateKnowledgeEntryBodySchema = z.object({
417
+ entryType: KnowledgeEntryTypeSchema,
418
+ contributorType: KnowledgeContributorTypeSchema,
419
+ action: KnowledgeActionSchema,
420
+ title: z.string().min(1).max(200),
421
+ content: z.string().min(1),
422
+ // Structured SOAP-like fields (optional)
423
+ request: z.string().optional(),
424
+ // S: What the user asked
425
+ findings: z.string().optional(),
426
+ // O: What was discovered
427
+ analysis: z.string().optional(),
428
+ // A: Root cause / assessment
429
+ outcome: z.string().optional(),
430
+ // P: What was done
431
+ nextSteps: z.string().optional(),
432
+ // Follow-up suggestions
433
+ tags: z.array(z.string().max(50)).max(20).default([]),
434
+ confidence: KnowledgeConfidenceSchema.default("medium"),
435
+ sessionId: z.string().optional(),
436
+ model: z.string().optional(),
437
+ supersedesId: z.string().optional(),
438
+ relatedIds: z.array(z.string()).max(10).default([]),
439
+ affectedFiles: z.array(z.string()).max(50).default([])
440
+ });
441
+ const UpdateKnowledgeEntryBodySchema = z.object({
442
+ status: KnowledgeStatusSchema.optional(),
443
+ pinned: z.boolean().optional(),
444
+ title: z.string().min(1).max(200).optional(),
445
+ content: z.string().min(1).optional(),
446
+ tags: z.array(z.string().max(50)).max(20).optional(),
447
+ confidence: KnowledgeConfidenceSchema.optional()
448
+ });
449
+ const QueryKnowledgeParamsSchema = z.object({
450
+ entryType: KnowledgeEntryTypeSchema.optional(),
451
+ status: KnowledgeStatusSchema.optional(),
452
+ tags: z.array(z.string()).optional(),
453
+ search: z.string().optional(),
454
+ limit: z.number().int().min(1).max(100).default(20),
455
+ offset: z.number().int().min(0).default(0)
456
+ });
457
+ const ProjectProfileSchema = z.object({
458
+ techStack: z.array(z.string()),
459
+ architectureType: z.string().optional(),
460
+ knownPitfalls: z.array(z.string()),
461
+ coreConventions: z.array(z.string()),
462
+ lastUpdatedAt: z.number(),
463
+ lastUpdatedBy: z.string().optional()
464
+ });
465
+ const KnowledgeInjectionModeSchema = z.enum(["auto", "full", "minimal"]);
466
+ const KnowledgeInjectionRequestSchema = z.object({
467
+ mode: KnowledgeInjectionModeSchema,
468
+ contextHints: z.array(z.string()).optional()
469
+ // Keywords from user message for relevance
470
+ });
471
+ const KnowledgeInjectionResponseSchema = z.object({
472
+ profile: ProjectProfileSchema.nullable(),
473
+ entries: z.array(z.object({
474
+ id: z.string(),
475
+ entryType: KnowledgeEntryTypeSchema,
476
+ title: z.string(),
477
+ content: z.string(),
478
+ tags: z.array(z.string()),
479
+ confidence: KnowledgeConfidenceSchema,
480
+ createdAt: z.string()
481
+ }))
482
+ });
483
+ const TurnKnowledgeExtractionSchema = z.object({
484
+ projectId: z.string(),
485
+ sessionId: z.string(),
486
+ model: z.string(),
487
+ turnId: z.string(),
488
+ turnData: z.object({
489
+ userMessage: z.string().max(2e3),
490
+ assistantText: z.string().max(5e3),
491
+ fileEdits: z.array(z.object({
492
+ path: z.string(),
493
+ type: z.enum(["create", "edit"])
494
+ })).max(50),
495
+ toolCallCount: z.number().int(),
496
+ outputTokens: z.number().int()
497
+ })
498
+ });
499
+
500
+ export { AgentMessageSchema, ApiMessageSchema, ApiUpdateMachineStateSchema, ApiUpdateNewMessageSchema, ApiUpdateSessionStateSchema, CoreUpdateBodySchema, CoreUpdateContainerSchema, CreateKnowledgeEntryBodySchema, DaemonStateSchema, KnowledgeActionSchema, KnowledgeConfidenceSchema, KnowledgeContributorTypeSchema, KnowledgeEntryTypeSchema, KnowledgeInjectionModeSchema, KnowledgeInjectionRequestSchema, KnowledgeInjectionResponseSchema, KnowledgeStatusSchema, LegacyMessageContentSchema, MachineMetadataSchema, MessageContentSchema, MessageMetaSchema, ProjectProfileSchema, QueryKnowledgeParamsSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, TailscaleInfoSchema, TailscaleServeEntrySchema, TunnelEntrySchema, TunnelProviderInfoSchema, TunnelStateSchema, TurnKnowledgeExtractionSchema, UpdateBodySchema, UpdateKnowledgeEntryBodySchema, UpdateMachineBodySchema, UpdateNewMessageBodySchema, UpdateSchema, UpdateSessionBodySchema, UserMessageSchema, VersionedEncryptedValueSchema, VersionedMachineEncryptedValueSchema, VersionedNullableEncryptedValueSchema, createEnvelope, sessionEnvelopeSchema, sessionEventSchema, sessionFileEventSchema, sessionModelUsageSchema, sessionNeedsContinueEventSchema, sessionPromptSuggestionEventSchema, sessionRoleSchema, sessionServiceMessageEventSchema, sessionStartEventSchema, sessionStateChangedEventSchema, sessionStopEventSchema, sessionTaskEndEventSchema, sessionTaskProgressEventSchema, sessionTaskStartEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionToolProgressEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, sessionUsageUpdateEventSchema };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmmao/happy-wire",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Shared message wire types and Zod schemas for Happy clients and services",
5
5
  "author": "kmmao",
6
6
  "license": "MIT",