scoutline 0.1.0 → 0.6.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/README.md +394 -7
- package/bin/scoutline.js +36 -15
- package/dist/capabilities/diagnostics.d.ts +135 -0
- package/dist/capabilities/diagnostics.d.ts.map +1 -0
- package/dist/capabilities/diagnostics.js +139 -0
- package/dist/capabilities/diagnostics.js.map +1 -0
- package/dist/capabilities/quota.d.ts +99 -0
- package/dist/capabilities/quota.d.ts.map +1 -0
- package/dist/capabilities/quota.js +129 -0
- package/dist/capabilities/quota.js.map +1 -0
- package/dist/capabilities/reader.d.ts +227 -0
- package/dist/capabilities/reader.d.ts.map +1 -0
- package/dist/capabilities/reader.js +100 -0
- package/dist/capabilities/reader.js.map +1 -0
- package/dist/capabilities/repository.d.ts +221 -0
- package/dist/capabilities/repository.d.ts.map +1 -0
- package/dist/capabilities/repository.js +172 -0
- package/dist/capabilities/repository.js.map +1 -0
- package/dist/capabilities/search.d.ts +110 -0
- package/dist/capabilities/search.d.ts.map +1 -0
- package/dist/capabilities/search.js +21 -0
- package/dist/capabilities/search.js.map +1 -0
- package/dist/capabilities/vision.d.ts +156 -0
- package/dist/capabilities/vision.d.ts.map +1 -0
- package/dist/capabilities/vision.js +111 -0
- package/dist/capabilities/vision.js.map +1 -0
- package/dist/command-invocation.d.ts +58 -0
- package/dist/command-invocation.d.ts.map +1 -0
- package/dist/command-invocation.js +95 -0
- package/dist/command-invocation.js.map +1 -0
- package/dist/commands/cache.d.ts +106 -0
- package/dist/commands/cache.d.ts.map +1 -0
- package/dist/commands/cache.js +203 -0
- package/dist/commands/cache.js.map +1 -0
- package/dist/commands/code.d.ts +11 -4
- package/dist/commands/code.d.ts.map +1 -1
- package/dist/commands/code.js +16 -42
- package/dist/commands/code.js.map +1 -1
- package/dist/commands/doctor.d.ts +69 -3
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +179 -52
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/quota.d.ts +45 -3
- package/dist/commands/quota.d.ts.map +1 -1
- package/dist/commands/quota.js +116 -60
- package/dist/commands/quota.js.map +1 -1
- package/dist/commands/read.d.ts +76 -2
- package/dist/commands/read.d.ts.map +1 -1
- package/dist/commands/read.js +260 -121
- package/dist/commands/read.js.map +1 -1
- package/dist/commands/repo.d.ts +55 -4
- package/dist/commands/repo.d.ts.map +1 -1
- package/dist/commands/repo.js +115 -172
- package/dist/commands/repo.js.map +1 -1
- package/dist/commands/repository-explorer.d.ts +147 -0
- package/dist/commands/repository-explorer.d.ts.map +1 -0
- package/dist/commands/repository-explorer.js +550 -0
- package/dist/commands/repository-explorer.js.map +1 -0
- package/dist/commands/search.d.ts +27 -2
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +95 -103
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/tools.d.ts +9 -3
- package/dist/commands/tools.d.ts.map +1 -1
- package/dist/commands/tools.js +29 -59
- package/dist/commands/tools.js.map +1 -1
- package/dist/commands/vision.d.ts +35 -9
- package/dist/commands/vision.d.ts.map +1 -1
- package/dist/commands/vision.js +184 -131
- package/dist/commands/vision.js.map +1 -1
- package/dist/index.d.ts +62 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +580 -223
- package/dist/index.js.map +1 -1
- package/dist/lib/cache.d.ts +178 -12
- package/dist/lib/cache.d.ts.map +1 -1
- package/dist/lib/cache.js +377 -39
- package/dist/lib/cache.js.map +1 -1
- package/dist/lib/code-mode.d.ts +13 -0
- package/dist/lib/code-mode.d.ts.map +1 -1
- package/dist/lib/code-mode.js +26 -6
- package/dist/lib/code-mode.js.map +1 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +15 -18
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/errors.d.ts +89 -11
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +168 -21
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/execution.d.ts +190 -0
- package/dist/lib/execution.d.ts.map +1 -0
- package/dist/lib/execution.js +383 -0
- package/dist/lib/execution.js.map +1 -0
- package/dist/lib/index.d.ts +10 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +10 -2
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/mcp-client.d.ts +75 -16
- package/dist/lib/mcp-client.d.ts.map +1 -1
- package/dist/lib/mcp-client.js +173 -108
- package/dist/lib/mcp-client.js.map +1 -1
- package/dist/lib/mcp-config.d.ts +17 -0
- package/dist/lib/mcp-config.d.ts.map +1 -1
- package/dist/lib/mcp-config.js +29 -0
- package/dist/lib/mcp-config.js.map +1 -1
- package/dist/lib/monitor-client.d.ts +17 -3
- package/dist/lib/monitor-client.d.ts.map +1 -1
- package/dist/lib/monitor-client.js +23 -69
- package/dist/lib/monitor-client.js.map +1 -1
- package/dist/lib/output.d.ts +53 -7
- package/dist/lib/output.d.ts.map +1 -1
- package/dist/lib/output.js +126 -39
- package/dist/lib/output.js.map +1 -1
- package/dist/lib/redact.d.ts +62 -3
- package/dist/lib/redact.d.ts.map +1 -1
- package/dist/lib/redact.js +165 -31
- package/dist/lib/redact.js.map +1 -1
- package/dist/lib/tool-cache.d.ts +86 -0
- package/dist/lib/tool-cache.d.ts.map +1 -0
- package/dist/lib/tool-cache.js +123 -0
- package/dist/lib/tool-cache.js.map +1 -0
- package/dist/lib/tty.d.ts +7 -20
- package/dist/lib/tty.d.ts.map +1 -1
- package/dist/lib/tty.js +51 -30
- package/dist/lib/tty.js.map +1 -1
- package/dist/node-command-invocation-adapter.d.ts +28 -0
- package/dist/node-command-invocation-adapter.d.ts.map +1 -0
- package/dist/node-command-invocation-adapter.js +88 -0
- package/dist/node-command-invocation-adapter.js.map +1 -0
- package/dist/providers/minimax/adapter.d.ts +49 -0
- package/dist/providers/minimax/adapter.d.ts.map +1 -0
- package/dist/providers/minimax/adapter.js +450 -0
- package/dist/providers/minimax/adapter.js.map +1 -0
- package/dist/providers/minimax/coding-plan-client.d.ts +60 -0
- package/dist/providers/minimax/coding-plan-client.d.ts.map +1 -0
- package/dist/providers/minimax/coding-plan-client.js +204 -0
- package/dist/providers/minimax/coding-plan-client.js.map +1 -0
- package/dist/providers/minimax/config.d.ts +32 -0
- package/dist/providers/minimax/config.d.ts.map +1 -0
- package/dist/providers/minimax/config.js +84 -0
- package/dist/providers/minimax/config.js.map +1 -0
- package/dist/providers/minimax/media.d.ts +88 -0
- package/dist/providers/minimax/media.d.ts.map +1 -0
- package/dist/providers/minimax/media.js +232 -0
- package/dist/providers/minimax/media.js.map +1 -0
- package/dist/providers/minimax/quota-client.d.ts +44 -0
- package/dist/providers/minimax/quota-client.d.ts.map +1 -0
- package/dist/providers/minimax/quota-client.js +83 -0
- package/dist/providers/minimax/quota-client.js.map +1 -0
- package/dist/providers/minimax/quota.d.ts +48 -0
- package/dist/providers/minimax/quota.d.ts.map +1 -0
- package/dist/providers/minimax/quota.js +120 -0
- package/dist/providers/minimax/quota.js.map +1 -0
- package/dist/providers/minimax/sdk-client.d.ts +29 -0
- package/dist/providers/minimax/sdk-client.d.ts.map +1 -0
- package/dist/providers/minimax/sdk-client.js +50 -0
- package/dist/providers/minimax/sdk-client.js.map +1 -0
- package/dist/providers/minimax/vision-attestations.d.ts +52 -0
- package/dist/providers/minimax/vision-attestations.d.ts.map +1 -0
- package/dist/providers/minimax/vision-attestations.js +79 -0
- package/dist/providers/minimax/vision-attestations.js.map +1 -0
- package/dist/providers/minimax/vision-conformance.d.ts +186 -0
- package/dist/providers/minimax/vision-conformance.d.ts.map +1 -0
- package/dist/providers/minimax/vision-conformance.js +371 -0
- package/dist/providers/minimax/vision-conformance.js.map +1 -0
- package/dist/providers/minimax/vision-mappings/chart.d.ts +35 -0
- package/dist/providers/minimax/vision-mappings/chart.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings/chart.js +55 -0
- package/dist/providers/minimax/vision-mappings/chart.js.map +1 -0
- package/dist/providers/minimax/vision-mappings/common.d.ts +60 -0
- package/dist/providers/minimax/vision-mappings/common.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings/common.js +75 -0
- package/dist/providers/minimax/vision-mappings/common.js.map +1 -0
- package/dist/providers/minimax/vision-mappings/diagnose-error.d.ts +35 -0
- package/dist/providers/minimax/vision-mappings/diagnose-error.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings/diagnose-error.js +55 -0
- package/dist/providers/minimax/vision-mappings/diagnose-error.js.map +1 -0
- package/dist/providers/minimax/vision-mappings/diagram.d.ts +35 -0
- package/dist/providers/minimax/vision-mappings/diagram.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings/diagram.js +55 -0
- package/dist/providers/minimax/vision-mappings/diagram.js.map +1 -0
- package/dist/providers/minimax/vision-mappings/extract-text.d.ts +35 -0
- package/dist/providers/minimax/vision-mappings/extract-text.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings/extract-text.js +55 -0
- package/dist/providers/minimax/vision-mappings/extract-text.js.map +1 -0
- package/dist/providers/minimax/vision-mappings/ui-artifact.d.ts +35 -0
- package/dist/providers/minimax/vision-mappings/ui-artifact.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings/ui-artifact.js +69 -0
- package/dist/providers/minimax/vision-mappings/ui-artifact.js.map +1 -0
- package/dist/providers/minimax/vision-mappings.generated.d.ts +29 -0
- package/dist/providers/minimax/vision-mappings.generated.d.ts.map +1 -0
- package/dist/providers/minimax/vision-mappings.generated.js +29 -0
- package/dist/providers/minimax/vision-mappings.generated.js.map +1 -0
- package/dist/providers/minimax/vision-revisions.d.ts +29 -0
- package/dist/providers/minimax/vision-revisions.d.ts.map +1 -0
- package/dist/providers/minimax/vision-revisions.js +34 -0
- package/dist/providers/minimax/vision-revisions.js.map +1 -0
- package/dist/providers/registry.d.ts +36 -0
- package/dist/providers/registry.d.ts.map +1 -0
- package/dist/providers/registry.js +45 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/providers/selection.d.ts +44 -0
- package/dist/providers/selection.d.ts.map +1 -0
- package/dist/providers/selection.js +85 -0
- package/dist/providers/selection.js.map +1 -0
- package/dist/providers/types.d.ts +281 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +127 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/providers/zai/adapter.d.ts +35 -0
- package/dist/providers/zai/adapter.d.ts.map +1 -0
- package/dist/providers/zai/adapter.js +685 -0
- package/dist/providers/zai/adapter.js.map +1 -0
- package/dist/providers/zai/credentials.d.ts +38 -0
- package/dist/providers/zai/credentials.d.ts.map +1 -0
- package/dist/providers/zai/credentials.js +60 -0
- package/dist/providers/zai/credentials.js.map +1 -0
- package/dist/providers/zai/encoded-error.d.ts +90 -0
- package/dist/providers/zai/encoded-error.d.ts.map +1 -0
- package/dist/providers/zai/encoded-error.js +169 -0
- package/dist/providers/zai/encoded-error.js.map +1 -0
- package/dist/providers/zai/media.d.ts +38 -0
- package/dist/providers/zai/media.d.ts.map +1 -0
- package/dist/providers/zai/media.js +107 -0
- package/dist/providers/zai/media.js.map +1 -0
- package/dist/providers/zai/monitor-client.d.ts +53 -0
- package/dist/providers/zai/monitor-client.d.ts.map +1 -0
- package/dist/providers/zai/monitor-client.js +117 -0
- package/dist/providers/zai/monitor-client.js.map +1 -0
- package/dist/providers/zai/quota.d.ts +47 -0
- package/dist/providers/zai/quota.d.ts.map +1 -0
- package/dist/providers/zai/quota.js +127 -0
- package/dist/providers/zai/quota.js.map +1 -0
- package/dist/providers/zai/reader.d.ts +82 -0
- package/dist/providers/zai/reader.d.ts.map +1 -0
- package/dist/providers/zai/reader.js +490 -0
- package/dist/providers/zai/reader.js.map +1 -0
- package/dist/providers/zai/repository.d.ts +76 -0
- package/dist/providers/zai/repository.d.ts.map +1 -0
- package/dist/providers/zai/repository.js +715 -0
- package/dist/providers/zai/repository.js.map +1 -0
- package/package.json +11 -6
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider-neutral Reader Capability Contract (core-flows D1, D2;
|
|
3
|
+
* tech-plan D1, D2).
|
|
4
|
+
*
|
|
5
|
+
* This module declares the single Reader operation (`reader-fetch`), its
|
|
6
|
+
* provider-neutral request, identity, cache, and result shapes, the total
|
|
7
|
+
* normalized cache decoder, and the `ReaderRawResponse` type capturing
|
|
8
|
+
* what the Z.AI WebReader MCP actually returns at runtime.
|
|
9
|
+
*
|
|
10
|
+
* It imports NO concrete Provider, transport, or Adapter. It does no URL
|
|
11
|
+
* rewriting, raw response parsing, Provider field mapping, Provider
|
|
12
|
+
* selection, retries, or presentation.
|
|
13
|
+
*
|
|
14
|
+
* Scope of this file:
|
|
15
|
+
* - request, operation, cache-identity, and result type contracts;
|
|
16
|
+
* - the discriminated `ReaderOperationKind` union;
|
|
17
|
+
* - a total decoder for the cacheable normalized result
|
|
18
|
+
* (`decodeReaderFetchResult`);
|
|
19
|
+
* - the `ReaderRawResponse` type consumed by Ticket 02's `webRead`
|
|
20
|
+
* signature fix.
|
|
21
|
+
*
|
|
22
|
+
* Ticket 01 introduces ONLY this contract and the decoder. Ticket 02
|
|
23
|
+
* fixes `webRead` to return `ReaderRawResponse`. Ticket 03 supplies the
|
|
24
|
+
* Z.AI Reader Adapter. Ticket 04 cuts the handler over. Nothing in this
|
|
25
|
+
* file is allowed to widen that boundary.
|
|
26
|
+
*
|
|
27
|
+
* Evidence base: [`artifacts/reader-webreader-characterization/`](../../../../.traycer/epics/4f065460-3416-4832-95a6-7ac5576fcfbc/artifacts/reader-webreader-characterization/index.md).
|
|
28
|
+
*/
|
|
29
|
+
// ===========================================================================
|
|
30
|
+
// Total normalized cache decoder
|
|
31
|
+
// ===========================================================================
|
|
32
|
+
//
|
|
33
|
+
// Accepts `unknown`, returns the typed result or `null`, never throws, and
|
|
34
|
+
// never trusts a generic cast. Shape contract is local; the Adapter (Ticket
|
|
35
|
+
// 03) is responsible for producing values that conform to
|
|
36
|
+
// `ReaderFetchResult`.
|
|
37
|
+
//
|
|
38
|
+
// Rules encoded:
|
|
39
|
+
// - reject primitives and arrays at the top level (results are objects);
|
|
40
|
+
// - reject schemaVersion other than the literal number 1;
|
|
41
|
+
// - reject missing or non-string `url`, `finalUrl`, `content`;
|
|
42
|
+
// - reject empty `url`, `finalUrl`, `content` (the Capability requires
|
|
43
|
+
// non-empty content; an empty fetch is a miss, not a degenerate hit);
|
|
44
|
+
// - reject `title` that is neither a string nor null;
|
|
45
|
+
// - reject `contentFormat` other than the literal strings "markdown"
|
|
46
|
+
// or "text";
|
|
47
|
+
// - preserve `metadata` and `external` verbatim when present.
|
|
48
|
+
function isPlainObject(value) {
|
|
49
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Type guard for a non-empty string. `""` is rejected.
|
|
53
|
+
*/
|
|
54
|
+
function isNonEmptyString(value) {
|
|
55
|
+
return typeof value === "string" && value.length > 0;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Decode a Reader fetch result from the cache. Returns the canonical
|
|
59
|
+
* `ReaderFetchResult` on success, `null` for any malformed value.
|
|
60
|
+
*
|
|
61
|
+
* `title: null` is a valid decoded value (the Adapter coerces missing
|
|
62
|
+
* or blank titles to null before writing; the decoder round-trips it).
|
|
63
|
+
*/
|
|
64
|
+
export function decodeReaderFetchResult(value) {
|
|
65
|
+
if (!isPlainObject(value))
|
|
66
|
+
return null;
|
|
67
|
+
// `schemaVersion` MUST be the literal number 1. The strict equality
|
|
68
|
+
// rejects numeric strings, bigints, and any future version.
|
|
69
|
+
if (value.schemaVersion !== 1)
|
|
70
|
+
return null;
|
|
71
|
+
if (!isNonEmptyString(value.url))
|
|
72
|
+
return null;
|
|
73
|
+
if (!isNonEmptyString(value.finalUrl))
|
|
74
|
+
return null;
|
|
75
|
+
if (!isNonEmptyString(value.content))
|
|
76
|
+
return null;
|
|
77
|
+
const title = value.title;
|
|
78
|
+
if (title !== null && typeof title !== "string")
|
|
79
|
+
return null;
|
|
80
|
+
const contentFormat = value.contentFormat;
|
|
81
|
+
if (contentFormat !== "markdown" && contentFormat !== "text")
|
|
82
|
+
return null;
|
|
83
|
+
// Optional fields preserved verbatim when present, omitted from the
|
|
84
|
+
// decoded result when absent so the round-trip equals the input shape.
|
|
85
|
+
// Built in one shot so `readonly` invariants on `ReaderFetchResult`
|
|
86
|
+
// are honored.
|
|
87
|
+
const hasMetadata = value.metadata !== undefined;
|
|
88
|
+
const hasExternal = value.external !== undefined;
|
|
89
|
+
return {
|
|
90
|
+
schemaVersion: 1,
|
|
91
|
+
url: value.url,
|
|
92
|
+
finalUrl: value.finalUrl,
|
|
93
|
+
title: title,
|
|
94
|
+
content: value.content,
|
|
95
|
+
contentFormat,
|
|
96
|
+
...(hasMetadata ? { metadata: value.metadata } : {}),
|
|
97
|
+
...(hasExternal ? { external: value.external } : {}),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reader.js","sourceRoot":"","sources":["../../src/capabilities/reader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAsOH,8EAA8E;AAC9E,iCAAiC;AACjC,8EAA8E;AAC9E,EAAE;AACF,2EAA2E;AAC3E,4EAA4E;AAC5E,0DAA0D;AAC1D,uBAAuB;AACvB,EAAE;AACF,iBAAiB;AACjB,2EAA2E;AAC3E,4DAA4D;AAC5D,iEAAiE;AACjE,yEAAyE;AACzE,0EAA0E;AAC1E,wDAAwD;AACxD,uEAAuE;AACvE,iBAAiB;AACjB,gEAAgE;AAEhE,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB,CAAC,KAAc;IACt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AE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpD,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACrD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider-neutral Repository Capability Contract (DESIGN.md §18,
|
|
3
|
+
* PRD FR-081, FR-083, FR-086, FR-089; NFR-004, NFR-006, NFR-007).
|
|
4
|
+
*
|
|
5
|
+
* This module declares the three repository operations (Search, Read File,
|
|
6
|
+
* Directory Listing), their provider-neutral request, identity, cache, and
|
|
7
|
+
* result shapes, and the total normalized cache decoders used by shared
|
|
8
|
+
* execution. It imports NO concrete Provider, transport, or Adapter. It
|
|
9
|
+
* does no path canonicalization, raw ZRead parsing, Provider field
|
|
10
|
+
* mapping, Provider selection, retries, or presentation.
|
|
11
|
+
*
|
|
12
|
+
* Scope of this file:
|
|
13
|
+
* - request, operation, cache-identity, and result type contracts;
|
|
14
|
+
* - total decoders for the three cacheable normalized result types
|
|
15
|
+
* (`decodeRepositorySearch`, `decodeRepositoryFile`,
|
|
16
|
+
* `decodeRepositoryDirectoryListing`);
|
|
17
|
+
* - the discriminated `RepositoryOperationKind` union shared by shared
|
|
18
|
+
* execution, retry policy, and diagnostics.
|
|
19
|
+
*
|
|
20
|
+
* P6-02 introduces ONLY this contract and the decoders. P6-03 supplies
|
|
21
|
+
* shared execution, P6-04 the Z.AI Adapter, and P6-05 the Explorer. The
|
|
22
|
+
* capability surface here is the boundary between those tickets and the
|
|
23
|
+
* commands; nothing in this file is allowed to widen the boundary.
|
|
24
|
+
*/
|
|
25
|
+
import type { ProviderId } from "../providers/types.js";
|
|
26
|
+
/**
|
|
27
|
+
* Discriminated union over the three repository operations. Shared
|
|
28
|
+
* execution maps each kind to its retry policy branch and diagnostics
|
|
29
|
+
* inventory. The union is the public source of truth; consumers iterate
|
|
30
|
+
* by listing each literal explicitly when they need a runtime set.
|
|
31
|
+
*/
|
|
32
|
+
export type RepositoryOperationKind = "repository-search" | "repository-read-file" | "repository-list-directory";
|
|
33
|
+
/**
|
|
34
|
+
* Provider-neutral Search request. `language` MUST be supplied explicitly
|
|
35
|
+
* (default `"en"` applied at the command layer before validation); empty
|
|
36
|
+
* or whitespace-only `query` is invalid at validate time.
|
|
37
|
+
*/
|
|
38
|
+
export interface RepositorySearchRequest {
|
|
39
|
+
readonly repository: string;
|
|
40
|
+
readonly query: string;
|
|
41
|
+
readonly language: "en" | "zh";
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Provider-neutral File request. `path` is a non-empty
|
|
45
|
+
* repository-relative POSIX path; `path: ""` (root) is invalid for File
|
|
46
|
+
* and is rejected by the cache decoder.
|
|
47
|
+
*/
|
|
48
|
+
export interface RepositoryFileRequest {
|
|
49
|
+
readonly repository: string;
|
|
50
|
+
readonly path: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Provider-neutral Directory Listing request. `path: ""` is the
|
|
54
|
+
* repository root; every other path is a non-empty repository-relative
|
|
55
|
+
* POSIX path.
|
|
56
|
+
*/
|
|
57
|
+
export interface RepositoryDirectoryRequest {
|
|
58
|
+
readonly repository: string;
|
|
59
|
+
readonly path: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Provider-neutral directory or file entry. `name` is the final segment
|
|
63
|
+
* and `path` is the repository-relative POSIX path of the entry
|
|
64
|
+
* itself. Both fields are non-empty strings — root-level entries are
|
|
65
|
+
* impossible because a directory entry sits below the listing's
|
|
66
|
+
* `path`. Order is Provider-supplied and preserved.
|
|
67
|
+
*/
|
|
68
|
+
export interface RepositoryEntry {
|
|
69
|
+
readonly name: string;
|
|
70
|
+
readonly path: string;
|
|
71
|
+
readonly kind: "file" | "directory";
|
|
72
|
+
}
|
|
73
|
+
/** Search excerpt: only text. ZRead does not supply reliable metadata. */
|
|
74
|
+
export interface RepositorySearchExcerpt {
|
|
75
|
+
readonly text: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Normalized Provider-derived Search result. `schemaVersion: 1` is the
|
|
79
|
+
* breaking migration shape from P6 (`data-mode scripting impact`).
|
|
80
|
+
*/
|
|
81
|
+
export interface RepositorySearchResult {
|
|
82
|
+
readonly schemaVersion: 1;
|
|
83
|
+
readonly repository: string;
|
|
84
|
+
readonly query: string;
|
|
85
|
+
readonly language: "en" | "zh";
|
|
86
|
+
readonly excerpts: readonly RepositorySearchExcerpt[];
|
|
87
|
+
readonly truncated: boolean;
|
|
88
|
+
readonly originalTextLength: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Normalized File result. `path` is a non-empty repository-relative
|
|
92
|
+
* POSIX path; the cache decoder rejects `path: ""` because File is
|
|
93
|
+
* always non-root. `truncated` carries the existing ellipsis rule.
|
|
94
|
+
*/
|
|
95
|
+
export interface RepositoryFileResult {
|
|
96
|
+
readonly schemaVersion: 1;
|
|
97
|
+
readonly repository: string;
|
|
98
|
+
readonly path: string;
|
|
99
|
+
readonly content: string;
|
|
100
|
+
readonly truncated: boolean;
|
|
101
|
+
readonly originalContentLength: number;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Normalized Directory Listing result. `path: ""` means the
|
|
105
|
+
* repository root. `entries` is never `null` and preserves sibling
|
|
106
|
+
* order from the Provider. Each entry's `name` and `path` are
|
|
107
|
+
* non-empty.
|
|
108
|
+
*/
|
|
109
|
+
export interface RepositoryDirectoryListing {
|
|
110
|
+
readonly repository: string;
|
|
111
|
+
readonly path: string;
|
|
112
|
+
readonly entries: readonly RepositoryEntry[];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Normalized Repository Tree result, composed of provider-ordered
|
|
116
|
+
* `snapshots`. `path: ""` means tree root. `depth` is the integer
|
|
117
|
+
* tree depth applied at the Explorer layer. Tree is Explorer
|
|
118
|
+
* projection and is not a cacheable `RepositoryOperation.decodeCached`
|
|
119
|
+
* implementation; this type remains public because Explorer surfaces
|
|
120
|
+
* it.
|
|
121
|
+
*/
|
|
122
|
+
export interface RepositoryTreeResult {
|
|
123
|
+
readonly schemaVersion: 1;
|
|
124
|
+
readonly repository: string;
|
|
125
|
+
readonly path: string;
|
|
126
|
+
readonly depth: number;
|
|
127
|
+
readonly snapshots: readonly RepositoryDirectoryListing[];
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Provider-owned legacy cache candidate. Old Z.AI keys encode the
|
|
131
|
+
* raw v0.2 tool response; the Adapter supplies the decoder so shared
|
|
132
|
+
* cache code never inspects Provider response shapes. An invalid
|
|
133
|
+
* decode is a cache miss.
|
|
134
|
+
*/
|
|
135
|
+
export interface LegacyRepositoryCacheCandidate<Result> {
|
|
136
|
+
readonly key: string;
|
|
137
|
+
decode(value: unknown): Result | null;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Identity used to read and write a Provider-partitioned cache entry.
|
|
141
|
+
* `credentialFingerprint` is the full lowercase SHA-256 hex digest of
|
|
142
|
+
* the resolved credential and is NEVER re-hashed by cache code.
|
|
143
|
+
* `request` is the normalized Capability request.
|
|
144
|
+
*/
|
|
145
|
+
export interface RepositoryCacheIdentity<Request, Result> {
|
|
146
|
+
readonly provider: ProviderId;
|
|
147
|
+
readonly capability: "repository-exploration";
|
|
148
|
+
readonly operation: RepositoryOperationKind;
|
|
149
|
+
readonly credentialFingerprint: string;
|
|
150
|
+
readonly request: Readonly<Request>;
|
|
151
|
+
readonly legacyCandidates: readonly LegacyRepositoryCacheCandidate<Result>[];
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Generic operation descriptor. Each Adapter supplies one of these for
|
|
155
|
+
* each operation it supports. The Adapter owns Provider field mapping,
|
|
156
|
+
* credentials, transport lifecycle, and error normalization. Commands
|
|
157
|
+
* and shared execution call only these four methods.
|
|
158
|
+
*/
|
|
159
|
+
export interface RepositoryOperation<Request, Result> {
|
|
160
|
+
readonly kind: RepositoryOperationKind;
|
|
161
|
+
/**
|
|
162
|
+
* Validate the request before any Provider access. Throws
|
|
163
|
+
* `ValidationError` for missing required fields and
|
|
164
|
+
* `UnsupportedOptionError` for Provider-specific options the Adapter
|
|
165
|
+
* does not accept. Validation MUST occur before credential resolution
|
|
166
|
+
* or transport construction.
|
|
167
|
+
*/
|
|
168
|
+
validate(request: Request): void;
|
|
169
|
+
/**
|
|
170
|
+
* Build the cache identity for a request. Called only after
|
|
171
|
+
* `validate` succeeds. The Adapter resolves its credential once and
|
|
172
|
+
* returns full fingerprint, canonical request, and zero or more
|
|
173
|
+
* legacy candidates. Candidate construction MUST NOT read ambient
|
|
174
|
+
* environment.
|
|
175
|
+
*/
|
|
176
|
+
cacheIdentity(request: Request): RepositoryCacheIdentity<Request, Result>;
|
|
177
|
+
/**
|
|
178
|
+
* Total decoder for cached normalized entries. Accepts an `unknown`
|
|
179
|
+
* value, validates shape, and returns the typed result or `null`.
|
|
180
|
+
* NEVER throws, NEVER trusts a generic cast.
|
|
181
|
+
*/
|
|
182
|
+
decodeCached(value: unknown): Result | null;
|
|
183
|
+
/**
|
|
184
|
+
* Invoke the Provider and return the normalized result. The Adapter
|
|
185
|
+
* closes its transport and never retries inside this method;
|
|
186
|
+
* shared execution owns retry policy.
|
|
187
|
+
*/
|
|
188
|
+
invoke(request: Request): Promise<Result>;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Repository Capability contract. Every Adapter that supports
|
|
192
|
+
* repository exploration implements this interface and exposes it as
|
|
193
|
+
* `adapter.repository` (P6-04 and beyond).
|
|
194
|
+
*/
|
|
195
|
+
export interface RepositoryCapability {
|
|
196
|
+
readonly search: RepositoryOperation<RepositorySearchRequest, RepositorySearchResult>;
|
|
197
|
+
readonly readFile: RepositoryOperation<RepositoryFileRequest, RepositoryFileResult>;
|
|
198
|
+
readonly listDirectory: RepositoryOperation<RepositoryDirectoryRequest, RepositoryDirectoryListing>;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Decode a Search result from the cache. Returns the canonical
|
|
202
|
+
* `RepositorySearchResult` on success, `null` for any malformed value.
|
|
203
|
+
*/
|
|
204
|
+
export declare function decodeRepositorySearch(value: unknown): RepositorySearchResult | null;
|
|
205
|
+
/**
|
|
206
|
+
* Decode a File result from the cache. Returns the canonical
|
|
207
|
+
* `RepositoryFileResult` on success, `null` otherwise. `path` MUST be
|
|
208
|
+
* non-empty — File is always non-root; `path: ""` is rejected here
|
|
209
|
+
* without performing any other path canonicalization.
|
|
210
|
+
*/
|
|
211
|
+
export declare function decodeRepositoryFile(value: unknown): RepositoryFileResult | null;
|
|
212
|
+
/**
|
|
213
|
+
* Decode a Directory Listing from the cache. Returns the canonical
|
|
214
|
+
* `RepositoryDirectoryListing` on success, `null` otherwise. The
|
|
215
|
+
* listing's own `path` may be `""` (root); every entry's `name` and
|
|
216
|
+
* `path` MUST be non-empty. Empty entries arrays are valid (a future
|
|
217
|
+
* Adapter contract). Each entry preserves Provider sibling order
|
|
218
|
+
* verbatim.
|
|
219
|
+
*/
|
|
220
|
+
export declare function decodeRepositoryDirectoryListing(value: unknown): RepositoryDirectoryListing | null;
|
|
221
|
+
//# sourceMappingURL=repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/capabilities/repository.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAMxD;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAC/B,mBAAmB,GACnB,sBAAsB,GACtB,2BAA2B,CAAC;AAMhC;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,C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;IACvC;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACjC;;;;;;OAMG;IACH,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,uBAAuB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC1E;;;;OAIG;IACH,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5C;;;;OAIG;IACH,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3C;AAMD;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC,uBAAuB,EAAE,sBAAsB,CAAC,CAAC;IACtF,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC,qBAAqB,EAAE,oBAAoB,CAAC,CAAC;IACpF,QAAQ,CAAC,aAAa,EAAE,mBAAmB,CACzC,0BAA0B,EAC1B,0BAA0B,CAC3B,CAAC;CACH;AA4CD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,sBAAsB,GAAG,IAAI,CA+BpF;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,GAAG,IAAI,CAkBhF;AAED;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,OAAO,GACb,0BAA0B,GAAG,IAAI,CA0BnC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider-neutral Repository Capability Contract (DESIGN.md §18,
|
|
3
|
+
* PRD FR-081, FR-083, FR-086, FR-089; NFR-004, NFR-006, NFR-007).
|
|
4
|
+
*
|
|
5
|
+
* This module declares the three repository operations (Search, Read File,
|
|
6
|
+
* Directory Listing), their provider-neutral request, identity, cache, and
|
|
7
|
+
* result shapes, and the total normalized cache decoders used by shared
|
|
8
|
+
* execution. It imports NO concrete Provider, transport, or Adapter. It
|
|
9
|
+
* does no path canonicalization, raw ZRead parsing, Provider field
|
|
10
|
+
* mapping, Provider selection, retries, or presentation.
|
|
11
|
+
*
|
|
12
|
+
* Scope of this file:
|
|
13
|
+
* - request, operation, cache-identity, and result type contracts;
|
|
14
|
+
* - total decoders for the three cacheable normalized result types
|
|
15
|
+
* (`decodeRepositorySearch`, `decodeRepositoryFile`,
|
|
16
|
+
* `decodeRepositoryDirectoryListing`);
|
|
17
|
+
* - the discriminated `RepositoryOperationKind` union shared by shared
|
|
18
|
+
* execution, retry policy, and diagnostics.
|
|
19
|
+
*
|
|
20
|
+
* P6-02 introduces ONLY this contract and the decoders. P6-03 supplies
|
|
21
|
+
* shared execution, P6-04 the Z.AI Adapter, and P6-05 the Explorer. The
|
|
22
|
+
* capability surface here is the boundary between those tickets and the
|
|
23
|
+
* commands; nothing in this file is allowed to widen the boundary.
|
|
24
|
+
*/
|
|
25
|
+
// ===========================================================================
|
|
26
|
+
// Total normalized cache decoders
|
|
27
|
+
// ===========================================================================
|
|
28
|
+
//
|
|
29
|
+
// Every decoder accepts `unknown`, returns the typed result or `null`,
|
|
30
|
+
// never throws, and never trusts a generic cast. The shape contract is
|
|
31
|
+
// local; the three adapters in P6-04 are responsible for producing
|
|
32
|
+
// values that conform to the Result interfaces.
|
|
33
|
+
//
|
|
34
|
+
// Rules encoded in each decoder:
|
|
35
|
+
// - reject primitives and arrays at the top level (results are objects);
|
|
36
|
+
// - reject required scalar fields that are missing or of the wrong
|
|
37
|
+
// type;
|
|
38
|
+
// - reject arrays that are themselves nullable or contain malformed
|
|
39
|
+
// items — partial goodness is NEVER a success;
|
|
40
|
+
// - preserve exact order, exact strings, exact numeric values;
|
|
41
|
+
// - accept an empty array as valid (a future Adapter contract).
|
|
42
|
+
function isPlainObject(value) {
|
|
43
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Type guard for a non-empty string. `""` is rejected.
|
|
47
|
+
*/
|
|
48
|
+
function isNonEmptyString(value) {
|
|
49
|
+
return typeof value === "string" && value.length > 0;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Type guard for a non-negative finite integer (0 or positive, no
|
|
53
|
+
* fractional part). `Number.NaN`, `Infinity`, and negatives are rejected.
|
|
54
|
+
*/
|
|
55
|
+
function isNonNegativeFiniteInteger(value) {
|
|
56
|
+
return (typeof value === "number" &&
|
|
57
|
+
Number.isFinite(value) &&
|
|
58
|
+
Number.isInteger(value) &&
|
|
59
|
+
value >= 0);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Decode a Search result from the cache. Returns the canonical
|
|
63
|
+
* `RepositorySearchResult` on success, `null` for any malformed value.
|
|
64
|
+
*/
|
|
65
|
+
export function decodeRepositorySearch(value) {
|
|
66
|
+
if (!isPlainObject(value))
|
|
67
|
+
return null;
|
|
68
|
+
if (value.schemaVersion !== 1)
|
|
69
|
+
return null;
|
|
70
|
+
if (typeof value.repository !== "string")
|
|
71
|
+
return null;
|
|
72
|
+
if (typeof value.query !== "string")
|
|
73
|
+
return null;
|
|
74
|
+
const language = value.language;
|
|
75
|
+
if (language !== "en" && language !== "zh")
|
|
76
|
+
return null;
|
|
77
|
+
if (typeof value.truncated !== "boolean")
|
|
78
|
+
return null;
|
|
79
|
+
if (!isNonNegativeFiniteInteger(value.originalTextLength))
|
|
80
|
+
return null;
|
|
81
|
+
const rawExcerpts = value.excerpts;
|
|
82
|
+
if (!Array.isArray(rawExcerpts))
|
|
83
|
+
return null;
|
|
84
|
+
const excerpts = [];
|
|
85
|
+
for (const item of rawExcerpts) {
|
|
86
|
+
if (!isPlainObject(item))
|
|
87
|
+
return null;
|
|
88
|
+
if (typeof item.text !== "string")
|
|
89
|
+
return null;
|
|
90
|
+
excerpts.push({ text: item.text });
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
schemaVersion: 1,
|
|
94
|
+
repository: value.repository,
|
|
95
|
+
query: value.query,
|
|
96
|
+
language,
|
|
97
|
+
excerpts,
|
|
98
|
+
truncated: value.truncated,
|
|
99
|
+
originalTextLength: value.originalTextLength,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Decode a File result from the cache. Returns the canonical
|
|
104
|
+
* `RepositoryFileResult` on success, `null` otherwise. `path` MUST be
|
|
105
|
+
* non-empty — File is always non-root; `path: ""` is rejected here
|
|
106
|
+
* without performing any other path canonicalization.
|
|
107
|
+
*/
|
|
108
|
+
export function decodeRepositoryFile(value) {
|
|
109
|
+
if (!isPlainObject(value))
|
|
110
|
+
return null;
|
|
111
|
+
if (value.schemaVersion !== 1)
|
|
112
|
+
return null;
|
|
113
|
+
if (typeof value.repository !== "string")
|
|
114
|
+
return null;
|
|
115
|
+
if (!isNonEmptyString(value.path))
|
|
116
|
+
return null;
|
|
117
|
+
if (typeof value.content !== "string")
|
|
118
|
+
return null;
|
|
119
|
+
if (typeof value.truncated !== "boolean")
|
|
120
|
+
return null;
|
|
121
|
+
if (!isNonNegativeFiniteInteger(value.originalContentLength))
|
|
122
|
+
return null;
|
|
123
|
+
return {
|
|
124
|
+
schemaVersion: 1,
|
|
125
|
+
repository: value.repository,
|
|
126
|
+
path: value.path,
|
|
127
|
+
content: value.content,
|
|
128
|
+
truncated: value.truncated,
|
|
129
|
+
originalContentLength: value.originalContentLength,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Decode a Directory Listing from the cache. Returns the canonical
|
|
134
|
+
* `RepositoryDirectoryListing` on success, `null` otherwise. The
|
|
135
|
+
* listing's own `path` may be `""` (root); every entry's `name` and
|
|
136
|
+
* `path` MUST be non-empty. Empty entries arrays are valid (a future
|
|
137
|
+
* Adapter contract). Each entry preserves Provider sibling order
|
|
138
|
+
* verbatim.
|
|
139
|
+
*/
|
|
140
|
+
export function decodeRepositoryDirectoryListing(value) {
|
|
141
|
+
if (!isPlainObject(value))
|
|
142
|
+
return null;
|
|
143
|
+
if (typeof value.repository !== "string")
|
|
144
|
+
return null;
|
|
145
|
+
if (typeof value.path !== "string")
|
|
146
|
+
return null;
|
|
147
|
+
const rawEntries = value.entries;
|
|
148
|
+
if (!Array.isArray(rawEntries))
|
|
149
|
+
return null;
|
|
150
|
+
const entries = [];
|
|
151
|
+
for (const item of rawEntries) {
|
|
152
|
+
if (!isPlainObject(item))
|
|
153
|
+
return null;
|
|
154
|
+
if (!isNonEmptyString(item.name))
|
|
155
|
+
return null;
|
|
156
|
+
if (!isNonEmptyString(item.path))
|
|
157
|
+
return null;
|
|
158
|
+
if (item.kind !== "file" && item.kind !== "directory")
|
|
159
|
+
return null;
|
|
160
|
+
entries.push({
|
|
161
|
+
name: item.name,
|
|
162
|
+
path: item.path,
|
|
163
|
+
kind: item.kind,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
repository: value.repository,
|
|
168
|
+
path: value.path,
|
|
169
|
+
entries,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../src/capabilities/repository.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AA8NH,8EAA8E;AAC9E,kCAAkC;AAClC,8EAA8E;AAC9E,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,mEAAmE;AACnE,gDAAgD;AAChD,EAAE;AACF,iCAAiC;AACjC,2EAA2E;AAC3E,qEAAqE;AACrE,YAAY;AACZ,sEAAsE;AACtE,mDAAmD;AACnD,iEAAiE;AACjE,kEAAkE;AAElE,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAA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
*
|
|
4
|
+
* Defines the normalized meaning shared by every Search Provider.
|
|
5
|
+
* Commands consume the Capability through `SearchCapability.invoke`,
|
|
6
|
+
* which returns `SearchSource[]` in the Provider-agnostic shape. All
|
|
7
|
+
* Provider-specific fields (rank, occurrence count, count, summary
|
|
8
|
+
* truncation, field projection, presentation) remain command meaning.
|
|
9
|
+
*
|
|
10
|
+
* The Cache Identity contract (`SearchCacheIdentity`,
|
|
11
|
+
* `LegacySearchCacheCandidate`) is declared here so P2-02 can wire
|
|
12
|
+
* Provider-partitioned cache keys without further type changes.
|
|
13
|
+
*
|
|
14
|
+
* Phase 2 implements only this contract. The Z.AI and MiniMax Search
|
|
15
|
+
* Adapters arrive in P2-03 and P2-04; the production registry arrives
|
|
16
|
+
* in P2-05. The Provider descriptors advertised in P2-01 already
|
|
17
|
+
* declare the search Capability, so command wiring can begin once the
|
|
18
|
+
* Adapters exist.
|
|
19
|
+
*/
|
|
20
|
+
import type { ProviderId } from "../providers/types.js";
|
|
21
|
+
/** Recency filter accepted by Z.AI; MiniMax rejects it. */
|
|
22
|
+
export type SearchRecency = "oneDay" | "oneWeek" | "oneMonth" | "oneYear" | "noLimit";
|
|
23
|
+
/**
|
|
24
|
+
* Provider controls accepted by the Search Capability. Every field is
|
|
25
|
+
* optional. MiniMax rejects `domain`, `recency`, `contentSize`, and
|
|
26
|
+
* `location` with `UNSUPPORTED_OPTION` before any SDK access.
|
|
27
|
+
*/
|
|
28
|
+
export interface SearchControls {
|
|
29
|
+
domain?: string;
|
|
30
|
+
recency?: SearchRecency;
|
|
31
|
+
contentSize?: "medium" | "high";
|
|
32
|
+
location?: "cn" | "us";
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A Search request. `query` must contain at least one non-whitespace
|
|
36
|
+
* character; the Capability's `validate` enforces this and throws
|
|
37
|
+
* `ValidationError` otherwise.
|
|
38
|
+
*/
|
|
39
|
+
export interface SearchRequest {
|
|
40
|
+
query: string;
|
|
41
|
+
controls?: Readonly<SearchControls>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Normalized Search result. Adapters populate this from their Provider
|
|
45
|
+
* response shape; commands merge, deduplicate, project, truncate, and
|
|
46
|
+
* rank downstream. Provider-only fields are discarded.
|
|
47
|
+
*/
|
|
48
|
+
export interface SearchSource {
|
|
49
|
+
title: string;
|
|
50
|
+
url: string;
|
|
51
|
+
summary: string;
|
|
52
|
+
source?: string;
|
|
53
|
+
date?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Provider-owned legacy cache candidate. Old Z.AI keys encode raw
|
|
57
|
+
* `WebSearchResult[]`; the Adapter supplies the decoder so shared cache
|
|
58
|
+
* code never inspects Provider response shapes. Invalid decode is a
|
|
59
|
+
* cache miss.
|
|
60
|
+
*/
|
|
61
|
+
export interface LegacySearchCacheCandidate {
|
|
62
|
+
readonly key: string;
|
|
63
|
+
decode(value: unknown): readonly SearchSource[] | null;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Identity used to read and write a Provider-partitioned cache entry.
|
|
67
|
+
* `credentialFingerprint` is the full lowercase SHA-256 hex digest of
|
|
68
|
+
* the active credential and is never hashed a second time by cache
|
|
69
|
+
* code. Request identity uses recursively key-sorted JSON of only
|
|
70
|
+
* `query` and Provider controls.
|
|
71
|
+
*/
|
|
72
|
+
export interface SearchCacheIdentity {
|
|
73
|
+
readonly provider: ProviderId;
|
|
74
|
+
readonly capability: "search";
|
|
75
|
+
readonly credentialFingerprint: string;
|
|
76
|
+
readonly request: Readonly<SearchRequest>;
|
|
77
|
+
readonly legacyCandidates?: readonly LegacySearchCacheCandidate[];
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Search Capability contract. Every Adapter that supports Search
|
|
81
|
+
* implements this interface and is consumed by shared execution. The
|
|
82
|
+
* Adapter owns Provider field mapping; commands call only these three
|
|
83
|
+
* methods.
|
|
84
|
+
*/
|
|
85
|
+
export interface SearchCapability {
|
|
86
|
+
/**
|
|
87
|
+
* Validate a request before any Provider access. Throws
|
|
88
|
+
* `ValidationError` for an empty or whitespace-only query, and
|
|
89
|
+
* `UnsupportedOptionError` for Provider-specific options the Adapter
|
|
90
|
+
* does not accept. Validation must occur before credential resolution
|
|
91
|
+
* or transport construction.
|
|
92
|
+
*/
|
|
93
|
+
validate(request: SearchRequest): void;
|
|
94
|
+
/**
|
|
95
|
+
* Build the cache identity for a request. Called only after
|
|
96
|
+
* `validate` succeeds. `compatibility.legacyCount` is the optional
|
|
97
|
+
* command count; it may enter only `legacyCandidates` and never the
|
|
98
|
+
* new request identity.
|
|
99
|
+
*/
|
|
100
|
+
cacheIdentity(request: SearchRequest, compatibility?: {
|
|
101
|
+
readonly legacyCount?: number;
|
|
102
|
+
}): SearchCacheIdentity;
|
|
103
|
+
/**
|
|
104
|
+
* Invoke the Provider and return normalized sources. The Adapter
|
|
105
|
+
* closes its transport and never retries inside this method; shared
|
|
106
|
+
* execution owns retry policy.
|
|
107
|
+
*/
|
|
108
|
+
invoke(request: SearchRequest): Promise<readonly SearchSource[]>;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/capabilities/search.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAMxD,2DAA2D;AAC3D,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,SAAS,GACT,UAAU,GACV,SAAS,GACT,SAAS,CAAC;AAEd;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,WAAW,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAChC,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB;A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/**
|
|
2
|
+
* Search Capability Contract (DESIGN.md §7, PRD FR-010 through FR-016).
|
|
3
|
+
*
|
|
4
|
+
* Defines the normalized meaning shared by every Search Provider.
|
|
5
|
+
* Commands consume the Capability through `SearchCapability.invoke`,
|
|
6
|
+
* which returns `SearchSource[]` in the Provider-agnostic shape. All
|
|
7
|
+
* Provider-specific fields (rank, occurrence count, count, summary
|
|
8
|
+
* truncation, field projection, presentation) remain command meaning.
|
|
9
|
+
*
|
|
10
|
+
* The Cache Identity contract (`SearchCacheIdentity`,
|
|
11
|
+
* `LegacySearchCacheCandidate`) is declared here so P2-02 can wire
|
|
12
|
+
* Provider-partitioned cache keys without further type changes.
|
|
13
|
+
*
|
|
14
|
+
* Phase 2 implements only this contract. The Z.AI and MiniMax Search
|
|
15
|
+
* Adapters arrive in P2-03 and P2-04; the production registry arrives
|
|
16
|
+
* in P2-05. The Provider descriptors advertised in P2-01 already
|
|
17
|
+
* declare the search Capability, so command wiring can begin once the
|
|
18
|
+
* Adapters exist.
|
|
19
|
+
*/
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/capabilities/search.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG"}
|