@zinn-dev/cli 0.45.0 → 0.46.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.
Files changed (59) hide show
  1. package/README.md +1 -1
  2. package/package.json +3 -3
  3. package/skills/zinn/SKILL.md +2 -2
  4. package/src/actor.d.ts +1 -1
  5. package/src/actor.js +4 -1
  6. package/src/capabilities-schema.d.ts +4 -0
  7. package/src/errors.d.ts +4 -0
  8. package/src/errors.js +18 -5
  9. package/src/lib.d.ts +2 -1
  10. package/src/lib.js +52 -20
  11. package/src/presentation/activity-presentation.js +2 -0
  12. package/src/presentation/doctor-presentation.d.ts +7 -1
  13. package/src/presentation/doctor-presentation.js +6 -2
  14. package/src/presentation/skill-status-presentation.d.ts +9 -0
  15. package/src/presentation/skill-status-presentation.js +43 -0
  16. package/src/presentation/task-blame-presentation.d.ts +1 -0
  17. package/src/presentation/task-blame-presentation.js +3 -1
  18. package/src/presentation/task-presentation.d.ts +16 -4
  19. package/src/presentation/task-presentation.js +60 -33
  20. package/src/result-schemas.d.ts +137 -0
  21. package/src/result-schemas.js +51 -0
  22. package/src/routes/activity-router.d.ts +4 -2
  23. package/src/routes/activity-router.js +44 -17
  24. package/src/routes/backup-router.d.ts +1 -0
  25. package/src/routes/backup-router.js +4 -3
  26. package/src/routes/capabilities-router.d.ts +1 -0
  27. package/src/routes/capabilities-router.js +1 -1
  28. package/src/routes/comment-router.d.ts +5 -0
  29. package/src/routes/comment-router.js +5 -5
  30. package/src/routes/doctor-router.d.ts +1 -0
  31. package/src/routes/doctor-router.js +33 -53
  32. package/src/routes/info-router.d.ts +1 -0
  33. package/src/routes/info-router.js +1 -1
  34. package/src/routes/label-router.d.ts +5 -0
  35. package/src/routes/label-router.js +5 -5
  36. package/src/routes/migrate-router.d.ts +1 -0
  37. package/src/routes/migrate-router.js +5 -7
  38. package/src/routes/project-router.d.ts +10 -0
  39. package/src/routes/project-router.js +31 -24
  40. package/src/routes/reindex-router.d.ts +1 -0
  41. package/src/routes/reindex-router.js +1 -1
  42. package/src/routes/relation-router.d.ts +3 -0
  43. package/src/routes/relation-router.js +9 -6
  44. package/src/routes/restore-router.d.ts +1 -0
  45. package/src/routes/restore-router.js +3 -4
  46. package/src/routes/router.js +2 -2
  47. package/src/routes/routes.d.ts +113 -2
  48. package/src/routes/skill-router.d.ts +53 -2
  49. package/src/routes/skill-router.js +114 -31
  50. package/src/routes/task-router.d.ts +33 -0
  51. package/src/routes/task-router.js +182 -88
  52. package/src/routes/whoami-router.d.ts +1 -0
  53. package/src/routes/whoami-router.js +1 -1
  54. package/src/skill-copies.d.ts +34 -0
  55. package/src/skill-copies.js +109 -0
  56. package/src/telemetry.d.ts +2 -2
  57. package/src/telemetry.js +8 -3
  58. package/src/types.d.ts +4 -0
  59. package/src/types.js +6 -0
