@every-app/sdk 0.3.0-rc.10 → 0.3.0-rc.11

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.
Files changed (89) hide show
  1. package/README.md +62 -64
  2. package/dist/cloudflare/catalogSettings.generated.d.ts +7 -4
  3. package/dist/cloudflare/catalogSettings.generated.d.ts.map +1 -1
  4. package/dist/cloudflare/catalogSettings.generated.js +7 -6
  5. package/dist/cloudflare/index.d.ts +1 -1
  6. package/dist/cloudflare/index.d.ts.map +1 -1
  7. package/dist/cloudflare/worker.d.ts +35 -1
  8. package/dist/cloudflare/worker.d.ts.map +1 -1
  9. package/dist/cloudflare/worker.js +31 -4
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/internal/aiDefault.d.ts +4 -3
  13. package/dist/internal/aiDefault.d.ts.map +1 -1
  14. package/dist/internal/aiDefault.js +6 -5
  15. package/dist/internal/aiProviders.d.ts.map +1 -1
  16. package/dist/internal/aiProviders.js +2 -2
  17. package/dist/internal/capabilities.d.ts +97 -481
  18. package/dist/internal/capabilities.d.ts.map +1 -1
  19. package/dist/internal/capabilities.js +47 -548
  20. package/dist/internal/catalog/index.d.ts +35 -0
  21. package/dist/internal/catalog/index.d.ts.map +1 -1
  22. package/dist/internal/catalog/infra.d.ts +35 -0
  23. package/dist/internal/catalog/infra.d.ts.map +1 -1
  24. package/dist/internal/catalog/infra.js +65 -0
  25. package/dist/internal/events.d.ts +52 -1
  26. package/dist/internal/events.d.ts.map +1 -1
  27. package/dist/internal/events.js +65 -3
  28. package/dist/internal/oauthBuiltIns.d.ts +101 -0
  29. package/dist/internal/oauthBuiltIns.d.ts.map +1 -0
  30. package/dist/internal/oauthBuiltIns.js +122 -0
  31. package/dist/internal/oauthClient.d.ts +7 -47
  32. package/dist/internal/oauthClient.d.ts.map +1 -1
  33. package/dist/internal/oauthClient.js +1 -115
  34. package/dist/internal/oauthPresets.d.ts +14 -15
  35. package/dist/internal/oauthPresets.d.ts.map +1 -1
  36. package/dist/internal/oauthPresets.js +42 -853
  37. package/dist/internal/oauthScopes.d.ts +43 -155
  38. package/dist/internal/oauthScopes.d.ts.map +1 -1
  39. package/dist/internal/oauthScopes.js +82 -475
  40. package/dist/internal/oauthSpec.d.ts +72 -71
  41. package/dist/internal/oauthSpec.d.ts.map +1 -1
  42. package/dist/internal/oauthSpec.js +178 -447
  43. package/dist/internal/protocol.d.ts +42 -13
  44. package/dist/internal/protocol.d.ts.map +1 -1
  45. package/dist/internal/protocol.js +45 -7
  46. package/dist/internal/providerRegistry.d.ts +1 -61
  47. package/dist/internal/providerRegistry.d.ts.map +1 -1
  48. package/dist/internal/providerRegistry.js +8 -115
  49. package/dist/internal/providerSpec.d.ts.map +1 -1
  50. package/dist/internal/providerSpec.js +14 -36
  51. package/dist/internal/remoteMcp.d.ts.map +1 -1
  52. package/dist/internal/remoteMcp.js +1 -5
  53. package/dist/internal/tools.d.ts +5 -4
  54. package/dist/internal/tools.d.ts.map +1 -1
  55. package/dist/internal/tools.js +4 -3
  56. package/dist/manifest.d.ts +34 -5
  57. package/dist/manifest.d.ts.map +1 -1
  58. package/dist/manifest.js +1 -1
  59. package/dist/server/attribution.d.ts +9 -0
  60. package/dist/server/attribution.d.ts.map +1 -1
  61. package/dist/server/attribution.js +7 -1
  62. package/dist/server/connectUrl.d.ts +4 -9
  63. package/dist/server/connectUrl.d.ts.map +1 -1
  64. package/dist/server/connectUrl.js +17 -14
  65. package/dist/server/eventsEndpoint.d.ts +48 -0
  66. package/dist/server/eventsEndpoint.d.ts.map +1 -0
  67. package/dist/server/eventsEndpoint.js +145 -0
  68. package/dist/server/everyApp.d.ts +15 -6
  69. package/dist/server/everyApp.d.ts.map +1 -1
  70. package/dist/server/everyApp.js +12 -3
  71. package/dist/server/index.d.ts +4 -3
  72. package/dist/server/index.d.ts.map +1 -1
  73. package/dist/server/index.js +2 -2
  74. package/dist/server/integrationFetch.d.ts +59 -71
  75. package/dist/server/integrationFetch.d.ts.map +1 -1
  76. package/dist/server/integrationFetch.js +117 -392
  77. package/dist/server/tools.d.ts +7 -2
  78. package/dist/server/tools.d.ts.map +1 -1
  79. package/dist/server/tools.js +2 -1
  80. package/dist/server/toolsEndpoint.d.ts +3 -1
  81. package/dist/server/toolsEndpoint.d.ts.map +1 -1
  82. package/dist/server/toolsEndpoint.js +9 -3
  83. package/dist/server/webhooks.d.ts +56 -0
  84. package/dist/server/webhooks.d.ts.map +1 -0
  85. package/dist/server/webhooks.js +205 -0
  86. package/package.json +1 -1
  87. package/dist/server/authorizeUrl.d.ts +0 -43
  88. package/dist/server/authorizeUrl.d.ts.map +0 -1
  89. package/dist/server/authorizeUrl.js +0 -106
