@vivix-labs/studio-chat-mcp 0.1.12 → 0.1.14

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/server.js CHANGED
@@ -29429,7 +29429,7 @@ data:
29429
29429
  // package.json
29430
29430
  var package_default = {
29431
29431
  name: "@vivix-labs/studio-chat-mcp",
29432
- version: "0.1.12",
29432
+ version: "0.1.14",
29433
29433
  type: "module",
29434
29434
  engines: {
29435
29435
  node: ">=22.12.0"
@@ -37794,12 +37794,24 @@ var options = {
37794
37794
  requestKey: external_exports.string().min(1).max(200).refine((value) => Boolean(value.trim())).optional(),
37795
37795
  approval: external_exports.string().min(1).optional()
37796
37796
  };
37797
- var chatRunSchema = external_exports.object({ target: targetSchema, input: external_exports.unknown(), ...options }).strict();
37797
+ var jsonObjectInput = external_exports.preprocess(
37798
+ (value) => {
37799
+ if (typeof value !== "string") return value;
37800
+ try {
37801
+ const parsed = JSON.parse(value);
37802
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : value;
37803
+ } catch {
37804
+ return value;
37805
+ }
37806
+ },
37807
+ external_exports.record(external_exports.string(), external_exports.unknown())
37808
+ );
37809
+ var chatRunSchema = external_exports.object({ target: targetSchema, input: jsonObjectInput, ...options }).strict();
37798
37810
  var chatActionSchema = external_exports.object({
37799
37811
  target: targetSchema,
37800
37812
  binding: external_exports.string().min(1).max(65536),
37801
37813
  action: operationId,
37802
- input: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
37814
+ input: jsonObjectInput.optional(),
37803
37815
  ...options
37804
37816
  }).strict();
37805
37817
  var projectionSchema = external_exports.object({
@@ -37824,7 +37836,7 @@ function unavailable() {
37824
37836
  throw inputError(
37825
37837
  "CHAT_UNAVAILABLE",
37826
37838
  "The source operation does not have a ready chat card.",
37827
- "Discover the ready card operation in the selected Host scope."
37839
+ 'Discover interactive cards with list_chat_capabilities first (reusable story, storyboard, character, and media cards live in {"kind":"user","id":"user"} scope). For headless plugin operations without chat cards, use vivix-studio plugin call or the Studio Workbench.'
37828
37840
  );
37829
37841
  }
37830
37842
  function destination(source, value) {
@@ -38382,7 +38394,16 @@ async function listChatCapabilities(host, scope, filter) {
38382
38394
  });
38383
38395
  }
38384
38396
  }
38385
- return { scope, items };
38397
+ const hasCards = items.some(
38398
+ (entry) => entry.kind === "component" || entry.kind === "projectOperation"
38399
+ );
38400
+ return {
38401
+ scope,
38402
+ items,
38403
+ ...!hasCards && scope.kind === "project" && {
38404
+ note: 'No interactive chat cards are registered in this project scope. Reusable cards (story-progress@1, storyboard@1, media-result@1, etc.) live in user scope ({"kind":"user","id":"user"}). Use vivix-studio plugin call or kind="nativeOperation" for headless project operations.'
38405
+ }
38406
+ };
38386
38407
  }
38387
38408
  async function describeChatCapability(host, scope, target2, componentId, kind) {
38388
38409
  const operations = await descriptions(host, scope);
@@ -38496,12 +38517,12 @@ var routing = (value, context) => {
38496
38517
  message: "Use either scope or legacy projectId, not both."
38497
38518
  });
38498
38519
  };
38499
- var runInput = external_exports.object({ ...common, input: external_exports.unknown() }).strict().superRefine(routing);
38520
+ var runInput = external_exports.object({ ...common, input: jsonObjectInput }).strict().superRefine(routing);
38500
38521
  var actionInput = external_exports.object({
38501
38522
  ...common,
38502
38523
  binding: external_exports.string().min(1).max(65536),
38503
38524
  action: identifier,
38504
- input: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
38525
+ input: jsonObjectInput.optional()
38505
38526
  }).strict().superRefine(routing);
