@assistant-ui/react-generative-ui 0.0.23 → 0.1.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.
- package/README.md +2 -0
- package/dist/a2ui.d.ts +1 -4
- package/dist/a2ui.d.ts.map +1 -1
- package/dist/a2ui.js +1 -4
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -10
- package/dist/index.server.d.ts +1 -2
- package/dist/index.server.d.ts.map +1 -1
- package/dist/index.server.js +1 -10
- package/dist/ir.d.ts +1 -111
- package/dist/ir.d.ts.map +1 -1
- package/dist/ir.js +1 -175
- package/dist/slack.d.ts +1 -4
- package/dist/slack.d.ts.map +1 -1
- package/dist/slack.js +1 -4
- package/dist/teams.d.ts +1 -4
- package/dist/teams.d.ts.map +1 -1
- package/dist/teams.js +1 -4
- package/package.json +5 -5
- package/src/a2ui.ts +1 -22
- package/src/index.server.ts +1 -2
- package/src/index.test.ts +75 -0
- package/src/index.ts +1 -2
- package/src/ir.ts +1 -279
- package/src/slack.ts +1 -39
- package/src/teams.ts +1 -35
- package/dist/JSONGenerativeUI.client.d.ts +0 -28
- package/dist/JSONGenerativeUI.client.d.ts.map +0 -1
- package/dist/JSONGenerativeUI.client.js +0 -101
- package/dist/JSONGenerativeUI.client.js.map +0 -1
- package/dist/JSONGenerativeUI.server.d.ts +0 -21
- package/dist/JSONGenerativeUI.server.d.ts.map +0 -1
- package/dist/JSONGenerativeUI.server.js +0 -32
- package/dist/JSONGenerativeUI.server.js.map +0 -1
- package/dist/JSONGenerativeUI.shared.d.ts +0 -63
- package/dist/JSONGenerativeUI.shared.d.ts.map +0 -1
- package/dist/JSONGenerativeUI.shared.js +0 -31
- package/dist/JSONGenerativeUI.shared.js.map +0 -1
- package/dist/RadioGroupScope.d.ts +0 -6
- package/dist/RadioGroupScope.d.ts.map +0 -1
- package/dist/RadioGroupScope.js +0 -25
- package/dist/RadioGroupScope.js.map +0 -1
- package/dist/a2ui/BindingContext.d.ts +0 -11
- package/dist/a2ui/BindingContext.d.ts.map +0 -1
- package/dist/a2ui/BindingContext.js +0 -12
- package/dist/a2ui/BindingContext.js.map +0 -1
- package/dist/a2ui/PresentRenderer.d.ts +0 -11
- package/dist/a2ui/PresentRenderer.d.ts.map +0 -1
- package/dist/a2ui/PresentRenderer.js +0 -39
- package/dist/a2ui/PresentRenderer.js.map +0 -1
- package/dist/a2ui/convert.d.ts +0 -15
- package/dist/a2ui/convert.d.ts.map +0 -1
- package/dist/a2ui/convert.js +0 -728
- package/dist/a2ui/convert.js.map +0 -1
- package/dist/a2ui/dataModel.d.ts +0 -9
- package/dist/a2ui/dataModel.d.ts.map +0 -1
- package/dist/a2ui/dataModel.js +0 -44
- package/dist/a2ui/dataModel.js.map +0 -1
- package/dist/a2ui/reducer.d.ts +0 -8
- package/dist/a2ui/reducer.d.ts.map +0 -1
- package/dist/a2ui/reducer.js +0 -242
- package/dist/a2ui/reducer.js.map +0 -1
- package/dist/a2ui/snapshot.d.ts +0 -3
- package/dist/a2ui/snapshot.d.ts.map +0 -1
- package/dist/a2ui/snapshot.js +0 -33
- package/dist/a2ui/snapshot.js.map +0 -1
- package/dist/a2ui/types.d.ts +0 -88
- package/dist/a2ui/types.d.ts.map +0 -1
- package/dist/a2ui/types.js +0 -6
- package/dist/a2ui/types.js.map +0 -1
- package/dist/a2ui/valueFunctions.d.ts +0 -16
- package/dist/a2ui/valueFunctions.d.ts.map +0 -1
- package/dist/a2ui/valueFunctions.js +0 -332
- package/dist/a2ui/valueFunctions.js.map +0 -1
- package/dist/actionRegistry.d.ts +0 -29
- package/dist/actionRegistry.d.ts.map +0 -1
- package/dist/actionRegistry.js +0 -41
- package/dist/actionRegistry.js.map +0 -1
- package/dist/answeredValues.d.ts +0 -16
- package/dist/answeredValues.d.ts.map +0 -1
- package/dist/answeredValues.js +0 -37
- package/dist/answeredValues.js.map +0 -1
- package/dist/buildPresentParameters.d.ts +0 -21
- package/dist/buildPresentParameters.d.ts.map +0 -1
- package/dist/buildPresentParameters.js +0 -95
- package/dist/buildPresentParameters.js.map +0 -1
- package/dist/constants.d.ts +0 -15
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -19
- package/dist/constants.js.map +0 -1
- package/dist/convert/boundSpec.d.ts +0 -48
- package/dist/convert/boundSpec.d.ts.map +0 -1
- package/dist/convert/boundSpec.js +0 -108
- package/dist/convert/boundSpec.js.map +0 -1
- package/dist/convert/copyBounded.d.ts +0 -25
- package/dist/convert/copyBounded.d.ts.map +0 -1
- package/dist/convert/copyBounded.js +0 -38
- package/dist/convert/copyBounded.js.map +0 -1
- package/dist/convert/isElement.d.ts +0 -3
- package/dist/convert/isElement.d.ts.map +0 -1
- package/dist/convert/isElement.js +0 -6
- package/dist/convert/isElement.js.map +0 -1
- package/dist/convert/takeRun.d.ts +0 -6
- package/dist/convert/takeRun.d.ts.map +0 -1
- package/dist/convert/takeRun.js +0 -20
- package/dist/convert/takeRun.js.map +0 -1
- package/dist/defineGenerativeComponents.d.ts +0 -29
- package/dist/defineGenerativeComponents.d.ts.map +0 -1
- package/dist/defineGenerativeComponents.js +0 -34
- package/dist/defineGenerativeComponents.js.map +0 -1
- package/dist/fieldReferences.d.ts +0 -9
- package/dist/fieldReferences.d.ts.map +0 -1
- package/dist/fieldReferences.js +0 -53
- package/dist/fieldReferences.js.map +0 -1
- package/dist/generativeUIToJSX.d.ts +0 -18
- package/dist/generativeUIToJSX.d.ts.map +0 -1
- package/dist/generativeUIToJSX.js +0 -76
- package/dist/generativeUIToJSX.js.map +0 -1
- package/dist/index.shared.d.ts +0 -15
- package/dist/index.shared.d.ts.map +0 -1
- package/dist/index.shared.js +0 -9
- package/dist/ir.js.map +0 -1
- package/dist/renderGenerativeUI.d.ts +0 -14
- package/dist/renderGenerativeUI.d.ts.map +0 -1
- package/dist/renderGenerativeUI.js +0 -83
- package/dist/renderGenerativeUI.js.map +0 -1
- package/dist/scopeSchema.d.ts +0 -6
- package/dist/scopeSchema.d.ts.map +0 -1
- package/dist/scopeSchema.js +0 -56
- package/dist/scopeSchema.js.map +0 -1
- package/dist/slack/constants.d.ts +0 -93
- package/dist/slack/constants.d.ts.map +0 -1
- package/dist/slack/constants.js +0 -146
- package/dist/slack/constants.js.map +0 -1
- package/dist/slack/decodeBlockAction.d.ts +0 -10
- package/dist/slack/decodeBlockAction.d.ts.map +0 -1
- package/dist/slack/decodeBlockAction.js +0 -129
- package/dist/slack/decodeBlockAction.js.map +0 -1
- package/dist/slack/fromSlackBlocks.d.ts +0 -27
- package/dist/slack/fromSlackBlocks.d.ts.map +0 -1
- package/dist/slack/fromSlackBlocks.js +0 -483
- package/dist/slack/fromSlackBlocks.js.map +0 -1
- package/dist/slack/toSlackBlocks.d.ts +0 -4
- package/dist/slack/toSlackBlocks.d.ts.map +0 -1
- package/dist/slack/toSlackBlocks.js +0 -901
- package/dist/slack/toSlackBlocks.js.map +0 -1
- package/dist/slack/types.d.ts +0 -204
- package/dist/slack/types.d.ts.map +0 -1
- package/dist/slack/types.js +0 -0
- package/dist/teams/constants.d.ts +0 -34
- package/dist/teams/constants.d.ts.map +0 -1
- package/dist/teams/constants.js +0 -68
- package/dist/teams/constants.js.map +0 -1
- package/dist/teams/decodeSubmitData.d.ts +0 -26
- package/dist/teams/decodeSubmitData.d.ts.map +0 -1
- package/dist/teams/decodeSubmitData.js +0 -70
- package/dist/teams/decodeSubmitData.js.map +0 -1
- package/dist/teams/temporalId.d.ts +0 -5
- package/dist/teams/temporalId.d.ts.map +0 -1
- package/dist/teams/temporalId.js +0 -28
- package/dist/teams/temporalId.js.map +0 -1
- package/dist/teams/toAdaptiveCard.d.ts +0 -45
- package/dist/teams/toAdaptiveCard.d.ts.map +0 -1
- package/dist/teams/toAdaptiveCard.js +0 -642
- package/dist/teams/toAdaptiveCard.js.map +0 -1
- package/dist/teams/toTeamsAttachments.d.ts +0 -10
- package/dist/teams/toTeamsAttachments.d.ts.map +0 -1
- package/dist/teams/toTeamsAttachments.js +0 -99
- package/dist/teams/toTeamsAttachments.js.map +0 -1
- package/dist/teams/types.d.ts +0 -224
- package/dist/teams/types.d.ts.map +0 -1
- package/dist/teams/types.js +0 -0
- package/dist/temporal.d.ts +0 -33
- package/dist/temporal.d.ts.map +0 -1
- package/dist/temporal.js +0 -152
- package/dist/temporal.js.map +0 -1
- package/dist/types.d.ts +0 -99
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -0
- package/dist/vocabulary/alert.d.ts +0 -32
- package/dist/vocabulary/alert.d.ts.map +0 -1
- package/dist/vocabulary/alert.js +0 -160
- package/dist/vocabulary/alert.js.map +0 -1
- package/dist/vocabulary/collectFormValues.d.ts +0 -23
- package/dist/vocabulary/collectFormValues.d.ts.map +0 -1
- package/dist/vocabulary/collectFormValues.js +0 -44
- package/dist/vocabulary/collectFormValues.js.map +0 -1
- package/dist/vocabulary/data.d.ts +0 -66
- package/dist/vocabulary/data.d.ts.map +0 -1
- package/dist/vocabulary/data.js +0 -503
- package/dist/vocabulary/data.js.map +0 -1
- package/dist/vocabulary/dispatch.d.ts +0 -9
- package/dist/vocabulary/dispatch.d.ts.map +0 -1
- package/dist/vocabulary/dispatch.js +0 -50
- package/dist/vocabulary/dispatch.js.map +0 -1
- package/dist/vocabulary/fact.d.ts +0 -19
- package/dist/vocabulary/fact.d.ts.map +0 -1
- package/dist/vocabulary/fact.js +0 -51
- package/dist/vocabulary/fact.js.map +0 -1
- package/dist/vocabulary/form.d.ts +0 -11
- package/dist/vocabulary/form.d.ts.map +0 -1
- package/dist/vocabulary/form.js +0 -23
- package/dist/vocabulary/form.js.map +0 -1
- package/dist/vocabulary/formatValue.d.ts +0 -7
- package/dist/vocabulary/formatValue.d.ts.map +0 -1
- package/dist/vocabulary/formatValue.js +0 -76
- package/dist/vocabulary/formatValue.js.map +0 -1
- package/dist/vocabulary/icon.d.ts +0 -41
- package/dist/vocabulary/icon.d.ts.map +0 -1
- package/dist/vocabulary/icon.js +0 -272
- package/dist/vocabulary/icon.js.map +0 -1
- package/dist/vocabulary/index.d.ts +0 -12
- package/dist/vocabulary/index.d.ts.map +0 -1
- package/dist/vocabulary/index.js +0 -36
- package/dist/vocabulary/index.js.map +0 -1
- package/dist/vocabulary/interactive.d.ts +0 -230
- package/dist/vocabulary/interactive.d.ts.map +0 -1
- package/dist/vocabulary/interactive.js +0 -530
- package/dist/vocabulary/interactive.js.map +0 -1
- package/dist/vocabulary/layout.d.ts +0 -79
- package/dist/vocabulary/layout.d.ts.map +0 -1
- package/dist/vocabulary/layout.js +0 -139
- package/dist/vocabulary/layout.js.map +0 -1
- package/dist/vocabulary/list.d.ts +0 -14
- package/dist/vocabulary/list.d.ts.map +0 -1
- package/dist/vocabulary/list.js +0 -50
- package/dist/vocabulary/list.js.map +0 -1
- package/dist/vocabulary/media.d.ts +0 -25
- package/dist/vocabulary/media.d.ts.map +0 -1
- package/dist/vocabulary/media.js +0 -42
- package/dist/vocabulary/media.js.map +0 -1
- package/dist/vocabulary/text.d.ts +0 -57
- package/dist/vocabulary/text.d.ts.map +0 -1
- package/dist/vocabulary/text.js +0 -49
- package/dist/vocabulary/text.js.map +0 -1
- package/dist/vocabulary/toTextContent.d.ts +0 -2
- package/dist/vocabulary/toTextContent.d.ts.map +0 -1
- package/dist/vocabulary/toTextContent.js +0 -6
- package/dist/vocabulary/toTextContent.js.map +0 -1
- package/src/JSONGenerativeUI.client.tsx +0 -168
- package/src/JSONGenerativeUI.server.tsx +0 -39
- package/src/JSONGenerativeUI.shared.ts +0 -90
- package/src/JSONGenerativeUI.test.tsx +0 -1298
- package/src/RadioGroupScope.server.test.tsx +0 -24
- package/src/RadioGroupScope.tsx +0 -34
- package/src/a2ui/BindingContext.ts +0 -26
- package/src/a2ui/PresentRenderer.tsx +0 -83
- package/src/a2ui/convert.test.ts +0 -2923
- package/src/a2ui/convert.ts +0 -1207
- package/src/a2ui/dataModel.ts +0 -69
- package/src/a2ui/reducer.test.ts +0 -422
- package/src/a2ui/reducer.ts +0 -363
- package/src/a2ui/snapshot.test.ts +0 -52
- package/src/a2ui/snapshot.ts +0 -52
- package/src/a2ui/types.ts +0 -114
- package/src/a2ui/valueFunctions.test.ts +0 -271
- package/src/a2ui/valueFunctions.ts +0 -523
- package/src/actionRegistry.test.ts +0 -90
- package/src/actionRegistry.ts +0 -88
- package/src/answeredValues.test.ts +0 -33
- package/src/answeredValues.tsx +0 -70
- package/src/buildPresentParameters.test.ts +0 -246
- package/src/buildPresentParameters.ts +0 -130
- package/src/constants.ts +0 -17
- package/src/convert/boundSpec.test.ts +0 -192
- package/src/convert/boundSpec.ts +0 -134
- package/src/convert/copyBounded.test.ts +0 -131
- package/src/convert/copyBounded.ts +0 -38
- package/src/convert/isElement.ts +0 -6
- package/src/convert/takeRun.test.ts +0 -64
- package/src/convert/takeRun.ts +0 -19
- package/src/defineGenerativeComponents.ts +0 -38
- package/src/fieldReferences.test.ts +0 -66
- package/src/fieldReferences.ts +0 -83
- package/src/generativeUIToJSX.test.ts +0 -268
- package/src/generativeUIToJSX.ts +0 -152
- package/src/index.server.test.ts +0 -106
- package/src/index.shared.ts +0 -61
- package/src/ir.test.ts +0 -203
- package/src/renderGenerativeUI.test.tsx +0 -373
- package/src/renderGenerativeUI.tsx +0 -165
- package/src/scopeSchema.test.ts +0 -72
- package/src/scopeSchema.ts +0 -71
- package/src/slack/a2uiSlack.test.ts +0 -198
- package/src/slack/constants.ts +0 -194
- package/src/slack/datePicker.test.ts +0 -612
- package/src/slack/decodeBlockAction.test.ts +0 -233
- package/src/slack/decodeBlockAction.ts +0 -232
- package/src/slack/fromSlackBlocks.test.ts +0 -1465
- package/src/slack/fromSlackBlocks.ts +0 -789
- package/src/slack/toSlackBlocks.test.ts +0 -3065
- package/src/slack/toSlackBlocks.ts +0 -1818
- package/src/slack/types.ts +0 -264
- package/src/teams/constants.ts +0 -93
- package/src/teams/decodeSubmitData.test.ts +0 -397
- package/src/teams/decodeSubmitData.ts +0 -110
- package/src/teams/temporal.test.ts +0 -766
- package/src/teams/temporalId.ts +0 -56
- package/src/teams/toAdaptiveCard.test.ts +0 -1897
- package/src/teams/toAdaptiveCard.ts +0 -1057
- package/src/teams/toTeamsAttachments.test.ts +0 -74
- package/src/teams/toTeamsAttachments.ts +0 -133
- package/src/teams/types.ts +0 -266
- package/src/temporal.test.ts +0 -319
- package/src/temporal.ts +0 -259
- package/src/types.ts +0 -119
- package/src/vocabulary/alert.test.tsx +0 -427
- package/src/vocabulary/alert.tsx +0 -217
- package/src/vocabulary/collectFormValues.test.ts +0 -389
- package/src/vocabulary/collectFormValues.ts +0 -116
- package/src/vocabulary/data.test.tsx +0 -858
- package/src/vocabulary/data.tsx +0 -819
- package/src/vocabulary/datepicker.dom.test.tsx +0 -1148
- package/src/vocabulary/dispatch.ts +0 -83
- package/src/vocabulary/fact.test.tsx +0 -94
- package/src/vocabulary/fact.tsx +0 -54
- package/src/vocabulary/form.test.tsx +0 -113
- package/src/vocabulary/form.tsx +0 -39
- package/src/vocabulary/formatValue.test.ts +0 -72
- package/src/vocabulary/formatValue.ts +0 -127
- package/src/vocabulary/icon.test.tsx +0 -64
- package/src/vocabulary/icon.tsx +0 -174
- package/src/vocabulary/index.test.ts +0 -65
- package/src/vocabulary/index.ts +0 -33
- package/src/vocabulary/interactive.dispatch.test.tsx +0 -454
- package/src/vocabulary/interactive.dom.test.tsx +0 -1747
- package/src/vocabulary/interactive.test.tsx +0 -377
- package/src/vocabulary/interactive.tsx +0 -1048
- package/src/vocabulary/layout.test.tsx +0 -323
- package/src/vocabulary/layout.tsx +0 -247
- package/src/vocabulary/list.test.tsx +0 -222
- package/src/vocabulary/list.tsx +0 -50
- package/src/vocabulary/media.test.tsx +0 -85
- package/src/vocabulary/media.tsx +0 -56
- package/src/vocabulary/text.test.tsx +0 -102
- package/src/vocabulary/text.tsx +0 -60
- package/src/vocabulary/toTextContent.ts +0 -2
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
//#region src/JSONGenerativeUI.shared.ts
|
|
2
|
-
const PRESENT_DESCRIPTION = "Present a UI component to the user. Select a component with `$type` and provide its props inline; nest components with `children`.";
|
|
3
|
-
const PROMPT_USER_DESCRIPTION = "Present a UI component to the user and wait for their response. Select a component with `$type` and provide its props inline; nest components with `children`. The user interacts with it and the result is returned to you.";
|
|
4
|
-
/**
|
|
5
|
-
* The schema-only half of the `present` tool, shared by both builds. The server
|
|
6
|
-
* build returns exactly this; the client build adds `execute` and `render`.
|
|
7
|
-
* Takes the already-built `parameters` so it isn't recomputed per tool.
|
|
8
|
-
*/
|
|
9
|
-
function presentToolBase(parameters, options) {
|
|
10
|
-
return {
|
|
11
|
-
type: "frontend",
|
|
12
|
-
description: PRESENT_DESCRIPTION,
|
|
13
|
-
parameters,
|
|
14
|
-
...options?.display !== void 0 ? { display: options.display } : {}
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* The schema-only half of the `prompt_user` tool, shared by both builds. The
|
|
19
|
-
* server build returns exactly this; the client build adds `render`.
|
|
20
|
-
*/
|
|
21
|
-
function promptUserToolBase(parameters) {
|
|
22
|
-
return {
|
|
23
|
-
type: "human",
|
|
24
|
-
description: PROMPT_USER_DESCRIPTION,
|
|
25
|
-
parameters
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
//#endregion
|
|
29
|
-
export { presentToolBase, promptUserToolBase };
|
|
30
|
-
|
|
31
|
-
//# sourceMappingURL=JSONGenerativeUI.shared.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JSONGenerativeUI.shared.js","names":[],"sources":["../src/JSONGenerativeUI.shared.ts"],"sourcesContent":["import type { ToolDefinition } from \"@assistant-ui/react\";\nimport type { JSONSchema7 } from \"json-schema\";\nimport type { ActionRegistry } from \"./actionRegistry\";\nimport type { GenerativeUILibrary } from \"./types\";\n\n/** Options for {@link JSONGenerativeUI}. */\nexport type JSONGenerativeUIOptions = {\n /**\n * The components the model is allowed to render, keyed by the `$type` it\n * selects them with. Author it with `defineGenerativeComponents({ ... })` so a\n * `\"use generative\"` build can split each `render` from its `properties`.\n */\n library: GenerativeUILibrary;\n /**\n * Host-provided map from `$action.type` to its handler. Interactive\n * components (`Button`/`Select`/`Input`/`DatePicker`) call `$dispatch($action)`\n * on their event, which resolves through this registry. Omit it for a\n * read-only render where model-emitted actions degrade to a no-op.\n */\n actions?: ActionRegistry;\n};\n\n/** Options for {@link JSONGenerativeUI.present}. */\nexport type PresentToolOptions = {\n /**\n * Set `\"standalone\"` to render the component on its own surface (outside the\n * chain-of-thought trace), e.g. a full-bleed artifact like a card. Omit it for\n * the default inline rendering — there is no `\"inline\"` value because that is\n * already the default.\n */\n display?: \"standalone\";\n};\n\ntype BackendDefaultMetadata = {\n unstable_backendDefault?: {\n parameters?: boolean;\n };\n};\n\n/** The `present` tool, as the model sees it (no client `render`/`execute`). */\nexport type PresentTool = ToolDefinition<\n Record<string, unknown>,\n Record<string, never>\n> &\n BackendDefaultMetadata;\n\n/** The `prompt_user` tool, as the model sees it (no client `render`). */\nexport type PromptUserTool = ToolDefinition<Record<string, unknown>, unknown> &\n BackendDefaultMetadata;\n\nconst PRESENT_DESCRIPTION =\n \"Present a UI component to the user. Select a component with `$type` and \" +\n \"provide its props inline; nest components with `children`.\";\n\nconst PROMPT_USER_DESCRIPTION =\n \"Present a UI component to the user and wait for their response. Select a \" +\n \"component with `$type` and provide its props inline; nest components with \" +\n \"`children`. The user interacts with it and the result is returned to you.\";\n\n/** The tool `parameters` schema, built once per instance (see `buildPresentParameters`). */\nexport type PresentParameters = JSONSchema7;\n\n/**\n * The schema-only half of the `present` tool, shared by both builds. The server\n * build returns exactly this; the client build adds `execute` and `render`.\n * Takes the already-built `parameters` so it isn't recomputed per tool.\n */\nexport function presentToolBase(\n parameters: PresentParameters,\n options?: PresentToolOptions,\n) {\n return {\n type: \"frontend\" as const,\n description: PRESENT_DESCRIPTION,\n parameters,\n ...(options?.display !== undefined ? { display: options.display } : {}),\n };\n}\n\n/**\n * The schema-only half of the `prompt_user` tool, shared by both builds. The\n * server build returns exactly this; the client build adds `render`.\n */\nexport function promptUserToolBase(parameters: PresentParameters) {\n return {\n type: \"human\" as const,\n description: PROMPT_USER_DESCRIPTION,\n parameters,\n };\n}\n"],"mappings":";AAkDA,MAAM,sBACJ;AAGF,MAAM,0BACJ;;;;;;AAYF,SAAgB,gBACd,YACA,SACA;CACA,OAAO;EACL,MAAM;EACN,aAAa;EACb;EACA,GAAI,SAAS,YAAY,KAAA,IAAY,EAAE,SAAS,QAAQ,QAAQ,IAAI,CAAC;CACvE;AACF;;;;;AAMA,SAAgB,mBAAmB,YAA+B;CAChE,OAAO;EACL,MAAM;EACN,aAAa;EACb;CACF;AACF"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
export declare const RadioGroupScope: ({ children, }: {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
}) => string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
|
|
5
|
-
export declare const useRadioGroupName: (name: string | undefined) => string;
|
|
6
|
-
//# sourceMappingURL=RadioGroupScope.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroupScope.d.ts","sourceRoot":"","sources":["../src/RadioGroupScope.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,eAAO,MAAM,eAAe,GAAI,eAE7B;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,oSAQA,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,GAAG,SAAS,WAMzD,CAAC"}
|
package/dist/RadioGroupScope.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
//#region src/RadioGroupScope.tsx
|
|
4
|
-
let radioGroupContext;
|
|
5
|
-
const supportsContext = typeof React.createContext === "function";
|
|
6
|
-
const useScopeId = supportsContext ? React.useId : () => void 0;
|
|
7
|
-
const useScopeContext = supportsContext ? React.useContext : () => void 0;
|
|
8
|
-
const getRadioGroupContext = () => supportsContext ? radioGroupContext ??= React.createContext(void 0) : void 0;
|
|
9
|
-
const RadioGroupScope = ({ children }) => {
|
|
10
|
-
const scopeId = useScopeId();
|
|
11
|
-
const Context = getRadioGroupContext();
|
|
12
|
-
return Context ? /* @__PURE__ */ jsx(Context.Provider, {
|
|
13
|
-
value: scopeId,
|
|
14
|
-
children
|
|
15
|
-
}) : children;
|
|
16
|
-
};
|
|
17
|
-
const useRadioGroupName = (name) => {
|
|
18
|
-
const scopeId = useScopeContext(getRadioGroupContext());
|
|
19
|
-
const groupId = React.useId();
|
|
20
|
-
return scopeId !== void 0 && name != null ? JSON.stringify([scopeId, name]) : name ?? groupId;
|
|
21
|
-
};
|
|
22
|
-
//#endregion
|
|
23
|
-
export { RadioGroupScope, useRadioGroupName };
|
|
24
|
-
|
|
25
|
-
//# sourceMappingURL=RadioGroupScope.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroupScope.js","names":[],"sources":["../src/RadioGroupScope.tsx"],"sourcesContent":["import * as React from \"react\";\n\nlet radioGroupContext: React.Context<string | undefined> | undefined;\nconst supportsContext = typeof React.createContext === \"function\";\nconst useScopeId = supportsContext ? React.useId : () => undefined;\nconst useScopeContext = supportsContext ? React.useContext : () => undefined;\n\n// Vocabulary schemas are also imported under React's server condition.\nconst getRadioGroupContext = () =>\n supportsContext\n ? (radioGroupContext ??= React.createContext<string | undefined>(undefined))\n : undefined;\n\nexport const RadioGroupScope = ({\n children,\n}: {\n children: React.ReactNode;\n}) => {\n const scopeId = useScopeId();\n const Context = getRadioGroupContext();\n return Context ? (\n <Context.Provider value={scopeId}>{children}</Context.Provider>\n ) : (\n children\n );\n};\n\nexport const useRadioGroupName = (name: string | undefined) => {\n const scopeId = useScopeContext(getRadioGroupContext()!);\n const groupId = React.useId();\n return scopeId !== undefined && name != null\n ? JSON.stringify([scopeId, name])\n : (name ?? groupId);\n};\n"],"mappings":";;;AAEA,IAAI;AACJ,MAAM,kBAAkB,OAAO,MAAM,kBAAkB;AACvD,MAAM,aAAa,kBAAkB,MAAM,cAAc,KAAA;AACzD,MAAM,kBAAkB,kBAAkB,MAAM,mBAAmB,KAAA;AAGnE,MAAM,6BACJ,kBACK,sBAAsB,MAAM,cAAkC,KAAA,CAAS,IACxE,KAAA;AAEN,MAAa,mBAAmB,EAC9B,eAGI;CACJ,MAAM,UAAU,WAAW;CAC3B,MAAM,UAAU,qBAAqB;CACrC,OAAO,UACL,oBAAC,QAAQ,UAAT;EAAkB,OAAO;EAAU;CAA2B,CAAA,IAE9D;AAEJ;AAEA,MAAa,qBAAqB,SAA6B;CAC7D,MAAM,UAAU,gBAAgB,qBAAqB,CAAE;CACvD,MAAM,UAAU,MAAM,MAAM;CAC5B,OAAO,YAAY,KAAA,KAAa,QAAQ,OACpC,KAAK,UAAU,CAAC,SAAS,IAAI,CAAC,IAC7B,QAAQ;AACf"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
export type A2uiBinding = {
|
|
3
|
-
readonly value: unknown;
|
|
4
|
-
readonly arrayValue: boolean;
|
|
5
|
-
};
|
|
6
|
-
export declare const A2uiBindingContext: React.Context<{
|
|
7
|
-
readonly fields: ReadonlyMap<string, A2uiBinding>;
|
|
8
|
-
readonly update: (path: string, value: unknown) => void;
|
|
9
|
-
} | undefined> | undefined;
|
|
10
|
-
export declare const useA2uiBinding: (name: string | undefined) => ((value: unknown) => void) | undefined;
|
|
11
|
-
//# sourceMappingURL=BindingContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BindingContext.d.ts","sourceRoot":"","sources":["../../src/a2ui/BindingContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,kBAAkB;qBAIF,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC;qBAChC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI;0BAIpD,CAAC;AAEhB,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,GAAG,SAAS,cAIzC,OAAO,sBAGpB,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
//#region src/a2ui/BindingContext.ts
|
|
3
|
-
const A2uiBindingContext = typeof React.createContext === "function" ? React.createContext(void 0) : void 0;
|
|
4
|
-
const useA2uiBinding = (name) => {
|
|
5
|
-
const context = React.useContext(A2uiBindingContext);
|
|
6
|
-
const binding = name === void 0 ? void 0 : context?.fields.get(name);
|
|
7
|
-
return context && binding && name !== void 0 ? (value) => context.update(name, binding.arrayValue ? [value] : value) : void 0;
|
|
8
|
-
};
|
|
9
|
-
//#endregion
|
|
10
|
-
export { A2uiBindingContext, useA2uiBinding };
|
|
11
|
-
|
|
12
|
-
//# sourceMappingURL=BindingContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BindingContext.js","names":[],"sources":["../../src/a2ui/BindingContext.ts"],"sourcesContent":["import * as React from \"react\";\n\nexport type A2uiBinding = {\n readonly value: unknown;\n readonly arrayValue: boolean;\n};\n\nexport const A2uiBindingContext =\n typeof React.createContext === \"function\"\n ? React.createContext<\n | {\n readonly fields: ReadonlyMap<string, A2uiBinding>;\n readonly update: (path: string, value: unknown) => void;\n }\n | undefined\n >(undefined)\n : undefined;\n\nexport const useA2uiBinding = (name: string | undefined) => {\n const context = React.useContext(A2uiBindingContext!);\n const binding = name === undefined ? undefined : context?.fields.get(name);\n return context && binding && name !== undefined\n ? (value: unknown) =>\n context.update(name, binding.arrayValue ? [value] : value)\n : undefined;\n};\n"],"mappings":";;AAOA,MAAa,qBACX,OAAO,MAAM,kBAAkB,aAC3B,MAAM,cAMJ,KAAA,CAAS,IACX,KAAA;AAEN,MAAa,kBAAkB,SAA6B;CAC1D,MAAM,UAAU,MAAM,WAAW,kBAAmB;CACpD,MAAM,UAAU,SAAS,KAAA,IAAY,KAAA,IAAY,SAAS,OAAO,IAAI,IAAI;CACzE,OAAO,WAAW,WAAW,SAAS,KAAA,KACjC,UACC,QAAQ,OAAO,MAAM,QAAQ,aAAa,CAAC,KAAK,IAAI,KAAK,IAC3D,KAAA;AACN"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import type { GenerativeUIDispatch, GenerativeUILibrary, GenerativeUIStatus } from "../types.js";
|
|
3
|
-
export declare function A2uiPresentRenderer({ surfaceId, operations, fallback, library, status, dispatch, }: {
|
|
4
|
-
surfaceId: string;
|
|
5
|
-
operations: unknown;
|
|
6
|
-
fallback: unknown;
|
|
7
|
-
library: GenerativeUILibrary;
|
|
8
|
-
status: GenerativeUIStatus;
|
|
9
|
-
dispatch?: GenerativeUIDispatch;
|
|
10
|
-
}): React.JSX.Element;
|
|
11
|
-
//# sourceMappingURL=PresentRenderer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PresentRenderer.d.ts","sourceRoot":"","sources":["../../src/a2ui/PresentRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EACnB,oBAAiB;AAMlB,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,UAAU,EACV,QAAQ,EACR,OAAO,EACP,MAAM,EACN,QAAQ,GACT,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CACjC,qBAwDA"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { renderGenerativeUI } from "../renderGenerativeUI.js";
|
|
2
|
-
import { A2uiBindingContext } from "./BindingContext.js";
|
|
3
|
-
import { applyA2uiOperations, setAtPointer } from "./reducer.js";
|
|
4
|
-
import { equalData, reconcileDataModel, resolvePointer } from "./dataModel.js";
|
|
5
|
-
import { createLiveSurfaceConverter } from "./convert.js";
|
|
6
|
-
import * as React from "react";
|
|
7
|
-
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
//#region src/a2ui/PresentRenderer.tsx
|
|
9
|
-
function A2uiPresentRenderer({ surfaceId, operations, fallback, library, status, dispatch }) {
|
|
10
|
-
const surface = React.useMemo(() => applyA2uiOperations(/* @__PURE__ */ new Map(), operations).state.get(surfaceId), [operations, surfaceId]);
|
|
11
|
-
const incoming = surface?.dataModel;
|
|
12
|
-
const [local, setLocal] = React.useState(() => ({
|
|
13
|
-
incoming,
|
|
14
|
-
value: incoming,
|
|
15
|
-
editedPaths: /* @__PURE__ */ new Set()
|
|
16
|
-
}));
|
|
17
|
-
const model = Object.is(incoming, local.incoming) ? local : reconcileDataModel(local.incoming, incoming, local.value, local.editedPaths);
|
|
18
|
-
if (model !== local) setLocal(model);
|
|
19
|
-
const convert = React.useMemo(() => surface && createLiveSurfaceConverter(surface), [surface]);
|
|
20
|
-
const converted = React.useMemo(() => convert?.(model.value), [convert, model.value]);
|
|
21
|
-
return /* @__PURE__ */ jsx(A2uiBindingContext.Provider, {
|
|
22
|
-
value: converted ? {
|
|
23
|
-
fields: converted.bindings,
|
|
24
|
-
update: (path, value) => setLocal((current) => equalData(resolvePointer(current.value, path), value) ? current : {
|
|
25
|
-
...current,
|
|
26
|
-
value: setAtPointer(current.value, path, value, false).value,
|
|
27
|
-
editedPaths: /* @__PURE__ */ new Set([...current.editedPaths, path])
|
|
28
|
-
})
|
|
29
|
-
} : void 0,
|
|
30
|
-
children: renderGenerativeUI(converted?.spec ?? fallback, library, {
|
|
31
|
-
status,
|
|
32
|
-
...dispatch ? { dispatch } : {}
|
|
33
|
-
})
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
//#endregion
|
|
37
|
-
export { A2uiPresentRenderer };
|
|
38
|
-
|
|
39
|
-
//# sourceMappingURL=PresentRenderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PresentRenderer.js","names":["BindingContext"],"sources":["../../src/a2ui/PresentRenderer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { renderGenerativeUI } from \"../renderGenerativeUI\";\nimport type {\n GenerativeUIDispatch,\n GenerativeUILibrary,\n GenerativeUIStatus,\n} from \"../types\";\nimport { A2uiBindingContext } from \"./BindingContext\";\nimport { equalData, reconcileDataModel, resolvePointer } from \"./dataModel\";\nimport { applyA2uiOperations, setAtPointer } from \"./reducer\";\nimport { createLiveSurfaceConverter } from \"./convert\";\n\nexport function A2uiPresentRenderer({\n surfaceId,\n operations,\n fallback,\n library,\n status,\n dispatch,\n}: {\n surfaceId: string;\n operations: unknown;\n fallback: unknown;\n library: GenerativeUILibrary;\n status: GenerativeUIStatus;\n dispatch?: GenerativeUIDispatch;\n}) {\n const surface = React.useMemo(\n () => applyA2uiOperations(new Map(), operations).state.get(surfaceId),\n [operations, surfaceId],\n );\n const incoming = surface?.dataModel;\n const [local, setLocal] = React.useState(() => ({\n incoming,\n value: incoming,\n editedPaths: new Set<string>(),\n }));\n const model = Object.is(incoming, local.incoming)\n ? local\n : reconcileDataModel(\n local.incoming,\n incoming,\n local.value,\n local.editedPaths,\n );\n if (model !== local) setLocal(model);\n const convert = React.useMemo(\n () => surface && createLiveSurfaceConverter(surface),\n [surface],\n );\n const converted = React.useMemo(\n () => convert?.(model.value),\n [convert, model.value],\n );\n const BindingContext = A2uiBindingContext!;\n return (\n <BindingContext.Provider\n value={\n converted\n ? {\n fields: converted.bindings,\n update: (path, value) =>\n setLocal((current) =>\n equalData(resolvePointer(current.value, path), value)\n ? current\n : {\n ...current,\n value: setAtPointer(current.value, path, value, false)\n .value,\n editedPaths: new Set([...current.editedPaths, path]),\n },\n ),\n }\n : undefined\n }\n >\n {renderGenerativeUI(converted?.spec ?? fallback, library, {\n status,\n ...(dispatch ? { dispatch } : {}),\n })}\n </BindingContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;AAYA,SAAgB,oBAAoB,EAClC,WACA,YACA,UACA,SACA,QACA,YAQC;CACD,MAAM,UAAU,MAAM,cACd,oCAAoB,IAAI,IAAI,GAAG,UAAU,CAAC,CAAC,MAAM,IAAI,SAAS,GACpE,CAAC,YAAY,SAAS,CACxB;CACA,MAAM,WAAW,SAAS;CAC1B,MAAM,CAAC,OAAO,YAAY,MAAM,gBAAgB;EAC9C;EACA,OAAO;EACP,6BAAa,IAAI,IAAY;CAC/B,EAAE;CACF,MAAM,QAAQ,OAAO,GAAG,UAAU,MAAM,QAAQ,IAC5C,QACA,mBACE,MAAM,UACN,UACA,MAAM,OACN,MAAM,WACR;CACJ,IAAI,UAAU,OAAO,SAAS,KAAK;CACnC,MAAM,UAAU,MAAM,cACd,WAAW,2BAA2B,OAAO,GACnD,CAAC,OAAO,CACV;CACA,MAAM,YAAY,MAAM,cAChB,UAAU,MAAM,KAAK,GAC3B,CAAC,SAAS,MAAM,KAAK,CACvB;CAEA,OACE,oBAACA,mBAAe,UAAhB;EACE,OACE,YACI;GACE,QAAQ,UAAU;GAClB,SAAS,MAAM,UACb,UAAU,YACR,UAAU,eAAe,QAAQ,OAAO,IAAI,GAAG,KAAK,IAChD,UACA;IACE,GAAG;IACH,OAAO,aAAa,QAAQ,OAAO,MAAM,OAAO,KAAK,CAAC,CACnD;IACH,6BAAa,IAAI,IAAI,CAAC,GAAG,QAAQ,aAAa,IAAI,CAAC;GACrD,CACN;EACJ,IACA,KAAA;EAGL,UAAA,mBAAmB,WAAW,QAAQ,UAAU,SAAS;GACxD;GACA,GAAI,WAAW,EAAE,SAAS,IAAI,CAAC;EACjC,CAAC;CACsB,CAAA;AAE7B"}
|
package/dist/a2ui/convert.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type UIElement } from "../ir.js";
|
|
2
|
-
import { type A2uiSurfaceState } from "./types.js";
|
|
3
|
-
import type { A2uiBinding } from "./BindingContext.js";
|
|
4
|
-
export declare function convertSurfaceToUISpec(surface: A2uiSurfaceState, options?: {
|
|
5
|
-
readonly keepUnknownComponents?: boolean;
|
|
6
|
-
}): {
|
|
7
|
-
spec: UIElement | null;
|
|
8
|
-
warnings: string[];
|
|
9
|
-
};
|
|
10
|
-
export declare const createLiveSurfaceConverter: (surface: A2uiSurfaceState) => (dataModel: unknown) => {
|
|
11
|
-
bindings: Map<string, A2uiBinding>;
|
|
12
|
-
spec: UIElement | null;
|
|
13
|
-
warnings: string[];
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=convert.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../src/a2ui/convert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,iBAAc;AAEnD,OAAO,EAAmB,KAAK,gBAAgB,EAAE,mBAAgB;AAMjE,OAAO,KAAK,EAAE,WAAW,EAAE,4BAAyB;AA2kCpD,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,gBAAgB,EACzB,OAAO,GAAE;IACP,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACrC,GACL;IACD,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAEA;AAED,eAAO,MAAM,0BAA0B,GAAI,SAAS,gBAAgB,MAG1D,WAAW,OAAO;;UAqBjB,SAAS,GAAG,IAAI;cAAY,MAAM,EAAE;CAT9C,CAAC"}
|