@jini-ai/agentic 0.3.7 → 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.
Files changed (84) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/README.md +33 -6
  3. package/dist/core/a2ui/agent-to-renderer.d.ts +3 -1
  4. package/dist/core/a2ui/agent-to-renderer.js +1 -1
  5. package/dist/core/a2ui/catalog.d.ts +14 -5
  6. package/dist/core/a2ui/catalog.js +5 -5
  7. package/dist/core/a2ui/common-types.d.ts +11 -3
  8. package/dist/core/a2ui/common-types.js +5 -3
  9. package/dist/core/a2ui/index.d.ts +1 -1
  10. package/dist/core/a2ui/index.js +1 -1
  11. package/dist/core/a2ui/interpreter.d.ts +45 -10
  12. package/dist/core/a2ui/interpreter.js +38 -43
  13. package/dist/core/a2ui/json-pointer.d.ts +16 -4
  14. package/dist/core/a2ui/json-pointer.js +7 -7
  15. package/dist/core/a2ui/renderer-to-agent.d.ts +22 -8
  16. package/dist/core/a2ui/renderer-to-agent.js +5 -5
  17. package/dist/core/a2ui/resolve.d.ts +7 -2
  18. package/dist/core/a2ui/resolve.js +10 -9
  19. package/dist/core/a2ui/tree.d.ts +8 -2
  20. package/dist/core/a2ui/tree.js +2 -2
  21. package/dist/core/ag-ui.d.ts +17 -9
  22. package/dist/core/ag-ui.js +4 -4
  23. package/dist/core/capability.d.ts +12 -3
  24. package/dist/core/capability.js +3 -3
  25. package/dist/core/dom/dom-page-driver.d.ts +8 -4
  26. package/dist/core/dom/dom-page-driver.js +19 -20
  27. package/dist/core/dom/index.d.ts +3 -3
  28. package/dist/core/dom/index.js +1 -1
  29. package/dist/core/dom/model-context.d.ts +18 -8
  30. package/dist/core/dom/model-context.js +12 -15
  31. package/dist/core/dom/native-model-context.d.ts +6 -0
  32. package/dist/core/dom/native-model-context.js +19 -0
  33. package/dist/core/element-handles.d.ts +6 -2
  34. package/dist/core/element-handles.js +3 -3
  35. package/dist/core/gen-ui/encoder.d.ts +21 -11
  36. package/dist/core/gen-ui/encoder.js +8 -7
  37. package/dist/core/gen-ui/events.d.ts +6 -5
  38. package/dist/core/gen-ui/events.js +6 -5
  39. package/dist/core/gen-ui/index.d.ts +1 -1
  40. package/dist/core/gen-ui/index.js +1 -1
  41. package/dist/core/guards.d.ts +17 -5
  42. package/dist/core/guards.js +6 -6
  43. package/dist/core/handle.d.ts +12 -5
  44. package/dist/core/handle.js +9 -8
  45. package/dist/core/index.d.ts +2 -1
  46. package/dist/core/index.js +2 -1
  47. package/dist/core/list-handles.d.ts +4 -1
  48. package/dist/core/list-handles.js +1 -1
  49. package/dist/core/mcp-ui-apps.d.ts +39 -9
  50. package/dist/core/mcp-ui-apps.js +10 -8
  51. package/dist/core/messages.d.ts +6 -0
  52. package/dist/core/messages.js +6 -0
  53. package/dist/core/page-capabilities.d.ts +0 -11
  54. package/dist/core/page-capabilities.js +13 -1
  55. package/dist/core/page-driver.d.ts +32 -11
  56. package/dist/core/page-executor.d.ts +8 -2
  57. package/dist/core/page-executor.js +31 -31
  58. package/dist/core/webmcp.d.ts +27 -8
  59. package/dist/core/webmcp.js +14 -14
  60. package/dist/index.d.ts +30 -0
  61. package/dist/index.js +30 -0
  62. package/dist/skills/install/archive.d.ts +8 -0
  63. package/dist/skills/install/archive.js +47 -0
  64. package/dist/skills/install/fetch-adapter.d.ts +6 -0
  65. package/dist/skills/install/fetch-adapter.js +6 -0
  66. package/dist/skills/install/github.d.ts +21 -0
  67. package/dist/skills/install/github.js +92 -0
  68. package/dist/skills/install/index.d.ts +11 -0
  69. package/dist/skills/install/index.js +11 -0
  70. package/dist/skills/install/install-service.d.ts +44 -0
  71. package/dist/skills/install/install-service.js +121 -0
  72. package/dist/skills/install/layout.d.ts +13 -0
  73. package/dist/skills/install/layout.js +22 -0
  74. package/dist/skills/install/live-registration.d.ts +61 -0
  75. package/dist/skills/install/live-registration.js +64 -0
  76. package/dist/skills/install/node-filesystem.d.ts +4 -0
  77. package/dist/skills/install/node-filesystem.js +41 -0
  78. package/dist/skills/install/ports.d.ts +101 -0
  79. package/dist/skills/install/ports.js +2 -0
  80. package/dist/skills/install/state.d.ts +13 -0
  81. package/dist/skills/install/state.js +23 -0
  82. package/dist/skills/install/validation.d.ts +45 -0
  83. package/dist/skills/install/validation.js +104 -0
  84. package/package.json +20 -5
