@kmmao/happy-wire 0.4.2 → 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
@@ -395,6 +395,129 @@ const DaemonStateSchema = z__namespace.object({
395
395
  tunnels: TunnelStateSchema.optional()
396
396
  });
397
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
+
398
521
  exports.AgentMessageSchema = AgentMessageSchema;
399
522
  exports.ApiMessageSchema = ApiMessageSchema;
400
523
  exports.ApiUpdateMachineStateSchema = ApiUpdateMachineStateSchema;
@@ -402,11 +525,22 @@ exports.ApiUpdateNewMessageSchema = ApiUpdateNewMessageSchema;
402
525
  exports.ApiUpdateSessionStateSchema = ApiUpdateSessionStateSchema;
403
526
  exports.CoreUpdateBodySchema = CoreUpdateBodySchema;
404
527
  exports.CoreUpdateContainerSchema = CoreUpdateContainerSchema;
528
+ exports.CreateKnowledgeEntryBodySchema = CreateKnowledgeEntryBodySchema;
405
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;
406
538
  exports.LegacyMessageContentSchema = LegacyMessageContentSchema;
407
539
  exports.MachineMetadataSchema = MachineMetadataSchema;
408
540
  exports.MessageContentSchema = MessageContentSchema;
409
541
  exports.MessageMetaSchema = MessageMetaSchema;
542
+ exports.ProjectProfileSchema = ProjectProfileSchema;
543
+ exports.QueryKnowledgeParamsSchema = QueryKnowledgeParamsSchema;
410
544
  exports.SessionMessageContentSchema = SessionMessageContentSchema;
411
545
  exports.SessionMessageSchema = SessionMessageSchema;
412
546
  exports.SessionProtocolMessageSchema = SessionProtocolMessageSchema;
@@ -415,7 +549,9 @@ exports.TailscaleServeEntrySchema = TailscaleServeEntrySchema;
415
549
  exports.TunnelEntrySchema = TunnelEntrySchema;
416
550
  exports.TunnelProviderInfoSchema = TunnelProviderInfoSchema;
417
551
  exports.TunnelStateSchema = TunnelStateSchema;
552
+ exports.TurnKnowledgeExtractionSchema = TurnKnowledgeExtractionSchema;
418
553
  exports.UpdateBodySchema = UpdateBodySchema;
554
+ exports.UpdateKnowledgeEntryBodySchema = UpdateKnowledgeEntryBodySchema;
419
555
  exports.UpdateMachineBodySchema = UpdateMachineBodySchema;
420
556
  exports.UpdateNewMessageBodySchema = UpdateNewMessageBodySchema;
421
557
  exports.UpdateSchema = UpdateSchema;
package/dist/index.d.cts CHANGED
@@ -1401,5 +1401,188 @@ declare const DaemonStateSchema: z.ZodObject<{
1401
1401
  }, z.core.$strip>;
1402
1402
  type DaemonState = z.infer<typeof DaemonStateSchema>;
1403
1403
 
1404
- 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, sessionStateChangedEventSchema, sessionStopEventSchema, sessionTaskEndEventSchema, sessionTaskProgressEventSchema, sessionTaskStartEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionToolProgressEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, sessionUsageUpdateEventSchema };
1405
- 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
@@ -1401,5 +1401,188 @@ declare const DaemonStateSchema: z.ZodObject<{
1401
1401
  }, z.core.$strip>;
1402
1402
  type DaemonState = z.infer<typeof DaemonStateSchema>;
1403
1403
 
1404
- 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, sessionStateChangedEventSchema, sessionStopEventSchema, sessionTaskEndEventSchema, sessionTaskProgressEventSchema, sessionTaskStartEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionToolProgressEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, sessionUsageUpdateEventSchema };
1405
- 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
@@ -374,4 +374,127 @@ const DaemonStateSchema = z.object({
374
374
  tunnels: TunnelStateSchema.optional()
375
375
  });
376
376
 
377
- 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, sessionStateChangedEventSchema, 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.2",
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",