@cchistory/lite 0.5.0 → 0.7.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 (190) hide show
  1. package/INSTALL.md +1 -1
  2. package/apps/lite-cli/dist/agent-contract.d.ts +5 -2
  3. package/apps/lite-cli/dist/agent-contract.d.ts.map +1 -1
  4. package/apps/lite-cli/dist/agent-contract.js +20 -9
  5. package/apps/lite-cli/dist/agent-contract.js.map +1 -1
  6. package/apps/lite-cli/dist/agent-journeys.test.d.ts +2 -0
  7. package/apps/lite-cli/dist/agent-journeys.test.d.ts.map +1 -0
  8. package/apps/lite-cli/dist/agent-journeys.test.js +403 -0
  9. package/apps/lite-cli/dist/agent-journeys.test.js.map +1 -0
  10. package/apps/lite-cli/dist/bin.js +3 -3
  11. package/apps/lite-cli/dist/bin.js.map +1 -1
  12. package/apps/lite-cli/dist/index.d.ts.map +1 -1
  13. package/apps/lite-cli/dist/index.js +55 -13
  14. package/apps/lite-cli/dist/index.js.map +1 -1
  15. package/apps/lite-cli/dist/index.test.js +34 -69
  16. package/apps/lite-cli/dist/index.test.js.map +1 -1
  17. package/apps/lite-cli/dist/query.d.ts +15 -2
  18. package/apps/lite-cli/dist/query.d.ts.map +1 -1
  19. package/apps/lite-cli/dist/query.js +79 -4
  20. package/apps/lite-cli/dist/query.js.map +1 -1
  21. package/apps/lite-cli/dist/shell.d.ts +2 -1
  22. package/apps/lite-cli/dist/shell.d.ts.map +1 -1
  23. package/apps/lite-cli/dist/shell.js +20 -16
  24. package/apps/lite-cli/dist/shell.js.map +1 -1
  25. package/apps/lite-cli/dist/version.d.ts +1 -1
  26. package/apps/lite-cli/dist/version.js +1 -1
  27. package/apps/lite-tui/dist/bin.js +3 -3
  28. package/apps/lite-tui/dist/bin.js.map +1 -1
  29. package/apps/lite-tui/dist/index.d.ts.map +1 -1
  30. package/apps/lite-tui/dist/index.js +4 -0
  31. package/apps/lite-tui/dist/index.js.map +1 -1
  32. package/apps/lite-tui/dist/index.test.js +5 -5
  33. package/apps/lite-tui/dist/index.test.js.map +1 -1
  34. package/apps/lite-tui/dist/model.d.ts.map +1 -1
  35. package/apps/lite-tui/dist/model.js +2 -1
  36. package/apps/lite-tui/dist/model.js.map +1 -1
  37. package/apps/lite-tui/dist/render.d.ts +1 -1
  38. package/apps/lite-tui/dist/version.d.ts +1 -1
  39. package/apps/lite-tui/dist/version.js +1 -1
  40. package/bin/cchistory-lite-tui.mjs +3 -3
  41. package/bin/cchistory-lite.mjs +3 -3
  42. package/docs/guide/agent-evidence.md +154 -0
  43. package/docs/guide/for-agents.md +45 -25
  44. package/docs/guide/lite.md +16 -4
  45. package/docs/guide/query.md +11 -2
  46. package/node_modules/@cchistory/canonical/dist/conversation-evidence.d.ts +85 -0
  47. package/node_modules/@cchistory/canonical/dist/conversation-evidence.d.ts.map +1 -0
  48. package/node_modules/@cchistory/canonical/dist/conversation-evidence.js +191 -0
  49. package/node_modules/@cchistory/canonical/dist/conversation-evidence.js.map +1 -0
  50. package/node_modules/@cchistory/canonical/dist/conversation-evidence.test.d.ts +2 -0
  51. package/node_modules/@cchistory/canonical/dist/conversation-evidence.test.d.ts.map +1 -0
  52. package/node_modules/@cchistory/canonical/dist/conversation-evidence.test.js +105 -0
  53. package/node_modules/@cchistory/canonical/dist/conversation-evidence.test.js.map +1 -0
  54. package/node_modules/@cchistory/canonical/dist/index.d.ts +2 -0
  55. package/node_modules/@cchistory/canonical/dist/index.d.ts.map +1 -1
  56. package/node_modules/@cchistory/canonical/dist/index.js +2 -0
  57. package/node_modules/@cchistory/canonical/dist/index.js.map +1 -1
  58. package/node_modules/@cchistory/canonical/dist/projection-audit.d.ts +4 -3
  59. package/node_modules/@cchistory/canonical/dist/projection-audit.d.ts.map +1 -1
  60. package/node_modules/@cchistory/canonical/dist/projection-audit.js +14 -0
  61. package/node_modules/@cchistory/canonical/dist/projection-audit.js.map +1 -1
  62. package/node_modules/@cchistory/canonical/dist/read-status.d.ts +11 -0
  63. package/node_modules/@cchistory/canonical/dist/read-status.d.ts.map +1 -0
  64. package/node_modules/@cchistory/canonical/dist/read-status.js +14 -0
  65. package/node_modules/@cchistory/canonical/dist/read-status.js.map +1 -0
  66. package/node_modules/@cchistory/canonical/dist/session-family.js +1 -1
  67. package/node_modules/@cchistory/canonical/dist/session-family.js.map +1 -1
  68. package/node_modules/@cchistory/canonical/dist/session-interpreter.d.ts +7 -3
  69. package/node_modules/@cchistory/canonical/dist/session-interpreter.d.ts.map +1 -1
  70. package/node_modules/@cchistory/canonical/dist/session-interpreter.js +15 -13
  71. package/node_modules/@cchistory/canonical/dist/session-interpreter.js.map +1 -1
  72. package/node_modules/@cchistory/canonical/package.json +1 -1
  73. package/node_modules/@cchistory/domain/dist/conversation-evidence.d.ts +24 -0
  74. package/node_modules/@cchistory/domain/dist/conversation-evidence.d.ts.map +1 -0
  75. package/node_modules/@cchistory/domain/dist/conversation-evidence.js +2 -0
  76. package/node_modules/@cchistory/domain/dist/conversation-evidence.js.map +1 -0
  77. package/node_modules/@cchistory/domain/dist/index.d.ts +5 -0
  78. package/node_modules/@cchistory/domain/dist/index.d.ts.map +1 -1
  79. package/node_modules/@cchistory/domain/dist/index.js.map +1 -1
  80. package/node_modules/@cchistory/domain/package.json +1 -1
  81. package/node_modules/@cchistory/live-runtime/dist/bootstrap.d.ts +1 -0
  82. package/node_modules/@cchistory/live-runtime/dist/bootstrap.d.ts.map +1 -1
  83. package/node_modules/@cchistory/live-runtime/dist/bootstrap.js +1 -0
  84. package/node_modules/@cchistory/live-runtime/dist/bootstrap.js.map +1 -1
  85. package/node_modules/@cchistory/live-runtime/dist/bounded-cache.d.ts +15 -0
  86. package/node_modules/@cchistory/live-runtime/dist/bounded-cache.d.ts.map +1 -0
  87. package/node_modules/@cchistory/live-runtime/dist/bounded-cache.js +44 -0
  88. package/node_modules/@cchistory/live-runtime/dist/bounded-cache.js.map +1 -0
  89. package/node_modules/@cchistory/live-runtime/dist/bounded-cache.test.d.ts +2 -0
  90. package/node_modules/@cchistory/live-runtime/dist/bounded-cache.test.d.ts.map +1 -0
  91. package/node_modules/@cchistory/live-runtime/dist/bounded-cache.test.js +45 -0
  92. package/node_modules/@cchistory/live-runtime/dist/bounded-cache.test.js.map +1 -0
  93. package/node_modules/@cchistory/live-runtime/dist/diagnostics.d.ts +7 -0
  94. package/node_modules/@cchistory/live-runtime/dist/diagnostics.d.ts.map +1 -0
  95. package/node_modules/@cchistory/live-runtime/dist/diagnostics.js +2 -0
  96. package/node_modules/@cchistory/live-runtime/dist/diagnostics.js.map +1 -0
  97. package/node_modules/@cchistory/live-runtime/dist/history-reader.d.ts +24 -0
  98. package/node_modules/@cchistory/live-runtime/dist/history-reader.d.ts.map +1 -0
  99. package/node_modules/@cchistory/live-runtime/dist/history-reader.js +155 -0
  100. package/node_modules/@cchistory/live-runtime/dist/history-reader.js.map +1 -0
  101. package/node_modules/@cchistory/live-runtime/dist/index.d.ts +92 -6
  102. package/node_modules/@cchistory/live-runtime/dist/index.d.ts.map +1 -1
  103. package/node_modules/@cchistory/live-runtime/dist/index.js +249 -70
  104. package/node_modules/@cchistory/live-runtime/dist/index.js.map +1 -1
  105. package/node_modules/@cchistory/live-runtime/dist/index.test.js +6 -1
  106. package/node_modules/@cchistory/live-runtime/dist/index.test.js.map +1 -1
  107. package/node_modules/@cchistory/live-runtime/dist/launcher-memory.d.ts +12 -0
  108. package/node_modules/@cchistory/live-runtime/dist/launcher-memory.d.ts.map +1 -0
  109. package/node_modules/@cchistory/live-runtime/dist/launcher-memory.js +44 -0
  110. package/node_modules/@cchistory/live-runtime/dist/launcher-memory.js.map +1 -0
  111. package/node_modules/@cchistory/live-runtime/dist/launcher-memory.test.d.ts +2 -0
  112. package/node_modules/@cchistory/live-runtime/dist/launcher-memory.test.d.ts.map +1 -0
  113. package/node_modules/@cchistory/live-runtime/dist/launcher-memory.test.js +20 -0
  114. package/node_modules/@cchistory/live-runtime/dist/launcher-memory.test.js.map +1 -0
  115. package/node_modules/@cchistory/live-runtime/dist/live-read-recovery.test.d.ts +2 -0
  116. package/node_modules/@cchistory/live-runtime/dist/live-read-recovery.test.d.ts.map +1 -0
  117. package/node_modules/@cchistory/live-runtime/dist/live-read-recovery.test.js +92 -0
  118. package/node_modules/@cchistory/live-runtime/dist/live-read-recovery.test.js.map +1 -0
  119. package/node_modules/@cchistory/live-runtime/dist/scan-guard.d.ts +1 -0
  120. package/node_modules/@cchistory/live-runtime/dist/scan-guard.d.ts.map +1 -1
  121. package/node_modules/@cchistory/live-runtime/dist/scan-guard.js +7 -13
  122. package/node_modules/@cchistory/live-runtime/dist/scan-guard.js.map +1 -1
  123. package/node_modules/@cchistory/live-runtime/dist/scan-guard.test.js +50 -55
  124. package/node_modules/@cchistory/live-runtime/dist/scan-guard.test.js.map +1 -1
  125. package/node_modules/@cchistory/live-runtime/dist/selective-query.d.ts +2 -1
  126. package/node_modules/@cchistory/live-runtime/dist/selective-query.d.ts.map +1 -1
  127. package/node_modules/@cchistory/live-runtime/dist/selective-query.js.map +1 -1
  128. package/node_modules/@cchistory/live-runtime/dist/selective-query.test.js +8 -3
  129. package/node_modules/@cchistory/live-runtime/dist/selective-query.test.js.map +1 -1
  130. package/node_modules/@cchistory/live-runtime/dist/system-memory.test.js +3 -3
  131. package/node_modules/@cchistory/live-runtime/dist/system-memory.test.js.map +1 -1
  132. package/node_modules/@cchistory/live-runtime/package.json +1 -1
  133. package/node_modules/@cchistory/source-adapters/dist/core/conversation-seeds.d.ts +3 -0
  134. package/node_modules/@cchistory/source-adapters/dist/core/conversation-seeds.d.ts.map +1 -1
  135. package/node_modules/@cchistory/source-adapters/dist/core/conversation-seeds.js.map +1 -1
  136. package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.d.ts +12 -0
  137. package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.d.ts.map +1 -0
  138. package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.js +32 -0
  139. package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.js.map +1 -0
  140. package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.test.d.ts +2 -0
  141. package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.test.d.ts.map +1 -0
  142. package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.test.js +21 -0
  143. package/node_modules/@cchistory/source-adapters/dist/core/decoded-record.test.js.map +1 -0
  144. package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.js +3 -2
  145. package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.js.map +1 -1
  146. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.d.ts +3 -1
  147. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.d.ts.map +1 -1
  148. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.js +56 -38
  149. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.js.map +1 -1
  150. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.test.js +76 -1
  151. package/node_modules/@cchistory/source-adapters/dist/core/jsonl-records.test.js.map +1 -1
  152. package/node_modules/@cchistory/source-adapters/dist/core/parser.d.ts +16 -5
  153. package/node_modules/@cchistory/source-adapters/dist/core/parser.d.ts.map +1 -1
  154. package/node_modules/@cchistory/source-adapters/dist/core/parser.js +136 -76
  155. package/node_modules/@cchistory/source-adapters/dist/core/parser.js.map +1 -1
  156. package/node_modules/@cchistory/source-adapters/dist/core/probe.d.ts.map +1 -1
  157. package/node_modules/@cchistory/source-adapters/dist/core/probe.js +75 -54
  158. package/node_modules/@cchistory/source-adapters/dist/core/probe.js.map +1 -1
  159. package/node_modules/@cchistory/source-adapters/dist/core/read-budget.d.ts +4 -1
  160. package/node_modules/@cchistory/source-adapters/dist/core/read-budget.d.ts.map +1 -1
  161. package/node_modules/@cchistory/source-adapters/dist/core/read-budget.js +5 -3
  162. package/node_modules/@cchistory/source-adapters/dist/core/read-budget.js.map +1 -1
  163. package/node_modules/@cchistory/source-adapters/dist/core/read-budget.test.js +61 -2
  164. package/node_modules/@cchistory/source-adapters/dist/core/read-budget.test.js.map +1 -1
  165. package/node_modules/@cchistory/source-adapters/dist/core/source-identity.d.ts +6 -2
  166. package/node_modules/@cchistory/source-adapters/dist/core/source-identity.d.ts.map +1 -1
  167. package/node_modules/@cchistory/source-adapters/dist/core/source-identity.js +5 -5
  168. package/node_modules/@cchistory/source-adapters/dist/core/source-identity.js.map +1 -1
  169. package/node_modules/@cchistory/source-adapters/dist/core/types.d.ts +4 -1
  170. package/node_modules/@cchistory/source-adapters/dist/core/types.d.ts.map +1 -1
  171. package/node_modules/@cchistory/source-adapters/dist/index.test.d.ts +1 -0
  172. package/node_modules/@cchistory/source-adapters/dist/index.test.d.ts.map +1 -1
  173. package/node_modules/@cchistory/source-adapters/dist/index.test.js +1 -0
  174. package/node_modules/@cchistory/source-adapters/dist/index.test.js.map +1 -1
  175. package/node_modules/@cchistory/source-adapters/dist/platforms/amp.test.js +49 -1
  176. package/node_modules/@cchistory/source-adapters/dist/platforms/amp.test.js.map +1 -1
  177. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.d.ts +2 -0
  178. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.d.ts.map +1 -1
  179. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.js +48 -29
  180. package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.js.map +1 -1
  181. package/node_modules/@cchistory/source-adapters/package.json +1 -1
  182. package/package.json +5 -5
  183. package/schemas/cchistory-lite-agent-v1.schema.json +8 -5
  184. package/schemas/cchistory-lite-canonical-v1.schema.json +82 -0
  185. package/schemas/cchistory-lite-diagnostic-v1.schema.json +27 -0
  186. package/schemas/cchistory-lite-query-result-v2.schema.json +232 -4
  187. package/schemas/cchistory-lite-query-result-v3.schema.json +45 -1
  188. package/schemas/cchistory-lite-query-v2.schema.json +150 -8
  189. package/schemas/cchistory-lite-v2.schema.json +82 -0
  190. package/skills/using-cchistory-lite/SKILL.md +86 -127
