@segmentstream/ontology 0.203.0 → 0.203.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.203.1
4
+
5
+ An app that declares `signIn.cli` now asks SegmentStream whether the member's consent still holds
6
+ before it exchanges a CLI token for a grant, so withdrawing the app on segmentstream.com also stops
7
+ a token issued just before.
8
+
3
9
  ## 0.203.0
4
10
 
5
11
  `signIn.cli: true` lets members' SegmentStream CLI reach the app's MCP server without a device
@@ -3,8 +3,14 @@ import type { FederationSession } from "../runtime/federation.js";
3
3
  export declare function createFederationStatus(options?: {
4
4
  fetch?: typeof fetch;
5
5
  now?: () => number;
6
- }): (session: Pick<FederationSession, "issuer" | "clientId" | "consentId" | "generation" | "sessionId">) => Promise<boolean>;
7
- export declare const federationStatus: (session: Pick<FederationSession, "issuer" | "clientId" | "consentId" | "generation" | "sessionId">) => Promise<boolean>;
6
+ }): (session: Pick<FederationSession, "issuer" | "clientId" | "consentId" | "generation" | "sessionId"> & {
7
+ /** A CLI token's consent, which no browser session carries. */
8
+ readonly use?: "cli";
9
+ }) => Promise<boolean>;
10
+ export declare const federationStatus: (session: Pick<FederationSession, "issuer" | "clientId" | "consentId" | "generation" | "sessionId"> & {
11
+ /** A CLI token's consent, which no browser session carries. */
12
+ readonly use?: "cli";
13
+ }) => Promise<boolean>;
8
14
  export interface BrowserRevision {
9
15
  readonly issuer: string;
10
16
  readonly clientId: string;
@@ -9,6 +9,7 @@ export function createFederationStatus(options = {}) {
9
9
  session.consentId,
10
10
  session.generation,
11
11
  session.sessionId,
12
+ session.use,
12
13
  ]);
13
14
  const cached = cache.get(key);
14
15
  if (cached && now() - cached.checkedAt < 55_000) {
@@ -22,6 +23,7 @@ export function createFederationStatus(options = {}) {
22
23
  generation: String(session.generation),
23
24
  consent: session.consentId,
24
25
  ...(session.sessionId === undefined ? {} : { session: session.sessionId }),
26
+ ...(session.use === undefined ? {} : { use: session.use }),
25
27
  }).toString();
26
28
  const response = await (options.fetch ?? fetch)(endpoint, {
27
29
  cache: "no-store",
@@ -49,6 +49,7 @@ import { suggestNames } from "./name-suggestions.js";
49
49
  import { observeMcpRequest } from "./mcp/request-log.js";
50
50
  import { oauthLayer } from "./oauth/server.js";
51
51
  import { createFederationProvider } from "./federation-provider.js";
52
+ import { federationStatus } from "./federation-status.js";
52
53
  import { federationLayer } from "./federation-server.js";
53
54
  import { channelSessionLayer } from "./channel/sessions.js";
54
55
  import { channelSignInLayer } from "./channel/sign-in.js";
@@ -446,7 +447,14 @@ export function createOntologyService(ontology, config) {
446
447
  ? {
447
448
  cliExchange: {
448
449
  clientId: federationConfig.clientId,
449
- verify: (token) => cliProvider.verifyCliToken(token),
450
+ // The token is offline evidence; Cloud confirms the member's consent still holds.
451
+ verify: async (token) => {
452
+ const identity = await cliProvider.verifyCliToken(token);
453
+ if (!(await federationStatus({ ...identity, use: "cli" }))) {
454
+ throw new Error("The member's consent to this app is no longer active");
455
+ }
456
+ return identity;
457
+ },
450
458
  },
451
459
  }
452
460
  : {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segmentstream/ontology",
3
- "version": "0.203.0",
3
+ "version": "0.203.1",
4
4
  "description": "Define a SegmentStream workspace app's ontology: entities, relationships, roles and actions, written with Effect.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "SegmentStream",