@otto-code/protocol 0.8.17 → 0.8.19

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.
@@ -16,6 +16,22 @@ export declare const ProjectKnowledgeStatusSchema: z.ZodEnum<{
16
16
  proposed: "proposed";
17
17
  confirmed: "confirmed";
18
18
  }>;
19
+ /**
20
+ * Where a project keeps its Knowledge store. `repository` is the historical
21
+ * `.otto/` directory in the working tree; `host` is a directory under the
22
+ * daemon's `$OTTO_HOME`, so the working tree stays clean. `null` on a project
23
+ * means "inherit the host default".
24
+ *
25
+ * Declared up here rather than beside the store RPCs at the bottom of the file:
26
+ * `messages.ts` composes it into the project descriptor, and the AOT validator
27
+ * generator evaluates these modules for real, so a schema referenced by another
28
+ * must already exist when that reference runs.
29
+ * COMPAT(projectKnowledgeStoreLocation): added in v0.8.18.
30
+ */
31
+ export declare const ProjectKnowledgeStoreLocationValueSchema: z.ZodEnum<{
32
+ repository: "repository";
33
+ host: "host";
34
+ }>;
19
35
  export declare const ProjectDeliveryStatusSchema: z.ZodEnum<{
20
36
  reference: "reference";
21
37
  charter: "charter";
@@ -92,6 +108,7 @@ export declare const ProjectKnowledgeRecordSchema: z.ZodObject<{
92
108
  affects: z.ZodOptional<z.ZodArray<z.ZodString>>;
93
109
  }, z.core.$strip>>>;
94
110
  path: z.ZodOptional<z.ZodString>;
111
+ absolutePath: z.ZodOptional<z.ZodString>;
95
112
  }, z.core.$strip>;
96
113
  /** Review health, not a persisted project-knowledge finding record. */
97
114
  export declare const ProjectKnowledgeHealthSchema: z.ZodObject<{
@@ -113,7 +130,9 @@ export declare const ProjectKnowledgeRootPageSchema: z.ZodObject<{
113
130
  slug: z.ZodString;
114
131
  title: z.ZodString;
115
132
  path: z.ZodString;
133
+ absolutePath: z.ZodOptional<z.ZodString>;
116
134
  body: z.ZodString;
135
+ bodyDigest: z.ZodOptional<z.ZodString>;
117
136
  }, z.core.$strip>;
118
137
  export declare const ProjectKnowledgeListRequestMessageSchema: z.ZodObject<{
119
138
  type: z.ZodLiteral<"project.knowledge.list.request">;
@@ -178,12 +197,15 @@ export declare const ProjectKnowledgeListResponseMessageSchema: z.ZodObject<{
178
197
  affects: z.ZodOptional<z.ZodArray<z.ZodString>>;
179
198
  }, z.core.$strip>>>;
180
199
  path: z.ZodOptional<z.ZodString>;
200
+ absolutePath: z.ZodOptional<z.ZodString>;
181
201
  }, z.core.$strip>>;
182
202
  rootPages: z.ZodOptional<z.ZodArray<z.ZodObject<{
183
203
  slug: z.ZodString;
184
204
  title: z.ZodString;
185
205
  path: z.ZodString;
206
+ absolutePath: z.ZodOptional<z.ZodString>;
186
207
  body: z.ZodString;
208
+ bodyDigest: z.ZodOptional<z.ZodString>;
187
209
  }, z.core.$strip>>>;
188
210
  findings: z.ZodArray<z.ZodObject<{
189
211
  kind: z.ZodEnum<{
@@ -270,6 +292,7 @@ export declare const ProjectKnowledgeGetResponseMessageSchema: z.ZodObject<{
270
292
  affects: z.ZodOptional<z.ZodArray<z.ZodString>>;
271
293
  }, z.core.$strip>>>;
272
294
  path: z.ZodOptional<z.ZodString>;
295
+ absolutePath: z.ZodOptional<z.ZodString>;
273
296
  }, z.core.$strip>>;
274
297
  }, z.core.$strip>;
275
298
  }, z.core.$strip>;
@@ -379,6 +402,7 @@ export declare const ProjectKnowledgeCreateResponseMessageSchema: z.ZodObject<{
379
402
  affects: z.ZodOptional<z.ZodArray<z.ZodString>>;
380
403
  }, z.core.$strip>>>;
