@braidlabs/fdc3 0.7.1 → 0.8.1

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/README.md CHANGED
@@ -18,9 +18,35 @@ The agent is built on the FINOS reference implementation (`@finos/fdc3-web-impl`
18
18
  `@finos/fdc3-agent-proxy`). Trusted fragments, compat and custom-element, get `window.fdc3` before
19
19
  their first script runs. A fragment whose id has no directory record gets none.
20
20
 
21
- An intent raised to a fragment that is mounted but still booting is held until its listener
22
- arrives. Not supported yet: `fdc3.open()`, `fdc3.close()`, raising with `newInstance: true`, and
23
- launching apps that aren't mounted; an intent resolver UI; and FDC3 for untrusted or contract
24
- fragments.
21
+ Give the agent a `container` and it can launch apps:
22
+
23
+ ```ts
24
+ const agent = createBraidDesktopAgent({
25
+ directory: applications,
26
+ container: document.getElementById('desk')!, // where fdc3.open and intents mount apps
27
+ });
28
+ ```
29
+
30
+ - **Launching.** `fdc3.open`, `newInstance: true`, and intents no running app can take mount a
31
+ `<fragment-slot>` in the container.
32
+ - **Resolving.** A built-in dialog chooses among several apps; a `resolveIntent` hook replaces it.
33
+
34
+ Preferences, per-app settings and saved layouts are not part of FDC3 and not part of this package.
35
+ They are the workspace in `@braidlabs/console/workspace`, which composes around the agent:
36
+
37
+ ```ts
38
+ import { createBraidDesktopAgent, dialogResolver } from '@braidlabs/fdc3';
39
+ import { createWorkspace } from '@braidlabs/console/workspace';
40
+
41
+ const workspace = createWorkspace();
42
+ const agent = createBraidDesktopAgent({
43
+ directory: applications,
44
+ ...workspace.fdc3(dialogResolver(document, { remember: true })), // container and resolveIntent
45
+ });
46
+ initBraid({ realmGlobals: workspace.realmGlobals(agent.realmGlobals) });
47
+ ```
48
+
49
+ Not supported yet: `fdc3.close()`, FDC3 for untrusted or contract fragments, and a live-updating
50
+ directory.
25
51
 