@@ -16,18 +16,14 @@
16
16
  * proxy's rules: inference routes only, the model allowlist, the usage
17
17
  * tap. Never a capability: its key would reach the account's credits
18
18
  * and keys on the same host.
19
- * - `oauth_client`: a provider's OAuth client (Google's, Microsoft's,
20
- * Slack's), held the same way. The gateway completes the token endpoint
21
- * calls only, putting the client on them; the app builds the authorize
22
- * URL from the public client id (`integrationStatus()`), sends people
23
- * back to a callback its manifest entry lists (`redirectPaths`), keeps
24
- * the user tokens and calls the provider's API with them itself. Other
25
- * providers' clients (GitHub, the social networks) are presets
26
- * (./oauthPresets.ts): rows only once an operator adds one. A client shared by apps
27
- * with different needs carries a `scopePolicy`: named scope sets an app
28
- * lists in its manifest entry's `scopes`, which ./oauthScopes.ts turns
29
- * into what the app may ask the provider for and what a token it is
30
- * handed may carry.
19
+ * - `oauth_client`: an OAuth provider (Google, Microsoft, Slack built
20
+ * in; GitHub and others as presets, ./oauthPresets.ts) whose client the
21
+ * gateway holds and whose flow it runs. A person connects in an app,
22
+ * for exactly the provider scopes the app's manifest entry lists
23
+ * (`scopes`); the gateway keeps the tokens and puts the person's token
24
+ * on the app's calls to the provider's `api` hosts. Each provider is a
25
+ * spec (./oauthSpec.ts), its differences data; ./oauthScopes.ts holds
26
+ * the one set of scope rules.
31
27
  * - `service`: something the gateway does itself, with no upstream host