381
404
  path: z.ZodOptional<z.ZodString>;
405
+ absolutePath: z.ZodOptional<z.ZodString>;
382
406
  }, z.core.$strip>;
383
407
  }, z.core.$strip>;
384
408
  }, z.core.$strip>;
@@ -390,6 +414,7 @@ export declare const ProjectKnowledgeApplyRequestMessageSchema: z.ZodObject<{
390
414
  title: z.ZodOptional<z.ZodString>;
391
415
  statement: z.ZodOptional<z.ZodString>;
392
416
  evidence: z.ZodOptional<z.ZodString>;
417
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
393
418
  provenanceText: z.ZodOptional<z.ZodString>;
394
419
  provenanceSource: z.ZodOptional<z.ZodString>;
395
420
  provenanceAffects: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -453,6 +478,7 @@ export declare const ProjectKnowledgeApplyResponseMessageSchema: z.ZodObject<{
453
478
  affects: z.ZodOptional<z.ZodArray<z.ZodString>>;
454
479
  }, z.core.$strip>>>;
455
480
  path: z.ZodOptional<z.ZodString>;
481
+ absolutePath: z.ZodOptional<z.ZodString>;
456
482
  }, z.core.$strip>>;
457
483
  error: z.ZodOptional<z.ZodString>;
458
484
  }, z.core.$strip>;
@@ -527,6 +553,7 @@ export declare const ProjectKnowledgeStatusResponseMessageSchema: z.ZodObject<{
527
553
  affects: z.ZodOptional<z.ZodArray<z.ZodString>>;
528
554
  }, z.core.$strip>>>;
529
555
  path: z.ZodOptional<z.ZodString>;
556
+ absolutePath: z.ZodOptional<z.ZodString>;
530
557
  }, z.core.$strip>>;
531
558
  }, z.core.$strip>;
532
559
  }, z.core.$strip>;
@@ -611,6 +638,7 @@ export declare const ProjectKnowledgeProjectApplyResponseMessageSchema: z.ZodObj
611
638
  affects: z.ZodOptional<z.ZodArray<z.ZodString>>;
612
639
  }, z.core.$strip>>>;
613
640
  path: z.ZodOptional<z.ZodString>;
641
+ absolutePath: z.ZodOptional<z.ZodString>;
614
642
  }, z.core.$strip>>;
615
643
  error: z.ZodOptional<z.ZodString>;
616
644
  }, z.core.$strip>;
@@ -689,6 +717,7 @@ export declare const ProjectKnowledgeReferenceApplyResponseMessageSchema: z.ZodO
689
717
  affects: z.ZodOptional<z.ZodArray<z.ZodString>>;
690
718
  }, z.core.$strip>>>;
691
719
  path: z.ZodOptional<z.ZodString>;
720
+ absolutePath: z.ZodOptional<z.ZodString>;
692
721
  }, z.core.$strip>>;
693
722
  error: z.ZodOptional<z.ZodString>;
694
723
  }, z.core.$strip>;
@@ -708,8 +737,176 @@ export declare const ProjectKnowledgeRootApplyResponseMessageSchema: z.ZodObject
708
737
  slug: z.ZodString;
709
738
  title: z.ZodString;
710
739
  path: z.ZodString;
