@saga-a2ui/react-mcp-stack 0.7.7-rc.1 → 0.9.0-rc.1
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/README.md +1 -1
- package/package.json +1 -1
- package/src/index.ts +6 -0
- package/src/server/index.ts +4 -0
- package/src/server/node/index.ts +5 -0
- package/src/start-a2ui-view.tsx +12 -2
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ The React stack for an MCP Apps view: it connects one React renderer to one deli
|
|
|
6
6
|
- `/faithful-card`: `FaithfulCardApp`, `startFaithfulCardApp`, `CardResultOutcome`, `CardResultReader`, `DeliveredResult` (what the definition's one `result` reader receives), `useHostLink` and `readingProfile`.
|
|
7
7
|
- `/faithful-card.css`: the card's stylesheet.
|
|
8
8
|
- `/content-policy`: `createContentPolicy` and `embedContentPolicy`, for the server that states the policy the card application reads from its document.
|
|
9
|
-
- `/server`: `createServerBudgets`, `registerPublicOperation`, `operationViewFromHtml`, `viewUriForHtml`, `attachRequestLifetime`, and the types `OperationView` and `RequestLifetime`. Node only; no browser entry imports it.
|
|
9
|
+
- `/server`: `createServerBudgets`, `registerPublicOperation`, `registerProtectedOperation`, `operationViewFromHtml`, `viewUriForHtml`, `attachRequestLifetime`, and the types `OperationView` and `RequestLifetime`. Node only; no browser entry imports it.
|
|
10
10
|
|
|
11
11
|
The main entry does not import `@saga-a2ui/components`, so an own-catalog bundle contains neither FaithfulCard nor Markdown. The package still declares the components package, so one install makes the `/faithful-card` and `/content-policy` entries work. React and React DOM are peers, both exactly 19.3.1.
|
|
12
12
|
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@saga-a2ui/react-mcp-stack","private":false,"description":"The React and MCP Apps stack for SAGA A2UI: starts a view for an application's own catalog, and a FaithfulCard application from one validated definition, so an application installs one stack plus React and writes only its own decisions","license":"Apache-2.0","type":"module","sideEffects":["**/*.css"],"exports":{".":"./src/index.ts","./faithful-card":"./src/faithful-card/index.ts","./content-policy":"./src/content-policy/index.ts","./server":"./src/server/index.ts","./faithful-card.css":"./src/faithful-card/faithful-card.css"},"files":["src","!src/**/*.test.ts","!src/**/*.test-support.ts"],"scripts":{"typecheck":"tsc --noEmit"},"dependencies":{"@modelcontextprotocol/ext-apps":"2.0.3","@saga-a2ui/components":"0.
|
|
1
|
+
{"name":"@saga-a2ui/react-mcp-stack","private":false,"description":"The React and MCP Apps stack for SAGA A2UI: starts a view for an application's own catalog, and a FaithfulCard application from one validated definition, so an application installs one stack plus React and writes only its own decisions","license":"Apache-2.0","type":"module","sideEffects":["**/*.css"],"exports":{".":"./src/index.ts","./faithful-card":"./src/faithful-card/index.ts","./content-policy":"./src/content-policy/index.ts","./server":"./src/server/index.ts","./faithful-card.css":"./src/faithful-card/faithful-card.css","./server/node":"./src/server/node/index.ts"},"files":["src","!src/**/*.test.ts","!src/**/*.test-support.ts"],"scripts":{"typecheck":"tsc --noEmit"},"dependencies":{"@modelcontextprotocol/ext-apps":"2.0.3","@saga-a2ui/components":"0.9.0-rc.1","@saga-a2ui/core":"0.9.0-rc.1","@saga-a2ui/mcp":"0.9.0-rc.1","@saga-a2ui/react":"0.9.0-rc.1","zod":"4.6.7"},"peerDependencies":{"react":"19.3.1","react-dom":"19.3.1"},"devDependencies":{"@modelcontextprotocol/client":"2.3.1","@types/node":"22.20.5","@types/react":"19.3.0","@types/react-dom":"19.3.0","jsdom":"28.1.0","react":"19.3.1","react-dom":"19.3.1","typescript":"^5.9.0","vitest":"^5.0.4"},"version":"0.9.0-rc.1","engines":{"node":">=22.12.0"},"repository":{"type":"git","url":"https://github.com/MachineWisdomAI/saga-a2ui.git","directory":"packages/react-mcp-stack"},"publishConfig":{"access":"public","tag":"next"}}
|
package/src/index.ts
CHANGED
|
@@ -21,6 +21,12 @@ export {
|
|
|
21
21
|
type StartMisuse,
|
|
22
22
|
} from './start-failure.js';
|
|
23
23
|
export type { RunningView } from './running-view.js';
|
|
24
|
+
// The conversation a running view hands its actions, and the results of adding a message to it.
|
|
25
|
+
export type {
|
|
26
|
+
AppendResult,
|
|
27
|
+
Conversation,
|
|
28
|
+
RequestOutcome,
|
|
29
|
+
} from '@saga-a2ui/core/conversation';
|
|
24
30
|
// The shapes of the two notifications an application's handlers receive.
|
|
25
31
|
export type { ToolInput, ToolResult } from '@saga-a2ui/mcp/view';
|
|
26
32
|
// How the reader meets the host (device or desktop), for an application that maps its own tokens.
|
package/src/server/index.ts
CHANGED
|
@@ -7,8 +7,12 @@ export {
|
|
|
7
7
|
attachRequestLifetime,
|
|
8
8
|
createServerBudgets,
|
|
9
9
|
operationViewFromHtml,
|
|
10
|
+
registerProtectedOperation,
|
|
10
11
|
registerPublicOperation,
|
|
11
12
|
viewUriForHtml,
|
|
13
|
+
type BudgetSettings,
|
|
14
|
+
type LifetimeCause,
|
|
15
|
+
type OperationOutcome,
|
|
12
16
|
type OperationView,
|
|
13
17
|
type RequestLifetime,
|
|
14
18
|
} from '@saga-a2ui/mcp/server';
|
package/src/start-a2ui-view.tsx
CHANGED
|
@@ -7,8 +7,14 @@ import {
|
|
|
7
7
|
} from '@saga-a2ui/react/a2ui';
|
|
8
8
|
import { ActionsScope, type ReactActions } from '@saga-a2ui/react/actions';
|
|
9
9
|
import type { ServerTransport } from '@saga-a2ui/core/actions';
|
|
10
|
+
import type { Conversation } from '@saga-a2ui/core/conversation';
|
|
10
11
|
import type { SurfaceLayout } from '@saga-a2ui/core/protocols/a2ui/v0_9';
|
|
11
|
-
import
|
|
12
|
+
import {
|
|
13
|
+
conversationFromApp,
|
|
14
|
+
type HostContext,
|
|
15
|
+
type ToolInput,
|
|
16
|
+
type ToolResult,
|
|
17
|
+
} from '@saga-a2ui/mcp/view';
|
|
12
18
|
import { createElement, Fragment, type ReactNode } from 'react';
|
|
13
19
|
import { watchActionSetup } from './action-setup.js';
|
|
14
20
|
import {
|
|
@@ -35,6 +41,8 @@ import type { ErrorPhase } from './start-failure.js';
|
|
|
35
41
|
export interface ViewHost {
|
|
36
42
|
/** The way an action reaches the application’s server, through the host. */
|
|
37
43
|
readonly server: ServerTransport<ServerReply>;
|
|
44
|
+
/** The one way to add a message to the conversation, optionally with context for the assistant. Ends with the view. */
|
|
45
|
+
readonly conversation: Conversation;
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
export interface StartA2uiViewOptions<TData> {
|
|
@@ -133,6 +141,7 @@ export function startA2uiViewOn<TData>(
|
|
|
133
141
|
const opened = surface;
|
|
134
142
|
const connection = connect();
|
|
135
143
|
const { app } = connection;
|
|
144
|
+
const lifetime = new AbortController();
|
|
136
145
|
const { actions: makeActions } = options;
|
|
137
146
|
const actions =
|
|
138
147
|
typeof makeActions === 'function'
|
|
@@ -142,6 +151,7 @@ export function startA2uiViewOn<TData>(
|
|
|
142
151
|
callServerTool: (request, requestOptions) =>
|
|
143
152
|
app.callServerTool(request, requestOptions),
|
|
144
153
|
},
|
|
154
|
+
conversation: conversationFromApp(app, lifetime.signal),
|
|
145
155
|
}),
|
|
146
156
|
)
|
|
147
157
|
: makeActions;
|
|
@@ -171,7 +181,7 @@ export function startA2uiViewOn<TData>(
|
|
|
171
181
|
|
|
172
182
|
const running = runView({
|
|
173
183
|
connection,
|
|
174
|
-
lifetime
|
|
184
|
+
lifetime,
|
|
175
185
|
releaseContainer: claim.release,
|
|
176
186
|
sizing: options.sizing ?? 'host',
|
|
177
187
|
...(readiness === undefined ? {} : { readyWhen: readiness }),
|