@jini-ai/registry 0.7.2 → 0.7.3-next.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/CHANGELOG.md +1 -1
- package/README.md +4 -4
- package/dist/database-backend.d.ts +1 -1
- package/dist/database-backend.js +1 -1
- package/dist/github-backend.js +2 -2
- package/dist/github-client.d.ts +30 -11
- package/dist/github-client.js +6 -56
- package/dist/ports.d.ts +1 -1
- package/dist/providers/github-http.d.ts +12 -0
- package/dist/providers/github-http.js +27 -0
- package/dist/tool-catalog/sqlite.d.ts +3 -3
- package/dist/tool-catalog/sqlite.js +2 -2
- package/dist/tool-catalog-builder/query.d.ts +2 -2
- package/dist/tool-catalog-builder/query.js +2 -2
- package/dist/tool-catalog-builder/search-enricher.d.ts +1 -1
- package/dist/tool-catalog-builder/search-enricher.js +1 -1
- package/dist/tool-catalog-builder/sqlite.d.ts +2 -2
- package/dist/tool-catalog-builder/sqlite.js +1 -1
- package/dist/trust-certificates.d.ts +14 -4
- package/dist/trust-certificates.js +6 -6
- package/dist/trust.js +3 -3
- package/dist/versioning.d.ts +1 -1
- package/dist/versioning.js +1 -1
- package/package.json +9 -15
package/CHANGELOG.md
CHANGED
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
|
|
87
87
|
## 0.5.2 — 2026-10-08
|
|
88
88
|
|
|
89
|
-
-
|
|
89
|
+
- Host clean-up release: code the first host moved into Jini, plus the Jini clean-up (see the commit log).
|
|
90
90
|
|
|
91
91
|
## 0.5.1 — 2026-10-05
|
|
92
92
|
|
package/README.md
CHANGED
|
@@ -31,10 +31,10 @@ resolution/trust helpers need nothing extra, so most adopters never pay the nati
|
|
|
31
31
|
`GithubRegistryClient`. `GithubApiRegistryClient` / `GithubApiRegistryClientOptions` is the real
|
|
32
32
|
HTTP implementation of that client interface.
|
|
33
33
|
- `DatabaseRegistryBackend` / `DatabaseRegistryBackendOptions` — SQL-backed, over a database handle
|
|
34
|
-
you supply. `ensureRegistryTables(db)` creates the schema; `upsertRegistryEntry(db, entry)` writes
|
|
34
|
+
you supply. `ensureRegistryTables({ db })` creates the schema; `upsertRegistryEntry(db, entry)` writes
|
|
35
35
|
a single entry.
|
|
36
36
|
|
|
37
|
-
**Version resolution** — `parseRegistrySpecifier('acme/theme@^2.1.0')` → `ParsedRegistrySpecifier`
|
|
37
|
+
**Version resolution** — `parseRegistrySpecifier({ input: 'acme/theme@^2.1.0' })` → `ParsedRegistrySpecifier`
|
|
38
38
|
(`{ name, range? }`), and `resolveRegistryEntryVersion` → `ResolvedRegistryEntryVersion`.
|
|
39
39
|
|
|
40
40
|
**Signature trust** — `verifyRegistryEntrySignatures` and `verifyRegistrySignature` returning a
|
|
@@ -75,13 +75,13 @@ const registry = new StaticRegistryBackend({
|
|
|
75
75
|
},
|
|
76
76
|
});
|
|
77
77
|
|
|
78
|
-
const { name, range } = parseRegistrySpecifier('acme/theme@^2.1.0');
|
|
78
|
+
const { name, range } = parseRegistrySpecifier({ input: 'acme/theme@^2.1.0' });
|
|
79
79
|
const resolved = await registry.resolve(name, range); // ResolvedRegistryEntry | null
|
|
80
80
|
|
|
81
81
|
// Or the SQL-backed variant, over a handle you own.
|
|
82
82
|
import Database from 'better-sqlite3';
|
|
83
83
|
const db = new Database('/var/lib/example/registry.sqlite');
|
|
84
|
-
ensureRegistryTables(db);
|
|
84
|
+
ensureRegistryTables({ db });
|
|
85
85
|
const dbRegistry = new DatabaseRegistryBackend({ id: 'local', trust: 'restricted', db });
|
|
86
86
|
```
|
|
87
87
|
|
|
@@ -41,7 +41,7 @@ export declare class DatabaseRegistryBackend extends StaticRegistryBackend {
|
|
|
41
41
|
*/
|
|
42
42
|
export declare function ensureRegistryTables({ db }: {
|
|
43
43
|
db: SqliteDb;
|
|
44
|
-
}): void;
|
|
44
|
+
}, _optional?: Record<string, never>): void;
|
|
45
45
|
/**
|
|
46
46
|
* Insert or update one registry entry's row for a given backend.
|
|
47
47
|
*
|
package/dist/database-backend.js
CHANGED
|
@@ -107,7 +107,7 @@ function publishedVersionRecords({ entry }, _options = {}) {
|
|
|
107
107
|
*
|
|
108
108
|
* @param db - The sqlite connection to migrate.
|
|
109
109
|
*/
|
|
110
|
-
export function ensureRegistryTables({ db }) {
|
|
110
|
+
export function ensureRegistryTables({ db }, _optional = {}) {
|
|
111
111
|
db.exec(`
|
|
112
112
|
CREATE TABLE IF NOT EXISTS registry_entries (
|
|
113
113
|
backend_id TEXT NOT NULL,
|
package/dist/github-backend.js
CHANGED
|
@@ -3,8 +3,8 @@ import { assertValidPublishRequest, StaticRegistryBackend } from './static-backe
|
|
|
3
3
|
const SAFE_ENTRY_NAME = /^([a-z0-9][a-z0-9._-]*)\/([a-z0-9][a-z0-9._-]*)$/;
|
|
4
4
|
/** A single safe path/branch segment: alnum-bounded, no separators, no traversal. */
|
|
5
5
|
const SAFE_VERSION = /^[A-Za-z0-9](?:[A-Za-z0-9._+-]*[A-Za-z0-9])?$/;
|
|
6
|
-
//
|
|
7
|
-
const CONTROL_CHARS = /[\
|
|
6
|
+
// Deliberately match C0/DEL control bytes, while allowing tab, newline, and carriage return.
|
|
7
|
+
const CONTROL_CHARS = /(?![\t\n\r\u0080-\u009F])\p{Cc}/u;
|
|
8
8
|
/**
|
|
9
9
|
* Split and validate a registry entry name into safe `vendor`/`name` path
|
|
10
10
|
* segments. `publish`/`yank` are public methods that take plain strings from
|
package/dist/github-client.d.ts
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module github-client
|
|
3
|
+
*
|
|
4
|
+
* A concrete `GithubRegistryClient` (the interface `github-backend.ts`
|
|
5
|
+
* defines and takes as an injected dependency) implemented against GitHub's
|
|
6
|
+
* real REST API. Per `archived provenance ledger`'s "2026-07-21 hardening pass": "No
|
|
7
|
+
* concrete `GithubRegistryClient` HTTP implementation exists in this
|
|
8
|
+
* package — `readManifest`/`createPublishPullRequest` are an injected
|
|
9
|
+
* interface with no concrete implementation anywhere in this repo." This
|
|
10
|
+
* file closes that gap.
|
|
11
|
+
*
|
|
12
|
+
* Built directly against GitHub's published REST API docs (Contents API,
|
|
13
|
+
* Git Data API, Pulls API — see each function's doc comment for the exact
|
|
14
|
+
* endpoint/behavior it was verified against), following the same "raw
|
|
15
|
+
* `fetch`, no SDK dependency" convention `@jini-ai/deploy`'s `packages/agent-plugins/netlify/targets/netlify.mjs`/
|
|
16
|
+
* `packages/agent-plugins/github-pages/targets/github-pages.mjs` already establish (this package has no `@jini-ai/deploy`
|
|
17
|
+
* dependency and does not gain one — the blob/tree/commit/ref mechanics
|
|
18
|
+
* below are written fresh for this package, not shared cross-package, since
|
|
19
|
+
* there is no existing shared low-level GitHub REST helper package).
|
|
20
|
+
* The HTTP orchestration now uses a host-injected transport port: hosts can
|
|
21
|
+
* bind that established timeout helper while preserving its cancellation and
|
|
22
|
+
* error semantics, and tests can exercise the request flow without global I/O.
|
|
23
|
+
* The kernel HttpClientPort owns timeout/cancellation and timeout error types. Requests retain
|
|
24
|
+
* the QUICK total bound and an explicit idle budget; request orchestration never chooses global
|
|
25
|
+
* fetch. Hosts can bind the existing helper or a policy-enforcing egress client without a new port.
|
|
26
|
+
*/
|
|
1
27
|
import type { HttpClientPort } from '@jini-ai/core/primitives';
|
|
2
28
|
import type { RegistryManifest } from '@jini-ai/protocol';
|
|
3
29
|
import type { GithubPublishMutation, GithubRegistryClient } from './github-backend.js';
|
|
@@ -23,8 +49,7 @@ export interface GithubApiRegistryClientOptions {
|
|
|
23
49
|
*/
|
|
24
50
|
export declare class GithubApiRegistryClient implements GithubRegistryClient {
|
|
25
51
|
private readonly token;
|
|
26
|
-
private readonly
|
|
27
|
-
private readonly http;
|
|
52
|
+
private readonly send;
|
|
28
53
|
constructor({ http }: {
|
|
29
54
|
http: HttpClientPort;
|
|
30
55
|
}, options?: GithubApiRegistryClientOptions);
|
|
@@ -62,7 +87,7 @@ export declare class GithubApiRegistryClient implements GithubRegistryClient {
|
|
|
62
87
|
* `request.baseRef`) via the Git Data API — create a blob per file, a tree
|
|
63
88
|
* layered on the base commit's tree, a commit, and a branch ref — then
|
|
64
89
|
* opens a pull request via `POST /repos/{owner}/{repo}/pulls`. Mirrors the
|
|
65
|
-
* blob→tree→commit→ref mechanics `@jini-ai/deploy`'s `github-pages.
|
|
90
|
+
* blob→tree→commit→ref mechanics `@jini-ai/deploy`'s `packages/agent-plugins/github-pages/targets/github-pages.mjs` already
|
|
66
91
|
* verified against GitHub's Git Data API docs, extended with an actual
|
|
67
92
|
* Pulls API call (that file force-pushes a branch directly; this one opens
|
|
68
93
|
* a PR against `baseRef` instead, matching `GithubPublishMutation`'s shape).
|
|
@@ -87,7 +112,7 @@ export declare class GithubApiRegistryClient implements GithubRegistryClient {
|
|
|
87
112
|
* against GitHub's Git Data Refs API docs: create returns `409 Conflict`
|
|
88
113
|
* when the ref already exists; update accepts `force: true` to bypass the
|
|
89
114
|
* fast-forward-only default — same "last publish wins" reasoning
|
|
90
|
-
* `@jini-ai/deploy`'s `github-pages.
|
|
115
|
+
* `@jini-ai/deploy`'s `packages/agent-plugins/github-pages/targets/github-pages.mjs` already documents for its own ref update.
|
|
91
116
|
*/
|
|
92
117
|
private ensureBranch;
|
|
93
118
|
/**
|
|
@@ -95,17 +120,11 @@ export declare class GithubApiRegistryClient implements GithubRegistryClient {
|
|
|
95
120
|
* because a pull request for this exact head/base already exists (the
|
|
96
121
|
* documented shape of that failure is a `422` whose `message` says so) —
|
|
97
122
|
* looks up and returns the existing PR's URL instead. Same
|
|
98
|
-
* try-then-recover-on-conflict shape `@jini-ai/deploy`'s `netlify.
|
|
123
|
+
* try-then-recover-on-conflict shape `@jini-ai/deploy`'s `packages/agent-plugins/netlify/targets/netlify.mjs`
|
|
99
124
|
* (`ensureNetlifySite`) already establishes for a different provider's
|
|
100
125
|
* analogous "create-or-find" race.
|
|
101
126
|
*/
|
|
102
127
|
private ensurePullRequest;
|
|
103
128
|
private findOpenPullRequest;
|
|
104
|
-
/**
|
|
105
|
-
* The single request builder: every call goes to `apiUrl` with the GitHub
|
|
106
|
-
* headers (bearer auth only when a token is configured) and the QUICK
|
|
107
|
-
* idle/total bounds. A JSON `body` adds the JSON content type.
|
|
108
|
-
*/
|
|
109
|
-
private send;
|
|
110
129
|
}
|
|
111
130
|
//# sourceMappingURL=github-client.d.ts.map
|
package/dist/github-client.js
CHANGED
|
@@ -1,33 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* @module github-client
|
|
3
|
-
*
|
|
4
|
-
* A concrete `GithubRegistryClient` (the interface `github-backend.ts`
|
|
5
|
-
* defines and takes as an injected dependency) implemented against GitHub's
|
|
6
|
-
* real REST API. Per `archived provenance ledger`'s "2026-07-21 hardening pass": "No
|
|
7
|
-
* concrete `GithubRegistryClient` HTTP implementation exists in this
|
|
8
|
-
* package — `readManifest`/`createPublishPullRequest` are an injected
|
|
9
|
-
* interface with no concrete implementation anywhere in this repo." This
|
|
10
|
-
* file closes that gap.
|
|
11
|
-
*
|
|
12
|
-
* Built directly against GitHub's published REST API docs (Contents API,
|
|
13
|
-
* Git Data API, Pulls API — see each function's doc comment for the exact
|
|
14
|
-
* endpoint/behavior it was verified against), following the same "raw
|
|
15
|
-
* `fetch`, no SDK dependency" convention `@jini-ai/deploy`'s `netlify.ts`/
|
|
16
|
-
* `github-pages.ts` already establish (this package has no `@jini-ai/deploy`
|
|
17
|
-
* dependency and does not gain one — the blob/tree/commit/ref mechanics
|
|
18
|
-
* below are written fresh for this package, not shared cross-package, since
|
|
19
|
-
* there is no existing shared low-level GitHub REST helper package).
|
|
20
|
-
* The HTTP orchestration now uses a host-injected transport port: hosts can
|
|
21
|
-
* bind that established timeout helper while preserving its cancellation and
|
|
22
|
-
* error semantics, and tests can exercise the request flow without global I/O.
|
|
23
|
-
* The kernel HttpClientPort owns timeout/cancellation and timeout error types. Requests retain
|
|
24
|
-
* the QUICK total bound and an explicit idle budget; request orchestration never chooses global
|
|
25
|
-
* fetch. Hosts can bind the existing helper or a policy-enforcing egress client without a new port.
|
|
26
|
-
*/
|
|
27
|
-
import { FETCH_TIMEOUT_MS } from '@jini-ai/platform/fetch-with-timeout';
|
|
28
|
-
const GITHUB_API = 'https://api.github.com';
|
|
29
|
-
/** Pinned per GitHub's own recommendation (`X-GitHub-Api-Version` header), matching `@jini-ai/deploy`'s `github-pages.ts` — see that file's doc comment for the sourcing rationale. */
|
|
30
|
-
const GITHUB_API_VERSION = '2026-03-10';
|
|
1
|
+
import { createGithubSender } from './providers/github-http.js';
|
|
31
2
|
/**
|
|
32
3
|
* `GithubRegistryClient` implementation against GitHub's real REST API:
|
|
33
4
|
* `readManifest` reads a file via the Contents API; `createPublishPullRequest`
|
|
@@ -36,12 +7,10 @@ const GITHUB_API_VERSION = '2026-03-10';
|
|
|
36
7
|
*/
|
|
37
8
|
export class GithubApiRegistryClient {
|
|
38
9
|
token;
|
|
39
|
-
|
|
40
|
-
http;
|
|
10
|
+
send;
|
|
41
11
|
constructor({ http }, options = {}) {
|
|
42
|
-
this.http = http;
|
|
43
12
|
this.token = options.token;
|
|
44
|
-
this.
|
|
13
|
+
this.send = createGithubSender({ http, token: this.token }, options);
|
|
45
14
|
}
|
|
46
15
|
/**
|
|
47
16
|
* Reads `path` at `ref` via `GET /repos/{owner}/{repo}/contents/{path}`
|
|
@@ -83,7 +52,7 @@ export class GithubApiRegistryClient {
|
|
|
83
52
|
* `request.baseRef`) via the Git Data API — create a blob per file, a tree
|
|
84
53
|
* layered on the base commit's tree, a commit, and a branch ref — then
|
|
85
54
|
* opens a pull request via `POST /repos/{owner}/{repo}/pulls`. Mirrors the
|
|
86
|
-
* blob→tree→commit→ref mechanics `@jini-ai/deploy`'s `github-pages.
|
|
55
|
+
* blob→tree→commit→ref mechanics `@jini-ai/deploy`'s `packages/agent-plugins/github-pages/targets/github-pages.mjs` already
|
|
87
56
|
* verified against GitHub's Git Data API docs, extended with an actual
|
|
88
57
|
* Pulls API call (that file force-pushes a branch directly; this one opens
|
|
89
58
|
* a PR against `baseRef` instead, matching `GithubPublishMutation`'s shape).
|
|
@@ -146,7 +115,7 @@ export class GithubApiRegistryClient {
|
|
|
146
115
|
* against GitHub's Git Data Refs API docs: create returns `409 Conflict`
|
|
147
116
|
* when the ref already exists; update accepts `force: true` to bypass the
|
|
148
117
|
* fast-forward-only default — same "last publish wins" reasoning
|
|
149
|
-
* `@jini-ai/deploy`'s `github-pages.
|
|
118
|
+
* `@jini-ai/deploy`'s `packages/agent-plugins/github-pages/targets/github-pages.mjs` already documents for its own ref update.
|
|
150
119
|
*/
|
|
151
120
|
async ensureBranch(owner, repo, branch, sha) {
|
|
152
121
|
const createResp = await this.send('POST', `${repoPath(owner, repo)}/git/refs`, { ref: `refs/heads/${branch}`, sha });
|
|
@@ -164,7 +133,7 @@ export class GithubApiRegistryClient {
|
|
|
164
133
|
* because a pull request for this exact head/base already exists (the
|
|
165
134
|
* documented shape of that failure is a `422` whose `message` says so) —
|
|
166
135
|
* looks up and returns the existing PR's URL instead. Same
|
|
167
|
-
* try-then-recover-on-conflict shape `@jini-ai/deploy`'s `netlify.
|
|
136
|
+
* try-then-recover-on-conflict shape `@jini-ai/deploy`'s `packages/agent-plugins/netlify/targets/netlify.mjs`
|
|
168
137
|
* (`ensureNetlifySite`) already establishes for a different provider's
|
|
169
138
|
* analogous "create-or-find" race.
|
|
170
139
|
*/
|
|
@@ -191,17 +160,6 @@ export class GithubApiRegistryClient {
|
|
|
191
160
|
const first = json[0];
|
|
192
161
|
return first && typeof first.html_url === 'string' ? first.html_url : undefined;
|
|
193
162
|
}
|
|
194
|
-
/**
|
|
195
|
-
* The single request builder: every call goes to `apiUrl` with the GitHub
|
|
196
|
-
* headers (bearer auth only when a token is configured) and the QUICK
|
|
197
|
-
* idle/total bounds. A JSON `body` adds the JSON content type.
|
|
198
|
-
*/
|
|
199
|
-
send(method, path, body) {
|
|
200
|
-
const json = body === undefined ? undefined : JSON.stringify(body);
|
|
201
|
-
const headers = githubHeaders(this.token, json === undefined ? {} : { 'Content-Type': 'application/json' });
|
|
202
|
-
const request = { url: `${this.apiUrl}${path}`, method, headers, idleTimeoutMs: FETCH_TIMEOUT_MS.QUICK, totalDeadlineMs: FETCH_TIMEOUT_MS.QUICK, ...(json === undefined ? {} : { body: json }) };
|
|
203
|
-
return this.http.send({ request });
|
|
204
|
-
}
|
|
205
163
|
}
|
|
206
164
|
function enc(value) {
|
|
207
165
|
return encodeURIComponent(value);
|
|
@@ -269,14 +227,6 @@ function parseManifest(content, where) {
|
|
|
269
227
|
function encPath(path) {
|
|
270
228
|
return path.split('/').filter(Boolean).map(encodeURIComponent).join('/');
|
|
271
229
|
}
|
|
272
|
-
function githubHeaders(token, extra = {}) {
|
|
273
|
-
return {
|
|
274
|
-
Accept: 'application/vnd.github+json',
|
|
275
|
-
'X-GitHub-Api-Version': GITHUB_API_VERSION,
|
|
276
|
-
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
|
277
|
-
...extra,
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
230
|
async function readGithubJson(resp) {
|
|
281
231
|
try {
|
|
282
232
|
return JSON.parse(resp.bodyText);
|
package/dist/ports.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SqliteDb } from '@jini-ai/
|
|
1
|
+
import type { SqliteDb } from '@jini-ai/core/contracts/storage';
|
|
2
2
|
/** The host owns the connection and its lifetime; registry never opens a default database. */
|
|
3
3
|
export type RegistryDatabasePort = Pick<SqliteDb, 'prepare' | 'exec' | 'transaction'>;
|
|
4
4
|
//# sourceMappingURL=ports.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HttpClientPort, HttpResponse } from '@jini-ai/core/primitives';
|
|
2
|
+
import type { GithubApiRegistryClientOptions } from '../github-client.js';
|
|
3
|
+
/**
|
|
4
|
+
* The single request builder: every call goes to `apiUrl` with the GitHub
|
|
5
|
+
* headers (bearer auth only when a token is configured) and the QUICK
|
|
6
|
+
* idle/total bounds. A JSON `body` adds the JSON content type.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createGithubSender({ http, token }: {
|
|
9
|
+
http: HttpClientPort;
|
|
10
|
+
token: string | undefined;
|
|
11
|
+
}, options?: Pick<GithubApiRegistryClientOptions, 'apiUrl'>): (method: "GET" | "POST" | "PATCH", path: string, body?: Record<string, unknown>) => Promise<HttpResponse>;
|
|
12
|
+
//# sourceMappingURL=github-http.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FETCH_TIMEOUT_MS } from '@jini-ai/core/net';
|
|
2
|
+
const GITHUB_API = 'https://api.github.com';
|
|
3
|
+
/** Pinned per GitHub's own recommendation (`X-GitHub-Api-Version` header), matching `@jini-ai/deploy`'s `packages/agent-plugins/github-pages/targets/github-pages.mjs` — see that file's doc comment for the sourcing rationale. */
|
|
4
|
+
const GITHUB_API_VERSION = '2026-03-10';
|
|
5
|
+
/**
|
|
6
|
+
* The single request builder: every call goes to `apiUrl` with the GitHub
|
|
7
|
+
* headers (bearer auth only when a token is configured) and the QUICK
|
|
8
|
+
* idle/total bounds. A JSON `body` adds the JSON content type.
|
|
9
|
+
*/
|
|
10
|
+
export function createGithubSender({ http, token }, options = {}) {
|
|
11
|
+
const apiUrl = options.apiUrl ?? GITHUB_API;
|
|
12
|
+
return (method, path, body) => {
|
|
13
|
+
const json = body === undefined ? undefined : JSON.stringify(body);
|
|
14
|
+
const headers = githubHeaders(token, json === undefined ? {} : { 'Content-Type': 'application/json' });
|
|
15
|
+
const request = { url: `${apiUrl}${path}`, method, headers, idleTimeoutMs: FETCH_TIMEOUT_MS.QUICK, totalDeadlineMs: FETCH_TIMEOUT_MS.QUICK, ...(json === undefined ? {} : { body: json }) };
|
|
16
|
+
return http.send({ request });
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function githubHeaders(token, extra = {}) {
|
|
20
|
+
return {
|
|
21
|
+
Accept: 'application/vnd.github+json',
|
|
22
|
+
'X-GitHub-Api-Version': GITHUB_API_VERSION,
|
|
23
|
+
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
|
24
|
+
...extra,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=github-http.js.map
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
* the asymmetry `examples/nlweb-demo`'s keyword-scoring spike measured) are passed to `bm25()` at
|
|
27
27
|
* query time, not baked into the index.
|
|
28
28
|
*/
|
|
29
|
-
import type { SqliteDb } from '@jini-ai/
|
|
29
|
+
import type { SqliteDb } from '@jini-ai/core/contracts/storage';
|
|
30
30
|
import type { ToolCatalogEntry, ToolCatalogSearchHit } from './index.js';
|
|
31
31
|
export type { ToolCatalogEntry, ToolCatalogSearchHit } from './index.js';
|
|
32
32
|
/** Idempotent. Safe to call repeatedly (`IF NOT EXISTS`), matching `migrate()`'s own convention. */
|
|
33
33
|
export declare function ensureToolCatalogTables({ db }: {
|
|
34
34
|
db: SqliteDb;
|
|
35
|
-
}): void;
|
|
35
|
+
}, _optional?: Record<string, never>): void;
|
|
36
36
|
/**
|
|
37
37
|
* Replaces the entire catalog with `entries` in one transaction — this table is a *snapshot* of
|
|
38
38
|
* whatever `ToolRegistry` a host assembled at boot, not an independently-edited store (§7.2's
|
|
@@ -54,7 +54,7 @@ export declare function reseedToolCatalog({ db, entries }: {
|
|
|
54
54
|
export declare function getToolCatalogEntry({ db, id }: {
|
|
55
55
|
db: SqliteDb;
|
|
56
56
|
id: string;
|
|
57
|
-
}): ToolCatalogEntry | null;
|
|
57
|
+
}, _optional?: Record<string, never>): ToolCatalogEntry | null;
|
|
58
58
|
/**
|
|
59
59
|
* `PROP` §6.1's `search_tools`: candidates only, no schemas — loading schemas at search time is
|
|
60
60
|
* what blows the context budget. Never returns an empty-query "everything" page (§6.1's staged
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Idempotent. Safe to call repeatedly (`IF NOT EXISTS`), matching `migrate()`'s own convention. */
|
|
2
|
-
export function ensureToolCatalogTables({ db }) {
|
|
2
|
+
export function ensureToolCatalogTables({ db }, _optional = {}) {
|
|
3
3
|
db.exec(`
|
|
4
4
|
CREATE TABLE IF NOT EXISTS tool_catalog (
|
|
5
5
|
id TEXT NOT NULL PRIMARY KEY,
|
|
@@ -43,7 +43,7 @@ export function reseedToolCatalog({ db, entries }, { now = Date.now() } = {}) {
|
|
|
43
43
|
});
|
|
44
44
|
replace(entries);
|
|
45
45
|
}
|
|
46
|
-
export function getToolCatalogEntry({ db, id }) {
|
|
46
|
+
export function getToolCatalogEntry({ db, id }, _optional = {}) {
|
|
47
47
|
const row = db.prepare('SELECT id, description, input_schema_json, source FROM tool_catalog WHERE id = ?').get(id);
|
|
48
48
|
if (!row)
|
|
49
49
|
return null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CatalogBuilderArgs, ToolCatalogEntry, ToolCatalogQuery } from './ports.js';
|
|
2
2
|
/** Live overview, preserving registration order; vocabulary and source policy are host-owned. */
|
|
3
|
-
export declare function listToolCatalogEntries(required: Pick<CatalogBuilderArgs, 'source' | 'enricher' | 'classifier'>): ToolCatalogEntry[];
|
|
3
|
+
export declare function listToolCatalogEntries(required: Pick<CatalogBuilderArgs, 'source' | 'enricher' | 'classifier'>, _optional?: Record<string, never>): ToolCatalogEntry[];
|
|
4
4
|
/** Disposable discovery snapshot; no SQLite construction or provider import in this builder.
|
|
5
5
|
* Descriptor, enrichment, source-classification and backend construction are host ports; this
|
|
6
6
|
* assembly does not import the storage catalog or a concrete ranking provider. Search defaults
|
|
@@ -28,5 +28,5 @@ export interface LiveToolCatalogQuery {
|
|
|
28
28
|
* source each time rather than promising that a disposable search snapshot is automatically fresh. */
|
|
29
29
|
export declare function createLiveToolCatalogQuery(required: {
|
|
30
30
|
initial: ToolCatalogQuery;
|
|
31
|
-
}): LiveToolCatalogQuery;
|
|
31
|
+
}, _optional?: Record<string, never>): LiveToolCatalogQuery;
|
|
32
32
|
//# sourceMappingURL=query.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { toolDiscoveryMetadata } from '@jini-ai/core';
|
|
|
2
2
|
import { nowIso } from '@jini-ai/core/primitives';
|
|
3
3
|
import { inputSignature } from './input-signature.js';
|
|
4
4
|
/** Live overview, preserving registration order; vocabulary and source policy are host-owned. */
|
|
5
|
-
export function listToolCatalogEntries(required) {
|
|
5
|
+
export function listToolCatalogEntries(required, _optional = {}) {
|
|
6
6
|
return required.source.list().map(descriptor => ({
|
|
7
7
|
id: descriptor.id,
|
|
8
8
|
source: required.classifier.classify({ id: descriptor.id }),
|
|
@@ -66,7 +66,7 @@ export function buildToolCatalogQuery(required, optional = {}) {
|
|
|
66
66
|
* Rebinding swaps subsequent requests without changing the object routes already hold.
|
|
67
67
|
* Backend retirement is separate and host-owned; the live overview re-reads the descriptor
|
|
68
68
|
* source each time rather than promising that a disposable search snapshot is automatically fresh. */
|
|
69
|
-
export function createLiveToolCatalogQuery(required) {
|
|
69
|
+
export function createLiveToolCatalogQuery(required, _optional = {}) {
|
|
70
70
|
let current = required.initial;
|
|
71
71
|
return {
|
|
72
72
|
query: {
|
|
@@ -11,5 +11,5 @@ export declare function createSearchEnricher(required: {
|
|
|
11
11
|
export declare function createPrefixSourceClassifier(required: {
|
|
12
12
|
separator: string;
|
|
13
13
|
fallbackSource: string;
|
|
14
|
-
}): SourceClassifier;
|
|
14
|
+
}, _optional?: Record<string, never>): SourceClassifier;
|
|
15
15
|
//# sourceMappingURL=search-enricher.d.ts.map
|
|
@@ -26,7 +26,7 @@ function ownValue(record, id) {
|
|
|
26
26
|
return Object.hasOwn(record, id) ? record[id] : undefined;
|
|
27
27
|
}
|
|
28
28
|
/** Source naming conventions are supplied by the host, including the orphan-ID fallback. */
|
|
29
|
-
export function createPrefixSourceClassifier(required) {
|
|
29
|
+
export function createPrefixSourceClassifier(required, _optional = {}) {
|
|
30
30
|
if (!required.separator || !required.fallbackSource)
|
|
31
31
|
throw new Error('source separator and fallback must not be empty');
|
|
32
32
|
return { classify({ id }) { return id.split(required.separator)[0] || required.fallbackSource; } };
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* Reseeding, tokenization, BM25 weights and score inversion remain in the storage adapter.
|
|
7
7
|
* Keep this on a separate Node subpath so browser consumers never load storage imports.
|
|
8
8
|
*/
|
|
9
|
-
import type { SqliteDb } from '@jini-ai/
|
|
9
|
+
import type { SqliteDb } from '@jini-ai/core/contracts/storage';
|
|
10
10
|
import type { CatalogStoreFactory } from './ports.js';
|
|
11
11
|
export declare function createSqliteCatalogStoreFactory({ db }: {
|
|
12
12
|
db: SqliteDb;
|
|
13
|
-
}): CatalogStoreFactory;
|
|
13
|
+
}, _optional?: Record<string, never>): CatalogStoreFactory;
|
|
14
14
|
//# sourceMappingURL=sqlite.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ensureToolCatalogTables, getToolCatalogEntry, reseedToolCatalog, searchToolCatalog } from '../tool-catalog/sqlite.js';
|
|
2
|
-
export function createSqliteCatalogStoreFactory({ db }) {
|
|
2
|
+
export function createSqliteCatalogStoreFactory({ db }, _optional = {}) {
|
|
3
3
|
return {
|
|
4
4
|
create({ entries, builtAtIso }) {
|
|
5
5
|
const now = Date.parse(builtAtIso);
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { X509Certificate } from 'node:crypto';
|
|
9
9
|
/** @internal Split a PEM string that may contain a leaf certificate followed by one or more intermediate certificates into individual parsed certificates, leaf first. */
|
|
10
|
-
export declare function parseCertificateBundle(pem
|
|
10
|
+
export declare function parseCertificateBundle({ pem }: {
|
|
11
|
+
pem: string;
|
|
12
|
+
}, _optional?: Record<string, never>): X509Certificate[];
|
|
11
13
|
/**
|
|
12
14
|
* @internal Walk from `chain[0]` (the leaf) through any bundled
|
|
13
15
|
* intermediates toward a certificate in `trustedCas`, checking a genuine
|
|
@@ -16,7 +18,10 @@ export declare function parseCertificateBundle(pem: string): X509Certificate[];
|
|
|
16
18
|
* trustedCas.length + 1` hops so a malformed/cyclic bundle cannot loop
|
|
17
19
|
* forever.
|
|
18
20
|
*/
|
|
19
|
-
export declare function chainToTrustedRoot(chain
|
|
21
|
+
export declare function chainToTrustedRoot({ chain, trustedCas }: {
|
|
22
|
+
chain: X509Certificate[];
|
|
23
|
+
trustedCas: X509Certificate[];
|
|
24
|
+
}, _optional?: Record<string, never>): boolean;
|
|
20
25
|
/**
|
|
21
26
|
* @internal `checkIssued` (DN linkage) AND `verify` (the actual cryptographic
|
|
22
27
|
* signature check) — either alone is insufficient: DN match alone proves
|
|
@@ -44,7 +49,12 @@ export declare function chainToTrustedRoot(chain: X509Certificate[], trustedCas:
|
|
|
44
49
|
* arbitrary user input). The `catch` here is genuinely unreachable through
|
|
45
50
|
* this module's real call graph, confirmed empirically, not merely asserted.
|
|
46
51
|
*/
|
|
47
|
-
export declare function certIssuedAndSignedBy(cert
|
|
52
|
+
export declare function certIssuedAndSignedBy({ cert, issuer }: {
|
|
53
|
+
cert: Pick<X509Certificate, 'checkIssued' | 'verify'>;
|
|
54
|
+
issuer: X509Certificate;
|
|
55
|
+
}, _optional?: Record<string, never>): boolean;
|
|
48
56
|
/** @internal Extract `URI:...` entries from an `X509Certificate#subjectAltName` string (e.g. `"URI:https://github.com/acme/example/.github/workflows/build.yml@refs/heads/main"`, comma-separated when multiple SAN entries are present). */
|
|
49
|
-
export declare function parseSanUris(subjectAltName
|
|
57
|
+
export declare function parseSanUris({ subjectAltName }: {
|
|
58
|
+
subjectAltName: string | null | undefined;
|
|
59
|
+
}, _optional?: Record<string, never>): string[];
|
|
50
60
|
//# sourceMappingURL=trust-certificates.d.ts.map
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { X509Certificate } from 'node:crypto';
|
|
9
9
|
/** @internal Split a PEM string that may contain a leaf certificate followed by one or more intermediate certificates into individual parsed certificates, leaf first. */
|
|
10
|
-
export function parseCertificateBundle(pem) {
|
|
10
|
+
export function parseCertificateBundle({ pem }, _optional = {}) {
|
|
11
11
|
const blocks = pem.match(/-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----/g) ?? [];
|
|
12
12
|
return blocks.map((block) => new X509Certificate(block));
|
|
13
13
|
}
|
|
@@ -19,16 +19,16 @@ export function parseCertificateBundle(pem) {
|
|
|
19
19
|
* trustedCas.length + 1` hops so a malformed/cyclic bundle cannot loop
|
|
20
20
|
* forever.
|
|
21
21
|
*/
|
|
22
|
-
export function chainToTrustedRoot(chain, trustedCas) {
|
|
22
|
+
export function chainToTrustedRoot({ chain, trustedCas }, _optional = {}) {
|
|
23
23
|
let current = chain[0];
|
|
24
24
|
if (!current)
|
|
25
25
|
return false;
|
|
26
26
|
const remaining = chain.slice(1);
|
|
27
27
|
const maxHops = chain.length + trustedCas.length + 1;
|
|
28
28
|
for (let hop = 0; hop < maxHops; hop += 1) {
|
|
29
|
-
if (trustedCas.some((ca) => certIssuedAndSignedBy(current, ca)))
|
|
29
|
+
if (trustedCas.some((ca) => certIssuedAndSignedBy({ cert: current, issuer: ca })))
|
|
30
30
|
return true;
|
|
31
|
-
const nextIndex = remaining.findIndex((candidate) => certIssuedAndSignedBy(current, candidate));
|
|
31
|
+
const nextIndex = remaining.findIndex((candidate) => certIssuedAndSignedBy({ cert: current, issuer: candidate }));
|
|
32
32
|
if (nextIndex === -1)
|
|
33
33
|
return false;
|
|
34
34
|
current = remaining[nextIndex];
|
|
@@ -63,7 +63,7 @@ export function chainToTrustedRoot(chain, trustedCas) {
|
|
|
63
63
|
* arbitrary user input). The `catch` here is genuinely unreachable through
|
|
64
64
|
* this module's real call graph, confirmed empirically, not merely asserted.
|
|
65
65
|
*/
|
|
66
|
-
export function certIssuedAndSignedBy(cert, issuer) {
|
|
66
|
+
export function certIssuedAndSignedBy({ cert, issuer }, _optional = {}) {
|
|
67
67
|
try {
|
|
68
68
|
return cert.checkIssued(issuer) && cert.verify(issuer.publicKey);
|
|
69
69
|
}
|
|
@@ -72,7 +72,7 @@ export function certIssuedAndSignedBy(cert, issuer) {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
/** @internal Extract `URI:...` entries from an `X509Certificate#subjectAltName` string (e.g. `"URI:https://github.com/acme/example/.github/workflows/build.yml@refs/heads/main"`, comma-separated when multiple SAN entries are present). */
|
|
75
|
-
export function parseSanUris(subjectAltName) {
|
|
75
|
+
export function parseSanUris({ subjectAltName }, _optional = {}) {
|
|
76
76
|
if (!subjectAltName)
|
|
77
77
|
return [];
|
|
78
78
|
return subjectAltName
|
package/dist/trust.js
CHANGED
|
@@ -144,7 +144,7 @@ function verifyGithubOidcSignature({ entry, signature }, { root } = {}) {
|
|
|
144
144
|
const leaf = checkCertificate(fields.certificate, root, fields.signedAt);
|
|
145
145
|
if ('reason' in leaf)
|
|
146
146
|
return leaf;
|
|
147
|
-
const identities = parseSanUris(leaf.subjectAltName);
|
|
147
|
+
const identities = parseSanUris({ subjectAltName: leaf.subjectAltName });
|
|
148
148
|
if (!identityAllowed(identities, root.allowedIdentities)) {
|
|
149
149
|
return fail('signer identity is not in the configured allowlist');
|
|
150
150
|
}
|
|
@@ -174,7 +174,7 @@ function checkSignatureFields(signature, root) {
|
|
|
174
174
|
function checkCertificate(pem, root, signedAt) {
|
|
175
175
|
let chain;
|
|
176
176
|
try {
|
|
177
|
-
chain = parseCertificateBundle(pem);
|
|
177
|
+
chain = parseCertificateBundle({ pem });
|
|
178
178
|
}
|
|
179
179
|
catch (cause) {
|
|
180
180
|
return fail(`could not parse certificate: ${cause.message}`);
|
|
@@ -189,7 +189,7 @@ function checkCertificate(pem, root, signedAt) {
|
|
|
189
189
|
catch (cause) {
|
|
190
190
|
return fail(`configured trust root certificate is invalid: ${cause.message}`);
|
|
191
191
|
}
|
|
192
|
-
if (!chainToTrustedRoot(chain, trustedCas))
|
|
192
|
+
if (!chainToTrustedRoot({ chain, trustedCas }))
|
|
193
193
|
return fail('certificate does not chain to a configured trust root');
|
|
194
194
|
if (signedAt < leaf.validFromDate || signedAt > leaf.validToDate) {
|
|
195
195
|
return fail('signedAt falls outside the certificate validity window');
|
package/dist/versioning.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export interface ResolvedRegistryEntryVersion {
|
|
|
31
31
|
*/
|
|
32
32
|
export declare function parseRegistrySpecifier({ input }: {
|
|
33
33
|
input: string;
|
|
34
|
-
}): ParsedRegistrySpecifier;
|
|
34
|
+
}, _optional?: Record<string, never>): ParsedRegistrySpecifier;
|
|
35
35
|
/**
|
|
36
36
|
* Resolve which of a {@link RegistryEntry}'s versions satisfies a requested
|
|
37
37
|
* range, following npm-style precedence: an explicit dist-tag, then an
|
package/dist/versioning.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @param input - The raw specifier string.
|
|
7
7
|
* @returns The parsed `{ name, range? }`.
|
|
8
8
|
*/
|
|
9
|
-
export function parseRegistrySpecifier({ input }) {
|
|
9
|
+
export function parseRegistrySpecifier({ input }, _optional = {}) {
|
|
10
10
|
const trimmed = input.trim();
|
|
11
11
|
const slash = trimmed.indexOf('/');
|
|
12
12
|
const at = trimmed.lastIndexOf('@');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/registry",
|
|
3
|
-
"version": "0.7.2",
|
|
3
|
+
"version": "0.7.3-next.2",
|
|
4
4
|
"description": "Pluggable content-registry backends (static, GitHub, database) and semver specifier resolution over @jini-ai/protocol’s registry wire types.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -26,8 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"optionalPeers": {
|
|
29
|
-
"better-sqlite3": "opt-in: sqlite storage — SQLite storage could not load better-sqlite3. Install better-sqlite3 to enable this feature, or check its installed version and native binaries."
|
|
30
|
-
"@jini-ai/db": "opt-in: database-backed adapters — Database-backed adapters could not load @jini-ai/db. Install @jini-ai/db to enable this feature, or check its installed version and native binaries."
|
|
29
|
+
"better-sqlite3": "opt-in: sqlite storage — SQLite storage could not load better-sqlite3. Install better-sqlite3 to enable this feature, or check its installed version and native binaries."
|
|
31
30
|
}
|
|
32
31
|
},
|
|
33
32
|
"type": "module",
|
|
@@ -78,28 +77,23 @@
|
|
|
78
77
|
"registry": "https://registry.npmjs.org"
|
|
79
78
|
},
|
|
80
79
|
"dependencies": {
|
|
81
|
-
"@jini-ai/
|
|
82
|
-
"@jini-ai/
|
|
83
|
-
"@jini-ai/core": "^0.7.2"
|
|
80
|
+
"@jini-ai/core": "^0.7.3-next.2",
|
|
81
|
+
"@jini-ai/protocol": "^0.7.3-next.2"
|
|
84
82
|
},
|
|
85
83
|
"peerDependencies": {
|
|
86
|
-
"better-sqlite3": "^13.0.0"
|
|
87
|
-
"@jini-ai/db": "^0.7.0"
|
|
84
|
+
"better-sqlite3": "^13.0.0"
|
|
88
85
|
},
|
|
89
86
|
"devDependencies": {
|
|
90
87
|
"@types/better-sqlite3": "^7.6.11",
|
|
91
88
|
"better-sqlite3": "^13.0.0",
|
|
92
|
-
"@jini-ai/core": "^0.7.2",
|
|
93
|
-
"@jini-ai/db": "0.7.2",
|
|
94
|
-
"@jini-ai/
|
|
95
|
-
"@jini-ai/
|
|
89
|
+
"@jini-ai/core": "^0.7.3-next.2",
|
|
90
|
+
"@jini-ai/db": "0.7.3-next.2",
|
|
91
|
+
"@jini-ai/platform": "^0.7.3-next.2",
|
|
92
|
+
"@jini-ai/protocol": "^0.7.3-next.2"
|
|
96
93
|
},
|
|
97
94
|
"peerDependenciesMeta": {
|
|
98
95
|
"better-sqlite3": {
|
|
99
96
|
"optional": true
|
|
100
|
-
},
|
|
101
|
-
"@jini-ai/db": {
|
|
102
|
-
"optional": true
|
|
103
97
|
}
|
|
104
98
|
},
|
|
105
99
|
"scripts": {
|