740
+ absolutePath: z.ZodOptional<z.ZodString>;
741
+ body: z.ZodString;
742
+ bodyDigest: z.ZodOptional<z.ZodString>;
743
+ }, z.core.$strip>>;
744
+ }, z.core.$strip>;
745
+ }, z.core.$strip>;
746
+ /**
747
+ * A reviewed refinement commits an accepted proposal, not an ordinary edit.
748
+ * Confirmed atomic Knowledge is demoted atomically with its new truth; root
749
+ * pages use a body digest because they have no review state.
750
+ */
751
+ export declare const ProjectKnowledgeRefineApplyRequestMessageSchema: z.ZodObject<{
752
+ type: z.ZodLiteral<"project.knowledge.refine.apply.request">;
753
+ requestId: z.ZodString;
754
+ workspaceId: z.ZodString;
755
+ target: z.ZodEnum<{
756
+ record: "record";
757
+ root: "root";
758
+ }>;
759
+ id: z.ZodOptional<z.ZodString>;
760
+ slug: z.ZodOptional<z.ZodString>;
761
+ statement: z.ZodOptional<z.ZodString>;
762
+ evidence: z.ZodOptional<z.ZodString>;
763
+ body: z.ZodOptional<z.ZodString>;
764
+ expectedUpdatedAt: z.ZodOptional<z.ZodString>;
765
+ expectedBodyDigest: z.ZodOptional<z.ZodString>;
766
+ }, z.core.$strip>;
767
+ export declare const ProjectKnowledgeRefineApplyResponseMessageSchema: z.ZodObject<{
768
+ type: z.ZodLiteral<"project.knowledge.refine.apply.response">;
769
+ payload: z.ZodObject<{
770
+ requestId: z.ZodString;
771
+ record: z.ZodNullable<z.ZodObject<{
772
+ id: z.ZodString;
773
+ kind: z.ZodEnum<{
774
+ project: "project";
775
+ reference: "reference";
776
+ decision: "decision";
777
+ constraint: "constraint";
778
+ requirement: "requirement";
779
+ architecture: "architecture";
780
+ finding: "finding";
781
+ }>;
782
+ title: z.ZodString;
783
+ statement: z.ZodString;
784
+ statementDigest: z.ZodOptional<z.ZodString>;
785
+ evidence: z.ZodOptional<z.ZodString>;
786
+ tags: z.ZodArray<z.ZodString>;
787
+ status: z.ZodEnum<{
788
+ superseded: "superseded";
789
+ proposed: "proposed";
790
+ confirmed: "confirmed";
791
+ }>;
792
+ deliveryStatus: z.ZodOptional<z.ZodEnum<{
793
+ reference: "reference";
794
+ charter: "charter";
795
+ in_build: "in_build";
796
+ partial: "partial";
797
+ blocked: "blocked";
798
+ complete: "complete";
799
+ deferred: "deferred";
800
+ cancelled: "cancelled";
801
+ }>>;
802
+ progress: z.ZodOptional<z.ZodObject<{
803
+ completed: z.ZodNumber;
804
+ total: z.ZodNumber;
805
+ unit: z.ZodString;
806
+ }, z.core.$strip>>;
807
+ referenceDisposition: z.ZodOptional<z.ZodEnum<{
808
+ read: "read";
809
+ unevaluated: "unevaluated";
810
+ adopted: "adopted";
811
+ rejected: "rejected";
812
+ dependency: "dependency";
813
+ }>>;
814
+ sourceUrl: z.ZodOptional<z.ZodString>;
815
+ createdAt: z.ZodString;
816
+ updatedAt: z.ZodString;
817
+ provenance: z.ZodOptional<z.ZodArray<z.ZodObject<{
818
+ text: z.ZodString;
819
+ recordedAt: z.ZodString;
820
+ source: z.ZodOptional<z.ZodString>;
821
+ kind: z.ZodOptional<z.ZodString>;
822
+ affects: z.ZodOptional<z.ZodArray<z.ZodString>>;
823
+ }, z.core.$strip>>>;
824
+ path: z.ZodOptional<z.ZodString>;
825
+ absolutePath: z.ZodOptional<z.ZodString>;
826
+ }, z.core.$strip>>;
827
+ page: z.ZodNullable<z.ZodObject<{
828
+ slug: z.ZodString;
829
+ title: z.ZodString;
830
+ path: z.ZodString;
831
+ absolutePath: z.ZodOptional<z.ZodString>;
711
832
  body: z.ZodString;
833
+ bodyDigest: z.ZodOptional<z.ZodString>;
712
834
  }, z.core.$strip>>;
835
+ demoted: z.ZodBoolean;
836
+ error: z.ZodOptional<z.ZodString>;
837
+ }, z.core.$strip>;
838
+ }, z.core.$strip>;
839
+ /** An exact source span inside an editable Project Knowledge title or body. */
840
+ export declare const ProjectKnowledgeRefinementAnchorSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
841
+ kind: z.ZodLiteral<"text">;
842
+ start: z.ZodNumber;
843
+ end: z.ZodNumber;
844
+ }, z.core.$strip>, z.ZodObject<{
845
+ kind: z.ZodLiteral<"fence">;
846
+ start: z.ZodNumber;
847
+ end: z.ZodNumber;
848
+ language: z.ZodNullable<z.ZodString>;
849
+ }, z.core.$strip>], "kind">;
850
+ /** A temporary source-bound instruction sent to the dedicated Knowledge writer. */
851
+ export declare const ProjectKnowledgeRefinementDirectiveSchema: z.ZodObject<{
852
+ id: z.ZodOptional<z.ZodString>;
853
+ kind: z.ZodEnum<{
854
+ replace: "replace";
855
+ refine: "refine";
856
+ }>;
857
+ selectedText: z.ZodOptional<z.ZodString>;
858
+ beforeContext: z.ZodOptional<z.ZodString>;
859
+ afterContext: z.ZodOptional<z.ZodString>;
860
+ anchor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
861
+ kind: z.ZodLiteral<"text">;
862
+ start: z.ZodNumber;
863
+ end: z.ZodNumber;
864
+ }, z.core.$strip>, z.ZodObject<{
865
+ kind: z.ZodLiteral<"fence">;
866
+ start: z.ZodNumber;
867
+ end: z.ZodNumber;
868
+ language: z.ZodNullable<z.ZodString>;
869
+ }, z.core.$strip>], "kind">>;
870
+ value: z.ZodString;
871
+ }, z.core.$strip>;
872
+ /**
873
+ * Produces one inert Knowledge proposal. Direct replacements have already been
874
+ * applied by the caller; this request carries only the remaining refinement
875
+ * instructions and never writes the store.
876
+ */
877
+ export declare const ProjectKnowledgeRefinementProposeRequestMessageSchema: z.ZodObject<{
878
+ type: z.ZodLiteral<"project.knowledge.refinement.propose.request">;
879
+ requestId: z.ZodString;
880
+ workspaceId: z.ZodString;
881
+ content: z.ZodString;
882
+ directives: z.ZodArray<z.ZodObject<{
883
+ id: z.ZodOptional<z.ZodString>;
884
+ kind: z.ZodEnum<{
885
+ replace: "replace";
886
+ refine: "refine";
887
+ }>;
888
+ selectedText: z.ZodOptional<z.ZodString>;
889
+ beforeContext: z.ZodOptional<z.ZodString>;
890
+ afterContext: z.ZodOptional<z.ZodString>;
891
+ anchor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
892
+ kind: z.ZodLiteral<"text">;
893
+ start: z.ZodNumber;
894
+ end: z.ZodNumber;
895
+ }, z.core.$strip>, z.ZodObject<{
896
+ kind: z.ZodLiteral<"fence">;
897
+ start: z.ZodNumber;
898
+ end: z.ZodNumber;
899
+ language: z.ZodNullable<z.ZodString>;
900
+ }, z.core.$strip>], "kind">>;
901
+ value: z.ZodString;
902
+ }, z.core.$strip>>;
903
+ }, z.core.$strip>;
904
+ export declare const ProjectKnowledgeRefinementProposeResponseMessageSchema: z.ZodObject<{
905
+ type: z.ZodLiteral<"project.knowledge.refinement.propose.response">;
906
+ payload: z.ZodObject<{
907
+ requestId: z.ZodString;
908
+ content: z.ZodNullable<z.ZodString>;
909
+ error: z.ZodOptional<z.ZodString>;
713
910
  }, z.core.$strip>;
714
911
  }, z.core.$strip>;