@@ -7,6 +7,88 @@
7
7
  "properties": {
8
8
  "schema": { "const": "cchistory-lite-canonical/v1" },
9
9
  "kind": { "type": "string" },
10
+ "read": {
11
+ "type": "object",
12
+ "additionalProperties": false,
13
+ "required": [
14
+ "id",
15
+ "prepared_at",
16
+ "scope"
17
+ ],
18
+ "properties": {
19
+ "id": {
20
+ "type": "string"
21
+ },
22
+ "prepared_at": {
23
+ "type": "string"
24
+ },
25
+ "scope": {
26
+ "type": "object",
27
+ "additionalProperties": false,
28
+ "required": [
29
+ "directory",
30
+ "source_ids"
31
+ ],
32
+ "properties": {
33
+ "directory": {
34
+ "type": [
35
+ "string",
36
+ "null"
37
+ ]
38
+ },
39
+ "source_ids": {
40
+ "type": "array",
41
+ "items": {
42
+ "type": "string"
43
+ }
44
+ }
45
+ }
46
+ }
47
+ }
48
+ },
49
+ "read_status": {
50
+ "type": "object",
51
+ "additionalProperties": false,
52
+ "required": [
53
+ "status",
54
+ "reasons",
55
+ "source_error_count",
56
+ "loss_warning_count",
57
+ "unknown_directory_sessions",
58
+ "projection_issue_count"
59
+ ],
60
+ "properties": {
61
+ "status": {
62
+ "enum": [
63
+ "no_known_gaps",
64
+ "partial",
65
+ "unverified"
66
+ ]
67
+ },
68
+ "reasons": {
69
+ "type": "array",
70
+ "items": {
71
+ "type": "string"
72
+ }
73
+ },
74
+ "source_error_count": {
75
+ "type": "integer",
76
+ "minimum": 0
77
+ },
78
+ "loss_warning_count": {
79
+ "type": "integer",
80
+ "minimum": 0
81
+ },
82
+ "unknown_directory_sessions": {
83
+ "type": "integer",
84
+ "minimum": 0
85
+ },
86
+ "projection_issue_count": {
87
+ "type": "integer",
88
+ "minimum": 0
89
+ }
90
+ }
91
+ },
10
92
  "projection_issues": { "type": "array" }
11
93
  },
