holon-ui 0.0.1-dev.31 → 0.0.1-dev.32

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/dist/page.d.ts CHANGED
@@ -44,7 +44,7 @@ export interface ConnectOptions<S extends Record<string, unknown> = {}, O extend
44
44
  /** The app's binding on a web page, in place of the generated one; its endpoint resolves against the page's origin. Ignored in an MCP Apps host. */
45
45
  web?: EndpointBinding;
46
46
  }
47
- type Client = ToolClient<any, any, any, any>;
47
+ type Client = ToolClient<any, any, any, any, any>;
48
48
  /** The tool call that opened a view: typed by its tool, or untyped when the host does not say which tool it was. */
49
49
  export type Opened<C extends Client> = {
50
50
  [K in keyof C["tools"] & string]: C["tools"][K] extends (input: infer I, ...rest: never[]) => Promise<infer O> ? {
@@ -78,8 +78,8 @@ export type Connect<C extends Client> = <S extends Record<string, unknown> = {},
78
78
  }) => Promise<Page<C>>;
79
79
  export interface OwnApp {
80
80
  identity: Identity;
81
- contracts: Record<string, Contract | null>;
82
81
  own: string;
82
+ contract: Contract | null;
83
83
  /** The app's MCP endpoint on the page's origin, such as "/mcp/checkout". */
84
84
  endpoint: string;
85
85
  }
@@ -5,8 +5,8 @@
5
5
  import { App } from "@modelcontextprotocol/ext-apps";
6
6
  import { bindApps, ToolCallError } from "holon-sh/runtime";
7
7
  export { bindApps, ToolCallError };
8
- export const connect = async ({ identity, contracts, own }, { tools = {}, view: { transport, ...options } = {} } = {}) => {
9
- const bind = (session) => bindApps(identity, contracts, { [own]: { session } })[own];
8
+ export const connect = async ({ identity, own, contract }, { tools = {}, view: { transport, ...options } = {} } = {}) => {
9
+ const bind = (session) => bindApps(identity, { [own]: contract }, { [own]: { session } })[own];
10
10
  const app = new App({ name: identity.name, version: identity.version }, {}, options);
11
11
  const session = {
12
12
  callTool: (request, { signal, timeout } = {}) => app.callServerTool(request, { signal, timeout }),
@@ -5,8 +5,8 @@ import { fromJsonSchema, getDisplayName } from "@modelcontextprotocol/client";
5
5
  import { bindApps, ToolCallError } from "holon-sh/runtime";
6
6
  export { bindApps, ToolCallError };
7
7
  /** Bind the page to its own app on the surface its build chose, and offer every tool to whichever agent is present. Most pages call the generated connect from #holon-ui. */
8
- export const connect = async ({ identity, contracts, own, endpoint }, { tools = {}, batch = false, web = { endpoint } } = {}) => {
9
- const client = bindApps(identity, contracts, { [own]: { ...web, endpoint: new URL(web.endpoint, location.origin) } })[own];
8
+ export const connect = async ({ identity, own, contract, endpoint }, { tools = {}, batch = false, web = { endpoint } } = {}) => {
9
+ const client = bindApps(identity, { [own]: contract }, { [own]: { ...web, endpoint: new URL(web.endpoint, location.origin) } })[own];
10
10
  const lifetime = new AbortController();
11
11
  const context = globalThis.document?.modelContext;
12
12
  // Offering tools is secondary to the page working: the page does not wait for it, and a failure is only reported.
@@ -18,7 +18,6 @@ export const connect = async ({ identity, contracts, own, endpoint }, { tools =
18
18
  const offer = async (tool) => await register(tool) && offered.set(tool.name, tool);
19
19
  const offers = Object.entries(tools).map(([name, tool]) => offer(pageTool(name, tool)));
20
20
  const listed = client.listTools({ signal }).then(({ tools: listed }) => {
21
- const contract = contracts[own];
22
21
  const contractedNames = contract && new Set(contract.tools.map(tool => tool.name));
23
22
  for (const tool of listed) {
24
23
  // MCP Apps: a tool whose visibility omits "model" must not reach the agent; absent means ["model", "app"].
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "holon-ui",
3
- "version": "0.0.1-dev.31",
3
+ "version": "0.0.1-dev.32",
4
4
  "description": "Typed MCP clients for browser pages: one connect() for MCP Apps views and WebMCP pages.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@modelcontextprotocol/client": "^2.3.1",
39
- "holon-sh": "^0.0.1-dev.37"
39
+ "holon-sh": "^0.0.1-dev.55"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@modelcontextprotocol/ext-apps": "^2.0.0"