@@ -57,7 +57,9 @@ export type FieldRefusal = FieldReadRefusal | 'not-text' | 'read-only' | 'disabl
57
57
  * @param field - The field's attributes.
58
58
  * @returns The first secrecy refusal, or `null` when the value may be reported.
59
59
  */
60
- export declare function findFieldReadRefusal(field: FieldDescriptor): FieldReadRefusal | null;
60
+ export declare function findFieldReadRefusal({ field }: {
61
+ field: FieldDescriptor;
62
+ }, _optional?: Record<string, never>): FieldReadRefusal | null;
61
63
  /**
62
64
  * Why an automated fill must be refused for this field, or `null` when it is safe to write.
63
65
  *
@@ -70,11 +72,17 @@ export declare function findFieldReadRefusal(field: FieldDescriptor): FieldReadR
70
72
  * @param field - The field's attributes.
71
73
  * @returns The first refusal reason, or `null` when the field may be filled.
72
74
  */
73
- export declare function findFieldFillRefusal(field: FieldDescriptor): FieldRefusal | null;
75
+ export declare function findFieldFillRefusal({ field }: {
76
+ field: FieldDescriptor;
77
+ }, _optional?: Record<string, never>): FieldRefusal | null;
74
78
  /** Model-readable reason for a refusal, so a blocked fill explains itself instead of failing opaquely. */
75
- export declare function describeFieldRefusal(refusal: FieldRefusal): string;
79
+ export declare function describeFieldRefusal({ refusal }: {
80
+ refusal: FieldRefusal;
81
+ }, _optional?: Record<string, never>): string;
76
82
  /** Model-readable reason a value was withheld, so a caller knows the field has contents it may not see rather than assuming it is empty. */
77
- export declare function describeFieldReadRefusal(refusal: FieldReadRefusal): string;
83
+ export declare function describeFieldReadRefusal({ refusal }: {
84
+ refusal: FieldReadRefusal;
85
+ }, _optional?: Record<string, never>): string;
78
86
  /** Default cap on page-authored text handed to a model. */
79
87
  export declare const MAX_AGENT_LABEL_LENGTH = 200;
