open-agentic-web 1.0.1 → 1.0.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/README.md +5 -9
- package/bin/cli.mjs +21 -8
- package/package.json +1 -1
- package/src/bridge.js +4 -4
- package/src/federation.js +35 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 🌐 Open Agentic Web SDK (`open-agentic-web`)
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/open-agentic-web)
|
|
4
4
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
5
5
|
[](https://cognizant-ai-labs.github.io/agentic-web/specs/mvp-v0.3.json)
|
|
6
6
|
|
|
@@ -172,8 +172,8 @@ Enable parent orchestrators to execute your site tools from an iframe using the
|
|
|
172
172
|
<script type="importmap">
|
|
173
173
|
{
|
|
174
174
|
"imports": {
|
|
175
|
-
"open-agentic-web": "https://esm.sh/open-agentic-web@1.0.
|
|
176
|
-
"open-agentic-web/": "https://esm.sh/open-agentic-web@1.0.
|
|
175
|
+
"open-agentic-web": "https://esm.sh/open-agentic-web@1.0.2",
|
|
176
|
+
"open-agentic-web/": "https://esm.sh/open-agentic-web@1.0.2/"
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
</script>
|
|
@@ -252,14 +252,10 @@ const turnResult = await swarm.runTurn({
|
|
|
252
252
|
|
|
253
253
|
console.log("Agent response:", turnResult.text);
|
|
254
254
|
|
|
255
|
-
// 4.
|
|
256
|
-
const linksConfig = swarm.exportLinks("my_hub_network");
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
// Search active specialist nodes in the swarm
|
|
255
|
+
// 4. Search active specialist nodes in the swarm
|
|
260
256
|
const diningAgents = swarm.search({ category: "Dining" });
|
|
261
257
|
|
|
262
|
-
// Export current peer mappings to links.json format
|
|
258
|
+
// 5. Export current peer mappings to links.json format
|
|
263
259
|
const linksConfig = swarm.exportLinks("my_hub_network");
|
|
264
260
|
```
|
|
265
261
|
|
package/bin/cli.mjs
CHANGED
|
@@ -98,6 +98,17 @@ async function runFederation() {
|
|
|
98
98
|
console.log(`Total checks run: ${fed.totalChecks}`);
|
|
99
99
|
console.log(`Passed: ${colors.green}${fed.totalPassed}${colors.reset} | Failed: ${colors.red}${fed.totalFailed}${colors.reset}`);
|
|
100
100
|
|
|
101
|
+
if (fed.meshReport?.results && fed.meshReport.results.length > 0) {
|
|
102
|
+
console.log(`\n${colors.bold}Mesh Link & Policy Verification Details:${colors.reset}`);
|
|
103
|
+
fed.meshReport.results.forEach(res => {
|
|
104
|
+
if (res.status === "PASS") {
|
|
105
|
+
console.log(` ${colors.green}✅ PASS:${colors.reset} ${res.message}`);
|
|
106
|
+
} else {
|
|
107
|
+
console.log(` ${colors.red}❌ FAIL:${colors.reset} ${res.message}`);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
101
112
|
if (!fed.valid) {
|
|
102
113
|
console.error(`\n${colors.red}${colors.bold}Federation validation failed.${colors.reset}\n`);
|
|
103
114
|
process.exit(1);
|
|
@@ -227,8 +238,8 @@ export class SiteActions {
|
|
|
227
238
|
<script type="importmap">
|
|
228
239
|
{
|
|
229
240
|
"imports": {
|
|
230
|
-
"open-agentic-web": "https://esm.sh/open-agentic-web@1.0.
|
|
231
|
-
"open-agentic-web/": "https://esm.sh/open-agentic-web@1.0.
|
|
241
|
+
"open-agentic-web": "https://esm.sh/open-agentic-web@1.0.2",
|
|
242
|
+
"open-agentic-web/": "https://esm.sh/open-agentic-web@1.0.2/"
|
|
232
243
|
}
|
|
233
244
|
}
|
|
234
245
|
</script>
|
|
@@ -239,11 +250,12 @@ export class SiteActions {
|
|
|
239
250
|
const registry = createActionRegistry();
|
|
240
251
|
SiteActions.registerActions(registry);
|
|
241
252
|
|
|
242
|
-
// Secure action bridge
|
|
253
|
+
// Secure action bridge: allows cross-origin orchestrators while enforcing human confirmation for irreversible actions
|
|
243
254
|
setupActionBridge({
|
|
244
255
|
registry,
|
|
256
|
+
allowedOrigins: ["*"],
|
|
245
257
|
onConfirm: async ({ action, arguments: args, origin }) => {
|
|
246
|
-
return window.confirm(
|
|
258
|
+
return window.confirm("[Action Authorization] " + origin + " is requesting to execute '" + action + "'. Authorize this action?");
|
|
247
259
|
}
|
|
248
260
|
});
|
|
249
261
|
</script>
|
|
@@ -265,8 +277,8 @@ export class SiteActions {
|
|
|
265
277
|
<script type="importmap">
|
|
266
278
|
{
|
|
267
279
|
"imports": {
|
|
268
|
-
"open-agentic-web": "https://esm.sh/open-agentic-web@1.0.
|
|
269
|
-
"open-agentic-web/": "https://esm.sh/open-agentic-web@1.0.
|
|
280
|
+
"open-agentic-web": "https://esm.sh/open-agentic-web@1.0.2",
|
|
281
|
+
"open-agentic-web/": "https://esm.sh/open-agentic-web@1.0.2/"
|
|
270
282
|
}
|
|
271
283
|
}
|
|
272
284
|
</script>
|
|
@@ -284,7 +296,7 @@ export class SiteActions {
|
|
|
284
296
|
`;
|
|
285
297
|
writeFileSync(join(fullPath, "index.html"), indexHtml);
|
|
286
298
|
|
|
287
|
-
//
|
|
299
|
+
// 6. links.json
|
|
288
300
|
const links = {
|
|
289
301
|
networks: {
|
|
290
302
|
[`${nodeName}_network`]: {}
|
|
@@ -295,6 +307,7 @@ export class SiteActions {
|
|
|
295
307
|
console.log(`\n${colors.green}${colors.bold}✨ Scaffolding complete!${colors.reset}`);
|
|
296
308
|
console.log(`Created conforming Open Agentic Web node at: ${colors.cyan}${fullPath}${colors.reset}`);
|
|
297
309
|
console.log(`Files generated:
|
|
310
|
+
├── index.html
|
|
298
311
|
├── agent-manifest.json
|
|
299
312
|
├── ${nodeName}.network.json
|
|
300
313
|
├── site-actions.js
|
|
@@ -341,7 +354,7 @@ switch (command) {
|
|
|
341
354
|
case "version":
|
|
342
355
|
case "-v":
|
|
343
356
|
case "--version":
|
|
344
|
-
console.log("open-agentic-web v1.0.
|
|
357
|
+
console.log("open-agentic-web v1.0.2");
|
|
345
358
|
break;
|
|
346
359
|
case "help":
|
|
347
360
|
case "--help":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-agentic-web",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Standard developer toolkit, conformance linter & in-browser runtime for the Open Agentic Web (Cognizant / Mozilla / MIT NANDA MVP Profile 0.3)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
package/src/bridge.js
CHANGED
|
@@ -13,7 +13,7 @@ export const ACTION_BRIDGE_PROTOCOL = "nsdeploy-actions-v1";
|
|
|
13
13
|
*/
|
|
14
14
|
export function setupActionBridge({
|
|
15
15
|
registry,
|
|
16
|
-
allowedOrigins =
|
|
16
|
+
allowedOrigins = ["*"],
|
|
17
17
|
onConfirm = null,
|
|
18
18
|
protocol = ACTION_BRIDGE_PROTOCOL,
|
|
19
19
|
windowObj = globalThis.window
|
|
@@ -22,10 +22,10 @@ export function setupActionBridge({
|
|
|
22
22
|
throw new Error("Action bridge requires a browser window environment.");
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
//
|
|
26
|
-
const effectiveAllowedOrigins = allowedOrigins
|
|
25
|
+
// Cross-origin federation allows orchestrators to connect; irreversible actions strictly enforce onConfirm
|
|
26
|
+
const effectiveAllowedOrigins = Array.isArray(allowedOrigins) && allowedOrigins.length > 0
|
|
27
27
|
? allowedOrigins
|
|
28
|
-
: [
|
|
28
|
+
: ["*"];
|
|
29
29
|
|
|
30
30
|
if (effectiveAllowedOrigins.includes("*")) {
|
|
31
31
|
console.warn(
|
package/src/federation.js
CHANGED
|
@@ -116,6 +116,40 @@ export class AgentSwarm {
|
|
|
116
116
|
throw new Error(`Manifest at '${manifestEndpoint}' does not declare any networks.`);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
let hydratedTools = manifest.actions?.agentTools || [];
|
|
120
|
+
if (network && typeof network.hocon === "string") {
|
|
121
|
+
try {
|
|
122
|
+
const netPath = network.hocon.replace(/^\.\//, "");
|
|
123
|
+
const netUrl = `${cleanUrl}/${netPath}`;
|
|
124
|
+
const netRes = await fetchFn(netUrl);
|
|
125
|
+
if (netRes && netRes.ok) {
|
|
126
|
+
const netJson = await netRes.json();
|
|
127
|
+
const declaredTools = netJson.tools || [];
|
|
128
|
+
const toolDefs = new Map();
|
|
129
|
+
for (const t of declaredTools) {
|
|
130
|
+
if (t && t.name) {
|
|
131
|
+
const toolName = t.name;
|
|
132
|
+
const toolDesc = t.description || t.instructions || "";
|
|
133
|
+
const toolParams = t.function?.parameters || t.parameters || { type: "object", properties: {} };
|
|
134
|
+
toolDefs.set(toolName, { name: toolName, description: toolDesc, inputSchema: toolParams });
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (toolDefs.size > 0) {
|
|
139
|
+
const rawTools = manifest.actions?.agentTools || Array.from(toolDefs.keys());
|
|
140
|
+
hydratedTools = rawTools.map(t => {
|
|
141
|
+
const toolName = typeof t === "string" ? t : t.name;
|
|
142
|
+
const baseName = toolName.replace(/^website_/, "");
|
|
143
|
+
const matched = toolDefs.get(toolName) || toolDefs.get(baseName) || toolDefs.get(`website_${baseName}`);
|
|
144
|
+
return matched || (typeof t === "object" ? t : { name: toolName, description: "", inputSchema: { type: "object", properties: {} } });
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
} catch {
|
|
149
|
+
// Fallback to manifest action tools
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
119
153
|
const candidateNode = {
|
|
120
154
|
id: manifest.name || network.name || `node_${Date.now()}`,
|
|
121
155
|
name: manifest.brand || manifest.description || manifest.name || network.name,
|
|
@@ -123,7 +157,7 @@ export class AgentSwarm {
|
|
|
123
157
|
node_url: cleanUrl,
|
|
124
158
|
category: manifest.category || (network.tags && network.tags[0]) || "Specialist",
|
|
125
159
|
description: manifest.description || network.description || "",
|
|
126
|
-
tools:
|
|
160
|
+
tools: hydratedTools
|
|
127
161
|
};
|
|
128
162
|
|
|
129
163
|
// User consent check
|