@wirecat/cli-core 0.650.0 → 0.652.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/CHANGELOG.md +65 -0
- package/dist/background/daily-archive-timer.d.ts +1 -1
- package/dist/cli/account-remove.js +11 -6
- package/dist/cli/compact.d.ts +5 -0
- package/dist/cli/compact.js +7 -3
- package/dist/cli/doctor-reports-command.d.ts +11 -0
- package/dist/cli/doctor-reports-command.js +57 -5
- package/dist/cli/help/first-screen.js +5 -0
- package/dist/cli/program.js +3 -1
- package/dist/cli/schedule/schedule-command.js +9 -3
- package/dist/cli/unknown-profile.d.ts +4 -3
- package/dist/cli/unknown-profile.js +13 -6
- package/dist/constants/index.d.ts +4 -3
- package/dist/constants/index.js +7 -5
- package/dist/documents/catalog.d.ts +2 -1
- package/dist/documents/catalog.js +4 -3
- package/dist/documents/index.d.ts +1 -1
- package/dist/documents/index.js +1 -1
- package/dist/documents/model.d.ts +3 -0
- package/dist/documents/scope.d.ts +13 -0
- package/dist/documents/scope.js +7 -0
- package/dist/entities/index.d.ts +10 -10
- package/dist/entities/task-results.d.ts +10 -10
- package/dist/errors/reasons.js +6 -1
- package/dist/kit/own-catalogue.d.ts +1 -1
- package/dist/kit/own-catalogue.js +3 -3
- package/dist/meetings/index.d.ts +1 -1
- package/dist/meetings/pull.js +19 -0
- package/dist/meetings/store.d.ts +7 -0
- package/dist/meetings/transcript-store.d.ts +4 -0
- package/dist/models/endpoint.d.ts +2 -2
- package/dist/models/endpoint.js +37 -3
- package/dist/services/documents/plan.d.ts +2 -1
- package/dist/services/documents/plan.js +35 -10
- package/dist/services/documents/ports.d.ts +2 -0
- package/dist/services/documents/sync.js +17 -7
- package/dist/services/metadata.d.ts +1 -1
- package/dist/services/search-all.js +20 -1
- package/dist/store/path.d.ts +2 -0
- package/dist/store/path.js +1 -1
- package/dist/store/sqlite/link-kinds.d.ts +2 -2
- package/dist/store/sqlite/link-kinds.js +2 -2
- package/dist/store/sqlite/meeting-projects.js +3 -3
- package/dist/store/sqlite/meeting-transcript-documents.d.ts +10 -0
- package/dist/store/sqlite/meeting-transcript-documents.js +52 -0
- package/dist/store/sqlite/meetings.d.ts +2 -2
- package/dist/store/sqlite/meetings.js +16 -2
- package/dist/store/sqlite/person-match-scan.d.ts +5 -0
- package/dist/store/sqlite/person-match-scan.js +21 -0
- package/package.json +2 -2
package/dist/entities/index.d.ts
CHANGED
|
@@ -4723,7 +4723,7 @@ export declare const ENTITIES: {
|
|
|
4723
4723
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
4724
4724
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
4725
4725
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
4726
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
4726
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
4727
4727
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
4728
4728
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
4729
4729
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -4738,7 +4738,7 @@ export declare const ENTITIES: {
|
|
|
4738
4738
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
4739
4739
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
4740
4740
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
4741
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
4741
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
4742
4742
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
4743
4743
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
4744
4744
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -4839,7 +4839,7 @@ export declare const ENTITIES: {
|
|
|
4839
4839
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
4840
4840
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
4841
4841
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
4842
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
4842
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
4843
4843
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
4844
4844
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
4845
4845
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -4854,7 +4854,7 @@ export declare const ENTITIES: {
|
|
|
4854
4854
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
4855
4855
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
4856
4856
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
4857
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
4857
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
4858
4858
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
4859
4859
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
4860
4860
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -4956,7 +4956,7 @@ export declare const ENTITIES: {
|
|
|
4956
4956
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
4957
4957
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
4958
4958
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
4959
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
4959
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
4960
4960
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
4961
4961
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
4962
4962
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -4971,7 +4971,7 @@ export declare const ENTITIES: {
|
|
|
4971
4971
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
4972
4972
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
4973
4973
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
4974
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
4974
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
4975
4975
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
4976
4976
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
4977
4977
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -5101,7 +5101,7 @@ export declare const ENTITIES: {
|
|
|
5101
5101
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
5102
5102
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
5103
5103
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
5104
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
5104
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
5105
5105
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
5106
5106
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
5107
5107
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -5116,7 +5116,7 @@ export declare const ENTITIES: {
|
|
|
5116
5116
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
5117
5117
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
5118
5118
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
5119
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
5119
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
5120
5120
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
5121
5121
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
5122
5122
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -5211,7 +5211,7 @@ export declare const ENTITIES: {
|
|
|
5211
5211
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
5212
5212
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
5213
5213
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
5214
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
5214
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
5215
5215
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
5216
5216
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
5217
5217
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -5226,7 +5226,7 @@ export declare const ENTITIES: {
|
|
|
5226
5226
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
5227
5227
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
5228
5228
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
5229
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
5229
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
5230
5230
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
5231
5231
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
5232
5232
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -54,7 +54,7 @@ export declare const taskCard: v.StrictObjectSchema<{
|
|
|
54
54
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
55
55
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
56
56
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
57
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
57
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
58
58
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
59
59
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
60
60
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -69,7 +69,7 @@ export declare const taskCard: v.StrictObjectSchema<{
|
|
|
69
69
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
70
70
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
71
71
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
72
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
72
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
73
73
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
74
74
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
75
75
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -172,7 +172,7 @@ export declare const taskCreated: v.StrictObjectSchema<{
|
|
|
172
172
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
173
173
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
174
174
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
175
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
175
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
176
176
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
177
177
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
178
178
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -187,7 +187,7 @@ export declare const taskCreated: v.StrictObjectSchema<{
|
|
|
187
187
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
188
188
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
189
189
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
190
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
190
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
191
191
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
192
192
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
193
193
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -291,7 +291,7 @@ export declare const taskLinks: v.UnionSchema<[v.StrictObjectSchema<{
|
|
|
291
291
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
292
292
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
293
293
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
294
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
294
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
295
295
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
296
296
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
297
297
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -306,7 +306,7 @@ export declare const taskLinks: v.UnionSchema<[v.StrictObjectSchema<{
|
|
|
306
306
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
307
307
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
308
308
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
309
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
309
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
310
310
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
311
311
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
312
312
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -438,7 +438,7 @@ export declare const taskMerge: v.StrictObjectSchema<{
|
|
|
438
438
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
439
439
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
440
440
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
441
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
441
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
442
442
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
443
443
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
444
444
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -453,7 +453,7 @@ export declare const taskMerge: v.StrictObjectSchema<{
|
|
|
453
453
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
454
454
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
455
455
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
456
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
456
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
457
457
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
458
458
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
459
459
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -550,7 +550,7 @@ export declare const taskUnmerge: v.StrictObjectSchema<{
|
|
|
550
550
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
551
551
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
552
552
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
553
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
553
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
554
554
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
555
555
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
556
556
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -565,7 +565,7 @@ export declare const taskUnmerge: v.StrictObjectSchema<{
|
|
|
565
565
|
readonly to: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
|
|
566
566
|
readonly kind: v.PicklistSchema<readonly ["links-to", "blocked-by", "follow-up-of", "about", "member-of", "labelled", "answered-by", "evidence", "created-from", "duplicate-of", "related-to", "reports-to", "customer-of", "partner-of", "assigned-to", "attached"], undefined>;
|
|
567
567
|
readonly anchor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
568
|
-
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar"], undefined>;
|
|
568
|
+
readonly origin: v.PicklistSchema<readonly ["file", "owner", "suggested", "message", "calendar", "meeting"], undefined>;
|
|
569
569
|
readonly target_text: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
570
570
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
571
571
|
readonly purpose: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
package/dist/errors/reasons.js
CHANGED
|
@@ -87,6 +87,11 @@ const OTHERS = [
|
|
|
87
87
|
"the model answered nothing; given a picture, it may not read pictures — choose a vision model",
|
|
88
88
|
],
|
|
89
89
|
validation("model.address-refused", "the model address is refused: https, or plain http and Ollama only on this computer"),
|
|
90
|
+
[
|
|
91
|
+
"network.host-undeclared",
|
|
92
|
+
"configuration_error",
|
|
93
|
+
"the request went to a host the CLI does not declare, or not the model address's own; nothing was sent",
|
|
94
|
+
],
|
|
90
95
|
[
|
|
91
96
|
"local-only.refused",
|
|
92
97
|
"permission_error",
|
|
@@ -300,7 +305,7 @@ const OTHERS = [
|
|
|
300
305
|
validation("input.empty", "a hidden prompt got an empty answer three times"),
|
|
301
306
|
validation("input.required", "the command needs an answer and cannot ask for one"),
|
|
302
307
|
validation("input.too-large", "the input is over its size limit"),
|
|
303
|
-
["meeting-project.stale", "
|
|
308
|
+
["meeting-project.stale", "conflict", "the meeting's project changed meanwhile"],
|
|
304
309
|
validation("fact.not-accepted", "only an accepted fact can be revoked"),
|
|
305
310
|
validation("fact.owner-written", "the owner wrote this fact; it was never proposed, so it cannot be revoked"),
|
|
306
311
|
validation("fact.payment-retired", "a payment is a payments row in store.finance, not a fact"),
|
|
@@ -2,6 +2,6 @@ import type { Command } from "commander";
|
|
|
2
2
|
import { type CatalogueOptions } from "../mcp/agent.js";
|
|
3
3
|
/**
|
|
4
4
|
* The MCP catalogue of a CLI's own commands, by path, as `read` or `write`: what cli-core mounted is left out, since
|
|
5
|
-
* cli-core pins it. A CLI's contract test pins this and the few shared commands it changes on purpose.
|
|
5
|
+
* cli-core pins it. A generated command (a Bot API method) is the CLI's own, as `commands --json` marks it. A CLI's contract test pins this and the few shared commands it changes on purpose.
|
|
6
6
|
*/
|
|
7
7
|
export declare const ownCatalogue: (program: Command, options?: CatalogueOptions) => Record<string, "read" | "write">;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { describeProgram, hasSharedContract } from "@wirecat/cli-base/commands";
|
|
1
|
+
import { describeProgram, hasSharedContract, metaOf } from "@wirecat/cli-base/commands";
|
|
2
2
|
import { toolsFromCommands } from "../mcp/agent.js";
|
|
3
3
|
const sharedPaths = (command, parents = [], into = new Set()) => {
|
|
4
4
|
for (const child of command.commands) {
|
|
5
5
|
const path = [...parents, child.name()];
|
|
6
|
-
if (hasSharedContract(child))
|
|
6
|
+
if (hasSharedContract(child) && metaOf(child).origin !== "generated")
|
|
7
7
|
into.add(path.join(" "));
|
|
8
8
|
sharedPaths(child, path, into);
|
|
9
9
|
}
|
|
@@ -11,7 +11,7 @@ const sharedPaths = (command, parents = [], into = new Set()) => {
|
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* The MCP catalogue of a CLI's own commands, by path, as `read` or `write`: what cli-core mounted is left out, since
|
|
14
|
-
* cli-core pins it. A CLI's contract test pins this and the few shared commands it changes on purpose.
|
|
14
|
+
* cli-core pins it. A generated command (a Bot API method) is the CLI's own, as `commands --json` marks it. A CLI's contract test pins this and the few shared commands it changes on purpose.
|
|
15
15
|
*/
|
|
16
16
|
export const ownCatalogue = (program, options = {}) => {
|
|
17
17
|
const shared = sharedPaths(program);
|
package/dist/meetings/index.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export { aggregateMeetingCounts, aggregateMeetingStats, MEETING_COUNTS_GROUPINGS
|
|
|
55
55
|
export type { ChatInput, ContractCase, EventCandidateFilter, IdentityInput, MeetingDetails, MeetingFilter, MeetingHitSource, MeetingInput, MeetingParticipant, MeetingSave, MeetingStore, NewRecord, ParticipantInput, SearchHit, TranscriptInput, TranscriptLanguageFill, TranscriptRowInput, } from "./store.js";
|
|
56
56
|
export { READ_BUDGET_EXCEEDED } from "./store.js";
|
|
57
57
|
export { meetingTimestamp } from "./timestamp.js";
|
|
58
|
-
export type { MeetingTranscriptReceiptStore, MeetingTranscriptStore, TranscriptAppend, TranscriptAppendReceipt, UnlinkedTranscriptInput, } from "./transcript-store.js";
|
|
58
|
+
export type { MeetingTranscriptDocumentStore, MeetingTranscriptReceiptStore, MeetingTranscriptStore, TranscriptAppend, TranscriptAppendReceipt, UnlinkedTranscriptInput, } from "./transcript-store.js";
|
|
59
59
|
export { parseTranscriptText, TranscriptTextError, type TranscriptTextHeader } from "./transcript-text.js";
|
|
60
60
|
export { type MeetingMediaDescriptor, type MeetingRecognitionSegment, type MeetingTranscriptionContext, type MeetingTranscriptionOptions, type MeetingTranscriptionReceipt, type MeetingTranscriptionSource, transcribeMeeting, } from "./transcription.js";
|
|
61
61
|
export { createUpcomingMeetingReader } from "./upcoming.js";
|
package/dist/meetings/pull.js
CHANGED
|
@@ -38,6 +38,20 @@ export const pull = async (source, store, options) => {
|
|
|
38
38
|
let failed = false;
|
|
39
39
|
/** The start of the first meeting that failed: the cursor of a stopped pull goes no further. */
|
|
40
40
|
let firstFailed;
|
|
41
|
+
const callers = new Set();
|
|
42
|
+
const linkCallers = async () => {
|
|
43
|
+
if (callers.size === 0 || !store.linkCallers)
|
|
44
|
+
return;
|
|
45
|
+
try {
|
|
46
|
+
await store.linkCallers(source.provider, [...callers]);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
report.warnings.push({
|
|
50
|
+
externalId: source.provider,
|
|
51
|
+
message: `callers not linked to people: ${error instanceof Error ? error.message : "failed"}`,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
41
55
|
const from = timestamp(since) - lookbackMs;
|
|
42
56
|
// Oldest first, so a stopped pull leaves everything before its cursor done.
|
|
43
57
|
const meetings = (await source.meetings(lookbackMs === 0 ? since : new Date(from).toISOString())).toSorted((a, b) => startOf(a) - startOf(b));
|
|
@@ -49,6 +63,7 @@ export const pull = async (source, store, options) => {
|
|
|
49
63
|
const reached = Math.min(startOf(m), firstFailed ?? Number.POSITIVE_INFINITY);
|
|
50
64
|
if (Number.isFinite(reached) && reached > timestamp(since))
|
|
51
65
|
await store.setCursor(options.accountId, new Date(reached).toISOString(), now);
|
|
66
|
+
await linkCallers();
|
|
52
67
|
return report;
|
|
53
68
|
}
|
|
54
69
|
const id = m.occurrence.id;
|
|
@@ -159,6 +174,9 @@ export const pull = async (source, store, options) => {
|
|
|
159
174
|
now,
|
|
160
175
|
});
|
|
161
176
|
await linkEvent(store, details, now);
|
|
177
|
+
for (const p of participants)
|
|
178
|
+
if (p.identity.phone)
|
|
179
|
+
callers.add(p.identity.externalId);
|
|
162
180
|
report.meetings++;
|
|
163
181
|
report.participants += participants.length;
|
|
164
182
|
report.transcriptRows += lines?.length ?? 0;
|
|
@@ -169,6 +187,7 @@ export const pull = async (source, store, options) => {
|
|
|
169
187
|
report.warnings.push({ externalId: id, message: error instanceof Error ? error.message : "Meeting pull failed" });
|
|
170
188
|
}
|
|
171
189
|
}
|
|
190
|
+
await linkCallers();
|
|
172
191
|
// A failed occurrence must remain inside the next pull's retry window.
|
|
173
192
|
if (!failed)
|
|
174
193
|
await store.setCursor(options.accountId, new Date(now).toISOString(), now);
|
package/dist/meetings/store.d.ts
CHANGED
|
@@ -22,6 +22,11 @@ export interface TranscriptRowInput extends Omit<NewRecord<TranscriptRow>, "meet
|
|
|
22
22
|
}
|
|
23
23
|
export interface TranscriptInput extends Omit<NewRecord<Transcript>, "meetingId" | "supersededAt"> {
|
|
24
24
|
rows: TranscriptRowInput[];
|
|
25
|
+
/**
|
|
26
|
+
* The Drive file the meeting service saved this transcript as (Meet's `docsDestination.document`). Drive may import
|
|
27
|
+
* the same Google Doc, before or after; the store joins the two, so search shows the meeting once.
|
|
28
|
+
*/
|
|
29
|
+
driveFileId?: string;
|
|
25
30
|
}
|
|
26
31
|
export interface ChatInput extends Omit<NewRecord<ChatLine>, "meetingId" | "senderParticipantId"> {
|
|
27
32
|
senderParticipantPosition: number | null;
|
|
@@ -145,6 +150,8 @@ export interface MeetingStore {
|
|
|
145
150
|
reviewMeetingLink?(meetingId: number, eventIds: number[], now: number): Promise<void>;
|
|
146
151
|
cursor(accountId: number): Promise<string | null>;
|
|
147
152
|
setCursor(accountId: number, value: string, now: number): Promise<void>;
|
|
153
|
+
/** Links the callers a sync saved, by `provider` and identity external id, to the people with their number. */
|
|
154
|
+
linkCallers?(provider: string, externalIds: readonly string[]): Promise<void>;
|
|
148
155
|
/** Detects the language of the account's transcripts that have none; stores it only with `apply`. */
|
|
149
156
|
fillTranscriptLanguages?(input: {
|
|
150
157
|
accountId: number;
|
|
@@ -35,3 +35,7 @@ export interface TranscriptAppendReceipt {
|
|
|
35
35
|
export interface MeetingTranscriptReceiptStore {
|
|
36
36
|
appendTranscriptsWithReceipt(input: TranscriptAppend): Promise<TranscriptAppendReceipt>;
|
|
37
37
|
}
|
|
38
|
+
/** The meeting whose transcript a Drive document is, by the `driveFileId` the meeting's transcript named. */
|
|
39
|
+
export interface MeetingTranscriptDocumentStore {
|
|
40
|
+
transcriptMeetings(documentIds: readonly number[]): Promise<Map<number, number>>;
|
|
41
|
+
}
|
|
@@ -7,7 +7,7 @@ export declare const modelAddressAllowed: (value: string) => boolean;
|
|
|
7
7
|
export declare const PLAIN_HTTP_REFUSED = "this address is not allowed: use https, or http only on this computer";
|
|
8
8
|
/**
|
|
9
9
|
* `fetch` that reaches only the host of this model address, through `hostFetch`. The address was checked when it was
|
|
10
|
-
* saved; its host is the one the person configured. `[::1]`
|
|
11
|
-
*
|
|
10
|
+
* saved; its host is the one the person configured. `[::1]` cannot leave this computer, so it goes through the plain
|
|
11
|
+
* `fetch`; any other IPv6 literal through `literalFetch`.
|
|
12
12
|
*/
|
|
13
13
|
export declare const endpointFetch: (address: string, timeoutMs: number) => FetchLike;
|
package/dist/models/endpoint.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CliError, isCliError } from "@wirecat/cli-base";
|
|
1
2
|
import { hostFetch } from "@wirecat/cli-base/http";
|
|
2
3
|
export const endpoint = (value) => {
|
|
3
4
|
try {
|
|
@@ -21,12 +22,45 @@ export const onThisComputer = (value) => {
|
|
|
21
22
|
/** https anywhere; plain http only to this computer, so neither the text nor the key crosses a network unencrypted. */
|
|
22
23
|
export const modelAddressAllowed = (value) => endpoint(value) && (new URL(value).protocol === "https:" || onThisComputer(value));
|
|
23
24
|
export const PLAIN_HTTP_REFUSED = "this address is not allowed: use https, or http only on this computer";
|
|
25
|
+
/**
|
|
26
|
+
* `hostFetch`'s rules for an IPv6 literal, which it does not take as a host: only this host, a deadline, and no
|
|
27
|
+
* redirect followed, since a model API has none to give.
|
|
28
|
+
*/
|
|
29
|
+
const literalFetch = (hostname, timeoutMs) => async (input, init = {}) => {
|
|
30
|
+
const url = new URL(input instanceof Request ? input.url : String(input));
|
|
31
|
+
if (url.hostname !== hostname)
|
|
32
|
+
throw new CliError("configuration_error", `${url.hostname} is not the model address's host, ${hostname}`, {
|
|
33
|
+
reason: "network.host-undeclared",
|
|
34
|
+
sent: false,
|
|
35
|
+
});
|
|
36
|
+
const deadline = AbortSignal.timeout(timeoutMs);
|
|
37
|
+
const signal = init.signal ? AbortSignal.any([init.signal, deadline]) : deadline;
|
|
38
|
+
try {
|
|
39
|
+
const response = await fetch(input, { ...init, signal, redirect: "manual" });
|
|
40
|
+
if (response.status >= 300 && response.status < 400) {
|
|
41
|
+
void response.body?.cancel().catch(() => { });
|
|
42
|
+
throw new CliError("invalid_response", `${hostname} answered with a redirect, which is not followed`);
|
|
43
|
+
}
|
|
44
|
+
return response;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
if (isCliError(error))
|
|
48
|
+
throw error;
|
|
49
|
+
if (init.signal?.aborted)
|
|
50
|
+
throw new CliError("cancelled", "request cancelled");
|
|
51
|
+
if (deadline.aborted)
|
|
52
|
+
throw new CliError("timeout", `${hostname} did not answer within ${timeoutMs} ms`, { retryable: true });
|
|
53
|
+
throw new CliError("network_error", `${hostname} could not be reached`, { retryable: true });
|
|
54
|
+
}
|
|
55
|
+
};
|
|
24
56
|
/**
|
|
25
57
|
* `fetch` that reaches only the host of this model address, through `hostFetch`. The address was checked when it was
|
|
26
|
-
* saved; its host is the one the person configured. `[::1]`
|
|
27
|
-
*
|
|
58
|
+
* saved; its host is the one the person configured. `[::1]` cannot leave this computer, so it goes through the plain
|
|
59
|
+
* `fetch`; any other IPv6 literal through `literalFetch`.
|
|
28
60
|
*/
|
|
29
61
|
export const endpointFetch = (address, timeoutMs) => {
|
|
30
62
|
const { hostname } = new URL(address);
|
|
31
|
-
|
|
63
|
+
if (hostname === "[::1]")
|
|
64
|
+
return fetch;
|
|
65
|
+
return hostname.startsWith("[") ? literalFetch(hostname, timeoutMs) : hostFetch({ hosts: [hostname], timeoutMs });
|
|
32
66
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DocumentSource, SourceFile, SourceState, SourceWalk } from "../../documents/model.js";
|
|
2
|
+
import { type SourceQuery } from "../../documents/scope.js";
|
|
2
3
|
import type { SyncOptions } from "./ports.js";
|
|
3
|
-
export declare const scopeHash: (roots: string[]) => string;
|
|
4
|
+
export declare const scopeHash: (roots: string[], query?: Pick<SourceQuery, "key" | "mode">) => string;
|
|
4
5
|
export declare const changedSince: (previous: SourceFile, file: SourceFile) => boolean;
|
|
5
6
|
interface WalkStore<M extends SourceFile> {
|
|
6
7
|
read: (scope: string) => SourceWalk<M> | undefined;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { CliError } from "@wirecat/cli-base";
|
|
3
|
-
import { within } from "../../documents/scope.js";
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { inScope, within } from "../../documents/scope.js";
|
|
4
|
+
// Without a query the hash stays what it was, so a profile that never set one keeps its checkpoint.
|
|
5
|
+
export const scopeHash = (roots, query) => createHash("sha256")
|
|
6
|
+
.update(JSON.stringify(query ? [[...roots].sort(), query.mode, query.key] : [...roots].sort()))
|
|
6
7
|
.digest("hex");
|
|
7
8
|
export const changedSince = (previous, file) => previous.version !== file.version ||
|
|
8
9
|
previous.modifiedAt !== file.modifiedAt ||
|
|
@@ -11,10 +12,10 @@ export const changedSince = (previous, file) => previous.version !== file.versio
|
|
|
11
12
|
JSON.stringify(previous.parents) !== JSON.stringify(file.parents);
|
|
12
13
|
const SAVE_EVERY_MS = 2000;
|
|
13
14
|
export const planDocuments = async (options, source, state, roots, limit, pictures, abandoned = [], walks) => {
|
|
14
|
-
const { isFolder, skipReason, retryable, maxEntries: MAX_ENTRIES, errorOf } = options;
|
|
15
|
+
const { isFolder, skipReason, retryable, maxEntries: MAX_ENTRIES, errorOf, query } = options;
|
|
15
16
|
const tooManyEntries = () => options.limitError?.() ?? new CliError("validation_error", `selected folders exceed the ${MAX_ENTRIES} entry limit`);
|
|
16
|
-
const scope = scopeHash(roots);
|
|
17
|
-
if (!roots.length)
|
|
17
|
+
const scope = scopeHash(roots, query);
|
|
18
|
+
if (!roots.length && query?.mode !== "include")
|
|
18
19
|
return {
|
|
19
20
|
scope,
|
|
20
21
|
cursor: state.cursor ?? "",
|
|
@@ -23,7 +24,11 @@ export const planDocuments = async (options, source, state, roots, limit, pictur
|
|
|
23
24
|
jobs: [...new Set([...Object.keys(state.documents), ...abandoned])].map((id) => ({ id, kind: "remove" })),
|
|
24
25
|
};
|
|
25
26
|
if (!source)
|
|
26
|
-
throw new CliError("configuration_error", "selected folders require an authenticated source");
|
|
27
|
+
throw new CliError("configuration_error", "selected folders or a saved query require an authenticated source");
|
|
28
|
+
if (query?.mode === "include" && !query.list)
|
|
29
|
+
throw new CliError("configuration_error", "a query that includes files must list them");
|
|
30
|
+
// Listed before the walk: a failure here then costs no folder already walked.
|
|
31
|
+
const found = query?.mode === "include" && query.list ? await query.list() : [];
|
|
27
32
|
const initial = !state.cursor || scope !== state.scope;
|
|
28
33
|
const resumed = initial ? walks?.read(scope) : undefined;
|
|
29
34
|
const cursor = initial ? (resumed?.cursor ?? (await source.startToken())) : state.cursor;
|
|
@@ -160,13 +165,26 @@ export const planDocuments = async (options, source, state, roots, limit, pictur
|
|
|
160
165
|
if (!visited.has(folder.id) && within(folder, roots, folders))
|
|
161
166
|
await crawl(folder);
|
|
162
167
|
}
|
|
168
|
+
const matched = new Set();
|
|
169
|
+
for (const file of found) {
|
|
170
|
+
if (isFolder(file) || file.trashed || !query?.matches(file) || matched.has(file.id))
|
|
171
|
+
continue;
|
|
172
|
+
if (!files.has(file.id) && ++discovered > MAX_ENTRIES)
|
|
173
|
+
throw tooManyEntries();
|
|
174
|
+
// Listed again on every sync, so only a new or changed file is work; a skipped one keeps its skip.
|
|
175
|
+
const prior = state.documents[file.id]?.metadata ?? state.skipped.find((item) => item.id === file.id)?.file;
|
|
176
|
+
if (initial || !prior || changedSince(prior, file))
|
|
177
|
+
changed.add(file.id);
|
|
178
|
+
files.set(file.id, file);
|
|
179
|
+
matched.add(file.id);
|
|
180
|
+
}
|
|
163
181
|
const jobs = [];
|
|
164
182
|
const skipped = [];
|
|
165
183
|
for (const root of roots)
|
|
166
184
|
if (folders[root]?.trashed)
|
|
167
185
|
skipped.push({ id: root, reason: "selected folder is unavailable" });
|
|
168
186
|
for (const [id, file] of files) {
|
|
169
|
-
if (!
|
|
187
|
+
if (!inScope(file, roots, folders, matched, query))
|
|
170
188
|
continue;
|
|
171
189
|
const previousSkip = state.skipped.find((item) => item.id === id);
|
|
172
190
|
const reason = skipReason(file);
|
|
@@ -190,10 +208,17 @@ export const planDocuments = async (options, source, state, roots, limit, pictur
|
|
|
190
208
|
}
|
|
191
209
|
for (const id of new Set([...Object.keys(state.documents), ...abandoned])) {
|
|
192
210
|
const file = files.get(id);
|
|
193
|
-
if (!file || !
|
|
211
|
+
if (!file || !inScope(file, roots, folders, matched, query))
|
|
194
212
|
jobs.push({ id, kind: "remove" });
|
|
195
213
|
}
|
|
196
214
|
// Only retain metadata for selected ancestry; the account-wide feed includes unrelated folders.
|
|
197
215
|
const scopedFolders = Object.fromEntries(Object.entries(folders).filter(([, file]) => within(file, roots, folders) || roots.includes(file.id)));
|
|
198
|
-
return {
|
|
216
|
+
return {
|
|
217
|
+
scope,
|
|
218
|
+
cursor: finalCursor,
|
|
219
|
+
folders: scopedFolders,
|
|
220
|
+
jobs,
|
|
221
|
+
skipped,
|
|
222
|
+
...(query?.mode === "include" ? { matched: [...matched] } : {}),
|
|
223
|
+
};
|
|
199
224
|
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { CliError } from "@wirecat/cli-base";
|
|
2
2
|
import type { DocumentSource, SourceFile, SourceIndex, SourceSkip, SourceStatePort } from "../../documents/model.js";
|
|
3
|
+
import type { SourceQuery } from "../../documents/scope.js";
|
|
3
4
|
export interface SyncOptions<M extends SourceFile> {
|
|
4
5
|
source: DocumentSource<M> | undefined;
|
|
5
6
|
index: SourceIndex<M>;
|
|
6
7
|
state: SourceStatePort<M>;
|
|
7
8
|
principal: string;
|
|
8
9
|
roots: string[];
|
|
10
|
+
query?: SourceQuery<M>;
|
|
9
11
|
textLimit: number;
|
|
10
12
|
max: number;
|
|
11
13
|
maxEntries: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { CliError, isCliError } from "@wirecat/cli-base";
|
|
3
3
|
import { catalogFiles } from "../../documents/catalog.js";
|
|
4
|
-
import {
|
|
4
|
+
import { inScope } from "../../documents/scope.js";
|
|
5
5
|
import { changedSince, planDocuments, scopeHash } from "./plan.js";
|
|
6
6
|
const MAX_PICTURE_BYTES = 25 * 1024 * 1024;
|
|
7
7
|
const SAVE_EVERY_MS = 2000;
|
|
@@ -9,7 +9,7 @@ const SAVE_EVERY_ITEMS = 25;
|
|
|
9
9
|
const isPicture = (file) => file.mime.startsWith("image/") && file.canDownload;
|
|
10
10
|
const hashText = (text) => createHash("sha256").update(text).digest("hex");
|
|
11
11
|
export const syncDocuments = async (options) => {
|
|
12
|
-
const { source, index, state: statePort, principal, roots, textLimit: limit, max, signal, rescan = false, pictures = false, assertHeld, errorOf, skipReason, storeVersion: VERSION, } = options;
|
|
12
|
+
const { source, index, state: statePort, principal, roots, textLimit: limit, max, signal, rescan = false, pictures = false, assertHeld, errorOf, skipReason, storeVersion: VERSION, query, } = options;
|
|
13
13
|
if (![max, limit, options.maxEntries].every((value) => Number.isSafeInteger(value) && value > 0))
|
|
14
14
|
throw new CliError("validation_error", "sync limits must be positive whole numbers");
|
|
15
15
|
const profile = { principal, roots, picture_search: pictures };
|
|
@@ -25,20 +25,25 @@ export const syncDocuments = async (options) => {
|
|
|
25
25
|
pending: 0,
|
|
26
26
|
skipped: [],
|
|
27
27
|
errors: [],
|
|
28
|
-
coverage:
|
|
28
|
+
coverage: query?.mode === "include"
|
|
29
|
+
? "selected folders and the files a saved query finds; unsupported files are reported"
|
|
30
|
+
: query?.mode === "exclude"
|
|
31
|
+
? "selected folders only, without the files a saved query keeps out; unsupported files are reported"
|
|
32
|
+
: "selected folders only; unsupported files are reported",
|
|
29
33
|
...(profile.picture_search ? { pictures: 0 } : {}),
|
|
30
34
|
};
|
|
31
35
|
let writer;
|
|
32
36
|
let flush;
|
|
33
37
|
try {
|
|
34
|
-
if (profile.roots.length
|
|
38
|
+
if ((profile.roots.length || query?.mode === "include") &&
|
|
39
|
+
(!source || (await source.identity()) !== profile.principal))
|
|
35
40
|
throw new CliError("authentication_error", "signed-in source account does not match this profile", {
|
|
36
41
|
reason: "profile.wrong-account",
|
|
37
42
|
});
|
|
38
43
|
const state = statePort.read();
|
|
39
44
|
if (state.principal !== principal)
|
|
40
45
|
throw new CliError("configuration_error", "sync state belongs to another source account");
|
|
41
|
-
const currentScope = scopeHash(profile.roots);
|
|
46
|
+
const currentScope = scopeHash(profile.roots, query);
|
|
42
47
|
const abandoned = state.pending && (state.pending.scope !== currentScope || rescan) ? state.pending.jobs.map((job) => job.id) : [];
|
|
43
48
|
if (state.pending?.scope !== currentScope || rescan)
|
|
44
49
|
delete state.pending;
|
|
@@ -59,7 +64,7 @@ export const syncDocuments = async (options) => {
|
|
|
59
64
|
if (!pending)
|
|
60
65
|
throw new CliError("invalid_response", "could not prepare a sync batch");
|
|
61
66
|
if (index.catalog)
|
|
62
|
-
await index.catalog.import(profile.principal, catalogFiles(state, profile.roots));
|
|
67
|
+
await index.catalog.import(profile.principal, catalogFiles(state, profile.roots, query));
|
|
63
68
|
result.skipped = state.skipped.map(({ id, reason }) => ({ id, reason }));
|
|
64
69
|
const saveNamesOnly = async (file, reason) => {
|
|
65
70
|
const doc = { metadata: file, markdown: "", text: "", tabs: [], notRead: reason };
|
|
@@ -140,7 +145,8 @@ export const syncDocuments = async (options) => {
|
|
|
140
145
|
if (!source)
|
|
141
146
|
throw new CliError("configuration_error", "a pending save requires source sign-in");
|
|
142
147
|
const content = await source.content(job.id, limit);
|
|
143
|
-
|
|
148
|
+
const listed = query?.mode === "include" && (pending.matched?.includes(job.id) ?? query.matches(content.metadata));
|
|
149
|
+
if (!listed && !inScope(content.metadata, profile.roots, pending.folders, new Set(), query)) {
|
|
144
150
|
await index.remove(profile.principal, job.id);
|
|
145
151
|
statePort.removeSnapshot(job.id);
|
|
146
152
|
delete state.documents[job.id];
|
|
@@ -203,6 +209,10 @@ export const syncDocuments = async (options) => {
|
|
|
203
209
|
state.cursor = pending.cursor;
|
|
204
210
|
state.scope = pending.scope;
|
|
205
211
|
state.folders = pending.folders;
|
|
212
|
+
if (pending.matched)
|
|
213
|
+
state.matched = pending.matched;
|
|
214
|
+
else
|
|
215
|
+
delete state.matched;
|
|
206
216
|
delete state.pending;
|
|
207
217
|
state.lastSync = new Date(now()).toISOString();
|
|
208
218
|
statePort.save(state);
|
|
@@ -14,12 +14,12 @@ export declare const metadataService: (deps: ServiceDeps) => {
|
|
|
14
14
|
dryRun?: boolean;
|
|
15
15
|
}) => Promise<{
|
|
16
16
|
items: ({
|
|
17
|
+
error?: undefined;
|
|
17
18
|
chatId: string;
|
|
18
19
|
tags: import("../domain/channel-tags.js").ChannelTagMatch[];
|
|
19
20
|
algorithm: string;
|
|
20
21
|
fetchedAt: string | null;
|
|
21
22
|
source: string;
|
|
22
|
-
error?: undefined;
|
|
23
23
|
} | {
|
|
24
24
|
tags?: undefined;
|
|
25
25
|
algorithm?: undefined;
|