@mrclrchtr/supi-code-runtime 7.4.0 → 8.0.1
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/package.json +1 -1
- package/src/api.ts +1 -1
- package/src/query-result.ts +22 -4
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -14,7 +14,7 @@ export type {
|
|
|
14
14
|
StructuralProvider,
|
|
15
15
|
StructuralResult,
|
|
16
16
|
} from "./capability/types.ts";
|
|
17
|
-
export type { CodeQueryResult } from "./query-result.ts";
|
|
17
|
+
export type { CodeQueryPartialMetadata, CodeQueryResult } from "./query-result.ts";
|
|
18
18
|
// Shared query-result constructors and contract
|
|
19
19
|
export {
|
|
20
20
|
completedCodeQuery,
|
package/src/query-result.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/** Structured metadata for a partial query result. */
|
|
2
|
+
export interface CodeQueryPartialMetadata {
|
|
3
|
+
/** Automatic path-policy evidence removed from a collected result. */
|
|
4
|
+
readonly automaticPathExclusion?: {
|
|
5
|
+
readonly excludedCount: number;
|
|
6
|
+
readonly examples: readonly string[];
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
1
10
|
/**
|
|
2
11
|
* Result of a read-only code-provider query.
|
|
3
12
|
*
|
|
@@ -8,7 +17,12 @@
|
|
|
8
17
|
*/
|
|
9
18
|
export type CodeQueryResult<T> =
|
|
10
19
|
| { readonly kind: "completed"; readonly data: T }
|
|
11
|
-
| {
|
|
20
|
+
| {
|
|
21
|
+
readonly kind: "partial";
|
|
22
|
+
readonly data: T;
|
|
23
|
+
readonly reason: string;
|
|
24
|
+
readonly metadata?: CodeQueryPartialMetadata;
|
|
25
|
+
}
|
|
12
26
|
| { readonly kind: "unavailable"; readonly reason: string };
|
|
13
27
|
|
|
14
28
|
/** Construct a successfully completed code-query result, including empty data. */
|
|
@@ -17,8 +31,12 @@ export function completedCodeQuery<T>(data: T): CodeQueryResult<T> {
|
|
|
17
31
|
}
|
|
18
32
|
|
|
19
33
|
/** Construct a usable but incomplete code-query result. */
|
|
20
|
-
export function partialCodeQuery<T>(
|
|
21
|
-
|
|
34
|
+
export function partialCodeQuery<T>(
|
|
35
|
+
data: T,
|
|
36
|
+
reason: string,
|
|
37
|
+
metadata?: CodeQueryPartialMetadata,
|
|
38
|
+
): CodeQueryResult<T> {
|
|
39
|
+
return { kind: "partial", data, reason, ...(metadata ? { metadata } : {}) };
|
|
22
40
|
}
|
|
23
41
|
|
|
24
42
|
/** Construct a code-query result that could not be established. */
|
|
@@ -35,7 +53,7 @@ export function mapCodeQueryResult<T, U>(
|
|
|
35
53
|
case "completed":
|
|
36
54
|
return completedCodeQuery(map(result.data));
|
|
37
55
|
case "partial":
|
|
38
|
-
return partialCodeQuery(map(result.data), result.reason);
|
|
56
|
+
return partialCodeQuery(map(result.data), result.reason, result.metadata);
|
|
39
57
|
case "unavailable":
|
|
40
58
|
return unavailableCodeQuery(result.reason);
|
|
41
59
|
}
|