akanjs 3.4.0-rc.3 → 3.4.0-rc.5

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": "akanjs",
3
- "version": "3.4.0-rc.3",
3
+ "version": "3.4.0-rc.5",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -47,7 +47,7 @@ export const SYSTEM_PAGE_STYLE = `
47
47
  body { margin: 0; min-height: 100vh; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--akan-background); color: var(--akan-foreground); }
48
48
  a { color: inherit; }
49
49
  .akan-system-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 18px; box-sizing: border-box; background: radial-gradient(circle at top left, rgba(255, 73, 59, 0.16), transparent 34%), linear-gradient(135deg, var(--akan-background), #111); }
50
- .akan-system-card { width: min(720px, 100%); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 32px; background: linear-gradient(145deg, rgba(42, 42, 42, 0.96), rgba(43, 46, 51, 0.78)); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36); padding: clamp(28px, 6vw, 56px); }
50
+ .akan-system-card { box-sizing: border-box; width: min(720px, 100%); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 32px; background: linear-gradient(145deg, rgba(42, 42, 42, 0.96), rgba(43, 46, 51, 0.78)); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36); padding: clamp(28px, 6vw, 56px); }
51
51
  .akan-system-status { margin: 0 0 18px; font-weight: 800; font-size: clamp(4rem, 18vw, 8rem); line-height: 0.85; letter-spacing: -0.08em; color: var(--akan-primary); }
52
52
  .akan-system-eyebrow { margin: 0 0 10px; color: var(--akan-accent); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; }
53
53
  .akan-system-title { margin: 0; max-width: 12ch; font-size: clamp(2rem, 7vw, 4rem); line-height: 0.95; letter-spacing: -0.055em; color: var(--akan-foreground); }
@@ -11,6 +11,15 @@ export class AgentCursor {
11
11
  static readonly driftBy = 18;
12
12
  /** Fade delay after the last call, for a host that reports no turn boundary (one that does calls `hold`). */
13
13
  static readonly idleMs = 1400;
14
+ static readonly #travelMax = 600;
15
+ static readonly #dwellMs = 420;
16
+ static #landsAt = 0;
17
+ static #waiting: ReturnType<typeof setTimeout> | null = null;
18
+ static readonly #hopFrom = 48;
19
+ static readonly #lingerMs = 6000;
20
+ static readonly #coveredMs = 360;
21
+ static readonly #recallMs = 8000;
22
+ static #left: { x: number; y: number; at: number } | null = null;
14
23
  static readonly thinkingClass = "akan-agent-cursor-thinking";
15
24
  static readonly scrollingClass = "akan-agent-cursor-scrolling";
16
25
 
@@ -24,16 +33,22 @@ export class AgentCursor {
24
33
  static press(target: HTMLElement): Promise<void> {
25
34
  if (typeof document === "undefined") return Promise.resolve();
26
35
  AgentCursor.#el?.classList.remove(AgentCursor.thinkingClass);
36
+ AgentCursor.#stopWaiting();
27
37
  return new Promise((resolve) => {
28
- ScreenFlash.whenStill(target, () => {
38
+
39
+ const land = (isFirst: boolean) => {
29
40
  if (!ScreenFlash.onTop(target)) {
30
- AgentCursor.hide();
31
- resolve();
41
+ if (isFirst) setTimeout(() => land(false), AgentCursor.#coveredMs);
42
+ else {
43
+ AgentCursor.#stopScrolling();
44
+ resolve();
45
+ }
32
46
  return;
33
47
  }
34
48
  const { top, left, width, height, right, bottom } = target.getBoundingClientRect();
35
49
  AgentCursor.#pressed = { top, left, right, bottom };
36
50
  const travel = AgentCursor.#moveTo(left + width / 2, top + height / 2);
51
+ AgentCursor.#landsAt = Date.now() + travel;
37
52
 
38
53
  if (travel)
39
54
  setTimeout(() => {
@@ -44,7 +59,8 @@ export class AgentCursor {
44
59
  AgentCursor.#tap();
45
60
  resolve();
46
61
  }
47
- });
62
+ };
63
+ ScreenFlash.whenStill(target, () => land(true));
48
64
  });
49
65
  }
50
66
 
@@ -63,15 +79,30 @@ export class AgentCursor {
63
79
  AgentCursor.#idle = null;
64
80
  }
65
81
 
82
+ /** A turn's end leaves the pointer where it is for a moment: a run of several turns then travels on from there. */
66
83
  static release() {
67
84
  AgentCursor.#held = false;
68
- AgentCursor.hide();
85
+ AgentCursor.#el?.classList.remove(AgentCursor.thinkingClass);
86
+ if (AgentCursor.#idle) clearTimeout(AgentCursor.#idle);
87
+ AgentCursor.#idle = setTimeout(() => {
88
+ AgentCursor.#idle = null;
89
+ AgentCursor.hide();
90
+ }, AgentCursor.#lingerMs);
69
91
  }
70
92
 
71
93
  /** Drifts clear of the last pressed control and shows the waiting spinner; a no-op before the first press. */
72
94
  static think() {
73
95
  const el = AgentCursor.#el;
74
96
  if (!el?.isConnected) return;
97
+ AgentCursor.#stopWaiting();
98
+ const wait = AgentCursor.#landsAt + AgentCursor.#dwellMs - Date.now();
99
+ if (wait > 0) {
100
+ AgentCursor.#waiting = setTimeout(() => {
101
+ AgentCursor.#waiting = null;
102
+ AgentCursor.think();
103
+ }, wait);
104
+ return;
105
+ }
75
106
  el.classList.remove(`${AgentCursor.className}-tap`);
76
107
  AgentCursor.#driftOff();
77
108
  el.classList.add(AgentCursor.thinkingClass);
@@ -91,10 +122,12 @@ export class AgentCursor {
91
122
  }
92
123
 
93
124
  static hide() {
125
+ AgentCursor.#stopWaiting();
94
126
  AgentCursor.#pressed = null;
95
127
  AgentCursor.#stopScrolling();
96
128
  AgentCursor.#el?.classList.remove(AgentCursor.thinkingClass);
97
129
  AgentCursor.#el?.classList.remove(`${AgentCursor.className}-shown`);
130
+ if (AgentCursor.#at) AgentCursor.#left = { ...AgentCursor.#at, at: Date.now() };
98
131
  AgentCursor.#at = null;
99
132
  const el = AgentCursor.#el;
100
133
  setTimeout(() => {
@@ -104,6 +137,12 @@ export class AgentCursor {
104
137
  }, 400);
105
138
  }
106
139
 
140
+ /** A call can end while the pointer is still on its way: the drift to the waiting spot holds until the press has shown. */
141
+ static #stopWaiting() {
142
+ if (AgentCursor.#waiting) clearTimeout(AgentCursor.#waiting);
143
+ AgentCursor.#waiting = null;
144
+ }
145
+
107
146
  static #stopScrolling() {
108
147
  AgentCursor.#el?.classList.remove(AgentCursor.scrollingClass, `${AgentCursor.scrollingClass}-up`);
109
148
  }
@@ -112,10 +151,13 @@ export class AgentCursor {
112
151
  const el = AgentCursor.#mounted();
113
152
  AgentCursor.#stopScrolling();
114
153
  el.classList.remove(AgentCursor.thinkingClass);
115
- const at = AgentCursor.#at;
116
-
117
- const travel = at && Math.hypot(x - at.x, y - at.y) >= AgentCursor.travelFrom ? AgentCursor.travelMs : 0;
118
-
154
+ const from = AgentCursor.#at ?? AgentCursor.#entryOf(el);
155
+ const distance = Math.hypot(x - from.x, y - from.y);
156
+ const travel =
157
+ distance >= AgentCursor.#hopFrom
158
+ ? Math.round(Math.min(AgentCursor.#travelMax, Math.max(AgentCursor.travelMs, 220 + distance * 0.55)))
159
+ : 0;
160
+ el.style.setProperty("--akan-agent-travel", `${travel || AgentCursor.travelMs}ms`);
119
161
  if (!travel) el.classList.add(`${AgentCursor.className}-placing`);
120
162
  el.style.transform = `translate3d(${Math.round(x)}px, ${Math.round(y)}px, 0)`;
121
163
  if (!travel) {
@@ -128,6 +170,20 @@ export class AgentCursor {
128
170
  return travel;
129
171
  }
130
172
 
173
+ /** Where a pointer with no place yet comes from: where it last left the screen, else the screen's far corner. */
174
+ static #entryOf(el: HTMLElement): { x: number; y: number } {
175
+ const left = AgentCursor.#left;
176
+ const from =
177
+ left && Date.now() - left.at < AgentCursor.#recallMs
178
+ ? { x: left.x, y: left.y }
179
+ : { x: window.innerWidth - 48, y: window.innerHeight - 48 };
180
+ el.classList.add(`${AgentCursor.className}-placing`);
181
+ el.style.transform = `translate3d(${Math.round(from.x)}px, ${Math.round(from.y)}px, 0)`;
182
+ void el.offsetWidth;
183
+ el.classList.remove(`${AgentCursor.className}-placing`);
184
+ return from;
185
+ }
186
+
131
187
  static #tap() {
132
188
  const el = AgentCursor.#el;
133
189
  if (!el) return;
@@ -17,8 +17,10 @@ export class AgentVisual {
17
17
  static readonly revealCap = 4;
18
18
  /** How many of a form patch's fields are drawn. */
19
19
  static readonly fieldCap = 5;
20
- /** The longest a navigate call waits for its press to land. */
20
+ /** The longest a call waits for its press to land. */
21
21
  static readonly leadMs = 600;
22
+ static readonly #pressable = "button, a[href], [role='button'], input, select, textarea";
23
+ static readonly #cornerPx = 96;
22
24
 
23
25
  static #revealed = 0;
24
26
  static #idle: ReturnType<typeof setTimeout> | null = null;
@@ -59,7 +61,7 @@ export class AgentVisual {
59
61
  AgentVisual.#acting += 1;
60
62
  const pressed = AgentVisual.#targetsOf(event).map((target) => AgentVisual.#act(target, { reveal, cursor }));
61
63
 
62
- if (!cursor || !pressed.length || !AgentVisual.#navigating(event.name)) return;
64
+ if (!cursor || !pressed.length) return;
63
65
  return AgentVisual.#capped(Promise.all(pressed));
64
66
  }
65
67
 
@@ -74,7 +76,10 @@ export class AgentVisual {
74
76
  static #targetsOf(event: ToolActivity): HTMLElement[] {
75
77
  if (AgentVisual.#navigating(event.name)) return AgentVisual.#linkTo(event.args.path);
76
78
  const form = AgentVisual.#formOf(event.name);
77
- if (!form) return AgentVisual.#only(ScreenTarget.controls(event.name), event.args);
79
+ if (!form) {
80
+ const controls = AgentVisual.#only(AgentVisual.#controlsOf(event.name), event.args);
81
+ return controls.length ? controls : AgentVisual.#closeOf(event.name);
82
+ }
78
83
  return Object.keys(event.args)
79
84
  .slice(0, AgentVisual.fieldCap)
80
85
  .flatMap((key) => AgentVisual.#only(ScreenTarget.controls(`${form}.${key}`)));
@@ -107,6 +112,37 @@ export class AgentVisual {
107
112
  return pressed;
108
113
  }
109
114
 
115
+ /** A control marked on a wrapper with no box of its own (`display: contents`) is pressed on what the wrapper holds. */
116
+ static #controlsOf(name: string): HTMLElement[] {
117
+ const marked = ScreenTarget.controls(name);
118
+ if (marked.length || !document.body) return marked;
119
+ const holders = document.body.querySelectorAll<HTMLElement>(`[data-akan-action="${CSS.escape(name)}"]`);
120
+ return [...holders].flatMap((holder) => {
121
+ const held = [...holder.querySelectorAll<HTMLElement>(AgentVisual.#pressable)].find(ScreenTarget.visible);
122
+ return held ? [held] : [];
123
+ });
124
+ }
125
+
126
+ /** Leaving a form (`cancelEditOf<Model>`) has no marked control: the pointer takes the button at the top corner of the dialog holding that form. */
127
+ static #closeOf(name: string): HTMLElement[] {
128
+ const match = /^cancelEditOf([A-Z]\w*)$/.exec(name.slice(name.lastIndexOf(".") + 1));
129
+ if (!match || !document.body) return [];
130
+ const held = `[data-akan-action$="On${match[1]}"], [data-akan-action="submit${match[1]}"]`;
131
+ const dialog = [...document.body.querySelectorAll<HTMLElement>('[role="dialog"]')]
132
+ .reverse()
133
+ .find((one) => ScreenTarget.visible(one) && one.querySelector(held));
134
+ if (!dialog) return [];
135
+ const box = dialog.getBoundingClientRect();
136
+ const farOf = (button: HTMLElement) => {
137
+ const at = button.getBoundingClientRect();
138
+ return Math.hypot(box.right - (at.left + at.width / 2), box.top - (at.top + at.height / 2));
139
+ };
140
+ const [nearest] = [...dialog.querySelectorAll<HTMLElement>("button")]
141
+ .filter((button) => ScreenTarget.visible(button) && !button.closest("[data-akan-action], [data-akan-state]"))
142
+ .sort((a, b) => farOf(a) - farOf(b));
143
+ return nearest && farOf(nearest) <= AgentVisual.#cornerPx ? [nearest] : [];
144
+ }
145
+
110
146
  static #linkTo(path: unknown): HTMLElement[] {
111
147
  const wanted = ScreenTarget.routeOf(typeof path === "string" ? path : "");
112
148
  if (!wanted || !document.body) return [];
@@ -114,7 +150,7 @@ export class AgentVisual {
114
150
  (link) =>
115
151
  ScreenTarget.routeOf(ScreenReader.hrefOf(link)) === wanted &&
116
152
  ScreenTarget.visible(link) &&
117
- ScreenFlash.inView(link),
153
+ ScreenFlash.inView(link, 0),
118
154
  );
119
155
  return AgentVisual.#only(links);
120
156
  }
@@ -32,7 +32,8 @@ export class ScreenFlash {
32
32
 
33
33
  /** Painted at its own centre, not just laid out — `checkVisibility` passes a control under a modal backdrop. */
34
34
  static onTop(target: HTMLElement) {
35
- if (!ScreenFlash.inView(target)) return false;
35
+
36
+ if (!ScreenFlash.inView(target, 0)) return false;
36
37
  if (typeof document.elementFromPoint !== "function") return true;
37
38
  const { top, left, width, height } = target.getBoundingClientRect();
38
39
  const hit = document.elementFromPoint(left + width / 2, top + height / 2);
@@ -36,7 +36,7 @@ export declare const SYSTEM_PAGE_STATUS_COPY: {
36
36
  readonly actionLabel: "Back to safety";
37
37
  };
38
38
  };
39
- export declare const SYSTEM_PAGE_STYLE = "\n:root { color-scheme: dark; --akan-primary: #ff493b; --akan-secondary: #2b2e33; --akan-accent: #d1a23b; --akan-foreground: #ffffff; --akan-background: #1a1a1a; --akan-error: #f02020; }\nbody { margin: 0; min-height: 100vh; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif; background: var(--akan-background); color: var(--akan-foreground); }\na { color: inherit; }\n.akan-system-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 18px; box-sizing: border-box; background: radial-gradient(circle at top left, rgba(255, 73, 59, 0.16), transparent 34%), linear-gradient(135deg, var(--akan-background), #111); }\n.akan-system-card { width: min(720px, 100%); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 32px; background: linear-gradient(145deg, rgba(42, 42, 42, 0.96), rgba(43, 46, 51, 0.78)); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36); padding: clamp(28px, 6vw, 56px); }\n.akan-system-status { margin: 0 0 18px; font-weight: 800; font-size: clamp(4rem, 18vw, 8rem); line-height: 0.85; letter-spacing: -0.08em; color: var(--akan-primary); }\n.akan-system-eyebrow { margin: 0 0 10px; color: var(--akan-accent); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; }\n.akan-system-title { margin: 0; max-width: 12ch; font-size: clamp(2rem, 7vw, 4rem); line-height: 0.95; letter-spacing: -0.055em; color: var(--akan-foreground); }\n.akan-system-description { margin: 22px 0 0; max-width: 56ch; color: rgba(255, 255, 255, 0.76); font-size: 1.05rem; line-height: 1.75; }\n.akan-system-path { margin: 22px 0 0; overflow-wrap: anywhere; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 16px; background: rgba(26, 26, 26, 0.72); padding: 12px 14px; color: rgba(255, 255, 255, 0.72); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.88rem; }\n.akan-system-actions { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 12px; }\n.akan-system-action { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; border: 1px solid var(--akan-primary); border-radius: 999px; background: var(--akan-primary); box-shadow: 0 12px 34px rgba(255, 73, 59, 0.26); color: var(--akan-foreground); padding: 0 18px; font-weight: 800; text-decoration: none; }\n.akan-system-secondary { border: 1px solid rgba(255, 255, 255, 0.12); background: var(--akan-secondary); color: var(--akan-foreground); }\n.akan-system-details { margin-top: 28px; max-height: 260px; overflow: auto; border-radius: 18px; background: rgba(26, 26, 26, 0.82); border: 1px solid rgba(240, 32, 32, 0.22); padding: 16px; color: rgba(255, 255, 255, 0.78); font-size: 0.82rem; line-height: 1.55; white-space: pre-wrap; }\n";
39
+ export declare const SYSTEM_PAGE_STYLE = "\n:root { color-scheme: dark; --akan-primary: #ff493b; --akan-secondary: #2b2e33; --akan-accent: #d1a23b; --akan-foreground: #ffffff; --akan-background: #1a1a1a; --akan-error: #f02020; }\nbody { margin: 0; min-height: 100vh; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif; background: var(--akan-background); color: var(--akan-foreground); }\na { color: inherit; }\n.akan-system-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 18px; box-sizing: border-box; background: radial-gradient(circle at top left, rgba(255, 73, 59, 0.16), transparent 34%), linear-gradient(135deg, var(--akan-background), #111); }\n.akan-system-card { box-sizing: border-box; width: min(720px, 100%); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 32px; background: linear-gradient(145deg, rgba(42, 42, 42, 0.96), rgba(43, 46, 51, 0.78)); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36); padding: clamp(28px, 6vw, 56px); }\n.akan-system-status { margin: 0 0 18px; font-weight: 800; font-size: clamp(4rem, 18vw, 8rem); line-height: 0.85; letter-spacing: -0.08em; color: var(--akan-primary); }\n.akan-system-eyebrow { margin: 0 0 10px; color: var(--akan-accent); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; }\n.akan-system-title { margin: 0; max-width: 12ch; font-size: clamp(2rem, 7vw, 4rem); line-height: 0.95; letter-spacing: -0.055em; color: var(--akan-foreground); }\n.akan-system-description { margin: 22px 0 0; max-width: 56ch; color: rgba(255, 255, 255, 0.76); font-size: 1.05rem; line-height: 1.75; }\n.akan-system-path { margin: 22px 0 0; overflow-wrap: anywhere; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 16px; background: rgba(26, 26, 26, 0.72); padding: 12px 14px; color: rgba(255, 255, 255, 0.72); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.88rem; }\n.akan-system-actions { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 12px; }\n.akan-system-action { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; border: 1px solid var(--akan-primary); border-radius: 999px; background: var(--akan-primary); box-shadow: 0 12px 34px rgba(255, 73, 59, 0.26); color: var(--akan-foreground); padding: 0 18px; font-weight: 800; text-decoration: none; }\n.akan-system-secondary { border: 1px solid rgba(255, 255, 255, 0.12); background: var(--akan-secondary); color: var(--akan-foreground); }\n.akan-system-details { margin-top: 28px; max-height: 260px; overflow: auto; border-radius: 18px; background: rgba(26, 26, 26, 0.82); border: 1px solid rgba(240, 32, 32, 0.22); padding: 16px; color: rgba(255, 255, 255, 0.78); font-size: 0.82rem; line-height: 1.55; white-space: pre-wrap; }\n";
40
40
  /** The card alone, styled by the app's own tokens: what a not-found raised after the layouts streamed renders in place. */
41
41
  export declare const SystemPageMain: (options: Omit<SystemPageOptions, "lang" | "stylesheetHref" | "script" | "scriptNonce">) => import("react").JSX.Element;
42
42
  export declare function createSystemPageDocument(options: SystemPageOptions): ReactNode;
@@ -17,6 +17,7 @@ export declare class AgentCursor {
17
17
  static scroll(way: "up" | "down"): void;
18
18
  /** Keeps the pointer up for as long as the turn runs, instead of for `idleMs` after the last call. */
19
19
  static hold(): void;
20
+ /** A turn's end leaves the pointer where it is for a moment: a run of several turns then travels on from there. */
20
21
  static release(): void;
21
22
  /** Drifts clear of the last pressed control and shows the waiting spinner; a no-op before the first press. */
22
23
  static think(): void;
@@ -12,7 +12,7 @@ export declare class AgentVisual {
12
12
  static readonly revealCap = 4;
13
13
  /** How many of a form patch's fields are drawn. */
14
14
  static readonly fieldCap = 5;
15
- /** The longest a navigate call waits for its press to land. */
15
+ /** The longest a call waits for its press to land. */
16
16
  static readonly leadMs = 600;
17
17
  /** The handlers `agentSessionOf` hands the session. `true` is every effect; an object turns one of them off. */
18
18
  static sink(option?: boolean | AgentVisualOption): {
package/ui/styles.css CHANGED
@@ -486,7 +486,7 @@ body.akan-mobile-document {
486
486
  pointer-events: none;
487
487
  opacity: 0;
488
488
  transition:
489
- transform 320ms cubic-bezier(0.22, 0.61, 0.36, 1),
489
+ transform var(--akan-agent-travel, 320ms) cubic-bezier(0.22, 0.61, 0.36, 1),
490
490
  opacity 200ms ease-out;
491
491
  }
492
492
 
@@ -100,6 +100,16 @@ export function createDesktopNotifications() {
100
100
  const pendingActions: NotificationEvent[] = [];
101
101
 
102
102
  const status = async (ctx: DesktopContext) => ((await shell(ctx, "notify.status")) as { status: number }).status;
103
+ let deniedReported = false;
104
+ const reportDenied = (ctx: DesktopContext) => {
105
+ if (deniedReported) return;
106
+ deniedReported = true;
107
+ const where =
108
+ process.platform === "darwin"
109
+ ? `macOS already denies notifications for the bundle id ${ctx.app.id} (System Settings › Notifications; macOS keeps the answer per bundle id)`
110
+ : `notifications for ${ctx.app.name} are turned off (Settings › System › Notifications)`;
111
+ console.warn(`[akan-native] local-notifications: ${where}, so requestPermission answers "denied" without a prompt`);
112
+ };
103
113
  const list = async (ctx: DesktopContext, op: "notify.pending" | "notify.delivered") =>
104
114
  ((await shell(ctx, op)) as NativeRequest[]).filter(mine);
105
115
 
@@ -174,6 +184,7 @@ export function createDesktopNotifications() {
174
184
  async requestPermission(args, ctx) {
175
185
  const provisional = (args as { provisional?: unknown } | undefined)?.provisional === true;
176
186
  const now = await status(ctx);
187
+ if (now === 1) reportDenied(ctx);
177
188
  if (now !== 0 && !(now === 3 && !provisional)) return { display: permissionState(now) };
178
189
  const after = (await shell(ctx, "notify.request", { provisional })) as { status: number };
179
190
  return { display: permissionState(after.status) };