@actcore/web-runtime 0.1.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 +10 -0
- package/README.md +148 -0
- package/dist/cache.d.ts +70 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +0 -0
- package/dist/cache.js.map +1 -0
- package/dist/host-api.d.ts +81 -0
- package/dist/host-api.d.ts.map +1 -0
- package/dist/host-api.js +46 -0
- package/dist/host-api.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/locale.d.ts +32 -0
- package/dist/locale.d.ts.map +1 -0
- package/dist/locale.js +64 -0
- package/dist/locale.js.map +1 -0
- package/dist/patches.d.ts +38 -0
- package/dist/patches.d.ts.map +1 -0
- package/dist/patches.js +76 -0
- package/dist/patches.js.map +1 -0
- package/dist/shims/sockets.d.ts +130 -0
- package/dist/shims/sockets.d.ts.map +1 -0
- package/dist/shims/sockets.js +128 -0
- package/dist/shims/sockets.js.map +1 -0
- package/dist/shims/wasi-http-internal.d.ts +7 -0
- package/dist/shims/wasi-http-internal.d.ts.map +1 -0
- package/dist/shims/wasi-http-internal.js +19 -0
- package/dist/shims/wasi-http-internal.js.map +1 -0
- package/dist/shims/wasi-http.d.ts +83 -0
- package/dist/shims/wasi-http.d.ts.map +1 -0
- package/dist/shims/wasi-http.js +452 -0
- package/dist/shims/wasi-http.js.map +1 -0
- package/dist/streaming-fallback.d.ts +16 -0
- package/dist/streaming-fallback.d.ts.map +1 -0
- package/dist/streaming-fallback.js +52 -0
- package/dist/streaming-fallback.js.map +1 -0
- package/dist/timing.d.ts +22 -0
- package/dist/timing.d.ts.map +1 -0
- package/dist/timing.js +48 -0
- package/dist/timing.js.map +1 -0
- package/dist/transpile.d.ts +10 -0
- package/dist/transpile.d.ts.map +1 -0
- package/dist/transpile.js +277 -0
- package/dist/transpile.js.map +1 -0
- package/dist/transpile.worker.d.ts +36 -0
- package/dist/transpile.worker.d.ts.map +1 -0
- package/dist/transpile.worker.js +43 -0
- package/dist/transpile.worker.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/dist/webmcp.d.ts +92 -0
- package/dist/webmcp.d.ts.map +1 -0
- package/dist/webmcp.js +189 -0
- package/dist/webmcp.js.map +1 -0
- package/package.json +69 -0
package/dist/webmcp.js
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge: expose an ACT component's tools on the browser's native WebMCP
|
|
3
|
+
* surface (`document.modelContext`). Native-only, feature-gated, opt-in.
|
|
4
|
+
*
|
|
5
|
+
* WebMCP is pre-standardization; we type only the slice we depend on
|
|
6
|
+
* (`registerTool` + `AbortSignal`) so upstream churn cannot break the build.
|
|
7
|
+
* Spec: https://webmachinelearning.github.io/webmcp/
|
|
8
|
+
*/
|
|
9
|
+
import { decode, encode } from 'cbor2';
|
|
10
|
+
import { resolveLocalizedString } from './locale.js';
|
|
11
|
+
/** Native WebMCP surface if present (canonical `document`, legacy `navigator`). */
|
|
12
|
+
export function getModelContext() {
|
|
13
|
+
if (typeof document !== 'undefined' && document.modelContext)
|
|
14
|
+
return document.modelContext;
|
|
15
|
+
if (typeof navigator !== 'undefined' && navigator.modelContext)
|
|
16
|
+
return navigator.modelContext;
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
/** True when the browser exposes a native WebMCP surface. */
|
|
20
|
+
export function isWebmcpAvailable() {
|
|
21
|
+
return getModelContext() !== null;
|
|
22
|
+
}
|
|
23
|
+
/** Coerce an ACT tool name to WebMCP's `[A-Za-z0-9_.-]`, ≤128, non-empty. */
|
|
24
|
+
export function sanitizeName(name) {
|
|
25
|
+
const cleaned = name.replace(/[^A-Za-z0-9_.-]/g, '_').slice(0, 128);
|
|
26
|
+
return cleaned || 'tool';
|
|
27
|
+
}
|
|
28
|
+
/** ACT `parameters-schema` (a JSON Schema string) → a JSON Schema object. */
|
|
29
|
+
export function parseInputSchema(schemaStr) {
|
|
30
|
+
if (schemaStr && schemaStr.trim()) {
|
|
31
|
+
try {
|
|
32
|
+
const parsed = JSON.parse(schemaStr);
|
|
33
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed))
|
|
34
|
+
return parsed;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
/* fall through to default */
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return { type: 'object', properties: {} };
|
|
41
|
+
}
|
|
42
|
+
/** Read the `std:read-only` boolean from ACT tool metadata, if present. */
|
|
43
|
+
export function readReadOnlyHint(metadata) {
|
|
44
|
+
for (const [key, val] of metadata) {
|
|
45
|
+
if (key === 'std:read-only') {
|
|
46
|
+
try {
|
|
47
|
+
const decoded = decode(val);
|
|
48
|
+
if (typeof decoded === 'boolean')
|
|
49
|
+
return decoded;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
/* ignore undecodable value */
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
/** WebMCP annotations for an ACT tool: readOnly from meta, untrusted by default. */
|
|
59
|
+
export function buildAnnotations(metadata) {
|
|
60
|
+
const readOnly = readReadOnlyHint(metadata);
|
|
61
|
+
return {
|
|
62
|
+
...(readOnly !== undefined ? { readOnlyHint: readOnly } : {}),
|
|
63
|
+
untrustedContentHint: true,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** wasi:http content-parts surface mimeType as an `option<string>` variant
|
|
67
|
+
* (`{tag:'some',val}`) rather than a plain string; normalise both. */
|
|
68
|
+
function normalizeMime(raw) {
|
|
69
|
+
if (typeof raw === 'string')
|
|
70
|
+
return raw;
|
|
71
|
+
if (raw && typeof raw === 'object' && raw.tag === 'some') {
|
|
72
|
+
return String(raw.val);
|
|
73
|
+
}
|
|
74
|
+
return 'application/octet-stream';
|
|
75
|
+
}
|
|
76
|
+
function asBytes(data) {
|
|
77
|
+
if (data instanceof Uint8Array)
|
|
78
|
+
return data;
|
|
79
|
+
return new Uint8Array(Array.isArray(data) ? data : []);
|
|
80
|
+
}
|
|
81
|
+
/** Collect a ToolResult's events (immediate array or streaming ReadableStream)
|
|
82
|
+
* into a single text blob, flagging whether a terminal error occurred. */
|
|
83
|
+
async function drainToText(result) {
|
|
84
|
+
const events = [];
|
|
85
|
+
if (result.tag === 'immediate') {
|
|
86
|
+
events.push(...result.val);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
// Typed as ReadableStream, but accept an already-drained array too — some intermediaries
|
|
90
|
+
// normalise streaming→immediate (mirrors normalizeMime's static-vs-runtime note).
|
|
91
|
+
const val = result.val;
|
|
92
|
+
if (Array.isArray(val)) {
|
|
93
|
+
events.push(...val);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
const reader = val.getReader();
|
|
97
|
+
try {
|
|
98
|
+
for (;;) {
|
|
99
|
+
const { done, value } = await reader.read();
|
|
100
|
+
if (done)
|
|
101
|
+
break;
|
|
102
|
+
if (value)
|
|
103
|
+
events.push(value);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
finally {
|
|
107
|
+
reader.releaseLock();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const parts = [];
|
|
112
|
+
let isError = false;
|
|
113
|
+
for (const ev of events) {
|
|
114
|
+
if (ev.tag === 'content') {
|
|
115
|
+
const mime = normalizeMime(ev.val.mimeType);
|
|
116
|
+
const data = asBytes(ev.val.data);
|
|
117
|
+
if (mime.startsWith('text/') || mime === 'application/json') {
|
|
118
|
+
parts.push(new TextDecoder().decode(data));
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
parts.push(`(${mime}, ${data.length} bytes)`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
isError = true;
|
|
126
|
+
parts.push(`error: ${ev.val.kind} · ${resolveLocalizedString(ev.val.message)}`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return { text: parts.join('\n'), isError };
|
|
130
|
+
}
|
|
131
|
+
/** Build the WebMCP `execute` handler that bridges to `ToolProvider.callTool`. */
|
|
132
|
+
export function buildExecute(provider, def, options) {
|
|
133
|
+
return async (input) => {
|
|
134
|
+
try {
|
|
135
|
+
const argBytes = encode(input ?? {}, { dcbor: true });
|
|
136
|
+
// Forward std:session-id only for a non-empty session id; null,
|
|
137
|
+
// undefined, and "" (a meaningless id) are all omitted.
|
|
138
|
+
const sessionId = options.getSessionId?.();
|
|
139
|
+
const meta = sessionId
|
|
140
|
+
? [['std:session-id', encode(sessionId, { dcbor: true })]]
|
|
141
|
+
: [];
|
|
142
|
+
const result = await provider.callTool(def.name, argBytes, meta);
|
|
143
|
+
const { text, isError } = await drainToText(result);
|
|
144
|
+
return { content: [{ type: 'text', text }], ...(isError ? { isError: true } : {}) };
|
|
145
|
+
}
|
|
146
|
+
catch (err) {
|
|
147
|
+
const msg = String(err?.message ?? err);
|
|
148
|
+
return { content: [{ type: 'text', text: msg }], isError: true };
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/** Map one ACT ToolDefinition to a WebMCP descriptor (execute included). */
|
|
153
|
+
export function toDescriptor(provider, def, options) {
|
|
154
|
+
return {
|
|
155
|
+
name: sanitizeName(def.name),
|
|
156
|
+
description: resolveLocalizedString(def.description),
|
|
157
|
+
inputSchema: parseInputSchema(def.parametersSchema),
|
|
158
|
+
annotations: buildAnnotations(def.metadata),
|
|
159
|
+
execute: buildExecute(provider, def, options),
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Register every tool of an ACT component on the native WebMCP surface.
|
|
164
|
+
* Opt-in and headless — the caller decides when to call it and renders any UI.
|
|
165
|
+
* No-ops (returns `available:false`) where `document.modelContext` is absent.
|
|
166
|
+
* Call `dispose()` before re-exposing a different component.
|
|
167
|
+
*/
|
|
168
|
+
export async function exposeToWebmcp(provider, tools, options = {}) {
|
|
169
|
+
const mc = getModelContext();
|
|
170
|
+
if (!mc)
|
|
171
|
+
return { count: 0, available: false, dispose() { } };
|
|
172
|
+
const controller = new AbortController();
|
|
173
|
+
let count = 0;
|
|
174
|
+
for (const def of tools) {
|
|
175
|
+
try {
|
|
176
|
+
const descriptor = toDescriptor(provider, def, options);
|
|
177
|
+
await mc.registerTool(descriptor, {
|
|
178
|
+
signal: controller.signal,
|
|
179
|
+
...(options.exposedTo ? { exposedTo: options.exposedTo } : {}),
|
|
180
|
+
});
|
|
181
|
+
count++;
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
console.warn(`[webmcp] registerTool for "${def.name}" failed:`, err);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return { count, available: true, dispose: () => controller.abort() };
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=webmcp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webmcp.js","sourceRoot":"","sources":["../src/webmcp.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAKvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAqCrD,mFAAmF;AACnF,MAAM,UAAU,eAAe;IAC7B,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,QAAQ,CAAC,YAAY;QAAE,OAAO,QAAQ,CAAC,YAAY,CAAC;IAC3F,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC,YAAY;QAAE,OAAO,SAAS,CAAC,YAAY,CAAC;IAC9F,OAAO,IAAI,CAAC;AACd,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,iBAAiB;IAC/B,OAAO,eAAe,EAAE,KAAK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AC;YACb,OAAO,CAAC,IAAI,CAAC,8BAA8B,GAAG,CAAC,IAAI,WAAW,EAAE,GAAG,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC;AACvE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@actcore/web-runtime",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Web runtime for ACT (Agent Component Tools) — loads and runs signed wasm agent tools in the browser, and exposes them to browser agents via WebMCP",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"act",
|
|
7
|
+
"agent-component-tools",
|
|
8
|
+
"agent",
|
|
9
|
+
"wasm",
|
|
10
|
+
"webassembly",
|
|
11
|
+
"component-model",
|
|
12
|
+
"mcp",
|
|
13
|
+
"webmcp",
|
|
14
|
+
"ai",
|
|
15
|
+
"tools",
|
|
16
|
+
"browser",
|
|
17
|
+
"wasip3",
|
|
18
|
+
"jspi"
|
|
19
|
+
],
|
|
20
|
+
"homepage": "https://actcore.dev",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/actcore/web-runtime"
|
|
24
|
+
},
|
|
25
|
+
"bugs": "https://github.com/actcore/web-runtime/issues",
|
|
26
|
+
"license": "MIT OR Apache-2.0",
|
|
27
|
+
"author": "Alexander Shishenko <alex@shishenko.com>",
|
|
28
|
+
"type": "module",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"default": "./dist/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"main": "./dist/index.js",
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"README.md",
|
|
40
|
+
"LICENSE"
|
|
41
|
+
],
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=20"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "npm run gen-version && npm run gen-types && tsc",
|
|
47
|
+
"gen-version": "node scripts/gen-version.mjs",
|
|
48
|
+
"clean": "rm -rf dist src/generated",
|
|
49
|
+
"typecheck": "tsc --noEmit",
|
|
50
|
+
"gen-types": "jco types wit --world-name host-view --async-mode jspi --async-wasi-imports -o src/generated",
|
|
51
|
+
"sync-wit": "WKG_CONFIG_FILE=wkg-registry.toml wkg wit fetch --type wit",
|
|
52
|
+
"test": "node --test 'tests/*.test.mjs'",
|
|
53
|
+
"example": "python3 -m http.server 8765"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@bytecodealliance/jco": "^1.25.0",
|
|
57
|
+
"@bytecodealliance/jco-transpile": "^0.4.1",
|
|
58
|
+
"@bytecodealliance/preview2-shim": "^0.19.0",
|
|
59
|
+
"cbor2": "^2.3.0"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"typescript": "^5.6.0",
|
|
63
|
+
"undici": "^8.3.0"
|
|
64
|
+
},
|
|
65
|
+
"publishConfig": {
|
|
66
|
+
"access": "public",
|
|
67
|
+
"provenance": true
|
|
68
|
+
}
|
|
69
|
+
}
|