12
94
  "additionalProperties": true
@@ -0,0 +1,27 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://cchistory.dev/schemas/cchistory-lite-diagnostic-v1.schema.json",
4
+ "title": "Optional read diagnostics on stderr",
5
+ "type": "object",
6
+ "required": ["schema", "kind"],
7
+ "properties": {
8
+ "schema": { "const": "cchistory-lite-diagnostic/v1" },
9
+ "kind": { "enum": ["read_start", "read_done", "read_error", "progress", "budget", "query_work", "cache", "notice"] },
10
+ "attempt_id": { "type": "string" },
11
+ "read_id": { "type": "string" },
12
+ "stage": { "type": "string" },
13
+ "count": { "type": "integer", "minimum": 0 },
14
+ "count_unit": { "enum": ["files", "records", "sessions", "turns"] },
15
+ "size_bytes": { "type": "integer", "minimum": 0 },
16
+ "requested_bytes": { "type": "integer", "minimum": 0 },
17
+ "allowed_native_bytes": { "type": "integer", "minimum": 0 },
18
+ "heap_available_bytes": { "type": "number", "minimum": 0 },
19
+ "system_available_bytes": { "type": ["number", "null"], "minimum": 0 },
20
+ "elapsed_ms": { "type": "number", "minimum": 0 },
21
+ "stage_elapsed_ms": { "type": "number", "minimum": 0 },
22
+ "heap_used_bytes": { "type": "number", "minimum": 0 },
23
+ "rss_bytes": { "type": "number", "minimum": 0 },
24
+ "process_peak_rss_bytes": { "type": "number", "minimum": 0 }
25
+ },
26
+ "additionalProperties": true
27
+ }
@@ -8,7 +8,9 @@
8
8
  "kind",
