Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ To <dfn>notify documents of a tool change</dfn> given a {{Document}} |tool owner
1. [=Assert=]: these steps are running [=in parallel=].

1. Let |navigablesToNotify| be |tool owner|'s [=node navigable=]'s [=navigable/traversable
navigable=]'s [=Document/inclusive descendant navigables=].
navigable=]'s [=navigable/active document=]'s [=Document/inclusive descendant navigables=].

1. [=list/For each=] |navigable| of |navigablesToNotify|:

Expand Down Expand Up @@ -478,7 +478,7 @@ internal value=] |uuid|, are as follows:
Issue: Support more granular errors; here we should return something that prompts the caller to
reject its {{Promise}} with a "{{DataError}}" {{DOMException}}.

1. If |inputObject| [=Object type|is not an Object=] is false, then run |completionSteps| given null
1. If |inputObject| [=Object type|is not an Object=], then run |completionSteps| given null
and false, and abort these steps.

Issue(#146): Specify and fire the "<code>toolactivated</code>" event.
Expand Down Expand Up @@ -820,7 +820,7 @@ The <dfn method for=ModelContext>getTools(<var>options</var>)</dfn> method steps
1. Let |tools| be an empty [=list=] of {{RegisteredTool}} dictionaries.

1. Let |navigables| be |toolRequestor|'s [=node navigable=]'s [=navigable/traversable
navigable=]'s [=Document/inclusive descendant navigables=].
navigable=]'s [=navigable/active document=]'s [=Document/inclusive descendant navigables=].

1. [=list/For each=] |navigable| of |navigables|:

Expand Down Expand Up @@ -1001,31 +1001,31 @@ The <dfn method for=ModelContext>executeTool(<var>tool</var>, <var>inputObject</
1. Let |completionSteps| be an algorithm that takes a [=string=]-or-null |result| and a
[=boolean=] |success|, and runs the following steps:

1. [=Assert=]: these steps are running [=in parallel=].
1. Run the following steps [=in parallel=]:

1. If |targetDocument|'s [=node navigable=]'s [=navigable/traversable navigable=]'s
[=traversable navigable/pending tool executions map=][|uuid|] does not [=map/exist=], then
return.
1. If |targetDocument|'s [=node navigable=]'s [=navigable/traversable navigable=]'s
[=traversable navigable/pending tool executions map=][|uuid|] does not [=map/exist=],
then return.

<div class=note id=pending-execution-removal-race>
<p>It is possible that a pending execution identified by |uuid| no longer exists. This can
happen due to a race between (a) tool cancellation when the caller document <a
href=#caller-destroyed-cleanup>gets destroyed</a> or when the caller aborts the
execution via the options signal; and (b) tool promise resolution. Both
of these race to invoke |completionSteps|, and the first invocation will remove the
pending execution by its key |uuid|, this check protects subsequent racing
invocations.</p>
</div>
<div class=note id=pending-execution-removal-race>
<p>It is possible that a pending execution identified by |uuid| no longer exists. This can
happen due to a race between (a) tool cancellation when the caller document <a
href=#caller-destroyed-cleanup>gets destroyed</a> or when the caller aborts the
execution via the options signal; and (b) tool promise resolution. Both
of these race to invoke |completionSteps|, and the first invocation will remove the
pending execution by its key |uuid|, this check protects subsequent racing
invocations.</p>
</div>

1. [=map/Remove=] |targetDocument|'s [=node navigable=]'s [=navigable/traversable
navigable=]'s [=traversable navigable/pending tool executions map=][|uuid|].
1. [=map/Remove=] |targetDocument|'s [=node navigable=]'s [=navigable/traversable
navigable=]'s [=traversable navigable/pending tool executions map=][|uuid|].

1. If |success| is true, then [=queue a global task=] on the [=webmcp task source=] given
|callerDocument|'s [=relevant global object=] to [=resolve=] |promise| with |result|.
1. If |success| is true, then [=queue a global task=] on the [=webmcp task source=] given
|callerDocument|'s [=relevant global object=] to [=resolve=] |promise| with |result|.

1. Otherwise, [=queue a global task=] on the [=webmcp task source=] given |callerDocument|'s
[=relevant global object=] to [=reject=] |promise| with an "{{UnknownError}}"
{{DOMException}}.
1. Otherwise, [=queue a global task=] on the [=webmcp task source=] given |callerDocument|'s
[=relevant global object=] to [=reject=] |promise| with an "{{UnknownError}}"
{{DOMException}}.

1. Let |execution| be a new [=pending tool execution=], with the following [=struct/items=]:

Expand Down
Loading