@adcp/sdk 9.2.2 → 9.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.
- package/README.md +23 -0
- package/dist/lib/discovery/validate-adagents.d.ts +2 -0
- package/dist/lib/discovery/validate-adagents.d.ts.map +1 -1
- package/dist/lib/discovery/validate-adagents.js +14 -6
- package/dist/lib/discovery/validate-adagents.js.map +1 -1
- package/dist/lib/index.d.ts +3 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +22 -12
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/registry/feed-stream.d.ts +147 -0
- package/dist/lib/registry/feed-stream.d.ts.map +1 -0
- package/dist/lib/registry/feed-stream.js +378 -0
- package/dist/lib/registry/feed-stream.js.map +1 -0
- package/dist/lib/registry/index.d.ts +52 -3
- package/dist/lib/registry/index.d.ts.map +1 -1
- package/dist/lib/registry/index.js +205 -2
- package/dist/lib/registry/index.js.map +1 -1
- package/dist/lib/registry/sync.d.ts +175 -10
- package/dist/lib/registry/sync.d.ts.map +1 -1
- package/dist/lib/registry/sync.js +601 -43
- package/dist/lib/registry/sync.js.map +1 -1
- package/dist/lib/registry/types.d.ts +38 -2
- package/dist/lib/registry/types.d.ts.map +1 -1
- package/dist/lib/registry/types.generated.d.ts +231 -8
- package/dist/lib/registry/types.generated.d.ts.map +1 -1
- package/dist/lib/registry/types.generated.js +1 -1
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-Sent Events transport for the registry change feed
|
|
3
|
+
* (`GET /api/registry/feed/stream`, adcp#5733).
|
|
4
|
+
*
|
|
5
|
+
* Generated OpenAPI types alone are not enough because the response is
|
|
6
|
+
* `text/event-stream`. This module provides a fetch-based SSE reader (so it can
|
|
7
|
+
* carry the `Authorization` bearer and run under Node) plus the typed message
|
|
8
|
+
* and error shapes the stream emits.
|
|
9
|
+
*
|
|
10
|
+
* The stream carries the resume cursor in the JSON `data.cursor` payload, not in
|
|
11
|
+
* SSE `id:` / `Last-Event-ID` (the registry does not use native EventSource
|
|
12
|
+
* resume in 3.x). Consumers persist `data.cursor` and reconnect with `?cursor=`.
|
|
13
|
+
*/
|
|
14
|
+
import type { FeedResponse, FeedFreshness } from './types.generated';
|
|
15
|
+
/** Query parameters for `GET /api/registry/feed/stream`. */
|
|
16
|
+
export interface FeedStreamQuery {
|
|
17
|
+
/** Resume after this event id. Omit to start at the beginning of retention. */
|
|
18
|
+
cursor?: string;
|
|
19
|
+
/** Comma-separated event type filters with glob support (e.g. `authorization.*`). */
|
|
20
|
+
types?: string;
|
|
21
|
+
/** Max events per SSE feed page (default 100, max 10,000). */
|
|
22
|
+
limit?: number;
|
|
23
|
+
/** Server-side interval while caught up (5–60s, default 15). Backlog pages are sent without waiting. */
|
|
24
|
+
pollIntervalSeconds?: number;
|
|
25
|
+
}
|
|
26
|
+
/** `heartbeat` event payload. Emitted while caught up; does not advance the cursor. */
|
|
27
|
+
export interface FeedHeartbeat {
|
|
28
|
+
generated_at: string;
|
|
29
|
+
cursor: string | null;
|
|
30
|
+
freshness?: FeedFreshness;
|
|
31
|
+
}
|
|
32
|
+
/** `error` event payload. Sent once before the server closes the stream. */
|
|
33
|
+
export interface FeedStreamErrorData {
|
|
34
|
+
/** e.g. `cursor_expired`, `feed_stream_error`. */
|
|
35
|
+
error: string;
|
|
36
|
+
message?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A typed message decoded from the SSE stream.
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* Registry-supplied strings (event payloads, `freshness`, `error.message`) are
|
|
43
|
+
* untrusted input. Sanitize before logging them or injecting them into LLM
|
|
44
|
+
* prompts/instructions or other executable context.
|
|
45
|
+
*/
|
|
46
|
+
export type FeedStreamMessage = {
|
|
47
|
+
type: 'feed';
|
|
48
|
+
page: FeedResponse;
|
|
49
|
+
} | {
|
|
50
|
+
type: 'heartbeat';
|
|
51
|
+
heartbeat: FeedHeartbeat;
|
|
52
|
+
} | {
|
|
53
|
+
type: 'error';
|
|
54
|
+
error: FeedStreamErrorData;
|
|
55
|
+
};
|
|
56
|
+
/** Base class for feed-stream transport failures. */
|
|
57
|
+
export declare class FeedStreamError extends Error {
|
|
58
|
+
constructor(message: string);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The stream endpoint is unavailable (404/406/501) or did not return an event
|
|
62
|
+
* stream (proxy returned HTML/JSON). Callers in `auto` mode fall back to polling.
|
|
63
|
+
*/
|
|
64
|
+
export declare class FeedStreamUnsupportedError extends FeedStreamError {
|
|
65
|
+
readonly status: number | undefined;
|
|
66
|
+
constructor(message: string, status?: number);
|
|
67
|
+
}
|
|
68
|
+
/** The initial cursor is expired (HTTP 410). Callers re-bootstrap then resume. */
|
|
69
|
+
export declare class FeedStreamCursorExpiredError extends FeedStreamError {
|
|
70
|
+
constructor(message: string);
|
|
71
|
+
}
|
|
72
|
+
/** A non-success HTTP status that is neither unsupported nor cursor-expired (e.g. 429, 500). */
|
|
73
|
+
export declare class FeedStreamHttpError extends FeedStreamError {
|
|
74
|
+
readonly status: number;
|
|
75
|
+
constructor(message: string, status: number);
|
|
76
|
+
}
|
|
77
|
+
/** A feed/heartbeat/error frame carried data that was not valid JSON or had the wrong shape. */
|
|
78
|
+
export declare class FeedStreamParseError extends FeedStreamError {
|
|
79
|
+
constructor(message: string);
|
|
80
|
+
}
|
|
81
|
+
interface SseEvent {
|
|
82
|
+
event: string;
|
|
83
|
+
data: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Default cap on a single un-dispatched SSE event before the parser fails
|
|
87
|
+
* closed. Measured in UTF-16 code units (an approximate byte bound — JS string
|
|
88
|
+
* length, which tracks heap cost). Generous enough for a full feed page (the
|
|
89
|
+
* JSON feed endpoint caps responses at ~2 MiB) while bounding memory against a
|
|
90
|
+
* hostile or buggy stream that never emits a blank line.
|
|
91
|
+
*/
|
|
92
|
+
export declare const DEFAULT_MAX_SSE_FRAME_BYTES: number;
|
|
93
|
+
/**
|
|
94
|
+
* Parse an SSE byte stream into events. Follows the WHATWG event-stream rules:
|
|
95
|
+
* comments (`:`-prefixed) are ignored, `data` lines accumulate (joined by `\n`),
|
|
96
|
+
* a blank line dispatches the buffered event, and a final block with no trailing
|
|
97
|
+
* blank line is dropped as incomplete (so a partially-transferred page is never
|
|
98
|
+
* surfaced).
|
|
99
|
+
*
|
|
100
|
+
* The in-progress line plus accumulated `data` lines for a single event are
|
|
101
|
+
* bounded by `maxFrameBytes`; a stream that exceeds it (no line terminator, or
|
|
102
|
+
* an unbounded run of `data:` lines before a blank line) throws
|
|
103
|
+
* {@link FeedStreamParseError} rather than growing memory without limit — the
|
|
104
|
+
* JSON feed path enforces the same fail-closed posture via its body-size cap.
|
|
105
|
+
*
|
|
106
|
+
* Parsing is O(n) regardless of how the bytes are chunked: each decoded chunk is
|
|
107
|
+
* scanned once, and an un-terminated line is held as a list of fragments joined
|
|
108
|
+
* only when it completes — never re-scanning or re-flattening a growing buffer.
|
|
109
|
+
*/
|
|
110
|
+
export declare function parseSseStream(source: AsyncIterable<Uint8Array> | ReadableStream<Uint8Array>, options?: {
|
|
111
|
+
maxFrameBytes?: number;
|
|
112
|
+
}): AsyncGenerator<SseEvent>;
|
|
113
|
+
/**
|
|
114
|
+
* Escape control characters and bound the length of a registry-supplied string
|
|
115
|
+
* before it is embedded in an Error message or logged. Registry/proxy text is
|
|
116
|
+
* untrusted input — left raw it is a log-injection / terminal-spoofing vector
|
|
117
|
+
* (and the repo treats registry strings as untrusted everywhere else). Mirrors
|
|
118
|
+
* the JSON client's `preview()`.
|
|
119
|
+
*/
|
|
120
|
+
export declare function sanitizeStreamText(text: string, maxChars?: number): string;
|
|
121
|
+
export interface OpenFeedStreamOptions {
|
|
122
|
+
fetchImpl: typeof globalThis.fetch;
|
|
123
|
+
baseUrl: string;
|
|
124
|
+
apiKey: string;
|
|
125
|
+
query?: FeedStreamQuery;
|
|
126
|
+
/**
|
|
127
|
+
* Redirect policy for the stream fetch. Defaults to `'error'`, which prevents
|
|
128
|
+
* the `Authorization` bearer from being replayed to a redirect target. Set
|
|
129
|
+
* `'follow'` only with a fully trusted `baseUrl` — fetch may forward the bearer
|
|
130
|
+
* to the redirect location.
|
|
131
|
+
*/
|
|
132
|
+
redirect?: 'follow' | 'error';
|
|
133
|
+
/** Cap on bytes buffered for a single un-dispatched SSE event. See {@link DEFAULT_MAX_SSE_FRAME_BYTES}. */
|
|
134
|
+
maxFrameBytes?: number;
|
|
135
|
+
signal?: AbortSignal;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Open the SSE feed stream and yield typed messages until the stream closes.
|
|
139
|
+
*
|
|
140
|
+
* Throws {@link FeedStreamCursorExpiredError} (410), {@link FeedStreamUnsupportedError}
|
|
141
|
+
* (404/406/501 or non-stream content-type), {@link FeedStreamHttpError} (other
|
|
142
|
+
* non-2xx), or {@link FeedStreamParseError} (malformed frame). Network/abort
|
|
143
|
+
* errors propagate from the underlying fetch.
|
|
144
|
+
*/
|
|
145
|
+
export declare function openFeedStream(opts: OpenFeedStreamOptions): AsyncGenerator<FeedStreamMessage>;
|
|
146
|
+
export {};
|
|
147
|
+
//# sourceMappingURL=feed-stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feed-stream.d.ts","sourceRoot":"","sources":["../../../src/lib/registry/feed-stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAErE,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAA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UAAU,QAAQ;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAmED;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,QAAmB,CAAC;AAE5D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAuB,cAAc,CACnC,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,cAAc,CAAC,UAAU,CAAC,EAC9D,OAAO,CAAC,EAAE;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,GACnC,cAAc,CAAC,QAAQ,CAAC,CAsD1B;AA8CD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,SAA0B,GAAG,MAAM,CAK3F;AAmED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC9B,2GAA2G;IAC3G,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAuB,cAAc,CAAC,IAAI,EAAE,qBAAqB,GAAG,cAAc,CAAC,iBAAiB,CAAC,CAyCpG"}
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Server-Sent Events transport for the registry change feed
|
|
4
|
+
* (`GET /api/registry/feed/stream`, adcp#5733).
|
|
5
|
+
*
|
|
6
|
+
* Generated OpenAPI types alone are not enough because the response is
|
|
7
|
+
* `text/event-stream`. This module provides a fetch-based SSE reader (so it can
|
|
8
|
+
* carry the `Authorization` bearer and run under Node) plus the typed message
|
|
9
|
+
* and error shapes the stream emits.
|
|
10
|
+
*
|
|
11
|
+
* The stream carries the resume cursor in the JSON `data.cursor` payload, not in
|
|
12
|
+
* SSE `id:` / `Last-Event-ID` (the registry does not use native EventSource
|
|
13
|
+
* resume in 3.x). Consumers persist `data.cursor` and reconnect with `?cursor=`.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.DEFAULT_MAX_SSE_FRAME_BYTES = exports.FeedStreamParseError = exports.FeedStreamHttpError = exports.FeedStreamCursorExpiredError = exports.FeedStreamUnsupportedError = exports.FeedStreamError = void 0;
|
|
17
|
+
exports.parseSseStream = parseSseStream;
|
|
18
|
+
exports.sanitizeStreamText = sanitizeStreamText;
|
|
19
|
+
exports.openFeedStream = openFeedStream;
|
|
20
|
+
// ====== Errors ======
|
|
21
|
+
/** Base class for feed-stream transport failures. */
|
|
22
|
+
class FeedStreamError extends Error {
|
|
23
|
+
constructor(message) {
|
|
24
|
+
super(message);
|
|
25
|
+
this.name = 'FeedStreamError';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.FeedStreamError = FeedStreamError;
|
|
29
|
+
/**
|
|
30
|
+
* The stream endpoint is unavailable (404/406/501) or did not return an event
|
|
31
|
+
* stream (proxy returned HTML/JSON). Callers in `auto` mode fall back to polling.
|
|
32
|
+
*/
|
|
33
|
+
class FeedStreamUnsupportedError extends FeedStreamError {
|
|
34
|
+
status;
|
|
35
|
+
constructor(message, status) {
|
|
36
|
+
super(message);
|
|
37
|
+
this.name = 'FeedStreamUnsupportedError';
|
|
38
|
+
this.status = status;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.FeedStreamUnsupportedError = FeedStreamUnsupportedError;
|
|
42
|
+
/** The initial cursor is expired (HTTP 410). Callers re-bootstrap then resume. */
|
|
43
|
+
class FeedStreamCursorExpiredError extends FeedStreamError {
|
|
44
|
+
constructor(message) {
|
|
45
|
+
super(message);
|
|
46
|
+
this.name = 'FeedStreamCursorExpiredError';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.FeedStreamCursorExpiredError = FeedStreamCursorExpiredError;
|
|
50
|
+
/** A non-success HTTP status that is neither unsupported nor cursor-expired (e.g. 429, 500). */
|
|
51
|
+
class FeedStreamHttpError extends FeedStreamError {
|
|
52
|
+
status;
|
|
53
|
+
constructor(message, status) {
|
|
54
|
+
super(message);
|
|
55
|
+
this.name = 'FeedStreamHttpError';
|
|
56
|
+
this.status = status;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.FeedStreamHttpError = FeedStreamHttpError;
|
|
60
|
+
/** A feed/heartbeat/error frame carried data that was not valid JSON or had the wrong shape. */
|
|
61
|
+
class FeedStreamParseError extends FeedStreamError {
|
|
62
|
+
constructor(message) {
|
|
63
|
+
super(message);
|
|
64
|
+
this.name = 'FeedStreamParseError';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.FeedStreamParseError = FeedStreamParseError;
|
|
68
|
+
/**
|
|
69
|
+
* Apply one SSE line to the accumulation state. Returns an event to yield when a
|
|
70
|
+
* blank line dispatches a buffered event with data, else null. Follows the
|
|
71
|
+
* WHATWG rules: `:`-prefixed comments ignored, one leading space stripped from
|
|
72
|
+
* each value, `id`/`retry` ignored (the registry uses `data.cursor`, not
|
|
73
|
+
* Last-Event-ID).
|
|
74
|
+
*
|
|
75
|
+
* Throws {@link FeedStreamParseError} as soon as accumulated `data` exceeds
|
|
76
|
+
* `maxFrameBytes` — before the dispatching blank line — so an oversized frame is
|
|
77
|
+
* never yielded (or JSON-parsed downstream), even when the whole frame, blank
|
|
78
|
+
* line included, arrives in a single chunk.
|
|
79
|
+
*/
|
|
80
|
+
function feedLine(line, st, maxFrameBytes) {
|
|
81
|
+
if (line === '') {
|
|
82
|
+
const ev = st.dataLines.length > 0 ? { event: st.eventType || 'message', data: st.dataLines.join('\n') } : null;
|
|
83
|
+
st.dataLines = [];
|
|
84
|
+
st.dataBytes = 0;
|
|
85
|
+
st.eventType = '';
|
|
86
|
+
return ev;
|
|
87
|
+
}
|
|
88
|
+
if (line[0] === ':')
|
|
89
|
+
return null; // comment
|
|
90
|
+
const colon = line.indexOf(':');
|
|
91
|
+
const field = colon === -1 ? line : line.slice(0, colon);
|
|
92
|
+
let value = colon === -1 ? '' : line.slice(colon + 1);
|
|
93
|
+
if (value[0] === ' ')
|
|
94
|
+
value = value.slice(1);
|
|
95
|
+
if (field === 'event')
|
|
96
|
+
st.eventType = value;
|
|
97
|
+
else if (field === 'data') {
|
|
98
|
+
st.dataLines.push(value);
|
|
99
|
+
st.dataBytes += value.length;
|
|
100
|
+
if (st.dataBytes > maxFrameBytes) {
|
|
101
|
+
throw new FeedStreamParseError(`registry feed stream event exceeded ${maxFrameBytes} bytes without dispatching`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
function asAsyncIterable(source) {
|
|
107
|
+
if (Symbol.asyncIterator in source) {
|
|
108
|
+
return source;
|
|
109
|
+
}
|
|
110
|
+
const reader = source.getReader();
|
|
111
|
+
return {
|
|
112
|
+
[Symbol.asyncIterator]() {
|
|
113
|
+
return {
|
|
114
|
+
async next() {
|
|
115
|
+
const { done, value } = await reader.read();
|
|
116
|
+
return done ? { done: true, value: undefined } : { done: false, value: value };
|
|
117
|
+
},
|
|
118
|
+
async return() {
|
|
119
|
+
await reader.cancel().catch(() => { });
|
|
120
|
+
reader.releaseLock();
|
|
121
|
+
return { done: true, value: undefined };
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Default cap on a single un-dispatched SSE event before the parser fails
|
|
129
|
+
* closed. Measured in UTF-16 code units (an approximate byte bound — JS string
|
|
130
|
+
* length, which tracks heap cost). Generous enough for a full feed page (the
|
|
131
|
+
* JSON feed endpoint caps responses at ~2 MiB) while bounding memory against a
|
|
132
|
+
* hostile or buggy stream that never emits a blank line.
|
|
133
|
+
*/
|
|
134
|
+
exports.DEFAULT_MAX_SSE_FRAME_BYTES = 16 * 1024 * 1024;
|
|
135
|
+
/**
|
|
136
|
+
* Parse an SSE byte stream into events. Follows the WHATWG event-stream rules:
|
|
137
|
+
* comments (`:`-prefixed) are ignored, `data` lines accumulate (joined by `\n`),
|
|
138
|
+
* a blank line dispatches the buffered event, and a final block with no trailing
|
|
139
|
+
* blank line is dropped as incomplete (so a partially-transferred page is never
|
|
140
|
+
* surfaced).
|
|
141
|
+
*
|
|
142
|
+
* The in-progress line plus accumulated `data` lines for a single event are
|
|
143
|
+
* bounded by `maxFrameBytes`; a stream that exceeds it (no line terminator, or
|
|
144
|
+
* an unbounded run of `data:` lines before a blank line) throws
|
|
145
|
+
* {@link FeedStreamParseError} rather than growing memory without limit — the
|
|
146
|
+
* JSON feed path enforces the same fail-closed posture via its body-size cap.
|
|
147
|
+
*
|
|
148
|
+
* Parsing is O(n) regardless of how the bytes are chunked: each decoded chunk is
|
|
149
|
+
* scanned once, and an un-terminated line is held as a list of fragments joined
|
|
150
|
+
* only when it completes — never re-scanning or re-flattening a growing buffer.
|
|
151
|
+
*/
|
|
152
|
+
async function* parseSseStream(source, options) {
|
|
153
|
+
const maxFrameBytes = options?.maxFrameBytes ?? exports.DEFAULT_MAX_SSE_FRAME_BYTES;
|
|
154
|
+
const decoder = new TextDecoder();
|
|
155
|
+
const st = { dataLines: [], dataBytes: 0, eventType: '' };
|
|
156
|
+
// Fragments of the current un-terminated line, spanning chunks; joined once
|
|
157
|
+
// when the line completes.
|
|
158
|
+
let lineFragments = [];
|
|
159
|
+
let lineFragmentsLen = 0;
|
|
160
|
+
// A `\r` ended the previous chunk; a leading `\n` here is the LF of that CRLF
|
|
161
|
+
// and must be skipped (the line already terminated at the `\r`).
|
|
162
|
+
let skipLeadingLF = false;
|
|
163
|
+
for await (const chunk of asAsyncIterable(source)) {
|
|
164
|
+
const c = decoder.decode(chunk, { stream: true });
|
|
165
|
+
if (c.length === 0)
|
|
166
|
+
continue;
|
|
167
|
+
let pos = 0;
|
|
168
|
+
if (skipLeadingLF) {
|
|
169
|
+
if (c[0] === '\n')
|
|
170
|
+
pos = 1;
|
|
171
|
+
skipLeadingLF = false;
|
|
172
|
+
}
|
|
173
|
+
while (pos < c.length) {
|
|
174
|
+
// Scan only this (small) chunk for the next terminator — never the
|
|
175
|
+
// accumulated frame — so indexing stays on a flat, short string.
|
|
176
|
+
let j = pos;
|
|
177
|
+
while (j < c.length && c[j] !== '\n' && c[j] !== '\r')
|
|
178
|
+
j += 1;
|
|
179
|
+
if (j === c.length)
|
|
180
|
+
break; // no terminator in the rest of this chunk
|
|
181
|
+
lineFragments.push(c.slice(pos, j));
|
|
182
|
+
const line = lineFragments.length === 1 ? lineFragments[0] : lineFragments.join('');
|
|
183
|
+
lineFragments = [];
|
|
184
|
+
lineFragmentsLen = 0;
|
|
185
|
+
const ev = feedLine(line, st, maxFrameBytes);
|
|
186
|
+
if (ev)
|
|
187
|
+
yield ev;
|
|
188
|
+
if (c[j] === '\r') {
|
|
189
|
+
if (j === c.length - 1) {
|
|
190
|
+
skipLeadingLF = true; // defer the CRLF check to the next chunk
|
|
191
|
+
pos = c.length;
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
pos = c[j + 1] === '\n' ? j + 2 : j + 1;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
pos = j + 1;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (pos < c.length) {
|
|
202
|
+
const tail = c.slice(pos);
|
|
203
|
+
lineFragments.push(tail);
|
|
204
|
+
lineFragmentsLen += tail.length;
|
|
205
|
+
}
|
|
206
|
+
// Fail closed if a single un-dispatched event grows past the cap, whether
|
|
207
|
+
// from an unterminated line or an unbounded run of data lines.
|
|
208
|
+
if (lineFragmentsLen + st.dataBytes > maxFrameBytes) {
|
|
209
|
+
throw new FeedStreamParseError(`registry feed stream event exceeded ${maxFrameBytes} bytes without dispatching`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// ====== Frame → typed message ======
|
|
214
|
+
function parseJsonFrame(event, data) {
|
|
215
|
+
try {
|
|
216
|
+
return JSON.parse(data);
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
219
|
+
throw new FeedStreamParseError(`registry feed stream sent malformed JSON on '${event}' event`);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function toFeedStreamMessage(evt) {
|
|
223
|
+
switch (evt.event) {
|
|
224
|
+
case 'feed': {
|
|
225
|
+
const page = parseJsonFrame('feed', evt.data);
|
|
226
|
+
if (!page || typeof page !== 'object' || !Array.isArray(page.events)) {
|
|
227
|
+
throw new FeedStreamParseError("registry feed stream 'feed' event was not a feed page");
|
|
228
|
+
}
|
|
229
|
+
return { type: 'feed', page: page };
|
|
230
|
+
}
|
|
231
|
+
case 'heartbeat': {
|
|
232
|
+
const heartbeat = parseJsonFrame('heartbeat', evt.data);
|
|
233
|
+
if (!heartbeat || typeof heartbeat !== 'object') {
|
|
234
|
+
throw new FeedStreamParseError("registry feed stream 'heartbeat' event was not an object");
|
|
235
|
+
}
|
|
236
|
+
return { type: 'heartbeat', heartbeat: heartbeat };
|
|
237
|
+
}
|
|
238
|
+
case 'error': {
|
|
239
|
+
const error = parseJsonFrame('error', evt.data);
|
|
240
|
+
if (!error || typeof error !== 'object' || typeof error.error !== 'string') {
|
|
241
|
+
throw new FeedStreamParseError("registry feed stream 'error' event had no error code");
|
|
242
|
+
}
|
|
243
|
+
return { type: 'error', error: error };
|
|
244
|
+
}
|
|
245
|
+
default:
|
|
246
|
+
// Unknown / `message` events (e.g. comments-as-keepalive frames) are ignored.
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
// ====== Connection ======
|
|
251
|
+
const ERROR_BODY_LIMIT_BYTES = 64 * 1024;
|
|
252
|
+
const ERROR_MESSAGE_MAX_CHARS = 256;
|
|
253
|
+
/**
|
|
254
|
+
* Escape control characters and bound the length of a registry-supplied string
|
|
255
|
+
* before it is embedded in an Error message or logged. Registry/proxy text is
|
|
256
|
+
* untrusted input — left raw it is a log-injection / terminal-spoofing vector
|
|
257
|
+
* (and the repo treats registry strings as untrusted everywhere else). Mirrors
|
|
258
|
+
* the JSON client's `preview()`.
|
|
259
|
+
*/
|
|
260
|
+
function sanitizeStreamText(text, maxChars = ERROR_MESSAGE_MAX_CHARS) {
|
|
261
|
+
// Match C0 controls (\u0000-\u001f) and DEL (\u007f); built from a string so
|
|
262
|
+
// the source never carries raw control bytes.
|
|
263
|
+
const CONTROL = new RegExp('[\\u0000-\\u001f\\u007f]', 'g');
|
|
264
|
+
return text.slice(0, maxChars).replace(CONTROL, ch => `\\u${ch.charCodeAt(0).toString(16).padStart(4, '0')}`);
|
|
265
|
+
}
|
|
266
|
+
function buildStreamUrl(baseUrl, query) {
|
|
267
|
+
const params = new URLSearchParams();
|
|
268
|
+
if (query?.cursor)
|
|
269
|
+
params.set('cursor', query.cursor);
|
|
270
|
+
if (query?.types)
|
|
271
|
+
params.set('types', query.types);
|
|
272
|
+
if (query?.limit != null)
|
|
273
|
+
params.set('limit', String(query.limit));
|
|
274
|
+
if (query?.pollIntervalSeconds != null)
|
|
275
|
+
params.set('poll_interval_seconds', String(query.pollIntervalSeconds));
|
|
276
|
+
const qs = params.toString();
|
|
277
|
+
return `${baseUrl}/api/registry/feed/stream${qs ? `?${qs}` : ''}`;
|
|
278
|
+
}
|
|
279
|
+
/** Read at most `maxBytes` of a response body, then cancel — never buffers a hostile multi-GB error body. */
|
|
280
|
+
async function readBoundedText(res, maxBytes) {
|
|
281
|
+
const reader = res.body?.getReader();
|
|
282
|
+
if (!reader) {
|
|
283
|
+
// No stream (e.g. a mocked Response): fall back, but still bound the result.
|
|
284
|
+
const text = await res.text().catch(() => '');
|
|
285
|
+
return text.slice(0, maxBytes);
|
|
286
|
+
}
|
|
287
|
+
const chunks = [];
|
|
288
|
+
let total = 0;
|
|
289
|
+
try {
|
|
290
|
+
while (total < maxBytes) {
|
|
291
|
+
const { done, value } = await reader.read();
|
|
292
|
+
if (done)
|
|
293
|
+
break;
|
|
294
|
+
if (value) {
|
|
295
|
+
chunks.push(value);
|
|
296
|
+
total += value.byteLength;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
finally {
|
|
301
|
+
await reader.cancel().catch(() => { });
|
|
302
|
+
reader.releaseLock();
|
|
303
|
+
}
|
|
304
|
+
return new TextDecoder().decode(concatChunks(chunks)).slice(0, maxBytes);
|
|
305
|
+
}
|
|
306
|
+
function concatChunks(chunks) {
|
|
307
|
+
let total = 0;
|
|
308
|
+
for (const c of chunks)
|
|
309
|
+
total += c.byteLength;
|
|
310
|
+
const out = new Uint8Array(total);
|
|
311
|
+
let offset = 0;
|
|
312
|
+
for (const c of chunks) {
|
|
313
|
+
out.set(c, offset);
|
|
314
|
+
offset += c.byteLength;
|
|
315
|
+
}
|
|
316
|
+
return out;
|
|
317
|
+
}
|
|
318
|
+
async function readErrorMessage(res) {
|
|
319
|
+
try {
|
|
320
|
+
const trimmed = await readBoundedText(res, ERROR_BODY_LIMIT_BYTES);
|
|
321
|
+
try {
|
|
322
|
+
const body = JSON.parse(trimmed);
|
|
323
|
+
if (typeof body.message === 'string')
|
|
324
|
+
return sanitizeStreamText(body.message);
|
|
325
|
+
if (typeof body.error === 'string')
|
|
326
|
+
return sanitizeStreamText(body.error);
|
|
327
|
+
}
|
|
328
|
+
catch {
|
|
329
|
+
/* not JSON */
|
|
330
|
+
}
|
|
331
|
+
const tail = trimmed.trim();
|
|
332
|
+
return tail ? sanitizeStreamText(tail) : undefined;
|
|
333
|
+
}
|
|
334
|
+
catch {
|
|
335
|
+
return undefined;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Open the SSE feed stream and yield typed messages until the stream closes.
|
|
340
|
+
*
|
|
341
|
+
* Throws {@link FeedStreamCursorExpiredError} (410), {@link FeedStreamUnsupportedError}
|
|
342
|
+
* (404/406/501 or non-stream content-type), {@link FeedStreamHttpError} (other
|
|
343
|
+
* non-2xx), or {@link FeedStreamParseError} (malformed frame). Network/abort
|
|
344
|
+
* errors propagate from the underlying fetch.
|
|
345
|
+
*/
|
|
346
|
+
async function* openFeedStream(opts) {
|
|
347
|
+
const url = buildStreamUrl(opts.baseUrl, opts.query);
|
|
348
|
+
const res = await opts.fetchImpl(url, {
|
|
349
|
+
method: 'GET',
|
|
350
|
+
headers: { Accept: 'text/event-stream', Authorization: `Bearer ${opts.apiKey}` },
|
|
351
|
+
redirect: opts.redirect ?? 'error',
|
|
352
|
+
signal: opts.signal,
|
|
353
|
+
});
|
|
354
|
+
if (!res.ok) {
|
|
355
|
+
const message = await readErrorMessage(res);
|
|
356
|
+
if (res.status === 410) {
|
|
357
|
+
throw new FeedStreamCursorExpiredError(message ?? 'registry feed cursor expired');
|
|
358
|
+
}
|
|
359
|
+
if (res.status === 404 || res.status === 406 || res.status === 501) {
|
|
360
|
+
throw new FeedStreamUnsupportedError(`registry feed stream unsupported (HTTP ${res.status})${message ? `: ${message}` : ''}`, res.status);
|
|
361
|
+
}
|
|
362
|
+
throw new FeedStreamHttpError(`registry feed stream request failed (HTTP ${res.status})${message ? `: ${message}` : ''}`, res.status);
|
|
363
|
+
}
|
|
364
|
+
const contentType = res.headers.get('content-type') ?? '';
|
|
365
|
+
if (!contentType.includes('text/event-stream')) {
|
|
366
|
+
await res.body?.cancel?.().catch(() => { });
|
|
367
|
+
throw new FeedStreamUnsupportedError(`registry feed stream returned non-stream content-type: ${contentType || 'none'}`);
|
|
368
|
+
}
|
|
369
|
+
if (!res.body) {
|
|
370
|
+
throw new FeedStreamUnsupportedError('registry feed stream response had no body');
|
|
371
|
+
}
|
|
372
|
+
for await (const evt of parseSseStream(res.body, { maxFrameBytes: opts.maxFrameBytes })) {
|
|
373
|
+
const msg = toFeedStreamMessage(evt);
|
|
374
|
+
if (msg)
|
|
375
|
+
yield msg;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
//# sourceMappingURL=feed-stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feed-stream.js","sourceRoot":"","sources":["../../../src/lib/registry/feed-stream.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AA8LH,wCAyDC;AAqDD,gDAKC;AA4FD,wCAyCC;AA3YD,uBAAuB;AAEvB,qDAAqD;AACrD,MAAa,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AALD,0CAKC;AAED;;;GAGG;AACH,MAAa,0BAA2B,SAAQ,eAAe;IACpD,MAAM,CAAqB;IACpC,YAAY,OAAe,EAAE,MAAe;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAPD,gEAOC;AAED,kFAAkF;AAClF,MAAa,4BAA6B,SAAQ,eAAe;IAC/D,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAC;IAC7C,CAAC;CACF;AALD,oEAKC;AAED,gGAAgG;AAChG,MAAa,mBAAoB,SAAQ,eAAe;IAC7C,MAAM,CAAS;IACxB,YAAY,OAAe,EAAE,MAAc;QACzC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAPD,kDAOC;AAED,gGAAgG;AAChG,MAAa,oBAAqB,SAAQ,eAAe;IACvD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,I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6C,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAC1F,GAAG,CAAC,MAAM,CACX,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;IAC1D,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC;QAC/C,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAC3C,MAAM,IAAI,0BAA0B,CAClC,0DAA0D,WAAW,IAAI,MAAM,EAAE,CAClF,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QACd,MAAM,IAAI,0BAA0B,CAAC,2CAA2C,CAAC,CAAC;IACpF,CAAC;IAED,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC;QACxF,MAAM,GAAG,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,GAAG;YAAE,MAAM,GAAG,CAAC;IACrB,CAAC;AACH,CAAC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import type { ResolvedBrand, ResolvedProperty, RegistryClientConfig, SaveBrandRequest, SaveBrandResponse, ListBrandLogosOptions, ListBrandLogosResponse, SaveBrandLogoInput, SaveBrandLogoResponse, UploadBrandLogoInput, UploadBrandLogoResponse, SavePropertyRequest, SavePropertyResponse, BrandRegistryItem, PropertyRegistryItem, ValidationResult, DomainLookupResult, ListBrandsOptions, ListOptions, ListAgentsOptions, ListAgentsResponse, ListPublishersResponse, CreateAdagentsRequest, CreateAdagentsResponse, CommunityMirrorAdagentsConfig, CreateCommunityMirrorAdagentsConfig, CommunityMirrorAdagentsCatalog, PublishCommunityMirrorAdagentsResponse, ListCommunityMirrorAdagentsResponse, DeleteCommunityMirrorAdagentsResponse, PublisherPropertySelector, FindCompanyResult, FeedQuery, FeedResponse, AgentSearchQuery, AgentSearchResponse, CrawlRequestResponse, ListPoliciesQuery, ListPoliciesResponse, ResolvePolicyQuery, ResolvePolicyResponse, ResolvePoliciesBulkRequest, ResolvePoliciesBulkResponse, GetPolicyHistoryQuery, GetPolicyHistoryResponse, SavePolicyRequest, SavePolicyResponse, GetBrandHistoryQuery, GetBrandHistoryResponse, GetPropertyHistoryQuery, GetPropertyHistoryResponse, AgentComplianceDetail, OperatorLookupResult, PublisherLookupResult, GetAgentStoryboardStatusResponse, GetAgentStoryboardStatusBulkResponse } from './types';
|
|
2
|
-
|
|
1
|
+
import type { ResolvedBrand, BrandHierarchyResolution, ResolveBrandHierarchyOptions, ResolvedProperty, RegistryClientConfig, SaveBrandRequest, SaveBrandResponse, ListBrandLogosOptions, ListBrandLogosResponse, SaveBrandLogoInput, SaveBrandLogoResponse, UploadBrandLogoInput, UploadBrandLogoResponse, SavePropertyRequest, SavePropertyResponse, BrandRegistryItem, PropertyRegistryItem, ValidationResult, DomainLookupResult, ListBrandsOptions, ListOptions, ListAgentsOptions, ListAgentsResponse, ListPublishersResponse, CreateAdagentsRequest, CreateAdagentsResponse, CommunityMirrorAdagentsConfig, CreateCommunityMirrorAdagentsConfig, CommunityMirrorAdagentsCatalog, PublishCommunityMirrorAdagentsResponse, ListCommunityMirrorAdagentsResponse, DeleteCommunityMirrorAdagentsResponse, PublisherPropertySelector, FindCompanyResult, FeedQuery, FeedResponse, AgentSearchQuery, AgentSearchResponse, CrawlRequestResponse, ManagerRevalidationResponse, ListPoliciesQuery, ListPoliciesResponse, ResolvePolicyQuery, ResolvePolicyResponse, ResolvePoliciesBulkRequest, ResolvePoliciesBulkResponse, GetPolicyHistoryQuery, GetPolicyHistoryResponse, SavePolicyRequest, SavePolicyResponse, GetBrandHistoryQuery, GetBrandHistoryResponse, GetPropertyHistoryQuery, GetPropertyHistoryResponse, AgentComplianceDetail, OperatorLookupResult, PublisherLookupResult, GetAgentStoryboardStatusResponse, GetAgentStoryboardStatusBulkResponse } from './types';
|
|
2
|
+
import type { FeedStreamQuery, FeedStreamMessage } from './feed-stream';
|
|
3
|
+
export type { ResolvedBrand, BrandHierarchyResolution, BrandHierarchyBulkResolution, ResolveBrandHierarchyOptions, ResolvedProperty, PropertyInfo, RegistryClientConfig, SaveBrandRequest, SaveBrandResponse, BrandLogoReviewStatus, ApprovedBrandLogoAsset, PendingBrandLogoAsset, ReviewedBrandLogoAsset, BrandLogoAsset, ListBrandLogosOptions, ListBrandLogosResponse, SaveBrandLogoInput, SaveBrandLogoResponse, UploadBrandLogoInput, UploadBrandLogoResponse, SavePropertyRequest, SavePropertyResponse, BrandRegistryItem, PropertyRegistryItem, ValidationResult, FederatedAgentWithDetails, FederatedPublisher, DomainLookupResult, ListBrandsOptions, ListOptions, ListAgentsOptions, ListAgentsResponse, ListPublishersResponse, ValidateAdagentsRequest, CreateAdagentsRequest, CreateAdagentsResponse, AdagentsAuthorizedAgent, AdagentsCatalogFormat, AdagentsPlacementDefinition, AdagentsPlacementFormatReference, AdagentsPlacementFormatOption, AdagentsPlacementTag, CreatedAdagentsJson, CommunityMirrorAdagentsConfig, CreateCommunityMirrorAdagentsConfig, CommunityMirrorAdagentsCatalog, PublishCommunityMirrorAdagentsResponse, CommunityMirrorAdagentsSummary, ListCommunityMirrorAdagentsResponse, GetCommunityMirrorAdagentsResponse, PublishCommunityMirrorAdagentsRequest, PublishCommunityMirrorAdagentsError, DeleteCommunityMirrorAdagentsResponse, ValidateProductAuthorizationRequest, ExpandProductIdentifiersRequest, PublisherPropertySelector, CompanySearchResult, FindCompanyResult, FeedQuery, AgentSearchQuery, CrawlRequest, ManagerRevalidationRequest, ManagerRevalidationResponse, ListPoliciesQuery, ListPoliciesResponse, ResolvePolicyQuery, ResolvePolicyResponse, ResolvePoliciesBulkRequest, ResolvePoliciesBulkResponse, GetPolicyHistoryQuery, GetPolicyHistoryResponse, SavePolicyRequest, SavePolicyResponse, GetBrandHistoryQuery, GetBrandHistoryResponse, GetPropertyHistoryQuery, GetPropertyHistoryResponse, AgentComplianceDetail, StoryboardStatus, OperatorLookupResult, PublisherLookupResult, ComplianceChangedPayload, GetAgentStoryboardStatusResponse, GetAgentStoryboardStatusBulkResponse, } from './types';
|
|
3
4
|
export type { paths, operations, components, LocalizedName, PropertyIdentifier, RegistryError, AgentCompliance, AgentHealth, AgentStats, AgentCapabilities, PropertySummary, CatalogEvent, FeedResponse, AgentInventoryProfile, AgentSearchResult, AgentSearchResponse, CrawlRequestResponse, AuthorizationEntry, BrandActivity, PropertyActivity, PolicySummary, Policy, PolicyHistory, CommunityMirrorListResponse, CommunityMirrorSummary, CommunityMirrorGetResponse, CommunityMirrorAdagentsJson, CommunityMirrorPublishResponse, CommunityMirrorPublishError, CommunityMirrorPublishRequest, CommunityMirrorDeleteResponse, } from './types';
|
|
4
5
|
export { RegistrySync } from './sync';
|
|
5
|
-
export type { RegistrySyncConfig, RegistrySyncState, RegistrySyncEvents, AgentFilter } from './sync';
|
|
6
|
+
export type { RegistrySyncConfig, RegistrySyncState, RegistrySyncTransport, RegistrySyncEvents, AgentFilter, } from './sync';
|
|
7
|
+
export { openFeedStream, parseSseStream, sanitizeStreamText, DEFAULT_MAX_SSE_FRAME_BYTES, FeedStreamError, FeedStreamUnsupportedError, FeedStreamCursorExpiredError, FeedStreamHttpError, FeedStreamParseError, } from './feed-stream';
|
|
8
|
+
export type { FeedStreamQuery, FeedStreamMessage, FeedHeartbeat, FeedStreamErrorData, OpenFeedStreamOptions, } from './feed-stream';
|
|
9
|
+
export type { FeedFreshness } from './types.generated';
|
|
6
10
|
export { InMemoryCursorStore, FileCursorStore } from './cursor-store';
|
|
7
11
|
export type { CursorStore } from './cursor-store';
|
|
8
12
|
export { PropertyRegistry } from './property-registry';
|
|
@@ -39,6 +43,7 @@ export declare class RegistryClient {
|
|
|
39
43
|
private readonly hasCustomMaxBodyBytes;
|
|
40
44
|
private readonly redirect;
|
|
41
45
|
private readonly fetchImpl;
|
|
46
|
+
private readonly brandHierarchyCache;
|
|
42
47
|
constructor(config?: RegistryClientConfig);
|
|
43
48
|
/**
|
|
44
49
|
* Resolve a single domain to its canonical brand identity.
|
|
@@ -56,6 +61,20 @@ export declare class RegistryClient {
|
|
|
56
61
|
}): Promise<FindCompanyResult>;
|
|
57
62
|
/** Bulk resolve domains to their canonical brand identities (max 100). */
|
|
58
63
|
lookupBrands(domains: string[]): Promise<Record<string, ResolvedBrand | null>>;
|
|
64
|
+
/**
|
|
65
|
+
* Resolve a domain to its ordered corporate brand hierarchy.
|
|
66
|
+
*
|
|
67
|
+
* The returned `chain` is ordered from the resolved brand itself through each
|
|
68
|
+
* parent to the house brand. A 404 from the registry returns `null`.
|
|
69
|
+
*/
|
|
70
|
+
resolveBrandHierarchy(domain: string, options?: ResolveBrandHierarchyOptions): Promise<BrandHierarchyResolution | null>;
|
|
71
|
+
/**
|
|
72
|
+
* Resolve up to 100 domains to ordered corporate brand hierarchies.
|
|
73
|
+
*
|
|
74
|
+
* Results are keyed by the caller-supplied domain. Unknown domains map to
|
|
75
|
+
* `null`, matching `lookupBrands()`.
|
|
76
|
+
*/
|
|
77
|
+
resolveBrandHierarchies(domains: string[], options?: ResolveBrandHierarchyOptions): Promise<Record<string, BrandHierarchyResolution | null>>;
|
|
59
78
|
/** List brands in the registry with optional search and pagination. */
|
|
60
79
|
listBrands(options?: ListBrandsOptions): Promise<{
|
|
61
80
|
brands: BrandRegistryItem[];
|
|
@@ -386,6 +405,22 @@ export declare class RegistryClient {
|
|
|
386
405
|
* Requires authentication.
|
|
387
406
|
*/
|
|
388
407
|
getFeed(options?: FeedQuery): Promise<FeedResponse>;
|
|
408
|
+
/**
|
|
409
|
+
* Stream the registry change feed over Server-Sent Events
|
|
410
|
+
* (`GET /api/registry/feed/stream`).
|
|
411
|
+
*
|
|
412
|
+
* Yields typed `feed` / `heartbeat` / `error` messages until the stream
|
|
413
|
+
* closes. The connection is long-lived — no body-size cap or request timeout
|
|
414
|
+
* applies; pass an `AbortSignal` to close it. Cursor state lives in the `feed`
|
|
415
|
+
* page payloads: persist `page.cursor` and reconnect with `{ cursor }`.
|
|
416
|
+
*
|
|
417
|
+
* Requires authentication. Most consumers should use `RegistrySync` with
|
|
418
|
+
* `transport: 'auto'`, which layers reconnect, polling fallback, and
|
|
419
|
+
* cursor-expiry recovery on top of this method.
|
|
420
|
+
*/
|
|
421
|
+
streamFeed(query?: FeedStreamQuery, init?: {
|
|
422
|
+
signal?: AbortSignal;
|
|
423
|
+
}): AsyncGenerator<FeedStreamMessage>;
|
|
389
424
|
/**
|
|
390
425
|
* Search agents by inventory profile. Returns ranked results with match scores.
|
|
391
426
|
* All filters use AND logic across dimensions; multiple CSV values within a
|
|
@@ -401,6 +436,14 @@ export declare class RegistryClient {
|
|
|
401
436
|
* Requires authentication.
|
|
402
437
|
*/
|
|
403
438
|
requestCrawl(domain: string): Promise<CrawlRequestResponse>;
|
|
439
|
+
/**
|
|
440
|
+
* Request fan-out re-validation for publishers delegating to a manager domain.
|
|
441
|
+
* Use after rotating a manager's adagents.json so MANAGERDOMAIN publishers
|
|
442
|
+
* are queued without waiting for the next routine crawl cycle.
|
|
443
|
+
*
|
|
444
|
+
* Requires authentication.
|
|
445
|
+
*/
|
|
446
|
+
requestManagerRevalidation(managerDomain: string): Promise<ManagerRevalidationResponse>;
|
|
404
447
|
/** List policies in the governance policy registry with optional filtering. */
|
|
405
448
|
listPolicies(params?: ListPoliciesQuery): Promise<ListPoliciesResponse>;
|
|
406
449
|
/** Resolve a single policy by ID. Optionally pin to a specific version. */
|
|
@@ -423,6 +466,12 @@ export declare class RegistryClient {
|
|
|
423
466
|
private normalizeBrandLogoList;
|
|
424
467
|
private toBrandLogoBlob;
|
|
425
468
|
private normalizeCommunityMirrorPlatform;
|
|
469
|
+
private brandHierarchyCacheKey;
|
|
470
|
+
private normalizeBrandHierarchyDomain;
|
|
471
|
+
private resolveBrandHierarchyCacheTtlMs;
|
|
472
|
+
private getCachedBrandHierarchy;
|
|
473
|
+
private setCachedBrandHierarchy;
|
|
474
|
+
private cloneBrandHierarchy;
|
|
426
475
|
private resolveCommunityMirrorPublishArgs;
|
|
427
476
|
private communityMirrorPlatformFromConfig;
|
|
428
477
|
private assertCommunityMirrorPropertiesMatchPlatform;
|