@agentsbloom/sdk 0.2.0 → 0.4.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/LICENSE +21 -21
- package/README.md +184 -254
- package/SECURITY.md +24 -19
- package/index.d.ts +95 -2
- package/index.js +1994 -1111
- package/lib/ap2.js +153 -38
- package/lib/outcomes.js +108 -0
- package/lib/shared-store.js +172 -0
- package/package.json +85 -81
- package/telemetry.js +24 -17
- package/assets/logo-mark.svg +0 -25
package/package.json
CHANGED
|
@@ -1,81 +1,85 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@agentsbloom/sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Universal Node.js/Express SDK to convert any e-commerce store into an Agent-Ready API (UCP, ACP, AP2, WebMCP, Web Bot Auth).",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./index.js",
|
|
7
|
-
"types": "./index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./index.d.ts",
|
|
11
|
-
"import": "./index.js",
|
|
12
|
-
"default": "./index.js"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"files": [
|
|
16
|
-
"index.js",
|
|
17
|
-
"index.d.ts",
|
|
18
|
-
"telemetry.js",
|
|
19
|
-
"lib/ap2.js",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"@opentelemetry/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"@opentelemetry/
|
|
63
|
-
"@opentelemetry/
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"@opentelemetry/
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"@opentelemetry/
|
|
70
|
-
"@opentelemetry/
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
|
|
81
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentsbloom/sdk",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Universal Node.js/Express SDK to convert any e-commerce store into an Agent-Ready API (UCP, ACP, AP2, WebMCP, Web Bot Auth).",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.js",
|
|
7
|
+
"types": "./index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./index.d.ts",
|
|
11
|
+
"import": "./index.js",
|
|
12
|
+
"default": "./index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"index.js",
|
|
17
|
+
"index.d.ts",
|
|
18
|
+
"telemetry.js",
|
|
19
|
+
"lib/ap2.js",
|
|
20
|
+
"lib/outcomes.js",
|
|
21
|
+
"lib/shared-store.js",
|
|
22
|
+
"README.md",
|
|
23
|
+
"LICENSE",
|
|
24
|
+
"SECURITY.md"
|
|
25
|
+
],
|
|
26
|
+
"sideEffects": true,
|
|
27
|
+
"keywords": [
|
|
28
|
+
"agentsbloom",
|
|
29
|
+
"webmcp",
|
|
30
|
+
"ucp",
|
|
31
|
+
"acp",
|
|
32
|
+
"ap2",
|
|
33
|
+
"web-bot-auth",
|
|
34
|
+
"ai-agents"
|
|
35
|
+
],
|
|
36
|
+
"author": "AgentsBloom <contact@agentsbloom.com>",
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://github.com/insane-lotus/agentsbloom-cloud.git",
|
|
41
|
+
"directory": "packages/sdk"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/insane-lotus/agentsbloom-cloud/tree/v2/packages/sdk#readme",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/insane-lotus/agentsbloom-cloud/issues"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=20"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"express": "^4.0.0"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@hono/node-server": "2.0.12",
|
|
58
|
+
"@modelcontextprotocol/sdk": "1.30.0",
|
|
59
|
+
"@opentelemetry/api": "^1.9.0"
|
|
60
|
+
},
|
|
61
|
+
"optionalDependencies": {
|
|
62
|
+
"@opentelemetry/exporter-trace-otlp-http": "0.221.0",
|
|
63
|
+
"@opentelemetry/resources": "2.10.0",
|
|
64
|
+
"@opentelemetry/sdk-trace-base": "2.10.0",
|
|
65
|
+
"@opentelemetry/sdk-trace-node": "2.10.0",
|
|
66
|
+
"@opentelemetry/semantic-conventions": "1.43.0"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@opentelemetry/exporter-trace-otlp-http": "0.221.0",
|
|
70
|
+
"@opentelemetry/resources": "2.10.0",
|
|
71
|
+
"@opentelemetry/sdk-trace-base": "2.10.0",
|
|
72
|
+
"@opentelemetry/sdk-trace-node": "2.10.0",
|
|
73
|
+
"@opentelemetry/semantic-conventions": "1.43.0",
|
|
74
|
+
"fast-check": "^3.23.2",
|
|
75
|
+
"jose": "^5.10.0"
|
|
76
|
+
},
|
|
77
|
+
"scripts": {
|
|
78
|
+
"test": "node --test \"test/*.test.js\"",
|
|
79
|
+
"lint": "node --check index.js && node --check telemetry.js && node --check lib/ap2.js && node --check scripts/check-package.mjs && node --check scripts/verify-consumer.mjs",
|
|
80
|
+
"check:package": "node scripts/check-package.mjs",
|
|
81
|
+
"verify:consumer": "node scripts/verify-consumer.mjs",
|
|
82
|
+
"release:check": "npm run lint && npm test && npm run check:package && npm run verify:consumer && npm pack --dry-run --ignore-scripts",
|
|
83
|
+
"prepublishOnly": "npm run release:check"
|
|
84
|
+
}
|
|
85
|
+
}
|
package/telemetry.js
CHANGED
|
@@ -7,19 +7,18 @@
|
|
|
7
7
|
* a merchant application that never calls setupTelemetry() is never forced
|
|
8
8
|
* to install them. They are declared as optionalDependencies in
|
|
9
9
|
* package.json rather than dependencies.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Initialize an OTLP trace exporter/provider pair.
|
|
14
10
|
*
|
|
15
|
-
*
|
|
16
|
-
* @
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
11
|
+
* Dependency-audit note (2026-08): upgraded to the OpenTelemetry JS 2.x line
|
|
12
|
+
* (sdk-trace-*@2.10, resources@2.10, exporter-trace-otlp-http@0.221) which
|
|
13
|
+
* fixes GHSA-8988-4f7v-96qf and friends. The 2.x API differences this file
|
|
14
|
+
* absorbs:
|
|
15
|
+
* - `Resource` class is gone -> `resourceFromAttributes()`
|
|
16
|
+
* - `SemanticResourceAttributes.SERVICE_NAME` is gone ->
|
|
17
|
+
* `ATTR_SERVICE_NAME` from @opentelemetry/semantic-conventions
|
|
18
|
+
* - `provider.register()` no longer accepts a global logger/meter; plain
|
|
19
|
+
* registration is still supported.
|
|
22
20
|
*/
|
|
21
|
+
|
|
23
22
|
let optionalDependencyWarningLogged = false;
|
|
24
23
|
|
|
25
24
|
export async function initExporter({ otlpEndpoint, serviceName, samplingRatio, apiKey } = {}) {
|
|
@@ -27,23 +26,31 @@ export async function initExporter({ otlpEndpoint, serviceName, samplingRatio, a
|
|
|
27
26
|
const { NodeTracerProvider } = await import('@opentelemetry/sdk-trace-node');
|
|
28
27
|
const { BatchSpanProcessor } = await import('@opentelemetry/sdk-trace-base');
|
|
29
28
|
const { OTLPTraceExporter } = await import('@opentelemetry/exporter-trace-otlp-http');
|
|
30
|
-
const {
|
|
31
|
-
|
|
29
|
+
const { resourceFromAttributes } = await import('@opentelemetry/resources');
|
|
30
|
+
let serviceNameKey;
|
|
31
|
+
try {
|
|
32
|
+
({ ATTR_SERVICE_NAME: serviceNameKey } = await import('@opentelemetry/semantic-conventions'));
|
|
33
|
+
} catch {
|
|
34
|
+
// Very new/old semantic-conventions layouts fall back to the literal.
|
|
35
|
+
serviceNameKey = 'service.name';
|
|
36
|
+
}
|
|
32
37
|
|
|
33
38
|
const exporter = new OTLPTraceExporter({
|
|
34
39
|
url: `${otlpEndpoint}/v1/traces`,
|
|
35
40
|
headers: { Authorization: `Bearer ${apiKey}` },
|
|
36
41
|
});
|
|
42
|
+
// 2.x: span processors are passed at construction via `spanProcessors`
|
|
43
|
+
// (addSpanProcessor was removed from the public provider API).
|
|
37
44
|
const provider = new NodeTracerProvider({
|
|
38
|
-
resource:
|
|
45
|
+
resource: resourceFromAttributes({ [serviceNameKey || 'service.name']: serviceName }),
|
|
46
|
+
spanProcessors: [new BatchSpanProcessor(exporter)],
|
|
39
47
|
});
|
|
40
|
-
provider.addSpanProcessor(new BatchSpanProcessor(exporter));
|
|
41
48
|
provider.register();
|
|
42
49
|
return { provider, exporter };
|
|
43
|
-
} catch {
|
|
50
|
+
} catch (err) {
|
|
44
51
|
if (!optionalDependencyWarningLogged) {
|
|
45
52
|
optionalDependencyWarningLogged = true;
|
|
46
|
-
console.warn(
|
|
53
|
+
console.warn(`🌸 AgentsBloom: OTel SDK packages unavailable, continuing without export. (${err?.message || 'unknown reason'})`);
|
|
47
54
|
}
|
|
48
55
|
return null;
|
|
49
56
|
}
|
package/assets/logo-mark.svg
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64" role="img" aria-labelledby="agentsbloom-title">
|
|
2
|
-
<title id="agentsbloom-title">AgentsBloom</title>
|
|
3
|
-
<style>
|
|
4
|
-
@media (prefers-color-scheme: dark) {
|
|
5
|
-
.s1 { stop-color: #4A90F7; }
|
|
6
|
-
.s2 { stop-color: #4EE2F8; }
|
|
7
|
-
.s3 { stop-color: #C3AFFF; }
|
|
8
|
-
}
|
|
9
|
-
</style>
|
|
10
|
-
<defs>
|
|
11
|
-
<linearGradient id="lotus-gradient" x1="0" y1="0" x2="1" y2="1">
|
|
12
|
-
<stop class="s1" offset="0%" stop-color="#1A73E8" />
|
|
13
|
-
<stop class="s2" offset="50%" stop-color="#22D3EE" />
|
|
14
|
-
<stop class="s3" offset="100%" stop-color="#A78BFA" />
|
|
15
|
-
</linearGradient>
|
|
16
|
-
</defs>
|
|
17
|
-
<g fill="url(#lotus-gradient)">
|
|
18
|
-
<path d="M32 52c1.6 2 2.7 3.7 3.3 5.2.2.6 0 1-.6 1.3l-2.7 1.5-2.7-1.5c-.6-.3-.8-.7-.6-1.3.6-1.5 1.7-3.2 3.3-5.2z" />
|
|
19
|
-
<path d="M14.5 20.8c.2-1 .7-1.2 1.6-.8 4.5 1.9 8 4.8 10.5 8.7 2.3 3.6 3.6 7.7 3.8 12.2 0 1-.4 1.4-1.3 1.1-4.7-1.5-8.4-4.3-11.1-8.4-2.6-4-3.8-8.3-3.5-12.8z" />
|
|
20
|
-
<path d="M49.5 20.8c-.2-1-.7-1.2-1.6-.8-4.5 1.9-8 4.8-10.5 8.7-2.3 3.6-3.6 7.7-3.8 12.2 0 1 .4 1.4 1.3 1.1 4.7-1.5 8.4-4.3 11.1-8.4 2.6-4 3.8-8.3 3.5-12.8z" />
|
|
21
|
-
<path d="M4 30c0-1 .3-1.5 1.3-1.6 6.5-.5 12.5 1.2 17.6 4.8 4.6 3.3 7.7 7.8 9.3 13.2.3 1 .1 1.6-.9 1.7-6.8.8-13-.7-18.4-4.6C7.5 39.6 4.3 34.9 4 30z" />
|
|
22
|
-
<path d="M60 30c0-1-.3-1.5-1.3-1.6-6.5-.5-12.5 1.2-17.6 4.8-4.6 3.3-7.7 7.8-9.3 13.2-.3 1-.1 1.6.9 1.7 6.8.8 13-.7 18.4-4.6C56.5 39.6 59.7 34.9 60 30z" />
|
|
23
|
-
<path d="M32 6c4.5 6 7.2 12 8 18 .8 6-.5 12-4 18l-4 6-4-6c-3.5-6-4.8-12-4-18 .8-6 3.5-12 8-18z" />
|
|
24
|
-
</g>
|
|
25
|
-
</svg>
|