@phosphorco/bb-cross-references 0.1.0 → 0.3.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.
@@ -1,4 +1,4 @@
1
- import type { BbPluginApi } from "@get-bb/plugin-sdk";
1
+ import type { BbPluginApi, StandardSchemaV1 } from "@get-bb/plugin-sdk";
2
2
  import type { PluginBrowserBbSdk } from "@get-bb/plugin-sdk/app";
3
3
  import { CROSS_REFERENCES_PROTOCOL, type ApplyProjectionInput, type ApplyProjectionResponse, type GetProjectionInput, type GetProjectionResponse, type ListBacklinksInput, type ListBacklinksResponse, type ListForwardReferencesInput, type ListForwardReferencesResponse, type CheckForwardReferencesInput, type ForwardReferenceStatus } from "./index.js";
4
4
  export type CrossReferencesSdk = Pick<BbPluginApi["sdk"], "plugins"> | Pick<PluginBrowserBbSdk, "plugins">;
@@ -27,3 +27,511 @@ export interface CrossReferencesClientOptions {
27
27
  }
28
28
  /** Explicit target, no hooks, storage, scheduling, retry or singleton. */
29
29
  export declare function createCrossReferencesClient(sdk: CrossReferencesSdk, targetPluginId?: string, options?: CrossReferencesClientOptions): CrossReferencesClient;