9
9
  "content_trust",
10
10
  "operations",
11
- "projection_issues"
11
+ "projection_issues",
12
+ "read",
13
+ "read_status"
12
14
  ],
13
15
  "properties": {
14
16
  "schema": {
@@ -39,7 +41,8 @@
39
41
  "session",
40
42
  "replies",
41
43
  "latest",
42
- "list"
44
+ "list",
45
+ "read"
43
46
  ]
44
47
  },
45
48
  "status": {
@@ -55,7 +58,35 @@
55
58
  "type": "object"
56
59
  }
57
60
  },
58
- "additionalProperties": false
61
+ "additionalProperties": false,
62
+ "allOf": [
63
+ {
64
+ "if": {
65
+ "properties": {
66
+ "kind": {
67
+ "const": "read"
68
+ },
69
+ "status": {
70
+ "const": "ok"
71
+ }
72
+ },
73
+ "required": [
74
+ "kind",
75
+ "status"
76
+ ]
77
+ },
78
+ "then": {
79
+ "properties": {
80
+ "result": {
81
+ "$ref": "#/$defs/evidenceRead"
82
+ }
83
+ },
84
+ "required": [
85
+ "result"
86
+ ]
87
+ }
88
+ }
89
+ ]
59
90
  }
60
91
  },
