@jini-ai/agentic 0.4.2 → 0.4.3

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.
Files changed (72) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/a2ui/agent-to-renderer.d.ts +613 -0
  3. package/dist/a2ui/agent-to-renderer.js +191 -0
  4. package/dist/a2ui/catalog.d.ts +73 -0
  5. package/dist/a2ui/catalog.js +304 -0
  6. package/dist/a2ui/common-types.d.ts +401 -0
  7. package/dist/a2ui/common-types.js +130 -0
  8. package/dist/a2ui/index.d.ts +16 -0
  9. package/dist/a2ui/index.js +16 -0
  10. package/dist/a2ui/interpreter.d.ts +71 -0
  11. package/dist/a2ui/interpreter.js +337 -0
  12. package/dist/a2ui/json-pointer.d.ts +48 -0
  13. package/dist/a2ui/json-pointer.js +174 -0
  14. package/dist/a2ui/renderer-to-agent.d.ts +342 -0
  15. package/dist/a2ui/renderer-to-agent.js +111 -0
  16. package/dist/a2ui/resolve.d.ts +28 -0
  17. package/dist/a2ui/resolve.js +144 -0
  18. package/dist/a2ui/tree.d.ts +66 -0
  19. package/dist/a2ui/tree.js +74 -0
  20. package/dist/ag-ui.d.ts +82 -0
  21. package/dist/ag-ui.js +85 -0
  22. package/dist/agui/encoder.d.ts +50 -0
  23. package/dist/agui/encoder.js +97 -0
  24. package/dist/agui/events.d.ts +59 -0
  25. package/dist/agui/events.js +15 -0
  26. package/dist/capability.d.ts +81 -0
  27. package/dist/capability.js +79 -0
  28. package/dist/core/a2ui/index.d.ts +3 -7
  29. package/dist/core/a2ui/index.js +3 -7
  30. package/dist/core/a2ui/interpreter.d.ts +1 -1
  31. package/dist/core/a2ui/interpreter.js +0 -1
  32. package/dist/core/a2ui/surface-properties.d.ts +1 -1
  33. package/dist/core/a2ui/surface-properties.js +1 -1
  34. package/dist/core/dom/index.d.ts +3 -8
  35. package/dist/core/dom/index.js +3 -8
  36. package/dist/core/gen-ui/index.d.ts +2 -4
  37. package/dist/core/gen-ui/index.js +2 -4
  38. package/dist/core/index.d.ts +4 -30
  39. package/dist/core/index.js +4 -30
  40. package/dist/dom/dom-page-driver.d.ts +36 -0
  41. package/dist/dom/dom-page-driver.js +601 -0
  42. package/dist/dom/index.d.ts +17 -0
  43. package/dist/dom/index.js +17 -0
  44. package/dist/dom/model-context.d.ts +69 -0
  45. package/dist/dom/model-context.js +44 -0
  46. package/dist/element-handles.d.ts +120 -0
  47. package/dist/element-handles.js +39 -0
  48. package/dist/gen-ui/encoder.d.ts +50 -0
  49. package/dist/gen-ui/encoder.js +97 -0
  50. package/dist/gen-ui/events.d.ts +59 -0
  51. package/dist/gen-ui/events.js +15 -0
  52. package/dist/gen-ui/index.d.ts +18 -0
  53. package/dist/gen-ui/index.js +17 -0
  54. package/dist/guards.d.ts +96 -0
  55. package/dist/guards.js +186 -0
  56. package/dist/handle.d.ts +41 -0
  57. package/dist/handle.js +41 -0
  58. package/dist/index.d.ts +3 -35
  59. package/dist/index.js +3 -35
  60. package/dist/mcp-ui-apps.d.ts +223 -0
  61. package/dist/mcp-ui-apps.js +252 -0
  62. package/dist/mcp-ui.d.ts +133 -0
  63. package/dist/mcp-ui.js +134 -0
  64. package/dist/page-capabilities.d.ts +14 -0
  65. package/dist/page-capabilities.js +129 -0
  66. package/dist/page-driver.d.ts +120 -0
  67. package/dist/page-driver.js +2 -0
  68. package/dist/page-executor.d.ts +94 -0
  69. package/dist/page-executor.js +320 -0
  70. package/dist/webmcp.d.ts +202 -0
  71. package/dist/webmcp.js +173 -0
  72. package/package.json +20 -6
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @module capability
3
+ *
4
+ * The vocabulary every agent-drivable surface shares: what an outside caller may ask a
5
+ * frontend to do, described as pure data with no transport, DOM, or framework attached.
6
+ *
7
+ * One noun, deliberately: **capability**. The chat pane's first draft used `tool` in its
8
+ * type names and `capability` in its ids, which forked the vocabulary across four files.
9
+ * `tool` stays reserved for the engine's own `ToolRegistry`/`ToolExecutor` nouns; anything
10
+ * an outside caller asks a *frontend* to do is a capability. Transports may of course
11
+ * present capabilities as MCP tools — that is a projection, not a rename.
12
+ */
13
+ /**
14
+ * Looks a capability up by id.
15
+ *
16
+ * @param capabilities - The manifest to search.
17
+ * @param id - Capability id to resolve.
18
+ * @returns The definition, or `undefined` when the id is not in the manifest.
19
+ */
20
+ export function findCapability(capabilities, id) {
21
+ return capabilities.find((capability) => capability.id === id);
22
+ }
23
+ /**
24
+ * Checks caller input against a capability's declared schema.
25
+ *
26
+ * Manifests advertise `additionalProperties: false` and a `required` list, but nothing was
27
+ * enforcing either — handlers read the fields they knew about and ignored the rest, so a
28
+ * misnamed argument silently became a missing one. This closes that for any surface that calls
29
+ * it. Intentionally a shallow check, not a JSON Schema engine: these schemas are flat by
30
+ * construction, and a real validator is a dependency this package will not take.
31
+ *
32
+ * @param capability - The capability being invoked.
33
+ * @param input - Raw caller-supplied arguments.
34
+ * @returns An error message, or `null` when the input is acceptable.
35
+ */
36
+ export function findCapabilityInputError(capability, input) {
37
+ const { properties, required, additionalProperties } = capability.inputSchema;
38
+ for (const name of required ?? []) {
39
+ if (input[name] === undefined)
40
+ return `"${name}" is required`;
41
+ }
42
+ if (additionalProperties === false) {
43
+ // `key in properties` walks the whole prototype chain, so a key that happens to be inherited
44
+ // from Object.prototype (`__proto__`, `constructor`, `toString`, `valueOf`, …) reads as
45
+ // "known" regardless of whether the schema actually lists it — `'constructor' in {}` is
46
+ // true even on an empty object. `JSON.parse('{"__proto__":...}')` creates a real own data
47
+ // property (not the accessor), so this was a live way for such a key to escape the
48
+ // "unknown argument" refusal entirely. hasOwnProperty ignores the prototype chain, so only
49
+ // keys the schema actually declares count as known.
50
+ const unknown = Object.keys(input)
51
+ .filter((key) => !Object.prototype.hasOwnProperty.call(properties, key));
52
+ if (unknown.length > 0) {
53
+ return `unknown ${unknown.length === 1 ? 'argument' : 'arguments'}: ${unknown.sort().join(', ')}`;
54
+ }
55
+ }
56
+ for (const [name, schema] of Object.entries(properties)) {
57
+ const value = input[name];
58
+ if (value === undefined)
59
+ continue;
60
+ const actual = Array.isArray(value) ? 'array' : typeof value;
61
+ if (actual !== schema.type)
62
+ return `"${name}" must be a ${schema.type}, received ${actual}`;
63
+ if (schema.enum !== undefined && !schema.enum.includes(value)) {
64
+ return `"${name}" must be one of: ${schema.enum.join(', ')}`;
65
+ }
66
+ }
67
+ return null;
68
+ }
69
+ /**
70
+ * The capabilities a caller may use given what is currently connected.
71
+ *
72
+ * @param capabilities - The full manifest.
73
+ * @param hasSession - Whether a live frontend session is attached.
74
+ * @returns Only the capabilities that can actually be satisfied right now.
75
+ */
76
+ export function availableCapabilities(capabilities, hasSession) {
77
+ return hasSession ? capabilities : capabilities.filter((c) => c.surface === 'server');
78
+ }
79
+ //# sourceMappingURL=capability.js.map
@@ -1,10 +1,6 @@
1
- /**
2
- * @module @jini-ai/a2ui
3
- *
4
- * A2UI ("Agent-to-UI") v1.0 wire types + a minimal client-side interpreter — see each module's
5
- * own doc for detail, and `archived provenance ledger` for provenance, verified-against-primary-source notes,
6
- * and the honest gap list against full v1.0 spec parity.
7
- */
1
+ /** @module @jini-ai/a2ui
2
+ * A2UI v1.0 wire types and a minimal client interpreter. Each module documents its supported
3
+ * contract and gaps; these exports do not imply full v1.0 interpreter parity. */
8
4
  export * from './common-types.js';