80
88
  export interface NormalizedLabel {
@@ -92,5 +100,9 @@ export interface NormalizedLabel {
92
100
  * @param maxLength - Cap, defaulting to {@link MAX_AGENT_LABEL_LENGTH}.
93
101
  * @returns The bounded text and whether anything was cut.
94
102
  */
95
- export declare function normalizeAgentLabel(raw: string, maxLength?: number): NormalizedLabel;
103
+ export declare function normalizeAgentLabel({ raw }: {
104
+ raw: string;
105
+ }, { maxLength }?: {
106
+ maxLength?: number | undefined;
107
+ }): NormalizedLabel;
96
108
  //# sourceMappingURL=guards.d.ts.map
@@ -77,7 +77,7 @@ const NON_TEXT_TYPES = new Set(['checkbox', 'radio', 'submit', 'reset', 'button'
77
77
  * @param field - The field's attributes.
78
78
  * @returns The first secrecy refusal, or `null` when the value may be reported.
79
79
  */
80
- export function findFieldReadRefusal(field) {
80
+ export function findFieldReadRefusal({ field }, _optional = {}) {
81
81
  const type = field.type?.toLowerCase();
82
82
  if (type !== undefined && DENIED_TYPES.has(type))
83
83
  return 'denied-type';
@@ -119,8 +119,8 @@ export function findFieldReadRefusal(field) {
119
119
  * @param field - The field's attributes.
120
120
  * @returns The first refusal reason, or `null` when the field may be filled.
121
121
  */
122
- export function findFieldFillRefusal(field) {
123
- const secrecy = findFieldReadRefusal(field);
122
+ export function findFieldFillRefusal({ field }, _optional = {}) {
123
+ const secrecy = findFieldReadRefusal({ field });
124
124
  if (secrecy !== null)
125
125
  return secrecy;
126
126
  const type = field.type?.toLowerCase();
@@ -146,11 +146,11 @@ const FIELD_READ_REFUSAL_MESSAGES = {
146
146
  'suspicious-name': 'this field name indicates a secret or anti-forgery token',
147
147
  };
148
148
  /** Model-readable reason for a refusal, so a blocked fill explains itself instead of failing opaquely. */
149
- export function describeFieldRefusal(refusal) {
149
+ export function describeFieldRefusal({ refusal }, _optional = {}) {
150
150
  return FIELD_REFUSAL_MESSAGES[refusal];
151
151
  }
152
152
  /** Model-readable reason a value was withheld, so a caller knows the field has contents it may not see rather than assuming it is empty. */
153
- export function describeFieldReadRefusal(refusal) {
153
+ export function describeFieldReadRefusal({ refusal }, _optional = {}) {
154
154
  return FIELD_READ_REFUSAL_MESSAGES[refusal];
155
155
  }
156
156
  /** Default cap on page-authored text handed to a model. */
@@ -176,7 +176,7 @@ const CONTROL_AND_BIDI =
176
176
  * @param maxLength - Cap, defaulting to {@link MAX_AGENT_LABEL_LENGTH}.
177
177
  * @returns The bounded text and whether anything was cut.
178
178
  */
179
- export function normalizeAgentLabel(raw, maxLength = MAX_AGENT_LABEL_LENGTH) {
179
+ export function normalizeAgentLabel({ raw }, { maxLength = MAX_AGENT_LABEL_LENGTH } = {}) {
180
180
  const stripped = raw.replace(CONTROL_AND_BIDI, ' ');
181
181
  const collapsed = stripped.replace(/\s+/g, ' ').trim();
182
182
  if (collapsed.length <= maxLength)
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * @module handle
3
3
  *
4
- * `agentHandle('save')` — the attribute props a component spreads onto its root element to
4
+ * `agentHandle({ handle: 'save' })` — the attribute props a component spreads onto its root element to
5
5
  * publish itself under this package's `data-agent-*` markup convention (see
6
6
  * `element-handles.ts`), without the caller having to know the attribute names or re-derive the
7
7
  * handle-validity rule itself.
8
8
  *
9
9
  * Deliberately pure data, no DOM: this returns a plain object of string attributes, spreadable by
10
- * React (`<button {...agentHandle('save')}>`), Vue, Svelte, or any renderer that accepts arbitrary
10
+ * React (`<button {...agentHandle({ handle: 'save' })}>`), Vue, Svelte, or any renderer that accepts arbitrary
11
11
  * attribute props on an element. That is what lets it live in this package's universal root
12
12
  * rather than `./dom` — nothing here touches `document` or any browser global.
13
13
  */
@@ -37,7 +37,9 @@ export type AgentHandleProps = {
37
37
  * @throws If `handle` is not a valid element handle — never publishes a handle a caller (`page.*`
38
38
  * capabilities, `resolveHandleSelector`) could not later resolve.
39
39
  */
40
- export declare function agentHandle(handle: string, options?: AgentHandleOptions): AgentHandleProps;
40
+ export declare function agentHandle({ handle }: {
41
+ handle: string;
42
+ }, options?: AgentHandleOptions): AgentHandleProps;
41
43
  /**
42
44
  * The handle for one sub-element published under `base` — `<base>-<action>`.
43
45
  *
@@ -54,9 +56,14 @@ export declare function agentHandle(handle: string, options?: AgentHandleOptions
54
56
  * @returns `<base>-<action>`.
55
57
  * @complexity O(1).
56
58
  */
57
- export declare function agentSubHandle(base: string, action: string): string;
59
+ export declare function agentSubHandle({ base, action }: {
60
+ base: string;
61
+ action: string;
62
+ }, _optional?: Record<string, never>): string;
58
63
  /** What to publish about one sub-element — see {@link agentHandleProps}. */
59
64
  export interface AgentHandlePropsOptions extends AgentHandleOptions {
65
+ /** Host-published base handle. Omit to leave the element unpublished. */
66
+ readonly base?: string | undefined;
60
67
  /**
61
68
  * The sub-element's name, appended to `base` via {@link agentSubHandle}. Omit when the element
62
69
  * IS `base` — the component's own root.
@@ -85,5 +92,5 @@ export interface AgentHandlePropsOptions extends AgentHandleOptions {
85
92
  * answering to a handle the host never wrote.
86
93
  * @complexity O(1).
87
94
  */
88
- export declare function agentHandleProps(base: string | undefined, options?: AgentHandlePropsOptions): AgentHandleProps | Record<string, never>;
95
+ export declare function agentHandleProps(_required: Record<string, never>, options?: AgentHandlePropsOptions): AgentHandleProps | Record<string, never>;
89
96
  //# sourceMappingURL=handle.d.ts.map
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * @module handle
3
3
  *
4
- * `agentHandle('save')` — the attribute props a component spreads onto its root element to
4
+ * `agentHandle({ handle: 'save' })` — the attribute props a component spreads onto its root element to
5
5
  * publish itself under this package's `data-agent-*` markup convention (see
6
6
  * `element-handles.ts`), without the caller having to know the attribute names or re-derive the
7
7
  * handle-validity rule itself.
8
8
  *
9
9
  * Deliberately pure data, no DOM: this returns a plain object of string attributes, spreadable by
10
- * React (`<button {...agentHandle('save')}>`), Vue, Svelte, or any renderer that accepts arbitrary
10
+ * React (`<button {...agentHandle({ handle: 'save' })}>`), Vue, Svelte, or any renderer that accepts arbitrary
11
11
  * attribute props on an element. That is what lets it live in this package's universal root
12
12
  * rather than `./dom` — nothing here touches `document` or any browser global.
13
13
  */
@@ -24,8 +24,8 @@ import { AGENT_ELEMENT_ATTRIBUTE, AGENT_LABEL_ATTRIBUTE, AGENT_PAGE_ATTRIBUTE, A
24
24
  * @throws If `handle` is not a valid element handle — never publishes a handle a caller (`page.*`
25
25
  * capabilities, `resolveHandleSelector`) could not later resolve.
26
26
  */
27
- export function agentHandle(handle, options = {}) {
28
- if (!isValidElementHandle(handle)) {
27
+ export function agentHandle({ handle }, options = {}) {
28
+ if (!isValidElementHandle({ handle })) {
29
29
  throw new Error(`invalid element handle "${handle.slice(0, 128)}": `
30
30
  + 'handles are lowercase words joined by single hyphens, and are never CSS selectors');
31
31
  }
@@ -54,7 +54,7 @@ export function agentHandle(handle, options = {}) {
54
54
  * @returns `<base>-<action>`.
55
55
  * @complexity O(1).
56
56
  */
57
- export function agentSubHandle(base, action) {
57
+ export function agentSubHandle({ base, action }, _optional = {}) {
58
58
  return `${base}-${action}`;
59
59
  }
60
60
  /**
@@ -79,10 +79,11 @@ export function agentSubHandle(base, action) {
79
79
  * answering to a handle the host never wrote.
80
80
  * @complexity O(1).
81
81
  */
82
- export function agentHandleProps(base, options = {}) {
82
+ export function agentHandleProps(_required, options = {}) {
83
+ const { base } = options;
83
84
  if (base === undefined)
84
85
  return {};
85
- const { action, ...rest } = options;
86
- return agentHandle(action === undefined ? base : agentSubHandle(base, action), rest);
86
+ const { action, base: _base, ...rest } = options;
87
+ return agentHandle({ handle: action === undefined ? base : agentSubHandle({ base, action }) }, rest);
87
88
  }
88
89
  //# sourceMappingURL=handle.js.map
@@ -15,7 +15,7 @@
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
17
  * package for the vocabulary rather than the other way around) — see this package's
18
- * source-map.md for why the split is real rather than a wholesale relocation.
18
+ * archived provenance ledger for why the split is real rather than a wholesale relocation.
19
19
  */
20
20
  export { findCapability, findCapabilityInputError, availableCapabilities, type CapabilityDef, type CapabilityInputSchema, type CapabilityRisk, type CapabilitySurface, } from './capability.js';
21
21
  export type { PageDriver, FindElementsFilter, PageSummary } from './page-driver.js';
@@ -72,4 +72,5 @@ export { toAgUiTool, toAgUiTools, createAgUiToolResult, AG_UI_TOOL_CALL_EVENTS,
72
72
  */
73
73
  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
74
  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
+ export { defaultAgenticMessages } from "./messages.js";
75
76
  //# sourceMappingURL=index.d.ts.map
@@ -15,7 +15,7 @@
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
17
  * package for the vocabulary rather than the other way around) — see this package's
18
- * source-map.md for why the split is real rather than a wholesale relocation.
18
+ * archived provenance ledger for why the split is real rather than a wholesale relocation.
19
19
  */
20
20
  export { findCapability, findCapabilityInputError, availableCapabilities, } from './capability.js';
21
21
  export { executePageCapability, projectElementState, DEFAULT_HIGHLIGHT_MS, MAX_HIGHLIGHT_MS, MAX_STATEFUL_ELEMENTS, } from './page-executor.js';
@@ -71,4 +71,5 @@ export { toAgUiTool, toAgUiTools, createAgUiToolResult, AG_UI_TOOL_CALL_EVENTS,
71
71
  */
72
72
  export { createGenUiEncoder, } from './gen-ui/index.js';
73
73
  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
+ export { defaultAgenticMessages } from "./messages.js";
74
75
  //# sourceMappingURL=index.js.map
@@ -39,5 +39,8 @@
39
39
  * search then walks the full used-set for each collision); n is a list's row/card count, which is
40
40
  * operator- or user-authored content and stays small in practice. Space O(n).
41
41
  */
42
- export declare function buildAgentListHandles(prefix: string, ids: readonly string[]): string[];
42
+ export declare function buildAgentListHandles({ prefix, ids }: {
43
+ prefix: string;
44
+ ids: readonly string[];
45
+ }, _optional?: Record<string, never>): string[];
43
46
  //# sourceMappingURL=list-handles.d.ts.map
@@ -39,7 +39,7 @@
39
39
  * search then walks the full used-set for each collision); n is a list's row/card count, which is
40
40
  * operator- or user-authored content and stays small in practice. Space O(n).
41
41
  */
42
- export function buildAgentListHandles(prefix, ids) {
42
+ export function buildAgentListHandles({ prefix, ids }, _optional = {}) {
43
43
  const used = new Set();
44
44
  return ids.map((id, index) => {
45
45
  const slug = id.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
@@ -127,12 +127,12 @@ export interface JsonRpcRequest {
127
127
  readonly jsonrpc: '2.0';
128
128
  readonly id: number | string;
129
129
  readonly method: string;
130
- readonly params?: Record<string, unknown>;
130
+ readonly params?: Record<string, unknown> | undefined;
131
131
  }
132
132
  export interface JsonRpcNotification {
133
133
  readonly jsonrpc: '2.0';
134
134
  readonly method: string;
135
- readonly params?: Record<string, unknown>;
135
+ readonly params?: Record<string, unknown> | undefined;
136
136
  }
137
137
  export interface JsonRpcError {
138
138
  readonly code: number;
@@ -193,9 +193,17 @@ export declare const JSON_RPC_ERROR_CODES: {
193
193
  * @param value - The raw `event.data`.
194
194
  * @returns True when the value is a well-formed JSON-RPC message.
195
195
  */
196
- export declare function isJsonRpcMessage(value: unknown): value is JsonRpcMessage;
196
+ export declare function isJsonRpcMessage(required: {
197
+ value: unknown;
198
+ }, _optional?: Record<string, never>): required is {
199
+ value: JsonRpcMessage;
200
+ };
197
201
  /** Whether a validated message expects a response (as opposed to being a notification). */
198
- export declare function isJsonRpcRequest(message: JsonRpcMessage): message is JsonRpcRequest;
202
+ export declare function isJsonRpcRequest(required: {
203
+ message: JsonRpcMessage;
204
+ }, _optional?: Record<string, never>): required is {
205
+ message: JsonRpcRequest;
206
+ };
199
207
  /**
200
208
  * Builds a request.
201
209
  *
@@ -204,13 +212,31 @@ export declare function isJsonRpcRequest(message: JsonRpcMessage): message is Js
204
212
  * @param method - Method name.
205
213
  * @param params - Optional parameters.
206
214
  */
207
- export declare function createJsonRpcRequest(id: number | string, method: string, params?: Record<string, unknown>): JsonRpcRequest;
215
+ export declare function createJsonRpcRequest({ id, method }: {
216
+ id: number | string;
217
+ method: string;
218
+ }, { params }?: {
219
+ params?: Record<string, unknown> | undefined;
220
+ }): JsonRpcRequest;
208
221
  /** Builds a notification — no `id`, so no response is expected or allowed. */
209
- export declare function createJsonRpcNotification(method: string, params?: Record<string, unknown>): JsonRpcNotification;
222
+ export declare function createJsonRpcNotification({ method }: {
223
+ method: string;
224
+ }, { params }?: {
225
+ params?: Record<string, unknown> | undefined;
226
+ }): JsonRpcNotification;
210
227
  /** Builds a success response for `id`. */
211
- export declare function createJsonRpcResult(id: number | string, result: unknown): JsonRpcResponse;
228
+ export declare function createJsonRpcResult({ id, result }: {
229
+ id: number | string;
230
+ result: unknown;
231
+ }, _optional?: Record<string, never>): JsonRpcResponse;
212
232
  /** Builds an error response for `id`. */
213
- export declare function createJsonRpcError(id: number | string, code: number, message: string, data?: unknown): JsonRpcResponse;
233
+ export declare function createJsonRpcError({ id, code, message }: {
234
+ id: number | string;
235
+ code: number;
236
+ message: string;
237
+ }, { data }?: {
238
+ data?: unknown;
239
+ }): JsonRpcResponse;
214
240
  /**
215
241
  * Builds a Jini page-action request.
216
242
  *
@@ -219,5 +245,9 @@ export declare function createJsonRpcError(id: number | string, code: number, me
219
245
  * @param input - Capability arguments.
220
246
  * @returns The namespaced extension request.
221
247
  */
222
- export declare function createPageActionRequest(id: number | string, capabilityId: string, input: Record<string, unknown>): JsonRpcRequest;
248
+ export declare function createPageActionRequest({ id, capabilityId, input }: {
249
+ id: number | string;
250
+ capabilityId: string;
251
+ input: Record<string, unknown>;
252
+ }, _optional?: Record<string, never>): JsonRpcRequest;
223
253
  //# sourceMappingURL=mcp-ui-apps.d.ts.map
@@ -190,7 +190,8 @@ function isJsonRpcErrorObject(value) {
190
190
  * @param value - The raw `event.data`.
191
191
  * @returns True when the value is a well-formed JSON-RPC message.
192
192
  */
193
- export function isJsonRpcMessage(value) {
193
+ export function isJsonRpcMessage(required, _optional = {}) {
194
+ const { value } = required;
194
195
  if (!isRecord(value) || value['jsonrpc'] !== '2.0')
195
196
  return false;
196
197
  if ('id' in value && typeof value['id'] !== 'number' && typeof value['id'] !== 'string')
@@ -212,7 +213,8 @@ export function isJsonRpcMessage(value) {
212
213
  return hasResult || isJsonRpcErrorObject(value['error']);
213
214
  }
214
215
  /** Whether a validated message expects a response (as opposed to being a notification). */
215
- export function isJsonRpcRequest(message) {
216
+ export function isJsonRpcRequest(required, _optional = {}) {
217
+ const { message } = required;
216
218
  return 'id' in message && typeof message.method === 'string';
217
219
  }
218
220
  /**
@@ -223,19 +225,19 @@ export function isJsonRpcRequest(message) {
223
225
  * @param method - Method name.
224
226
  * @param params - Optional parameters.
225
227
  */
226
- export function createJsonRpcRequest(id, method, params) {
228
+ export function createJsonRpcRequest({ id, method }, { params } = {}) {
227
229
  return { jsonrpc: '2.0', id, method, ...(params === undefined ? {} : { params }) };
228
230
  }
229
231
  /** Builds a notification — no `id`, so no response is expected or allowed. */
230
- export function createJsonRpcNotification(method, params) {
232
+ export function createJsonRpcNotification({ method }, { params } = {}) {
231
233
  return { jsonrpc: '2.0', method, ...(params === undefined ? {} : { params }) };
232
234
  }
233
235
  /** Builds a success response for `id`. */
234
- export function createJsonRpcResult(id, result) {
236
+ export function createJsonRpcResult({ id, result }, _optional = {}) {
235
237
  return { jsonrpc: '2.0', id, result };
236
238
  }
237
239
  /** Builds an error response for `id`. */
238
- export function createJsonRpcError(id, code, message, data) {
240
+ export function createJsonRpcError({ id, code, message }, { data } = {}) {
239
241
  return { jsonrpc: '2.0', id, error: { code, message, ...(data === undefined ? {} : { data }) } };
240
242
  }
241
243
  /**
@@ -246,7 +248,7 @@ export function createJsonRpcError(id, code, message, data) {
246
248
  * @param input - Capability arguments.
247
249
  * @returns The namespaced extension request.
248
250
  */
249
- export function createPageActionRequest(id, capabilityId, input) {
250
- return createJsonRpcRequest(id, JINI_PAGE_ACTION_METHOD, { capabilityId, input });
251
+ export function createPageActionRequest({ id, capabilityId, input }, _optional = {}) {
252
+ return createJsonRpcRequest({ id, method: JINI_PAGE_ACTION_METHOD }, { params: { capabilityId, input } });
251
253
  }
252
254
  //# sourceMappingURL=mcp-ui-apps.js.map
@@ -0,0 +1,6 @@
1
+ /** Model-facing defaults. Hosts can replace descriptions in the existing CapabilityDef
2
+ * descriptors before projecting tools; canonical descriptor IDs and policy remain unchanged. */
3
+ export declare const defaultAgenticMessages: {
4
+ pageNavigateDescription: () => string;
5
+ };
6
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1,6 @@
1
+ /** Model-facing defaults. Hosts can replace descriptions in the existing CapabilityDef
2
+ * descriptors before projecting tools; canonical descriptor IDs and policy remain unchanged. */
3
+ export const defaultAgenticMessages = {
4
+ pageNavigateDescription: () => 'Move to another page, named by its data-agent-page id. Only pages the host has published are reachable; arbitrary URLs are refused. Returns which page was showing before and after, and how many controls each publishes — call page.find_elements again afterwards, since every handle you hold may belong to the page you just left.',
5
+ };
6
+ //# sourceMappingURL=messages.js.map
@@ -1,14 +1,3 @@
1
- /**
2
- * @module page-capabilities
3
- *
4
- * What an outside caller may ask a *page* to do: find the tagged controls, point at one, and
5
- * operate it. Every verb addresses an element by its published `data-agent-element` handle —
6
- * never by a caller-supplied selector, and never by evaluating caller-supplied script.
7
- *
8
- * Deliberately small. `click` is unbounded by construction (it carries whatever effect that
9
- * button has), so the surface stays narrow and the page decides what is reachable by choosing
10
- * what to tag. Nothing here scans a whole document: a host names the container to search.
11
- */
12
1
  import type { CapabilityDef } from './capability.js';
13
2
  export declare const PAGE_CAPABILITIES: readonly CapabilityDef[];
14
3
  //# sourceMappingURL=page-capabilities.d.ts.map
@@ -1,3 +1,15 @@
1
+ /**
2
+ * @module page-capabilities
3
+ *
4
+ * What an outside caller may ask a *page* to do: find the tagged controls, point at one, and
5
+ * operate it. Every verb addresses an element by its published `data-agent-element` handle —
6
+ * never by a caller-supplied selector, and never by evaluating caller-supplied script.
7
+ *
8
+ * Deliberately small. `click` is unbounded by construction (it carries whatever effect that
9
+ * button has), so the surface stays narrow and the page decides what is reachable by choosing
10
+ * what to tag. Nothing here scans a whole document: a host names the container to search.
11
+ */
12
+ import { defaultAgenticMessages } from './messages.js';
1
13
  /** Handle argument shared by every element-addressed verb. */
2
14
  const HANDLE_PROPERTY = {
3
15
  handle: {
@@ -113,7 +125,7 @@ export const PAGE_CAPABILITIES = [
113
125
  },
114
126
  {
115
127
  id: 'page.navigate',
116
- description: 'Move to another page of this site, named by its data-agent-page id. Only pages the host has published are reachable; arbitrary URLs are refused. Returns which page was showing before and after, and how many controls each publishes — call page.find_elements again afterwards, since every handle you hold may belong to the page you just left.',
128
+ description: defaultAgenticMessages.pageNavigateDescription(),
117
129
  inputSchema: {
118
130
  type: 'object',
119
131
  properties: {
@@ -51,27 +51,39 @@ export interface PageDriver {
51
51
  * @param filter - Optional role/substring narrowing.
52
52
  * @returns Descriptors. `label` may be raw page text; the executor normalizes it.
53
53
  */
54
- findElements(filter: FindElementsFilter): Promise<readonly AgentElementDescriptor[]>;
54
+ findElements(_required: Record<string, never>, filter?: FindElementsFilter): Promise<readonly AgentElementDescriptor[]>;
55
55
  /**
56
56
  * The pages this host can navigate to.
57
57
  *
58
58
  * An allowlist, so `page.navigate` refuses anything the host has not published rather than
59
59
  * accepting a caller-supplied URL.
60
60
  */
61
- listPages(): Promise<readonly PageSummary[]>;
61
+ listPages(_required: Record<string, never>, _optional?: Record<string, never>): Promise<readonly PageSummary[]>;
62
62
  /**
63
63
  * The attributes of a field, for the fill guard.
64
64
  *
65
65
  * @param handle - A validated element handle.
66
66
  * @returns The field's attributes, or `null` when the handle does not resolve to an input.
67
67
  */
68
- describeField(handle: string): Promise<FieldDescriptor | null>;
68
+ describeField(required: {
69
+ handle: string;
70
+ }, _optional?: Record<string, never>): Promise<FieldDescriptor | null>;
69
71
  /** Draws a transient marker. The executor has already clamped `durationMs`. */
70
- highlight(handle: string, durationMs: number): Promise<void>;
71
- scrollTo(handle: string): Promise<void>;
72
- click(handle: string): Promise<void>;
72
+ highlight(required: {
73
+ handle: string;
74
+ durationMs: number;
75
+ }, _optional?: Record<string, never>): Promise<void>;
76
+ scrollTo(required: {
77
+ handle: string;
78
+ }, _optional?: Record<string, never>): Promise<void>;
79
+ click(required: {
80
+ handle: string;
81
+ }, _optional?: Record<string, never>): Promise<void>;
73
82
  /** Called only after the fill guard has passed. */
74
- fill(handle: string, text: string): Promise<void>;
83
+ fill(required: {
84
+ handle: string;
85
+ text: string;
86
+ }, _optional?: Record<string, never>): Promise<void>;
75
87
  /**
76
88
  * Chooses — or, in a multi-select, removes — an option in a dropdown, matching visible text
77
89
  * before value.
@@ -89,9 +101,16 @@ export interface PageDriver {
89
101
  * @throws When the handle is not a dropdown, when no option matches, or when `selected: false`
90
102
  * is requested on a single-select.
91
103
  */
92
- selectOption(handle: string, option: string, selected?: boolean): Promise<void>;
104
+ selectOption(required: {
105
+ handle: string;
106
+ option: string;
107
+ }, optional?: {
108
+ selected?: boolean | undefined;
109
+ }): Promise<void>;
93
110
  /** Called only after `page` has been checked against {@link PageDriver.listPages}. */
94
- navigate(page: string): Promise<void>;
111
+ navigate(required: {
112
+ page: string;
113
+ }, _optional?: Record<string, never>): Promise<void>;
95
114
  /**
96
115
  * What the element currently is: its live text, a field's contents, checked/disabled/visible.
97
116
  *
@@ -103,7 +122,9 @@ export interface PageDriver {
103
122
  * @returns The raw state, or `null` when the handle no longer resolves — which is itself an
104
123
  * observation (a click that removed its own target), not an error.
105
124
  */
106
- describeState?(handle: string): Promise<AgentElementRawState | null>;
125
+ describeState?(required: {
126
+ handle: string;
127
+ }, _optional?: Record<string, never>): Promise<AgentElementRawState | null>;
107
128
  /**
108
129
  * Resolves once the surface has finished reacting to the write that just happened.
109
130
  *
@@ -115,6 +136,6 @@ export interface PageDriver {
115
136
  * Implementations must be bounded: a hidden tab suspends animation frames indefinitely, so a
116
137
  * naive "wait for the next frame" never resolves for exactly the background agent this is for.
117
138
  */
118
- settle?(): Promise<void>;
139
+ settle?(_required: Record<string, never>, _optional?: Record<string, never>): Promise<void>;
119
140
  }
120
141
  //# sourceMappingURL=page-driver.d.ts.map
@@ -68,7 +68,9 @@ export interface PageWriteObservation {
68
68
  * guard does — a secrecy rule re-derived by each driver is a secrecy rule that will eventually be
69
69
  * derived wrong. A value arriving with no descriptor to check is withheld rather than trusted.
70
70
  */
71
- export declare function projectElementState(raw: AgentElementRawState): AgentElementState;
71
+ export declare function projectElementState({ raw }: {
72
+ raw: AgentElementRawState;
73
+ }, _optional?: Record<string, never>): AgentElementState;
72
74
  /**
73
75
  * What page is showing and how much it publishes, at one moment — the before/after pair
74
76
  * `page.navigate` reports. Not {@link PageSummary} (`page-driver.js`): that names one entry in the
@@ -90,5 +92,9 @@ export interface PageActivitySnapshot {
90
92
  * a field no automated caller may fill, or the page is not published. Refusals are errors on
91
93
  * purpose: a caller must be told why, not handed a silent no-op it will retry forever.
92
94
  */
93
- export declare function executePageCapability(driver: PageDriver, capabilityId: string, input: Record<string, unknown>): Promise<unknown>;
95
+ export declare function executePageCapability({ driver, capabilityId, input }: {
96
+ driver: PageDriver;
97
+ capabilityId: string;
98
+ input: Record<string, unknown>;
99
+ }, _optional?: Record<string, never>): Promise<unknown>;
94
100
  //# sourceMappingURL=page-executor.d.ts.map