@matterfact/embed 0.8.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 +72 -0
- package/dist/{chunk-PNSYFXXU.js → chunk-6EM7T2JV.js} +27 -2
- package/dist/chunk-6EM7T2JV.js.map +1 -0
- package/dist/{chunk-UD7CAQXV.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-R2ZEJARX.js → chunk-URGQBG4I.js} +28 -4
- package/dist/chunk-URGQBG4I.js.map +1 -0
- package/dist/context-ACFBWIFH.js +3 -0
- package/dist/{context-ARBB2XD6.js.map → context-ACFBWIFH.js.map} +1 -1
- package/dist/{context-MVGSYIMB.js → context-U2HJJN2S.js} +4 -2
- package/dist/embed.js +1 -1
- package/dist/embed.js.map +2 -2
- package/dist/index.cjs +29 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +60 -2
- package/dist/index.d.ts +60 -2
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +40 -2
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +49 -1
- package/dist/react.d.ts +49 -1
- package/dist/react.js +16 -3
- package/dist/react.js.map +1 -1
- package/dist/{snapshot-UGTXZVB6.js → snapshot-4GXT6PKZ.js} +2 -2
- package/dist/{snapshot-GL4YBMXD.js → snapshot-Y75SCGCM.js} +3 -3
- package/dist/{snapshot-GL4YBMXD.js.map → snapshot-Y75SCGCM.js.map} +1 -1
- package/package.json +1 -1
- package/dist/chunk-PNSYFXXU.js.map +0 -1
- package/dist/chunk-R2ZEJARX.js.map +0 -1
- package/dist/chunk-UQCETVRF.js +0 -2
- package/dist/chunk-W52Q7G4J.js +0 -3
- package/dist/chunk-W52Q7G4J.js.map +0 -7
- package/dist/context-ARBB2XD6.js +0 -3
- /package/dist/{chunk-UD7CAQXV.js.map → chunk-BKKXHSYU.js.map} +0 -0
- /package/dist/{chunk-UQCETVRF.js.map → chunk-NWNMS34P.js.map} +0 -0
- /package/dist/{context-MVGSYIMB.js.map → context-U2HJJN2S.js.map} +0 -0
- /package/dist/{snapshot-UGTXZVB6.js.map → snapshot-4GXT6PKZ.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* shapes are right, "deeper integration" is a transport swap (postMessage ->
|
|
19
19
|
* direct call), not a rewrite. So model the DOMAIN here, not the plumbing.
|
|
20
20
|
*/
|
|
21
|
-
declare const PROTOCOL_VERSION =
|
|
21
|
+
declare const PROTOCOL_VERSION = 3;
|
|
22
22
|
/** Every message is namespaced so we never collide with the host page's own postMessage traffic. */
|
|
23
23
|
declare const CHANNEL = "mf-embed";
|
|
24
24
|
/**
|
|
@@ -58,6 +58,43 @@ interface PageEntity {
|
|
|
58
58
|
text?: string;
|
|
59
59
|
data?: Record<string, unknown>;
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* How a route's content is classified, for the annotated site map.
|
|
63
|
+
*
|
|
64
|
+
* The host DECORATES the site map we auto-derive (see `SiteMapEntry`) so the agent
|
|
65
|
+
* knows which routes carry MATTERFACT content and of what kind — app-wide awareness
|
|
66
|
+
* it can navigate toward. This is CLASSIFICATION only: no per-instance ids, and never
|
|
67
|
+
* a capability token. The concrete artifact/document on the CURRENT page still arrives
|
|
68
|
+
* via `host.context` entities / `host.artifactGrants`, resolved per page.
|
|
69
|
+
*
|
|
70
|
+
* - `mf-artifact` — a co-embedded matterfact artifact (its slug); the token stays on
|
|
71
|
+
* the live iframe / grant, never here.
|
|
72
|
+
* - `mf-document` — a matterfact document (dossier/report), resolved to an MF_DOC_ID
|
|
73
|
+
* host-side per page.
|
|
74
|
+
* - `host-data` — the host's own data; not a matterfact entity.
|
|
75
|
+
*/
|
|
76
|
+
type ContentClass = {
|
|
77
|
+
kind: 'mf-artifact';
|
|
78
|
+
slug: string;
|
|
79
|
+
} | {
|
|
80
|
+
kind: 'mf-document';
|
|
81
|
+
doctype: string;
|
|
82
|
+
} | {
|
|
83
|
+
kind: 'host-data';
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* One route in the annotated site map: the path pattern + label we derived, plus the
|
|
87
|
+
* host's content classification. `current` marks the route the user is on.
|
|
88
|
+
*/
|
|
89
|
+
interface SiteMapEntry {
|
|
90
|
+
/** Route pattern or path, e.g. '/app/company/:ticker/dossier'. */
|
|
91
|
+
path: string;
|
|
92
|
+
/** Human label for the route ('Company Dossier'). */
|
|
93
|
+
label?: string;
|
|
94
|
+
/** The host's classification of this route's content, when it annotated it. */
|
|
95
|
+
content?: ContentClass;
|
|
96
|
+
current?: boolean;
|
|
97
|
+
}
|
|
61
98
|
/** A co-embedded artifact's read-only capability, for the backend to materialize its
|
|
62
99
|
* data. Backend-only — never rendered. `token` is the artifact's own embed token. */
|
|
63
100
|
interface ArtifactGrant {
|
|
@@ -174,6 +211,17 @@ type HostToWidget = {
|
|
|
174
211
|
} | {
|
|
175
212
|
type: 'host.artifactGrants';
|
|
176
213
|
grants: ArtifactGrant[];
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* The annotated site map — the app's routes with the host's content
|
|
217
|
+
* classification. Sent on mount and re-sent on navigation (a virtualized SPA can
|
|
218
|
+
* change what's routable). Distinct from the per-page `host.context`: this is the
|
|
219
|
+
* whole app's structure, so the agent can reason about and navigate toward MF
|
|
220
|
+
* content the user isn't currently looking at.
|
|
221
|
+
*/
|
|
222
|
+
| {
|
|
223
|
+
type: 'host.sitemap';
|
|
224
|
+
sitemap: SiteMapEntry[];
|
|
177
225
|
} | {
|
|
178
226
|
type: 'host.tools';
|
|
179
227
|
tools: HostTool[];
|
|
@@ -356,6 +404,16 @@ type WidgetToHost = {
|
|
|
356
404
|
/** The widget has no session; the host must run the hosted-login popup. */
|
|
357
405
|
| {
|
|
358
406
|
type: 'widget.needsAuth';
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Deeplink the host to one of its OWN routes — the "open on page" control on a
|
|
410
|
+
* co-embedded document's side-panel viewer. The widget is a cross-origin iframe and
|
|
411
|
+
* can't navigate the top window itself, so it asks the loader, which resolves the
|
|
412
|
+
* href against the host location and refuses anything off the host's own origin.
|
|
413
|
+
*/
|
|
414
|
+
| {
|
|
415
|
+
type: 'widget.navigate';
|
|
416
|
+
href: string;
|
|
359
417
|
};
|
|
360
418
|
/**
|
|
361
419
|
* Everything on the wire is wrapped.
|
|
@@ -603,4 +661,4 @@ declare class EmbedHost {
|
|
|
603
661
|
*/
|
|
604
662
|
declare function mount(config: LoaderConfig): EmbedHost;
|
|
605
663
|
|
|
606
|
-
export { type ActivityEvent, type ArtifactGrant, CHANNEL, type DomSnapshot, type ElementRef, EmbedHost, type Envelope, type FocusContext, type HostToWidget, type HostTool, type LoaderConfig, PROTOCOL_VERSION, type PageContext, type PageEntity, type ToolCall, type WidgetToHost, envelope, isEnvelope, mount, readConfig };
|
|
664
|
+
export { type ActivityEvent, type ArtifactGrant, CHANNEL, type ContentClass, type DomSnapshot, type ElementRef, EmbedHost, type Envelope, type FocusContext, type HostToWidget, type HostTool, type LoaderConfig, PROTOCOL_VERSION, type PageContext, type PageEntity, type SiteMapEntry, type ToolCall, type WidgetToHost, envelope, isEnvelope, mount, readConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* shapes are right, "deeper integration" is a transport swap (postMessage ->
|
|
19
19
|
* direct call), not a rewrite. So model the DOMAIN here, not the plumbing.
|
|
20
20
|
*/
|
|
21
|
-
declare const PROTOCOL_VERSION =
|
|
21
|
+
declare const PROTOCOL_VERSION = 3;
|
|
22
22
|
/** Every message is namespaced so we never collide with the host page's own postMessage traffic. */
|
|
23
23
|
declare const CHANNEL = "mf-embed";
|
|
24
24
|
/**
|
|
@@ -58,6 +58,43 @@ interface PageEntity {
|
|
|
58
58
|
text?: string;
|
|
59
59
|
data?: Record<string, unknown>;
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* How a route's content is classified, for the annotated site map.
|
|
63
|
+
*
|
|
64
|
+
* The host DECORATES the site map we auto-derive (see `SiteMapEntry`) so the agent
|
|
65
|
+
* knows which routes carry MATTERFACT content and of what kind — app-wide awareness
|
|
66
|
+
* it can navigate toward. This is CLASSIFICATION only: no per-instance ids, and never
|
|
67
|
+
* a capability token. The concrete artifact/document on the CURRENT page still arrives
|
|
68
|
+
* via `host.context` entities / `host.artifactGrants`, resolved per page.
|
|
69
|
+
*
|
|
70
|
+
* - `mf-artifact` — a co-embedded matterfact artifact (its slug); the token stays on
|
|
71
|
+
* the live iframe / grant, never here.
|
|
72
|
+
* - `mf-document` — a matterfact document (dossier/report), resolved to an MF_DOC_ID
|
|
73
|
+
* host-side per page.
|
|
74
|
+
* - `host-data` — the host's own data; not a matterfact entity.
|
|
75
|
+
*/
|
|
76
|
+
type ContentClass = {
|
|
77
|
+
kind: 'mf-artifact';
|
|
78
|
+
slug: string;
|
|
79
|
+
} | {
|
|
80
|
+
kind: 'mf-document';
|
|
81
|
+
doctype: string;
|
|
82
|
+
} | {
|
|
83
|
+
kind: 'host-data';
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* One route in the annotated site map: the path pattern + label we derived, plus the
|
|
87
|
+
* host's content classification. `current` marks the route the user is on.
|
|
88
|
+
*/
|
|
89
|
+
interface SiteMapEntry {
|
|
90
|
+
/** Route pattern or path, e.g. '/app/company/:ticker/dossier'. */
|
|
91
|
+
path: string;
|
|
92
|
+
/** Human label for the route ('Company Dossier'). */
|
|
93
|
+
label?: string;
|
|
94
|
+
/** The host's classification of this route's content, when it annotated it. */
|
|
95
|
+
content?: ContentClass;
|
|
96
|
+
current?: boolean;
|
|
97
|
+
}
|
|
61
98
|
/** A co-embedded artifact's read-only capability, for the backend to materialize its
|
|
62
99
|
* data. Backend-only — never rendered. `token` is the artifact's own embed token. */
|
|
63
100
|
interface ArtifactGrant {
|
|
@@ -174,6 +211,17 @@ type HostToWidget = {
|
|
|
174
211
|
} | {
|
|
175
212
|
type: 'host.artifactGrants';
|
|
176
213
|
grants: ArtifactGrant[];
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* The annotated site map — the app's routes with the host's content
|
|
217
|
+
* classification. Sent on mount and re-sent on navigation (a virtualized SPA can
|
|
218
|
+
* change what's routable). Distinct from the per-page `host.context`: this is the
|
|
219
|
+
* whole app's structure, so the agent can reason about and navigate toward MF
|
|
220
|
+
* content the user isn't currently looking at.
|
|
221
|
+
*/
|
|
222
|
+
| {
|
|
223
|
+
type: 'host.sitemap';
|
|
224
|
+
sitemap: SiteMapEntry[];
|
|
177
225
|
} | {
|
|
178
226
|
type: 'host.tools';
|
|
179
227
|
tools: HostTool[];
|
|
@@ -356,6 +404,16 @@ type WidgetToHost = {
|
|
|
356
404
|
/** The widget has no session; the host must run the hosted-login popup. */
|
|
357
405
|
| {
|
|
358
406
|
type: 'widget.needsAuth';
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Deeplink the host to one of its OWN routes — the "open on page" control on a
|
|
410
|
+
* co-embedded document's side-panel viewer. The widget is a cross-origin iframe and
|
|
411
|
+
* can't navigate the top window itself, so it asks the loader, which resolves the
|
|
412
|
+
* href against the host location and refuses anything off the host's own origin.
|
|
413
|
+
*/
|
|
414
|
+
| {
|
|
415
|
+
type: 'widget.navigate';
|
|
416
|
+
href: string;
|
|
359
417
|
};
|
|
360
418
|
/**
|
|
361
419
|
* Everything on the wire is wrapped.
|
|
@@ -603,4 +661,4 @@ declare class EmbedHost {
|
|
|
603
661
|
*/
|
|
604
662
|
declare function mount(config: LoaderConfig): EmbedHost;
|
|
605
663
|
|
|
606
|
-
export { type ActivityEvent, type ArtifactGrant, CHANNEL, type DomSnapshot, type ElementRef, EmbedHost, type Envelope, type FocusContext, type HostToWidget, type HostTool, type LoaderConfig, PROTOCOL_VERSION, type PageContext, type PageEntity, type ToolCall, type WidgetToHost, envelope, isEnvelope, mount, readConfig };
|
|
664
|
+
export { type ActivityEvent, type ArtifactGrant, CHANNEL, type ContentClass, type DomSnapshot, type ElementRef, EmbedHost, type Envelope, type FocusContext, type HostToWidget, type HostTool, type LoaderConfig, PROTOCOL_VERSION, type PageContext, type PageEntity, type SiteMapEntry, type ToolCall, type WidgetToHost, envelope, isEnvelope, mount, readConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/protocol.ts
|
|
2
|
-
var PROTOCOL_VERSION =
|
|
2
|
+
var PROTOCOL_VERSION = 3;
|
|
3
3
|
var CHANNEL = "mf-embed";
|
|
4
4
|
function envelope(payload, id) {
|
|
5
5
|
return {
|
|
@@ -599,6 +599,9 @@ var EmbedHost = class {
|
|
|
599
599
|
case "widget.needsAuth":
|
|
600
600
|
void this.provideAuth();
|
|
601
601
|
break;
|
|
602
|
+
case "widget.navigate":
|
|
603
|
+
void this.loadContext().then((m) => m.navigateHost(msg.href));
|
|
604
|
+
break;
|
|
602
605
|
}
|
|
603
606
|
}
|
|
604
607
|
/**
|
|
@@ -715,7 +718,7 @@ var EmbedHost = class {
|
|
|
715
718
|
}
|
|
716
719
|
}
|
|
717
720
|
loadContext() {
|
|
718
|
-
this.context ?? (this.context = import('./context-
|
|
721
|
+
this.context ?? (this.context = import('./context-ACFBWIFH.js').then((m) => {
|
|
719
722
|
m.start(
|
|
720
723
|
this.send,
|
|
721
724
|
this.config.origin,
|