@matterfact/embed 0.7.0 → 0.9.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 +171 -1
- package/dist/chunk-6EM7T2JV.js +816 -0
- package/dist/chunk-6EM7T2JV.js.map +1 -0
- package/dist/{chunk-4Q2ROXLR.js → chunk-BKKXHSYU.js} +2 -2
- package/dist/chunk-FEXG4LQJ.js +3 -0
- package/dist/chunk-FEXG4LQJ.js.map +7 -0
- package/dist/chunk-NWNMS34P.js +2 -0
- package/dist/chunk-URGQBG4I.js +800 -0
- package/dist/chunk-URGQBG4I.js.map +1 -0
- package/dist/context-ACFBWIFH.js +3 -0
- package/dist/{context-YX2KXFLI.js.map → context-ACFBWIFH.js.map} +1 -1
- package/dist/{context-WU2F5CBC.js → context-U2HJJN2S.js} +4 -2
- package/dist/embed.js +1 -1
- package/dist/embed.js.map +4 -4
- package/dist/index.cjs +1006 -159
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +192 -32
- package/dist/index.d.ts +192 -32
- package/dist/index.js +537 -130
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +1042 -165
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +81 -1
- package/dist/react.d.ts +81 -1
- package/dist/react.js +566 -132
- package/dist/react.js.map +1 -1
- package/dist/{snapshot-JOGZWESK.js → snapshot-4GXT6PKZ.js} +2 -2
- package/dist/{snapshot-MUXE7KXX.js → snapshot-Y75SCGCM.js} +3 -3
- package/dist/{snapshot-MUXE7KXX.js.map → snapshot-Y75SCGCM.js.map} +1 -1
- package/examples/embed-demo/README.md +37 -0
- package/examples/embed-demo/src/App.tsx +55 -21
- package/examples/embed-demo/src/HoistDemo.tsx +390 -0
- package/examples/embed-demo/src/main.tsx +7 -0
- package/examples/embed-demo/src/mockXH.ts +492 -0
- package/examples/embed-demo/src/placement.tsx +43 -0
- package/examples/embed-demo/src/styles.css +147 -2
- package/examples/embed-demo/vite.config.ts +2 -2
- package/package.json +1 -1
- package/dist/chunk-7I37ZFAJ.js +0 -2
- package/dist/chunk-AXKXNYRT.js +0 -381
- package/dist/chunk-AXKXNYRT.js.map +0 -1
- package/dist/chunk-D7R6WVHG.js +0 -2
- package/dist/chunk-D7R6WVHG.js.map +0 -7
- package/dist/chunk-RS6RMZ77.js +0 -396
- package/dist/chunk-RS6RMZ77.js.map +0 -1
- package/dist/context-YX2KXFLI.js +0 -3
- /package/dist/{chunk-4Q2ROXLR.js.map → chunk-BKKXHSYU.js.map} +0 -0
- /package/dist/{chunk-7I37ZFAJ.js.map → chunk-NWNMS34P.js.map} +0 -0
- /package/dist/{context-WU2F5CBC.js.map → context-U2HJJN2S.js.map} +0 -0
- /package/dist/{snapshot-JOGZWESK.js.map → snapshot-4GXT6PKZ.js.map} +0 -0
package/dist/react.d.cts
CHANGED
|
@@ -24,6 +24,64 @@ interface PageEntity {
|
|
|
24
24
|
text?: string;
|
|
25
25
|
data?: Record<string, unknown>;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* How a route's content is classified, for the annotated site map.
|
|
29
|
+
*
|
|
30
|
+
* The host DECORATES the site map we auto-derive (see `SiteMapEntry`) so the agent
|
|
31
|
+
* knows which routes carry MATTERFACT content and of what kind — app-wide awareness
|
|
32
|
+
* it can navigate toward. This is CLASSIFICATION only: no per-instance ids, and never
|
|
33
|
+
* a capability token. The concrete artifact/document on the CURRENT page still arrives
|
|
34
|
+
* via `host.context` entities / `host.artifactGrants`, resolved per page.
|
|
35
|
+
*
|
|
36
|
+
* - `mf-artifact` — a co-embedded matterfact artifact (its slug); the token stays on
|
|
37
|
+
* the live iframe / grant, never here.
|
|
38
|
+
* - `mf-document` — a matterfact document (dossier/report), resolved to an MF_DOC_ID
|
|
39
|
+
* host-side per page.
|
|
40
|
+
* - `host-data` — the host's own data; not a matterfact entity.
|
|
41
|
+
*/
|
|
42
|
+
type ContentClass = {
|
|
43
|
+
kind: 'mf-artifact';
|
|
44
|
+
slug: string;
|
|
45
|
+
} | {
|
|
46
|
+
kind: 'mf-document';
|
|
47
|
+
doctype: string;
|
|
48
|
+
} | {
|
|
49
|
+
kind: 'host-data';
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* One route in the annotated site map: the path pattern + label we derived, plus the
|
|
53
|
+
* host's content classification. `current` marks the route the user is on.
|
|
54
|
+
*/
|
|
55
|
+
interface SiteMapEntry {
|
|
56
|
+
/** Route pattern or path, e.g. '/app/company/:ticker/dossier'. */
|
|
57
|
+
path: string;
|
|
58
|
+
/** Human label for the route ('Company Dossier'). */
|
|
59
|
+
label?: string;
|
|
60
|
+
/** The host's classification of this route's content, when it annotated it. */
|
|
61
|
+
content?: ContentClass;
|
|
62
|
+
current?: boolean;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The Hoist adapter — a pure transform from a `HoistRuntime` (already read out of
|
|
67
|
+
* `window.XH` by hoist-runtime.ts) into the context/snapshot shapes context.ts sends
|
|
68
|
+
* over the bridge.
|
|
69
|
+
*
|
|
70
|
+
* This file never touches `window` or `XH` itself — see hoist-runtime.ts for the only
|
|
71
|
+
* code that does — so every function here is a plain, fully unit-testable transform
|
|
72
|
+
* against a plain object. That split is what keeps this file degrade-safe: it can be
|
|
73
|
+
* exhaustively tested without a real Hoist app, and hoist-runtime.ts's own try/catch
|
|
74
|
+
* (via detectHoist) is the one place a live-model surprise can ever throw.
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
/** The host's policy for agent-driven actions, keyed by tool family. Read from
|
|
78
|
+
* `window.matterfact.hoist.actions` by hoist-runtime.ts's `readActionsConfig`
|
|
79
|
+
* (the `<MatterfactAgent actions>` React prop is sugar that writes that same
|
|
80
|
+
* global — see react.tsx's `writeActionsGlobal`); `'off'` is the default — the
|
|
81
|
+
* tool is opt-in, never advertised unless a host turns it on. */
|
|
82
|
+
interface HoistActionsConfig {
|
|
83
|
+
navigate: 'off' | 'confirm' | 'auto';
|
|
84
|
+
}
|
|
27
85
|
|
|
28
86
|
interface MatterfactAgentProps {
|
|
29
87
|
/** Publishable key (`pk_…`) identifying this embed app. Public, origin-scoped. */
|
|
@@ -76,8 +134,30 @@ interface MatterfactAgentProps {
|
|
|
76
134
|
* OR'd together.
|
|
77
135
|
*/
|
|
78
136
|
dev?: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Turn on agent-driven host tools (today: `hoist.navigate`) at the given confirm
|
|
139
|
+
* tier, e.g. `{ navigate: 'confirm' }`. Default is every action tool OFF; this is
|
|
140
|
+
* opt-in only.
|
|
141
|
+
*
|
|
142
|
+
* This is just sugar over setting `window.matterfact.hoist.actions` yourself — the
|
|
143
|
+
* LAZY chunk (adapters/hoist-runtime.ts's `readActionsConfig`) reads that global
|
|
144
|
+
* directly at advertise/execute time, so there is nothing for the eager loader to
|
|
145
|
+
* carry. See `writeActionsGlobal` below.
|
|
146
|
+
*/
|
|
147
|
+
actions?: HoistActionsConfig;
|
|
148
|
+
/**
|
|
149
|
+
* The app's site map, annotated with each route's content class — so the agent knows
|
|
150
|
+
* which routes carry matterfact content (a co-embedded artifact, a document/report) or
|
|
151
|
+
* the host's own data, and can navigate toward them.
|
|
152
|
+
*
|
|
153
|
+
* Classification only: give the route pattern + label + a `content` tag; NEVER a
|
|
154
|
+
* capability token (the concrete artifact/document on the current page arrives via page
|
|
155
|
+
* context / the live iframe). Sugar over `window.matterfact.sitemap`, read by the loader
|
|
156
|
+
* on load and on navigation.
|
|
157
|
+
*/
|
|
158
|
+
sitemap?: SiteMapEntry[];
|
|
79
159
|
}
|
|
80
|
-
declare function MatterfactAgent({ publishableKey, widgetOrigin, surface, theme, getAuthToken, getPageContext, inline, className, style, pageContext, dev, }: MatterfactAgentProps): react_jsx_runtime.JSX.Element | null;
|
|
160
|
+
declare function MatterfactAgent({ publishableKey, widgetOrigin, surface, theme, getAuthToken, getPageContext, inline, className, style, pageContext, dev, actions, sitemap, }: MatterfactAgentProps): react_jsx_runtime.JSX.Element | null;
|
|
81
161
|
interface MatterfactArtifactProps {
|
|
82
162
|
/** The artifact's slug/name. */
|
|
83
163
|
slug: string;
|
package/dist/react.d.ts
CHANGED
|
@@ -24,6 +24,64 @@ interface PageEntity {
|
|
|
24
24
|
text?: string;
|
|
25
25
|
data?: Record<string, unknown>;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* How a route's content is classified, for the annotated site map.
|
|
29
|
+
*
|
|
30
|
+
* The host DECORATES the site map we auto-derive (see `SiteMapEntry`) so the agent
|
|
31
|
+
* knows which routes carry MATTERFACT content and of what kind — app-wide awareness
|
|
32
|
+
* it can navigate toward. This is CLASSIFICATION only: no per-instance ids, and never
|
|
33
|
+
* a capability token. The concrete artifact/document on the CURRENT page still arrives
|
|
34
|
+
* via `host.context` entities / `host.artifactGrants`, resolved per page.
|
|
35
|
+
*
|
|
36
|
+
* - `mf-artifact` — a co-embedded matterfact artifact (its slug); the token stays on
|
|
37
|
+
* the live iframe / grant, never here.
|
|
38
|
+
* - `mf-document` — a matterfact document (dossier/report), resolved to an MF_DOC_ID
|
|
39
|
+
* host-side per page.
|
|
40
|
+
* - `host-data` — the host's own data; not a matterfact entity.
|
|
41
|
+
*/
|
|
42
|
+
type ContentClass = {
|
|
43
|
+
kind: 'mf-artifact';
|
|
44
|
+
slug: string;
|
|
45
|
+
} | {
|
|
46
|
+
kind: 'mf-document';
|
|
47
|
+
doctype: string;
|
|
48
|
+
} | {
|
|
49
|
+
kind: 'host-data';
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* One route in the annotated site map: the path pattern + label we derived, plus the
|
|
53
|
+
* host's content classification. `current` marks the route the user is on.
|
|
54
|
+
*/
|
|
55
|
+
interface SiteMapEntry {
|
|
56
|
+
/** Route pattern or path, e.g. '/app/company/:ticker/dossier'. */
|
|
57
|
+
path: string;
|
|
58
|
+
/** Human label for the route ('Company Dossier'). */
|
|
59
|
+
label?: string;
|
|
60
|
+
/** The host's classification of this route's content, when it annotated it. */
|
|
61
|
+
content?: ContentClass;
|
|
62
|
+
current?: boolean;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The Hoist adapter — a pure transform from a `HoistRuntime` (already read out of
|
|
67
|
+
* `window.XH` by hoist-runtime.ts) into the context/snapshot shapes context.ts sends
|
|
68
|
+
* over the bridge.
|
|
69
|
+
*
|
|
70
|
+
* This file never touches `window` or `XH` itself — see hoist-runtime.ts for the only
|
|
71
|
+
* code that does — so every function here is a plain, fully unit-testable transform
|
|
72
|
+
* against a plain object. That split is what keeps this file degrade-safe: it can be
|
|
73
|
+
* exhaustively tested without a real Hoist app, and hoist-runtime.ts's own try/catch
|
|
74
|
+
* (via detectHoist) is the one place a live-model surprise can ever throw.
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
/** The host's policy for agent-driven actions, keyed by tool family. Read from
|
|
78
|
+
* `window.matterfact.hoist.actions` by hoist-runtime.ts's `readActionsConfig`
|
|
79
|
+
* (the `<MatterfactAgent actions>` React prop is sugar that writes that same
|
|
80
|
+
* global — see react.tsx's `writeActionsGlobal`); `'off'` is the default — the
|
|
81
|
+
* tool is opt-in, never advertised unless a host turns it on. */
|
|
82
|
+
interface HoistActionsConfig {
|
|
83
|
+
navigate: 'off' | 'confirm' | 'auto';
|
|
84
|
+
}
|
|
27
85
|
|
|
28
86
|
interface MatterfactAgentProps {
|
|
29
87
|
/** Publishable key (`pk_…`) identifying this embed app. Public, origin-scoped. */
|
|
@@ -76,8 +134,30 @@ interface MatterfactAgentProps {
|
|
|
76
134
|
* OR'd together.
|
|
77
135
|
*/
|
|
78
136
|
dev?: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Turn on agent-driven host tools (today: `hoist.navigate`) at the given confirm
|
|
139
|
+
* tier, e.g. `{ navigate: 'confirm' }`. Default is every action tool OFF; this is
|
|
140
|
+
* opt-in only.
|
|
141
|
+
*
|
|
142
|
+
* This is just sugar over setting `window.matterfact.hoist.actions` yourself — the
|
|
143
|
+
* LAZY chunk (adapters/hoist-runtime.ts's `readActionsConfig`) reads that global
|
|
144
|
+
* directly at advertise/execute time, so there is nothing for the eager loader to
|
|
145
|
+
* carry. See `writeActionsGlobal` below.
|
|
146
|
+
*/
|
|
147
|
+
actions?: HoistActionsConfig;
|
|
148
|
+
/**
|
|
149
|
+
* The app's site map, annotated with each route's content class — so the agent knows
|
|
150
|
+
* which routes carry matterfact content (a co-embedded artifact, a document/report) or
|
|
151
|
+
* the host's own data, and can navigate toward them.
|
|
152
|
+
*
|
|
153
|
+
* Classification only: give the route pattern + label + a `content` tag; NEVER a
|
|
154
|
+
* capability token (the concrete artifact/document on the current page arrives via page
|
|
155
|
+
* context / the live iframe). Sugar over `window.matterfact.sitemap`, read by the loader
|
|
156
|
+
* on load and on navigation.
|
|
157
|
+
*/
|
|
158
|
+
sitemap?: SiteMapEntry[];
|
|
79
159
|
}
|
|
80
|
-
declare function MatterfactAgent({ publishableKey, widgetOrigin, surface, theme, getAuthToken, getPageContext, inline, className, style, pageContext, dev, }: MatterfactAgentProps): react_jsx_runtime.JSX.Element | null;
|
|
160
|
+
declare function MatterfactAgent({ publishableKey, widgetOrigin, surface, theme, getAuthToken, getPageContext, inline, className, style, pageContext, dev, actions, sitemap, }: MatterfactAgentProps): react_jsx_runtime.JSX.Element | null;
|
|
81
161
|
interface MatterfactArtifactProps {
|
|
82
162
|
/** The artifact's slug/name. */
|
|
83
163
|
slug: string;
|