61
92
  "projection_issues": {
@@ -78,7 +109,204 @@
78
109
  }
79
110
  },
80
111
  "additionalProperties": false
112
+ },
113
+ "read_status": {
114
+ "type": "object",
115
+ "additionalProperties": false,
116
+ "required": [
117
+ "status",
118
+ "reasons",
119
+ "source_error_count",
120
+ "loss_warning_count",
121
+ "unknown_directory_sessions",
122
+ "projection_issue_count"
123
+ ],
124
+ "properties": {
125
+ "status": {
126
+ "enum": [
127
+ "no_known_gaps",
128
+ "partial",
129
+ "unverified"
130
+ ]
131
+ },
132
+ "reasons": {
133
+ "type": "array",
134
+ "items": {
135
+ "type": "string"
136
+ }
137
+ },
138
+ "source_error_count": {
139
+ "type": "integer",
140
+ "minimum": 0
141
+ },
142
+ "loss_warning_count": {
143
+ "type": "integer",
144
+ "minimum": 0
145
+ },
146
+ "unknown_directory_sessions": {
147
+ "type": "integer",
148
+ "minimum": 0
149
+ },
150
+ "projection_issue_count": {
151
+ "type": "integer",
152
+ "minimum": 0
153
+ }
154
+ }
155
+ },
156
+ "read": {
157
+ "type": "object",
158
+ "additionalProperties": false,
159
+ "required": [
160
+ "id",
161
+ "prepared_at",
162
+ "scope"
163
+ ],
164
+ "properties": {
165
+ "id": {
166
+ "type": "string"
167
+ },
168
+ "prepared_at": {
169
+ "type": "string"
170
+ },
171
+ "scope": {
172
+ "type": "object",
173
+ "additionalProperties": false,
174
+ "required": [
175
+ "directory",
176
+ "source_ids"
177
+ ],
178
+ "properties": {
179
+ "directory": {
180
+ "type": [
181
+ "string",
182
+ "null"
183
+ ]
184
+ },
185
+ "source_ids": {
186
+ "type": "array",
187
+ "items": {
188
+ "type": "string"
189
+ }
190
+ }
191
+ }
192
+ }
193
+ }
81
194
  }