715
912
  export declare const ProjectKnowledgeDeleteRequestMessageSchema: z.ZodObject<{
@@ -732,9 +929,110 @@ export type ProjectKnowledgeListResponseMessage = z.infer<typeof ProjectKnowledg
732
929
  export type ProjectKnowledgeGetResponseMessage = z.infer<typeof ProjectKnowledgeGetResponseMessageSchema>;
733
930
  export type ProjectKnowledgeCreateResponseMessage = z.infer<typeof ProjectKnowledgeCreateResponseMessageSchema>;
734
931
  export type ProjectKnowledgeApplyResponseMessage = z.infer<typeof ProjectKnowledgeApplyResponseMessageSchema>;
932
+ export type ProjectKnowledgeRefinementProposeResponseMessage = z.infer<typeof ProjectKnowledgeRefinementProposeResponseMessageSchema>;
735
933
  export type ProjectKnowledgeStatusResponseMessage = z.infer<typeof ProjectKnowledgeStatusResponseMessageSchema>;
736
934
  export type ProjectKnowledgeProjectApplyResponseMessage = z.infer<typeof ProjectKnowledgeProjectApplyResponseMessageSchema>;
737
935
  export type ProjectKnowledgeReferenceApplyResponseMessage = z.infer<typeof ProjectKnowledgeReferenceApplyResponseMessageSchema>;
738
936
  export type ProjectKnowledgeRootApplyResponseMessage = z.infer<typeof ProjectKnowledgeRootApplyResponseMessageSchema>;
937
+ export type ProjectKnowledgeRefineApplyResponseMessage = z.infer<typeof ProjectKnowledgeRefineApplyResponseMessageSchema>;
739
938
  export type ProjectKnowledgeDeleteResponseMessage = z.infer<typeof ProjectKnowledgeDeleteResponseMessageSchema>;
939
+ /** What the daemon resolved for a workspace, and why the client may act on it. */
940
+ export declare const ProjectKnowledgeStoreDescriptorSchema: z.ZodObject<{
941
+ location: z.ZodEnum<{
942
+ repository: "repository";
943
+ host: "host";
944
+ }>;
945
+ override: z.ZodNullable<z.ZodEnum<{
946
+ repository: "repository";
947
+ host: "host";
948
+ }>>;
949
+ hostDefault: z.ZodEnum<{
950
+ repository: "repository";
951
+ host: "host";
952
+ }>;
953
+ basePath: z.ZodString;
954
+ projectId: z.ZodNullable<z.ZodString>;
955
+ hasPages: z.ZodBoolean;
956
+ otherLocationHasPages: z.ZodBoolean;
957
+ }, z.core.$strip>;
958
+ /**
959
+ * Addressed by project or by workspace. Project Settings has a project and no
960
+ * open workspace; the Knowledge panel has a workspace and reaches its project
961
+ * through it. Both are optional on the wire and the daemon rejects neither
962
+ * being set, rather than forcing a caller to invent an id it does not have.
963
+ */
964
+ export declare const ProjectKnowledgeStoreGetRequestMessageSchema: z.ZodObject<{
965
+ type: z.ZodLiteral<"project.knowledge.store.get.request">;
966
+ requestId: z.ZodString;
967
+ workspaceId: z.ZodOptional<z.ZodString>;
968
+ projectId: z.ZodOptional<z.ZodString>;
969
+ }, z.core.$strip>;
970
+ export declare const ProjectKnowledgeStoreGetResponseMessageSchema: z.ZodObject<{
971
+ type: z.ZodLiteral<"project.knowledge.store.get.response">;
972
+ payload: z.ZodObject<{
973
+ requestId: z.ZodString;
974
+ store: z.ZodNullable<z.ZodObject<{
975
+ location: z.ZodEnum<{
976
+ repository: "repository";
977
+ host: "host";
978
+ }>;
979
+ override: z.ZodNullable<z.ZodEnum<{
980
+ repository: "repository";
981
+ host: "host";
982
+ }>>;
983
+ hostDefault: z.ZodEnum<{
984
+ repository: "repository";
985
+ host: "host";
986
+ }>;
987
+ basePath: z.ZodString;
988
+ projectId: z.ZodNullable<z.ZodString>;
989
+ hasPages: z.ZodBoolean;
990
+ otherLocationHasPages: z.ZodBoolean;
991
+ }, z.core.$strip>>;
992
+ error: z.ZodNullable<z.ZodString>;
993
+ }, z.core.$strip>;
994
+ }, z.core.$strip>;
995
+ export declare const ProjectKnowledgeStoreSetRequestMessageSchema: z.ZodObject<{
996
+ type: z.ZodLiteral<"project.knowledge.store.set.request">;
997
+ requestId: z.ZodString;
998
+ projectId: z.ZodString;
999
+ workspaceId: z.ZodOptional<z.ZodString>;
1000
+ location: z.ZodNullable<z.ZodEnum<{
1001
+ repository: "repository";
1002
+ host: "host";
1003
+ }>>;
1004
+ movePages: z.ZodDefault<z.ZodBoolean>;
1005
+ }, z.core.$strip>;
1006
+ export declare const ProjectKnowledgeStoreSetResponseMessageSchema: z.ZodObject<{
1007
+ type: z.ZodLiteral<"project.knowledge.store.set.response">;
1008
+ payload: z.ZodObject<{
1009
+ requestId: z.ZodString;
1010
+ projectId: z.ZodString;
1011
+ accepted: z.ZodBoolean;
1012
+ store: z.ZodNullable<z.ZodObject<{
1013
+ location: z.ZodEnum<{
1014
+ repository: "repository";
1015
+ host: "host";
1016
+ }>;
1017
+ override: z.ZodNullable<z.ZodEnum<{
1018
+ repository: "repository";
1019
+ host: "host";
1020
+ }>>;
1021
+ hostDefault: z.ZodEnum<{
1022
+ repository: "repository";
1023
+ host: "host";
1024
+ }>;
1025
+ basePath: z.ZodString;
1026
+ projectId: z.ZodNullable<z.ZodString>;
1027
+ hasPages: z.ZodBoolean;
1028
+ otherLocationHasPages: z.ZodBoolean;
1029
+ }, z.core.$strip>>;
1030
+ movedPageCount: z.ZodNumber;
1031
+ error: z.ZodNullable<z.ZodString>;
1032
+ }, z.core.$strip>;
1033
+ }, z.core.$strip>;
1034
+ export type ProjectKnowledgeStoreDescriptor = z.infer<typeof ProjectKnowledgeStoreDescriptorSchema>;
1035
+ export type ProjectKnowledgeStoreGetResponseMessage = z.infer<typeof ProjectKnowledgeStoreGetResponseMessageSchema>;
1036
+ export type ProjectKnowledgeStoreSetResponseMessage = z.infer<typeof ProjectKnowledgeStoreSetResponseMessageSchema>;
1037
+ export type ProjectKnowledgeStoreLocationValue = z.infer<typeof ProjectKnowledgeStoreLocationValueSchema>;
740
1038
  //# sourceMappingURL=project-knowledge.d.ts.map
@@ -15,6 +15,19 @@ export const ProjectKnowledgeKindSchema = z.enum([
15
15
  "reference",
16
16
  ]);
17
17
  export const ProjectKnowledgeStatusSchema = z.enum(["proposed", "confirmed", "superseded"]);
18
+ /**
19
+ * Where a project keeps its Knowledge store. `repository` is the historical
20
+ * `.otto/` directory in the working tree; `host` is a directory under the
21
+ * daemon's `$OTTO_HOME`, so the working tree stays clean. `null` on a project
22
+ * means "inherit the host default".
23
+ *
24
+ * Declared up here rather than beside the store RPCs at the bottom of the file:
25
+ * `messages.ts` composes it into the project descriptor, and the AOT validator
26
+ * generator evaluates these modules for real, so a schema referenced by another
27
+ * must already exist when that reference runs.
28
+ * COMPAT(projectKnowledgeStoreLocation): added in v0.8.18.
29
+ */
30
+ export const ProjectKnowledgeStoreLocationValueSchema = z.enum(["repository", "host"]);
18
31
  export const ProjectDeliveryStatusSchema = z.enum([
19
32
  "charter",
20
33
  "in_build",
@@ -61,7 +74,13 @@ export const ProjectKnowledgeRecordSchema = z.object({
61
74
  affects: z.array(z.string()).optional(),
62
75
  }))
63
76
  .optional(),
77
+ // Relative to the store's path base: the project root for a repository
78
+ // store, the store directory for a host store. Prefer `absolutePath` when
79
+ // the client needs a path it can actually open.
64
80
  path: z.string().optional(),
81
+ // COMPAT(projectKnowledgeStoreLocation): added in v0.8.18; the only path a
82
+ // client can open for a host-local store. Absent from older daemons.
83
+ absolutePath: z.string().optional(),
65
84
  });
