@datalayer/agent-runtimes 1.3.104 → 1.3.105
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/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/pap/index.d.ts +42 -0
- package/lib/pap/index.js +57 -0
- package/package.json +2 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type DiscoveredCompany, type DiscoveryOptions, type JsonWebKeySet, type ClientMetadata, type IdentityRequestOptions } from '@datalayer/personal-agent-protocol';
|
|
2
|
+
/** Verified public company capabilities safe for model and UI surfaces. */
|
|
3
|
+
export interface PapCompanySummary {
|
|
4
|
+
readonly organization: string;
|
|
5
|
+
readonly domain: string;
|
|
6
|
+
readonly protocolVersion: string;
|
|
7
|
+
readonly issuer: string | null;
|
|
8
|
+
readonly signIn: readonly string[];
|
|
9
|
+
readonly interfaces: readonly string[];
|
|
10
|
+
readonly extensions: Readonly<Record<string, string>>;
|
|
11
|
+
}
|
|
12
|
+
/** Verified public personal-agent identity safe for model and UI surfaces. */
|
|
13
|
+
export interface PapAgentIdentitySummary {
|
|
14
|
+
readonly clientId: string;
|
|
15
|
+
readonly clientName: string;
|
|
16
|
+
readonly redirectCount: number;
|
|
17
|
+
readonly signingAlgorithms: readonly string[];
|
|
18
|
+
readonly extensions: Readonly<Record<string, string>>;
|
|
19
|
+
}
|
|
20
|
+
type DiscoverCompany = (domain: string, options?: DiscoveryOptions) => Promise<DiscoveredCompany>;
|
|
21
|
+
interface IdentityClient {
|
|
22
|
+
fetchMetadata(clientId: string, options?: IdentityRequestOptions): Promise<ClientMetadata>;
|
|
23
|
+
fetchJwks(clientId: string, options?: IdentityRequestOptions): Promise<JsonWebKeySet>;
|
|
24
|
+
}
|
|
25
|
+
export interface PapPersonalAgentCapabilityOptions {
|
|
26
|
+
readonly discover?: DiscoverCompany;
|
|
27
|
+
readonly identity?: IdentityClient;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Use PAP clients while enforcing Agent Runtimes' public-summary boundary.
|
|
31
|
+
*
|
|
32
|
+
* Authorization URLs, callback state, assertions, proofs, and tokens are not
|
|
33
|
+
* represented by this API. Those values remain in deterministic host
|
|
34
|
+
* services and cross runtime boundaries only as opaque references.
|
|
35
|
+
*/
|
|
36
|
+
export declare class PapPersonalAgentCapability {
|
|
37
|
+
#private;
|
|
38
|
+
constructor(options?: PapPersonalAgentCapabilityOptions);
|
|
39
|
+
discoverCompany(domain: string, options?: DiscoveryOptions): Promise<PapCompanySummary>;
|
|
40
|
+
inspectAgent(clientId: string, options?: IdentityRequestOptions): Promise<PapAgentIdentitySummary>;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
package/lib/pap/index.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
import { AgentIdentityClient, discoverCompany, } from '@datalayer/personal-agent-protocol';
|
|
6
|
+
function extensionVersions(extensions) {
|
|
7
|
+
return Object.freeze(Object.fromEntries(Object.entries(extensions).map(([name, value]) => [name, value.version])));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Use PAP clients while enforcing Agent Runtimes' public-summary boundary.
|
|
11
|
+
*
|
|
12
|
+
* Authorization URLs, callback state, assertions, proofs, and tokens are not
|
|
13
|
+
* represented by this API. Those values remain in deterministic host
|
|
14
|
+
* services and cross runtime boundaries only as opaque references.
|
|
15
|
+
*/
|
|
16
|
+
export class PapPersonalAgentCapability {
|
|
17
|
+
#discover;
|
|
18
|
+
#identity;
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
this.#discover = options.discover ?? discoverCompany;
|
|
21
|
+
this.#identity = options.identity ?? new AgentIdentityClient();
|
|
22
|
+
}
|
|
23
|
+
async discoverCompany(domain, options = {}) {
|
|
24
|
+
const company = await this.#discover(domain, options);
|
|
25
|
+
const { document } = company;
|
|
26
|
+
const signIn = ['direct', 'device', 'mediated'].filter(method => document.auth?.[method] !== undefined);
|
|
27
|
+
const interfaces = [
|
|
28
|
+
...(document.agent?.protocols.map(protocol => `agent:${protocol.type}`) ??
|
|
29
|
+
[]),
|
|
30
|
+
...document.apis.map(api => `api:${api.type}`),
|
|
31
|
+
...(document.web === undefined ? [] : ['web']),
|
|
32
|
+
];
|
|
33
|
+
return Object.freeze({
|
|
34
|
+
organization: document.organization.name,
|
|
35
|
+
domain: document.organization.domain,
|
|
36
|
+
protocolVersion: document.protocol_version,
|
|
37
|
+
issuer: document.auth?.issuer ?? null,
|
|
38
|
+
signIn: Object.freeze(signIn),
|
|
39
|
+
interfaces: Object.freeze(interfaces),
|
|
40
|
+
extensions: extensionVersions(document.extensions),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
async inspectAgent(clientId, options = {}) {
|
|
44
|
+
const metadata = await this.#identity.fetchMetadata(clientId, options);
|
|
45
|
+
const keys = await this.#identity.fetchJwks(clientId, options);
|
|
46
|
+
const signingAlgorithms = [
|
|
47
|
+
...new Set(keys.keys.map(key => key.alg ?? (key.kty === 'EC' ? 'ES256' : 'RS256'))),
|
|
48
|
+
].sort();
|
|
49
|
+
return Object.freeze({
|
|
50
|
+
clientId: metadata.client_id,
|
|
51
|
+
clientName: metadata.client_name,
|
|
52
|
+
redirectCount: metadata.redirect_uris.length,
|
|
53
|
+
signingAlgorithms: Object.freeze(signingAlgorithms),
|
|
54
|
+
extensions: extensionVersions(metadata.extensions),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datalayer/agent-runtimes",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.105",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
".",
|
|
@@ -160,6 +160,7 @@
|
|
|
160
160
|
"@datalayer/lexical-loro": "^1.0.6",
|
|
161
161
|
"@datalayer/primer-addons": "^1.0.39",
|
|
162
162
|
"@datalayer/primer-rjsf": "^1.0.3",
|
|
163
|
+
"@datalayer/personal-agent-protocol": "^0.3.1",
|
|
163
164
|
"@datalayer/reactor": "^1.0.4",
|
|
164
165
|
"@datalayer/reactor-commands": "^1.0.4",
|
|
165
166
|
"@datalayer/reactor-manager": "^1.0.4",
|