82
195
  },
83
- "additionalProperties": false
196
+ "additionalProperties": false,
197
+ "$defs": {
198
+ "evidenceRead": {
199
+ "type": "object",
200
+ "required": [
201
+ "target",
202
+ "revision",
203
+ "messages",
204
+ "shown",
205
+ "total_messages",
206
+ "returned_chars",
207
+ "max_chars",
208
+ "has_more",
209
+ "next_cursor"
210
+ ],
211
+ "properties": {
212
+ "target": {
213
+ "type": "object"
214
+ },
215
+ "revision": {
216
+ "type": "string",
217
+ "pattern": "^[a-f0-9]{64}$"
218
+ },
219
+ "messages": {
220
+ "type": "array",
221
+ "maxItems": 100,
222
+ "items": {
223
+ "type": "object",
224
+ "required": [
225
+ "message_id",
226
+ "session_id",
227
+ "turn_id",
228
+ "role",
229
+ "created_at",
230
+ "text",
231
+ "start",
232
+ "end",
233
+ "total_chars",
234
+ "truncated"
235
+ ],
236
+ "properties": {
237
+ "message_id": {
238
+ "type": "string"
239
+ },
240
+ "session_id": {
241
+ "type": "string"
242
+ },
243
+ "turn_id": {
244
+ "type": [
245
+ "string",
246
+ "null"
247
+ ]
248
+ },
249
+ "created_at": {
250
+ "type": "string"
251
+ },
252
+ "text": {
253
+ "type": "string"
254
+ },
255
+ "role": {
256
+ "enum": [
257
+ "user",
258
+ "assistant"
259
+ ]
260
+ },
261
+ "start": {
262
+ "type": "integer",
263
+ "minimum": 0
264
+ },
265
+ "end": {
266
+ "type": "integer",
267
+ "minimum": 0
268
+ },
269
+ "total_chars": {
270
+ "type": "integer",
271
+ "minimum": 0
272
+ },
273
+ "truncated": {
274
+ "type": "boolean"
275
+ }
276
+ },
277
+ "additionalProperties": false
278
+ }
279
+ },
280
+ "shown": {
281
+ "type": "integer",
282
+ "minimum": 0,
283
+ "maximum": 100
284
+ },
285
+ "total_messages": {
286
+ "type": "integer",
287
+ "minimum": 0
288
+ },
289
+ "returned_chars": {
290
+ "type": "integer",
291
+ "minimum": 0,
292
+ "maximum": 64000
293
+ },
294
+ "max_chars": {
295
+ "type": "integer",
296
+ "minimum": 256,
297
+ "maximum": 64000
298
+ },
299
+ "has_more": {
300
+ "type": "boolean"
301
+ },
302
+ "next_cursor": {
303
+ "type": [
304
+ "string",
305
+ "null"
306
+ ]
307
+ }
308
+ },
309
+ "additionalProperties": false
310
+ }
311
+ }
84
312
  }
