From 1fd1fde42a934993d8057b5ab06cfcd04788573c Mon Sep 17 00:00:00 2001 From: Isaac Ahouma Date: Mon, 27 Oct 2025 14:07:00 -0700 Subject: [PATCH 1/4] Relax user activation requirements for session creation This change updates the specification to require sticky user activation instead of transient user activation for creating sessions under certain conditions, as discussed in issue #83. Fixes: https://github.com/webmachinelearning/writing-assistance-apis/issues/83 Bug: 454435239 --- index.bs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/index.bs b/index.bs index 99030f5..8c0dee5 100644 --- a/index.bs +++ b/index.bs @@ -1826,14 +1826,12 @@ Every [=interface=] [=interface/including=] the {{DestroyableModel}} interface m :: 1. If |availability| is "{{Availability/downloadable}}", then: - 1. If |realm|'s [=realm/global object=] does not have [=transient activation=], then: + 1. If the user agent does not have sticky user activation in |realm|'s [=realm/global object=], then: 1. [=Queue a global task=] on the [=AI task source=] given |realm|'s [=realm/global object=] to [=reject=] |promise| with a "{{NotAllowedError}}" {{DOMException}}. 1. Abort these steps. - 1. [=Consume user activation=] given |realm|'s [=realm/global object=]. - 1. The user agent may display a user interface to the user to confirm that they want to perform the download operation given by |startDownload|, or to show the progress of the download. Alternately, the user agent may decide to deny the ability to perform |startDownload| based on implicit signals of the user's intent, including the considerations in [[#privacy-availability-eviction]] and [[#security-disk-space]]. If the user explicitly or implicitly signals that they do not want to start the download, then: 1. [=Queue a global task=] on the [=AI task source=] given |realm|'s [=realm/global object=] to [=reject=] |promise| with a "{{NotAllowedError}}" {{DOMException}}. From 2d6cfbdb3f127a6e76d5ef6763dcec24d030246a Mon Sep 17 00:00:00 2001 From: Isaac Ahouma Date: Mon, 27 Oct 2025 14:29:21 -0700 Subject: [PATCH 2/4] Relax user activation requirements for session creation This change updates the specification to require sticky user activation instead of transient user activation for creating sessions under certain conditions, as discussed in issue #83. Fixes: https://github.com/webmachinelearning/writing-assistance-apis/issues/83 --- index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.bs b/index.bs index 8c0dee5..a8f524f 100644 --- a/index.bs +++ b/index.bs @@ -1826,7 +1826,7 @@ Every [=interface=] [=interface/including=] the {{DestroyableModel}} interface m :: 1. If |availability| is "{{Availability/downloadable}}", then: - 1. If the user agent does not have sticky user activation in |realm|'s [=realm/global object=], then: + 1. If the user agent does not have [=sticky activation=] in |realm|'s [=realm/global object=], then: 1. [=Queue a global task=] on the [=AI task source=] given |realm|'s [=realm/global object=] to [=reject=] |promise| with a "{{NotAllowedError}}" {{DOMException}}. From f53ea916538bfa4dac46015c52b32078c2512060 Mon Sep 17 00:00:00 2001 From: Isaac Ahouma Date: Mon, 27 Oct 2025 14:29:21 -0700 Subject: [PATCH 3/4] Relax user activation requirements for session creation This change updates the specification to require sticky user activation instead of transient user activation for creating sessions under certain conditions, as discussed in issue #83. Fixes: https://github.com/webmachinelearning/writing-assistance-apis/issues/83 --- index.bs | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/index.bs b/index.bs index 8c0dee5..b6e38fd 100644 --- a/index.bs +++ b/index.bs @@ -112,7 +112,7 @@ enum SummarizerLength { "short", "medium", "long" };
The static create(|options|) method steps are: - 1. Return the result of [=creating an AI model object=] given |options|, "{{summarizer}}", [=validate and canonicalize summarizer options=], [=computing summarizer options availability=], [=download the summarizer model=], [=initialize the summarizer model=], and [=create a summarizer object=]. + 1. Return the result of [=creating an AI model object=] given |options|, "{{summarizer}}", [=validate and canonicalize summarizer options=], [=computing summarizer options availability=], [=download the summarizer model=], [=initialize the summarizer model=], [=create a summarizer object=], and false.
@@ -698,7 +698,7 @@ enum WriterLength { "short", "medium", "long" };
The static create(|options|) method steps are: - 1. Return the result of [=creating an AI model object=] given |options|, "{{writer}}", [=validate and canonicalize writer options=], [=computing writer options availability=], [=download the writer model=], [=initialize the writer model=], and [=create a writer object=]. + 1. Return the result of [=creating an AI model object=] given |options|, "{{writer}}", [=validate and canonicalize writer options=], [=computing writer options availability=], [=download the writer model=], [=initialize the writer model=], [=create a writer object=], and false.
@@ -1213,7 +1213,7 @@ enum RewriterLength { "as-is", "shorter", "longer" };
The static create(|options|) method steps are: - 1. Return the result of [=creating an AI model object=] given |options|, "{{rewriter}}", [=validate and canonicalize rewriter options=], [=computing rewriter options availability=], [=download the rewriter model=], [=initialize the rewriter model=], and [=create a rewriter object=]. + 1. Return the result of [=creating an AI model object=] given |options|, "{{rewriter}}", [=validate and canonicalize rewriter options=], [=computing rewriter options availability=], [=download the rewriter model=], [=initialize the rewriter model=], [=create a rewriter object=], and false.
@@ -1744,7 +1744,7 @@ Every [=interface=] [=interface/including=] the {{DestroyableModel}} interface m * an algorithm |getAvailability| taking an [=ordered map=] and returning an {{Availability}} or null, * an algorithm |startDownload| taking an [=ordered map=] and returning a boolean, * an algorithm |initialize| taking an [=ordered map=] and returning an error information or null, and - * an algorithm |create| taking a [=ECMAScript/realm=] and an [=ordered map=] and returning a Web IDL object representing the model, + * an algorithm |create| taking a [=ECMAScript/realm=], an [=ordered map=] and an optional boolean |requireTransientActivation| (default true) and returning a Web IDL object representing the model, perform the following steps: @@ -1826,11 +1826,20 @@ Every [=interface=] [=interface/including=] the {{DestroyableModel}} interface m :: 1. If |availability| is "{{Availability/downloadable}}", then: - 1. If the user agent does not have sticky user activation in |realm|'s [=realm/global object=], then: + 1. If |requireTransientActivation| is true, then: + 1. If |realm|'s [=realm/global object=] does not have [=transient activation=], then: - 1. [=Queue a global task=] on the [=AI task source=] given |realm|'s [=realm/global object=] to [=reject=] |promise| with a "{{NotAllowedError}}" {{DOMException}}. + 1. [=Queue a global task=] on the [=AI task source=] given |realm|'s [=realm/global object=] to [=reject=] |promise| with a "{{NotAllowedError}}" {{DOMException}}. - 1. Abort these steps. + 1. Abort these steps. + + 1. [=Consume user activation=] given |realm|'s [=realm/global object=]. + 1. Else: + 1. If |realm|'s [=realm/global object=] does not have [=sticky activation=], then: + + 1. [=Queue a global task=] on the [=AI task source=] given |realm|'s [=realm/global object=] to [=reject=] |promise| with a "{{NotAllowedError}}" {{DOMException}}. + + 1. Abort these steps. 1. The user agent may display a user interface to the user to confirm that they want to perform the download operation given by |startDownload|, or to show the progress of the download. Alternately, the user agent may decide to deny the ability to perform |startDownload| based on implicit signals of the user's intent, including the considerations in [[#privacy-availability-eviction]] and [[#security-disk-space]]. If the user explicitly or implicitly signals that they do not want to start the download, then: From e3664f9267735208c53177cbbee6acf5b3a22e12 Mon Sep 17 00:00:00 2001 From: Isaac Ahouma Date: Thu, 30 Oct 2025 09:32:44 -0700 Subject: [PATCH 4/4] Replace 'Else' with 'Origin' in the creation algorithm --- index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.bs b/index.bs index b6e38fd..188b4c3 100644 --- a/index.bs +++ b/index.bs @@ -1834,7 +1834,7 @@ Every [=interface=] [=interface/including=] the {{DestroyableModel}} interface m 1. Abort these steps. 1. [=Consume user activation=] given |realm|'s [=realm/global object=]. - 1. Else: + 1. Otherwise: 1. If |realm|'s [=realm/global object=] does not have [=sticky activation=], then: 1. [=Queue a global task=] on the [=AI task source=] given |realm|'s [=realm/global object=] to [=reject=] |promise| with a "{{NotAllowedError}}" {{DOMException}}.