@tangle-network/agent-knowledge 1.2.0 → 1.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/AGENTS.md +36 -0
- package/README.md +95 -0
- package/dist/{chunk-TXNYP4WI.js → chunk-4PNXQ2NT.js} +1 -1
- package/dist/chunk-4PNXQ2NT.js.map +1 -0
- package/dist/{chunk-JLCQ6O7W.js → chunk-HKYD765Q.js} +574 -441
- package/dist/chunk-HKYD765Q.js.map +1 -0
- package/dist/chunk-WCYW2GDA.js +551 -0
- package/dist/chunk-WCYW2GDA.js.map +1 -0
- package/dist/chunk-YMKHCTS2.js +19 -0
- package/dist/chunk-YMKHCTS2.js.map +1 -0
- package/dist/cli.js +77 -34
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +686 -406
- package/dist/index.js +591 -168
- package/dist/index.js.map +1 -1
- package/dist/sources/index.d.ts +386 -0
- package/dist/sources/index.js +34 -0
- package/dist/sources/index.js.map +1 -0
- package/dist/{types-DTUp66Gr.d.ts → types-CAeh7Lwb.d.ts} +1 -1
- package/dist/viz/index.d.ts +1 -1
- package/dist/viz/index.js +1 -1
- package/package.json +18 -12
- package/dist/chunk-JLCQ6O7W.js.map +0 -1
- package/dist/chunk-TXNYP4WI.js.map +0 -1
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pluggable knowledge source contract.
|
|
3
|
+
*
|
|
4
|
+
* A `KnowledgeSource` is one external provider of authoritative content that
|
|
5
|
+
* an agent's knowledge base should track over time (e.g. Cornell LII US Code,
|
|
6
|
+
* IRS publications, a state secretary-of-state filing portal). It returns
|
|
7
|
+
* hashable, embed-ready `KnowledgeFragment`s plus enough provenance metadata
|
|
8
|
+
* for downstream consumers to:
|
|
9
|
+
*
|
|
10
|
+
* 1. detect change against a previous snapshot (see `./changes`)
|
|
11
|
+
* 2. score freshness on a per-source-id basis (see `./freshness`)
|
|
12
|
+
* 3. decide which evals to re-run when the underlying authority moves
|
|
13
|
+
* (the `dimensionHints` field is the binding contract for that decision)
|
|
14
|
+
*
|
|
15
|
+
* Sources MUST be pure with respect to local filesystem state outside the
|
|
16
|
+
* cache directory the caller hands them — they read remote authorities and
|
|
17
|
+
* return data. They MUST mark `verifiable: false` on any fragment they could
|
|
18
|
+
* not authenticate (block page, 4xx, parse failure) rather than silently
|
|
19
|
+
* substituting empty/partial content. The control loop downstream uses
|
|
20
|
+
* `verifiable` to refuse promotion of un-grounded content.
|
|
21
|
+
*
|
|
22
|
+
* @stable
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Per-fetch options the host (control loop / cron / CLI) passes in.
|
|
26
|
+
*
|
|
27
|
+
* `signal` lets the host abort long-running fetches (rate-limited authority,
|
|
28
|
+
* congested network). `cacheDir` is where the source SHOULD write its disk
|
|
29
|
+
* cache; an undefined value disables caching (useful in tests). `now` is
|
|
30
|
+
* injected for deterministic tests of change-detection windows.
|
|
31
|
+
*/
|
|
32
|
+
interface FetchOpts {
|
|
33
|
+
/** Abort signal forwarded to the underlying HTTP fetcher. */
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
/** Absolute path under which the source may cache raw bytes. */
|
|
36
|
+
cacheDir?: string;
|
|
37
|
+
/** Clock injection for deterministic tests. */
|
|
38
|
+
now?: () => Date;
|
|
39
|
+
/**
|
|
40
|
+
* Maximum number of authority pages the source should fetch in this call.
|
|
41
|
+
* Sources MUST respect this bound — exhaustively crawling Cornell LII on
|
|
42
|
+
* every cron tick would be both rude and slow. Default is source-specific.
|
|
43
|
+
*/
|
|
44
|
+
limit?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Source-specific selector string. Examples:
|
|
47
|
+
* - cornell-lii: `'uscode/text/18/1836'` or `'wex/non-compete'`
|
|
48
|
+
* - irs-publications: `'index'` or `'p15'`
|
|
49
|
+
* - state-sos: opaque, see `StateSosSourceConfig`
|
|
50
|
+
*
|
|
51
|
+
* Sources that don't need a selector ignore this field.
|
|
52
|
+
*/
|
|
53
|
+
selector?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The standard provenance shape every fragment carries. Kept separate from
|
|
57
|
+
* `KnowledgeFragment` so freshness/change code can pass it around without
|
|
58
|
+
* also dragging the body text.
|
|
59
|
+
*/
|
|
60
|
+
interface FragmentProvenance {
|
|
61
|
+
/** Canonical URL the fragment was extracted from. */
|
|
62
|
+
url: string;
|
|
63
|
+
/**
|
|
64
|
+
* Source-attested timestamp: the time the AUTHORITY last updated this
|
|
65
|
+
* content, as reported by the source (Last-Modified header, in-page
|
|
66
|
+
* effective date, registry generated-at, etc). Falls back to the fetch
|
|
67
|
+
* time only when the authority publishes no timestamp.
|
|
68
|
+
*/
|
|
69
|
+
sourceUpdatedAt: string;
|
|
70
|
+
/** ISO timestamp the fragment was fetched. */
|
|
71
|
+
fetchedAt: string;
|
|
72
|
+
/**
|
|
73
|
+
* Jurisdiction the content is binding within, if applicable. Use ISO
|
|
74
|
+
* country code, US state abbreviation, or 'US-FED' for federal scope.
|
|
75
|
+
* Statute sources MUST populate this; reference / encyclopedia sources
|
|
76
|
+
* MAY leave it undefined.
|
|
77
|
+
*/
|
|
78
|
+
jurisdiction?: string;
|
|
79
|
+
/**
|
|
80
|
+
* True iff the source could authenticate the fetched content (HTTP 200,
|
|
81
|
+
* expected selectors present, parse succeeded). False on any block page,
|
|
82
|
+
* rate-limit response, 4xx/5xx, or selector miss. Consumers MUST refuse
|
|
83
|
+
* to promote `verifiable: false` fragments into citable knowledge.
|
|
84
|
+
*/
|
|
85
|
+
verifiable: boolean;
|
|
86
|
+
/** If `verifiable === false`, the reason — surfaced to operators. */
|
|
87
|
+
unverifiableReason?: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* One unit of authoritative content. Stable hash on `(id, body)` lets change
|
|
91
|
+
* detection reason about identity across snapshots.
|
|
92
|
+
*/
|
|
93
|
+
interface KnowledgeFragment {
|
|
94
|
+
/**
|
|
95
|
+
* Stable identity within (sourceId, selector-space). Two fetches against
|
|
96
|
+
* the same authority section MUST produce the same `id`. The (sourceId,
|
|
97
|
+
* id) pair is the primary key for change detection.
|
|
98
|
+
*/
|
|
99
|
+
id: string;
|
|
100
|
+
/** Free-form title — section heading, publication name, etc. */
|
|
101
|
+
title: string;
|
|
102
|
+
/** Body text, normalised: no HTML tags, line breaks preserved. */
|
|
103
|
+
body: string;
|
|
104
|
+
/** SHA-256 of `body`. Pre-computed so consumers don't re-hash on diff. */
|
|
105
|
+
bodyHash: string;
|
|
106
|
+
provenance: FragmentProvenance;
|
|
107
|
+
/**
|
|
108
|
+
* Eval dimensions an agent-eval campaign should re-score when this
|
|
109
|
+
* fragment changes. Examples: `citation_hygiene`, `jurisdictional_accuracy`,
|
|
110
|
+
* `tax_compliance`, `regulatory_currency`. The eval cron treats this as a
|
|
111
|
+
* set, not a contract — adding a new dimension is non-breaking.
|
|
112
|
+
*
|
|
113
|
+
* This is the load-bearing field for the continuous-ingestion story: a
|
|
114
|
+
* Ryan-LLC-style ruling vacates the FTC non-compete rule → the source
|
|
115
|
+
* returns a fragment with `jurisdictional_accuracy` in this list →
|
|
116
|
+
* `detectChanges()` emits a `KnowledgeChange` carrying that hint → the
|
|
117
|
+
* cron knows exactly which agent-eval campaigns to re-run.
|
|
118
|
+
*/
|
|
119
|
+
dimensionHints: string[];
|
|
120
|
+
/** Arbitrary source-specific metadata for debugging / connector wiring. */
|
|
121
|
+
metadata?: Record<string, unknown>;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* One pluggable knowledge source.
|
|
125
|
+
*
|
|
126
|
+
* Implementations: see `./cornell-lii`, `./irs-publications`, `./state-sos`.
|
|
127
|
+
* To author a new source, follow the same shape and register it in your
|
|
128
|
+
* application's source list — there is no global registry by design (per
|
|
129
|
+
* the per-tenant isolation contract; see README).
|
|
130
|
+
*/
|
|
131
|
+
interface KnowledgeSource {
|
|
132
|
+
/** Stable id — used to key freshness state. MUST NOT change once shipped. */
|
|
133
|
+
id: string;
|
|
134
|
+
/** Human-readable name for dashboards. */
|
|
135
|
+
name: string;
|
|
136
|
+
/** One-sentence description: what authority + scope. */
|
|
137
|
+
description: string;
|
|
138
|
+
/**
|
|
139
|
+
* Pull fragments for this source. Sources MUST:
|
|
140
|
+
* - rate-limit themselves (>=1 req/sec per source by convention)
|
|
141
|
+
* - send a polite User-Agent
|
|
142
|
+
* - cache to disk when `opts.cacheDir` is set
|
|
143
|
+
* - mark `verifiable: false` rather than throwing on parse/block
|
|
144
|
+
* - honour `opts.signal`
|
|
145
|
+
* - honour `opts.limit`
|
|
146
|
+
*/
|
|
147
|
+
fetch(opts: FetchOpts): Promise<KnowledgeFragment[]>;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
interface CornellLiiSelector {
|
|
151
|
+
/** Either 'uscode' or 'wex'. */
|
|
152
|
+
kind: 'uscode' | 'wex';
|
|
153
|
+
/**
|
|
154
|
+
* For `uscode`: `<title>/<section>` (e.g. `'18/1836'` for DTSA).
|
|
155
|
+
* For `wex`: the slug (e.g. `'non-compete'`).
|
|
156
|
+
*/
|
|
157
|
+
path: string;
|
|
158
|
+
/**
|
|
159
|
+
* Optional pre-declared eval dimensions affected by this section. If
|
|
160
|
+
* omitted, defaults are chosen from `kind` + path heuristics.
|
|
161
|
+
*/
|
|
162
|
+
dimensionHints?: string[];
|
|
163
|
+
}
|
|
164
|
+
interface CornellLiiSourceOptions {
|
|
165
|
+
/**
|
|
166
|
+
* Selectors to fetch on each `fetch()` call. The caller (a per-tenant
|
|
167
|
+
* workspace config, typically) lists exactly the authorities they need
|
|
168
|
+
* tracked. There is no auto-discovery; that would crawl Cornell at
|
|
169
|
+
* cron speed, which is what the polite-fetch contract exists to avoid.
|
|
170
|
+
*/
|
|
171
|
+
selectors: CornellLiiSelector[];
|
|
172
|
+
/** Source id override; default is `'cornell-lii'`. */
|
|
173
|
+
id?: string;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Build a Cornell LII source for the listed selectors.
|
|
177
|
+
*
|
|
178
|
+
* Example: track DTSA + non-compete:
|
|
179
|
+
* ```
|
|
180
|
+
* createCornellLiiSource({
|
|
181
|
+
* selectors: [
|
|
182
|
+
* { kind: 'uscode', path: '18/1836' },
|
|
183
|
+
* { kind: 'wex', path: 'non-compete', dimensionHints: ['jurisdictional_accuracy'] },
|
|
184
|
+
* ],
|
|
185
|
+
* })
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
declare function createCornellLiiSource(options: CornellLiiSourceOptions): KnowledgeSource;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Minimal HTML helpers used by the shipped sources.
|
|
192
|
+
*
|
|
193
|
+
* Deliberately not a full DOM parser: every authority we ship against
|
|
194
|
+
* (Cornell LII, IRS.gov, state SOS portals) has well-behaved server-rendered
|
|
195
|
+
* HTML where regex-based extraction is correct and cheap. Bringing in cheerio
|
|
196
|
+
* would add a 1.5MB dependency to a package whose purpose is shipping
|
|
197
|
+
* primitives, not parsing arbitrary web pages.
|
|
198
|
+
*
|
|
199
|
+
* If a future source needs real DOM traversal, it should depend on its own
|
|
200
|
+
* parser locally rather than promoting one into the package-wide deps.
|
|
201
|
+
*
|
|
202
|
+
* @stable
|
|
203
|
+
*/
|
|
204
|
+
/**
|
|
205
|
+
* Strip HTML tags, collapse whitespace, decode common entities.
|
|
206
|
+
*
|
|
207
|
+
* Preserves paragraph and line breaks (`</p>`, `<br>`, `</li>`, `</div>`,
|
|
208
|
+
* `</h*>`) as `\n` so statute text retains its subsection structure.
|
|
209
|
+
*/
|
|
210
|
+
declare function htmlToText(html: string): string;
|
|
211
|
+
/** Extract the first match of a regex's first capture group, or undefined. */
|
|
212
|
+
declare function firstMatch(html: string, pattern: RegExp): string | undefined;
|
|
213
|
+
/** Extract the inner HTML of the first matching tag with id `id`. */
|
|
214
|
+
declare function innerHtmlById(html: string, id: string): string | undefined;
|
|
215
|
+
/**
|
|
216
|
+
* Extract every (href, text) pair matching the URL regex.
|
|
217
|
+
* Returns absolute URLs by resolving against `baseUrl`.
|
|
218
|
+
*/
|
|
219
|
+
declare function extractLinks(html: string, hrefPattern: RegExp, baseUrl: string): {
|
|
220
|
+
href: string;
|
|
221
|
+
text: string;
|
|
222
|
+
}[];
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Polite HTTP fetcher used by every shipped source.
|
|
226
|
+
*
|
|
227
|
+
* Three invariants this enforces — each was a bug found while wiring real
|
|
228
|
+
* authorities; do not regress:
|
|
229
|
+
*
|
|
230
|
+
* 1. Per-host throttling. Cornell LII serves under 1 req/s/origin
|
|
231
|
+
* politely and will start serving block pages above that. The lock
|
|
232
|
+
* is per-host (`hostThrottle`) rather than per-source so that two
|
|
233
|
+
* independent sources targeting the same authority still cooperate.
|
|
234
|
+
*
|
|
235
|
+
* 2. On-disk content cache keyed by URL. Production sources are called
|
|
236
|
+
* from a cron loop; without a cache, every run re-hits the same
|
|
237
|
+
* pages and inflates change-detection false-positives (the authority
|
|
238
|
+
* occasionally serves slightly different boilerplate). The cache is
|
|
239
|
+
* content-addressed by URL, not by ETag — authorities like IRS.gov
|
|
240
|
+
* do not consistently send ETag/Last-Modified.
|
|
241
|
+
*
|
|
242
|
+
* 3. Block-page detection on success. A 200 with a captcha body still
|
|
243
|
+
* means "we couldn't authenticate." Sources downstream rely on
|
|
244
|
+
* `verifiable` to refuse promotion — losing that signal because the
|
|
245
|
+
* fetcher said "well, the status code was 200" is the bug class
|
|
246
|
+
* this exists to prevent.
|
|
247
|
+
*
|
|
248
|
+
* @stable
|
|
249
|
+
*/
|
|
250
|
+
/** User-Agent string sent on every outbound request. */
|
|
251
|
+
declare const POLITE_USER_AGENT = "agent-knowledge/0.2.0 (+https://github.com/tangle-network/agent-knowledge)";
|
|
252
|
+
/** Minimum gap between successive requests to the same origin (ms). */
|
|
253
|
+
declare const MIN_REQUEST_GAP_MS = 1000;
|
|
254
|
+
/** Maximum response body we will buffer in memory (bytes). */
|
|
255
|
+
declare const MAX_RESPONSE_BYTES: number;
|
|
256
|
+
interface PoliteFetchOptions {
|
|
257
|
+
signal?: AbortSignal;
|
|
258
|
+
cacheDir?: string;
|
|
259
|
+
/**
|
|
260
|
+
* Cache age beyond which we re-fetch. Default 1 hour — long enough to
|
|
261
|
+
* batch a cron sweep across many selectors, short enough that hourly
|
|
262
|
+
* authoritative-page changes get picked up next tick.
|
|
263
|
+
*/
|
|
264
|
+
cacheTtlMs?: number;
|
|
265
|
+
/**
|
|
266
|
+
* Extra request headers. The fetcher always sets `User-Agent` and
|
|
267
|
+
* `Accept`; callers can add `Accept-Language` etc.
|
|
268
|
+
*/
|
|
269
|
+
headers?: Record<string, string>;
|
|
270
|
+
}
|
|
271
|
+
interface PoliteFetchResult {
|
|
272
|
+
url: string;
|
|
273
|
+
status: number;
|
|
274
|
+
/** Decoded UTF-8 body. Truncated to `MAX_RESPONSE_BYTES`. */
|
|
275
|
+
body: string;
|
|
276
|
+
/**
|
|
277
|
+
* Best-effort source-attested timestamp. Reads `Last-Modified`,
|
|
278
|
+
* falling back to `Date`, falling back to fetch time. Always ISO 8601.
|
|
279
|
+
*/
|
|
280
|
+
sourceUpdatedAt: string;
|
|
281
|
+
fetchedAt: string;
|
|
282
|
+
/** True iff the response was satisfied from disk cache. */
|
|
283
|
+
fromCache: boolean;
|
|
284
|
+
/**
|
|
285
|
+
* False on: non-2xx status, captcha/block page heuristic match, or
|
|
286
|
+
* decoded body below 200 chars from a host known to serve real content
|
|
287
|
+
* (Cornell, IRS, state SOS). `unverifiableReason` carries the why.
|
|
288
|
+
*/
|
|
289
|
+
verifiable: boolean;
|
|
290
|
+
unverifiableReason?: string;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Fetch one URL with per-host throttling, on-disk cache, and block-page
|
|
294
|
+
* detection. Never throws on network/HTTP failure — returns a result with
|
|
295
|
+
* `verifiable: false` and `unverifiableReason` set so the caller can decide
|
|
296
|
+
* whether to skip, retry, or surface.
|
|
297
|
+
*
|
|
298
|
+
* Throws ONLY on `AbortError` (caller asked to stop) and on cache-write
|
|
299
|
+
* failures that indicate a misconfigured filesystem.
|
|
300
|
+
*/
|
|
301
|
+
declare function politeFetch(url: string, options?: PoliteFetchOptions): Promise<PoliteFetchResult>;
|
|
302
|
+
/** Reset the in-process throttle map. Test-only. */
|
|
303
|
+
declare function __resetHttpThrottle(): void;
|
|
304
|
+
/** Cheap heuristic that catches CAPTCHA, WAF block pages, and "Just a moment" interstitials. */
|
|
305
|
+
declare function looksLikeBlockPage(body: string): boolean;
|
|
306
|
+
|
|
307
|
+
interface IrsPublicationsSourceOptions {
|
|
308
|
+
/**
|
|
309
|
+
* Specific publication slugs to fetch (e.g. `['p15', 'p17', 'p463']`).
|
|
310
|
+
* When `includeIndex` is true (default), the publications index page is
|
|
311
|
+
* also fetched as a single fragment so change detection can notice
|
|
312
|
+
* year/revision shifts across the whole catalogue.
|
|
313
|
+
*/
|
|
314
|
+
publications?: string[];
|
|
315
|
+
/**
|
|
316
|
+
* Revenue procedure paths to fetch (e.g. `['/irb/2024-31_IRB']`). The
|
|
317
|
+
* caller passes the exact path; this source does not auto-discover.
|
|
318
|
+
*/
|
|
319
|
+
revenueProcedures?: string[];
|
|
320
|
+
includeIndex?: boolean;
|
|
321
|
+
id?: string;
|
|
322
|
+
}
|
|
323
|
+
/** Default eval dimensions for IRS-sourced fragments. */
|
|
324
|
+
declare const IRS_DIMENSION_HINTS: string[];
|
|
325
|
+
declare function createIrsPublicationsSource(options?: IrsPublicationsSourceOptions): KnowledgeSource;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Generic Secretary-of-State source.
|
|
329
|
+
*
|
|
330
|
+
* Every US state SOS surfaces LLC/Corp formation requirements differently
|
|
331
|
+
* (CA via static forms pages, DE via division of corporations pages, TX
|
|
332
|
+
* via SOSDirect content pages). Rather than baking 50 state-specific
|
|
333
|
+
* parsers into this package, the source takes a config that names the URL
|
|
334
|
+
* pattern + CSS-equivalent selector + jurisdiction tag. Callers supply one
|
|
335
|
+
* config per state they need tracked.
|
|
336
|
+
*
|
|
337
|
+
* The selector is interpreted as a substring/regex of an HTML element id
|
|
338
|
+
* or class — see `StateSosSourceConfig` for the contract. This is
|
|
339
|
+
* intentionally minimal; richer extraction belongs in a state-specific
|
|
340
|
+
* adapter the consumer authors.
|
|
341
|
+
*
|
|
342
|
+
* @experimental Interface will likely grow as we add more state coverage.
|
|
343
|
+
*/
|
|
344
|
+
interface StateSosEntity {
|
|
345
|
+
/** Stable id for this fragment within the state (e.g. 'llc-formation', 'corp-formation'). */
|
|
346
|
+
id: string;
|
|
347
|
+
/** Path under the configured `baseUrl` for this entity. */
|
|
348
|
+
path: string;
|
|
349
|
+
/**
|
|
350
|
+
* Extraction selector. Choose one:
|
|
351
|
+
* - `{ kind: 'id', value: 'main-content' }` — innermost match of element with that id
|
|
352
|
+
* - `{ kind: 'class', value: 'field--name-body' }` — innermost match of element with that class
|
|
353
|
+
* - `{ kind: 'regex', value: /<article[\s\S]*?<\/article>/i }` — raw regex
|
|
354
|
+
* - `{ kind: 'whole' }` — full body, tags stripped (fallback for unstructured pages)
|
|
355
|
+
*/
|
|
356
|
+
selector: {
|
|
357
|
+
kind: 'id';
|
|
358
|
+
value: string;
|
|
359
|
+
} | {
|
|
360
|
+
kind: 'class';
|
|
361
|
+
value: string;
|
|
362
|
+
} | {
|
|
363
|
+
kind: 'regex';
|
|
364
|
+
value: RegExp;
|
|
365
|
+
} | {
|
|
366
|
+
kind: 'whole';
|
|
367
|
+
};
|
|
368
|
+
title: string;
|
|
369
|
+
/** Eval dimensions this entity feeds. */
|
|
370
|
+
dimensionHints?: string[];
|
|
371
|
+
}
|
|
372
|
+
interface StateSosSourceConfig {
|
|
373
|
+
/** US state postal code, e.g. 'CA', 'DE', 'TX'. */
|
|
374
|
+
state: string;
|
|
375
|
+
/** Base URL for the state SOS — e.g. 'https://www.sos.ca.gov'. */
|
|
376
|
+
baseUrl: string;
|
|
377
|
+
/** Entities this state exposes (LLC, Corp, etc). */
|
|
378
|
+
entities: StateSosEntity[];
|
|
379
|
+
/** Source id; default `state-sos:<state>`. */
|
|
380
|
+
id?: string;
|
|
381
|
+
/** Display name; default `<state> Secretary of State`. */
|
|
382
|
+
name?: string;
|
|
383
|
+
}
|
|
384
|
+
declare function createStateSosSource(config: StateSosSourceConfig): KnowledgeSource;
|
|
385
|
+
|
|
386
|
+
export { type CornellLiiSelector, type CornellLiiSourceOptions, type FetchOpts, type FragmentProvenance, IRS_DIMENSION_HINTS, type IrsPublicationsSourceOptions, type KnowledgeFragment, type KnowledgeSource, MAX_RESPONSE_BYTES, MIN_REQUEST_GAP_MS, POLITE_USER_AGENT, type PoliteFetchOptions, type PoliteFetchResult, type StateSosEntity, type StateSosSourceConfig, __resetHttpThrottle, createCornellLiiSource, createIrsPublicationsSource, createStateSosSource, extractLinks, firstMatch, htmlToText, innerHtmlById, looksLikeBlockPage, politeFetch };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IRS_DIMENSION_HINTS,
|
|
3
|
+
MAX_RESPONSE_BYTES,
|
|
4
|
+
MIN_REQUEST_GAP_MS,
|
|
5
|
+
POLITE_USER_AGENT,
|
|
6
|
+
__resetHttpThrottle,
|
|
7
|
+
createCornellLiiSource,
|
|
8
|
+
createIrsPublicationsSource,
|
|
9
|
+
createStateSosSource,
|
|
10
|
+
extractLinks,
|
|
11
|
+
firstMatch,
|
|
12
|
+
htmlToText,
|
|
13
|
+
innerHtmlById,
|
|
14
|
+
looksLikeBlockPage,
|
|
15
|
+
politeFetch
|
|
16
|
+
} from "../chunk-WCYW2GDA.js";
|
|
17
|
+
import "../chunk-YMKHCTS2.js";
|
|
18
|
+
export {
|
|
19
|
+
IRS_DIMENSION_HINTS,
|
|
20
|
+
MAX_RESPONSE_BYTES,
|
|
21
|
+
MIN_REQUEST_GAP_MS,
|
|
22
|
+
POLITE_USER_AGENT,
|
|
23
|
+
__resetHttpThrottle,
|
|
24
|
+
createCornellLiiSource,
|
|
25
|
+
createIrsPublicationsSource,
|
|
26
|
+
createStateSosSource,
|
|
27
|
+
extractLinks,
|
|
28
|
+
firstMatch,
|
|
29
|
+
htmlToText,
|
|
30
|
+
innerHtmlById,
|
|
31
|
+
looksLikeBlockPage,
|
|
32
|
+
politeFetch
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -170,4 +170,4 @@ interface KnowledgeRelease {
|
|
|
170
170
|
metadata?: Record<string, unknown>;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
export type { ClaimRef as C, KnowledgeGraphEdge as K, SourceRecord as S, KnowledgeGraphNode as a, KnowledgeGraph as b,
|
|
173
|
+
export type { ClaimRef as C, KnowledgeGraphEdge as K, SourceRecord as S, KnowledgeGraphNode as a, KnowledgeGraph as b, KnowledgeIndex as c, KnowledgeSearchResult as d, KnowledgeEventType as e, KnowledgeEvent as f, KnowledgePage as g, KnowledgeLintFinding as h, KnowledgeBaseCandidate as i, KnowledgeWriteBlock as j, KnowledgeClaim as k, KnowledgeRelease as l, SourceRegistry as m, KnowledgeWriteParseResult as n, KnowledgeId as o, KnowledgePolicy as p, KnowledgeRelation as q, KnowledgeUnit as r, SourceAnchor as s };
|
package/dist/viz/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { K as KnowledgeGraphEdge, a as KnowledgeGraphNode, b as KnowledgeGraph } from '../types-
|
|
1
|
+
import { K as KnowledgeGraphEdge, a as KnowledgeGraphNode, b as KnowledgeGraph } from '../types-CAeh7Lwb.js';
|
|
2
2
|
|
|
3
3
|
interface KnowledgeVizNode extends KnowledgeGraphNode {
|
|
4
4
|
degree: number;
|
package/dist/viz/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-knowledge",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Source-grounded, eval-gated knowledge growth primitives for agents.",
|
|
5
5
|
"homepage": "https://github.com/tangle-network/agent-knowledge#readme",
|
|
6
6
|
"repository": {
|
|
@@ -28,6 +28,11 @@
|
|
|
28
28
|
"types": "./dist/cli.d.ts",
|
|
29
29
|
"import": "./dist/cli.js",
|
|
30
30
|
"default": "./dist/cli.js"
|
|
31
|
+
},
|
|
32
|
+
"./sources": {
|
|
33
|
+
"types": "./dist/sources/index.d.ts",
|
|
34
|
+
"import": "./dist/sources/index.js",
|
|
35
|
+
"default": "./dist/sources/index.js"
|
|
31
36
|
}
|
|
32
37
|
},
|
|
33
38
|
"bin": {
|
|
@@ -42,19 +47,12 @@
|
|
|
42
47
|
"publishConfig": {
|
|
43
48
|
"access": "public"
|
|
44
49
|
},
|
|
45
|
-
"scripts": {
|
|
46
|
-
"build": "tsup",
|
|
47
|
-
"dev": "tsup --watch",
|
|
48
|
-
"prepare": "tsup",
|
|
49
|
-
"test": "vitest run",
|
|
50
|
-
"test:watch": "vitest",
|
|
51
|
-
"typecheck": "tsc --noEmit"
|
|
52
|
-
},
|
|
53
50
|
"dependencies": {
|
|
54
|
-
"@tangle-network/agent-eval": "^0.
|
|
51
|
+
"@tangle-network/agent-eval": "^0.29.1",
|
|
55
52
|
"zod": "^4.3.6"
|
|
56
53
|
},
|
|
57
54
|
"devDependencies": {
|
|
55
|
+
"@biomejs/biome": "^2.4.15",
|
|
58
56
|
"@types/node": "^25.6.0",
|
|
59
57
|
"tsup": "^8.0.0",
|
|
60
58
|
"typescript": "^5.7.0",
|
|
@@ -64,5 +62,13 @@
|
|
|
64
62
|
"node": ">=20"
|
|
65
63
|
},
|
|
66
64
|
"license": "MIT",
|
|
67
|
-
"
|
|
68
|
-
|
|
65
|
+
"scripts": {
|
|
66
|
+
"build": "tsup",
|
|
67
|
+
"dev": "tsup --watch",
|
|
68
|
+
"test": "vitest run",
|
|
69
|
+
"test:watch": "vitest",
|
|
70
|
+
"typecheck": "tsc --noEmit",
|
|
71
|
+
"lint": "biome check src tests",
|
|
72
|
+
"format": "biome format --write src tests"
|
|
73
|
+
}
|
|
74
|
+
}
|