Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

498 Allow intents to be resolved on output type (where they return data) #499

Closed

Conversation

kriswest
Copy link
Contributor

@kriswest kriswest commented Nov 12, 2021

Adds an element to the AppD Application schema that can specify the Context type that intent can return and extends the findIntent API calls to be able to use it for resolution.

Support for this was not added to the raiseIntent APIs as:

  • a second optional string argument would be a problem (that it isn't on findIntent)
  • this form of resolution is likely to be performed programmatically, rather than through a resolver UI

Copy link
Contributor

@thorsent thorsent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the work on this. I suggested a few rewordings. It's probably worth several passes to get as close to perfect as possible.

docs/api/ref/DesktopAgent.md Outdated Show resolved Hide resolved
docs/api/ref/DesktopAgent.md Outdated Show resolved Hide resolved
docs/api/ref/DesktopAgent.md Outdated Show resolved Hide resolved
docs/api/ref/DesktopAgent.md Outdated Show resolved Hide resolved
docs/api/ref/DesktopAgent.md Outdated Show resolved Hide resolved
```typescript
enum DataError {
NoDataReturned = 'NoDataReturned',
IntentHandlerRejected = 'IntentHandlerRejected',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may need some more discussion around error handling. For instance, a request for a quote would likely return some sort of well-defined "Quote" context, but what if the end user is not authorized to receive that market data? We wouldn't want to muddy the Quote context with arbitrary error messages, but then the DataError enum type provides no information about why the intent was rejected, which in this case would result in quite a bit of potential confusion for the end user.

We may want to either (a) consider allowing at least a simple error string to be rejected/thrown, or (b) allow for the possibility of more than one context being returned (e.g. an Error context. Receiving apps may then disambiguate by examining the type member).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At present, an app resolving an intent has no means to identify the app raising the intent and couldn't assess authorization. Hence, any such mechanism would have to be a function of the Desktop Agent. However, I take the point on returning some info about why the promise was rejected (for feedback to the end-user - 'IntentHandlerRejected' is not all that informative and we are deliberately losing any info on why the rejection occurred).

I don't particularly like the idea of using an 'ErrorContext' type (I think that overloads the purpose of context). However, we could use the javascript Error type (or similar that we define), setting the message to these values and setting the optional cause property to the error/rejection message returned by the intent handler... However, its a departure from all other rejects, which reject with just a string.

docs/api/spec.md Outdated Show resolved Hide resolved
docs/api/spec.md Outdated Show resolved Hide resolved
*
* Using `raiseIntentForContext` is similar to calling `findIntentsByContext`, and then raising an intent against one of the returned apps, except in this case the desktop agent has the opportunity to provide the user with a richer selection interface where they can choose both the intent and target app.
*
* Returns an `IntentResolution` object with a handle to the app that responded to the selected intent.
* Returns an `IntentResolution` object with details of the app that was selected to respond to the intent. If the application that resolves the intent returns a promise of Context data, this may be retrieved via the `getResult()` function of the IntentResolution object. If an error is thrown by the handler function, the promise returned is rejected, or no promise is returned then the Desktop Agent MUST reject the promise returned by the `getResult()` function of the `IntentResolution` with a string from the `DataError` enumeration.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DRY docs again.

@kriswest kriswest added channels feeds & transactions Channels, Feeds & Transactions Discussion Group enhancement New feature or request api FDC3 API Working Group labels Nov 22, 2021
@kriswest kriswest changed the title Allow intents to be resolved on output type (where they return data) 498 Allow intents to be resolved on output type (where they return data) Nov 26, 2021
@kriswest kriswest requested a review from RexJaeschke February 15, 2022 13:29
@RexJaeschke RexJaeschke removed their request for review February 20, 2022 17:24
@kriswest kriswest force-pushed the 498-resolve-intents-on-output-type branch from 929b287 to b88b4af Compare February 21, 2022 21:13
@kriswest
Copy link
Contributor Author

Closing in favour of #508 which contains all the same commits

@kriswest kriswest closed this Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api FDC3 API Working Group channels feeds & transactions Channels, Feeds & Transactions Discussion Group cla-present enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make it possible to resolve intent based on output type as well as input
2 participants