9
5
  export * from './agent-to-renderer.js';
10
6
  export * from './renderer-to-agent.js';
@@ -1,10 +1,6 @@
1
- /**
2
- * @module @jini-ai/a2ui
3
- *
4
- * A2UI ("Agent-to-UI") v1.0 wire types + a minimal client-side interpreter — see each module's
5
- * own doc for detail, and `archived provenance ledger` for provenance, verified-against-primary-source notes,
6
- * and the honest gap list against full v1.0 spec parity.
7
- */
1
+ /** @module @jini-ai/a2ui
2
+ * A2UI v1.0 wire types and a minimal client interpreter. Each module documents its supported
3
+ * contract and gaps; these exports do not imply full v1.0 interpreter parity. */
8
4
  export * from './common-types.js';
9
5
  export * from './agent-to-renderer.js';
10
6
  export * from './renderer-to-agent.js';
@@ -4,7 +4,7 @@ import { WireComponentSchema } from './agent-to-renderer.js';
4
4
  import type { RendererToAgentMessage } from './renderer-to-agent.js';
5
5
  import { type Catalog } from './catalog.js';
6
6
  import { resolveDynamicValue } from './resolve.js';
7
- import { type DynamicValue, type LocalFunctionAction } from './common-types.js';
7
+ import type { DynamicValue, LocalFunctionAction } from './common-types.js';
8
8
  export interface ComponentInstance {
9
9
  readonly id: string;
10
10
  readonly component: string;
@@ -46,7 +46,6 @@ import { buildActionMessage, buildFunctionResponseMessage, buildGenericErrorMess
46
46
  import { setAtPointer } from './json-pointer.js';
47
47
  import { isComponentAllowed } from './catalog.js';
48
48
  import { resolveDynamicValue } from './resolve.js';
49
- import {} from './common-types.js';
50
49
  /**
51
50
  * Best-effort `surfaceId` extraction from a raw envelope's message-type-keyed body, without
52
51
  * assuming the envelope is well-formed. Used only to attribute a parse failure to a surface when
@@ -6,7 +6,7 @@
6
6
  * Why a display-only marker: a host's chat pane treats a surface that arrives while its tool call is
7
7
  * still open as a question the person must answer ("Waiting for your answer above"). That is right
8
8
  * for a form or a choice, and wrong for a chart a tool draws and then holds its call open only to
9
- * hear whether the browser refused it (Tovu demo V3, 2026-10-05). The tool that emits the surface is
9
+ * hear whether the browser refused it (host demo V3, 2026-10-05). The tool that emits the surface is
10
10
  * the only party that knows which it is, so it says so on `createSurface.surfaceProperties`, which
11
11
  * the v1.0 schema already accepts as an open record; renderers ignore the key.
12
12
  */
@@ -6,7 +6,7 @@
6
6
  * Why a display-only marker: a host's chat pane treats a surface that arrives while its tool call is
7
7
  * still open as a question the person must answer ("Waiting for your answer above"). That is right
8
8
  * for a form or a choice, and wrong for a chart a tool draws and then holds its call open only to
9
- * hear whether the browser refused it (Tovu demo V3, 2026-10-05). The tool that emits the surface is
9
+ * hear whether the browser refused it (host demo V3, 2026-10-05). The tool that emits the surface is
10
10
  * the only party that knows which it is, so it says so on `createSurface.surfaceProperties`, which
11
11
  * the v1.0 schema already accepts as an open record; renderers ignore the key.
12
12
  */
@@ -3,15 +3,10 @@
3
3
  *
4
4
  * The one `PageDriver` (see `@jini-ai/agentic`'s `page-driver.ts`) that reads and writes a real DOM
5
5
  * subtree. Split into its own entry point, compiled under its own `DOM`-lib `tsconfig.dom.json`,
6
- * so the rest of this package can stay provably DOM-free — see archived provenance ledger's "The DOM split".
7
- *
8
- * `@jini-ai/chat-react` is this package's one in-repo consumer today.
6
+ * so the rest of this package stays DOM-free.
9
7
  */
10
8
  export { createDomPageDriver, currentAgentPage, type DomPageDriverRequired, type DomPageDriverOptions, type DomPageDriverPage, } from './dom-page-driver.js';
11
- /**
12
- * WebMCP feature detection — moved 2026-07-26 from `@jini-ai/ui`'s `agent-tools/model-context.ts`
13
- * (plan §8 step 6). See `model-context.ts`'s module doc for why it lives here rather than
14
- * alongside `../webmcp.ts`'s DOM-free projection.
15
- */
9
+ /** Browser WebMCP feature detection. See model-context.ts for why it lives here rather than
10
+ * beside the DOM-free webmcp.ts projection. */
16
11
  export { getAgentModelContext, type AgentModelContextLike, type ModelContextHostPort, type AgentModelContextRegisterToolOptions, type AgentModelContextToolRegistration, } from './model-context.js';
17
12
  //# sourceMappingURL=index.d.ts.map
@@ -3,15 +3,10 @@
3
3
  *
4
4
  * The one `PageDriver` (see `@jini-ai/agentic`'s `page-driver.ts`) that reads and writes a real DOM
5
5
  * subtree. Split into its own entry point, compiled under its own `DOM`-lib `tsconfig.dom.json`,
6
- * so the rest of this package can stay provably DOM-free — see archived provenance ledger's "The DOM split".
7
- *
8
- * `@jini-ai/chat-react` is this package's one in-repo consumer today.
6
+ * so the rest of this package stays DOM-free.
9
7
  */
10
8
  export { createDomPageDriver, currentAgentPage, } from './dom-page-driver.js';
11
- /**
12
- * WebMCP feature detection — moved 2026-07-26 from `@jini-ai/ui`'s `agent-tools/model-context.ts`
13
- * (plan §8 step 6). See `model-context.ts`'s module doc for why it lives here rather than
14
- * alongside `../webmcp.ts`'s DOM-free projection.
15
- */
9
+ /** Browser WebMCP feature detection. See model-context.ts for why it lives here rather than
10
+ * beside the DOM-free webmcp.ts projection. */
16
11
  export { getAgentModelContext, } from './model-context.js';
17
12
  //# sourceMappingURL=index.js.map
@@ -5,10 +5,8 @@
5
5
  * `state_update`, `ui.surface_requested`, `ui.surface_responded`, `run.lifecycle`) and the encoder
6
6
  * that produces them from a `RunProtocolEvent` stream.
7
7
  *
8
- * **This is not AG-UI**, despite what this directory was called until 2026-07-27. The real
9
- * Agent-User Interaction Protocol uses a 33-member `SCREAMING_SNAKE` event enum and shares zero
10
- * event names with these six; `../ag-ui.ts` is the genuine AG-UI projection and lives at `src/`
11
- * root, apart from this. See `archived provenance ledger` for how the two came to be confused.
8
+ * GenUI and AG-UI are distinct contracts: AG-UI uses SCREAMING_SNAKE event names, while these six
9
+ * belong to Jini's run-stream protocol. ../ag-ui.ts owns the AG-UI projection.
12
10
  *
13
11
  * Nothing here opens a connection or touches a browser global. Transport (SSE, WebSocket) belongs
14
12
  * to a host — `@jini-ai/http-kit`'s run-stream route is the shipped consumer.
@@ -5,10 +5,8 @@
5
5
  * `state_update`, `ui.surface_requested`, `ui.surface_responded`, `run.lifecycle`) and the encoder
6
6
  * that produces them from a `RunProtocolEvent` stream.
7
7
  *
8
- * **This is not AG-UI**, despite what this directory was called until 2026-07-27. The real
9
- * Agent-User Interaction Protocol uses a 33-member `SCREAMING_SNAKE` event enum and shares zero
10
- * event names with these six; `../ag-ui.ts` is the genuine AG-UI projection and lives at `src/`
11
- * root, apart from this. See `archived provenance ledger` for how the two came to be confused.
8
+ * GenUI and AG-UI are distinct contracts: AG-UI uses SCREAMING_SNAKE event names, while these six
9
+ * belong to Jini's run-stream protocol. ../ag-ui.ts owns the AG-UI projection.
12
10
  *
13
11
  * Nothing here opens a connection or touches a browser global. Transport (SSE, WebSocket) belongs
14
12
  * to a host — `@jini-ai/http-kit`'s run-stream route is the shipped consumer.
@@ -14,8 +14,7 @@
14
14
  * same-document in a real site like a CMS, `postMessage` when a host embeds an untrusted
15
15
  * preview in a sandboxed frame. The verbs are identical either way. Also not here: any product's
16
16
  * OWN capabilities (`@jini-ai/chat-core`'s `chat.*` verbs stay in chat-core, which depends on this
17
- * package for the vocabulary rather than the other way around) — see this package's
18
- * archived provenance ledger for why the split is real rather than a wholesale relocation.
17
+ * package for the vocabulary rather than the other way around).
19
18
  */
20
19
  export { findCapability, findCapabilityInputError, availableCapabilities, type CapabilityDef, type CapabilityInputSchema, type CapabilityRisk, type CapabilitySurface, } from './capability.js';
21
20
  export type { PageDriver, FindElementsFilter, PageSummary } from './page-driver.js';
@@ -42,34 +41,9 @@ export { toWebMcpTool, toWebMcpTools, isValidWebMcpToolName, WebMcpConfirmationR
42
41
  * AG-UI's published `EventType` enum.
43
42
  */
44
43
  export { toAgUiTool, toAgUiTools, createAgUiToolResult, AG_UI_TOOL_CALL_EVENTS, type AgUiTool, type AgUiToolResultMessage, } from './ag-ui.js';
45
- /**
46
- * Jini's **own** run-stream surface protocol, from `./gen-ui/` — six event kinds and the encoder
47
- * that produces them (folded in 2026-07-26 from the standalone `@jini-ai/agui` package, plan §3a).
48
- *
49
- * Renamed from `./agui/` on 2026-07-27, because this is NOT AG-UI. The real Agent-User Interaction
50
- * Protocol (https://github.com/ag-ui-protocol/ag-ui) carries a 33-member `SCREAMING_SNAKE` event
51
- * enum — `RUN_STARTED`, `TEXT_MESSAGE_CONTENT`, `STATE_DELTA`, `STEP_STARTED`, `REASONING_*` — and
52
- * shares **zero** event names with the six dotted-lowercase kinds in `./gen-ui/events.ts`, which
53
- * are a de-branded port of one product's internal run-event adapter. Carrying the AG-UI name on
54
- * them asserted a conformance that does not exist.
55
- *
56
- * `./ag-ui.ts` above was wrongly folded in with them on 2026-07-26 and moved back out on the 27th:
57
- * it is the one file here that really does speak AG-UI, so merging it with these six was the exact
58
- * inversion of the truth.
59
- *
60
- * The exported symbols were renamed `Agui`/`AGUI` → `GenUi` on 2026-07-29, finishing what the
61
- * directory move started: with genuine AG-UI (`./ag-ui.ts`, exported just above as `toAgUiTool`
62
- * and friends) living in the same barrel, two unrelated protocols were reading as one.
63
- *
64
- * `@jini-ai/http-kit` used to mount this encoder behind a route still named `/api/runs/:runId/
65
- * agui-stream` — left un-renamed at the time on the assumption it was a wire contract an
66
- * already-deployed client might be calling. A 2026-08-18 audit found zero callers of that route
67
- * anywhere (no client in this repo or any consuming product ever requested it, and `@jini-ai/http-kit` has never
68
- * actually been published to npm, so no external integrator could depend on it either); the route,
69
- * its registrar, and its tests were removed outright rather than renamed. This `gen-ui/` module
70
- * itself was untouched — it is `@jini-ai/agentic`'s own public export and its removal is a separate
71
- * decision.
72
- */
44
+ /** Jini's gen-ui protocol has six dotted-lowercase event kinds, distinct from genuine AG-UI's
45
+ * SCREAMING_SNAKE event vocabulary exported above. Keep the names separate: claiming AG-UI
46
+ * conformance for this internal projection would misrepresent its public contract. */
73
47
  export { createGenUiEncoder, type GenUiEncodeContext, type GenUiEncoder, type GenUiAgentMessageEvent, type GenUiEvent, type GenUiEventBase, type GenUiEventKind, type GenUiRunLifecycleEvent, type GenUiStateUpdateEvent, type GenUiSurfaceRequestedEvent, type GenUiSurfaceRespondedEvent, type GenUiToolCallEvent, } from './gen-ui/index.js';
74
48
  export { MCP_UI_VIEW_METHODS, MCP_UI_HOST_NOTIFICATIONS, MCP_UI_VIEW_NOTIFICATIONS, MCP_UI_HOST_REQUESTS, MCP_UI_SANDBOX_NOTE, JINI_PAGE_ACTION_METHOD, JSON_RPC_ERROR_CODES, isJsonRpcMessage, isJsonRpcRequest, createJsonRpcRequest, createJsonRpcNotification, createJsonRpcResult, createJsonRpcError, createPageActionRequest, type JsonRpcMessage, type JsonRpcRequest, type JsonRpcNotification, type JsonRpcResponse, type JsonRpcError, } from './mcp-ui-apps.js';
75
49
  export { defaultAgenticMessages } from "./messages.js";
@@ -14,8 +14,7 @@
14
14
  * same-document in a real site like a CMS, `postMessage` when a host embeds an untrusted
15
15
  * preview in a sandboxed frame. The verbs are identical either way. Also not here: any product's
16
16
  * OWN capabilities (`@jini-ai/chat-core`'s `chat.*` verbs stay in chat-core, which depends on this
17
- * package for the vocabulary rather than the other way around) — see this package's
18
- * archived provenance ledger for why the split is real rather than a wholesale relocation.
17
+ * package for the vocabulary rather than the other way around).
19
18
  */
20
19
  export { findCapability, findCapabilityInputError, availableCapabilities, } from './capability.js';
21
20
  export { executePageCapability, projectElementState, DEFAULT_HIGHLIGHT_MS, MAX_HIGHLIGHT_MS, MAX_STATEFUL_ELEMENTS, } from './page-executor.js';
@@ -41,34 +40,9 @@ export { toWebMcpTool, toWebMcpTools, isValidWebMcpToolName, WebMcpConfirmationR
41
40
  * AG-UI's published `EventType` enum.
42
41
  */
43
42
  export { toAgUiTool, toAgUiTools, createAgUiToolResult, AG_UI_TOOL_CALL_EVENTS, } from './ag-ui.js';
44
- /**
45
- * Jini's **own** run-stream surface protocol, from `./gen-ui/` — six event kinds and the encoder
46
- * that produces them (folded in 2026-07-26 from the standalone `@jini-ai/agui` package, plan §3a).
47
- *
48
- * Renamed from `./agui/` on 2026-07-27, because this is NOT AG-UI. The real Agent-User Interaction
49
- * Protocol (https://github.com/ag-ui-protocol/ag-ui) carries a 33-member `SCREAMING_SNAKE` event
50
- * enum — `RUN_STARTED`, `TEXT_MESSAGE_CONTENT`, `STATE_DELTA`, `STEP_STARTED`, `REASONING_*` — and
51
- * shares **zero** event names with the six dotted-lowercase kinds in `./gen-ui/events.ts`, which
52
- * are a de-branded port of one product's internal run-event adapter. Carrying the AG-UI name on
53
- * them asserted a conformance that does not exist.
54
- *
55
- * `./ag-ui.ts` above was wrongly folded in with them on 2026-07-26 and moved back out on the 27th:
56
- * it is the one file here that really does speak AG-UI, so merging it with these six was the exact
57
- * inversion of the truth.
58
- *
59
- * The exported symbols were renamed `Agui`/`AGUI` → `GenUi` on 2026-07-29, finishing what the
60
- * directory move started: with genuine AG-UI (`./ag-ui.ts`, exported just above as `toAgUiTool`
61
- * and friends) living in the same barrel, two unrelated protocols were reading as one.
62
- *
63
- * `@jini-ai/http-kit` used to mount this encoder behind a route still named `/api/runs/:runId/
64
- * agui-stream` — left un-renamed at the time on the assumption it was a wire contract an
65
- * already-deployed client might be calling. A 2026-08-18 audit found zero callers of that route
66
- * anywhere (no client in this repo or any consuming product ever requested it, and `@jini-ai/http-kit` has never
67
- * actually been published to npm, so no external integrator could depend on it either); the route,
68
- * its registrar, and its tests were removed outright rather than renamed. This `gen-ui/` module
69
- * itself was untouched — it is `@jini-ai/agentic`'s own public export and its removal is a separate
70
- * decision.
71
- */
43
+ /** Jini's gen-ui protocol has six dotted-lowercase event kinds, distinct from genuine AG-UI's
44
+ * SCREAMING_SNAKE event vocabulary exported above. Keep the names separate: claiming AG-UI
45
+ * conformance for this internal projection would misrepresent its public contract. */
72
46
  export { createGenUiEncoder, } from './gen-ui/index.js';
73
47
  export { MCP_UI_VIEW_METHODS, MCP_UI_HOST_NOTIFICATIONS, MCP_UI_VIEW_NOTIFICATIONS, MCP_UI_HOST_REQUESTS, MCP_UI_SANDBOX_NOTE, JINI_PAGE_ACTION_METHOD, JSON_RPC_ERROR_CODES, isJsonRpcMessage, isJsonRpcRequest, createJsonRpcRequest, createJsonRpcNotification, createJsonRpcResult, createJsonRpcError, createPageActionRequest, } from './mcp-ui-apps.js';
74
48
  export { defaultAgenticMessages } from "./messages.js";
@@ -0,0 +1,36 @@
1
+ import type { PageDriver } from '../page-driver.js';
2
+ /** One page a host allows navigation to: its human label, and how to actually get there. */
3
+ export interface DomPageDriverPage {
4
+ /** Shown to a caller by `page.find_elements`/`page.navigate`'s refusal message — see
5
+ * `PageSummary.label` for why this exists at all. */
6
+ readonly label: string;
7
+ readonly navigate: () => void;
8
+ }
9
+ export interface DomPageDriverOptions {
10
+ /** The subtree to expose. Never pass `document`. */
11
+ readonly root: ParentNode & {
12
+ querySelector: Element['querySelector'];
13
+ };
14
+ /** Page ids this driver may navigate to, each with its label and how to get there. */
15
+ readonly pages: Readonly<Record<string, DomPageDriverPage>>;
16
+ /**
17
+ * The id of the page currently shown, reported on every element.
18
+ *
19
+ * Omit it in a single-page app that swaps views: the driver then reads `data-agent-page` from
20
+ * the live DOM on every call, so navigating actually changes what elements report. A value
21
+ * captured here is fixed for the driver's whole lifetime, which is right only for a surface that
22
+ * never changes view — and silently wrong for one that does, since the driver outlives any one
23
+ * view (it is bound to the connection, not the render).
24
+ */
25
+ readonly currentPage?: string | undefined;
26
+ }
27
+ /**
28
+ * Builds a driver over `root`.
29
+ *
30
+ * @param options - The subtree, the navigable pages, and the current page id.
31
+ * @returns A driver ready to hand to `executePageCapability`.
32
+ */
33
+ export declare function createDomPageDriver(options: DomPageDriverOptions): PageDriver;
34
+ /** Reads the current page's `data-agent-page`, for hosts that tag the body. */
35
+ export declare function currentAgentPage(root: ParentNode): string | undefined;
36
+ //# sourceMappingURL=dom-page-driver.d.ts.map