38506
38527
  function mapChatResult(result) {
38507
38528
  const { bindings: _bindings, ...structuredContent } = result.structuredContent;
@@ -38526,7 +38547,7 @@ function createChatServer(options2) {
38526
38547
  const server = new McpServer(
38527
38548
  { name: "vivix-studio-chat", version: package_default.version },
38528
38549
  {
38529
- instructions: "Discover capabilities on this same connection with list_chat_capabilities and describe_chat_capability. General interactions default to user scope and do not need a business project. Use an explicit project scope for saved project operations. Read media through query_studio_media and resolve_chat_media. Preserve requestKey and original arguments for recovery; never automatically resubmit an uncertain action."
38550
+ instructions: "Use this server for Vivix Studio interactive cards. When a request involves reviewing, choosing, editing, comparing, previewing, or presenting Studio content, call list_chat_capabilities in user scope first, even when the work belongs to a project. If discovery returns a relevant component, immediately call describe_chat_capability for that route and then run_studio_action with the returned scope and target. A discovery call alone is not a completed card flow. Use project scope separately for project media queries or declared project cards. If a project-scope discovery includes a fallback user-scope card, use the scope and target returned on that card. For existing media or project progress, prefer a matching storyboard, media-result, story-progress, or media-query route when its returned inputs can be filled from the current project state. Use Studio CLI plugin operations for multi-step workflow and generation execution unless invoked via a card action. For a full Studio project, project open --no-open only returns the workbenchUrl. If the Host provides a native browser or side-panel handoff, open that exact URL there. In Codex, use the host open_in_codex handoff with a browser target and right placement when available. Do not use CUA to create or open the workbench tab. run_studio_action renders a chat card and does not open the workbench. A successful tool result confirms that the Host accepted the request, but does not confirm that the client displayed a card or opened a sidebar. Recommend a new conversation only when this conversation has just installed Studio or changed the MCP configuration and the tools are absent from the active and deferred host registries. On a later conversation with the tools still absent, report that the host has not exposed interactive cards and continue with the CLI and Workbench. Do not recommend another conversation after list_chat_capabilities or another card tool has succeeded. Terminal-only hosts should continue with the CLI and Workbench. General interactions default to user scope; saved project operations use explicit project scope. Preserve requestKey and original arguments for recovery; never automatically resubmit an uncertain action."
38530
38551
  }
38531
38552
  );
38532
38553
  server.registerTool(
@@ -38570,7 +38591,8 @@ function createChatServer(options2) {
38570
38591
  code: String(error62.code),
38571
38592
  message: error62.message,
38572
38593
  ..."hint" in error62 ? { hint: error62.hint } : {},
38573
- ..."currentRevision" in error62 ? { currentRevision: error62.currentRevision } : {}
38594
+ ..."currentRevision" in error62 ? { currentRevision: error62.currentRevision } : {},
38595
+ ..."phase" in error62 && error62.phase === "pre_acceptance" ? { phase: error62.phase } : {}
38574
38596
  } : {
38575
38597
  code: "HOST_RESPONSE_INVALID",
38576
38598
  message: "The Studio request could not be completed."
@@ -38616,7 +38638,7 @@ function createChatServer(options2) {
38616
38638
  "list_chat_capabilities",
38617
38639
  {
38618
38640
  title: "Discover chat capabilities",
38619
- description: "Read ready components, project cards and media queries from this connected Host. Set kind=nativeOperation to search paginated operation targets for native card actions, including operations without a chat view. Describe their input schema before binding. Defaults to user scope. This lists capabilities, not saved media.",
38641
+ description: "Read ready components, project cards and media queries from this connected Host. Reusable interactive cards live in user scope; project scope normally exposes media queries unless a project plugin declares custom cards. Set kind=nativeOperation to search paginated operation targets for native card actions (not directly rendered by run_studio_action). Defaults to user scope.",
38620
38642
  inputSchema: external_exports.object({
38621
38643
  scope: scopeSchema.default(userScope),
38622
38644
  kind: external_exports.literal("nativeOperation").optional(),
@@ -38625,14 +38647,35 @@ function createChatServer(options2) {
38625
38647
  limit: external_exports.number().int().min(1).max(100).optional()
38626
38648
  }).strict()
38627
38649
  },
38628
- ({ scope, kind, query, offset, limit }) => readResult("Chat capabilities discovered.", async () => ({
38629
- ...await listChatCapabilities(
38630
- host,
38631
- scope,
38632
- kind ? { kind, query, offset, limit } : void 0
38633
- ),
38634
- resourceDomains: [...options2.resourceDomains ?? defaultResourceDomains]
38635
- }))
38650
+ ({ scope, kind, query, offset, limit }) => readResult(
38651
+ "Chat capabilities discovered. If a returned component matches the current step, call describe_chat_capability next, then run_studio_action.",
38652
+ async () => {
38653
+ const discovered = await listChatCapabilities(
38654
+ host,
38655
+ scope,
38656
+ kind ? { kind, query, offset, limit } : void 0
38657
+ );
38658
+ if (scope.kind === "project" && !kind && !discovered.items.some(
38659
+ (item) => item.kind === "component" || item.kind === "projectOperation"
38660
+ )) {
38661
+ try {
38662
+ const user = await listChatCapabilities(host, userScope);
38663
+ const cards = user.items.filter(
38664
+ (item) => item.kind === "component" || item.kind === "projectOperation"
38665
+ );
38666
+ if (cards.length)
38667
+ return {
38668
+ ...discovered,
38669
+ items: [...discovered.items, ...cards],
38670
+ fallback: { scope: user.scope, itemCount: cards.length },
38671
+ note: "Reusable cards were found in user scope. Use each card item's returned scope and target."
38672
+ };
38673
+ } catch {
38674
+ }
38675
+ }
38676
+ return discovered;
38677
+ }
38678
+ )
38636
38679
  );
38637
38680
  server.registerTool(
38638
38681
  "describe_chat_capability",
@@ -38655,8 +38698,8 @@ function createChatServer(options2) {
38655
38698
  "query_studio_media",
38656
38699
  {
38657
38700
  title: "Read Studio media records",
38658
- description: "Run a discovered, read-only media query on this same Host. Read its input schema first. Use the actual returned fixed refs when selecting historical files; this never invokes a write or generation.",
38659
- inputSchema: external_exports.object({ scope: scopeSchema.default(userScope), target, input: external_exports.unknown() }).strict()
38701
+ description: "Run a discovered, read-only media query on this same Host. Read its input schema first. `input` is a JSON object; a JSON-encoded object string is accepted and normalized. Use the actual returned fixed refs when selecting historical files; this never invokes a write or generation.",
38702
+ inputSchema: external_exports.object({ scope: scopeSchema.default(userScope), target, input: jsonObjectInput }).strict()
38660
38703
  },
38661
38704
  ({ scope, target: selected, input: input2 }) => readResult("Media records read.", () => queryStudioMedia(host, scope, selected, input2))
38662
38705
  );
@@ -38677,7 +38720,7 @@ function createChatServer(options2) {
38677
38720
  "run_studio_action",
38678
38721
  {
38679
38722
  title: "Run Studio action",
38680
- description: "Open a component or declared project card using the scope, target and contract returned by this connection discovery tools. Default interface headings, field labels, group headings and buttons to English unless the user requests another interface language. Preserve story names, story text and user input in their original language. User-scope components work without a business project. Project business operations require the selected project scope. Legacy projectId calls remain supported. Preserve requestKey and original input for uncertain recovery.",
38723
+ description: "Open a component or declared project card using the scope, target and contract returned by this connection discovery tools. `input` is a JSON object; a JSON-encoded object string is accepted and normalized. Default interface headings, field labels, group headings and buttons to English unless the user requests another interface language. Preserve story names, story text and user input in their original language. User-scope components work without a business project. Project business operations require the selected project scope. Legacy projectId calls remain supported. Preserve requestKey and original input for uncertain recovery.",
38681
38724
  inputSchema: runInput,
38682
38725
  _meta: { ui: { resourceUri: chatResourceUri } }
38683
38726
  },
@@ -38687,7 +38730,7 @@ function createChatServer(options2) {
38687
38730
  "studio_card_action",
38688
38731
  {
38689
38732
  title: "Studio card action",
38690
- description: "Call an action declared by the operation that opened this card. Keep its original projectId, source target and Host binding. The adapter resolves the destination. The Host validates input, enforces permissions and confirmation, and preserves the request key. Business parameters belong in input.",
38733
+ description: "Call an action declared by the operation that opened this card. Keep its original projectId, source target and Host binding. The adapter resolves the destination. The Host validates input, enforces permissions and confirmation, and preserves the request key. Business parameters belong in input, which is a JSON object; a JSON-encoded object string is accepted and normalized.",
38691
38734
  inputSchema: actionInput,
38692
38735
  _meta: { ui: { visibility: ["app"] } }
38693
38736
  },
package/dist/setup.js CHANGED
@@ -2,18 +2,8 @@
2
2
  import { execFileSync } from "node:child_process";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { homedir } from "node:os";
5
- import { join, resolve as resolve2 } from "node:path";
6
- import {
7
- lstat,
8
- mkdir,
9
- readFile,
10
- readlink,
11
- realpath,
12
- rename,
13
- rm,
14
- symlink,
15
- writeFile
16
- } from "node:fs/promises";
5
+ import { join } from "node:path";
6
+ import { lstat, mkdir, readFile, realpath, rename, rm, writeFile } from "node:fs/promises";
17
7
  import { setTimeout as delay } from "node:timers/promises";
18
8
 
19
9
  // scripts/codex-config.mjs
@@ -898,7 +888,6 @@ var cliCall = (...args) => {
898
888
  });
899
889
  return reply.data;
900
890
  };
901
- var catalog = (await read(join(scratch, "packages.json"))).data.packages;
902
891
  var user = ["--scope", "user"];
903
892
  var pins = await read(join(scratch, "chat-pins.json"));
904
893
  var packages = {
@@ -984,36 +973,11 @@ if (drama && cliCall("project", "list").projects.some((p) => p.id === drama && p
984
973
  });
985
974
  }
986
975
  }
987
- for (const [id, skill] of [
988
- ["studio-chat", "vivix-studio-chat"],
989
- ["chat-components", "chat-components"],
990
- ["ui-system", "vivix-studio-ui"]
991
- ]) {
992
- const name = packages[id], version = pins[name];
993
- const record = catalog.find((p) => p.package === name && p.version === version);
994
- const packageStore = join(profile, "plugins", encodeURIComponent(name));
995
- const source = join(packageStore, version, record.relativeRoot, "skills", skill);
996
- await readFile(join(source, "SKILL.md"));
997
- for (const directory of [".agents/skills", ".claude/skills"]) {
998
- const parent = join(homedir(), directory), dest = join(parent, skill);
999
- await mkdir(parent, { recursive: true });
1000
- const link = await present(dest);
1001
- if (link) {
1002
- const old2 = link.isSymbolicLink() && resolve2(parent, await readlink(dest));
1003
- if (old2 === source) continue;
1004
- if (!old2 || !old2.startsWith(packageStore + "/") || !old2.endsWith("/skills/" + skill)) {
1005
- console.log("Retained personal Skill: " + dest);
1006
- continue;
1007
- }
1008
- }
1009
- const tmp = dest + "." + randomUUID();
1010
- try {
1011
- await symlink(source, tmp);
1012
- await rename(tmp, dest);
1013
- } finally {
1014
- await rm(tmp, { force: true });
1015
- }
1016
- }
976
+ try {
977
+ cliCall("agent", "setup", "--agent", "both");
978
+ } catch (error) {
979
+ if (error.code !== "AGENT_SKILL_CONFLICT") throw error;
980
+ console.log("Retained personal Agent Skill: " + error.message);
1017
981
  }
1018
982
  var empty = join(scratch, "connection-input.json");
1019
983
  await writeFile(empty, "{}", { mode: 384 });
@@ -1046,7 +1010,7 @@ if (changed) {
1046
1010
  }
1047
1011
  }
1048
1012
  console.log(
1049
- "Studio Chat is configured for new conversations (CLI and Workbench are ready immediately)."
1013
+ "Studio Chat is configured. The current host decides when interactive cards are available. CLI and Workbench are ready now."
1050
1014
  );
1051
1015
  /*! Bundled license information:
1052
1016
 
package/package.json CHANGED
@@ -1,10 +1,16 @@
1
1
  {
2
2
  "name": "@vivix-labs/studio-chat-mcp",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22.12.0"
7
7
  },
8
+ "scripts": {
9
+ "build": "tsx scripts/build-chat-mcp.ts build",
10
+ "package": "tsx scripts/build-chat-mcp.ts package",
11
+ "check": "tsc --noEmit",
12
+ "test": "tsx --test tests/*.test.ts chat-ui/*.test.ts"
13
+ },
8
14
  "devDependencies": {
9
15
  "@modelcontextprotocol/client": "2.4.0",
10
16
  "@modelcontextprotocol/core": "2.4.0",
@@ -40,11 +46,5 @@
40
46
  "access": "public",
41
47
  "registry": "https://registry.npmjs.org/",
42
48
  "tag": "beta"
43
- },
44
- "scripts": {
45
- "build": "tsx scripts/build-chat-mcp.ts build",
46
- "package": "tsx scripts/build-chat-mcp.ts package",
47
- "check": "tsc --noEmit",
48
- "test": "tsx --test tests/*.test.ts chat-ui/*.test.ts"
49
49
  }
50
- }
50
+ }
@@ -18,7 +18,8 @@ names, saved object names, and user input in their original language. A story
18
18
  choice's `label` is content; its group `label` is interface text. For example, use
19
19
  `Choose a story` with `《我们先约会》` and its original Chinese synopsis.
20
20
 
21
- Use this connection's `list_chat_capabilities`, then
21
+ Use this connection's `list_chat_capabilities` (check active session
22
+ capabilities when starting or continuing a Studio project), then
22
23
  `describe_chat_capability` for the selected route and component ID. Reuse the
23
24
  returned `scope`, `target`, schemas and examples. General conversation components
24
25
  default to user scope and do not require creating a business project. The MCP
@@ -56,12 +57,18 @@ before display or playback. It needs no preview ID,
56
57
  import or public URL. A remote MCP Host cannot read a path on the user's computer.
57
58
  This whole-file preview does not provide progressive long-video playback.
58
59
 
59
- If the interactive card tools are not active in the current conversation,
60
- proactively tell the user in natural language (without mentioning internal
61
- protocol/server names or hardcoding a client name) that interactive cards are
62
- not active in this session yet and suggest starting a new conversation to
63
- experience the full interactive features, while continuing via the CLI and
64
- Studio Workbench.
60
+ If the interactive card tools are not active after this conversation has just
61
+ installed Studio or changed the MCP configuration, proactively tell the user
62
+ in natural language (without mentioning internal protocol/server names or
63
+ hardcoding a client name) that interactive cards require starting a new
64
+ conversation, while continuing via the CLI and Studio Workbench. On a later
65
+ conversation, if the tools are still absent, report that the current host has
66
+ not exposed interactive cards and continue via the CLI and Studio Workbench
67
+ without asking for another conversation.
68
+
69
+ When `list_chat_capabilities`, `describe_chat_capability`, or
70
+ `run_studio_action` has succeeded in the current conversation, treat cards as
71
+ active and do not suggest starting a new conversation for this task.
65
72
 
66
73
  If discovery returns no ready matching capability, report that status and retain
67
74
  the draft. For an unmet general presentation need, follow the installed
package/README.md DELETED
@@ -1,120 +0,0 @@
1
- # Studio Chat MCP adapter
2
-
3
- Studio loads this user-scoped server plugin into its Host process. The plugin owns MCP tools, chat declarations, card action routing, projection and the bundled MCP Apps page. Codex connects to the plugin's authenticated Streamable HTTP route.
4
-
5
- ## Install and enable
6
-
7
- The public Studio suite installer installs this Host plugin and its card provider, enables them in user scope, and registers the CLI `stdio` bridge (`vivix-studio agent mcp`) in the agent configuration. Existing server entries and personal Skills are preserved. Start a new conversation to load the interactive cards in that session.
8
-
9
- Use the paired Studio CLI with SDK API 0.2.6, Node.js 22.12+ and pnpm 10.33.0. Build a standard Studio plugin directory from this repository.
10
-
11
- ```sh
12
- pnpm --filter @vivix-labs/studio-chat-mcp package "$PWD/artifacts/studio-chat-host"
13
- vivix-studio plugin install "$PWD/artifacts/studio-chat-host/studio-chat-mcp"
14
- vivix-studio plugin enable @vivix-labs/studio-chat-mcp --scope user --instance studio-chat --trust --allow-access host.operations
15
- ```
16
-
17
- Open a project and enable its business plugins normally. Discover their ready operations with `vivix-studio plugin describe`. Use ordinary `plugin call <adapter-instance> run --scope user --input <file> --json` or the MCP tools to open a card. The adapter also registers an `action` operation for subsequent clicks.
18
-
19
- The package exports its chat protocol types from `@vivix-labs/studio-chat-mcp/shared`. Chat components import these types from the adapter package. The CLI SDK does not export chat types.
20
-
21
- ## Connect an MCP client
22
-
23
- For any MCP client that speaks `stdio` (Codex, Claude Code, Cursor, Antigravity, etc.), configure the CLI's built-in bridge command:
24
-
25
- ```toml
26
- [mcp_servers.vivix-studio-chat]
27
- command = "vivix-studio"
28
- args = ["agent", "mcp"]
29
- ```
30
-
31
- The bridge automatically starts the shared local Host if it is stopped, discovers the active `studio-chat` route credential, and forwards JSON-RPC messages to the Host over loopback HTTP — surviving Host restarts, port changes, and reboots without updating client configuration.
32
-
33
- To inspect the underlying Host endpoint directly (e.g., for testing):
34
-
35
- ```sh
36
- printf '{}\n' > connection-input.json
37
- vivix-studio plugin call studio-chat connection --scope user --input connection-input.json --json
38
- ```
39
-
40
- The plugin requires Studio plugin API 0.2.6. It exposes discovery and media reads on the same connection as `run_studio_action`, the app-only `studio_card_action`, and `ui://studio/chat/v12.html`. Its connection PID equals the Studio Host PID. Disabling the plugin removes the route through the normal plugin lifecycle. The current bundled MCP dependency requires an explicit Host restart for code upgrades when the generic reloader reports `restart_required`.
41
-
42
- ## Discover and read through one connection
43
-
44
- `list_chat_capabilities({})` defaults to `{kind:"user",id:"user"}` and returns ready reusable components, declared chat operations and read-only media queries with their actual `scope` and `target`. Component entries come from the enabled provider's existing `components.list`; the adapter does not keep a second component registry. Generic interactions need a user-scoped component provider and do not create a business project.
45
-
46
- Pass the returned route to `describe_chat_capability({scope,target,componentId?})`. A component description contains its props, result, selected render input and examples, with local schema references intact. For saved project operations, use the selected project's explicit scope. The Host still enforces grants, readiness, bindings and receipts. Legacy `projectId` input remains supported; supplying both it and `scope` is rejected.
47
-
48
- `query_studio_media({scope,target,input})` invokes only a discovered media query with read effects and no confirmation. Read its input schema first. Returned records, task output refs and file selections provide the immutable `ref: {storeId,objectId,versionId}` for `resolve_chat_media({scope,ref,fileId?})`.
49
-
50
- The resolver delegates `{ref,fileId?,access:"https"}` to the existing backend file-access operation. The file service checks the selected bytes, follows a matching saved origin, reuses a usable stored HTTPS URL, or asks the original API provider for a fresh read ticket by its persisted remote ID and original task identity. Ordinary local reads keep their existing behavior. An unmatched local file is an explicit error; resolving never uploads, generates or substitutes another version. The MCP response contains the fixed ref, file ID, MIME type, HTTPS URL and optional expiry, without the Host path.
51
-
52
- Tool `content` is a short readable receipt. `structuredContent` contains model-readable creative data and routing. Signed action bindings, the script digest and prepared messages travel in `_meta` for the App. The page reads the current registered renderer for the original versioned component ID through a read-only MCP resource, then verifies the response's component ID and script digest before mounting. Historical props use the current compatible appearance. The saved digest remains available for legacy clients. The page also accepts legacy replies whose public data contains bindings. A tool return proves neither that a client displayed the card nor that a click delivered a continuation; those require separate UI evidence.
53
-
54
- The adapter's `resourceDomains` configuration declares canonical HTTPS origins for media and other resources. Its default is the Official media CDN, `https://static.vivi-x.ai`. Declare any additional verified source origins explicitly in this adapter's configuration. Discovery returns the active `resourceDomains`; a readable URL alone does not establish that a native host permits the iframe to load it. The component's own `mediaOrigins` further restricts each card. Do not use URL proxies, rehosting or disabled checks to evade a host URL-safety rejection.
55
-
56
- - [Installation-to-card acceptance](acceptance/README.md)
57
- - [Card page and sandbox](chat-ui/README.md)
58
-
59
- ## Discover native action targets
60
-
61
- Search `list_chat_capabilities({scope,kind:"nativeOperation",query,offset,limit})`.
62
- The default limit is 20, the maximum is 100, and nextOffset identifies the next page.
63
- Describe the returned target with kind=nativeOperation to read input/output schemas,
64
- effects, confirm and contract. This includes operations without a chat declaration.
65
- Discovery reads metadata without invoking business operations; default component
66
- discovery does not expand into the whole native catalog.
67
-
68
- An installed source may provide `dynamicActions(context)`. It resolves native
69
- bindings from initial input or authenticated binding context. The adapter admits
70
- those exact same-scope targets through host.operations, signs them with the source
71
- and retains invokeBound recovery. The resolver is installed server code; browser
72
- input never supplies a destination or callback. Static dependency rules are unchanged.
73
-
74
- ## Declare a chat operation
75
-
76
- The App-only `read_local_media` tool reads a supplied absolute image, audio or video `path`
77
- and byte `offset` directly on the local Host. Each response contains at most
78
- 256 KiB in `_meta["studio/media"]`; binary data does not enter public tool output.
79
- Local images support PNG, JPEG and WebP through the same chunk and Blob transport.
80
- The component receives an optional `readMedia` callback through the sandbox bridge,
81
- which accepts only paths declared by the original card projection. Later reads
82
- carry the initial file identity/size/mtime and reject changes. No preview registry,
83
- public media endpoint, import or CLI SDK change is involved. Existing HTTPS media
84
- and action dispatch keep their current routes. Use a matching component package
85
- and adapter; local paths require the Host to share the caller's filesystem.
86
-
87
- A business plugin publishes `extensions: { chat: { component, projectResult, actions } }`
88
- on its operation and registers the component in the manifest's `components` field.
89
- The adapter routes `(action, input)` to the declared destination. Business plugins
90
- own object identity, validation, input mapping, and writes. See the
91
- [component contract](chat-ui/README.md) for Props and Host receipt recovery.
92
-
93
- Card projectors may return optional server-only `bindingContext` JSON. The adapter
94
- puts it inside the existing signed Host operation bindings, strips the top-level
95
- field from the public projection, and supplies the authenticated snapshot as
96
- `ChatActionContext.bindingContext` and `ChatProjectionContext.bindingContext`.
97
- Browser action input never supplies that context. Updated projections can replace
98
- it; unchanged legacy cards omit it and keep context-free bindings. The Host keeps
99
- its existing size limit, scope/caller authentication, generation validation and
100
- receipt-before-preparation replay. Context is signed for integrity, not encrypted;
101
- do not put secrets in it.
102
-
103
- ## Send a follow-up message
104
-
105
- A declared action can provide `prepareMessage(request, context)` instead of a
106
- target. The adapter authenticates the original source binding and passes its
107
- server-owned context to this callback. The callback returns `{intent, data}` with
108
- a nonempty intent and JSON object data. This read-only path invokes no business
109
- operation and creates no business receipt.
110
-
111
- When the client advertises structured model context, the outer MCP App uses
112
- `updateModelContext` for the exact interaction data, then sends the readable
113
- request. Clients with messaging but without structured context receive the
114
- request followed by the complete interaction JSON in the same message.
115
- The sandbox receives the result status without prepared message metadata.
116
-
117
- Unsupported or rejected sends retain the draft. Unknown sends retain their
118
- original request identity and are not automatically resent. The component's
119
- prompt and target actions remain exclusive per button. If a client advertises
120
- structured context but the update fails, the page retains the draft.