32
28
  * an app names (sending email, listing the organization's members). An
33
29
  * app lists it the same way and calls its routes,
@@ -317,105 +313,10 @@ export interface GatewayServiceCapability {
317
313
  /** The everyapp skill's setup guide, when there is anything to set up. */
318
314
  setup?: string;
319
315
  }
320
- /** Where the gateway puts an OAuth client on a token request. */
316
+ /** Where the Gateway puts its OAuth client on a token request: the form body or HTTP Basic. */
321
317
  export type OAuthClientInjection = "form" | "basic";
322
- /** A token endpoint an `oauth_client` capability completes, with its rule. */
323
- export interface OAuthTokenEndpoint {
324
- /** The endpoint's host, always over https. */
325
- host: string;
326
- /** The exact pathname. */
327
- path: string;
328
- methods: readonly ("GET" | "POST")[];
329
- /**
330
- * Where the client goes: the form body or HTTP Basic
331
- * (injectClientCredentials() in ./oauthClient.ts).
332
- */
333
- inject: OAuthClientInjection;
334
- }
335
- /**
336
- * One host's allowlist a scope set unlocks. Matched against the raw
337
- * pathname, case preserved, by `scopeRouteAllows()` in ./oauthScopes.ts:
338
- * the proxy boundary once the gateway holds tokens, tested data until then.
339
- */
340
- export interface OAuthScopeRoute {
341
- /** A bare https host, one of the capability's `api` hosts. */
342
- host: string;
343
- /**
344
- * Raw-path entries: exact, or a prefix when the entry ends in `/`. GET
345
- * and HEAD go through when one matches.
346
- */
347
- paths: readonly string[];
348
- /**
349
- * The read-shaped POSTs a read set allows (queries, watches): anchored,
350
- * flagless RegExps over the raw pathname. Every other POST is refused.
351
- */
352
- posts?: readonly RegExp[];
353
- }
354
- /**
355
- * A named bundle an app lists under `scopes`: what it asks the provider for
356
- * and what that unlocks.
357
- */
358
- export interface OAuthScopeSet {
359
- /** What Admin → Apps and a consent page call it: "Gmail (read-only)". */
360
- label: string;
361
- /**
362
- * A read set unlocks GET, HEAD and its `posts` only. No write set exists
363
- * on the shared clients yet; adding one is a reviewed registry change.
364
- */
365
- access: CapabilityAccess;
366
- /** The provider's scope strings, requested verbatim (Slack: bot scopes). */
367
- scopes: readonly string[];
368
- /** Slack's `user_scope` strings, issued to the installing person's own token; absent elsewhere. */
369
- userScopes?: readonly string[];
370
- routes: readonly OAuthScopeRoute[];
371
- }
372
- /**
373
- * How a provider spells granted scopes in its token response; each has a
374
- * parser in ./oauthScopes.ts. `space` and `comma` are the plain spellings
375
- * a registered provider names (`scopeDialect`): a token response without
376
- * a `scope` field is taken as granted-as-requested (RFC 6749 §5.1).
377
- */
378
- export type OAuthScopeDialect = "google" | "microsoft" | "slack" | "space" | "comma";
379
- /**
380
- * Everything the gateway needs to hold an app to its scope sets at the
381
- * token endpoint. Present means an app's entry must list `scopes` and the
382
- * gateway refuses tokens outside them. Data only: the dialect selects the
383
- * parser, so the registry stays a table.
384
- */
385
- export interface OAuthScopePolicy {
386
- sets: Readonly<Record<string, OAuthScopeSet>>;
387
- /**
388
- * Scopes a token may carry beyond the declared sets without refusal:
389
- * identity and refresh scopes, in every spelling the provider uses.
390
- * Never a data scope.
391
- */
392
- tolerated: readonly string[];
393
- /**
394
- * Scopes every declaring app asks for whatever its sets, on the authorize
395
- * URL and Microsoft's token leg (`offline_access`). Always tolerated.
396
- */
397
- alwaysRequested: readonly string[];
398
- dialect: OAuthScopeDialect;
399
- /**
400
- * The `tokenGrantType()` values the gateway completes through this
401
- * client. `null` is a code exchange that carries no `grant_type` (Slack's
402
- * oauth.v2.access).
403
- */
404
- grantTypes: readonly (string | null)[];
405
- /**
406
- * What becomes of the token request's `scope` once it passes the check:
407
- * `replace` it with the app's requested list (Microsoft's token-leg
408
- * extension, which keeps a token to one resource), `drop` it (Google
409
- * documents no `scope` on either token leg), or `keep` it (Slack).
410
- */
411
- requestScope: "replace" | "drop" | "keep";
412
- /**
413
- * Decoded path segments no set unlocks on any host, compared
414
- * case-insensitively: batch tunnels that carry other requests inside, and
415
- * resources that reveal secrets under a read scope.
416
- */
417
- deniedSegments: readonly string[];
418
- }
318
+ /** How a provider separates scopes in its `scope` parameter and its token answer. */
319
+ export type OAuthScopeSeparator = "space" | "comma";
419
320
  /** How a provider names the account a new connection is for, read once after the exchange. */
420
321
  export interface OAuthIdentity {
421
322
  /** An https URL on one of the provider's `api` hosts, GET with the new token. */
@@ -426,94 +327,74 @@ export interface OAuthIdentity {
426
327
  id?: string;
427
328
  }
428
329
  /**
429
- * What the Gateway needs to run a provider's authorization-code flow
430
- * itself (docs/design/2026-10-oauth-providers.md section 5): present on a
431
- * catalog entry that supports the Gateway-owned flow, and built from a
432
- * registered row's `auth` (`kind: "oauth2-user"`). Absent: the entry
433
- * keeps the app-driven flow only (the social networks).
330
+ * The provider's authorization-code flow as data, from its spec
331
+ * (./oauthSpec.ts): everything that differs between providers. The
332
+ * Gateway runs it; an app never sees a token or the client.
434
333
  */
435
334
  export interface OAuthFlow {
335
+ /** Where the browser goes to consent (https). */
336
+ authorizeUrl: string;
436
337
  /** The token endpoint the Gateway posts the code and refresh token to (https). */
437
338
  tokenUrl: string;
438
339
  /** Where a disconnect revokes the token; absent means the tokens die at their expiry. */
439
340
  revokeUrl?: string;
440
341
  /** The revoke call's method (default POST). */
441
342
  revokeMethod?: "POST" | "DELETE";
442
- /** Whether the authorize request carries a PKCE S256 challenge (default true). */
343
+ /** Where the client goes on the token request. */
344
+ inject: OAuthClientInjection;
345
+ /** Whether the authorize request carries a PKCE S256 challenge. */
443
346
  pkce: boolean;
444
- /** How the token response spells what it granted. */
445
- scopeDialect: OAuthScopeDialect;
347
+ scopeSeparator: OAuthScopeSeparator;
348
+ /**
349
+ * Joined onto an app's short scope (`gmail.modify`) for the authorize
350
+ * URL, and taken off a granted one for comparison: Google's
351
+ * `https://www.googleapis.com/auth/`. Absent: scopes as written.
352
+ */
353
+ scopePrefix?: string;
446
354
  /** Extra query on the authorize URL (Google's `access_type=offline`). */
447
355
  authorizeParams?: Readonly<Record<string, string>>;
448
356
  /** Extra headers on the token request (GitHub's `Accept: application/json`). */
449
357
  tokenHeaders?: Readonly<Record<string, string>>;
450
358
  identity?: OAuthIdentity;
359
+ /**
360
+ * Scopes the Gateway adds to every connect, whatever the app lists: what
361
+ * the identity URL needs, and a refresh token's (Microsoft's
362
+ * `offline_access`). Tolerated at mint; apps never list them.
363
+ */
364
+ identityScopes: readonly string[];
365
+ /** Scopes a token may carry beyond what was asked without refusal (another spelling of an identity scope). Never a data scope. */
366
+ tolerated: readonly string[];
451
367
  }
452
368
  /**
453
- * A provider's OAuth client the gateway holds. The gateway completes its
454
- * token endpoints only (`token`), putting the client on each request; the
455
- * app builds the authorize URL from the public client id and calls the
456
- * provider's API with the user tokens it keeps.
369
+ * An OAuth provider the Gateway holds a client for and runs the flow for
370
+ * (docs/design/2026-11-oauth-simplify.md). A person connects in an app;
371
+ * the connection is theirs and that app's, for exactly the scopes the
372
+ * app's `everyapp.config.ts` lists, and the app calls the provider's
373
+ * `api` hosts through the Gateway, which puts the token on.
457
374
  */
458
375
  export interface OAuthClientCapability {
459
376
  mode: "oauth_client";
460
- /** The provider's name in errors and logs. */
377
+ /** The provider's name in errors, pages and logs. */
461
378
  label: string;
462
- /** Gateway secret names. No `clientSecret`: a public client, the id alone. */
379
+ /** Gateway setting names. No `clientSecret`: a public client, the id alone. */
463
380
  secrets: {
464
381
  clientId: string;
465
382
  clientSecret?: string;
466
383
  };
467
- /** The only calls the gateway completes; anything else is refused. */
468
- token: readonly OAuthTokenEndpoint[];
469
- /**
470
- * Obtaining and refreshing user tokens with the operator's client
471
- * writes, so a catalog client is `["write"]`. A registered OAuth
472
- * provider says what the proxy may do with the held token: read, write
473
- * or both (docs/design/2026-10-oauth-providers.md section 7).
474
- */
475
- access: readonly CapabilityAccess[];
476
- /** Where the operator registers the client. */
384
+ /** Where the operator registers the client (the spec's `docs`). */
477
385
  console: string;
478
386
  /** The everyapp skill's setup guide for the client, when one exists. */
479
387
  setup?: string;
480
- /**
481
- * The authorize endpoint the app sends people to and the scopes the
482
- * client must be allowed: the operator's checklist and the docs. With
483
- * a `scopePolicy`, the union of its sets' scopes and `alwaysRequested`.
484
- */
485
- authorize: {
486
- url: string;
487
- scopes: readonly string[];
488
- };
489
- /**
490
- * Named scope sets an app lists in its manifest entry's `scopes`, for a
491
- * client several apps share with different needs. Absent: the whole
492
- * client is the grant.
493
- */
494
- scopePolicy?: OAuthScopePolicy;
495
- /**
496
- * Hosts the app calls afterwards with the user's token; the Gateway's
497
- * held-token branch forwards to these alone, and a scope policy's
498
- * routes are on them.
499
- */
388
+ /** The only hosts the held token is ever sent to, over https. */
500
389
  api: readonly string[];
501
- /** The Gateway-owned flow, when the entry supports it. */
502
- flow?: OAuthFlow;
503
- /** A registered OAuth provider's spec fields (a catalog client has `setup` instead). */
390
+ flow: OAuthFlow;
391
+ /** What it is for, in one line. */
504
392
  description?: string;
505
393
  /** The API reference (a spec's `api`), optional. */
506
394
  reference?: string;
507
395
  hint?: string;
508
396
  example?: string;
509
397
  tags?: readonly string[];
510
- /**
511
- * A registered OAuth provider's methods: what a read grant may use
512
- * (default GET and HEAD) and what a write grant adds (default the
513
- * API-key default). A catalog client leaves both unset.
514
- */
515
- readMethods?: readonly string[];
516
- writeMethods?: readonly string[];
517
398
  }
518
399
  export type Capability = ApiKeyCapability | AiProviderCapability | OAuthClientCapability | GatewayServiceCapability;
519
400
  export declare const CAPABILITIES: {
@@ -1724,6 +1605,41 @@ export declare const CAPABILITIES: {
1724
1605
  };
1725
1606
  readonly tags: readonly ["weather", "forecast"];
1726
1607
  };
1608
+ readonly daytona: {
1609
+ readonly mode: "api_key";
1610
+ readonly label: "Daytona";
1611
+ readonly description: "Sandboxes for running code: create, start, stop, archive and delete sandboxes, and manage their snapshots and volumes.";
1612
+ readonly auth: {
1613
+ readonly kind: "bearer";
1614
+ readonly secret: "DAYTONA_API_KEY";
1615
+ };
1616
+ readonly docs: "https://www.daytona.io/docs/en/api-keys/";
1617
+ readonly api: "https://www.daytona.io/docs/en/tools/api/";
1618
+ readonly hosts: readonly ["app.daytona.io"];
1619
+ readonly data: "account";
1620
+ readonly access: readonly ["read", "write"];
1621
+ readonly readMethods: readonly ["GET", "HEAD"];
1622
+ readonly writeMethods: readonly ["POST", "PUT", "PATCH", "DELETE"];
1623
+ readonly accountWidePaths: readonly [readonly ["organizations"], readonly ["organization"], readonly ["billing"], readonly ["api-keys"], readonly ["users"], readonly ["audit"], readonly ["webhooks"], readonly ["secret"], readonly ["docker-registry"], readonly ["object-storage"], readonly ["regions"], readonly ["runners"], readonly ["for-runner"], readonly ["jobs"], readonly ["warm-pools"], readonly ["preview"], readonly ["ssh-access", "validate"]];
1624
+ readonly hint: "An API key from the Daytona dashboard's Keys page, with only the permissions the apps need; the Gateway sends it as a bearer token to app.daytona.io. Any key of an organization reaches every running sandbox in it, so give the Gateway a Daytona organization of its own.";
1625
+ readonly secrets: readonly [{
1626
+ readonly name: "DAYTONA_API_KEY";
1627
+ readonly hint: "An API key from the Daytona dashboard's Keys page: write:sandboxes and delete:sandboxes (and the snapshot or volume ones) only if an app needs them, and never manage:api_keys, manage:secrets, manage:billing or the region and runner permissions.";
1628
+ }];
1629
+ readonly smoke: {
1630
+ readonly method: "GET";
1631
+ readonly path: "/api/sandbox";
1632
+ readonly expect: readonly [200];
1633
+ readonly free: true;
1634
+ readonly note: "Lists the organization's sandboxes; any key may read them.";
1635
+ };
1636
+ readonly example: "start a sandbox from my snapshot and stop it when the run is done";
1637
+ readonly verified: {
1638
+ readonly on: "2026-11-01";
1639
+ readonly how: "docs";
1640
+ };
1641
+ readonly tags: readonly ["sandbox", "compute", "hosting"];
1642
+ };
1727
1643
  readonly postmark: {
1728
1644
  readonly mode: "api_key";
1729
1645
  readonly label: "Postmark";
@@ -2702,303 +2618,22 @@ export declare const CAPABILITIES: {
2702
2618
  readonly settings: readonly [];
2703
2619
  readonly optionalSettings: readonly [];
2704
2620
  };
2705
- readonly slack: {
2706
- readonly mode: "oauth_client";
2707
- readonly label: "Slack";
2708
- readonly secrets: {
2709
- readonly clientId: "SLACK_CLIENT_ID";
2710
- readonly clientSecret: "SLACK_CLIENT_SECRET";
2711
- };
2712
- readonly token: readonly [{
2713
- readonly host: "slack.com";
2714
- readonly path: "/api/oauth.v2.access";
2715
- readonly methods: readonly ["POST"];
2716
- readonly inject: "form";
2717
- }];
2718
- readonly access: readonly ["write"];
2719
- readonly console: "https://api.slack.com/apps";
2720
- readonly setup: "setup/slack.md";
2721
- readonly authorize: {
2722
- readonly url: "https://slack.com/oauth/v2/authorize";
2723
- readonly scopes: readonly ["channels:read", "groups:read", "users:read", "users:read.email", "chat:write", "chat:write.public", "chat:write.customize", "channels:join", "channels:manage", "groups:write", "channels:write.invites", "groups:write.invites", "im:write", "files:write", "channels:write"];
2724
- };
2725
- readonly scopePolicy: {
2726
- readonly dialect: "slack";
2727
- readonly grantTypes: readonly [null, "refresh_token"];
2728
- readonly requestScope: "keep";
2729
- readonly alwaysRequested: readonly [];
2730
- readonly tolerated: readonly [];
2731
- readonly deniedSegments: readonly [];
2732
- readonly sets: {
2733
- readonly "channels.read": {
2734
- readonly label: "Channels (read-only)";
2735
- readonly access: "read";
2736
- readonly scopes: readonly ["channels:read", "groups:read"];
2737
- readonly routes: readonly [{
2738
- readonly host: "slack.com";
2739
- readonly paths: readonly ["/api/conversations.list", "/api/conversations.info", "/api/conversations.members", "/api/users.conversations"];
2740
- readonly posts: readonly [RegExp, RegExp];
2741
- }];
2742
- };
2743
- readonly "users.read": {
2744
- readonly label: "Members (read-only)";
2745
- readonly access: "read";
2746
- readonly scopes: readonly ["users:read"];
2747
- readonly routes: readonly [{
2748
- readonly host: "slack.com";
2749
- readonly paths: readonly ["/api/users.list", "/api/users.info", "/api/users.getPresence", "/api/bots.info"];
2750
- readonly posts: readonly [RegExp, RegExp];
2751
- }];
2752
- };
2753
- readonly "users.email": {
2754
- readonly label: "Members' email addresses (read-only)";
2755
- readonly access: "read";
2756
- readonly scopes: readonly ["users:read.email"];
2757
- readonly routes: readonly [{
2758
- readonly host: "slack.com";
2759
- readonly paths: readonly ["/api/users.lookupByEmail"];
2760
- readonly posts: readonly [RegExp];
2761
- }];
2762
- };
2763
- readonly "messages.write": {
2764
- readonly label: "Messages (post as the app)";
2765
- readonly access: "write";
2766
- readonly scopes: readonly ["chat:write", "chat:write.public", "chat:write.customize"];
2767
- readonly routes: readonly [{
2768
- readonly host: "slack.com";
2769
- readonly paths: readonly ["/api/chat.scheduledMessages.list"];
2770
- readonly posts: readonly [RegExp];
2771
- }];
2772
- };
2773
- readonly "channels.join": {
2774
- readonly label: "Channels (join public ones)";
2775
- readonly access: "write";
2776
- readonly scopes: readonly ["channels:join"];
2777
- readonly routes: readonly [{
2778
- readonly host: "slack.com";
2779
- readonly paths: readonly [];
2780
- readonly posts: readonly [RegExp];
2781
- }];
2782
- };
2783
- readonly "channels.manage": {
2784
- readonly label: "Channels (create, manage and invite to; open DMs)";
2785
- readonly access: "write";
2786
- readonly scopes: readonly ["channels:manage", "groups:write", "channels:write.invites", "groups:write.invites", "im:write"];
2787
- readonly routes: readonly [{
2788
- readonly host: "slack.com";
2789
- readonly paths: readonly [];
2790
- readonly posts: readonly [RegExp];
2791
- }];
2792
- };
2793
- readonly "files.write": {
2794
- readonly label: "Files (upload)";
2795
- readonly access: "write";
2796
- readonly scopes: readonly ["files:write"];
2797
- readonly routes: readonly [{
2798
- readonly host: "slack.com";
2799
- readonly paths: readonly [];
2800
- readonly posts: readonly [RegExp];
2801
- }];
2802
- };
2803
- readonly "user-channels.manage": {
2804
- readonly label: "Channels (as the installing person: read, manage, invite to)";
2805
- readonly access: "write";
2806
- readonly scopes: readonly [];
2807
- readonly userScopes: readonly ["channels:read", "channels:write", "groups:read", "groups:write"];
2808
- readonly routes: readonly [{
2809
- readonly host: "slack.com";
2810
- readonly paths: readonly ["/api/conversations.list", "/api/conversations.info", "/api/conversations.members", "/api/users.conversations"];
2811
- readonly posts: readonly [RegExp, RegExp];
2812
- }];
2813
- };
2814
- };
2815
- };
2816
- readonly api: readonly ["slack.com"];
2817
- readonly flow: {
2818
- readonly tokenUrl: "https://slack.com/api/oauth.v2.access";
2819
- readonly revokeUrl: "https://slack.com/api/auth.revoke";
2820
- readonly pkce: false;
2821
- readonly scopeDialect: "slack";
2822
- readonly identity: {
2823
- readonly url: "https://slack.com/api/auth.test";
2824
- readonly label: "team";
2825
- readonly id: "user_id";
2826
- };
2621
+ readonly slack: OAuthClientCapability & {
2622
+ secrets: {
2623
+ clientId: "SLACK_CLIENT_ID";
2624
+ clientSecret: "SLACK_CLIENT_SECRET";
2827
2625
  };
2828
2626
  };
2829
- readonly "google-workspace": {
2830
- readonly mode: "oauth_client";
2831
- readonly label: "Google (Gmail, Calendar, Search Console and Analytics)";
2832
- readonly secrets: {
2833
- readonly clientId: "GOOGLE_WORKSPACE_CLIENT_ID";
2834
- readonly clientSecret: "GOOGLE_WORKSPACE_CLIENT_SECRET";
2835
- };
2836
- readonly token: readonly [{
2837
- readonly host: "oauth2.googleapis.com";
2838
- readonly path: "/token";
2839
- readonly methods: readonly ["POST"];
2840
- readonly inject: "form";
2841
- }];
2842
- readonly access: readonly ["write"];
2843
- readonly console: "https://console.cloud.google.com/apis/credentials";
2844
- readonly setup: "setup/google.md";
2845
- readonly authorize: {
2846
- readonly url: "https://accounts.google.com/o/oauth2/v2/auth";
2847
- readonly scopes: readonly ["openid", "email", "profile", "https://www.googleapis.com/auth/gmail.readonly", "https://www.googleapis.com/auth/calendar.readonly", "https://www.googleapis.com/auth/webmasters.readonly", "https://www.googleapis.com/auth/analytics.readonly"];
2848
- };
2849
- readonly scopePolicy: {
2850
- readonly dialect: "google";
2851
- readonly grantTypes: readonly ["authorization_code", "refresh_token"];
2852
- readonly requestScope: "drop";
2853
- readonly alwaysRequested: readonly [];
2854
- readonly tolerated: readonly ["openid", "email", "profile", "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"];
2855
- readonly deniedSegments: readonly ["batch", "measurementProtocolSecrets"];
2856
- readonly sets: {
2857
- readonly identity: {
2858
- readonly label: "Google account (who you are)";
2859
- readonly access: "read";
2860
- readonly scopes: readonly ["openid", "email", "profile"];
2861
- readonly routes: readonly [{
2862
- readonly host: "openidconnect.googleapis.com";
2863
- readonly paths: readonly ["/v1/userinfo"];
2864
- }, {
2865
- readonly host: "www.googleapis.com";
2866
- readonly paths: readonly ["/oauth2/v2/userinfo", "/oauth2/v3/userinfo", "/userinfo/v2/me"];
2867
- }];
2868
- };
2869
- readonly "gmail.read": {
2870
- readonly label: "Gmail (read-only)";
2871
- readonly access: "read";
2872
- readonly scopes: readonly ["https://www.googleapis.com/auth/gmail.readonly"];
2873
- readonly routes: readonly [{
2874
- readonly host: "gmail.googleapis.com";
2875
- readonly paths: readonly ["/gmail/v1/users/"];
2876
- readonly posts: readonly [RegExp];
2877
- }];
2878
- };
2879
- readonly "calendar.read": {
2880
- readonly label: "Google Calendar (read-only)";
2881
- readonly access: "read";
2882
- readonly scopes: readonly ["https://www.googleapis.com/auth/calendar.readonly"];
2883
- readonly routes: readonly [{
2884
- readonly host: "www.googleapis.com";
2885
- readonly paths: readonly ["/calendar/v3/"];
2886
- readonly posts: readonly [RegExp, RegExp, RegExp, RegExp];
2887
- }];
2888
- };
2889
- readonly "search-console.read": {
2890
- readonly label: "Search Console (read-only)";
2891
- readonly access: "read";
2892
- readonly scopes: readonly ["https://www.googleapis.com/auth/webmasters.readonly"];
2893
- readonly routes: readonly [{
2894
- readonly host: "www.googleapis.com";
2895
- readonly paths: readonly ["/webmasters/v3/"];
2896
- readonly posts: readonly [RegExp];
2897
- }, {
2898
- readonly host: "searchconsole.googleapis.com";
2899
- readonly paths: readonly ["/webmasters/v3/"];
2900
- readonly posts: readonly [RegExp, RegExp];
2901
- }];
2902
- };
2903
- readonly "analytics.read": {
2904
- readonly label: "Google Analytics (read-only)";
2905
- readonly access: "read";
2906
- readonly scopes: readonly ["https://www.googleapis.com/auth/analytics.readonly"];
2907
- readonly routes: readonly [{
2908
- readonly host: "analyticsdata.googleapis.com";
2909
- readonly paths: readonly ["/v1beta/properties/"];
2910
- readonly posts: readonly [RegExp];
2911
- }, {
2912
- readonly host: "analyticsadmin.googleapis.com";
2913
- readonly paths: readonly ["/v1beta/accountSummaries", "/v1beta/accounts", "/v1beta/accounts/", "/v1beta/properties", "/v1beta/properties/", "/v1alpha/properties/"];
2914
- }];
2915
- };
2916
- };
2917
- };
2918
- readonly api: readonly ["gmail.googleapis.com", "www.googleapis.com", "searchconsole.googleapis.com", "analyticsdata.googleapis.com", "analyticsadmin.googleapis.com", "openidconnect.googleapis.com"];
2919
- readonly flow: {
2920
- readonly tokenUrl: "https://oauth2.googleapis.com/token";
2921
- readonly pkce: true;
2922
- readonly scopeDialect: "google";
2923
- readonly authorizeParams: {
2924
- readonly access_type: "offline";
2925
- readonly prompt: "consent";
2926
- };
2927
- readonly identity: {
2928
- readonly url: "https://openidconnect.googleapis.com/v1/userinfo";
2929
- readonly label: "email";
2930
- readonly id: "sub";
2931
- };
2627
+ readonly "google-workspace": OAuthClientCapability & {
2628
+ secrets: {
2629
+ clientId: "GOOGLE_WORKSPACE_CLIENT_ID";
2630
+ clientSecret: "GOOGLE_WORKSPACE_CLIENT_SECRET";
2932
2631
  };
2933
2632
  };
2934
- readonly "microsoft-365": {
2935
- readonly mode: "oauth_client";
2936
- readonly label: "Microsoft 365 (Outlook mail and calendar)";
2937
- readonly secrets: {
2938
- readonly clientId: "MICROSOFT_365_CLIENT_ID";
2939
- readonly clientSecret: "MICROSOFT_365_CLIENT_SECRET";
2940
- };
2941
- readonly token: readonly [{
2942
- readonly host: "login.microsoftonline.com";
2943
- readonly path: "/common/oauth2/v2.0/token";
2944
- readonly methods: readonly ["POST"];
2945
- readonly inject: "form";
2946
- }];
2947
- readonly access: readonly ["write"];
2948
- readonly console: "https://entra.microsoft.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade";
2949
- readonly setup: "setup/microsoft-365.md";
2950
- readonly authorize: {
2951
- readonly url: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize";
2952
- readonly scopes: readonly ["offline_access", "User.Read", "Mail.Read", "Calendars.Read"];
2953
- };
2954
- readonly scopePolicy: {
2955
- readonly dialect: "microsoft";
2956
- readonly grantTypes: readonly ["authorization_code", "refresh_token"];
2957
- readonly requestScope: "replace";
2958
- readonly alwaysRequested: readonly ["offline_access"];
2959
- readonly tolerated: readonly ["openid", "profile", "email", "offline_access", "User.Read"];
2960
- readonly deniedSegments: readonly ["$batch", "beta"];
2961
- readonly sets: {
2962
- readonly identity: {
2963
- readonly label: "Microsoft account (who you are)";
2964
- readonly access: "read";
2965
- readonly scopes: readonly ["User.Read"];
2966
- readonly routes: readonly [{
2967
- readonly host: "graph.microsoft.com";
2968
- readonly paths: readonly ["/v1.0/me", "/oidc/userinfo"];
2969
- }];
2970
- };
2971
- readonly "mail.read": {
2972
- readonly label: "Outlook mail (read-only)";
2973
- readonly access: "read";
2974
- readonly scopes: readonly ["Mail.Read"];
2975
- readonly routes: readonly [{
2976
- readonly host: "graph.microsoft.com";
2977
- readonly paths: readonly ["/v1.0/me/messages", "/v1.0/me/messages/", "/v1.0/me/mailFolders", "/v1.0/me/mailFolders/"];
2978
- }];
2979
- };
2980
- readonly "calendar.read": {
2981
- readonly label: "Outlook calendar (read-only)";
2982
- readonly access: "read";
2983
- readonly scopes: readonly ["Calendars.Read"];
2984
- readonly routes: readonly [{
2985
- readonly host: "graph.microsoft.com";
2986
- readonly paths: readonly ["/v1.0/me/calendar", "/v1.0/me/calendar/", "/v1.0/me/calendars", "/v1.0/me/calendars/", "/v1.0/me/events", "/v1.0/me/events/", "/v1.0/me/calendarView", "/v1.0/me/calendarView/"];
2987
- readonly posts: readonly [RegExp];
2988
- }];
2989
- };
2990
- };
2991
- };
2992
- readonly api: readonly ["graph.microsoft.com"];
2993
- readonly flow: {
2994
- readonly tokenUrl: "https://login.microsoftonline.com/common/oauth2/v2.0/token";
2995
- readonly pkce: true;
2996
- readonly scopeDialect: "microsoft";
2997
- readonly identity: {
2998
- readonly url: "https://graph.microsoft.com/v1.0/me";
2999
- readonly label: "userPrincipalName";
3000
- readonly id: "id";
3001
- };
2633
+ readonly "microsoft-365": OAuthClientCapability & {
2634
+ secrets: {
2635
+ clientId: "MICROSOFT_365_CLIENT_ID";
2636
+ clientSecret: "MICROSOFT_365_CLIENT_SECRET";
3002
2637
  };
3003
2638
  };
3004
2639
  };
@@ -3012,18 +2647,8 @@ export type ApiKeyCapabilityId = CapabilityIdOf<"api_key">;
3012
2647
  export type AiProviderId = CapabilityIdOf<"ai">;
3013
2648
  /** Capabilities the gateway performs itself, each with its SDK helper. */
3014
2649
  export type ServiceCapabilityId = CapabilityIdOf<"service">;
3015
- /** OAuth clients whose token endpoints apps reach with `integrationFetch()`. */
2650
+ /** The built-in OAuth providers whose APIs apps reach with `integrationFetch()`. */
3016
2651
  export type OAuthClientCapabilityId = CapabilityIdOf<"oauth_client">;
3017
- /**
3018
- * The scope set names an OAuth client offers; `never` for a client without
3019
- * a scope policy. Distributes over a union of ids, so a generic over two
3020
- * clients gets every name either offers rather than the names they share.
3021
- */
3022
- export type OAuthScopeSetName<Id extends OAuthClientCapabilityId> = Id extends unknown ? (typeof CAPABILITIES)[Id] extends {
3023
- scopePolicy: {
3024
- sets: infer S;
3025
- };
3026
- } ? keyof S & string : never : never;
3027
2652
  /** The Gateway settings an `auth` block names: the key, and a Basic username held as a setting. */
3028
2653
  type AuthSettingsOf<A> = (A extends {
3029
2654
  secret: infer S extends string;
@@ -3037,7 +2662,7 @@ type SettingsOf<C> = C extends {
3037
2662
  optionalSettings: readonly (infer O extends string)[];
3038
2663
  } ? S | O : C extends {
3039
2664
  secrets: infer S;
3040
- token: unknown;
2665
+ flow: unknown;
3041
2666
  } ? S[keyof S] & string : C extends {
3042
2667
  auth: infer A;
3043
2668
  } ? AuthSettingsOf<A> | (C extends {
@@ -3119,13 +2744,12 @@ export type IntegrationProxyRoute =
3119
2744
  capability: ApiKeyCapability;
3120
2745
  upstream: URL;
3121
2746
  }
3122
- /** A call to one of an OAuth client's token endpoints, with its rule. */
2747
+ /** A call to one of an OAuth provider's API hosts, which goes with the person's held token. */
3123
2748
  | {
3124
2749
  kind: "oauth_client";
3125
2750
  id: string;
3126
2751
  capability: OAuthClientCapability;
3127
2752
  upstream: URL;
3128
- endpoint: OAuthTokenEndpoint;
3129
2753
  }
3130
2754
  /** A call to one of the routes a service capability declares. */
3131
2755
  | {
@@ -3139,20 +2763,12 @@ export type CapabilitySettings = Readonly<Record<string, unknown>>;
3139
2763
  /**
3140
2764
  * The capability call an AppGateway path names, or null when the path names
3141
2765
  * an unknown capability (or an AI provider, which has its own route), a
3142
- * host outside the provider's, a path that could leave that host, a path
3143
- * that isn't one of an OAuth client's token endpoints, or a route a service
3144
- * capability doesn't declare. `settings` resolves an API-key provider's
2766
+ * host outside the provider's, a path that could leave that host, or a
2767
+ * route a service capability doesn't declare. `settings` resolves an API-key provider's
3145
2768
  * `hostSetting` (a Shopify store's host); `lookup` is where the id is found,
3146
2769
  * the catalog alone by default.
3147
2770
  */
3148
2771
  export declare function parseIntegrationProxyPath(pathname: string, search: string, settings?: CapabilitySettings, lookup?: CapabilityLookup): IntegrationProxyRoute | null;
3149
- /**
3150
- * The token endpoint `upstream` is, by its exact host and path, or null.
3151
- * Its method is the caller's to check.
3152
- */
3153
- export declare function tokenEndpointFor(capability: OAuthClientCapability, upstream: URL): OAuthTokenEndpoint | null;
3154
- /** An OAuth client's token endpoints, as `POST https://host/path` lines for messages. */
3155
- export declare function describeTokenEndpoints(capability: OAuthClientCapability): string;
3156
2772
  /**
3157
2773
  * The command that gives the gateway `capability`'s client:
3158
2774
  * `pnpm everyapp secret set <ID> <SECRET>`.