26
52
  Full documentation: https://braidjs.github.io/braid/packages/fdc3
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@braidlabs/fdc3",
3
- "version": "0.7.1",
4
- "description": "An FDC3 3.0 Desktop Agent for Braid pages: every composed fragment gets a window.fdc3 bound to its own app identity, with user channels, app channels and intents across fragments, resolved against an FDC3 App Directory. Built on the FINOS reference implementation.",
3
+ "version": "0.8.1",
4
+ "description": "An FDC3 3.0 Desktop Agent for Braid pages: every composed fragment gets a window.fdc3 bound to its own app identity, with user channels, app channels and intents across fragments, resolved against an FDC3 App Directory, with launching and an intent resolver. Built on the FINOS reference implementation.",
5
5
  "keywords": [
6
6
  "braid",
7
7
  "micro-frontends",
@@ -28,7 +28,8 @@
28
28
  "dependencies": {
29
29
  "@finos/fdc3-agent-proxy": "3.0.0",
30
30
  "@finos/fdc3-standard": "3.0.0",
31
- "@finos/fdc3-web-impl": "3.0.0"
31
+ "@finos/fdc3-web-impl": "3.0.0",
32
+ "uuid": "^14.0.0"
32
33
  },
33
34
  "publishConfig": {
34
35
  "access": "public"
package/src/agent.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type DirectoryApp } from '@finos/fdc3-web-impl';
2
- import { type DesktopAgent } from '@finos/fdc3-standard';
2
+ import { type AppIdentifier, type Context, type DesktopAgent } from '@finos/fdc3-standard';
3
3
  /**
4
4
  * An FDC3 3.0 Desktop Agent for one Braid page.
5
5
  *
@@ -17,6 +17,12 @@ import { type DesktopAgent } from '@finos/fdc3-standard';
17
17
  * per message — the isolation and ordering a MessagePort gives, without one.
18
18
  * - **Lifetime is the fragment's.** When the fragment is torn down its instance is terminated: its
19
19
  * listeners stop receiving and `findInstances` no longer reports it.
20
+ * - **Launching is mounting.** With a `container`, `fdc3.open` and intents for apps that are not
21
+ * running mount a `<fragment-slot>` there.
22
+ *
23
+ * That is all of it. What FDC3 does not standardize — remembered choices, preferences, per-app
24
+ * settings, saved layouts — is not here: it is the workspace in `@braidlabs/console/workspace`,
25
+ * which composes around this agent through `resolveIntent` and `realmGlobals`.
20
26
  */
21
27
  export interface BraidDesktopAgentOptions {
22
28
  /**
@@ -26,15 +32,58 @@ export interface BraidDesktopAgentOptions {
26
32
  * one whose record's `fdc3Version` range excludes 3.0.
27
33
  */
28
34
  directory: readonly DirectoryApp[];
35
+ /**
36
+ * Where the agent mounts fragments it launches — for `fdc3.open`, and for an intent whose app is
37
+ * not running. A `<fragment-slot>` the host places there itself counts as that app starting.
38
+ * Without one nothing is launched: `fdc3.open` rejects with `ErrorOnLaunch`.
39
+ *
40
+ * A function is asked each time, for a container a framework renders after the agent is
41
+ * created or replaces later; while it returns nothing, a launch is refused as if there were none.
42
+ */
43
+ container?: Element | (() => Element | null | undefined);
44
+ /**
45
+ * Chooses among the apps that can take an intent, when there is more than one. Defaults to a
46
+ * built-in dialog in a browser; `false` refuses such a raise with `UserCancelledResolution`.
47
+ */
48
+ resolveIntent?: IntentResolverHook | false;
29
49
  }
50
+ /** One app — a running instance, or the app itself to be launched — that can take an intent. */
51
+ export interface IntentCandidate {
52
+ intent: string;
53
+ appId: string;
54
+ /** Set for a running instance; absent for the app itself, which choosing launches — or, when `starting`, waits for. */
55
+ instanceId?: string;
56
+ /** The app is open but not yet listening for the intent; choosing it waits for that instance rather than launching one. */
57
+ starting?: true;
58
+ /** The directory's title for the app, or its id. */
59
+ title: string;
60
+ /** The directory's first icon, if it has one. */
61
+ icon?: string;
62
+ }
63
+ export interface IntentChoiceRequest {
64
+ context: Context;
65
+ raisedBy: AppIdentifier;
66
+ /** Two or more, in the order the agent found them. */
67
+ candidates: IntentCandidate[];
68
+ }
69
+ /**
70
+ * Chooses for a raise: one of the candidates, or undefined to cancel. The agent keeps nothing, so
71
+ * `remember` is for whatever wraps the hook — the console workspace's `intentResolver` stores the
72
+ * choice and answers the next raise itself.
73
+ */
74
+ export type IntentResolverHook = (request: IntentChoiceRequest) => Promise<{
75
+ candidate: IntentCandidate;
76
+ remember?: boolean;
77
+ } | undefined>;
30
78
  export interface BraidDesktopAgent {
31
79
  /**
32
- * The hook for `initBraid({ realmGlobals })`: a fragment in the directory gets `{ fdc3 }`, an
33
- * agent bound to its id, before any of its code runs; its signal releases the instance.
80
+ * The hook for `initBraid({ realmGlobals })`: a fragment in the directory gets `{ fdc3 }`, bound
81
+ * to its id, before any of its code runs; its signal releases the instance.
34
82
  */
35
83
  realmGlobals(fragment: {
36
84
  fragmentId: string;
37
85
  signal: AbortSignal;
86
+ slot?: Element;
38
87
  }): Promise<{
39
88
  fdc3: DesktopAgent;
40
89
  } | undefined>;
package/src/agent.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { BasicDirectory, ChannelType, DefaultFDC3Server, IntentHandler, State, } from '@finos/fdc3-web-impl';
2
2
  import { AbstractMessaging, DefaultAppSupport, DefaultChannelSupport, DefaultHeartbeatSupport, DefaultIntentSupport, DesktopAgentProxy, } from '@finos/fdc3-agent-proxy';
3
3
  import { ChannelError, CloseError, LogLevel, OpenError, ResolveError, } from '@finos/fdc3-standard';
4
+ import { dialogResolver } from './resolver.js';
4
5
  /** The FDC3 version the agent implements; the directory drops records whose `fdc3Version` excludes it. */
5
6
  const FDC3_VERSION = '3.0';
6
7
  /** A request is answered within this, or the proxy reports `ApiTimeout`. */
@@ -18,19 +19,53 @@ const USER_CHANNELS = [
18
19
  ['magenta', '7'],
19
20
  ['purple', '8'],
20
21
  ];
21
- /** The proxy's intent resolver and channel selector, when the host supplies no UI for either. */
22
+ /** The proxy's channel selector, and its connectables, when the host supplies no UI. */
22
23
  const NO_UI = {
23
24
  connect: async () => undefined,
24
25
  disconnect: async () => undefined,
25
- // no resolver UI: a raise that needs a choice is refused, as FDC3 says, with UserCancelledResolution
26
26
  chooseIntent: async () => undefined,
27
27
  updateChannel: async () => undefined,
28
28
  setChannelChangeCallback: () => undefined,
29
29
  };
30
30
  export function createBraidDesktopAgent(options) {
31
31
  // a directory that failed to load is an empty one, not a page that fails to compose
32
- const directory = new BasicDirectory(Array.isArray(options.directory) ? [...options.directory] : [], FDC3_VERSION);
33
- const context = new BraidServerContext(taskQueue());
32
+ const records = Array.isArray(options.directory) ? [...options.directory] : [];
33
+ const directory = new BasicDirectory(records, FDC3_VERSION);
34
+ /** The container now: the one given, or whatever the host's function finds at this moment. */
35
+ const containerNow = () => (typeof options.container === 'function' ? options.container() : options.container) ?? undefined;
36
+ const canLaunch = options.container !== undefined;
37
+ const resolveIntent = options.resolveIntent === false
38
+ ? undefined
39
+ : (options.resolveIntent ?? (typeof document === 'undefined' ? undefined : dialogResolver(document)));
40
+ /** Slots the agent mounted, until their fragment connects. */
41
+ const launches = new WeakMap();
42
+ /** Connected fragments' instance ids, by the slot they boot in. */
43
+ const bySlot = new Map();
44
+ const context = new BraidServerContext(taskQueue(), (appId) => {
45
+ const container = containerNow();
46
+ if (!container)
47
+ return undefined;
48
+ const instanceId = crypto.randomUUID();
49
+ mountSlot(container, appId, (slot) => launches.set(slot, { instanceId }));
50
+ return instanceId;
51
+ });
52
+ context.launchable = canLaunch;
53
+ context.knows = (appId) => directory.retrieveAppsById(appId).length > 0;
54
+ // a slot in the container that has not connected yet: launched by the agent, or placed by the host
55
+ context.mounting = (appId) => {
56
+ const container = containerNow();
57
+ if (!container)
58
+ return undefined;
59
+ for (const slot of slotsIn(container)) {
60
+ if (slot.getAttribute('name') !== appId || bySlot.has(slot))
61
+ continue;
62
+ let launch = launches.get(slot);
63
+ if (!launch)
64
+ launches.set(slot, (launch = { instanceId: crypto.randomUUID() }));
65
+ return launch.instanceId;
66
+ }
67
+ return undefined;
68
+ };
34
69
  const userChannels = USER_CHANNELS.map(([color, glyph]) => ({
35
70
  id: `fdc3.channel.${glyph}`,
36
71
  type: ChannelType.user,
@@ -41,21 +76,61 @@ export function createBraidDesktopAgent(options) {
41
76
  // which instances are listening for what: the agent's intent handler is the source of truth
42
77
  const intentHandler = server.handlers.find((handler) => handler instanceof IntentHandler);
43
78
  context.hasListener = (instanceId, intent, contextType) => intentHandler?.hasListener(instanceId, intent, contextType) ?? false;
44
- async function connect(appId, signal) {
45
- const instanceId = context.createUUID();
79
+ context.heldIntents = () => intentHandler?.pendingIntents ?? new Set();
80
+ /** The candidates for a raise, as the resolver sees them. */
81
+ function candidatesOf(appIntents) {
82
+ return appIntents.flatMap((appIntent) => appIntent.apps.map((app) => {
83
+ const record = directory.retrieveAppsById(app.appId)[0];
84
+ const icon = record?.icons?.[0]?.src;
85
+ return {
86
+ intent: appIntent.intent.name,
87
+ appId: app.appId,
88
+ ...(app.instanceId
89
+ ? { instanceId: app.instanceId }
90
+ : app.instanceMetadata?.braidStarting === true
91
+ ? { starting: true }
92
+ : {}),
93
+ title: record?.title ?? app.appId,
94
+ ...(icon ? { icon } : {}),
95
+ };
96
+ }));
97
+ }
98
+ /** The proxy's intent resolver for one instance: the only candidate, or the host's choice among several. */
99
+ async function choose(raisedBy, appIntents, raised) {
100
+ const candidates = candidatesOf(appIntents);
101
+ let choice = candidates.length === 1 ? candidates[0] : undefined;
102
+ if (!choice && candidates.length > 1 && resolveIntent) {
103
+ // a resolver that throws has chosen nothing
104
+ const answer = await resolveIntent({ context: raised, raisedBy, candidates: candidates.map((candidate) => ({ ...candidate })) }).catch(() => undefined);
105
+ // only one of what was offered: a resolver cannot route the intent anywhere else
106
+ choice = answer && candidates.find((candidate) => sameCandidate(candidate, answer.candidate));
107
+ }
108
+ if (!choice)
109
+ return undefined;
110
+ return {
111
+ intent: choice.intent,
112
+ appId: choice.instanceId ? { appId: choice.appId, instanceId: choice.instanceId } : { appId: choice.appId },
113
+ };
114
+ }
115
+ async function connect(appId, signal, slot) {
116
+ // kept until the connect succeeds: a boot cut short and retried connects as the same launch
117
+ const launch = slot ? launches.get(slot) : undefined;
118
+ const instanceId = launch?.instanceId ?? context.createUUID();
46
119
  let open = true;
47
120
  // A fragment holds its `fdc3` and everything reachable from it. The server — and through it
48
121
  // every other instance — is reachable only through this closure, never as a property, so a
49
122
  // fragment can speak only as itself.
50
- const messaging = new InProcessMessaging({ appId, instanceId }, (message) => server.receive(context.targetInstance(message), instanceId), () => open);
123
+ const messaging = new InProcessMessaging({ appId, instanceId }, (message) => server.receive(context.inspect(message, instanceId), instanceId), () => open, canLaunch);
51
124
  context.setInstanceDetails(instanceId, { appId, instanceId, state: State.Connected });
52
125
  context.onMessage(instanceId, (message) => {
53
126
  if (open)
54
127
  messaging.deliver(message);
55
128
  });
129
+ const identity = { appId, instanceId };
130
+ const resolver = { ...NO_UI, chooseIntent: (appIntents, raised) => choose(identity, appIntents, raised) };
56
131
  const heartbeat = new DefaultHeartbeatSupport(messaging);
57
132
  const channels = new DefaultChannelSupport(messaging, NO_UI, MESSAGE_TIMEOUT_MS);
58
- const intents = new DefaultIntentSupport(messaging, NO_UI, MESSAGE_TIMEOUT_MS, INTENT_TIMEOUT_MS);
133
+ const intents = new DefaultIntentSupport(messaging, resolver, MESSAGE_TIMEOUT_MS, INTENT_TIMEOUT_MS);
59
134
  const apps = new DefaultAppSupport(messaging, MESSAGE_TIMEOUT_MS, INTENT_TIMEOUT_MS);
60
135
  // the proxy logs every message at its default level; warnings and errors are what a host wants
61
136
  const agent = new DesktopAgentProxy(heartbeat, channels, intents, apps, [heartbeat, channels, NO_UI, NO_UI], LogLevel.WARN);
@@ -63,6 +138,8 @@ export function createBraidDesktopAgent(options) {
63
138
  if (!open)
64
139
  return;
65
140
  open = false;
141
+ if (slot && bySlot.get(slot) === instanceId)
142
+ bySlot.delete(slot);
66
143
  // terminates the instance and drops its listeners and channel membership on the agent side
67
144
  server.cleanup(instanceId);
68
145
  // the agent will not answer what was in flight, so answer it here
@@ -77,17 +154,50 @@ export function createBraidDesktopAgent(options) {
77
154
  release();
78
155
  return undefined;
79
156
  }
80
- return signal.aborted ? undefined : agent;
157
+ // A launched app is one FINOS is waiting for: an open to answer, or an intent to deliver. It
158
+ // learns of the arrival from the Web Connection Protocol's identity check, so the instance
159
+ // announces itself with one — before the fragment has its `fdc3`, so the context listener it
160
+ // adds next finds FINOS ready to deliver the open's context to it.
161
+ if (launch)
162
+ await context.announce(server, instanceId);
163
+ // held intents tied to an instance of this app that is gone are this one's now
164
+ const container = containerNow();
165
+ if (container)
166
+ context.adopt(appId, instanceId, (id) => slotsIn(container).some((other) => launches.get(other)?.instanceId === id));
167
+ if (signal.aborted)
168
+ return undefined;
169
+ if (slot) {
170
+ launches.delete(slot);
171
+ bySlot.set(slot, instanceId);
172
+ }
173
+ return { fdc3: agent };
81
174
  }
82
175
  return {
83
- async realmGlobals({ fragmentId, signal }) {
176
+ async realmGlobals({ fragmentId, signal, slot }) {
84
177
  if (signal.aborted || directory.retrieveAppsById(fragmentId).length === 0)
85
178
  return undefined;
86
- const fdc3 = await connect(fragmentId, signal);
87
- return fdc3 ? { fdc3 } : undefined;
179
+ return connect(fragmentId, signal, slot);
88
180
  },
89
181
  };
90
182
  }
183
+ /** The `<fragment-slot>` children of a container, in document order. */
184
+ function slotsIn(container) {
185
+ return [...container.children].filter((child) => child.localName === 'fragment-slot');
186
+ }
187
+ /**
188
+ * Mounts a `<fragment-slot>` for an app at the end of `container`. `prepare` runs before the slot
189
+ * connects — which is when it boots and its fragment asks for its globals.
190
+ */
191
+ function mountSlot(container, appId, prepare) {
192
+ const slot = container.ownerDocument.createElement('fragment-slot');
193
+ slot.setAttribute('name', appId);
194
+ prepare?.(slot);
195
+ container.append(slot);
196
+ return slot;
197
+ }
198
+ function sameCandidate(a, b) {
199
+ return !!b && a.intent === b.intent && a.appId === b.appId && (a.instanceId ?? null) === (b.instanceId ?? null);
200
+ }
91
201
  /**
92
202
  * One app instance's side of the in-process transport. State is in `#private` fields, which a
93
203
  * fragment cannot read through the proxy that holds this.
@@ -95,13 +205,15 @@ export function createBraidDesktopAgent(options) {
95
205
  class InProcessMessaging extends AbstractMessaging {
96
206
  #send;
97
207
  #isOpen;
208
+ #canLaunch;
98
209
  #listeners = new Map();
99
210
  /** Requests sent and not yet answered, by request id. */
100
211
  #inFlight = new Map();
101
- constructor(identity, send, isOpen) {
212
+ constructor(identity, send, isOpen, canLaunch) {
102
213
  super(identity);
103
214
  this.#send = send;
104
215
  this.#isOpen = isOpen;
216
+ this.#canLaunch = canLaunch;
105
217
  }
106
218
  createUUID() {
107
219
  return crypto.randomUUID();
@@ -114,13 +226,15 @@ class InProcessMessaging extends AbstractMessaging {
114
226
  async post(message) {
115
227
  if (!this.#isOpen())
116
228
  return this.#refuse(message, 'AgentDisconnected');
117
- // launching a fragment is the host's to do, and is not wired yet: neither `open` nor a raise
118
- // that asks for a new instance (the agent would hand that to the instance already running)
229
+ // without a container nothing can be launched: neither `open` nor a raise that asks for a new
230
+ // instance (the agent would hand that to the instance already running)
119
231
  const { type: kind, payload: request } = message;
120
- if (kind === 'openRequest')
121
- return this.#refuse(message, OpenError.ErrorOnLaunch);
122
- if ((kind === 'raiseIntentRequest' || kind === 'raiseIntentForContextRequest') && request?.newInstance === true) {
123
- return this.#refuse(message, ResolveError.TargetAppUnavailable);
232
+ if (!this.#canLaunch) {
233
+ if (kind === 'openRequest')
234
+ return this.#refuse(message, OpenError.ErrorOnLaunch);
235
+ if ((kind === 'raiseIntentRequest' || kind === 'raiseIntentForContextRequest') && request?.newInstance === true) {
236
+ return this.#refuse(message, ResolveError.TargetAppUnavailable);
237
+ }
124
238
  }
125
239
  let copy;
126
240
  try {
@@ -214,17 +328,29 @@ function taskQueue() {
214
328
  channel.port2.postMessage(null);
215
329
  };
216
330
  }
217
- /** The agent's view of the page: instances are connected fragments, and nothing is launched. */
331
+ /**
332
+ * The agent's view of the page: instances are connected fragments, and launching one is the
333
+ * `launch` callback's — mounting a slot — when the host gave a container.
334
+ */
218
335
  class BraidServerContext {
219
336
  schedule;
337
+ launch;
220
338
  /**
221
339
  * Registrations are plain data: the agent copies them into its responses (an intent's candidate
222
340
  * apps), so a delivery callback kept on one would be sent along with it.
223
341
  */
224
342
  instances = new Map();
225
343
  deliveries = new Map();
226
- constructor(schedule) {
344
+ /**
345
+ * Raises in progress that asked for a new instance, noted by {@link inspect} for
346
+ * {@link narrowIntents}, which has no other way to tell; dropped after a task.
347
+ */
348
+ newInstance = [];
349
+ constructor(schedule,
350
+ /** Mounts a new instance of the app, returning the instance id it will connect as; undefined if nothing can be launched. */
351
+ launch) {
227
352
  this.schedule = schedule;
353
+ this.launch = launch;
228
354
  }
229
355
  /** Whether an instance has an intent listener for `intent` (and `contextType`, if given); set by the agent. */
230
356
  hasListener = () => false;
@@ -232,14 +358,47 @@ class BraidServerContext {
232
358
  live(appId) {
233
359
  return [...this.instances.values()].filter((instance) => instance.appId === appId && instance.state === State.Connected);
234
360
  }
361
+ /** Set when the host gave a container. */
362
+ launchable = false;
235
363
  /**
236
- * A raise that names an app but no instance is resolved here to the instance that will take
237
- * it: the one listening for the intent, or — when none is yet — the app's only instance, so the
238
- * agent holds the intent until that fragment's listener arrives. FINOS would otherwise treat it
239
- * as a request to launch the app, which a Braid page cannot do.
364
+ * A mounted instance of the app that has not connected yet — one the agent launched, or a slot
365
+ * the host placed in the container — as the instance id it will connect as. Set by the agent.
240
366
  */
241
- targetInstance(message) {
367
+ mounting = () => undefined;
368
+ /** The app has an instance that will be able to take an intent, but none listening for it yet. */
369
+ booting(appId) {
370
+ return this.live(appId).length > 0 || this.mounting(appId) !== undefined;
371
+ }
372
+ /** Adds `note` to `list` for one task. */
373
+ static hold(list, note) {
374
+ list.push(note);
375
+ setTimeout(() => {
376
+ const index = list.indexOf(note);
377
+ if (index >= 0)
378
+ list.splice(index, 1);
379
+ }, 0);
380
+ }
381
+ /**
382
+ * Looks at a request on its way to the agent, and returns what the agent should get:
383
+ *
384
+ * - A raise that names an app but no instance is resolved here to the instance that will take
385
+ * it: the one listening for the intent, or — when none is yet — the app's only instance, so
386
+ * the agent holds the intent until that fragment's listener arrives. FINOS would otherwise
387
+ * treat it as a request to launch the app. A raise asking for a new instance is left alone.
388
+ * - A raise asking for a new instance is noted, so {@link narrowIntents} offers it launches.
389
+ */
390
+ inspect(message, from) {
242
391
  const { type, payload } = message;
392
+ if (type !== 'raiseIntentRequest' && type !== 'raiseIntentForContextRequest')
393
+ return message;
394
+ if (payload?.newInstance === true) {
395
+ BraidServerContext.hold(this.newInstance, {
396
+ from,
397
+ ...(typeof payload.intent === 'string' ? { intent: payload.intent } : {}),
398
+ ...(typeof payload.context?.type === 'string' ? { contextType: payload.context.type } : {}),
399
+ });
400
+ return message;
401
+ }
243
402
  const app = payload?.app;
244
403
  if (type !== 'raiseIntentRequest' || typeof payload?.intent !== 'string' || typeof app?.appId !== 'string' || app.instanceId) {
245
404
  return message;
@@ -250,6 +409,13 @@ class BraidServerContext {
250
409
  const target = listening.length === 1 ? listening[0] : listening.length === 0 && live.length === 1 ? live[0] : undefined;
251
410
  return target ? { ...message, payload: { ...payload, app: { appId: target.appId, instanceId: target.instanceId } } } : message;
252
411
  }
412
+ /**
413
+ * Tells FINOS a launched instance has arrived, with the Web Connection Protocol identity check
414
+ * it would otherwise wait for. Its answer, addressed to the instance, is ignored there.
415
+ */
416
+ async announce(server, instanceId) {
417
+ await server.receive({ type: 'WCP4ValidateAppIdentity', meta: { connectionAttemptUuid: this.createUUID(), timestamp: new Date() }, payload: {} }, instanceId);
418
+ }
253
419
  /** Where messages for an instance go. */
254
420
  onMessage(id, deliver) {
255
421
  this.deliveries.set(id, deliver);
@@ -265,13 +431,73 @@ class BraidServerContext {
265
431
  this.schedule(() => deliver(copy));
266
432
  }
267
433
  /**
268
- * Nothing is launched: `fdc3.open` is refused before it reaches the agent, and launching a
269
- * fragment is the host's to do. The agent still calls this when it holds an intent for an app
270
- * that is mounted but not yet listening (see {@link narrowIntents}) — the instance it waits for
271
- * already exists, so this names it. It never rejects: the agent does not handle a rejection here.
434
+ * Called for `fdc3.open`, and when FINOS holds an intent for an app to start. FINOS adds the held
435
+ * intent and calls this in one step, so the newest held intent for the app from this raiser that
436
+ * is not yet tied to an instance is that raise's — and none means `fdc3.open`.
437
+ *
438
+ * - `fdc3.open` launches. An app the directory does not know rejects with `AppNotFound`, which
439
+ * FINOS answers the open with.
440
+ * - A held intent launches when its raise asked for a new instance. Otherwise it waits for an
441
+ * instance that is booting — connected but not listening for it, or mounted and not yet
442
+ * connected, including one an earlier raise just launched — and launches only when there is
443
+ * none; deciding here, when the launch would happen, keeps two quick raises from mounting the
444
+ * app twice.
445
+ *
446
+ * Either way the held intent is then tied to that instance (see {@link adopt}): FINOS holds it
447
+ * for "any instance of the app" and drops the id returned here, so otherwise whichever instance
448
+ * added a listener first would take it.
272
449
  */
273
- async open(appId) {
274
- return this.live(appId)[0]?.instanceId ?? this.createUUID();
450
+ async open(appId, from) {
451
+ if (!this.launchable)
452
+ return this.live(appId)[0]?.instanceId ?? this.createUUID();
453
+ const raiser = from?.instanceId;
454
+ const held = [...this.heldIntents()]
455
+ .reverse()
456
+ .find((intent) => intent.appId?.appId === appId && intent.appId.instanceId === undefined && intent.r?.from?.instanceId === raiser);
457
+ // a string the directory has: anything else is refused before a slot is mounted for it
458
+ const known = typeof appId === 'string' && this.knows(appId);
459
+ if (!held) {
460
+ if (!known)
461
+ throw new Error(OpenError.AppNotFound);
462
+ // a container that is not on the page right now: refused, rather than an open that waits out its timeout
463
+ const launched = this.launch(appId);
464
+ if (!launched)
465
+ throw new Error(OpenError.ErrorOnLaunch);
466
+ return launched;
467
+ }
468
+ if (!known)
469
+ return this.createUUID();
470
+ const request = held.r ?? {};
471
+ const contextType = typeof request.context?.type === 'string' ? request.context.type : undefined;
472
+ const booting = request.newInstance === true
473
+ ? undefined
474
+ : (this.live(appId).find((instance) => !this.hasListener(instance.instanceId, String(request.intent), contextType))?.instanceId ??
475
+ this.mounting(appId));
476
+ const instanceId = booting ?? this.launch(appId);
477
+ if (!instanceId)
478
+ return this.createUUID();
479
+ held.appId = { appId, instanceId };
480
+ return instanceId;
481
+ }
482
+ /** Whether the directory has the app; set by the agent. */
483
+ knows = () => false;
484
+ /** The intents FINOS is holding for an app to start; set by the agent from its intent handler. */
485
+ heldIntents = () => new Set();
486
+ /**
487
+ * A new instance of `appId` takes over the held intents tied to an instance of that app that is
488
+ * gone — torn down, or its slot removed before it connected (a restore replaces slots) — so they
489
+ * reach the instance that replaced it rather than waiting out their timeout. `pending` says which
490
+ * not-yet-connected instance ids still have a slot.
491
+ */
492
+ adopt(appId, instanceId, pending) {
493
+ for (const held of this.heldIntents()) {
494
+ const tied = held.appId?.instanceId;
495
+ if (held.appId?.appId !== appId || tied === undefined || tied === instanceId)
496
+ continue;
497
+ if (this.instances.get(tied)?.state === State.Connected || pending(tied))
498
+ continue;
499
+ held.appId = { appId, instanceId };
500
+ }
275
501
  }
276
502
  /**
277
503
  * `fdc3.close()`, refused: fragments are torn down by their host, not by the agent. The agent
@@ -323,25 +549,42 @@ class BraidServerContext {
323
549
  return FDC3_VERSION;
324
550
  }
325
551
  /**
326
- * The candidates an intent may go to, given that nothing can be launched:
552
+ * The candidates an intent may go to:
327
553
  *
328
554
  * - an instance only once it listens for the intent, for this context's type — before then,
329
555
  * sending it the intent would lose it;
330
- * - an app without an instance (the directory's entry) only while one is mounted and none of its
331
- * instances listens yet — the agent then holds the intent until the listener arrives.
556
+ * - an app without an instance (the directory's entry) while one is booting — connected, or
557
+ * mounted and not yet connected — and none listens yet: the agent then holds the intent until
558
+ * the listener arrives, and {@link open} hands it that instance rather than launching another;
559
+ * - with a container, an app the directory names for the intent that has no instance listening
560
+ * or booting, which choosing launches. A raise that asked for a new instance launches even
561
+ * when one is booting.
332
562
  *
333
- * An app with no live instance drops out, which makes the raise a clean `NoAppsFound`.
563
+ * Without a container, an app with no live instance drops out, which makes the raise a clean
564
+ * `NoAppsFound`.
334
565
  */
335
- async narrowIntents(_raiser, appIntents, context) {
336
- return appIntents
566
+ async narrowIntents(raiser, appIntents, context) {
567
+ // a raise for a new instance is not held for a booting one; open() takes the note when it launches
568
+ const fresh = this.newInstance.some((note) => note.from === raiser.instanceId &&
569
+ (note.contextType ?? 'fdc3.nothing') === (context?.type ?? 'fdc3.nothing') &&
570
+ (note.intent === undefined || appIntents.some((appIntent) => appIntent.intent.name === note.intent)));
571
+ const narrowed = appIntents
337
572
  .map((appIntent) => {
338
- const listening = appIntent.apps.filter((app) => app.instanceId !== undefined && this.hasListener(app.instanceId, appIntent.intent.name, context?.type));
339
- const waiting = appIntent.apps.filter((app) => app.instanceId === undefined &&
340
- this.live(app.appId).length > 0 &&
341
- !listening.some((candidate) => candidate.appId === app.appId));
342
- return { ...appIntent, apps: [...listening, ...waiting] };
573
+ // a raise for a new instance is offered launches only: every app the directory names for it
574
+ const listening = fresh
575
+ ? []
576
+ : appIntent.apps.filter((app) => app.instanceId !== undefined && this.hasListener(app.instanceId, appIntent.intent.name, context?.type));
577
+ const listens = (appId) => listening.some((candidate) => candidate.appId === appId);
578
+ const entries = appIntent.apps.filter((app) => app.instanceId === undefined && !listens(app.appId));
579
+ const waiting = fresh ? [] : entries.filter((app) => this.booting(app.appId));
580
+ // launching is for an app nothing running or booting can take the intent for
581
+ const launches = this.launchable ? entries.filter((app) => !waiting.includes(app)) : [];
582
+ // marked, so the resolver can say choosing it waits rather than launches
583
+ const marked = waiting.map((app) => ({ ...app, instanceMetadata: { ...app.instanceMetadata, braidStarting: true } }));
584
+ return { ...appIntent, apps: [...listening, ...marked, ...launches] };
343
585
  })
344
586
  .filter((appIntent) => appIntent.apps.length > 0);
587
+ return narrowed;
345
588
  }
346
589
  }
347
590
  //# sourceMappingURL=agent.js.map
package/src/agent.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"agent.js","sourceRoot":"","sources":["../../../../libs/braid-fdc3/src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,KAAK,GAMN,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,GAElB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,SAAS,EACT,YAAY,GAKb,MAAM,sBAAsB,CAAC;AAsC9B,0GAA0G;AAC1G,MAAM,YAAY,GAAG,KAAK,CA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ACpD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
package/src/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export { createBraidDesktopAgent } from './agent.js';
2
- export type { BraidDesktopAgent, BraidDesktopAgentOptions } from './agent.js';
2
+ export type { BraidDesktopAgent, BraidDesktopAgentOptions, IntentCandidate, IntentChoiceRequest, IntentResolverHook, } from './agent.js';
3
+ export { dialogResolver } from './resolver.js';
4
+ export type { DialogResolverOptions } from './resolver.js';
package/src/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export { createBraidDesktopAgent } from './agent.js';
2
+ export { dialogResolver } from './resolver.js';
2
3
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/braid-fdc3/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/braid-fdc3/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAQrD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { IntentResolverHook } from './agent.js';
2
+ export interface DialogResolverOptions {
3
+ /**
4
+ * Shows "Remember my choice", and answers with `remember: true` when it is ticked. Off by
5
+ * default: the agent keeps nothing, so offer it only when the hook is wrapped by something that
6
+ * does — the console workspace's `intentResolver`.
7
+ */
8
+ remember?: boolean;
9
+ }
10
+ /**
11
+ * The built-in intent resolver: a modal `<dialog>` listing the candidates. Keyboard-usable as a
12
+ * dialog is — Tab between choices, Enter to pick, Escape to cancel — and announced by its heading.
13
+ * It lives in a shadow root of its own, so the page's styles do not reach it.
14
+ */
15
+ export declare function dialogResolver(document: Document, options?: DialogResolverOptions): IntentResolverHook;
@@ -0,0 +1,91 @@
1
+ /**
2
+ * The built-in intent resolver: a modal `<dialog>` listing the candidates. Keyboard-usable as a
3
+ * dialog is — Tab between choices, Enter to pick, Escape to cancel — and announced by its heading.
4
+ * It lives in a shadow root of its own, so the page's styles do not reach it.
5
+ */
6
+ export function dialogResolver(document, options = {}) {
7
+ return ({ candidates, context }) => new Promise((resolve) => {
8
+ const host = document.createElement('braid-intent-resolver');
9
+ const root = host.attachShadow({ mode: 'open' });
10
+ const dialog = document.createElement('dialog');
11
+ dialog.setAttribute('aria-labelledby', 'title');
12
+ const intents = [...new Set(candidates.map((candidate) => candidate.intent))];
13
+ const style = document.createElement('style');
14
+ style.textContent = `
15
+ dialog { font: 14px/1.4 system-ui, sans-serif; border: 1px solid #8886; border-radius: 8px; padding: 16px; min-width: 280px; max-width: 420px; color: CanvasText; background: Canvas; }
16
+ dialog::backdrop { background: #0004; }
17
+ h2 { font-size: 15px; margin: 0 0 4px; }
18
+ p { margin: 0 0 12px; color: GrayText; }
19
+ ul { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; }
20
+ button { font: inherit; width: 100%; text-align: start; padding: 8px 10px; border: 1px solid #8886; border-radius: 6px; background: transparent; color: inherit; cursor: pointer; display: flex; gap: 8px; align-items: center; }
21
+ button:hover { background: #8882; }
22
+ button:focus-visible { outline: 2px solid Highlight; outline-offset: 1px; }
23
+ img { width: 20px; height: 20px; }
24
+ .note { margin-inline-start: auto; color: GrayText; font-size: 12px; }
25
+ footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
26
+ footer button { width: auto; margin-inline-start: auto; }
27
+ `;
28
+ const title = document.createElement('h2');
29
+ title.id = 'title';
30
+ title.textContent = intents.length === 1 ? `Open with…` : 'Choose an action';
31
+ const detail = document.createElement('p');
32
+ detail.textContent = intents.length === 1 ? `${intents[0]} · ${context?.type ?? ''}` : String(context?.type ?? '');
33
+ const list = document.createElement('ul');
34
+ candidates.forEach((candidate, index) => {
35
+ const item = document.createElement('li');
36
+ const button = document.createElement('button');
37
+ button.type = 'button';
38
+ button.dataset.index = String(index);
39
+ if (candidate.icon && /^https:/i.test(candidate.icon)) {
40
+ const icon = document.createElement('img');
41
+ icon.src = candidate.icon;
42
+ icon.alt = '';
43
+ button.append(icon);
44
+ }
45
+ const name = document.createElement('span');
46
+ name.textContent = intents.length === 1 ? candidate.title : `${candidate.title} — ${candidate.intent}`;
47
+ const note = document.createElement('span');
48
+ note.className = 'note';
49
+ const state = candidate.instanceId ? 'open' : candidate.starting ? 'starting' : 'new';
50
+ note.textContent = state;
51
+ button.append(name, note);
52
+ const spoken = { open: 'already open', starting: 'starting', new: 'opens a new one' }[state];
53
+ button.setAttribute('aria-label', `${name.textContent}, ${spoken}`);
54
+ if (index === 0)
55
+ button.autofocus = true;
56
+ item.append(button);
57
+ list.append(item);
58
+ });
59
+ const footer = document.createElement('footer');
60
+ const label = document.createElement('label');
61
+ const remember = document.createElement('input');
62
+ remember.type = 'checkbox';
63
+ remember.name = 'remember';
64
+ label.append(remember, ' Remember my choice');
65
+ const cancel = document.createElement('button');
66
+ cancel.type = 'button';
67
+ cancel.textContent = 'Cancel';
68
+ cancel.dataset.cancel = '';
69
+ footer.append(...(options.remember ? [label] : []), cancel);
70
+ dialog.append(title, detail, list, footer);
71
+ root.append(style, dialog);
72
+ let answer;
73
+ dialog.addEventListener('click', (event) => {
74
+ const button = event.target.closest?.('button');
75
+ if (!button)
76
+ return;
77
+ if (button.dataset.index !== undefined) {
78
+ answer = { candidate: candidates[Number(button.dataset.index)], ...(options.remember ? { remember: remember.checked } : {}) };
79
+ }
80
+ dialog.close();
81
+ });
82
+ // Escape, or the dialog closed any other way, is a cancel unless a choice was made
83
+ dialog.addEventListener('close', () => {
84
+ host.remove();
85
+ resolve(answer);
86
+ });
87
+ document.body.append(host);
88
+ dialog.showModal();
89
+ });
90
+ }
91
+ //# sourceMappingURL=resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../../../libs/braid-fdc3/src/resolver.ts"],"names":[],"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