librarium-spec 1.0.0 → 1.1.1

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # librarium-spec
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/librarium-spec?label=npm)](https://www.npmjs.com/package/librarium-spec)
4
+ [![Packagist version](https://img.shields.io/packagist/v/jkudish/librarium-spec)](https://packagist.org/packages/jkudish/librarium-spec)
5
+ [![License: MIT](https://img.shields.io/npm/l/librarium-spec?color=blue)](LICENSE)
6
+
7
+ <p align="center">
8
+ <img src=".github/librarium-banner.png" alt="librarium: Give your agent more than one source." />
9
+ </p>
10
+
3
11
  Shared data for Librarium: request, Run and stored-Run JSON schemas, the source catalog, and conformance fixtures. [Librarium](https://github.com/jkudish/librarium) (JavaScript, CLI and MCP) and [Laravel AI Librarium](https://github.com/jkudish/laravel-ai-librarium) (PHP) both read it, so a Run written by one validates in the other.
4
12
 
5
13
  It contains data and tests only, no runtime code. Most people get it as a dependency of those packages. Install it directly when you build a Librarium-compatible tool, store, or report reader.
@@ -58,8 +66,23 @@ npm test
58
66
 
59
67
  `npm test` runs `scripts/check.mjs`, which validates every fixture against the schemas and a reference selection implementation.
60
68
 
61
- ## Links
69
+ Read the full [specification](SPEC.md).
70
+
71
+ ## The Librarium family
72
+
73
+ - [Librarium](https://github.com/jkudish/librarium): the JavaScript CLI, MCP server and library (`npm install -g librarium`).
74
+ - [Laravel AI Librarium](https://github.com/jkudish/laravel-ai-librarium): the Laravel package (`composer require jkudish/laravel-ai-librarium`).
75
+ - [Laravel AI Librarium: Firecrawl](https://github.com/jkudish/laravel-ai-librarium-firecrawl): collects AI answer engine results for the Laravel package through Firecrawl browser sessions.
76
+ - [librarium.si](https://librarium.si): documentation for all of them.
77
+
78
+ ## Sponsoring
79
+
80
+ If you find the Librarium spec useful, consider becoming a [sponsor](https://github.com/sponsors/jkudish) or [donating](https://stripe.com/@jkudish).
81
+
82
+ ## Contributing and security
83
+
84
+ To report a vulnerability, see [SECURITY.md](SECURITY.md).
85
+
86
+ ## License
62
87
 
63
- - Documentation: [librarium.si](https://librarium.si)
64
- - [Specification](SPEC.md)
65
- - [MIT license](LICENSE)
88
+ [MIT](LICENSE)
package/SPEC.md CHANGED
@@ -1,7 +1,10 @@
1
1
  # Librarium simplified surface: specification
2
2
 
3
3
  Status: **approved** by Joey Kudish on 2026-10-12 (PlanMode epic #4954).
4
- Package version 1.0.0: published as npm `librarium-spec` and Composer `jkudish/librarium-spec`.
4
+ Package version 1.1.1, distributed as npm `librarium-spec` and Composer `jkudish/librarium-spec`.
5
+ 1.1.0 adds optional result `search_results` and the `collector` option on
6
+ `openai`, `claude`, `perplexity` and `gemini` (approved by Joey Kudish on
7
+ 2026-11-03, PlanMode #5820).
5
8
  Governs: Librarium JS 2.0 (`jkudish/librarium`, npm `librarium`), Laravel AI
6
9
  Librarium 1.0 (`jkudish/laravel-ai-librarium`), the Firecrawl adapter
7
10
  (`jkudish/laravel-ai-librarium-firecrawl`), this package, the CLI, MCP, docs,
@@ -74,6 +77,16 @@ are skipped by `deep` the same way.
74
77
  | `valyu` | Valyu search | Valyu research | `mode` (default `standard`), `output` |
75
78
  | `you` | You.com answer | You.com research | `quick: answer \| research` |
76
79
 
80
+ `collector: direct | dataforseo` (since 1.1, PHP only) is an option of
81
+ `openai`, `claude`, `perplexity` (with `quick: sonar-pro`) and `gemini` (with
82
+ `quick: grounded`). `dataforseo` asks the same provider's model through
83
+ DataForSEO's LLM Responses API in Live mode, with web search on and DataForSEO
84
+ credentials; `model` selects DataForSEO's `model_name` where the source has a
85
+ `model` option. It replaces only the quick variant (a `deep` request still runs
86
+ the direct deep variant), reports
87
+ `provenance.collector: "dataforseo"` and `search_results`, and is unpriced
88
+ because DataForSEO adds the model's token charge to its per-task fee.
89
+
77
90
  Mapping from today's JS profiles and PHP profile ids to (source, depth,
78
91
  option) lives in `sources.json` and is the migration table for config and
79
92
  docs. Where a language lacks a variant today (for example SERP collectors that
@@ -175,6 +188,17 @@ Schemas: `schema/request.schema.json`, `schema/run.schema.json`,
175
188
  `over_budget`, `excluded`, `no_collector`.
176
189
  - `answer` is Markdown (null for search-only sources); `citations` always
177
190
  present. Raw provider bodies are evidence in the store, never inline.
191
+ - `citations` are the pages the answer cites. A page the source's search
192
+ returned but the answer does not cite is never a citation.
193
+ - `search_results` (optional, since 1.1) are the pages the source's own web
194
+ search returned while answering: `{ url, title, snippet, published_at }`, in
195
+ provider order, exact-URL duplicates removed (first kept). They include
196
+ pages the answer did not cite, so cited pages usually appear in both lists.
197
+ Absent or `null` means the source does not report its retrieval set, which
198
+ is not evidence that it searched nothing; `[]` means it reported an empty
199
+ set. A listed page was retrieved, not necessarily read or rejected.
200
+ Search-only sources, whose results already are the `citations`, omit it.
201
+ Readers built against 1.0 must be updated before reading Runs that carry it.
178
202
  - `cost.reported` is provider-reported only; unknown is `null`, never `"0"`.
179
203
  `cost.complete` is true only when every result reported a cost.
180
204
 
@@ -0,0 +1,50 @@
1
+ {
2
+ "spec": "librarium.run/1",
3
+ "id": "run_01JAB2C3D4E5F6G7H8J9K0M1N2",
4
+ "question": "Replacing GA4 for an EU SaaS: compare Plausible, Fathom, and Matomo",
5
+ "depth": "quick",
6
+ "status": "done",
7
+ "created_at": "2026-10-12T18:04:11Z",
8
+ "finished_at": "2026-10-12T18:06:14Z",
9
+ "cost": {
10
+ "estimated": null,
11
+ "reported": "0.40",
12
+ "complete": true,
13
+ "max": null
14
+ },
15
+ "results": [
16
+ {
17
+ "source": "claude",
18
+ "status": "done",
19
+ "observation": "api",
20
+ "answer": "Plausible is the lighter EU-hosted option [1].",
21
+ "citations": [
22
+ {
23
+ "url": "https://plausible.io/features",
24
+ "title": "Plausible features"
25
+ }
26
+ ],
27
+ "search_results": [
28
+ {
29
+ "url": "https://plausible.io/",
30
+ "rank": 1
31
+ }
32
+ ],
33
+ "cost": {
34
+ "estimated": null,
35
+ "reported": "0.10"
36
+ },
37
+ "started_at": "2026-10-12T18:04:12Z",
38
+ "duration_ms": 122000,
39
+ "provenance": {
40
+ "provider": "anthropic",
41
+ "variant": "chat",
42
+ "model": "claude-sonnet-5",
43
+ "collector": null
44
+ },
45
+ "error": null
46
+ }
47
+ ],
48
+ "skipped": [],
49
+ "notices": []
50
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "spec": "librarium.run/1",
3
+ "id": "run_01JAB2C3D4E5F6G7H8J9K0M1N2",
4
+ "question": "Replacing GA4 for an EU SaaS: compare Plausible, Fathom, and Matomo",
5
+ "depth": "quick",
6
+ "status": "done",
7
+ "created_at": "2026-10-12T18:04:11Z",
8
+ "finished_at": "2026-10-12T18:06:14Z",
9
+ "cost": {
10
+ "estimated": null,
11
+ "reported": "0.40",
12
+ "complete": true,
13
+ "max": null
14
+ },
15
+ "results": [
16
+ {
17
+ "source": "claude",
18
+ "status": "done",
19
+ "observation": "api",
20
+ "answer": "Plausible is the lighter EU-hosted option [1].",
21
+ "citations": [
22
+ {
23
+ "url": "https://plausible.io/features",
24
+ "title": "Plausible features"
25
+ }
26
+ ],
27
+ "search_results": [
28
+ {
29
+ "title": "No URL"
30
+ }
31
+ ],
32
+ "cost": {
33
+ "estimated": null,
34
+ "reported": "0.10"
35
+ },
36
+ "started_at": "2026-10-12T18:04:12Z",
37
+ "duration_ms": 122000,
38
+ "provenance": {
39
+ "provider": "anthropic",
40
+ "variant": "chat",
41
+ "model": "claude-sonnet-5",
42
+ "collector": null
43
+ },
44
+ "error": null
45
+ }
46
+ ],
47
+ "skipped": [],
48
+ "notices": []
49
+ }
@@ -0,0 +1,130 @@
1
+ {
2
+ "spec": "librarium.run/1",
3
+ "id": "run_01JAB2C3D4E5F6G7H8J9K0M1N2",
4
+ "question": "Replacing GA4 for an EU SaaS: compare Plausible, Fathom, and Matomo",
5
+ "depth": "quick",
6
+ "status": "done",
7
+ "created_at": "2026-10-12T18:04:11Z",
8
+ "finished_at": "2026-10-12T18:06:14Z",
9
+ "cost": {
10
+ "estimated": null,
11
+ "reported": "0.40",
12
+ "complete": true,
13
+ "max": null
14
+ },
15
+ "results": [
16
+ {
17
+ "source": "claude",
18
+ "status": "done",
19
+ "observation": "api",
20
+ "answer": "Plausible is the lighter EU-hosted option [1].",
21
+ "citations": [
22
+ {
23
+ "url": "https://plausible.io/features",
24
+ "title": "Plausible features"
25
+ }
26
+ ],
27
+ "search_results": [
28
+ {
29
+ "url": "https://plausible.io/features",
30
+ "title": "Plausible features",
31
+ "snippet": "Lightweight, cookie-free analytics.",
32
+ "published_at": null
33
+ },
34
+ {
35
+ "url": "https://usefathom.com/",
36
+ "title": "Fathom Analytics",
37
+ "snippet": null,
38
+ "published_at": "2026-10-01T00:00:00Z"
39
+ }
40
+ ],
41
+ "cost": {
42
+ "estimated": null,
43
+ "reported": "0.10"
44
+ },
45
+ "started_at": "2026-10-12T18:04:12Z",
46
+ "duration_ms": 122000,
47
+ "provenance": {
48
+ "provider": "anthropic",
49
+ "variant": "chat",
50
+ "model": "claude-sonnet-5",
51
+ "collector": null
52
+ },
53
+ "error": null
54
+ },
55
+ {
56
+ "source": "perplexity",
57
+ "status": "done",
58
+ "observation": "api",
59
+ "answer": "No current sources found.",
60
+ "citations": [],
61
+ "search_results": [],
62
+ "cost": {
63
+ "estimated": null,
64
+ "reported": "0.10"
65
+ },
66
+ "started_at": "2026-10-12T18:04:12Z",
67
+ "duration_ms": 122000,
68
+ "provenance": {
69
+ "provider": "perplexity",
70
+ "variant": "sonar-pro",
71
+ "model": "sonar-pro",
72
+ "collector": "dataforseo"
73
+ },
74
+ "error": null
75
+ },
76
+ {
77
+ "source": "exa",
78
+ "status": "done",
79
+ "observation": "api",
80
+ "answer": "Plausible is the lighter EU-hosted option [1].",
81
+ "citations": [
82
+ {
83
+ "url": "https://plausible.io/features",
84
+ "title": "Plausible features"
85
+ }
86
+ ],
87
+ "cost": {
88
+ "estimated": null,
89
+ "reported": "0.10"
90
+ },
91
+ "started_at": "2026-10-12T18:04:12Z",
92
+ "duration_ms": 122000,
93
+ "provenance": {
94
+ "provider": "exa",
95
+ "variant": "search",
96
+ "model": null,
97
+ "collector": null
98
+ },
99
+ "error": null
100
+ },
101
+ {
102
+ "source": "gemini",
103
+ "status": "done",
104
+ "observation": "api",
105
+ "answer": "Plausible is the lighter EU-hosted option [1].",
106
+ "citations": [
107
+ {
108
+ "url": "https://plausible.io/features",
109
+ "title": "Plausible features"
110
+ }
111
+ ],
112
+ "search_results": null,
113
+ "cost": {
114
+ "estimated": null,
115
+ "reported": "0.10"
116
+ },
117
+ "started_at": "2026-10-12T18:04:12Z",
118
+ "duration_ms": 122000,
119
+ "provenance": {
120
+ "provider": "gemini",
121
+ "variant": "grounded",
122
+ "model": null,
123
+ "collector": null
124
+ },
125
+ "error": null
126
+ }
127
+ ],
128
+ "skipped": [],
129
+ "notices": []
130
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "librarium-spec",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "Shared Librarium contract: request/Run schemas, source catalog, and conformance fixtures.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -225,6 +225,45 @@
225
225
  }
226
226
  }
227
227
  },
228
+ "search_results": {
229
+ "description": "Optional. Pages the source's own web search returned while answering, in provider order with exact-URL duplicates removed. Absent or null: the source does not report its retrieval set. [] : it reported an empty one.",
230
+ "type": [
231
+ "array",
232
+ "null"
233
+ ],
234
+ "items": {
235
+ "type": "object",
236
+ "additionalProperties": false,
237
+ "required": [
238
+ "url"
239
+ ],
240
+ "properties": {
241
+ "url": {
242
+ "type": "string",
243
+ "format": "uri"
244
+ },
245
+ "title": {
246
+ "type": [
247
+ "string",
248
+ "null"
249
+ ]
250
+ },
251
+ "snippet": {
252
+ "type": [
253
+ "string",
254
+ "null"
255
+ ]
256
+ },
257
+ "published_at": {
258
+ "type": [
259
+ "string",
260
+ "null"
261
+ ],
262
+ "format": "date-time"
263
+ }
264
+ }
265
+ }
266
+ },
228
267
  "cost": {
229
268
  "type": "object",
230
269
  "additionalProperties": false,
package/sources.json CHANGED
@@ -48,9 +48,24 @@
48
48
  "options": {
49
49
  "model": {
50
50
  "type": "string"
51
+ },
52
+ "collector": {
53
+ "default": "direct",
54
+ "values": [
55
+ "direct",
56
+ "dataforseo"
57
+ ],
58
+ "variants": {
59
+ "dataforseo": {
60
+ "js": null,
61
+ "php": "dataforseo-llm-claude",
62
+ "env": "DATAFORSEO_LOGIN+DATAFORSEO_PASSWORD"
63
+ }
64
+ }
51
65
  }
52
66
  },
53
- "php_credential": "ai.providers.anthropic.key"
67
+ "php_credential": "ai.providers.anthropic.key",
68
+ "notes": "collector dataforseo asks the same provider through DataForSEO's LLM Responses API (Live) with DataForSEO credentials."
54
69
  },
55
70
  {
56
71
  "id": "exa",
@@ -130,9 +145,27 @@
130
145
  "env": "GEMINI_API_KEY"
131
146
  }
132
147
  }
148
+ },
149
+ "collector": {
150
+ "default": "direct",
151
+ "values": [
152
+ "direct",
153
+ "dataforseo"
154
+ ],
155
+ "variants": {
156
+ "dataforseo": {
157
+ "js": null,
158
+ "php": "dataforseo-llm-gemini",
159
+ "env": "DATAFORSEO_LOGIN+DATAFORSEO_PASSWORD",
160
+ "requires": {
161
+ "quick": "grounded"
162
+ }
163
+ }
164
+ }
133
165
  }
134
166
  },
135
- "php_credential": "ai.providers.gemini.key"
167
+ "php_credential": "ai.providers.gemini.key",
168
+ "notes": "collector dataforseo asks the same provider through DataForSEO's LLM Responses API (Live) with DataForSEO credentials."
136
169
  },
137
170
  {
138
171
  "id": "google",
@@ -278,9 +311,24 @@
278
311
  },
279
312
  "effort": {
280
313
  "type": "string"
314
+ },
315
+ "collector": {
316
+ "default": "direct",
317
+ "values": [
318
+ "direct",
319
+ "dataforseo"
320
+ ],
321
+ "variants": {
322
+ "dataforseo": {
323
+ "js": null,
324
+ "php": "dataforseo-llm-chatgpt",
325
+ "env": "DATAFORSEO_LOGIN+DATAFORSEO_PASSWORD"
326
+ }
327
+ }
281
328
  }
282
329
  },
283
- "php_credential": "ai.providers.openai.key"
330
+ "php_credential": "ai.providers.openai.key",
331
+ "notes": "collector dataforseo asks the same provider through DataForSEO's LLM Responses API (Live) with DataForSEO credentials."
284
332
  },
285
333
  {
286
334
  "id": "openrouter",
@@ -416,9 +464,27 @@
416
464
  "env": "PERPLEXITY_API_KEY"
417
465
  }
418
466
  }
467
+ },
468
+ "collector": {
469
+ "default": "direct",
470
+ "values": [
471
+ "direct",
472
+ "dataforseo"
473
+ ],
474
+ "variants": {
475
+ "dataforseo": {
476
+ "js": null,
477
+ "php": "dataforseo-llm-perplexity",
478
+ "env": "DATAFORSEO_LOGIN+DATAFORSEO_PASSWORD",
479
+ "requires": {
480
+ "quick": "sonar-pro"
481
+ }
482
+ }
483
+ }
419
484
  }
420
485
  },
421
- "php_credential": "services.perplexity.key"
486
+ "php_credential": "services.perplexity.key",
487
+ "notes": "collector dataforseo asks the same provider through DataForSEO's LLM Responses API (Live) with DataForSEO credentials."
422
488
  },
423
489
  {
424
490
  "id": "tavily",