@@ -10,7 +10,8 @@
10
10
  "read",
11
11
  "operations",
12
12
  "projection_issues",
13
- "diagnostics"
13
+ "diagnostics",
14
+ "read_status"
14
15
  ],
15
16
  "properties": {
16
17
  "schema": {
@@ -214,6 +215,49 @@
214
215
  ]
215
216
  }
216
217
  }
218
+ },
219
+ "read_status": {
220
+ "type": "object",
221
+ "additionalProperties": false,
222
+ "required": [
223
+ "status",
224
+ "reasons",
225
+ "source_error_count",
226
+ "loss_warning_count",
227
+ "unknown_directory_sessions",
228
+ "projection_issue_count"
229
+ ],
230
+ "properties": {
231
+ "status": {
232
+ "enum": [
233
+ "no_known_gaps",
234
+ "partial",
235
+ "unverified"
236
+ ]
237
+ },
238
+ "reasons": {
239
+ "type": "array",
240
+ "items": {
241
+ "type": "string"
242
+ }
243
+ },
244
+ "source_error_count": {
245
+ "type": "integer",
246
+ "minimum": 0
247
+ },
248
+ "loss_warning_count": {
249
+ "type": "integer",
250
+ "minimum": 0
251
+ },
252
+ "unknown_directory_sessions": {
253
+ "type": "integer",
254
+ "minimum": 0
255
+ },
256
+ "projection_issue_count": {
257
+ "type": "integer",
258
+ "minimum": 0
259
+ }
260
+ }
217
261
  }
218
262
  }
219
263
  }
@@ -12,6 +12,7 @@
12
12
  "items": {
13
13
  "oneOf": [
14
14
  { "$ref": "#/$defs/search" },
15
+ { "$ref": "#/$defs/read" },
15
16
  { "$ref": "#/$defs/session" },
16
17
  { "$ref": "#/$defs/replies" },
17
18
  { "$ref": "#/$defs/latest" },
@@ -21,19 +22,160 @@
21
22
  }
22
23
  },