30
+ /** V2 never negotiates down to strict V1 reads or legacy missing-describe. */
31
+ export interface CrossReferencesV2Client {
32
+ readonly pluginId: string;
33
+ describe(signal?: AbortSignal): Promise<{
34
+ protocol: typeof CROSS_REFERENCES_PROTOCOL;
35
+ version: 2;
36
+ }>;
37
+ listMentions(input: import('./evidence-v2.js').ListMentionsInputV2, signal?: AbortSignal): Promise<import('./evidence-v2.js').ListMentionsOutputV2>;
38
+ resolveLookup(input: import('./evidence-v2.js').ResolveLookupInputV2, signal?: AbortSignal): Promise<import('./evidence-v2.js').ResolveLookupOutputV2>;
39
+ }
40
+ export declare function createCrossReferencesV2Client(sdk: CrossReferencesSdk, targetPluginId?: string, options?: CrossReferencesClientOptions): CrossReferencesV2Client;
41
+ export declare const crossReferencesV2RpcContract: {
42
+ readonly crossReferencesV2ListMentions: {
43
+ readonly input: StandardSchemaV1<{
44
+ version: 2;
45
+ query: {
46
+ kind: "resource";
47
+ target: {
48
+ provider: string;
49
+ keys: Record<string, string>;
50
+ };
51
+ relation: "self" | "github-pr-family";
52
+ } | {
53
+ kind: "authored-url";
54
+ href: string;
55
+ };
56
+ source?: {
57
+ provider: string;
58
+ keys: Record<string, string>;
59
+ } | undefined;
60
+ producerPluginId?: string | undefined;
61
+ pageSize?: number | undefined;
62
+ cursor?: string | undefined;
63
+ ifSnapshot?: string | undefined;
64
+ }, {
65
+ version: 2;
66
+ query: {
67
+ kind: "resource";
68
+ target: {
69
+ provider: string;
70
+ keys: Record<string, string>;
71
+ };
72
+ relation: "self" | "github-pr-family";
73
+ } | {
74
+ kind: "authored-url";
75
+ href: string;
76
+ };
77
+ source?: {
78
+ provider: string;
79
+ keys: Record<string, string>;
80
+ } | undefined;
81
+ producerPluginId?: string | undefined;
82
+ pageSize?: number | undefined;
83
+ cursor?: string | undefined;
84
+ ifSnapshot?: string | undefined;
85
+ }>;
86
+ readonly output: StandardSchemaV1<{
87
+ [x: string]: unknown;
88
+ version: 2;
89
+ status: "page";
90
+ snapshot: string;
91
+ items: unknown[];
92
+ counts: {
93
+ [x: string]: unknown;
94
+ retainedOccurrences: number;
95
+ confirmedOccurrences: number;
96
+ unconfirmedOccurrences: number;
97
+ producerClaims: number;
98
+ indexedSources: number;
99
+ claimsWithoutLocations: number;
100
+ excerptUnavailable: number;
101
+ };
102
+ coverage: {
103
+ [x: string]: unknown;
104
+ scope: "known-sources";
105
+ collectionIncomplete: boolean;
106
+ retentionLimited: boolean;
107
+ capHistoryUnknown: boolean;
108
+ legacyClaimsPresent: boolean;
109
+ evidenceStateUnknown: boolean;
110
+ authoredUrlCoverage: {
111
+ [x: string]: unknown;
112
+ state: "complete-for-known-locations" | "partial";
113
+ unknownLocations: number;
114
+ scope: "known-locations";
115
+ watermark: string;
116
+ };
117
+ reasons: string[];
118
+ reasonsClipped: boolean;
119
+ checkedAt: number | null;
120
+ };
121
+ nextCursor: string | null;
122
+ } | {
123
+ [x: string]: unknown;
124
+ version: 2;
125
+ status: "not-modified";
126
+ snapshot: string;
127
+ coverage: {
128
+ [x: string]: unknown;
129
+ scope: "known-sources";
130
+ collectionIncomplete: boolean;
131
+ retentionLimited: boolean;
132
+ capHistoryUnknown: boolean;
133
+ legacyClaimsPresent: boolean;
134
+ evidenceStateUnknown: boolean;
135
+ authoredUrlCoverage: {
136
+ [x: string]: unknown;
137
+ state: "complete-for-known-locations" | "partial";
138
+ unknownLocations: number;
139
+ scope: "known-locations";
140
+ watermark: string;
141
+ };
142
+ reasons: string[];
143
+ reasonsClipped: boolean;
144
+ checkedAt: number | null;
145
+ };
146
+ } | {
147
+ [x: string]: unknown;
148
+ version: 2;
149
+ status: "restart";
150
+ reason: "snapshot-changed";
151
+ snapshot: string;
152
+ } | {
153
+ [x: string]: unknown;
154
+ version: 2;
155
+ status: "unavailable";
156
+ reason: "index-warming" | "read-budget";
157
+ retryable: boolean;
158
+ }, {
159
+ [x: string]: unknown;
160
+ version: 2;
161
+ status: "page";
162
+ snapshot: string;
163
+ items: ({
164
+ [x: string]: unknown;
165
+ kind: "occurrence";
166
+ evidenceRevision: number;
167
+ occurrenceKey: string;
168
+ locator: {
169
+ [x: string]: unknown;
170
+ kind: "conversation";
171
+ threadId: string;
172
+ messageId: string;
173
+ messageSeq: number;
174
+ anchorSeq: number | null;
175
+ role: "user" | "assistant";
176
+ };
177
+ sourceContentRevision: string;
178
+ span: {
179
+ [x: string]: unknown;
180
+ start: number;
181
+ end: number;
182
+ };
183
+ excerpt: {
184
+ [x: string]: unknown;
185
+ state: "ready";
186
+ text: string;
187
+ sourceSpan: {
188
+ [x: string]: unknown;
189
+ start: number;
190
+ end: number;
191
+ };
192
+ matchSpan: {
193
+ [x: string]: unknown;
194
+ start: number;
195
+ end: number;
196
+ };
197
+ clippedBefore: boolean;
198
+ clippedAfter: boolean;
199
+ matchClippedBefore: boolean;
200
+ matchClippedAfter: boolean;
201
+ codecVersion: 1;
202
+ } | {
203
+ [x: string]: unknown;
204
+ state: "unavailable";
205
+ reason: "not-materialized" | "indivisible-word" | "no-eligible-context";
206
+ codecVersion: 1;
207
+ };
208
+ messageCreatedAt: number;
209
+ observedAt: number;
210
+ confirmation: "observed" | "retained-unconfirmed";
211
+ provenance: {
212
+ [x: string]: unknown;
213
+ pluginId: string;
214
+ origin: "builtin" | "contributed";
215
+ confidence: "high" | "medium" | "low";
216
+ recognition: {
217
+ [x: string]: unknown;
218
+ basis: "explicit" | "text-url" | "existing-link" | "git-remote" | "context";
219
+ explanation: string;
220
+ evidence?: {
221
+ [x: string]: unknown;
222
+ span?: {
223
+ [x: string]: unknown;
224
+ start: number;
225
+ end: number;
226
+ } | undefined;
227
+ link?: number | undefined;
228
+ remote?: string | undefined;
229
+ } | undefined;
230
+ };
231
+ source: {
232
+ [x: string]: unknown;
233
+ provider: string;
234
+ id: string;
235
+ kind?: string | undefined;
236
+ };
237
+ authoredHref?: string | undefined;
238
+ verifiedFile?: {
239
+ [x: string]: unknown;
240
+ kind: "workspace";
241
+ environmentId: string;
242
+ path: string;
243
+ } | {
244
+ [x: string]: unknown;
245
+ kind: "thread-storage";
246
+ threadId: string;
247
+ path: string;
248
+ } | undefined;
249
+ };
250
+ authoredUrlState: "unknown" | "exact" | "not-url";
251
+ source: {
252
+ [x: string]: unknown;
253
+ presentation: {
254
+ [x: string]: unknown;
255
+ label: string;
256
+ url?: string | undefined;
257
+ detail?: string | undefined;
258
+ };
259
+ provider: string;
260
+ keys: Record<string, string>;
261
+ };
262
+ target: {
263
+ [x: string]: unknown;
264
+ presentation: {
265
+ [x: string]: unknown;
266
+ label: string;
267
+ url?: string | undefined;
268
+ detail?: string | undefined;
269
+ };
270
+ provider: string;
271
+ keys: Record<string, string>;
272
+ };
273
+ producerPluginId: string;
274
+ graphRevision: number;
275
+ cap: {
276
+ [x: string]: unknown;
277
+ state: "unknown" | "uncapped" | "capped";
278
+ limit: 100 | null;
279
+ sourceHistoryUnknown: boolean | null;
280
+ };
281
+ } | {
282
+ [x: string]: unknown;
283
+ kind: "claim-without-evidence";
284
+ reason: "legacy" | "producer-no-evidence" | "not-yet-collected";
285
+ matchBasis: "primary-resource" | "primary-url-identity";
286
+ source: {
287
+ [x: string]: unknown;
288
+ presentation: {
289
+ [x: string]: unknown;
290
+ label: string;
291
+ url?: string | undefined;
292
+ detail?: string | undefined;
293
+ };
294
+ provider: string;
295
+ keys: Record<string, string>;
296
+ };
297
+ target: {
298
+ [x: string]: unknown;
299
+ presentation: {
300
+ [x: string]: unknown;
301
+ label: string;
302
+ url?: string | undefined;
303
+ detail?: string | undefined;
304
+ };
305
+ provider: string;
306
+ keys: Record<string, string>;
307
+ };
308
+ producerPluginId: string;
309
+ graphRevision: number;
310
+ cap: {
311
+ [x: string]: unknown;
312
+ state: "unknown" | "uncapped" | "capped";
313
+ limit: 100 | null;
314
+ sourceHistoryUnknown: boolean | null;
315
+ };
316
+ } | {
317
+ [x: string]: unknown;
318
+ kind: "unsupported";
319
+ reason: "unsupported-format";
320
+ source: {
321
+ [x: string]: unknown;
322
+ presentation: {
323
+ [x: string]: unknown;
324
+ label: string;
325
+ url?: string | undefined;
326
+ detail?: string | undefined;
327
+ };
328
+ provider: string;
329
+ keys: Record<string, string>;
330
+ };
331
+ target: {
332
+ [x: string]: unknown;
333
+ presentation: {
334
+ [x: string]: unknown;
335
+ label: string;
336
+ url?: string | undefined;
337
+ detail?: string | undefined;
338
+ };
339
+ provider: string;
340
+ keys: Record<string, string>;
341
+ };
342
+ producerPluginId: string;
343
+ graphRevision: number;
344
+ cap: {
345
+ [x: string]: unknown;
346
+ state: "unknown" | "uncapped" | "capped";
347
+ limit: 100 | null;
348
+ sourceHistoryUnknown: boolean | null;
349
+ };
350
+ })[];
351
+ counts: {
352
+ [x: string]: unknown;
353
+ retainedOccurrences: number;
354
+ confirmedOccurrences: number;
355
+ unconfirmedOccurrences: number;
356
+ producerClaims: number;
357
+ indexedSources: number;
358
+ claimsWithoutLocations: number;
359
+ excerptUnavailable: number;
360
+ };
361
+ coverage: {
362
+ [x: string]: unknown;
363
+ scope: "known-sources";
364
+ collectionIncomplete: boolean;
365
+ retentionLimited: boolean;
366
+ capHistoryUnknown: boolean;
367
+ legacyClaimsPresent: boolean;
368
+ evidenceStateUnknown: boolean;
369
+ authoredUrlCoverage: {
370
+ [x: string]: unknown;
371
+ state: "complete-for-known-locations" | "partial";
372
+ unknownLocations: number;
373
+ scope: "known-locations";
374
+ watermark: string;
375
+ };
376
+ reasons: string[];
377
+ reasonsClipped: boolean;
378
+ checkedAt: number | null;
379
+ };
380
+ nextCursor: string | null;
381
+ } | {
382
+ [x: string]: unknown;
383
+ version: 2;
384
+ status: "not-modified";
385
+ snapshot: string;
386
+ coverage: {
387
+ [x: string]: unknown;
388
+ scope: "known-sources";
389
+ collectionIncomplete: boolean;
390
+ retentionLimited: boolean;
391
+ capHistoryUnknown: boolean;
392
+ legacyClaimsPresent: boolean;
393
+ evidenceStateUnknown: boolean;
394
+ authoredUrlCoverage: {
395
+ [x: string]: unknown;
396
+ state: "complete-for-known-locations" | "partial";
397
+ unknownLocations: number;
398
+ scope: "known-locations";
399
+ watermark: string;
400
+ };
401
+ reasons: string[];
402
+ reasonsClipped: boolean;
403
+ checkedAt: number | null;
404
+ };
405
+ } | {
406
+ [x: string]: unknown;
407
+ version: 2;
408
+ status: "restart";
409
+ reason: "snapshot-changed";
410
+ snapshot: string;
411
+ } | {
412
+ [x: string]: unknown;
413
+ version: 2;
414
+ status: "unavailable";
415
+ reason: "index-warming" | "read-budget";
416
+ retryable: boolean;
417
+ }>;
418
+ };
419
+ readonly crossReferencesV2ResolveLookup: {
420
+ readonly input: StandardSchemaV1<{
421
+ version: 2;
422
+ text: string;
423
+ mode: "recognize" | "exact-url";
424
+ context?: {
425
+ projectId?: string | undefined;
426
+ threadId?: string | undefined;
427
+ environmentId?: string | undefined;
428
+ git?: {
429
+ remotes: {
430
+ name: string;
431
+ url: string;
432
+ }[];
433
+ branch?: string | undefined;
434
+ upstream?: {
435
+ remote: string;
436
+ branch: string;
437
+ } | undefined;
438
+ } | undefined;
439
+ locale?: string | undefined;
440
+ timeZone?: string | undefined;
441
+ links?: {
442
+ href: string;
443
+ }[] | undefined;
444
+ } | undefined;
445
+ }, {
446
+ version: 2;
447
+ text: string;
448
+ mode: "recognize" | "exact-url";
449
+ context?: {
450
+ projectId?: string | undefined;
451
+ threadId?: string | undefined;
452
+ environmentId?: string | undefined;
453
+ git?: {
454
+ remotes: {
455
+ name: string;
456
+ url: string;
457
+ }[];
458
+ branch?: string | undefined;
459
+ upstream?: {
460
+ remote: string;
461
+ branch: string;
462
+ } | undefined;
463
+ } | undefined;
464
+ locale?: string | undefined;
465
+ timeZone?: string | undefined;
466
+ links?: {
467
+ href: string;
468
+ }[] | undefined;
469
+ } | undefined;
470
+ }>;
471
+ readonly output: StandardSchemaV1<{
472
+ [x: string]: unknown;
473
+ version: 2;
474
+ state: "ready" | "ambiguous" | "unrecognized" | "incomplete";
475
+ options: {
476
+ [x: string]: unknown;
477
+ query: {
478
+ [x: string]: unknown;
479
+ kind: "resource";
480
+ target: {
481
+ [x: string]: unknown;
482
+ provider: string;
483
+ keys: Record<string, string>;
484
+ };
485
+ relation: "self" | "github-pr-family";
486
+ } | {
487
+ [x: string]: unknown;
488
+ kind: "authored-url";
489
+ href: string;
490
+ };
491
+ label: string;
492
+ inputSpan: {
493
+ [x: string]: unknown;
494
+ start: number;
495
+ end: number;
496
+ };
497
+ basis: "supplier" | "native" | "stored-codec";
498
+ reasons: string[];
499
+ }[];
500
+ reasons: string[];
501
+ }, {
502
+ [x: string]: unknown;
503
+ version: 2;
504
+ state: "ready" | "ambiguous" | "unrecognized" | "incomplete";
505
+ options: {
506
+ [x: string]: unknown;
507
+ query: {
508
+ [x: string]: unknown;
509
+ kind: "resource";
510
+ target: {
511
+ [x: string]: unknown;
512
+ provider: string;
513
+ keys: Record<string, string>;
514
+ };
515
+ relation: "self" | "github-pr-family";
516
+ } | {
517
+ [x: string]: unknown;
518
+ kind: "authored-url";
519
+ href: string;
520
+ };
521
+ label: string;
522
+ inputSpan: {
523
+ [x: string]: unknown;
524
+ start: number;
525
+ end: number;
526
+ };
527
+ basis: "supplier" | "native" | "stored-codec";
528
+ reasons: string[];
529
+ }[];
530
+ reasons: string[];
531
+ }>;
532
+ };
533
+ };
534
+ export declare function registerCrossReferencesV2(bb: Pick<BbPluginApi, 'rpc'>, handlers: {
535
+ crossReferencesV2ListMentions: (input: import('./evidence-v2.js').ListMentionsInputV2) => import('./evidence-v2.js').ListMentionsOutputV2 | Promise<import('./evidence-v2.js').ListMentionsOutputV2>;
536
+ crossReferencesV2ResolveLookup: (input: import('./evidence-v2.js').ResolveLookupInputV2) => import('./evidence-v2.js').ResolveLookupOutputV2 | Promise<import('./evidence-v2.js').ResolveLookupOutputV2>;
537
+ }): void;