66
85
  /** Review health, not a persisted project-knowledge finding record. */
67
86
  export const ProjectKnowledgeHealthSchema = z.object({
@@ -76,7 +95,12 @@ export const ProjectKnowledgeRootPageSchema = z.object({
76
95
  slug: z.string(),
77
96
  title: z.string(),
78
97
  path: z.string(),
98
+ // COMPAT(projectKnowledgeStoreLocation): added in v0.8.18. See the same field
99
+ // on ProjectKnowledgeRecordSchema.
100
+ absolutePath: z.string().optional(),
79
101
  body: z.string(),
102
+ /** Conditional-write precondition for a reviewed root-page refinement. */
103
+ bodyDigest: z.string().optional(),
80
104
  });
81
105
  export const ProjectKnowledgeListRequestMessageSchema = z.object({
82
106
  type: z.literal("project.knowledge.list.request"),
@@ -135,6 +159,9 @@ export const ProjectKnowledgeApplyRequestMessageSchema = z.object({
135
159
  title: z.string().max(160).optional(),
136
160
  statement: z.string().optional(),
137
161
  evidence: z.string().optional(),
162
+ // COMPAT(projectKnowledgeTagEditing): added in v0.8.21, accepted through
163
+ // 2027-02-27 for clients before tag editing.
164
+ tags: z.array(z.string().max(48)).max(32).optional(),
138
165
  provenanceText: z.string().optional(),
139
166
  provenanceSource: z.string().max(160).optional(),
140
167
  provenanceAffects: z.array(z.string()).optional(),
@@ -210,6 +237,78 @@ export const ProjectKnowledgeRootApplyResponseMessageSchema = z.object({
210
237
  page: ProjectKnowledgeRootPageSchema.nullable(),
211
238
  }),
212
239
  });
240
+ /**
241
+ * A reviewed refinement commits an accepted proposal, not an ordinary edit.
242
+ * Confirmed atomic Knowledge is demoted atomically with its new truth; root
243
+ * pages use a body digest because they have no review state.
244
+ */
245
+ export const ProjectKnowledgeRefineApplyRequestMessageSchema = z.object({
246
+ type: z.literal("project.knowledge.refine.apply.request"),
247
+ requestId: z.string(),
248
+ workspaceId: z.string(),
249
+ target: z.enum(["record", "root"]),
250
+ id: z.string().optional(),
251
+ slug: z.string().optional(),
252
+ statement: z.string().optional(),
253
+ // COMPAT(projectKnowledgeEvidenceRefinement): added in v0.8.18, accepted
254
+ // through 2027-02-27 for clients before multi-field record review.
255
+ evidence: z.string().optional(),
256
+ body: z.string().optional(),
257
+ expectedUpdatedAt: z.string().optional(),
258
+ expectedBodyDigest: z.string().optional(),
259
+ });
260
+ export const ProjectKnowledgeRefineApplyResponseMessageSchema = z.object({
261
+ type: z.literal("project.knowledge.refine.apply.response"),
262
+ payload: z.object({
263
+ requestId: z.string(),
264
+ record: ProjectKnowledgeRecordSchema.nullable(),
265
+ page: ProjectKnowledgeRootPageSchema.nullable(),
266
+ demoted: z.boolean(),
267
+ error: z.string().optional(),
268
+ }),
269
+ });
270
+ /** An exact source span inside an editable Project Knowledge title or body. */
271
+ export const ProjectKnowledgeRefinementAnchorSchema = z.discriminatedUnion("kind", [
272
+ z.object({ kind: z.literal("text"), start: z.number().int(), end: z.number().int() }),
273
+ z.object({
274
+ kind: z.literal("fence"),
275
+ start: z.number().int(),
276
+ end: z.number().int(),
277
+ language: z.string().nullable(),
278
+ }),
279
+ ]);
280
+ /** A temporary source-bound instruction sent to the dedicated Knowledge writer. */
281
+ export const ProjectKnowledgeRefinementDirectiveSchema = z.object({
282
+ id: z.string().optional(),
283
+ kind: z.enum(["replace", "refine"]),
284
+ // COMPAT(projectKnowledgePhraseRefinement): accepted through 2027-02-27 for
285
+ // clients before source-owned review anchors.
286
+ selectedText: z.string().optional(),
287
+ beforeContext: z.string().optional(),
288
+ afterContext: z.string().optional(),
289
+ anchor: ProjectKnowledgeRefinementAnchorSchema.optional(),
290
+ value: z.string(),
291
+ });
292
+ /**
293
+ * Produces one inert Knowledge proposal. Direct replacements have already been
294
+ * applied by the caller; this request carries only the remaining refinement
295
+ * instructions and never writes the store.
296
+ */
297
+ export const ProjectKnowledgeRefinementProposeRequestMessageSchema = z.object({
298
+ type: z.literal("project.knowledge.refinement.propose.request"),
299
+ requestId: z.string(),
300
+ workspaceId: z.string(),
301
+ content: z.string(),
302
+ directives: z.array(ProjectKnowledgeRefinementDirectiveSchema),
303
+ });
304
+ export const ProjectKnowledgeRefinementProposeResponseMessageSchema = z.object({
305
+ type: z.literal("project.knowledge.refinement.propose.response"),
306
+ payload: z.object({
307
+ requestId: z.string(),
308
+ content: z.string().nullable(),
309
+ error: z.string().optional(),
310
+ }),
311
+ });
213
312
  export const ProjectKnowledgeDeleteRequestMessageSchema = z.object({
214
313
  type: z.literal("project.knowledge.delete.request"),
215
314
  requestId: z.string(),
@@ -226,4 +325,71 @@ export const ProjectKnowledgeDeleteResponseMessageSchema = z.object({
226
325
  error: z.string().optional(),
227
326
  }),
228
327
  });
328
+ // COMPAT(projectKnowledgeStoreLocation): added in v0.8.18, drop the gate when
329
+ // floor >= v0.8.18. Gated by server_info features.projectKnowledgeStoreLocation.
330
+ /** What the daemon resolved for a workspace, and why the client may act on it. */
331
+ export const ProjectKnowledgeStoreDescriptorSchema = z.object({
332
+ location: ProjectKnowledgeStoreLocationValueSchema,
333
+ /** The project's own override; null means it is following the host default. */
334
+ override: ProjectKnowledgeStoreLocationValueSchema.nullable(),
335
+ /** The host default in force, so the UI can label the inherited choice. */
336
+ hostDefault: ProjectKnowledgeStoreLocationValueSchema,
337
+ /** Absolute directory holding `KNOWLEDGE.md` and the `knowledge/` tree. */
338
+ basePath: z.string(),
339
+ /** The project this store belongs to, when the workspace has a registered one. */
340
+ projectId: z.string().nullable(),
341
+ /** Whether the resolved store holds pages a switch would offer to carry over. */
342
+ hasPages: z.boolean(),
343
+ /** Whether the other location already holds pages a switch would land beside. */
344
+ otherLocationHasPages: z.boolean(),
345
+ });
346
+ /**
347
+ * Addressed by project or by workspace. Project Settings has a project and no
348
+ * open workspace; the Knowledge panel has a workspace and reaches its project
349
+ * through it. Both are optional on the wire and the daemon rejects neither
350
+ * being set, rather than forcing a caller to invent an id it does not have.
351
+ */
352
+ export const ProjectKnowledgeStoreGetRequestMessageSchema = z.object({
353
+ type: z.literal("project.knowledge.store.get.request"),
354
+ requestId: z.string(),
355
+ workspaceId: z.string().optional(),
356
+ projectId: z.string().optional(),
357
+ });
358
+ export const ProjectKnowledgeStoreGetResponseMessageSchema = z.object({
359
+ type: z.literal("project.knowledge.store.get.response"),
360
+ payload: z.object({
361
+ requestId: z.string(),
362
+ store: ProjectKnowledgeStoreDescriptorSchema.nullable(),
363
+ error: z.string().nullable(),
364
+ }),
365
+ });
366
+ export const ProjectKnowledgeStoreSetRequestMessageSchema = z.object({
367
+ type: z.literal("project.knowledge.store.set.request"),
368
+ requestId: z.string(),
369
+ projectId: z.string().min(1),
370
+ /**
371
+ * The workspace whose context report should be refreshed. Optional because
372
+ * the setting is reachable from Project Settings, where no workspace is open.
373
+ */
374
+ workspaceId: z.string().optional(),
375
+ /** Null returns the project to inheriting the host default. */
376
+ location: ProjectKnowledgeStoreLocationValueSchema.nullable(),
377
+ /**
378
+ * Whether to carry the existing pages to the new location. The daemon never
379
+ * decides this: a silent move stages a deletion in the user's working tree.
380
+ */
381
+ movePages: z.boolean().default(false),
382
+ });
383
+ export const ProjectKnowledgeStoreSetResponseMessageSchema = z.object({
384
+ type: z.literal("project.knowledge.store.set.response"),
385
+ payload: z.object({
386
+ requestId: z.string(),
387
+ projectId: z.string(),
388
+ accepted: z.boolean(),
389
+ store: ProjectKnowledgeStoreDescriptorSchema.nullable(),
390
+ /** Pages actually carried across. Zero when `movePages` was false. */
391
+ movedPageCount: z.number().int().nonnegative(),
392
+ error: z.string().nullable(),
393
+ }),
394
+ });
229
395
  //# sourceMappingURL=project-knowledge.js.map