23
24
  "$defs": {
24
- "search": {
25
+ "read": {
25
26
  "type": "object",
26
- "required": ["id", "kind", "query"],
27
+ "required": [
28
+ "id",
29
+ "kind"
30
+ ],
31
+ "oneOf": [
32
+ {
33
+ "required": [
34
+ "session_ref"
35
+ ],
36
+ "not": {
37
+ "required": [
38
+ "turn_ref"
39
+ ]
40
+ }
41
+ },
42
+ {
43
+ "required": [
44
+ "turn_ref"
45
+ ],
46
+ "not": {
47
+ "required": [
48
+ "session_ref"
49
+ ]
50
+ }
51
+ }
52
+ ],
27
53
  "properties": {
28
- "id": { "type": "string", "minLength": 1 },
29
- "kind": { "const": "search" },
30
- "query": { "type": "string", "minLength": 1 },
31
- "project_ref": { "type": "string", "minLength": 1 },
32
- "limit": { "type": "integer", "minimum": 1 },
33
- "offset": { "type": "integer", "minimum": 0 }
54
+ "id": {
55
+ "type": "string",
56
+ "minLength": 1
57
+ },
58
+ "kind": {
59
+ "const": "read"
60
+ },
61
+ "session_ref": {
62
+ "type": "string",
63
+ "minLength": 1
64
+ },
65
+ "turn_ref": {
66
+ "type": "string",
67
+ "minLength": 1
68
+ },
69
+ "max_chars": {
70
+ "type": "integer",
71
+ "minimum": 256,
72
+ "maximum": 64000,
73
+ "default": 8000
74
+ },
75
+ "limit": {
76
+ "type": "integer",
77
+ "minimum": 1,
78
+ "maximum": 100,
79
+ "default": 20
80
+ },
81
+ "cursor": {
82
+ "type": "string",
83
+ "minLength": 1,
84
+ "maxLength": 2048
85
+ }
34
86
  },
35
87
  "additionalProperties": false
36
88
  },
89
+ "search": {
90
+ "type": "object",
91
+ "required": [
92
+ "id",
93
+ "kind",
94
+ "query"
95
+ ],
96
+ "properties": {
97
+ "id": {
98
+ "type": "string",
99
+ "minLength": 1
100
+ },
101
+ "kind": {
102
+ "const": "search"
103
+ },
104
+ "query": {
105
+ "type": "string",
106
+ "minLength": 1
107
+ },
108
+ "project_ref": {
109
+ "type": "string",
110
+ "minLength": 1
111
+ },
112
+ "limit": {
113
+ "type": "integer",
114
+ "minimum": 1
115
+ },
116
+ "offset": {
117
+ "type": "integer",
118
+ "minimum": 0
119
+ },
120
+ "content": {
121
+ "enum": [
122
+ "authored",
123
+ "conversation"
124
+ ],
125
+ "default": "authored"
126
+ },
127
+ "max_chars": {
128
+ "type": "integer",
129
+ "minimum": 256,
130
+ "maximum": 64000,
131
+ "default": 8000
132
+ },
133
+ "group_by": { "enum": ["session", "message"], "default": "session" }
134
+ },
135
+ "additionalProperties": false,
136
+ "allOf": [
137
+ {
138
+ "if": {
139
+ "properties": {
140
+ "content": {
141
+ "const": "conversation"
142
+ }
143
+ },
144
+ "required": [
145
+ "content"
146
+ ]
147
+ },
148
+ "then": {
149
+ "properties": {
150
+ "limit": {
151
+ "maximum": 100
152
+ }
153
+ }
154
+ }
155
+ },
156
+ {
157
+ "if": {
158
+ "required": [
159
+ "max_chars"
160
+ ]
161
+ },
162
+ "then": {
163
+ "properties": {
164
+ "content": {
165
+ "const": "conversation"
166
+ }
167
+ },
168
+ "required": [
169
+ "content"
170
+ ]
171
+ }
172
+ },
173
+ {
174
+ "if": { "required": ["group_by"] },
175
+ "then": { "properties": { "content": { "const": "conversation" } }, "required": ["content"] }
176
+ }
177
+ ]
178
+ },
37
179
  "session": {
38
180
  "type": "object",
39
181
  "required": ["id", "kind", "refs"],
@@ -13,6 +13,88 @@
13
13
  ]
14
14
  },
15
15
  "content_trust": { "const": "untrusted_history" },
16
+ "read": {
17
+ "type": "object",
18
+ "additionalProperties": false,
19
+ "required": [
20
+ "id",
21
+ "prepared_at",
22
+ "scope"
23
+ ],
24
+ "properties": {
25
+ "id": {
26
+ "type": "string"
27
+ },
28
+ "prepared_at": {
29
+ "type": "string"
30
+ },
31
+ "scope": {
32
+ "type": "object",
33
+ "additionalProperties": false,
34
+ "required": [
35
+ "directory",
36
+ "source_ids"
37
+ ],
38
+ "properties": {
39
+ "directory": {
40
+ "type": [
41
+ "string",
42
+ "null"
43
+ ]
44
+ },
45
+ "source_ids": {
46
+ "type": "array",
47
+ "items": {
48
+ "type": "string"
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+ },
55
+ "read_status": {
56
+ "type": "object",
57
+ "additionalProperties": false,
58
+ "required": [
59
+ "status",
60
+ "reasons",
61
+ "source_error_count",
62
+ "loss_warning_count",
63
+ "unknown_directory_sessions",
64
+ "projection_issue_count"
65
+ ],
66
+ "properties": {
67
+ "status": {
68
+ "enum": [
69
+ "no_known_gaps",
70
+ "partial",
71
+ "unverified"
72
+ ]
73
+ },
74
+ "reasons": {
75
+ "type": "array",
76
+ "items": {
77
+ "type": "string"
78
+ }
79
+ },
80
+ "source_error_count": {
81
+ "type": "integer",
82
+ "minimum": 0
83
+ },
84
+ "loss_warning_count": {
85
+ "type": "integer",
86
+ "minimum": 0
87
+ },
88
+ "unknown_directory_sessions": {
89
+ "type": "integer",
90
+ "minimum": 0
91
+ },
92
+ "projection_issue_count": {
93
+ "type": "integer",
94
+ "minimum": 0
95
+ }
96
+ }
97
+ },
16
98
  "projection_issues": { "type": "array", "items": { "$ref": "#/$defs/projectionIssue" } },
17
99
  "sources": { "type": "array", "items": { "$ref": "#/$defs/source" } },
18
100
  "projects": { "type": "array", "items": { "$ref": "#/$defs/project" } },