@@ -103,6 +103,7 @@ export declare const activitySchema: z.ZodObject<{
103
103
  actor_model: z.ZodNullable<z.ZodString>;
104
104
  actor_effort: z.ZodNullable<z.ZodString>;
105
105
  actor_client: z.ZodNullable<z.ZodString>;
106
+ actor_directory: z.ZodNullable<z.ZodString>;
106
107
  entity_type: z.ZodString;
107
108
  entity_id: z.ZodString;
108
109
  action: z.ZodString;
@@ -119,6 +120,7 @@ export declare const actorSchema: z.ZodObject<{
119
120
  actor_model: z.ZodNullable<z.ZodString>;
120
121
  actor_effort: z.ZodNullable<z.ZodString>;
121
122
  actor_client: z.ZodNullable<z.ZodString>;
123
+ actor_directory: z.ZodNullable<z.ZodString>;
122
124
  }, z.core.$strict>;
123
125
  export declare const taskAttributionSchema: z.ZodObject<{
124
126
  actor_kind: z.ZodString;
@@ -131,6 +133,7 @@ export declare const taskAttributionSchema: z.ZodObject<{
131
133
  actor_model: z.ZodNullable<z.ZodString>;
132
134
  actor_effort: z.ZodNullable<z.ZodString>;
133
135
  actor_client: z.ZodNullable<z.ZodString>;
136
+ actor_directory: z.ZodNullable<z.ZodString>;
134
137
  id: z.ZodString;
135
138
  created_at: z.ZodNumber;
136
139
  }, z.core.$strict>;
@@ -282,6 +285,7 @@ export declare const taskDetailHistorySchema: z.ZodObject<{
282
285
  actor_model: z.ZodNullable<z.ZodString>;
283
286
  actor_effort: z.ZodNullable<z.ZodString>;
284
287
  actor_client: z.ZodNullable<z.ZodString>;
288
+ actor_directory: z.ZodNullable<z.ZodString>;
285
289
  entity_type: z.ZodString;
286
290
  entity_id: z.ZodString;
287
291
  action: z.ZodString;
@@ -423,6 +427,7 @@ export declare const taskBlameSchema: z.ZodObject<{
423
427
  actor_model: z.ZodNullable<z.ZodString>;
424
428
  actor_effort: z.ZodNullable<z.ZodString>;
425
429
  actor_client: z.ZodNullable<z.ZodString>;
430
+ actor_directory: z.ZodNullable<z.ZodString>;
426
431
  id: z.ZodString;
427
432
  created_at: z.ZodNumber;
428
433
  }, z.core.$strict>>;
@@ -443,6 +448,7 @@ export declare const taskBlameSchema: z.ZodObject<{
443
448
  actor_model: z.ZodNullable<z.ZodString>;
444
449
  actor_effort: z.ZodNullable<z.ZodString>;
445
450
  actor_client: z.ZodNullable<z.ZodString>;
451
+ actor_directory: z.ZodNullable<z.ZodString>;
446
452
  id: z.ZodString;
447
453
  created_at: z.ZodNumber;
448
454
  }, z.core.$strict>>;
@@ -460,6 +466,7 @@ export declare const taskBlameSchema: z.ZodObject<{
460
466
  actor_model: z.ZodNullable<z.ZodString>;
461
467
  actor_effort: z.ZodNullable<z.ZodString>;
462
468
  actor_client: z.ZodNullable<z.ZodString>;
469
+ actor_directory: z.ZodNullable<z.ZodString>;
463
470
  id: z.ZodString;
464
471
  created_at: z.ZodNumber;
465
472
  }, z.core.$strict>>;
@@ -477,6 +484,7 @@ export declare const taskBlameSchema: z.ZodObject<{
477
484
  actor_model: z.ZodNullable<z.ZodString>;
478
485
  actor_effort: z.ZodNullable<z.ZodString>;
479
486
  actor_client: z.ZodNullable<z.ZodString>;
487
+ actor_directory: z.ZodNullable<z.ZodString>;
480
488
  id: z.ZodString;
481
489
  created_at: z.ZodNumber;
482
490
  }, z.core.$strict>>;
@@ -497,6 +505,7 @@ export declare const taskBlameSchema: z.ZodObject<{
497
505
  actor_model: z.ZodNullable<z.ZodString>;
498
506
  actor_effort: z.ZodNullable<z.ZodString>;
499
507
  actor_client: z.ZodNullable<z.ZodString>;
508
+ actor_directory: z.ZodNullable<z.ZodString>;
500
509
  id: z.ZodString;
501
510
  created_at: z.ZodNumber;
502
511
  }, z.core.$strict>>;
@@ -517,6 +526,7 @@ export declare const taskBlameSchema: z.ZodObject<{
517
526
  actor_model: z.ZodNullable<z.ZodString>;
518
527
  actor_effort: z.ZodNullable<z.ZodString>;
519
528
  actor_client: z.ZodNullable<z.ZodString>;
529
+ actor_directory: z.ZodNullable<z.ZodString>;
520
530
  id: z.ZodString;
521
531
  created_at: z.ZodNumber;
522
532
  }, z.core.$strict>>;
@@ -544,6 +554,7 @@ export declare const taskBlameSchema: z.ZodObject<{
544
554
  actor_model: z.ZodNullable<z.ZodString>;
545
555
  actor_effort: z.ZodNullable<z.ZodString>;
546
556
  actor_client: z.ZodNullable<z.ZodString>;
557
+ actor_directory: z.ZodNullable<z.ZodString>;
547
558
  id: z.ZodString;
548
559
  created_at: z.ZodNumber;
549
560
  }, z.core.$strict>>;
@@ -562,6 +573,7 @@ export declare const taskBlameSchema: z.ZodObject<{
562
573
  actor_model: z.ZodNullable<z.ZodString>;
563
574
  actor_effort: z.ZodNullable<z.ZodString>;
564
575
  actor_client: z.ZodNullable<z.ZodString>;
576
+ actor_directory: z.ZodNullable<z.ZodString>;
565
577
  id: z.ZodString;
566
578
  created_at: z.ZodNumber;
567
579
  }, z.core.$strict>>;
@@ -792,6 +804,33 @@ export declare const backupSchema: z.ZodObject<{
792
804
  export declare const skillInstallSchema: z.ZodObject<{
793
805
  source: z.ZodString;
794
806
  }, z.core.$strict>;
807
+ export declare const skillUninstallSchema: z.ZodObject<{
808
+ removed: z.ZodArray<z.ZodObject<{
809
+ path: z.ZodString;
810
+ scope: z.ZodEnum<{
811
+ project: "project";
812
+ home: "home";
813
+ }>;
814
+ }, z.core.$strict>>;
815
+ }, z.core.$strict>;
816
+ export declare const skillStatusSchema: z.ZodObject<{
817
+ bundled: z.ZodObject<{
818
+ path: z.ZodString;
819
+ reviewedVersion: z.ZodNullable<z.ZodString>;
820
+ }, z.core.$strict>;
821
+ copies: z.ZodArray<z.ZodObject<{
822
+ path: z.ZodString;
823
+ links: z.ZodArray<z.ZodString>;
824
+ scope: z.ZodEnum<{
825
+ project: "project";
826
+ home: "home";
827
+ }>;
828
+ reviewedVersion: z.ZodNullable<z.ZodString>;
829
+ matches: z.ZodBoolean;
830
+ readable: z.ZodBoolean;
831
+ remedy: z.ZodNullable<z.ZodString>;
832
+ }, z.core.$strict>>;
833
+ }, z.core.$strict>;
795
834
  export declare const restoreSchema: z.ZodObject<{
796
835
  databasePath: z.ZodString;
797
836
  previousVersion: z.ZodNumber;
@@ -884,6 +923,57 @@ export declare const resultSchemas: {
884
923
  expires_at: z.ZodNumber;
885
924
  }, z.core.$strict>>;
886
925
  }, z.core.$strict>>;
926
+ TaskSearchResults: z.ZodArray<z.ZodObject<{
927
+ id: z.ZodString;
928
+ key: z.ZodString;
929
+ project_id: z.ZodString;
930
+ status: z.ZodEnum<{
931
+ Active: "Active";
932
+ Archived: "Archived";
933
+ }>;
934
+ column: z.ZodString;
935
+ column_id: z.ZodString;
936
+ is_first: z.ZodBoolean;
937
+ is_last: z.ZodBoolean;
938
+ column_category: z.ZodNullable<z.ZodString>;
939
+ title: z.ZodString;
940
+ description: z.ZodNullable<z.ZodString>;
941
+ priority: z.ZodNullable<z.ZodString>;
942
+ due_at: z.ZodNullable<z.ZodNumber>;
943
+ labels: z.ZodArray<z.ZodString>;
944
+ label_ids: z.ZodArray<z.ZodString>;
945
+ created_at: z.ZodNumber;
946
+ updated_at: z.ZodNumber;
947
+ claim: z.ZodNullable<z.ZodObject<{
948
+ state: z.ZodEnum<{
949
+ live: "live";
950
+ expired: "expired";
951
+ }>;
952
+ actor_kind: z.ZodString;
953
+ actor_name: z.ZodNullable<z.ZodString>;
954
+ actor_session_id: z.ZodNullable<z.ZodString>;
955
+ actor_thread_id: z.ZodNullable<z.ZodString>;
956
+ claimed_at: z.ZodNumber;
957
+ renewed_at: z.ZodNumber;
958
+ worked_at: z.ZodNumber;
959
+ lease_ms: z.ZodNumber;
960
+ expires_at: z.ZodNumber;
961
+ }, z.core.$strict>>;
962
+ matches: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
963
+ snippet: z.ZodString;
964
+ highlights: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
965
+ field: z.ZodEnum<{
966
+ description: "description";
967
+ key: "key";
968
+ title: "title";
969
+ }>;
970
+ }, z.core.$strict>, z.ZodObject<{
971
+ snippet: z.ZodString;
972
+ highlights: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
973
+ field: z.ZodLiteral<"comment">;
974
+ comment_key: z.ZodString;
975
+ }, z.core.$strict>], "field">>;
976
+ }, z.core.$strict>>;
887
977
  NextTask: z.ZodNullable<z.ZodObject<{
888
978
  id: z.ZodString;
889
979
  key: z.ZodString;
@@ -1008,6 +1098,7 @@ export declare const resultSchemas: {
1008
1098
  actor_model: z.ZodNullable<z.ZodString>;
1009
1099
  actor_effort: z.ZodNullable<z.ZodString>;
1010
1100
  actor_client: z.ZodNullable<z.ZodString>;
1101
+ actor_directory: z.ZodNullable<z.ZodString>;
1011
1102
  id: z.ZodString;
1012
1103
  created_at: z.ZodNumber;
1013
1104
  }, z.core.$strict>>;
@@ -1028,6 +1119,7 @@ export declare const resultSchemas: {
1028
1119
  actor_model: z.ZodNullable<z.ZodString>;
1029
1120
  actor_effort: z.ZodNullable<z.ZodString>;
1030
1121
  actor_client: z.ZodNullable<z.ZodString>;
1122
+ actor_directory: z.ZodNullable<z.ZodString>;
1031
1123
  id: z.ZodString;
1032
1124
  created_at: z.ZodNumber;
1033
1125
  }, z.core.$strict>>;
@@ -1045,6 +1137,7 @@ export declare const resultSchemas: {
1045
1137
  actor_model: z.ZodNullable<z.ZodString>;
1046
1138
  actor_effort: z.ZodNullable<z.ZodString>;
1047
1139
  actor_client: z.ZodNullable<z.ZodString>;
1140
+ actor_directory: z.ZodNullable<z.ZodString>;
1048
1141
  id: z.ZodString;
1049
1142
  created_at: z.ZodNumber;
1050
1143
  }, z.core.$strict>>;
@@ -1062,6 +1155,7 @@ export declare const resultSchemas: {
1062
1155
  actor_model: z.ZodNullable<z.ZodString>;
1063
1156
  actor_effort: z.ZodNullable<z.ZodString>;
1064
1157
  actor_client: z.ZodNullable<z.ZodString>;
1158
+ actor_directory: z.ZodNullable<z.ZodString>;
1065
1159
  id: z.ZodString;
1066
1160
  created_at: z.ZodNumber;
1067
1161
  }, z.core.$strict>>;
@@ -1082,6 +1176,7 @@ export declare const resultSchemas: {
1082
1176
  actor_model: z.ZodNullable<z.ZodString>;
1083
1177
  actor_effort: z.ZodNullable<z.ZodString>;
1084
1178
  actor_client: z.ZodNullable<z.ZodString>;
1179
+ actor_directory: z.ZodNullable<z.ZodString>;
1085
1180
  id: z.ZodString;
1086
1181
  created_at: z.ZodNumber;
1087
1182
  }, z.core.$strict>>;
@@ -1102,6 +1197,7 @@ export declare const resultSchemas: {
1102
1197
  actor_model: z.ZodNullable<z.ZodString>;
1103
1198
  actor_effort: z.ZodNullable<z.ZodString>;
1104
1199
  actor_client: z.ZodNullable<z.ZodString>;
1200
+ actor_directory: z.ZodNullable<z.ZodString>;
1105
1201
  id: z.ZodString;
1106
1202
  created_at: z.ZodNumber;
1107
1203
  }, z.core.$strict>>;
@@ -1129,6 +1225,7 @@ export declare const resultSchemas: {
1129
1225
  actor_model: z.ZodNullable<z.ZodString>;
1130
1226
  actor_effort: z.ZodNullable<z.ZodString>;
1131
1227
  actor_client: z.ZodNullable<z.ZodString>;
1228
+ actor_directory: z.ZodNullable<z.ZodString>;
1132
1229
  id: z.ZodString;
1133
1230
  created_at: z.ZodNumber;
1134
1231
  }, z.core.$strict>>;
@@ -1147,6 +1244,7 @@ export declare const resultSchemas: {
1147
1244
  actor_model: z.ZodNullable<z.ZodString>;
1148
1245
  actor_effort: z.ZodNullable<z.ZodString>;
1149
1246
  actor_client: z.ZodNullable<z.ZodString>;
1247
+ actor_directory: z.ZodNullable<z.ZodString>;
1150
1248
  id: z.ZodString;
1151
1249
  created_at: z.ZodNumber;
1152
1250
  }, z.core.$strict>>;
@@ -1232,6 +1330,7 @@ export declare const resultSchemas: {
1232
1330
  actor_model: z.ZodNullable<z.ZodString>;
1233
1331
  actor_effort: z.ZodNullable<z.ZodString>;
1234
1332
  actor_client: z.ZodNullable<z.ZodString>;
1333
+ actor_directory: z.ZodNullable<z.ZodString>;
1235
1334
  entity_type: z.ZodString;
1236
1335
  entity_id: z.ZodString;
1237
1336
  action: z.ZodString;
@@ -1498,6 +1597,7 @@ export declare const resultSchemas: {
1498
1597
  actor_model: z.ZodNullable<z.ZodString>;
1499
1598
  actor_effort: z.ZodNullable<z.ZodString>;
1500
1599
  actor_client: z.ZodNullable<z.ZodString>;
1600
+ actor_directory: z.ZodNullable<z.ZodString>;
1501
1601
  entity_type: z.ZodString;
1502
1602
  entity_id: z.ZodString;
1503
1603
  action: z.ZodString;
@@ -1516,6 +1616,7 @@ export declare const resultSchemas: {
1516
1616
  actor_model: z.ZodNullable<z.ZodString>;
1517
1617
  actor_effort: z.ZodNullable<z.ZodString>;
1518
1618
  actor_client: z.ZodNullable<z.ZodString>;
1619
+ actor_directory: z.ZodNullable<z.ZodString>;
1519
1620
  entity_type: z.ZodString;
1520
1621
  entity_id: z.ZodString;
1521
1622
  action: z.ZodString;
@@ -1532,6 +1633,7 @@ export declare const resultSchemas: {
1532
1633
  actor_model: z.ZodNullable<z.ZodString>;
1533
1634
  actor_effort: z.ZodNullable<z.ZodString>;
1534
1635
  actor_client: z.ZodNullable<z.ZodString>;
1636
+ actor_directory: z.ZodNullable<z.ZodString>;
1535
1637
  }, z.core.$strict>;
1536
1638
  Info: z.ZodObject<{
1537
1639
  settingsFiles: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -1703,6 +1805,33 @@ export declare const resultSchemas: {
1703
1805
  SkillInstall: z.ZodObject<{
1704
1806
  source: z.ZodString;
1705
1807
  }, z.core.$strict>;
1808
+ SkillUninstall: z.ZodObject<{
1809
+ removed: z.ZodArray<z.ZodObject<{
1810
+ path: z.ZodString;
1811
+ scope: z.ZodEnum<{
1812
+ project: "project";
1813
+ home: "home";
1814
+ }>;
1815
+ }, z.core.$strict>>;
1816
+ }, z.core.$strict>;
1817
+ SkillStatus: z.ZodObject<{
1818
+ bundled: z.ZodObject<{
1819
+ path: z.ZodString;
1820
+ reviewedVersion: z.ZodNullable<z.ZodString>;
1821
+ }, z.core.$strict>;
1822
+ copies: z.ZodArray<z.ZodObject<{
1823
+ path: z.ZodString;
1824
+ links: z.ZodArray<z.ZodString>;
1825
+ scope: z.ZodEnum<{
1826
+ project: "project";
1827
+ home: "home";
1828
+ }>;
1829
+ reviewedVersion: z.ZodNullable<z.ZodString>;
1830
+ matches: z.ZodBoolean;
1831
+ readable: z.ZodBoolean;
1832
+ remedy: z.ZodNullable<z.ZodString>;
1833
+ }, z.core.$strict>>;
1834
+ }, z.core.$strict>;
1706
1835
  ErrorEnvelope: z.ZodObject<{
1707
1836
  error: z.ZodObject<{
1708
1837
  code: z.ZodEnum<{
@@ -1766,6 +1895,7 @@ export declare const resultSchemas: {
1766
1895
  unmarked_database: "unmarked_database";
1767
1896
  newer_database: "newer_database";
1768
1897
  older_database: "older_database";
1898
+ migration_paused: "migration_paused";
1769
1899
  invalid_backup: "invalid_backup";
1770
1900
  busy: "busy";
1771
1901
  locked: "locked";
@@ -1786,6 +1916,7 @@ export declare const resultSchemas: {
1786
1916
  databasePath: z.ZodOptional<z.ZodString>;
1787
1917
  backupDirectory: z.ZodOptional<z.ZodString>;
1788
1918
  backupPath: z.ZodOptional<z.ZodString>;
1919
+ applied: z.ZodOptional<z.ZodLiteral<true>>;
1789
1920
  schemaVersion: z.ZodOptional<z.ZodNumber>;
1790
1921
  supportedSchemaVersion: z.ZodOptional<z.ZodNumber>;
1791
1922
  expectedColumn: z.ZodOptional<z.ZodString>;
@@ -1925,6 +2056,10 @@ export declare const resultSchemas: {
1925
2056
  restore: "restore";
1926
2057
  inspect: "inspect";
1927
2058
  }>;
2059
+ external: z.ZodArray<z.ZodEnum<{
2060
+ files: "files";
2061
+ network: "network";
2062
+ }>>;
1928
2063
  }, z.core.$strict>;
1929
2064
  confirmation: z.ZodObject<{
1930
2065
  kind: z.ZodEnum<{
@@ -1993,6 +2128,8 @@ export type PresentedRestore = z.infer<typeof restoreSchema>;
1993
2128
  export type PresentedMigrate = z.infer<typeof migrateSchema>;
1994
2129
  export type PresentedReindex = z.infer<typeof reindexSchema>;
1995
2130
  export type PresentedSkillInstall = z.infer<typeof skillInstallSchema>;
2131
+ export type PresentedSkillUninstall = z.infer<typeof skillUninstallSchema>;
2132
+ export type PresentedSkillStatus = z.infer<typeof skillStatusSchema>;
1996
2133
  /** Generates local references against the extracted schemas document in draft-07 spec */
1997
2134
  export declare function generateResultSchemas(schemas?: Record<string, z.ZodType>): {
1998
2135
  $schema: string;
@@ -53,6 +53,21 @@ export const taskSchema = z.strictObject({
53
53
  .nullable()
54
54
  .describe("The task's claim, or null when it has none or the database predates claims."),
55
55
  });
56
+ const searchExcerptFields = {
57
+ snippet: z.string().describe("Excerpt containing the first match in this source."),
58
+ highlights: z
59
+ .array(z.tuple([count, count]))
60
+ .describe("Zero-based, end-exclusive Unicode code-point ranges relative to the snippet."),
61
+ };
62
+ const taskSearchMatchSchema = z.discriminatedUnion("field", [
63
+ z.strictObject({ field: z.enum(["key", "title", "description"]), ...searchExcerptFields }),
64
+ z.strictObject({
65
+ field: z.literal("comment"),
66
+ comment_key: z.string(),
67
+ ...searchExcerptFields,
68
+ }),
69
+ ]);
70
+ const taskSearchResultSchema = taskSchema.extend({ matches: z.array(taskSearchMatchSchema) });
56
71
  export const relationSchema = z.strictObject({
57
72
  id: z.string().describe("Stored relation ID."),
58
73
  type: z
@@ -106,6 +121,7 @@ export const activitySchema = z.strictObject({
106
121
  actor_model: nullableText,
107
122
  actor_effort: nullableText,
108
123
  actor_client: nullableText,
124
+ actor_directory: nullableText,
109
125
  entity_type: z
110
126
  .string()
111
127
  .describe(`Known entity types: ${activityEntityTypeSchema.options.join(", ")}. Other stored values may occur.`),
@@ -129,6 +145,7 @@ export const actorSchema = activitySchema.pick({
129
145
  actor_model: true,
130
146
  actor_effort: true,
131
147
  actor_client: true,
148
+ actor_directory: true,
132
149
  });
133
150
  export const taskAttributionSchema = actorSchema.extend({
134
151
  id: activitySchema.shape.id,
@@ -295,6 +312,37 @@ export const backupSchema = z.strictObject({ path: z.string() });
295
312
  export const skillInstallSchema = z.strictObject({
296
313
  source: z.string().describe("The skill folder inside the CLI package that was installed."),
297
314
  });
315
+ export const skillUninstallSchema = z.strictObject({
316
+ removed: z
317
+ .array(z.strictObject({
318
+ path: z.string().describe("The first checked path that reached the removed skill file."),
319
+ scope: z.enum(["home", "project"]),
320
+ }))
321
+ .describe("The checked skill copies that the run removed, empty when it removed none."),
322
+ });
323
+ export const skillStatusSchema = z.strictObject({
324
+ bundled: z
325
+ .strictObject({
326
+ path: z
327
+ .string()
328
+ .describe("The skill folder inside the CLI package, which `zinn skill install` installs."),
329
+ reviewedVersion: nullableText.describe("The CLI version the bundled skill was reviewed for."),
330
+ })
331
+ .describe("The skill this CLI installs."),
332
+ copies: z
333
+ .array(z.strictObject({
334
+ path: z.string().describe("The first checked path that reaches the skill file."),
335
+ links: z
336
+ .array(z.string())
337
+ .describe("The other checked paths that reach the same file, in checking order."),
338
+ scope: z.enum(["home", "project"]),
339
+ reviewedVersion: nullableText.describe("The CLI version the copy was reviewed for, null when it names none or cannot be read."),
340
+ matches: z.boolean().describe("Whether its reviewed version matches the bundled skill."),
341
+ readable: z.boolean(),
342
+ remedy: nullableText.describe("The command that updates the copy, null when it matches."),
343
+ }))
344
+ .describe("One entry per skill file agents may load, in checking order, empty when there is none."),
345
+ });
298
346
  export const restoreSchema = z.strictObject({
299
347
  databasePath: z.string(),
300
348
  previousVersion: count.describe("Destination schema version before restore; zero when the destination had no schema version. backupPath says whether it was replaced."),
@@ -312,6 +360,7 @@ export const reindexSchema = z.strictObject({ databasePath: z.string(), taskCoun
312
360
  export const resultSchemas = {
313
361
  Task: taskSchema,
314
362
  TaskList: z.array(taskSchema),
363
+ TaskSearchResults: z.array(taskSearchResultSchema),
315
364
  NextTask: taskSchema.nullable(),
316
365
  TaskDetail: taskDetailSchema,
317
366
  TaskBlame: taskBlameSchema,
@@ -345,6 +394,8 @@ export const resultSchemas = {
345
394
  Migrate: migrateSchema,
346
395
  Reindex: reindexSchema,
347
396
  SkillInstall: skillInstallSchema,
397
+ SkillUninstall: skillUninstallSchema,
398
+ SkillStatus: skillStatusSchema,
348
399
  ErrorEnvelope: errorDocumentSchema,
349
400
  Capabilities: capabilitiesSchema,
350
401
  JsonValue: jsonValueSchema,
@@ -4,6 +4,7 @@ export declare const activityRouter: {
4
4
  effects: {
5
5
  domain: "read";
6
6
  storage: "normal-open";
7
+ external: never[];
7
8
  };
8
9
  confirmation: {
9
10
  kind: "none";
@@ -96,8 +97,8 @@ export declare const activityRouter: {
96
97
  readonly value: {
97
98
  readonly kind: "activity-change";
98
99
  readonly name: "field[=value]";
99
- readonly pattern: `^((${string})|(${string})=.+)$`;
100
- readonly description: `Fields: ${string}. Omit the value to match any change. Values apply to column, priority and added labels, ignoring case. priority=none matches an unassigned priority.`;
100
+ readonly pattern: string;
101
+ readonly description: `Fields: ${string}. Omit the value to match any change. ${string} priority=none matches an unassigned priority.`;
101
102
  };
102
103
  };
103
104
  readonly follow: {
@@ -149,6 +150,7 @@ export declare const activityRouter: {
149
150
  effects: {
150
151
  domain: "read";
151
152
  storage: "normal-open";
153
+ external: never[];
152
154
  };
153
155
  confirmation: {
154
156
  kind: "none";
@@ -1,15 +1,19 @@
1
1
  import { listLimitOption, listLimitDescription, parseListLimit } from "../list-limit.js";
2
2
  import { jsonResult } from "../results.js";
3
3
  import { parseArgs } from "node:util";
4
- import { activity, activityActionSchema, activityChangedFieldSchema, activityChangedSchema, CoreError, } from "@zinn-dev/core";
4
+ import { activity, activityActionSchema, activityChangedFieldSchema, activityChangedFieldsWithOptionalValue, activityChangedFieldsWithoutValue, activityChangedSchema, activityIdSchema, activityListSchema, CoreError, InputValidationError, readSnapshot, } from "@zinn-dev/core";
5
5
  import { generateCommandUsage, getOptionInputs, violatesConstraint } from "../input.js";
6
6
  import { CliError } from "../errors.js";
7
7
  import { parseTimestampInput } from "../timestamp-input.js";
8
8
  import { formatListContinuation } from "../list-continuation.js";
9
- import { diagnostic, output, outputStream, quit, validatePositionals, validateUniqueOptions, } from "../lib.js";
9
+ import { diagnostic, getOutputMode, output, outputStream, quit, validatePositionals, validateUniqueOptions, } from "../lib.js";
10
10
  import { followUntilStopped } from "../follow.js";
11
11
  import { formatActivityList, presentActivities } from "../presentation/activity-presentation.js";
12
12
  const changedFieldList = activityChangedFieldSchema.options.join(", ");
13
+ const changedFieldListFormatter = new Intl.ListFormat("en-GB");
14
+ const changedFieldsWithoutValue = changedFieldListFormatter.format(activityChangedFieldsWithoutValue);
15
+ const changedFieldsWithValue = changedFieldListFormatter.format(activityChangedFieldsWithOptionalValue.map((field) => field === "labels" ? "added labels" : field));
16
+ const changedValueHelp = `Values apply to ${changedFieldsWithValue}, ignoring case.`;
13
17
  const activityInputs = {
14
18
  list: {
15
19
  options: {
@@ -69,8 +73,8 @@ const activityInputs = {
69
73
  value: {
70
74
  kind: "activity-change",
71
75
  name: "field[=value]",
72
- pattern: `^((${activityChangedFieldSchema.options.join("|")})|(${activityChangedFieldSchema.exclude(["title", "description"]).options.join("|")})=.+)$`,
73
- description: `Fields: ${changedFieldList}. Omit the value to match any change. Values apply to column, priority and added labels, ignoring case. priority=none matches an unassigned priority.`,
76
+ pattern: String.raw `^(?:(?:${activityChangedFieldsWithOptionalValue.join("|")})(?:=[\s\S]+)?|${activityChangedFieldsWithoutValue.join("|")})$`,
77
+ description: `Fields: ${changedFieldList}. Omit the value to match any change. ${changedValueHelp} priority=none matches an unassigned priority.`,
74
78
  },
75
79
  },
76
80
  follow: { type: "boolean" },
@@ -110,7 +114,7 @@ const activityInputs = {
110
114
  export const activityRouter = {
111
115
  list: {
112
116
  summary: "List recorded activity across the database, newest first.",
113
- effects: { domain: "read", storage: "normal-open" },
117
+ effects: { domain: "read", storage: "normal-open", external: [] },
114
118
  confirmation: { kind: "none" },
115
119
  input: activityInputs.list,
116
120
  results: [
@@ -172,22 +176,31 @@ export const activityRouter = {
172
176
  since: parseTimestampInput(values.since, "--since"),
173
177
  until: parseTimestampInput(values.until, "--until"),
174
178
  };
175
- const formatEvents = (events) => formatActivityList(presentActivities(events, selection));
179
+ const presentTextEvents = (events) => getOutputMode() === "text" ? presentActivities(events, selection) : [];
176
180
  if (values.follow === true) {
177
181
  const follower = readSelectedActivity(values, () => activity.follow(filters));
178
182
  return followUntilStopped(async (signal) => {
179
- const polled = readSelectedActivity(values, () => follower.poll());
183
+ const polled = readSelectedActivity(values, () => readSnapshot(() => {
184
+ const polled = follower.poll();
185
+ return "stopped" in polled
186
+ ? polled
187
+ : { ...polled, presented: presentTextEvents(polled.events) };
188
+ }));
180
189
  if ("stopped" in polled) {
181
190
  const reason = polled.stopped === "file_replaced"
182
191
  ? `The database file at ${polled.databasePath} was replaced or removed`
183
192
  : `The database schema at ${polled.databasePath} changed`;
184
193
  throw new CliError(`${reason}, so following stopped. Run the command again to follow new activity.`, "conflict", { entity: "database", databasePath: polled.databasePath });
185
194
  }
186
- await outputStream(polled.events, formatEvents, signal);
195
+ await outputStream(polled.events, () => formatActivityList(polled.presented), signal);
187
196
  });
188
197
  }
189
- const page = readSelectedActivity(values, () => activity.getAll({ ...filters, limit, startingAfter: values["starting-after"] }));
190
- output(page.events, formatEvents);
198
+ const input = { ...filters, limit, startingAfter: values["starting-after"] };
199
+ const page = readSelectedActivity(values, () => readWithActivityPresentation(activityListSchema, input, () => {
200
+ const page = activity.getAll(input);
201
+ return { ...page, presented: presentTextEvents(page.events) };
202
+ }));
203
+ output(page.events, () => formatActivityList(page.presented));
191
204
  if (page.nextCursor !== undefined) {
192
205
  diagnostic(`More activity. Continue with: ${formatListContinuation(["activity", "list"], [], tokens, "starting-after", page.nextCursor)}`);
193
206
  }
@@ -214,9 +227,9 @@ Returns all matching events unless --limit is supplied.
214
227
  --action <action> Match a recorded action. Repeat to match any listed action.
215
228
  --changed <field>[=<value>] Match a task field change, with an optional value.
216
229
  Fields: ${changedFieldList}.
217
- Values apply to column, priority and added labels, ignoring case.
230
+ ${changedValueHelp}
218
231
  Without a value, labels match additions and removals.
219
- Title and description match any change, without a value.
232
+ Use ${changedFieldsWithoutValue} without a value.
220
233
  Use priority=none for an unassigned priority.
221
234
  --follow Print new activity as it is committed, until stopped.
222
235
  --limit <n> ${listLimitDescription}
@@ -262,7 +275,7 @@ Examples:
262
275
  },
263
276
  view: {
264
277
  summary: "Show one recorded event with full activity/entity IDs, actor and complete changes.",
265
- effects: { domain: "read", storage: "normal-open" },
278
+ effects: { domain: "read", storage: "normal-open", external: [] },
266
279
  confirmation: { kind: "none" },
267
280
  input: activityInputs.view,
268
281
  results: [jsonResult("Activity")],
@@ -274,10 +287,13 @@ Examples:
274
287
  strict: true,
275
288
  });
276
289
  validatePositionals(positionals, activityInputs.view.forms[0]);
277
- const viewed = activity.getById(positionals[0]);
278
- output(viewed, (event) => formatActivityList(presentActivities([event], { showsFullIds: true }), {
279
- showsDetails: true,
280
- }));
290
+ const id = positionals[0];
291
+ const { viewed, presented } = readWithActivityPresentation(activityIdSchema, id, () => {
292
+ const viewed = activity.getById(id);
293
+ const presented = getOutputMode() === "text" ? presentActivities([viewed], { showsFullIds: true }) : [];
294
+ return { viewed, presented };
295
+ });
296
+ output(viewed, () => formatActivityList(presented, { showsDetails: true }));
281
297
  },
282
298
  help: `${generateCommandUsage("activity view", activityInputs.view)}
283
299
 
@@ -290,6 +306,17 @@ With --json, return one full activity record.
290
306
  Example: zinn activity view 019abcdf-1234-7`,
291
307
  },
292
308
  };
309
+ /** Text adds database lookups. Validate the input before opening their shared snapshot. */
310
+ function readWithActivityPresentation(schema, input, read) {
311
+ if (getOutputMode() === "json") {
312
+ return read();
313
+ }
314
+ const validation = schema.safeParse(input);
315
+ if (!validation.success) {
316
+ throw new InputValidationError(validation.error.issues);
317
+ }
318
+ return readSnapshot(read);
319
+ }
293
320
  /** Reads the selected activity, reporting core's refusals with the flag that caused them */
294
321
  function readSelectedActivity(values, read) {
295
322
  try {
@@ -3,6 +3,7 @@ export declare const backupCommand: {
3
3
  effects: {
4
4
  domain: "none";
5
5
  storage: "backup";
6
+ external: never[];
6
7
  };
7
8
  confirmation: {
8
9
  kind: "none";
@@ -5,8 +5,8 @@ import { generateCommandUsage, noInput } from "../input.js";
5
5
  import { output, validatePositionals } from "../lib.js";
6
6
  import packageJson from "../../package.json" with { type: "json" };
7
7
  export const backupCommand = {
8
- summary: "Save a copy of the database to ~/.zinn/backups/, or to backups/ in ZINN_DIR when it is set.",
9
- effects: { domain: "none", storage: "backup" },
8
+ summary: "Save a verified copy of the database to ~/.zinn/backups/, or to backups/ in ZINN_DIR when it is set.",
9
+ effects: { domain: "none", storage: "backup", external: [] },
10
10
  confirmation: { kind: "none" },
11
11
  input: noInput,
12
12
  results: [jsonResult("Backup")],
@@ -23,8 +23,9 @@ export const backupCommand = {
23
23
  },
24
24
  help: `${generateCommandUsage("backup", noInput)}
25
25
 
26
- Save a copy of the database to ~/.zinn/backups/, or to backups/ in ZINN_DIR when it is set.
26
+ Save a verified copy of the database to ~/.zinn/backups/, or to backups/ in ZINN_DIR when it is set.
27
27
 
28
28
  The copy includes recent writes and is safe to take while Zinn is in use.
29
+ Zinn checks the copy's SQLite integrity and foreign keys. If a check fails, the command reports the path of the copy retained for recovery.
29
30
  Fails when there is no database yet. Existing backups are never overwritten.`,
30
31
  };
@@ -3,6 +3,7 @@ export declare const capabilitiesCommand: {
3
3
  effects: {
4
4
  domain: "none";
5
5
  storage: "none";
6
+ external: never[];
6
7
  };
7
8
  confirmation: {
8
9
  kind: "none";
@@ -5,7 +5,7 @@ import { formatCapabilities } from "../presentation/capabilities-presentation.js
5
5
  import { jsonResult } from "../results.js";
6
6
  export const capabilitiesCommand = {
7
7
  summary: "Describe the installed CLI commands, inputs, results and errors.",
8
- effects: { domain: "none", storage: "none" },
8
+ effects: { domain: "none", storage: "none", external: [] },
9
9
  confirmation: { kind: "none" },
10
10
  input: noInput,
11
11
  results: [jsonResult("Capabilities")],