@peac/mappings-content-signals 0.11.2
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/LICENSE +190 -0
- package/README.md +82 -0
- package/dist/content-usage.d.ts +47 -0
- package/dist/content-usage.d.ts.map +1 -0
- package/dist/index.cjs +385 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +371 -0
- package/dist/index.mjs.map +1 -0
- package/dist/observation.d.ts +33 -0
- package/dist/observation.d.ts.map +1 -0
- package/dist/resolve.d.ts +35 -0
- package/dist/resolve.d.ts.map +1 -0
- package/dist/robots.d.ts +15 -0
- package/dist/robots.d.ts.map +1 -0
- package/dist/tdmrep.d.ts +19 -0
- package/dist/tdmrep.d.ts.map +1 -0
- package/dist/types.d.ts +108 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +53 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content Signal Types (DD-136, DD-137)
|
|
3
|
+
*
|
|
4
|
+
* Types for content use policy signal observation.
|
|
5
|
+
* Signals RECORD observations, never enforce (DD-95 rail neutrality).
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Signal source identifier (DD-137 precedence order).
|
|
9
|
+
*
|
|
10
|
+
* Note: Content-Signal header is reserved for a future version when a parser
|
|
11
|
+
* is implemented. Only sources with shipped parsers are included here.
|
|
12
|
+
*/
|
|
13
|
+
export type SignalSource = 'tdmrep-json' | 'content-usage-header' | 'robots-txt';
|
|
14
|
+
/** Three-state signal decision (DD-136) */
|
|
15
|
+
export type SignalDecision = 'allow' | 'deny' | 'unspecified';
|
|
16
|
+
/**
|
|
17
|
+
* Canonical purpose token for content signals.
|
|
18
|
+
*
|
|
19
|
+
* Subset of PEAC CanonicalPurpose relevant to content use policy signals.
|
|
20
|
+
*/
|
|
21
|
+
export type ContentPurpose = 'ai-training' | 'ai-inference' | 'ai-search' | 'ai-generative' | 'tdm';
|
|
22
|
+
/** Single content signal entry from a specific source */
|
|
23
|
+
export interface ContentSignalEntry {
|
|
24
|
+
/** Purpose this signal applies to */
|
|
25
|
+
purpose: ContentPurpose;
|
|
26
|
+
/** Three-state decision */
|
|
27
|
+
decision: SignalDecision;
|
|
28
|
+
/** Which source produced this signal */
|
|
29
|
+
source: SignalSource;
|
|
30
|
+
/** Raw value from the source (for debugging) */
|
|
31
|
+
raw_value?: string;
|
|
32
|
+
}
|
|
33
|
+
/** SF value type classification per RFC 9651 */
|
|
34
|
+
export type SfValueType = 'token' | 'string' | 'boolean' | 'inner-list' | 'byte-sequence';
|
|
35
|
+
/** Single parsed Structured Fields Dictionary member (RFC 9651) */
|
|
36
|
+
export interface SfDictionaryMember {
|
|
37
|
+
/** Member key (lowercase, as parsed) */
|
|
38
|
+
key: string;
|
|
39
|
+
/** Raw member string from the header (key=value with parameters) */
|
|
40
|
+
raw: string;
|
|
41
|
+
/** SF value type classification */
|
|
42
|
+
valueType: SfValueType;
|
|
43
|
+
/** Token value if valueType is 'token', null otherwise */
|
|
44
|
+
tokenValue: string | null;
|
|
45
|
+
}
|
|
46
|
+
/** Full parse result from Content-Usage header parsing */
|
|
47
|
+
export interface ContentUsageParseResult {
|
|
48
|
+
/** Original raw header value */
|
|
49
|
+
raw: string;
|
|
50
|
+
/** All parsed SF Dictionary members (known and unknown) */
|
|
51
|
+
parsed: SfDictionaryMember[];
|
|
52
|
+
/** Mapped signal entries for recognized AIPREF vocabulary keys */
|
|
53
|
+
entries: ContentSignalEntry[];
|
|
54
|
+
/** Unrecognized dictionary members (forward-compatible pass-through) */
|
|
55
|
+
extensions: SfDictionaryMember[];
|
|
56
|
+
}
|
|
57
|
+
/** Aggregated content signal observation */
|
|
58
|
+
export interface ContentSignalObservation {
|
|
59
|
+
/** When the signals were observed (ISO 8601) */
|
|
60
|
+
observed_at: string;
|
|
61
|
+
/** URI the signals apply to */
|
|
62
|
+
target_uri: string;
|
|
63
|
+
/** Resolved signals (one per purpose, highest-priority source wins) */
|
|
64
|
+
signals: ContentSignalEntry[];
|
|
65
|
+
/** Content digest for integrity binding */
|
|
66
|
+
digest?: {
|
|
67
|
+
alg: 'sha-256';
|
|
68
|
+
val: string;
|
|
69
|
+
};
|
|
70
|
+
/** Which sources were checked */
|
|
71
|
+
sources_checked: SignalSource[];
|
|
72
|
+
}
|
|
73
|
+
/** Pre-fetched robots.txt content */
|
|
74
|
+
export interface RobotsTxtInput {
|
|
75
|
+
/** Raw text content of robots.txt */
|
|
76
|
+
content: string;
|
|
77
|
+
}
|
|
78
|
+
/** Pre-fetched tdmrep.json content */
|
|
79
|
+
export interface TdmrepInput {
|
|
80
|
+
/** Raw JSON string of tdmrep.json */
|
|
81
|
+
content: string;
|
|
82
|
+
}
|
|
83
|
+
/** Pre-fetched Content-Usage header value */
|
|
84
|
+
export interface ContentUsageInput {
|
|
85
|
+
/** Raw header value */
|
|
86
|
+
value: string;
|
|
87
|
+
}
|
|
88
|
+
/** Maximum input size for robots.txt (500 KB) */
|
|
89
|
+
export declare const MAX_ROBOTS_TXT_SIZE = 512000;
|
|
90
|
+
/** Maximum input size for tdmrep.json (64 KB) */
|
|
91
|
+
export declare const MAX_TDMREP_SIZE = 65536;
|
|
92
|
+
/** Maximum header value size (8 KB) */
|
|
93
|
+
export declare const MAX_HEADER_SIZE = 8192;
|
|
94
|
+
/**
|
|
95
|
+
* AI-relevant user-agent strings for robots.txt parsing.
|
|
96
|
+
*
|
|
97
|
+
* Maps user-agent tokens to the content purposes they represent.
|
|
98
|
+
*/
|
|
99
|
+
export declare const AI_USER_AGENTS: Record<string, ContentPurpose[]>;
|
|
100
|
+
/**
|
|
101
|
+
* Signal source precedence (DD-137).
|
|
102
|
+
* Lower index = higher priority.
|
|
103
|
+
*
|
|
104
|
+
* Note: Content-Signal header is reserved for a future version.
|
|
105
|
+
* When implemented, it will slot between tdmrep-json and content-usage-header.
|
|
106
|
+
*/
|
|
107
|
+
export declare const SOURCE_PRECEDENCE: readonly SignalSource[];
|
|
108
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,sBAAsB,GAAG,YAAY,CAAC;AAEjF,2CAA2C;AAC3C,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,GAAG,aAAa,CAAC;AAE9D;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,cAAc,GAAG,WAAW,GAAG,eAAe,GAAG,KAAK,CAAC;AAEpG,yDAAyD;AACzD,MAAM,WAAW,kBAAkB;IACjC,qCAAqC;IACrC,OAAO,EAAE,cAAc,CAAC;IACxB,2BAA2B;IAC3B,QAAQ,EAAE,cAAc,CAAC;IACzB,wCAAwC;IACxC,MAAM,EAAE,YAAY,CAAC;IACrB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD,gDAAgD;AAChD,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,GAAG,eAAe,CAAC;AAE1F,mEAAmE;AACnE,MAAM,WAAW,kBAAkB;IACjC,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,GAAG,EAAE,MAAM,CAAC;IACZ,mCAAmC;IACnC,SAAS,EAAE,WAAW,CAAC;IACvB,0DAA0D;IAC1D,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,0DAA0D;AAC1D,MAAM,WAAW,uBAAuB;IACtC,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,kEAAkE;IAClE,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,wEAAwE;IACxE,UAAU,EAAE,kBAAkB,EAAE,CAAC;CAClC;AAED,4CAA4C;AAC5C,MAAM,WAAW,wBAAwB;IACvC,gDAAgD;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,2CAA2C;IAC3C,MAAM,CAAC,EAAE;QAAE,GAAG,EAAE,SAAS,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,iCAAiC;IACjC,eAAe,EAAE,YAAY,EAAE,CAAC;CACjC;AAMD,qCAAqC;AACrC,MAAM,WAAW,cAAc;IAC7B,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,sCAAsC;AACtC,MAAM,WAAW,WAAW;IAC1B,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,6CAA6C;AAC7C,MAAM,WAAW,iBAAiB;IAChC,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;CACf;AAMD,iDAAiD;AACjD,eAAO,MAAM,mBAAmB,SAAS,CAAC;AAE1C,iDAAiD;AACjD,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC,uCAAuC;AACvC,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,CAU3D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,YAAY,EAI3C,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@peac/mappings-content-signals",
|
|
3
|
+
"version": "0.11.2",
|
|
4
|
+
"description": "Content use policy signal parsing for PEAC (robots.txt, tdmrep.json, Content-Usage)",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/peacprotocol/peac.git",
|
|
10
|
+
"directory": "packages/mappings/content-signals"
|
|
11
|
+
},
|
|
12
|
+
"author": "jithinraj <7850727+jithinraj@users.noreply.github.com>",
|
|
13
|
+
"license": "Apache-2.0",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/peacprotocol/peac/issues"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/peacprotocol/peac#readme",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@peac/kernel": "0.11.2",
|
|
27
|
+
"@peac/schema": "0.11.2"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^22.19.11",
|
|
31
|
+
"typescript": "^5.3.3",
|
|
32
|
+
"vitest": "^4.0.0",
|
|
33
|
+
"tsup": "^8.0.0"
|
|
34
|
+
},
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"import": "./dist/index.mjs",
|
|
39
|
+
"require": "./dist/index.cjs",
|
|
40
|
+
"default": "./dist/index.mjs"
|
|
41
|
+
},
|
|
42
|
+
"./package.json": "./package.json"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"prebuild": "rm -rf dist",
|
|
46
|
+
"build": "pnpm run build:js && pnpm run build:types",
|
|
47
|
+
"test": "vitest run",
|
|
48
|
+
"test:watch": "vitest",
|
|
49
|
+
"clean": "rm -rf dist",
|
|
50
|
+
"build:js": "tsup",
|
|
51
|
+
"build:types": "rm -f dist/.tsbuildinfo && tsc && rm -f dist/.tsbuildinfo"
|
|
52
|
+
}
|
|
53
|
+
}
|