@glassly/miniapp 0.4.3-dev.1200 → 0.4.3-dev.1206

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.
Files changed (69) hide show
  1. package/dist/display/index.d.ts +2 -1
  2. package/dist/display/index.d.ts.map +1 -1
  3. package/dist/display/index.js +1 -1
  4. package/dist/display/index.js.map +1 -1
  5. package/dist/display/profiles/index.d.ts +2 -0
  6. package/dist/display/profiles/index.d.ts.map +1 -1
  7. package/dist/display/profiles/index.js +1 -0
  8. package/dist/display/profiles/index.js.map +1 -1
  9. package/dist/display/profiles/textProfile.d.ts +24 -0
  10. package/dist/display/profiles/textProfile.d.ts.map +1 -0
  11. package/dist/display/profiles/textProfile.js +52 -0
  12. package/dist/display/profiles/textProfile.js.map +1 -0
  13. package/dist/display/scene/process.d.ts.map +1 -1
  14. package/dist/display/scene/process.js +2 -3
  15. package/dist/display/scene/process.js.map +1 -1
  16. package/dist/host/actionInvoke.d.ts +44 -0
  17. package/dist/host/actionInvoke.d.ts.map +1 -0
  18. package/dist/host/actionInvoke.js +87 -0
  19. package/dist/host/actionInvoke.js.map +1 -0
  20. package/dist/host/gestureClaims.d.ts +37 -0
  21. package/dist/host/gestureClaims.d.ts.map +1 -0
  22. package/dist/host/gestureClaims.js +45 -0
  23. package/dist/host/gestureClaims.js.map +1 -0
  24. package/dist/host/index.d.ts +8 -0
  25. package/dist/host/index.d.ts.map +1 -1
  26. package/dist/host/index.js +9 -0
  27. package/dist/host/index.js.map +1 -1
  28. package/dist/host/manifestActions.d.ts +69 -0
  29. package/dist/host/manifestActions.d.ts.map +1 -0
  30. package/dist/host/manifestActions.js +89 -0
  31. package/dist/host/manifestActions.js.map +1 -0
  32. package/dist/host/memory/MemoryStore.d.ts +178 -0
  33. package/dist/host/memory/MemoryStore.d.ts.map +1 -0
  34. package/dist/host/memory/MemoryStore.js +615 -0
  35. package/dist/host/memory/MemoryStore.js.map +1 -0
  36. package/dist/host/memory/search.d.ts +72 -0
  37. package/dist/host/memory/search.d.ts.map +1 -0
  38. package/dist/host/memory/search.js +188 -0
  39. package/dist/host/memory/search.js.map +1 -0
  40. package/dist/host/miniappPermissions.d.ts +16 -0
  41. package/dist/host/miniappPermissions.d.ts.map +1 -0
  42. package/dist/host/miniappPermissions.js +7 -0
  43. package/dist/host/miniappPermissions.js.map +1 -0
  44. package/dist/host/settingsBridge.d.ts +49 -0
  45. package/dist/host/settingsBridge.d.ts.map +1 -0
  46. package/dist/host/settingsBridge.js +110 -0
  47. package/dist/host/settingsBridge.js.map +1 -0
  48. package/dist/host/widgetPlacements.d.ts +44 -0
  49. package/dist/host/widgetPlacements.d.ts.map +1 -0
  50. package/dist/host/widgetPlacements.js +84 -0
  51. package/dist/host/widgetPlacements.js.map +1 -0
  52. package/dist/session.d.ts +6 -0
  53. package/dist/session.d.ts.map +1 -1
  54. package/dist/session.js.map +1 -1
  55. package/package.json +2 -2
  56. package/src/display/index.ts +3 -0
  57. package/src/display/profiles/index.ts +3 -0
  58. package/src/display/profiles/textProfile.ts +66 -0
  59. package/src/display/scene/process.ts +2 -3
  60. package/src/host/actionInvoke.ts +110 -0
  61. package/src/host/gestureClaims.ts +77 -0
  62. package/src/host/index.ts +10 -0
  63. package/src/host/manifestActions.ts +152 -0
  64. package/src/host/memory/MemoryStore.ts +704 -0
  65. package/src/host/memory/search.ts +214 -0
  66. package/src/host/miniappPermissions.ts +19 -0
  67. package/src/host/settingsBridge.ts +119 -0
  68. package/src/host/widgetPlacements.ts +135 -0
  69. package/src/session.ts +6 -0
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Pure memory-timeline search — the matching engine behind MemoryStore.query
3
+ * and the assistant's get_transcripts tool.
4
+ *
5
+ * Lives outside MemoryStore so it is unit-testable and importable by the
6
+ * assistant's eval harness (which replays the exact host semantics against a
7
+ * mock corpus). Keep it dependency-free and runtime-neutral: it also runs
8
+ * under bun for tests.
9
+ *
10
+ * TWO MATCH MODES, deliberately different:
11
+ * - `contains`: exact case-insensitive substring — the pre-existing contract,
12
+ * kept verbatim for callers that need precision (codes, URLs, exact phrases).
13
+ * - `terms`: ANY-of term matching with per-word fuzziness. Speech-to-text
14
+ * mangles proper nouns ("Sompo" for "Sampo", "Korwin" for "Corwin"), so a
15
+ * term word matches a transcript token on exact/substring, small edit
16
+ * distance, OR same Soundex key. A multi-word term ("ring size") requires
17
+ * all of its words to match somewhere in the entry.
18
+ *
19
+ * The scan walks BACKWARDS from the newest in-window entry and stops at
20
+ * `limit` matches: the caller keeps the most recent matches anyway, and the
21
+ * common "last 90 minutes" query then touches dozens of entries instead of
22
+ * the full 4000-entry timeline. Window bounds are found by binary search on
23
+ * `at` (the timeline is maintained time-sorted).
24
+ */
25
+ export interface MemorySearchableEntry {
26
+ text: string;
27
+ at: number;
28
+ }
29
+ export interface MemorySearchQuery {
30
+ /** Epoch ms lower bound (inclusive). */
31
+ sinceMs?: number;
32
+ /** Epoch ms upper bound (inclusive). */
33
+ untilMs?: number;
34
+ /** Exact case-insensitive substring filter. */
35
+ contains?: string;
36
+ /** Fuzzy any-of terms (see file header). Combined with `contains` as AND. */
37
+ terms?: string[];
38
+ /** Max matches kept (newest win). Caller enforces its own cap. */
39
+ limit: number;
40
+ }
41
+ export interface MemorySearchResult<T> {
42
+ /** Matches in chronological order (newest last), at most `limit`. */
43
+ entries: T[];
44
+ /**
45
+ * Entries inside the TIME window before keyword filtering. Lets the caller
46
+ * tell "keyword matched nothing" apart from "window itself is empty" — the
47
+ * distinction that saves an LLM a blind retry round.
48
+ */
49
+ windowCount: number;
50
+ }
51
+ export declare function searchMemoryEntries<T extends MemorySearchableEntry>(entries: readonly T[], q: MemorySearchQuery): MemorySearchResult<T>;
52
+ /**
53
+ * Does query word `w` match transcript token `t`?
54
+ * - exact, or substring for w of 3+ chars ("kestrel" in "kestrels")
55
+ * - for words of 5+ chars: bounded edit distance (1, or 2 for 7+ chars)
56
+ * — catches one-vowel STT swaps ("sompo"/"sampo", "korwin"/"corwin").
57
+ * 5 is the floor because at 4 chars a one-edit radius swallows unrelated
58
+ * common words ("code"→"mode"); mistranscribed NAMES are almost always 5+.
59
+ * - same Soundex key with similar length — catches phonetic respellings that
60
+ * edit distance misses ("warryn"/"warren" style doublings)
61
+ */
62
+ export declare function fuzzyWordMatch(w: string, t: string): boolean;
63
+ /** Lowercase, strip diacritics, split on non-alphanumerics. */
64
+ export declare function tokenize(text: string): string[];
65
+ /**
66
+ * Optimal-string-alignment edit distance, early-exited: returns whether
67
+ * dist(a, b) <= max. Transpositions count as one edit (common in STT output).
68
+ */
69
+ export declare function editDistanceAtMost(a: string, b: string, max: number): boolean;
70
+ /** Classic Soundex. Empty input returns "". */
71
+ export declare function soundex(word: string): string;
72
+ //# sourceMappingURL=search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/host/memory/search.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;CACX;AAED,MAAM,WAAW,iBAAiB;IAChC,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,qEAAqE;IACrE,OAAO,EAAE,CAAC,EAAE,CAAA;IACZ;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAA;CACpB;AAKD,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,qBAAqB,EACjE,OAAO,EAAE,SAAS,CAAC,EAAE,EACrB,CAAC,EAAE,iBAAiB,GACnB,kBAAkB,CAAC,CAAC,CAAC,CAmBvB;AAkBD;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAO5D;AAED,+DAA+D;AAC/D,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAO/C;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAqB7E;AAuBD,+CAA+C;AAC/C,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAc5C"}
@@ -0,0 +1,188 @@
1
+ /**
2
+ * Pure memory-timeline search — the matching engine behind MemoryStore.query
3
+ * and the assistant's get_transcripts tool.
4
+ *
5
+ * Lives outside MemoryStore so it is unit-testable and importable by the
6
+ * assistant's eval harness (which replays the exact host semantics against a
7
+ * mock corpus). Keep it dependency-free and runtime-neutral: it also runs
8
+ * under bun for tests.
9
+ *
10
+ * TWO MATCH MODES, deliberately different:
11
+ * - `contains`: exact case-insensitive substring — the pre-existing contract,
12
+ * kept verbatim for callers that need precision (codes, URLs, exact phrases).
13
+ * - `terms`: ANY-of term matching with per-word fuzziness. Speech-to-text
14
+ * mangles proper nouns ("Sompo" for "Sampo", "Korwin" for "Corwin"), so a
15
+ * term word matches a transcript token on exact/substring, small edit
16
+ * distance, OR same Soundex key. A multi-word term ("ring size") requires
17
+ * all of its words to match somewhere in the entry.
18
+ *
19
+ * The scan walks BACKWARDS from the newest in-window entry and stops at
20
+ * `limit` matches: the caller keeps the most recent matches anyway, and the
21
+ * common "last 90 minutes" query then touches dozens of entries instead of
22
+ * the full 4000-entry timeline. Window bounds are found by binary search on
23
+ * `at` (the timeline is maintained time-sorted).
24
+ */
25
+ /** Tokenized lowercase text per entry, cached for the entry object's lifetime. */
26
+ const tokenCache = new WeakMap();
27
+ export function searchMemoryEntries(entries, q) {
28
+ const since = q.sinceMs ?? 0;
29
+ const until = q.untilMs ?? Number.MAX_SAFE_INTEGER;
30
+ const lo = lowerBound(entries, since);
31
+ const hi = upperBound(entries, until); // exclusive
32
+ const windowCount = Math.max(0, hi - lo);
33
+ const needle = q.contains?.trim().toLowerCase() || null;
34
+ const termWords = (q.terms ?? []).map((t) => tokenize(t)).filter((words) => words.length > 0);
35
+ const picked = [];
36
+ for (let i = hi - 1; i >= lo && picked.length < q.limit; i--) {
37
+ const e = entries[i];
38
+ if (needle && !e.text.toLowerCase().includes(needle))
39
+ continue;
40
+ if (termWords.length > 0 && !matchesAnyTerm(e, termWords))
41
+ continue;
42
+ picked.push(e);
43
+ }
44
+ picked.reverse();
45
+ return { entries: picked, windowCount };
46
+ }
47
+ /** True when any term matches — a term matches iff ALL its words match a token. */
48
+ function matchesAnyTerm(entry, termWords) {
49
+ let tokens = tokenCache.get(entry);
50
+ if (!tokens) {
51
+ tokens = tokenize(entry.text);
52
+ tokenCache.set(entry, tokens);
53
+ }
54
+ outer: for (const words of termWords) {
55
+ for (const word of words) {
56
+ if (!tokens.some((tok) => fuzzyWordMatch(word, tok)))
57
+ continue outer;
58
+ }
59
+ return true;
60
+ }
61
+ return false;
62
+ }
63
+ /**
64
+ * Does query word `w` match transcript token `t`?
65
+ * - exact, or substring for w of 3+ chars ("kestrel" in "kestrels")
66
+ * - for words of 5+ chars: bounded edit distance (1, or 2 for 7+ chars)
67
+ * — catches one-vowel STT swaps ("sompo"/"sampo", "korwin"/"corwin").
68
+ * 5 is the floor because at 4 chars a one-edit radius swallows unrelated
69
+ * common words ("code"→"mode"); mistranscribed NAMES are almost always 5+.
70
+ * - same Soundex key with similar length — catches phonetic respellings that
71
+ * edit distance misses ("warryn"/"warren" style doublings)
72
+ */
73
+ export function fuzzyWordMatch(w, t) {
74
+ if (w === t)
75
+ return true;
76
+ if (w.length >= 3 && t.includes(w))
77
+ return true;
78
+ if (w.length < 5 || t.length < 4)
79
+ return false;
80
+ const maxDist = w.length >= 7 ? 2 : 1;
81
+ if (Math.abs(w.length - t.length) <= maxDist && editDistanceAtMost(w, t, maxDist))
82
+ return true;
83
+ return Math.abs(w.length - t.length) <= 2 && soundex(w) === soundex(t);
84
+ }
85
+ /** Lowercase, strip diacritics, split on non-alphanumerics. */
86
+ export function tokenize(text) {
87
+ return text
88
+ .toLowerCase()
89
+ .normalize("NFD")
90
+ .replace(/[\u0300-\u036f]/g, "")
91
+ .split(/[^a-z0-9]+/)
92
+ .filter((t) => t.length > 0);
93
+ }
94
+ /**
95
+ * Optimal-string-alignment edit distance, early-exited: returns whether
96
+ * dist(a, b) <= max. Transpositions count as one edit (common in STT output).
97
+ */
98
+ export function editDistanceAtMost(a, b, max) {
99
+ if (Math.abs(a.length - b.length) > max)
100
+ return false;
101
+ let prev2 = null;
102
+ let prev = Array.from({ length: b.length + 1 }, (_, j) => j);
103
+ for (let i = 1; i <= a.length; i++) {
104
+ const cur = [i];
105
+ let rowMin = i;
106
+ for (let j = 1; j <= b.length; j++) {
107
+ const cost = a[i - 1] === b[j - 1] ? 0 : 1;
108
+ let v = Math.min(prev[j] + 1, cur[j - 1] + 1, prev[j - 1] + cost);
109
+ if (prev2 && i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
110
+ v = Math.min(v, prev2[j - 2] + 1);
111
+ }
112
+ cur.push(v);
113
+ if (v < rowMin)
114
+ rowMin = v;
115
+ }
116
+ if (rowMin > max)
117
+ return false;
118
+ prev2 = prev;
119
+ prev = cur;
120
+ }
121
+ return prev[b.length] <= max;
122
+ }
123
+ const SOUNDEX_CODES = {
124
+ b: "1",
125
+ f: "1",
126
+ p: "1",
127
+ v: "1",
128
+ c: "2",
129
+ g: "2",
130
+ j: "2",
131
+ k: "2",
132
+ q: "2",
133
+ s: "2",
134
+ x: "2",
135
+ z: "2",
136
+ d: "3",
137
+ t: "3",
138
+ l: "4",
139
+ m: "5",
140
+ n: "5",
141
+ r: "6",
142
+ };
143
+ /** Classic Soundex. Empty input returns "". */
144
+ export function soundex(word) {
145
+ const w = word.toLowerCase().replace(/[^a-z]/g, "");
146
+ if (!w)
147
+ return "";
148
+ let out = w[0].toUpperCase();
149
+ let lastCode = SOUNDEX_CODES[w[0]] ?? "";
150
+ for (let i = 1; i < w.length && out.length < 4; i++) {
151
+ const ch = w[i];
152
+ const code = SOUNDEX_CODES[ch] ?? "";
153
+ // h/w are transparent: they don't reset the adjacent-duplicate rule.
154
+ if (ch === "h" || ch === "w")
155
+ continue;
156
+ if (code && code !== lastCode)
157
+ out += code;
158
+ lastCode = code;
159
+ }
160
+ return out.padEnd(4, "0");
161
+ }
162
+ /** First index with at >= value (entries time-sorted ascending). */
163
+ function lowerBound(entries, value) {
164
+ let lo = 0;
165
+ let hi = entries.length;
166
+ while (lo < hi) {
167
+ const mid = (lo + hi) >> 1;
168
+ if (entries[mid].at < value)
169
+ lo = mid + 1;
170
+ else
171
+ hi = mid;
172
+ }
173
+ return lo;
174
+ }
175
+ /** First index with at > value (i.e. exclusive end for an inclusive bound). */
176
+ function upperBound(entries, value) {
177
+ let lo = 0;
178
+ let hi = entries.length;
179
+ while (lo < hi) {
180
+ const mid = (lo + hi) >> 1;
181
+ if (entries[mid].at <= value)
182
+ lo = mid + 1;
183
+ else
184
+ hi = mid;
185
+ }
186
+ return lo;
187
+ }
188
+ //# sourceMappingURL=search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/host/memory/search.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AA+BH,kFAAkF;AAClF,MAAM,UAAU,GAAG,IAAI,OAAO,EAAoB,CAAA;AAElD,MAAM,UAAU,mBAAmB,CACjC,OAAqB,EACrB,CAAoB;IAEpB,MAAM,KAAK,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,CAAA;IAC5B,MAAM,KAAK,GAAG,CAAC,CAAC,OAAO,IA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AAA;IACvB,OAAO,EAAE,GAAG,EAAE,EAAE,CAAC;QACf,MAAM,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;QAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,KAAK;YAAE,EAAE,GAAG,GAAG,GAAG,CAAC,CAAA;;YACpC,EAAE,GAAG,GAAG,CAAA;IACf,CAAC;IACD,OAAO,EAAE,CAAA;AACX,CAAC;AAED,+EAA+E;AAC/E,SAAS,UAAU,CAAC,OAAyC,EAAE,KAAa;IAC1E,IAAI,EAAE,GAAG,CAAC,CAAA;IACV,IAAI,EAAE,GAAG,OAAO,CAAC,MAAM,CAAA;IACvB,OAAO,EAAE,GAAG,EAAE,EAAE,CAAC;QACf,MAAM,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;QAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,KAAK;YAAE,EAAE,GAAG,GAAG,GAAG,CAAC,CAAA;;YACrC,EAAE,GAAG,GAAG,CAAA;IACf,CAAC;IACD,OAAO,EAAE,CAAA;AACX,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Whether a miniapp may use an API gated on a manifest permission
3
+ * (miniapp.json -> permissions): `session.miniapps` needs MANAGE_MINIAPPS,
4
+ * `session.settings` PLATFORM_SETTINGS, the notification app list
5
+ * READ_NOTIFICATIONS. System apps pass without declaring it. Pure, so the
6
+ * runtime only does the reply.
7
+ */
8
+ export interface PermissionCaller {
9
+ system: boolean;
10
+ permissions?: ReadonlyArray<{
11
+ type?: string;
12
+ }>;
13
+ }
14
+ export declare function declaresPermission(permissions: PermissionCaller["permissions"], permission: string): boolean;
15
+ export declare function mayUsePermission(caller: PermissionCaller, permission: string): boolean;
16
+ //# sourceMappingURL=miniappPermissions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"miniappPermissions.d.ts","sourceRoot":"","sources":["../../src/host/miniappPermissions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,OAAO,CAAA;IACf,WAAW,CAAC,EAAE,aAAa,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC,CAAA;CAC7C;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,gBAAgB,CAAC,aAAa,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAE5G;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAEtF"}
@@ -0,0 +1,7 @@
1
+ export function declaresPermission(permissions, permission) {
2
+ return (permissions ?? []).some((declared) => declared.type?.toUpperCase() === permission);
3
+ }
4
+ export function mayUsePermission(caller, permission) {
5
+ return caller.system || declaresPermission(caller.permissions, permission);
6
+ }
7
+ //# sourceMappingURL=miniappPermissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"miniappPermissions.js","sourceRoot":"","sources":["../../src/host/miniappPermissions.ts"],"names":[],"mappings":"AAYA,MAAM,UAAU,kBAAkB,CAAC,WAA4C,EAAE,UAAkB;IACjG,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,UAAU,CAAC,CAAA;AAC5F,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,MAAwB,EAAE,UAAkB;IAC3E,OAAO,MAAM,CAAC,MAAM,IAAI,kBAAkB,CAAC,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,CAAA;AAC5E,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * The settings bridge's vocabulary (session.settings): which engine settings
3
+ * a miniapp with the PLATFORM_SETTINGS permission may read or write, the
4
+ * derived read-only keys the engine computes rather than stores, and the
5
+ * request validation. Pure, so the runtime's handlers stay thin and this can
6
+ * be tested without the native import surface the runtime pulls in.
7
+ *
8
+ * A dashboard miniapp is the usual consumer: it edits the notification,
9
+ * glasses-menu, display-position, brightness and microphone keys the phone's
10
+ * settings screens do, through the store, so persistence, server sync and the
11
+ * Bluetooth sync behave as if a phone screen wrote them. A dashboard's own
12
+ * look is not here; it keeps that in its storage.
13
+ */
14
+ export type SettingsBridgeAccess = "read" | "write";
15
+ /** Stored settings the bridge serves, by key, with what a permitted app may do to each. */
16
+ export declare const SETTINGS_BRIDGE_KEYS: Readonly<Record<string, SettingsBridgeAccess>>;
17
+ /** A stored key's default, as a fresh copy; undefined for a key the bridge does not store. */
18
+ export declare function settingsBridgeDefault(key: string): unknown;
19
+ /**
20
+ * Read-only keys the engine computes: whether the wearer can see the phone,
21
+ * whether the foreground miniapp is drawing on the glasses, and the paired
22
+ * controllers with their battery and input. They change on their own clocks;
23
+ * the runtime pushes them like stored keys.
24
+ */
25
+ export declare const DERIVED_SETTINGS_KEYS: readonly ["phone_active", "foreground_app_on_screen", "controllers"];
26
+ export type DerivedSettingsKey = (typeof DERIVED_SETTINGS_KEYS)[number];
27
+ export declare function isDerivedSettingsKey(key: string): key is DerivedSettingsKey;
28
+ /** What a permitted app may do with `key`, or null when the bridge does not serve it. */
29
+ export declare function settingsBridgeAccess(key: string): SettingsBridgeAccess | null;
30
+ /** Every key the bridge serves, stored then derived. */
31
+ export declare function allSettingsBridgeKeys(): string[];
32
+ /**
33
+ * The keys a SETTINGS_GET asks for: everything when `requested` is absent,
34
+ * else the known ones among the requested strings (unknown keys are left
35
+ * out, never rejected).
36
+ */
37
+ export declare function selectSettingsBridgeKeys(requested: unknown): string[];
38
+ export type SettingsSetValidation = {
39
+ ok: true;
40
+ key: string;
41
+ value: unknown;
42
+ } | {
43
+ ok: false;
44
+ code: "INVALID_ARGUMENT" | "NOT_PERMITTED";
45
+ message: string;
46
+ };
47
+ /** A SETTINGS_SET payload: a writable key and a JSON value (undefined is not a value). */
48
+ export declare function validateSettingsSet(payload: Record<string, unknown>): SettingsSetValidation;
49
+ //# sourceMappingURL=settingsBridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settingsBridge.d.ts","sourceRoot":"","sources":["../../src/host/settingsBridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,OAAO,CAAA;AAEnD,2FAA2F;AAC3F,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAsB/E,CAAA;AAsBD,8FAA8F;AAC9F,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAG1D;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,sEAAuE,CAAA;AACzG,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvE,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,kBAAkB,CAE3E;AAED,yFAAyF;AACzF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAG7E;AAED,wDAAwD;AACxD,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,EAAE,CAIrE;AAED,MAAM,MAAM,qBAAqB,GAC/B;IAAC,EAAE,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAC,GAAG;IAAC,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,kBAAkB,GAAG,eAAe,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,CAAA;AAEpH,0FAA0F;AAC1F,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,qBAAqB,CAY3F"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * The settings bridge's vocabulary (session.settings): which engine settings
3
+ * a miniapp with the PLATFORM_SETTINGS permission may read or write, the
4
+ * derived read-only keys the engine computes rather than stores, and the
5
+ * request validation. Pure, so the runtime's handlers stay thin and this can
6
+ * be tested without the native import surface the runtime pulls in.
7
+ *
8
+ * A dashboard miniapp is the usual consumer: it edits the notification,
9
+ * glasses-menu, display-position, brightness and microphone keys the phone's
10
+ * settings screens do, through the store, so persistence, server sync and the
11
+ * Bluetooth sync behave as if a phone screen wrote them. A dashboard's own
12
+ * look is not here; it keeps that in its storage.
13
+ */
14
+ /** Stored settings the bridge serves, by key, with what a permitted app may do to each. */
15
+ export const SETTINGS_BRIDGE_KEYS = {
16
+ // The dashboard's master switch is a phone-side debug knob.
17
+ custom_dashboard_enabled: "read",
18
+ head_up_angle: "write",
19
+ // Where the glasses draw; each model's steps are its display.positionRange.
20
+ dashboard_depth: "write",
21
+ dashboard_height: "write",
22
+ // Device settings the dashboard's glasses Settings page edits.
23
+ brightness: "write",
24
+ auto_brightness: "write",
25
+ // Per paired model: the store resolves the indexed key.
26
+ preferred_mic: "write",
27
+ menu_apps: "write",
28
+ notifications_enabled: "write",
29
+ notifications_popups: "write",
30
+ notifications_popup_seconds: "write",
31
+ notifications_batch_seconds: "write",
32
+ notifications_hold_during_apps: "write",
33
+ notifications_ignore_while_active: "write",
34
+ notifications_blocklist: "write",
35
+ // Apps the glasses reported posting notifications; the engine records it.
36
+ notification_seen_apps: "read",
37
+ };
38
+ // What each stored key holds until someone writes it; the Glassly App's settings store reads these.
39
+ const SETTINGS_BRIDGE_DEFAULTS = {
40
+ custom_dashboard_enabled: true,
41
+ head_up_angle: 45,
42
+ dashboard_depth: 2,
43
+ dashboard_height: 4,
44
+ brightness: 50,
45
+ auto_brightness: true,
46
+ preferred_mic: "auto",
47
+ menu_apps: null,
48
+ notifications_enabled: true,
49
+ notifications_popups: true,
50
+ notifications_popup_seconds: 5,
51
+ notifications_batch_seconds: 0,
52
+ notifications_hold_during_apps: true,
53
+ notifications_ignore_while_active: true,
54
+ notifications_blocklist: [],
55
+ notification_seen_apps: [],
56
+ };
57
+ /** A stored key's default, as a fresh copy; undefined for a key the bridge does not store. */
58
+ export function settingsBridgeDefault(key) {
59
+ const value = SETTINGS_BRIDGE_DEFAULTS[key];
60
+ return value !== null && typeof value === "object" ? JSON.parse(JSON.stringify(value)) : value;
61
+ }
62
+ /**
63
+ * Read-only keys the engine computes: whether the wearer can see the phone,
64
+ * whether the foreground miniapp is drawing on the glasses, and the paired
65
+ * controllers with their battery and input. They change on their own clocks;
66
+ * the runtime pushes them like stored keys.
67
+ */
68
+ export const DERIVED_SETTINGS_KEYS = ["phone_active", "foreground_app_on_screen", "controllers"];
69
+ export function isDerivedSettingsKey(key) {
70
+ return DERIVED_SETTINGS_KEYS.includes(key);
71
+ }
72
+ /** What a permitted app may do with `key`, or null when the bridge does not serve it. */
73
+ export function settingsBridgeAccess(key) {
74
+ if (isDerivedSettingsKey(key))
75
+ return "read";
76
+ return SETTINGS_BRIDGE_KEYS[key] ?? null;
77
+ }
78
+ /** Every key the bridge serves, stored then derived. */
79
+ export function allSettingsBridgeKeys() {
80
+ return [...Object.keys(SETTINGS_BRIDGE_KEYS), ...DERIVED_SETTINGS_KEYS];
81
+ }
82
+ /**
83
+ * The keys a SETTINGS_GET asks for: everything when `requested` is absent,
84
+ * else the known ones among the requested strings (unknown keys are left
85
+ * out, never rejected).
86
+ */
87
+ export function selectSettingsBridgeKeys(requested) {
88
+ if (requested === undefined || requested === null)
89
+ return allSettingsBridgeKeys();
90
+ if (!Array.isArray(requested))
91
+ return [];
92
+ return requested.filter((key) => typeof key === "string" && settingsBridgeAccess(key) !== null);
93
+ }
94
+ /** A SETTINGS_SET payload: a writable key and a JSON value (undefined is not a value). */
95
+ export function validateSettingsSet(payload) {
96
+ const key = payload.key;
97
+ if (typeof key !== "string" || !key) {
98
+ return { ok: false, code: "INVALID_ARGUMENT", message: "settings.set requires a key" };
99
+ }
100
+ const access = settingsBridgeAccess(key);
101
+ if (access === null)
102
+ return { ok: false, code: "INVALID_ARGUMENT", message: `Unknown setting "${key}"` };
103
+ if (access !== "write")
104
+ return { ok: false, code: "NOT_PERMITTED", message: `Setting "${key}" is read-only` };
105
+ if (!("value" in payload) || payload.value === undefined) {
106
+ return { ok: false, code: "INVALID_ARGUMENT", message: "settings.set requires a value" };
107
+ }
108
+ return { ok: true, key, value: payload.value };
109
+ }
110
+ //# sourceMappingURL=settingsBridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settingsBridge.js","sourceRoot":"","sources":["../../src/host/settingsBridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,2FAA2F;AAC3F,MAAM,CAAC,MAAM,oBAAoB,GAAmD;IAClF,4DAA4D;IAC5D,wBAAwB,EAAE,MAAM;IAChC,aAAa,EAAE,OAAO;IACtB,4EAA4E;IAC5E,eAAe,EAAE,OAAO;IACxB,gBAAgB,EAAE,OAAO;IACzB,+DAA+D;IAC/D,UAAU,EAAE,OAAO;IACnB,eAAe,EAAE,OAAO;IACxB,wDAAwD;IACxD,aAAa,EAAE,OAAO;IACtB,SAAS,EAAE,OAAO;IAClB,qBAAqB,EAAE,OAAO;IAC9B,oBAAoB,EAAE,OAAO;IAC7B,2BAA2B,EAAE,OAAO;IACpC,2BAA2B,EAAE,OAAO;IACpC,8BAA8B,EAAE,OAAO;IACvC,iCAAiC,EAAE,OAAO;IAC1C,uBAAuB,EAAE,OAAO;IAChC,0EAA0E;IAC1E,sBAAsB,EAAE,MAAM;CAC/B,CAAA;AAED,oGAAoG;AACpG,MAAM,wBAAwB,GAAsC;IAClE,wBAAwB,EAAE,IAAI;IAC9B,aAAa,EAAE,EAAE;IACjB,eAAe,EAAE,CAAC;IAClB,gBAAgB,EAAE,CAAC;IACnB,UAAU,EAAE,EAA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C,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Who placed which widget where: the pure bookkeeping behind the runtime's
3
+ * widget routing. A placement is one host's box for one provider widget;
4
+ * a provider is placed while any host holds one of its widgets. Frames are
5
+ * kept per widget and view so a host that places one again gets the last
6
+ * card and expanded frames at once.
7
+ */
8
+ export type WidgetView = "card" | "expanded";
9
+ export interface WidgetBox {
10
+ size: "XS" | "XSM" | "SM" | "MD" | "LG";
11
+ width: number;
12
+ height: number;
13
+ }
14
+ export interface Placement {
15
+ hostPackageName: string;
16
+ providerPackageName: string;
17
+ widgetId: string;
18
+ box: WidgetBox;
19
+ }
20
+ export interface WidgetPlacements {
21
+ /** Keyed by `${host}|${provider}/${widgetId}`. */
22
+ placements: ReadonlyMap<string, Placement>;
23
+ /** The latest frame per `${provider}/${widgetId}` and view. */
24
+ frames: ReadonlyMap<string, Readonly<Partial<Record<WidgetView, unknown[]>>>>;
25
+ }
26
+ export declare const widgetKey: (providerPackageName: string, widgetId: string) => string;
27
+ export declare function emptyWidgetPlacements(): WidgetPlacements;
28
+ export declare function placeWidget(state: WidgetPlacements, placement: Placement): WidgetPlacements;
29
+ export declare function unplaceWidget(state: WidgetPlacements, hostPackageName: string, providerPackageName: string, widgetId: string): WidgetPlacements;
30
+ /** A host went away: drop everything it placed. */
31
+ export declare function dropHost(state: WidgetPlacements, hostPackageName: string): WidgetPlacements;
32
+ /** A provider went away: drop its placements, keep its frames for the placeholder. */
33
+ export declare function dropProvider(state: WidgetPlacements, providerPackageName: string): WidgetPlacements;
34
+ export declare function setFrame(state: WidgetPlacements, providerPackageName: string, widgetId: string, elements: unknown[], view?: WidgetView): WidgetPlacements;
35
+ export declare function frameOf(state: WidgetPlacements, providerPackageName: string, widgetId: string, view?: WidgetView): unknown[] | null;
36
+ export declare function placementOf(state: WidgetPlacements, hostPackageName: string, providerPackageName: string, widgetId: string): Placement | null;
37
+ /** Hosts holding this widget, each once. */
38
+ export declare function hostsOf(state: WidgetPlacements, providerPackageName: string, widgetId: string): string[];
39
+ /** Providers with at least one widget placed. */
40
+ export declare function placedProviders(state: WidgetPlacements): Set<string>;
41
+ export declare function isProviderPlaced(state: WidgetPlacements, providerPackageName: string): boolean;
42
+ /** The placements a host holds on a provider, for re-delivering boxes. */
43
+ export declare function placementsBy(state: WidgetPlacements, hostPackageName: string): Placement[];
44
+ //# sourceMappingURL=widgetPlacements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widgetPlacements.d.ts","sourceRoot":"","sources":["../../src/host/widgetPlacements.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,UAAU,CAAA;AAE5C,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IACvC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,SAAS;IACxB,eAAe,EAAE,MAAM,CAAA;IACvB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,SAAS,CAAA;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,kDAAkD;IAClD,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAC1C,+DAA+D;IAC/D,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;CAC9E;AAED,eAAO,MAAM,SAAS,GAAI,qBAAqB,MAAM,EAAE,UAAU,MAAM,KAAG,MAA8C,CAAA;AAIxH,wBAAgB,qBAAqB,IAAI,gBAAgB,CAExD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,GAAG,gBAAgB,CAI3F;AAED,wBAAgB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E,eAAe,EAAE,MAAM,GAAG,SAAS,EAAE,CAE1F"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Who placed which widget where: the pure bookkeeping behind the runtime's
3
+ * widget routing. A placement is one host's box for one provider widget;
4
+ * a provider is placed while any host holds one of its widgets. Frames are
5
+ * kept per widget and view so a host that places one again gets the last
6
+ * card and expanded frames at once.
7
+ */
8
+ export const widgetKey = (providerPackageName, widgetId) => `${providerPackageName}/${widgetId}`;
9
+ const placementKey = (hostPackageName, providerPackageName, widgetId) => `${hostPackageName}|${widgetKey(providerPackageName, widgetId)}`;
10
+ export function emptyWidgetPlacements() {
11
+ return { placements: new Map(), frames: new Map() };
12
+ }
13
+ export function placeWidget(state, placement) {
14
+ const placements = new Map(state.placements);
15
+ placements.set(placementKey(placement.hostPackageName, placement.providerPackageName, placement.widgetId), placement);
16
+ return { ...state, placements };
17
+ }
18
+ export function unplaceWidget(state, hostPackageName, providerPackageName, widgetId) {
19
+ const key = placementKey(hostPackageName, providerPackageName, widgetId);
20
+ if (!state.placements.has(key))
21
+ return state;
22
+ const placements = new Map(state.placements);
23
+ placements.delete(key);
24
+ return { ...state, placements };
25
+ }
26
+ /** A host went away: drop everything it placed. */
27
+ export function dropHost(state, hostPackageName) {
28
+ const placements = new Map(state.placements);
29
+ for (const [key, placement] of state.placements) {
30
+ if (placement.hostPackageName === hostPackageName)
31
+ placements.delete(key);
32
+ }
33
+ return placements.size === state.placements.size ? state : { ...state, placements };
34
+ }
35
+ /** A provider went away: drop its placements, keep its frames for the placeholder. */
36
+ export function dropProvider(state, providerPackageName) {
37
+ const placements = new Map(state.placements);
38
+ for (const [key, placement] of state.placements) {
39
+ if (placement.providerPackageName === providerPackageName)
40
+ placements.delete(key);
41
+ }
42
+ return placements.size === state.placements.size ? state : { ...state, placements };
43
+ }
44
+ export function setFrame(state, providerPackageName, widgetId, elements, view = "card") {
45
+ const key = widgetKey(providerPackageName, widgetId);
46
+ const frames = new Map(state.frames);
47
+ frames.set(key, { ...state.frames.get(key), [view]: elements });
48
+ return { ...state, frames };
49
+ }
50
+ export function frameOf(state, providerPackageName, widgetId, view = "card") {
51
+ return state.frames.get(widgetKey(providerPackageName, widgetId))?.[view] ?? null;
52
+ }
53
+ export function placementOf(state, hostPackageName, providerPackageName, widgetId) {
54
+ return state.placements.get(placementKey(hostPackageName, providerPackageName, widgetId)) ?? null;
55
+ }
56
+ /** Hosts holding this widget, each once. */
57
+ export function hostsOf(state, providerPackageName, widgetId) {
58
+ const hosts = new Set();
59
+ for (const placement of state.placements.values()) {
60
+ if (placement.providerPackageName === providerPackageName && placement.widgetId === widgetId) {
61
+ hosts.add(placement.hostPackageName);
62
+ }
63
+ }
64
+ return Array.from(hosts);
65
+ }
66
+ /** Providers with at least one widget placed. */
67
+ export function placedProviders(state) {
68
+ const providers = new Set();
69
+ for (const placement of state.placements.values())
70
+ providers.add(placement.providerPackageName);
71
+ return providers;
72
+ }
73
+ export function isProviderPlaced(state, providerPackageName) {
74
+ for (const placement of state.placements.values()) {
75
+ if (placement.providerPackageName === providerPackageName)
76
+ return true;
77
+ }
78
+ return false;
79
+ }
80
+ /** The placements a host holds on a provider, for re-delivering boxes. */
81
+ export function placementsBy(state, hostPackageName) {
82
+ return Array.from(state.placements.values()).filter((placement) => placement.hostPackageName === hostPackageName);
83
+ }
84
+ //# sourceMappingURL=widgetPlacements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widgetPlacements.js","sourceRoot":"","sources":["../../src/host/widgetPlacements.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAwBH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,mBAA2B,EAAE,QAAgB,EAAU,EAAE,CAAC,GAAG,mBAAmB,IAAI,QAAQ,EAAE,CAAA;AACxH,MAAM,YAAY,GAAG,CAAC,eAAuB,EAAE,mBAA2B,EAAE,QAAgB,EAAU,EAAE,CACtG,GAAG,eAAe,IAAI,SAAS,CAAC,mBAAmB,EAAE,QAAQ,CAAC,EAAE,C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AAK,mBAAmB;YAAE,OAAO,IAAI,CAAA;IACxE,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,YAAY,CAAC,KAAuB,EAAE,eAAuB;IAC3E,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,eAAe,KAAK,eAAe,CAAC,CAAA;AACnH,CAAC"}
package/dist/session.d.ts CHANGED
@@ -94,6 +94,12 @@ export interface DisplayCapabilities {
94
94
  * glasses can show the overlay slot (see display.showView).
95
95
  */
96
96
  views?: Array<"main" | "dashboard">;
97
+ /**
98
+ * Id of the display profile the Glassly App wraps this app's text with right
99
+ * now (see `textProfileFor` in `@glassly/miniapp/display`). Absent on older
100
+ * Glassly App versions.
101
+ */
102
+ textProfile?: string;
97
103
  /** Legacy capability fields (resolution, isColor, maxTextLines, …) ride along. */
98
104
  [key: string]: unknown;
99
105
  }