@popmelt.com/core 0.18.1 → 0.19.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 CHANGED
@@ -158,6 +158,40 @@ export function Providers({ children }: { children: React.ReactNode }) {
158
158
 
159
159
  `navigate` is optional for single-page use. Pass your router's navigation function when Popmelt needs to restore annotations across routes.
160
160
 
161
+ ### Add application context to comments
162
+
163
+ Use `getCommentMeta` to snapshot application-owned context whenever a human
164
+ submits annotations or replies in a thread. Popmelt validates and detaches the
165
+ JSON, includes it as contextual evidence for the model, and persists the same
166
+ snapshot with the stored human turn.
167
+
168
+ ```tsx
169
+ <PopmeltProvider
170
+ getCommentMeta={({ kind }) => ({
171
+ 'my-app/video-ui/v1': {
172
+ kind,
173
+ generation: {
174
+ prompt: generation.prompt,
175
+ dataVersion: store.getState().version,
176
+ },
177
+ frame: {
178
+ assetId: video.id,
179
+ timeMs: Math.round(video.currentTime * 1000),
180
+ },
181
+ interactions: recorder.snapshot(),
182
+ },
183
+ })}
184
+ >
185
+ {children}
186
+ </PopmeltProvider>
187
+ ```
188
+
189
+ The hook may be synchronous or asynchronous. Return a plain JSON object; use a
190
+ namespaced, versioned key so multiple integrations can coexist. Comment
191
+ metadata is limited to 64 KiB per human turn. Keep large binaries and long
192
+ event logs in external storage or attachments and place their stable IDs,
193
+ hashes, and timestamps in `meta`.
194
+
161
195
  ### Next.js
162
196
 
163
197
  Next.js needs both the command wrapper and the config wrapper.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "popmelt-core",
3
- "version": "0.18.1",
3
+ "version": "0.19.0",
4
4
  "description": "Ambient project memory and shared understanding for Codex",
5
5
  "author": {
6
6
  "name": "Popmelt",
@@ -1,5 +1,5 @@
1
1
  import { Camera, Object3D, Raycaster } from 'three';
2
- import { P as PopmeltSubjectAdapter } from './subjects-CeqtFged.mjs';
2
+ import { P as PopmeltSubjectAdapter } from './subjects-C6Bu8uSX.mjs';
3
3
 
4
4
  type ThreeSubjectAdapterOptions = {
5
5
  /** Unique adapter identity when a page owns more than one Three.js surface. */
@@ -87,6 +87,12 @@ type PopmeltSubjectTrackingAnchor = {
87
87
  /** Vertical position normalized within the subject bounds. */
88
88
  y: number;
89
89
  };
90
+ type PopmeltSubjectOutlinePoint = {
91
+ /** Horizontal position normalized within the subject bounds. */
92
+ x: number;
93
+ /** Vertical position normalized within the subject bounds. */
94
+ y: number;
95
+ };
90
96
  type PopmeltSubject = {
91
97
  key: string;
92
98
  label: string;
@@ -101,6 +107,8 @@ type PopmeltSubject = {
101
107
  videoObject?: VideoObjectContext;
102
108
  /** Optional provider-neutral foreground anchors used by motion tracking. */
103
109
  trackingAnchors?: readonly PopmeltSubjectTrackingAnchor[];
110
+ /** Optional provider-neutral contour normalized within the subject bounds. */
111
+ outline?: readonly PopmeltSubjectOutlinePoint[];
104
112
  };
105
113
  type PopmeltSurfaceSnapshot = {
106
114
  element: HTMLCanvasElement;
@@ -125,6 +133,13 @@ type PopmeltSubjectAdapter = {
125
133
  surfaceKind?: 'image' | 'video';
126
134
  /** Resolve once the adapter's persisted subject index is available. */
127
135
  whenReady?(): Promise<void>;
136
+ /** Notify Core when asynchronous perception changes hit-testable subjects. */
137
+ subscribe?(listener: () => void): () => void;
138
+ /** Ordered hit candidates, innermost/most-specific first. */
139
+ hitTestAll?(clientPoint: {
140
+ x: number;
141
+ y: number;
142
+ }): readonly PopmeltSubject[];
128
143
  hitTest(clientPoint: {
129
144
  x: number;
130
145
  y: number;
@@ -147,6 +162,8 @@ type PopmeltSubjectAdapter = {
147
162
  updateSubjectBounds?(key: string, bounds: PopmeltSubjectBounds): PopmeltSubject | null;
148
163
  /** Replace optional foreground anchors normalized within subject bounds. */
149
164
  updateSubjectTrackingAnchors?(key: string, anchors: readonly PopmeltSubjectTrackingAnchor[]): PopmeltSubject | null;
165
+ /** Promote a transient perception candidate into a durable subject. */
166
+ promoteSubject?(key: string): PopmeltSubject | null;
150
167
  /** Remove a user-created subject or hide an adapter-owned subject. */
151
168
  removeSubject?(key: string): void;
152
169
  };