๐ Getting started โ
WCI (Web Context Interface) is an open standard and TypeScript SDK for annotating web pages, distilling them for LLM context, and dispatching typed browser actions.
Prerequisites โ
- Node.js 18+
- A browser environment (Bridge and Distiller run in the DOM; Context uses
fetch)
Install โ
From this repository (development):
bash
git clone <your-repo-url>
cd WIA_framework
npm install
npm run buildWhen published to npm:
bash
npm install @webcontextinterface/core
# or install packages individually:
# npm install @webcontextinterface/spec @webcontextinterface/distiller @webcontextinterface/bridge @webcontextinterface/context1. Annotate your HTML โ
Add data-wci-* attributes to elements agents should see or control:
html
<input
data-wci-id="email-input"
data-wci-role="form"
data-wci-desc="User email โ must be unique"
data-wci-action="fill"
data-wci-required="true"
data-wci-state='{"value":"","valid":null}'
data-wci-scope="registration-form"
data-wci-priority="1"
/>See Specification for the full attribute list.
2. Distil the page for an LLM โ
typescript
import { WciDistiller } from '@webcontextinterface/distiller';
const distiller = new WciDistiller({
format: 'json',
scope: 'registration-form',
maxNodes: 64,
});
const view = distiller.distil(document);
// Pass to your LLM as tool context or system-adjacent user message
const json = distiller.distilJSON(document);3. Dispatch actions from agent decisions โ
typescript
import { WciBridge } from '@webcontextinterface/bridge';
import { WciContextLoader } from '@webcontextinterface/context';
const ctx = await WciContextLoader.load(window.location.origin);
const bridge = new WciBridge(document.getElementById('registration-form')!);
bridge.setPolicy(ctx.policy);
const fillResult = await bridge.fill('email-input', 'user@example.com');
if (!fillResult.success) {
console.error(fillResult.error);
}
await bridge.click('submit-btn');
console.log(bridge.getHistory());4. Load site-wide context โ
Place these at your site root (see Site policy):
/wci.txtโ allow/deny scopes, rate limits, auth/wci.jsonโ structured manifest and task flows/wci.mdโ narrative for the LLM system prompt
typescript
import { WciContextLoader } from '@webcontextinterface/context';
const ctx = await WciContextLoader.load('https://your-site.com');
bridge.setPolicy(ctx.policy);
const systemPrompt = ctx.narrative ?? '';5. All-in-one SDK import โ
typescript
import {
WciDistiller,
WciBridge,
WciContextLoader,
readWciNodeSpec,
} from '@webcontextinterface/core';Run the demo โ
bash
npm run demoOpens the interactive showcase at http://localhost:5173 with live distillation, action log, and site context viewer.
Next steps โ
- Architecture โ how the layers connect
- LLM integration โ closed-loop agent patterns
- API reference โ per-package APIs
