esoul-sdk 0.19.1 → 0.20.0

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 (44) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/api-reference.md +658 -14
  3. package/dist/manifest.d.ts +544 -18
  4. package/dist/manifest.js +210 -7
  5. package/dist/react.d.ts +35 -0
  6. package/dist/react.js +13 -0
  7. package/dist/server.d.ts +84 -2
  8. package/dist/server.js +47 -0
  9. package/dist/testing/index.d.ts +5 -0
  10. package/dist/testing/index.js +4 -0
  11. package/dist/testing/sim-gmail/bytes.d.ts +21 -0
  12. package/dist/testing/sim-gmail/bytes.js +125 -0
  13. package/dist/testing/sim-gmail/corpus.d.ts +69 -0
  14. package/dist/testing/sim-gmail/corpus.js +471 -0
  15. package/dist/testing/sim-gmail/errors.d.ts +26 -0
  16. package/dist/testing/sim-gmail/errors.js +71 -0
  17. package/dist/testing/sim-gmail/faults.d.ts +74 -0
  18. package/dist/testing/sim-gmail/faults.js +108 -0
  19. package/dist/testing/sim-gmail/http.d.ts +81 -0
  20. package/dist/testing/sim-gmail/http.js +793 -0
  21. package/dist/testing/sim-gmail/index.d.ts +149 -0
  22. package/dist/testing/sim-gmail/index.js +416 -0
  23. package/dist/testing/sim-gmail/mime.d.ts +78 -0
  24. package/dist/testing/sim-gmail/mime.js +352 -0
  25. package/dist/testing/sim-gmail/names.d.ts +22 -0
  26. package/dist/testing/sim-gmail/names.js +83 -0
  27. package/dist/testing/sim-gmail/personas.d.ts +40 -0
  28. package/dist/testing/sim-gmail/personas.js +250 -0
  29. package/dist/testing/sim-gmail/query.d.ts +51 -0
  30. package/dist/testing/sim-gmail/query.js +280 -0
  31. package/dist/testing/sim-gmail/random.d.ts +33 -0
  32. package/dist/testing/sim-gmail/random.js +116 -0
  33. package/dist/testing/sim-gmail/render.d.ts +30 -0
  34. package/dist/testing/sim-gmail/render.js +89 -0
  35. package/dist/testing/sim-gmail/types.d.ts +243 -0
  36. package/dist/testing/sim-gmail/types.js +2 -0
  37. package/dist/testing/sim-gmail/world.d.ts +217 -0
  38. package/dist/testing/sim-gmail/world.js +657 -0
  39. package/dist/types.d.ts +9 -0
  40. package/docs/02-manifest.md +2 -2
  41. package/docs/08-connections.md +146 -8
  42. package/llms-full.txt +148 -10
  43. package/package.json +3 -2
  44. package/schemas/plugin.schema.json +53 -2
package/CHANGELOG.md ADDED
@@ -0,0 +1,46 @@
1
+ # esoul-sdk changelog
2
+
3
+ Releases before 0.20.0 are recorded in the repository history only.
4
+
5
+ ## 0.20.0
6
+
7
+ ### Added
8
+
9
+ - **Platform accounts (Google): `credentials` in `plugin.json`.** An app declares one slot,
10
+ `credentials: { <slot>: { family: "google", scopes, why, label?, background? } }`, with scopes
11
+ from `gmail.readonly`, `gmail.modify`, `gmail.send`, `gmail.compose`, `gmail.labels`,
12
+ `calendar.events`, `calendar.readonly`, `contacts`, `contacts.readonly`, `drive.readonly`,
13
+ `drive.file` (short or full URL). The person assigns a Google account to the app in Account
14
+ settings → Google. Schema: `PluginCredentialsSchema`, `GOOGLE_CREDENTIAL_SCOPES`,
15
+ `normaliseCredentialScopes`. See `docs/08-connections.md` → "Platform accounts (Google)".
16
+ - **`credentials(ctx).slot(name)` in `esoul-sdk/server`: a proxy, never a token.** `.fetch(url, init)`
17
+ is the standard `fetch` with the account's access added by the platform, sent only when the URL
18
+ is a clean `https://` Google API URL that one of the slot's scopes reaches for that method, and
19
+ the caller is the account's owner (or the app's own background work when the slot declares
20
+ `background: true`). `.status()` answers `{ state: "ready" | "not_bound" | "needs_consent" |
21
+ "reconnect" | "not_allowed", account?, missingScopes?, connectUrl?, reason? }`. A refusal throws
22
+ `CredentialUnavailable` (`isCredentialUnavailable`) with a `code` a tool can relay.
23
+ - **`useCredential(slot, { nodeId })` and `<ConnectAccount/>` in `esoul-sdk/react`.** The screen
24
+ asks the same question `status()` answers, for the person looking at it; `connect()` sends the
25
+ owner to consent, a reconnect, or Account settings → Google.
26
+ - **`simGmail()` in `esoul-sdk/testing`: a fake Gmail at the HTTP level.** The endpoints the
27
+ platform's mail code calls, with Gmail's wire shapes and error envelopes; mailboxes that deliver
28
+ to each other and thread like Gmail; history and push; scripted counterparties (`addPersona`,
29
+ `crowd`) on a virtual clock (`advance`); deterministic faults; a seeded, production-shaped
30
+ synthetic corpus (300 messages by default); `snapshot()` / `simGmail({ restore })`.
31
+ Also `DEFAULT_SIM_ACCOUNT`, `DEFAULT_CROWD_MIX`. See `src/testing/sim-gmail/README.md` in the
32
+ repository. No Node built-ins: it runs in jest, Node, Next.js and the browser.
33
+ - In a Forge box (esoul-app-host 0.3.0), the Google slot is bound to one simulated account and
34
+ answered by `simGmail`; the installed app uses the person's real account.
35
+
36
+ ### Changed
37
+
38
+ - **The env-name rule (W-060).** A `connections` entry's `clientIdEnv` / `clientSecretEnv` must
39
+ name the app's OWN env vars: `PLUGIN_<APP ID upper-cased, - as _>__<NAME>`, e.g.
40
+ `PLUGIN_MY_APP__CLIENT_ID`. Any other name is refused by the manifest schema; a name ending in
41
+ `_WEBHOOK_TOKEN` is the platform's and is refused too (`pluginEnvPrefix`,
42
+ `pluginEnvNameProblem`). An app that named `GOOGLE_CLIENT_ID` or any other platform variable
43
+ must rename it and have the owner set the new name.
44
+ - `authorizeUrl` / `tokenUrl` must be `https://` (plain `http://` only to the loopback, for a mock
45
+ provider such as `startMockOAuth`) — `pluginEndpointProblem`.
46
+ - The package no longer ships compiled test files (`src/**/*.test.ts` are excluded from `dist/`).