@ahtmljs/schema 0.1.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/dist/diff.d.ts +16 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +90 -0
- package/dist/diff.js.map +1 -0
- package/dist/format-compact.d.ts +29 -0
- package/dist/format-compact.d.ts.map +1 -0
- package/dist/format-compact.js +567 -0
- package/dist/format-compact.js.map +1 -0
- package/dist/format-json.d.ts +17 -0
- package/dist/format-json.d.ts.map +1 -0
- package/dist/format-json.js +39 -0
- package/dist/format-json.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/snapshot.d.ts +49 -0
- package/dist/snapshot.d.ts.map +1 -0
- package/dist/snapshot.js +109 -0
- package/dist/snapshot.js.map +1 -0
- package/dist/types.d.ts +256 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/dist/validate.d.ts +17 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +179 -0
- package/dist/validate.js.map +1 -0
- package/package.json +23 -0
- package/src/schema.json +222 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ahtmljs/schema — public API.
|
|
3
|
+
*/
|
|
4
|
+
export * from './types.js';
|
|
5
|
+
export { SnapshotBuilder, snapshot, computeEtag } from './snapshot.js';
|
|
6
|
+
export { validate, isValid, type Issue } from './validate.js';
|
|
7
|
+
export { toJson, fromJson } from './format-json.js';
|
|
8
|
+
export { toCompact, fromCompact } from './format-compact.js';
|
|
9
|
+
export { diff, applyDiff } from './diff.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ahtmljs/schema — public API.
|
|
3
|
+
*/
|
|
4
|
+
export * from './types.js';
|
|
5
|
+
export { SnapshotBuilder, snapshot, computeEtag } from './snapshot.js';
|
|
6
|
+
export { validate, isValid } from './validate.js';
|
|
7
|
+
export { toJson, fromJson } from './format-json.js';
|
|
8
|
+
export { toCompact, fromCompact } from './format-compact.js';
|
|
9
|
+
export { diff, applyDiff } from './diff.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAc,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snapshot builder DSL.
|
|
3
|
+
*
|
|
4
|
+
* import { snapshot } from '@ahtmljs/schema';
|
|
5
|
+
*
|
|
6
|
+
* const snap = snapshot(req.url, 'product_detail')
|
|
7
|
+
* .ttl(300)
|
|
8
|
+
* .policy({ agents_welcome: true, license: 'CC-BY-4.0' })
|
|
9
|
+
* .add({
|
|
10
|
+
* id: 'product:mbp-14-m3',
|
|
11
|
+
* type: 'product',
|
|
12
|
+
* name: 'MacBook Pro 14"',
|
|
13
|
+
* price: { amount: 1999, currency: 'USD' },
|
|
14
|
+
* stock: { status: 'in_stock', quantity: 42 },
|
|
15
|
+
* })
|
|
16
|
+
* .action({
|
|
17
|
+
* id: 'purchase',
|
|
18
|
+
* target: 'product:mbp-14-m3',
|
|
19
|
+
* auth: 'required',
|
|
20
|
+
* cost: { amount: 1999, currency: 'USD', category: 'purchase' },
|
|
21
|
+
* reversible: { reversible: true, window: 'P30D', policy: 'full_refund' },
|
|
22
|
+
* side_effects: ['charge_card', 'email_buyer', 'decrement_stock'],
|
|
23
|
+
* confirmation: 'required',
|
|
24
|
+
* })
|
|
25
|
+
* .build();
|
|
26
|
+
*/
|
|
27
|
+
import type { Snapshot, PageType, Entity, Action, Policy, Provenance, Links, Meta, JsonSchema } from './types.js';
|
|
28
|
+
export declare class SnapshotBuilder {
|
|
29
|
+
private snap;
|
|
30
|
+
constructor(url: string, pageType: PageType);
|
|
31
|
+
ttl(seconds: number): this;
|
|
32
|
+
etag(tag: string): this;
|
|
33
|
+
fetchedAt(iso: string): this;
|
|
34
|
+
policy(p: Policy): this;
|
|
35
|
+
provenance(p: Provenance): this;
|
|
36
|
+
add(...entities: Entity[]): this;
|
|
37
|
+
action(...actions: Action[]): this;
|
|
38
|
+
links(l: Links): this;
|
|
39
|
+
schema(name: string, def: JsonSchema): this;
|
|
40
|
+
meta(m: Meta): this;
|
|
41
|
+
build(): Snapshot;
|
|
42
|
+
}
|
|
43
|
+
export declare function snapshot(url: string, pageType: PageType): SnapshotBuilder;
|
|
44
|
+
/**
|
|
45
|
+
* Compute a stable, weak ETag from snapshot content.
|
|
46
|
+
* Content-addressed: same entities + actions → same etag (regardless of fetched_at).
|
|
47
|
+
*/
|
|
48
|
+
export declare function computeEtag(s: Snapshot): string;
|
|
49
|
+
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../src/snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,UAAU,EACV,KAAK,EACL,IAAI,EACJ,UAAU,EACX,MAAM,YAAY,CAAC;AAEpB,qBAAa,eAAe;IAC1B,OAAO,CAAC,IAAI,CAAW;gBAEX,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;IAW3C,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK1B,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAKvB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK5B,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAKvB,UAAU,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAK/B,GAAG,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI;IAKhC,MAAM,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IAKlC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI;IAKrB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI;IAM3C,IAAI,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI;IAKnB,KAAK,IAAI,QAAQ;CAGlB;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,eAAe,CAEzE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,QAAQ,GAAG,MAAM,CAU/C"}
|
package/dist/snapshot.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snapshot builder DSL.
|
|
3
|
+
*
|
|
4
|
+
* import { snapshot } from '@ahtmljs/schema';
|
|
5
|
+
*
|
|
6
|
+
* const snap = snapshot(req.url, 'product_detail')
|
|
7
|
+
* .ttl(300)
|
|
8
|
+
* .policy({ agents_welcome: true, license: 'CC-BY-4.0' })
|
|
9
|
+
* .add({
|
|
10
|
+
* id: 'product:mbp-14-m3',
|
|
11
|
+
* type: 'product',
|
|
12
|
+
* name: 'MacBook Pro 14"',
|
|
13
|
+
* price: { amount: 1999, currency: 'USD' },
|
|
14
|
+
* stock: { status: 'in_stock', quantity: 42 },
|
|
15
|
+
* })
|
|
16
|
+
* .action({
|
|
17
|
+
* id: 'purchase',
|
|
18
|
+
* target: 'product:mbp-14-m3',
|
|
19
|
+
* auth: 'required',
|
|
20
|
+
* cost: { amount: 1999, currency: 'USD', category: 'purchase' },
|
|
21
|
+
* reversible: { reversible: true, window: 'P30D', policy: 'full_refund' },
|
|
22
|
+
* side_effects: ['charge_card', 'email_buyer', 'decrement_stock'],
|
|
23
|
+
* confirmation: 'required',
|
|
24
|
+
* })
|
|
25
|
+
* .build();
|
|
26
|
+
*/
|
|
27
|
+
import { AHTML_VERSION } from './types.js';
|
|
28
|
+
export class SnapshotBuilder {
|
|
29
|
+
snap;
|
|
30
|
+
constructor(url, pageType) {
|
|
31
|
+
this.snap = {
|
|
32
|
+
ahtml: AHTML_VERSION,
|
|
33
|
+
url,
|
|
34
|
+
fetched_at: new Date().toISOString(),
|
|
35
|
+
page_type: pageType,
|
|
36
|
+
entities: [],
|
|
37
|
+
actions: [],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
ttl(seconds) {
|
|
41
|
+
this.snap.ttl = seconds;
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
etag(tag) {
|
|
45
|
+
this.snap.etag = tag;
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
fetchedAt(iso) {
|
|
49
|
+
this.snap.fetched_at = iso;
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
policy(p) {
|
|
53
|
+
this.snap.policy = p;
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
provenance(p) {
|
|
57
|
+
this.snap.provenance = p;
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
add(...entities) {
|
|
61
|
+
this.snap.entities.push(...entities);
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
action(...actions) {
|
|
65
|
+
this.snap.actions.push(...actions);
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
links(l) {
|
|
69
|
+
this.snap.links = { ...this.snap.links, ...l };
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
schema(name, def) {
|
|
73
|
+
this.snap.schemas ??= {};
|
|
74
|
+
this.snap.schemas[name] = def;
|
|
75
|
+
return this;
|
|
76
|
+
}
|
|
77
|
+
meta(m) {
|
|
78
|
+
this.snap.meta = { ...this.snap.meta, ...m };
|
|
79
|
+
return this;
|
|
80
|
+
}
|
|
81
|
+
build() {
|
|
82
|
+
return structuredClone(this.snap);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export function snapshot(url, pageType) {
|
|
86
|
+
return new SnapshotBuilder(url, pageType);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Compute a stable, weak ETag from snapshot content.
|
|
90
|
+
* Content-addressed: same entities + actions → same etag (regardless of fetched_at).
|
|
91
|
+
*/
|
|
92
|
+
export function computeEtag(s) {
|
|
93
|
+
const stable = {
|
|
94
|
+
url: s.url,
|
|
95
|
+
page_type: s.page_type,
|
|
96
|
+
entities: s.entities,
|
|
97
|
+
actions: s.actions,
|
|
98
|
+
links: s.links,
|
|
99
|
+
policy: s.policy,
|
|
100
|
+
};
|
|
101
|
+
return `W/"${djb2(JSON.stringify(stable))}"`;
|
|
102
|
+
}
|
|
103
|
+
function djb2(str) {
|
|
104
|
+
let h = 5381;
|
|
105
|
+
for (let i = 0; i < str.length; i++)
|
|
106
|
+
h = ((h << 5) + h + str.charCodeAt(i)) | 0;
|
|
107
|
+
return (h >>> 0).toString(16);
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../src/snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAa3C,MAAM,OAAO,eAAe;IAClB,IAAI,CAAW;IAEvB,YAAY,GAAW,EAAE,QAAkB;QACzC,IAAI,CAAC,IAAI,GAAG;YACV,KAAK,EAAE,aAAa;YACpB,GAAG;YACH,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,SAAS,EAAE,QAAQ;YACnB,QAAQ,EAAE,EAAE;YACZ,OAAO,EAAE,EAAE;SACZ,CAAC;IACJ,CAAC;IAED,GAAG,CAAC,OAAe;QACjB,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,GAAW;QACd,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,CAAC,GAAW;QACnB,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,CAAS;QACd,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC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;IACrC,MAAM,MAAM,GAAG;QACb,GAAG,EAAE,CAAC,CAAC,GAAG;QACV,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,MAAM,EAAE,CAAC,CAAC,MAAM;KACjB,CAAC;IACF,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC;AAC/C,CAAC;AAED,SAAS,IAAI,CAAC,GAAW;IACvB,IAAI,CAAC,GAAG,IAAI,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAChF,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAChC,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AHTML Semantic Snapshot — core type definitions.
|
|
3
|
+
*
|
|
4
|
+
* A snapshot is the canonical agent-facing representation of a web page.
|
|
5
|
+
* Same data, two serializations:
|
|
6
|
+
* - JSON (strict, machine-canonical)
|
|
7
|
+
* - Compact text (token-optimal for LLMs — see format-compact.ts)
|
|
8
|
+
*/
|
|
9
|
+
export type AhtmlVersion = '0.1';
|
|
10
|
+
export interface Snapshot {
|
|
11
|
+
ahtml: AhtmlVersion;
|
|
12
|
+
url: string;
|
|
13
|
+
fetched_at: string;
|
|
14
|
+
ttl?: number;
|
|
15
|
+
etag?: string;
|
|
16
|
+
page_type: PageType;
|
|
17
|
+
policy?: Policy;
|
|
18
|
+
provenance?: Provenance;
|
|
19
|
+
entities: Entity[];
|
|
20
|
+
actions: Action[];
|
|
21
|
+
links?: Links;
|
|
22
|
+
schemas?: Record<string, JsonSchema>;
|
|
23
|
+
meta?: Meta;
|
|
24
|
+
}
|
|
25
|
+
export type PageType = 'home' | 'product_detail' | 'product_list' | 'article' | 'document' | 'profile' | 'task_list' | 'task_detail' | 'dataset' | 'conversation' | 'checkout' | 'search_results' | 'category' | 'other';
|
|
26
|
+
export type EntityId = string;
|
|
27
|
+
export type EntityType = 'product' | 'document' | 'task' | 'profile' | 'dataset' | 'conversation';
|
|
28
|
+
export type Freshness = 'live' | 'near_realtime' | 'daily' | 'static';
|
|
29
|
+
export interface BaseEntity {
|
|
30
|
+
id: EntityId;
|
|
31
|
+
type: EntityType;
|
|
32
|
+
freshness?: Freshness;
|
|
33
|
+
updated_at?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface Money {
|
|
36
|
+
amount: number;
|
|
37
|
+
currency: string;
|
|
38
|
+
}
|
|
39
|
+
export interface Stock {
|
|
40
|
+
status: 'in_stock' | 'low_stock' | 'out_of_stock' | 'preorder' | 'discontinued';
|
|
41
|
+
quantity?: number;
|
|
42
|
+
}
|
|
43
|
+
export interface Asset {
|
|
44
|
+
url: string;
|
|
45
|
+
alt?: string;
|
|
46
|
+
width?: number;
|
|
47
|
+
height?: number;
|
|
48
|
+
}
|
|
49
|
+
export interface Product extends BaseEntity {
|
|
50
|
+
type: 'product';
|
|
51
|
+
name: string;
|
|
52
|
+
brand?: string;
|
|
53
|
+
description?: string;
|
|
54
|
+
price?: Money;
|
|
55
|
+
list_price?: Money;
|
|
56
|
+
stock?: Stock;
|
|
57
|
+
sku?: string;
|
|
58
|
+
variants?: ProductVariant[];
|
|
59
|
+
images?: Asset[];
|
|
60
|
+
attributes?: Record<string, string | number | boolean>;
|
|
61
|
+
rating?: {
|
|
62
|
+
average: number;
|
|
63
|
+
count: number;
|
|
64
|
+
};
|
|
65
|
+
category?: EntityId;
|
|
66
|
+
}
|
|
67
|
+
export interface ProductVariant {
|
|
68
|
+
id: EntityId;
|
|
69
|
+
name: string;
|
|
70
|
+
price?: Money;
|
|
71
|
+
stock?: Stock;
|
|
72
|
+
attributes?: Record<string, string>;
|
|
73
|
+
}
|
|
74
|
+
export interface Document extends BaseEntity {
|
|
75
|
+
type: 'document';
|
|
76
|
+
title: string;
|
|
77
|
+
author?: string | string[];
|
|
78
|
+
published_at?: string;
|
|
79
|
+
modified_at?: string;
|
|
80
|
+
summary?: string;
|
|
81
|
+
content?: string;
|
|
82
|
+
word_count?: number;
|
|
83
|
+
reading_time?: number;
|
|
84
|
+
language?: string;
|
|
85
|
+
tags?: string[];
|
|
86
|
+
canonical_url?: string;
|
|
87
|
+
}
|
|
88
|
+
export interface Task extends BaseEntity {
|
|
89
|
+
type: 'task';
|
|
90
|
+
title: string;
|
|
91
|
+
description?: string;
|
|
92
|
+
state: 'open' | 'in_progress' | 'blocked' | 'done' | 'cancelled';
|
|
93
|
+
priority?: 'low' | 'medium' | 'high' | 'urgent';
|
|
94
|
+
assignee?: EntityId;
|
|
95
|
+
due_at?: string;
|
|
96
|
+
labels?: string[];
|
|
97
|
+
parent?: EntityId;
|
|
98
|
+
}
|
|
99
|
+
export interface Profile extends BaseEntity {
|
|
100
|
+
type: 'profile';
|
|
101
|
+
name: string;
|
|
102
|
+
kind: 'person' | 'organization' | 'bot';
|
|
103
|
+
handle?: string;
|
|
104
|
+
avatar?: Asset;
|
|
105
|
+
bio?: string;
|
|
106
|
+
email?: string;
|
|
107
|
+
homepage?: string;
|
|
108
|
+
verified?: boolean;
|
|
109
|
+
attributes?: Record<string, string>;
|
|
110
|
+
}
|
|
111
|
+
export interface DatasetColumn {
|
|
112
|
+
key: string;
|
|
113
|
+
label: string;
|
|
114
|
+
type: 'string' | 'number' | 'boolean' | 'datetime' | 'entity_ref' | 'money';
|
|
115
|
+
format?: string;
|
|
116
|
+
}
|
|
117
|
+
export interface Dataset extends BaseEntity {
|
|
118
|
+
type: 'dataset';
|
|
119
|
+
name: string;
|
|
120
|
+
columns: DatasetColumn[];
|
|
121
|
+
rows: unknown[][];
|
|
122
|
+
row_count_total?: number;
|
|
123
|
+
description?: string;
|
|
124
|
+
}
|
|
125
|
+
export interface ConversationMessage {
|
|
126
|
+
id: string;
|
|
127
|
+
author: EntityId;
|
|
128
|
+
posted_at: string;
|
|
129
|
+
content: string;
|
|
130
|
+
reply_to?: string;
|
|
131
|
+
}
|
|
132
|
+
export interface Conversation extends BaseEntity {
|
|
133
|
+
type: 'conversation';
|
|
134
|
+
title?: string;
|
|
135
|
+
participants: EntityId[];
|
|
136
|
+
messages: ConversationMessage[];
|
|
137
|
+
message_count_total?: number;
|
|
138
|
+
}
|
|
139
|
+
export type Entity = Product | Document | Task | Profile | Dataset | Conversation;
|
|
140
|
+
export type ActionCategory = 'read' | 'search' | 'navigate' | 'create' | 'update' | 'delete' | 'transact' | 'send' | 'auth';
|
|
141
|
+
export type AuthRequirement = 'none' | 'optional' | 'required' | {
|
|
142
|
+
scheme: string;
|
|
143
|
+
scopes?: string[];
|
|
144
|
+
};
|
|
145
|
+
export interface ActionCost {
|
|
146
|
+
amount?: number;
|
|
147
|
+
currency?: string;
|
|
148
|
+
unit?: 'request' | 'token' | 'credit' | 'message' | 'item';
|
|
149
|
+
category: 'free' | 'purchase' | 'subscription' | 'rate_limited' | 'compute';
|
|
150
|
+
notes?: string;
|
|
151
|
+
}
|
|
152
|
+
export interface Reversibility {
|
|
153
|
+
reversible: boolean;
|
|
154
|
+
window?: string;
|
|
155
|
+
policy?: string;
|
|
156
|
+
}
|
|
157
|
+
export type SideEffect = 'charge_card' | 'email_buyer' | 'email_seller' | 'sms' | 'decrement_stock' | 'create_account' | 'modify_profile' | 'public_post' | 'send_message' | 'consume_credit' | 'webhook' | string;
|
|
158
|
+
export interface Action {
|
|
159
|
+
id: string;
|
|
160
|
+
label?: string;
|
|
161
|
+
target?: EntityId | EntityId[];
|
|
162
|
+
input?: JsonSchema | {
|
|
163
|
+
$ref: string;
|
|
164
|
+
};
|
|
165
|
+
output?: JsonSchema | {
|
|
166
|
+
$ref: string;
|
|
167
|
+
};
|
|
168
|
+
auth?: AuthRequirement;
|
|
169
|
+
cost?: ActionCost;
|
|
170
|
+
reversible?: Reversibility;
|
|
171
|
+
side_effects?: SideEffect[];
|
|
172
|
+
rate_limit?: string;
|
|
173
|
+
preview_url?: string;
|
|
174
|
+
execute_url?: string;
|
|
175
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
176
|
+
confirmation?: 'none' | 'recommended' | 'required';
|
|
177
|
+
category?: ActionCategory;
|
|
178
|
+
}
|
|
179
|
+
export interface Policy {
|
|
180
|
+
agents_welcome: boolean;
|
|
181
|
+
license?: string;
|
|
182
|
+
rate_limit?: string;
|
|
183
|
+
actions_require?: string;
|
|
184
|
+
contact?: string;
|
|
185
|
+
terms_url?: string;
|
|
186
|
+
attribution_required?: boolean;
|
|
187
|
+
republish?: 'allowed' | 'denied' | 'attribution_only';
|
|
188
|
+
caching?: {
|
|
189
|
+
ttl?: number;
|
|
190
|
+
allowed?: boolean;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
export interface Provenance {
|
|
194
|
+
issuer?: string;
|
|
195
|
+
signed?: boolean;
|
|
196
|
+
signature?: string;
|
|
197
|
+
signature_alg?: string;
|
|
198
|
+
fetched_via?: string;
|
|
199
|
+
}
|
|
200
|
+
export interface PaginationLink {
|
|
201
|
+
cursor?: string;
|
|
202
|
+
url?: string;
|
|
203
|
+
expected?: number;
|
|
204
|
+
total?: number;
|
|
205
|
+
}
|
|
206
|
+
export interface Links {
|
|
207
|
+
self?: string;
|
|
208
|
+
next?: PaginationLink;
|
|
209
|
+
prev?: PaginationLink;
|
|
210
|
+
parent?: EntityId | string;
|
|
211
|
+
related?: EntityId[];
|
|
212
|
+
canonical?: string;
|
|
213
|
+
}
|
|
214
|
+
export interface Meta {
|
|
215
|
+
snapshot_bytes?: number;
|
|
216
|
+
html_bytes?: number;
|
|
217
|
+
compression_ratio?: number;
|
|
218
|
+
generated_by?: string;
|
|
219
|
+
[k: string]: unknown;
|
|
220
|
+
}
|
|
221
|
+
export interface JsonSchema {
|
|
222
|
+
type?: string;
|
|
223
|
+
properties?: Record<string, JsonSchema>;
|
|
224
|
+
items?: JsonSchema;
|
|
225
|
+
required?: string[];
|
|
226
|
+
enum?: unknown[];
|
|
227
|
+
format?: string;
|
|
228
|
+
$ref?: string;
|
|
229
|
+
[k: string]: unknown;
|
|
230
|
+
}
|
|
231
|
+
export type DiffChange = {
|
|
232
|
+
op: 'add';
|
|
233
|
+
entity: Entity;
|
|
234
|
+
} | {
|
|
235
|
+
op: 'remove';
|
|
236
|
+
id: EntityId;
|
|
237
|
+
} | {
|
|
238
|
+
op: 'update';
|
|
239
|
+
id: EntityId;
|
|
240
|
+
patch: Record<string, unknown>;
|
|
241
|
+
} | {
|
|
242
|
+
op: 'add_action';
|
|
243
|
+
action: Action;
|
|
244
|
+
} | {
|
|
245
|
+
op: 'remove_action';
|
|
246
|
+
id: string;
|
|
247
|
+
};
|
|
248
|
+
export interface SnapshotDiff {
|
|
249
|
+
ahtml: AhtmlVersion;
|
|
250
|
+
url: string;
|
|
251
|
+
from_etag?: string;
|
|
252
|
+
to_etag?: string;
|
|
253
|
+
changes: DiffChange[];
|
|
254
|
+
}
|
|
255
|
+
export declare const AHTML_VERSION: AhtmlVersion;
|
|
256
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC;AAEjC,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,YAAY,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAA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,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AHTML Semantic Snapshot — core type definitions.
|
|
3
|
+
*
|
|
4
|
+
* A snapshot is the canonical agent-facing representation of a web page.
|
|
5
|
+
* Same data, two serializations:
|
|
6
|
+
* - JSON (strict, machine-canonical)
|
|
7
|
+
* - Compact text (token-optimal for LLMs — see format-compact.ts)
|
|
8
|
+
*/
|
|
9
|
+
export const AHTML_VERSION = '0.1';
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA+SH,MAAM,CAAC,MAAM,aAAa,GAAiB,KAAK,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zero-dependency structural validator for AHTML snapshots.
|
|
3
|
+
*
|
|
4
|
+
* Returns a list of human-readable issues. Empty array = valid.
|
|
5
|
+
* For full JSON Schema validation, run schema.json through any standard
|
|
6
|
+
* JSON Schema validator (ajv, etc.). This validator is intentionally lean
|
|
7
|
+
* so the @ahtmljs/schema package has zero runtime dependencies.
|
|
8
|
+
*/
|
|
9
|
+
import type { Snapshot } from './types.js';
|
|
10
|
+
export interface Issue {
|
|
11
|
+
path: string;
|
|
12
|
+
message: string;
|
|
13
|
+
severity: 'error' | 'warning';
|
|
14
|
+
}
|
|
15
|
+
export declare function validate(snap: unknown): Issue[];
|
|
16
|
+
export declare function isValid(snap: unknown): snap is Snapshot;
|
|
17
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAkB,MAAM,YAAY,CAAC;AAE3D,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;AA4BD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,KAAK,EAAE,CAkE/C;AA+ED,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,QAAQ,CAEvD"}
|