@justai/core 0.5.0 → 0.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justai/core",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "The framework-free heart of the persona shell \u2014 the load-bearing behaviour (auth capture, reveal, ready) as plain strings, so Astro and Next inject the SAME logic instead of each re-writing it.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
package/src/index.d.ts CHANGED
@@ -24,3 +24,13 @@ export declare function consentCopy(lang: string): { consentText: string; consen
24
24
 
25
25
  /** The consent dialog's behaviour — origin-scoped, asked once, with the universal change-your-mind door. */
26
26
  export declare const CONSENT_JS: string;
27
+
28
+ /** The query parameter a caller uses to declare which presentation it is asking for. */
29
+ export declare const PRESENTATION_PARAM: string;
30
+ /** Its value when the caller is another persona speaking over atrium. */
31
+ export declare const PRESENTATION_EMBEDDED: string;
32
+ /**
33
+ * Which presentation this page is in: `"embedded"` only when a caller DECLARED it and the browser
34
+ * agrees we are in a frame. Presentation only — never a permission. See the note in index.js.
35
+ */
36
+ export declare function presentation(loc?: Location, win?: Window): "standalone" | "embedded";
package/src/index.js CHANGED
@@ -329,3 +329,51 @@ var asked=tz.indexOf("Europe/")===0||[
329
329
  if(!asked)return;
330
330
  setTimeout(open,700);
331
331
  }catch(_){}})();`;
332
+
333
+ // queries: is this persona standalone or embedded · how does a persona know it is inside another
334
+ // persona · mode=atrium · presentation mode · a sub-persona should not show Cancel when
335
+ // opened directly · does this page have a caller
336
+ //
337
+ // WHICH PRESENTATION A PERSONA IS IN, AND WHY IT IS A QUESTION AT ALL.
338
+ //
339
+ // The founder, 2026-07-27, looking at `/files` opened directly in a tab and still wearing the
340
+ // clothes it wears inside somebody else's sheet:
341
+ //
342
+ // "bir persona veya sub personanin kendisinin standalone calisip calismadigini bilmesi gerekir
343
+ // ki ona gore ux deneyiminde degisiklige gidebilsin"
344
+ //
345
+ // A page opened by a person and a page opened by another persona are two different situations, and
346
+ // the same controls do not belong in both. Standalone there is nothing to cancel — "Cancel" is a
347
+ // button with no meaning, offered to somebody who never asked a question. "Choose from device" is
348
+ // the phrasing of an answer; alone, the same control is simply "Upload".
349
+ //
350
+ // TWO SIGNALS, AND THEY ANSWER DIFFERENT QUESTIONS:
351
+ //
352
+ // · `window.parent !== window` is the BROWSER's answer to "am I in a frame". It is true and it is
353
+ // free, but it says nothing about who put us there or what they want.
354
+ // · `?mode=atrium` is the CALLER's declaration of the experience it is asking for. It is a claim —
355
+ // anyone can type it — and that is fine, because it decides nothing but presentation.
356
+ //
357
+ // So both are required, and neither is a permission. Anything that must not be forged (who may read
358
+ // a file, whose persona owns a write) is decided by the verified origin on the atrium channel, never
359
+ // by this. What this decides is which words a person reads.
360
+ //
361
+ // The param exists at all because the frame is the SLOWER truth: a handshake takes a beat, and a
362
+ // page that waits for it shows the wrong chrome first and then rearranges itself in front of the
363
+ // person. The declaration is available in the first paint.
364
+ export const PRESENTATION_PARAM = "mode";
365
+ export const PRESENTATION_EMBEDDED = "atrium";
366
+
367
+ export function presentation(loc, win) {
368
+ const l = loc || (typeof location !== "undefined" ? location : null);
369
+ const w = win || (typeof window !== "undefined" ? window : null);
370
+ if (!l || !w) return "standalone";
371
+ let declared = null;
372
+ try {
373
+ declared = new URLSearchParams(l.search).get(PRESENTATION_PARAM);
374
+ } catch {
375
+ /* a search string we cannot parse is a page nobody addressed */
376
+ }
377
+ const framed = w.parent !== w;
378
+ return declared === PRESENTATION_EMBEDDED && framed ? "embedded" : "standalone";
379
+ }