techne-sdk 0.13.0 → 0.14.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.
package/CHANGELOG.md CHANGED
@@ -3,7 +3,55 @@
3
3
  `techne-sdk` on npm and the `techne-sdk` crate share a version. Each entry names what changes for an app or
4
4
  a crate user.
5
5
 
6
- ## 0.13.0 (unreleased)
6
+ ## 0.14.0 (2026-11-30)
7
+
8
+ The sign-in form and the "Sign in with Techne" button. Needs the Techne sign-in page (ePDS) that reads a phone
9
+ `login_hint` and `epds_other_ways=1`: ePDS `main` `0831c41`, on prod since 2026-11-30. Exports are added; none
10
+ is removed or renamed, and no function changes meaning. npm only: nothing in the crate's code changed since
11
+ 0.13.1 (only its manifest `description`), so the crate stays 0.13.1.
12
+
13
+ ### Added
14
+
15
+ - **`techne-sdk/sign-in`: `mountSignIn(target, options)` and `mountSignInButton(target, options)`**, each
16
+ answering `{ unmount() }`. The form is the Techne sign-in card for any web page: your logo and name, Email and
17
+ Phone tabs (a country picker inside the card), "Send me a code", "Other ways to sign in" and "Powered by
18
+ Techne". It has one look for every app and keeps one size in every view. It lives in a shadow root, so no
19
+ styles leak either way. README: "The sign-in form".
20
+ - **`techne-sdk/react/sign-in`: `SignInForm` and `SignInButton`**, the same as React components.
21
+ - **`signIn` takes `email`, `phone` (E.164) or `otherWays: true`.** An address or number goes to the sign-in
22
+ page as `login_hint`, so the page sends the code and opens on the code step. `otherWays` opens the page
23
+ with "Other ways to sign in" already open (`epds_other_ways=1`). Both are set on the authorization URL,
24
+ because `@atproto/oauth-client` replaces a `login_hint` passed in its options with its own. The Techne
25
+ sign-in page reads the URL's `login_hint` before the PAR request's.
26
+ - **`OAuthClientLike` gains optional `authorize` and `abortRequest`** (BrowserOAuthClient has both). A client
27
+ injected with `setOAuthClientFactory` needs `authorize` for the three new options.
28
+ - **Dependency: `libphonenumber-js`** (`min` metadata), for the phone field. It is the same reading the
29
+ Techne sign-in page makes.
30
+
31
+ ### Fixed
32
+
33
+ - **`techne-sdk/catalog`: adopted lexicons group under their own authority.** `org.hypercerts.funding.receipt`
34
+ (and its query document) now have `group: 'org.hypercerts'`, and `app.certified.defs` and
35
+ `app.certified.signature.defs` have `group: 'app.certified'`; they had `'pub.techne'`. Every record's group is
36
+ now a prefix of its NSID. A browse list that grouped by `group` showed them under pub.techne.
37
+
38
+ ## 0.13.1 (2026-11-28)
39
+
40
+ Inputs. No export is added, removed or renamed, and no function
41
+ changes. npm 0.13.1 and crate 0.13.1 are built from the same commit; the crate's code is unchanged and moves to
42
+ check 0.3.37.
43
+
44
+ ### Inputs
45
+
46
+ - **Lexicons `v0.1.22-techne.101`, check crate `techne-lexicon-check` 0.3.37** (the crate's dependency, exact;
47
+ its code is unchanged). Description fixes to `geo`, `orgAtPlace` and `statement#locations` (who writes the
48
+ superseded types now; how a statement's claim counts on a type whose entries are sites, as on an org).
49
+ `pub.techne.draft.derivation` signal `name` gains the known value `edgeResolution` (the field stays open).
50
+ - **Platform API at platform `main` `d28c1574e`.** Its method lexicons are unchanged. Reads on that platform
51
+ take `place` and `placeV2` side by side, count each claim entry that names no own entry as its own site on a
52
+ sites type, and count curated only from the types' curators' rows.
53
+
54
+ ## 0.13.0 (2026-11-28)
7
55
 
8
56
  Location queries. Nothing is removed or renamed. Ship after the platform that answers `in`/`covers` (platform
9
57
  `main` `c9c85f31b`) is on prod: an older platform refuses those conditions and never sends `matched` or
package/README.md CHANGED
@@ -2,8 +2,10 @@
2
2
 
3
3
  TechneSDK for apps on the Techne platform: sign in, `put`, query, `useEvent` and the read-time check.
4
4
 
5
+ Roadmap: [where Techne is heading](https://github.com/technefoundation/sdk/blob/main/.claude/skills/techne-platform/roadmap.md), shared by every Techne repo: what is live today, the agreed direction, and what is still open.
6
+
5
7
  - **npm:** one package, `techne-sdk`, with subpaths.
6
- - **Rust:** the crate `techne-sdk` (`crates/techne-sdk`). It holds the logic that must give the platform's answers exactly: the check, the version ranking (`eventState`) and `put`'s private-first, public-last plan. The npm package runs the same crate as WebAssembly, or as wasm2js on hosts without WebAssembly (Hermes). Opt-in features add the atproto plumbing services share (no platform crate either): `crypto` for service-auth JWTs, signed labels, record proofs and service-account passwords, and `net` for DID resolution, verified record fetches and PDS password sessions.
8
+ - **Rust:** the crate `techne-sdk` (`crates/techne-sdk`). It holds the logic that must give the platform's answers exactly: the check, the version ranking (`eventState`) and `put`'s private-first, public-last plan. The npm package runs the same crate as WebAssembly, or as wasm2js on hosts without WebAssembly (Hermes). Opt-in features add the atproto plumbing services share (no platform crate either): `crypto` for service-auth JWTs, signed labels, record proofs and service-account passwords, `net` for DID resolution, verified record fetches and PDS password sessions, and `tap` for the stock client of a Tap's `/channel`.
7
9
 
8
10
  The SDK depends on two things only: the published lexicons (the `lexicons` repo at a tag) and the platform's published API. It contains no platform code.
9
11
 
@@ -27,11 +29,13 @@ Every import goes through the package's `exports`, so the resolver has to read t
27
29
  | `techne-sdk/react/query` | the client's reads as hooks over TanStack Query (`useRecordQuery`, `useRecord`, `useVersions`, `defaultQueryClient`); needs `@tanstack/react-query` |
28
30
  | `techne-sdk/versions` | the same state without React: `eventState`, `verifyAnswer`, version labels |
29
31
  | `techne-sdk/auth` | sign-in ("Sign in with Techne"): `signIn`, `signUp`, `restore`, `signOut`, `clientMetadata`, `scopes`, `appKey`, `appSpace`, `ownAppSpace`, `WHOLE_STORE` (browser OAuth); the account page: `openAccountSettings`, `accountSettingsUrl` |
32
+ | `techne-sdk/sign-in` | the sign-in form and the "Sign in with Techne" button for any web page: `mountSignIn`, `mountSignInButton` (no framework; [below](#the-sign-in-form)) |
33
+ | `techne-sdk/react/sign-in` | the same as React components: `SignInForm`, `SignInButton` |
30
34
  | `techne-sdk/session` | a session the app holds itself, for React Native as well as the browser (plain JS, no native module): phone sign-in through the platform's door (`startPhoneSignIn`, `finishPhoneSignIn`), `OwnSession` (`did` + `fetchHandler` for `connect`, refresh, `signOut`, the device credential's proofs), DPoP helpers; `adoptHeldSession` (deprecated) |
31
35
  | `techne-sdk/connect` | `connect(session, platform?)` / `connectHosted(did, fetchHandler)` / `connectAnonymous(platform?)`: the client over one session, with its reads (`query`, `get`, `versions`, their options forms) and `put`; `bind(clients)` over clients made elsewhere |
32
36
  | `techne-sdk/put` | `put(techne, records, { deletes })`: the one write, deletes included (public deletes hinted to the platform); each of `records` is `{ record, rkey?, space? }` (`record` the body with its `$type`; `rkey` derived when absent: the lexicon's literal key, else a TID from the record's `createdAt` and CID, and with neither `put` throws before writing anything; `space` only for a private record); `put(techne, [], { deletes })` for deletes alone. Its `status` is never `valid`: `invalid` with the reason (not counted; `not curated: no lexicon`, another app's own type, is written all the same) or `pending` (not refused: indexed when the hint answered, so it reads back by URI, but not yet in the commons' curated view; a failed hint is `pending` too, and the record comes by the relay); `curation` says per record whether it is `curated`, `notCurated` (why) or still `pending`, and `{ wait: ms }` waits for the curated record |
33
37
  | `techne-sdk/query` | the platform's generic queries: `listRecords`, `getRecords`, `compose` (several steps in one `composeRecords` call), hosts (`hostsOf`, `hostSteps`/`hostsFrom`) |
34
- | `techne-sdk/links` | link tokens: create, redeem, check, revoke |
38
+ | `techne-sdk/links` | link tokens: create, reset, redeem, check, revoke, list your links for an app and target, and a link's redemptions |
35
39
  | `techne-sdk/wasm` | the check itself: `validate`, `decide`, `verify` (`validate` knows the built-in lexicons only; a runtime type is checked by the platform on write) |
36
40
  | `techne-sdk/catalog` | the browsable lexicon catalog |
37
41
  | `techne-sdk/nsid`, `techne-sdk/nsid.json` | every NSID as a constant (`NSID`, `METHOD`) |
@@ -94,17 +98,12 @@ for (;;) {
94
98
  - **Limits:** each statement times out after 5 s (`query` then throws a `ComposeStepError` with status 500 and a
95
99
  message starting `query read:`); a `near` over a dense area can approach it, so page `near` small. `query` sends `composeRecords`, which has a row
96
100
  budget per signed-in DID and answers 429 `RateLimitExceeded` past it; `query` retries twice, then throws.
97
- Anonymous callers get one such budget per client IP only where the server is set up to know the client's IP
98
- (the platform's `AUTH_RATE_LIMIT_CLIENT_IP`); where it is not, all anonymous callers share one budget ten times
99
- that size, so another anonymous reader can use up yours.
101
+ Anonymous callers may share one budget; the guide's Limits section below says when.
100
102
  - **Without the SDK:** `/xrpc/*` (and `/.well-known/did.json`) on the platform answers CORS for any origin, so a page can `fetch`
101
- `https://techne.computer/xrpc/pub.techne.draft.query.listRecords?query=<JSON>&limit=10` directly. The routes
102
- under `/xrpc/_*` (the agent consent flow and the change stream) are not methods and get no CORS. (CORS is live
103
- on staging since 2026-11-24 and reaches techne.computer with the first platform release after that; until
104
- then a browser page reads techne.computer through its own server.)
103
+ `https://techne.computer/xrpc/pub.techne.draft.query.listRecords?query=<JSON>&limit=10` directly.
105
104
 
106
105
  The builder guide's `reading-public-data` section (https://techne.computer/docs/reading-public-data.md) has the
107
- query rules and the other read servers.
106
+ query rules, the Limits and the other read servers.
108
107
 
109
108
  ## Scripts and agents
110
109
 
@@ -162,13 +161,13 @@ const metadata = clientMetadata({ clientId, clientName: 'Cafe finder' })
162
161
 
163
162
  // On every page load: finishes a sign-in when the page is the redirect back, else restores a kept session.
164
163
  const session = await restore({ clientId })
165
- if (!session) await signIn({ clientId, handle: 'alice' }) // alice.techne.town, once techne.town is live (see below)
164
+ if (!session) await signIn({ clientId, handle: 'alice' }) // alice.techne.town
166
165
  else {
167
166
  const techne = connect(session, TECHNE_PLATFORM_DID)
168
167
  }
169
168
  ```
170
169
 
171
- - **Who:** with no `handle`, the sign-in starts at the default PDS (techne.town), which asks who you are. A bare name (`alice`) is a handle on the default handle domain. A full handle, a DID or a PDS URL from any PDS is used as given. `signUp({ clientId })` opens the PDS's create-account screen.
170
+ - **Who:** with no `handle`, the sign-in starts at the default PDS (techne.town), which asks who you are. An app that asked for the address or number itself passes `email` or `phone` (E.164, `+15024429492`) instead: the sign-in page sends the code at once and opens on the code step. `otherWays: true` opens the sign-in page with "Other ways to sign in" (passkey, Nostr key, a handle on another server) already open. One of `handle`, `email`, `phone` and `otherWays` at a time. The [sign-in form](#the-sign-in-form) does all this for you. A bare name (`alice`) is a handle on the default handle domain. A full handle, a DID or a PDS URL from any PDS is used as given. `signUp({ clientId })` opens the PDS's create-account screen.
172
171
  - **Scopes:** `scopes({ clientId })` is what it asks for by default, least privilege: `atproto`; the platform's `authPermissioned` permission set with the platform as its audience (the `permissioned.*` calls: private writes, reads and deletes); the app's own private space by its exact key, `ownAppSpace(clientId)` = `space:pub.techne.draft.space.private?skey=<appKey>` (ask for your own space this way: a keyless `space.private` scope, or `skey=*`, is every app's private data, and the consent page shows it as a red warning); and an `rpc:<nsid>?aud=<platform>%23atproto_appview` scope for each generic read the SDK makes signed in: `query.listRecords`, `query.countRecords` and `query.getRecords` (`techne-sdk/query`, `put`'s curation answer) and `registry.getType` and `registry.listTypes`. The platform narrows those reads by the token's space scopes, so they reach public data and the app's own space. An app passes the types it writes as `types: [nsid, ...]`, and each adds a `repo:<nsid>` scope (create, update, delete), as the platform's own least-privilege list does, plus `rpc:pub.techne.draft.sync.indexRecord` so `put` can hint the platform what it wrote (a pending type's records are indexed no other way); without `types` the app writes no public record. `query.composeRecords` is not in the default (the SDK makes no such call); an app that calls it asks for `everything: 'read'`. Everything the person can reach (their personal space, their circles, beacons shared with them) is an opt-in: `everything: 'read'` adds the `authRead` set and `space:*?authority=*&action=read` (`WHOLE_STORE_READ`), `everything: 'write'` adds `authRead`, `authWrite`, `space:*?authority=*&manage=create&manage=update` (`WHOLE_STORE`) and a `repo:` scope for the public records outside `pub.techne.*` (`community.lexicon.*`, `org.hypercerts.funding.receipt`; then our own public types need no `types` entry). The sets reach no space on Techne's PDS; the `space:` scope, asked for by name, does. The consent page shows those with a large warning; ask only if the app needs them. Pass the same `types` and `everything` to `signIn` and `clientMetadata`, since the PDS refuses a request beyond what the metadata declares. Pass `scope` to ask for other scopes, and pass it to both. An app that publishes its own community type (`pub.techne.draft.c.*`) as the signed-in person passes `publish: true`, which adds `rpc:pub.techne.draft.registry.publishType` (publishing a type is a public act). The type's NSID is the registry's answer, so its `repo:` scope can be asked for only after publishing: publish once (a setup sign-in with `publish: true`), then sign in with the published NSID in `types`.
173
172
  - **A private record names its space:** a record of a type with no public home is written privately, and it must name the `space` it is for; `put` throws `PutError` (`InvalidRequest`) with nothing written when one does not, as the platform's `permissioned.putRecords` refuses it. A record only the person reads goes in their own `space.personal`: `` { record, space: `at://${did}/pub.techne.draft.space.personal/self` } ``. Public records name no space and go to the person's PDS.
174
173
  - **The app's private space:** `appSpace(session.did, clientId)` is `at://{did}/pub.techne.draft.space.private/{appKey}`, where `appKey(clientId)` is the client id hashed (base32, lowercase, no padding, of its SHA-256; the platform's `sidecar_rkey`). Write there with `put(techne, [{ record, space: appSpace(did, clientId) }])` and read with `permissioned.listRecords({ space })`. Only that person reads it, through a token whose `space:` scopes cover it or one with no scope claim at all (below). In development the client id is the loopback client's, `resolveClientId(options)` with the same options `signIn` took: it carries the scope, so it changes with the port, `types` and `everything`, and so does the space. Its scope names the space type without a key (an id cannot carry its own hash), which is every app's private space: Techne's PDS no longer narrows it to the loopback app's own, and the consent page shows the red every-app warning. That is development only; a hosted app asks with `ownAppSpace(clientId)`. The browser keeps one stored session per origin, so a page that switches between client ids (other `types`, another port's id) signs out first; `restore` hands back whichever session the origin holds.
@@ -178,7 +177,54 @@ else {
178
177
  - **The account page and Delete account:** people manage their account (profile, ways to sign in, devices and apps, Delete account) on the account page at their PDS's sign-in host, never inside an app. `openAccountSettings()` opens it in a new tab; call it from the tap's handler. `openAccountSettings({ section: 'delete' })` opens it at Delete account: that is the link for Apple's account-deletion rule (the app still deletes its own data itself). There is no API that deletes an account. Sections are `'profile'`, `'methods'` and `'delete'`. Pass `session` (from `restore`) and it answers `false` without opening anything when the person signed in at another server, which has no Techne account page. Pass `open: (url) => …` to open it elsewhere (an in-app browser sheet in React Native). `accountSettingsUrl(options)` is the address alone. The host comes from the PDS's OAuth metadata, so a move of the sign-in host changes nothing for you. An app on a platform session (`connectHosted`) passes `techne` too, and the page opens already signed in through the platform's one-time link (`identity.openAccountPage`) where the platform and this SDK carry it; otherwise the page asks for a code.
179
178
  - **Another deployment:** `platform` names the platform's DID (`TECHNE_PLATFORM_DID` by default). `pds`, `plcUrl` and `handleDomain` name the PDS people sign in at, its PLC directory and its handle domain. Pass them the same way to every `techne-sdk/auth` call that takes them (`signIn`, `signUp`, `restore`, `signOut`, `redirectState`, …): the OAuth client is made once per client id with the first call's values. `connect(session, platform)` takes only the platform: the user's PDS resolves its DID. `connectAnonymous(platform, { plcUrl })` takes the PLC directory too, since it resolves a did:plc platform itself.
180
179
 
181
- **Before the Techne release:** the techne.town defaults (`TECHNE_PLATFORM_DID`, the techne.town PDS and handle domain) go live at the Techne release. Until then, `signIn()` without `pds` fails: pass `pds`, `plcUrl`, `handleDomain` and `platform` explicitly, and ask the Techne team for the current staging values.
180
+ ## The sign-in form
181
+
182
+ `techne-sdk/sign-in` puts the Techne sign-in form on any page of your app, so people start signing in without leaving it:
183
+
184
+ ```ts
185
+ import { mountSignIn } from 'techne-sdk/sign-in'
186
+
187
+ const form = mountSignIn(document.getElementById('sign-in')!, {
188
+ clientId: 'https://cafes.example/oauth-client-metadata.json',
189
+ appName: 'Cafe finder',
190
+ logo: '/logo.png', // a square image; shown 44 px with rounded corners
191
+ })
192
+ // form.unmount() takes it away again.
193
+ ```
194
+
195
+ In React:
196
+
197
+ ```tsx
198
+ import { SignInForm } from 'techne-sdk/react/sign-in'
199
+
200
+ <SignInForm clientId={clientId} appName="Cafe finder" logo="/logo.png" />
201
+ ```
202
+
203
+ **What the person sees.** One card: your logo and name at the top, "Sign in", and a line that says your app uses their Techne account and that the code makes an account for someone new. Below that are Email and Phone tabs. The phone field has a country picker, and its list opens inside the card. Then come a "Send me a code" button, a line of fine print ("We email you a code. No password."), a quiet "Other ways to sign in" link, and "Powered by Techne".
204
+
205
+ - **Send me a code** takes them to the Techne sign-in page with the code already sent, on the step where they type it (it calls `signIn` with `email` or `phone`). After the code they come back to your redirect URI, where `restore` answers the session, as for any sign-in.
206
+ - **Other ways to sign in** takes them to the Techne sign-in page with passkey, Nostr key and a handle on another server open (`signIn` with `otherWays`).
207
+ - A malformed address or number is caught in the form, and the fine print says what is wrong. When the sign-in cannot start (the PDS is unreachable), the fine print says so and `onError` gets the error.
208
+
209
+ **One look for every app.** Your logo and name are the only things that change. The card is 420 px wide, or narrower in a narrower container, and it keeps one size in every view (each tab, the country list), so nothing on your page moves. Put it in a container at least about 320 px wide.
210
+
211
+ **It can't break your page, and your page can't break it.** The form lives in a shadow root on its own element (`<techne-sign-in>`, appended to the element you give). Its styles stay inside, and your page's styles don't reach in. The brand fonts load from the home PDS (`https://pds.techne.town/static/fonts/`), declared once in your document's head under names of its own (`Techne Octave`, `Techne Public Sans`). If they can't load, Georgia and Arial stand in.
212
+
213
+ **Options.** Everything `signIn` takes except who is signing in (`clientId`, `types`, `everything`, `publish`, `scope`, `state`, `platform`, `pds`, `plcUrl`, `handleDomain`, `location`). Pass the same values as to `clientMetadata` and `restore`. Add `appName` (required), `logo` and `onError`. The React components also take `className` and `style` for the `<div>` they mount in, and they mount again when an option changes (not when only `onError` or `onClick` changes).
214
+
215
+ **Accessible.** The inputs have labels. The tabs are a `tablist`: arrow keys, Home and End move between them, and only the selected tab is in the tab order. The country picker is a searchable `listbox`: type to filter, use the arrows and Enter to pick, and Escape or Back to close. The country picked last is kept on the browser (`localStorage`, `techne-sdk:phone-country`). Otherwise the browser's language picks the first one.
216
+
217
+ ### The button
218
+
219
+ Use `mountSignInButton` (`SignInButton` in React) for a "Sign in with Techne" button in a navigation bar or anywhere else a form won't fit:
220
+
221
+ ```ts
222
+ import { mountSignInButton } from 'techne-sdk/sign-in'
223
+
224
+ mountSignInButton(navSlot, { clientId, theme: 'dark', size: 'small' })
225
+ ```
226
+
227
+ `theme: 'dark'` (the default) is black, for light backgrounds. `'light'` is white with a black edge, for dark backgrounds. `size: 'medium'` is 44 px tall and `'small'` is 36 px. A click calls `signIn` with no hint, which opens the Techne sign-in page at its first step. Pass `onClick` to do something else instead, such as showing the form. The button shows the name only, in Techne's type. Don't put the Techne mark beside it.
182
228
 
183
229
  ## A session the app holds (React Native)
184
230
 
@@ -0,0 +1,14 @@
1
+ /**
2
+ * What `signIn` and the sign-in form (`techne-sdk/sign-in`) share about who is signing in and how a redirect
3
+ * ends. Internal: not a package export.
4
+ */
5
+ /** An E.164 number: `+`, then 7 to 15 digits, the first not 0. */
6
+ export declare const E164: RegExp;
7
+ /** An email address as the form and `signIn` take it: something, `@`, a domain with a dot. */
8
+ export declare const isEmailAddress: (s: string) => boolean;
9
+ /** The rejection of a sign-in redirect when the person comes back to the page without signing in (the
10
+ * library's `signInRedirect`, and ours): `Error('User navigated back')`, or an AggregateError holding it when
11
+ * cancelling the pushed request failed too. */
12
+ export declare const NAVIGATED_BACK = "User navigated back";
13
+ /** Whether `err` is that rejection. */
14
+ export declare function isNavigatedBack(err: unknown): boolean;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * What `signIn` and the sign-in form (`techne-sdk/sign-in`) share about who is signing in and how a redirect
3
+ * ends. Internal: not a package export.
4
+ */
5
+ /** An E.164 number: `+`, then 7 to 15 digits, the first not 0. */
6
+ export const E164 = /^\+[1-9]\d{6,14}$/;
7
+ /** An email address as the form and `signIn` take it: something, `@`, a domain with a dot. */
8
+ export const isEmailAddress = (s) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s);
9
+ /** The rejection of a sign-in redirect when the person comes back to the page without signing in (the
10
+ * library's `signInRedirect`, and ours): `Error('User navigated back')`, or an AggregateError holding it when
11
+ * cancelling the pushed request failed too. */
12
+ export const NAVIGATED_BACK = 'User navigated back';
13
+ /** Whether `err` is that rejection. */
14
+ export function isNavigatedBack(err) {
15
+ if (err instanceof AggregateError)
16
+ return err.errors.some(isNavigatedBack);
17
+ return err?.message === NAVIGATED_BACK;
18
+ }
@@ -35,7 +35,9 @@
35
35
  * Where it starts: no handle starts at the techne.town PDS ({@link TECHNE_TOWN_PDS}), which asks who you
36
36
  * are; a bare name (`alice`) is a techne.town handle (`alice.techne.town`); a full handle, a DID or a PDS
37
37
  * URL from any PDS goes as given. `signUp` goes to the techne.town PDS with `prompt: 'create'`, its
38
- * create-account screen. An app whose people live on another PDS (a test deployment's) names it with the `pds`
38
+ * create-account screen. An address or number the app asked for itself goes as `email` or `phone` (the sign-in page
39
+ * sends the code and opens on the code step), and `otherWays` opens it with "Other ways to sign in" open: both set
40
+ * on the authorization URL ({@link SignInOptions.email}); `techne-sdk/sign-in` is the form that does it. An app whose people live on another PDS (a test deployment's) names it with the `pds`
39
41
  * option, and its PLC directory with `plcUrl`: handles then resolve at that PDS, a sign-in with no
40
42
  * handle and every sign-up start there, a bare name takes `handleDomain`, and DIDs resolve at that PLC.
41
43
  *
@@ -88,6 +90,12 @@ export interface OAuthClientLike {
88
90
  state?: string | null;
89
91
  } | undefined>;
90
92
  signInRedirect(input: string, options?: AuthorizeOptions): Promise<unknown>;
93
+ /** The authorization URL a sign-in navigates to (BrowserOAuthClient's, through PAR): {@link signIn} adds
94
+ * `login_hint` and `epds_other_ways` to it, which the library would drop. Needed for `email`, `phone` and
95
+ * `otherWays`. */
96
+ authorize?(input: string, options?: AuthorizeOptions): Promise<URL>;
97
+ /** Cancel the PAR request behind an authorization URL (the person came back without signing in). */
98
+ abortRequest?(url: URL): Promise<void>;
91
99
  revoke(sub: string): Promise<void>;
92
100
  /** The metadata the client signs in with (BrowserOAuthClient's): its `scope` is what a restarted sign-in asks for. */
93
101
  readonly clientMetadata?: {
@@ -206,6 +214,16 @@ export interface SignInOptions extends ClientOptions {
206
214
  signUp?: boolean;
207
215
  /** Handed back by the redirect: {@link redirectState} answers it there. */
208
216
  state?: string;
217
+ /** The person's email address, typed in the app (the sign-in form, `techne-sdk/sign-in`): the Techne sign-in
218
+ * page skips its first step, sends a code to it, and opens on the code step. Sent as `login_hint`. Not with
219
+ * `handle`, `phone` or `otherWays`. */
220
+ email?: string;
221
+ /** The person's phone number, E.164 (`+15024429492`): as `email`, by text message. Not with `handle`,
222
+ * `email` or `otherWays`. */
223
+ phone?: string;
224
+ /** Open the Techne sign-in page with "Other ways to sign in" (passkey, Nostr key, a handle on another server)
225
+ * already open (`epds_other_ways=1`). Not with `handle`, `email` or `phone`. */
226
+ otherWays?: boolean;
209
227
  }
210
228
  /** Sign in: redirects to the person's PDS, and comes back to the app's redirect URI (then {@link restore}).
211
229
  * When the sign-in page hands the person back because their account is on another server, {@link restore}
@@ -3,6 +3,7 @@ import { isValidDid, isValidHandle, isValidNsid } from '@atproto/syntax';
3
3
  import { NSID } from '../generated/nsid.js';
4
4
  import { appviewRef, TECHNE_PLATFORM_DID } from '../platform.js';
5
5
  import { ownAppSpace } from './app-key.js';
6
+ import { E164, isEmailAddress, NAVIGATED_BACK } from './hints.js';
6
7
  import { TECHNE_TOWN, TECHNE_TOWN_PDS } from './hosts.js';
7
8
  import { PUBLIC_HOMES } from './placement.gen.js';
8
9
  export { appKey, appSpace, ownAppSpace } from './app-key.js';
@@ -179,6 +180,49 @@ export function onSessionDeleted(o, listener) {
179
180
  deletedListeners.delete(clientId);
180
181
  };
181
182
  }
183
+ /** What a sign-in adds to the authorization URL (the library sets `login_hint` itself, from the handle it
184
+ * resolved, and drops one passed in its options, so a typed email or number goes on the URL, which the
185
+ * Techne sign-in page reads before the PAR request's). Throws a TypeError on a combination that makes no sense. */
186
+ function pageParams(o) {
187
+ const email = o.email?.trim();
188
+ const phone = o.phone?.trim();
189
+ const asked = [email && 'email', phone && 'phone', o.otherWays && 'otherWays'].filter(Boolean);
190
+ if (!asked.length)
191
+ return null;
192
+ if (asked.length > 1)
193
+ throw new TypeError(`techne-sdk/auth: signIn takes one of email, phone and otherWays (got ${asked.join(' and ')})`);
194
+ if (o.handle?.trim())
195
+ throw new TypeError(`techne-sdk/auth: signIn takes handle or ${asked[0]}, not both`);
196
+ if (email && !isEmailAddress(email))
197
+ throw new TypeError(`techne-sdk/auth: email is an address (got ${JSON.stringify(o.email)})`);
198
+ if (phone && !E164.test(phone))
199
+ throw new TypeError(`techne-sdk/auth: phone is an E.164 number, +<country code><number> (got ${JSON.stringify(o.phone)})`);
200
+ if (email)
201
+ return { login_hint: email };
202
+ if (phone)
203
+ return { login_hint: phone };
204
+ return { epds_other_ways: '1' };
205
+ }
206
+ /** What BrowserOAuthClient's signInRedirect does, with `params` on the URL: navigate, and if the page is still
207
+ * here 5 s later (the person came back), cancel the request and reject. */
208
+ async function redirectWith(client, input, options, params) {
209
+ if (typeof client.authorize !== 'function')
210
+ throw new Error('techne-sdk/auth: this OAuth client cannot build an authorization URL (email, phone and otherWays need authorize())');
211
+ const url = await client.authorize(input, options);
212
+ for (const [k, v] of Object.entries(params))
213
+ url.searchParams.set(k, v);
214
+ const location = globalThis.location;
215
+ if (!location)
216
+ throw new Error('techne-sdk/auth: signIn navigates, so it needs a browser page');
217
+ location.assign(url.href);
218
+ await new Promise((_, reject) => {
219
+ const timer = setTimeout(() => {
220
+ const err = new Error(NAVIGATED_BACK);
221
+ Promise.resolve(client.abortRequest?.(url)).then(() => reject(err), (reason) => reject(new AggregateError([err, reason])));
222
+ }, 5e3);
223
+ timer.unref?.();
224
+ });
225
+ }
182
226
  /** Where a sign-in for `handle` starts: see the module doc. */
183
227
  function signInTarget(handle, o = {}) {
184
228
  const h = handle?.trim().replace(/^@/, '');
@@ -192,6 +236,7 @@ function signInTarget(handle, o = {}) {
192
236
  * When the sign-in page hands the person back because their account is on another server, {@link restore}
193
237
  * starts this sign-in again there (see {@link MAX_HANDBACKS}). */
194
238
  export async function signIn(o = {}) {
239
+ const params = pageParams(o);
195
240
  const { scope } = resolveClient(o);
196
241
  const client = await oauthClient(o);
197
242
  // A sign-up is at the home PDS unless the app names another PDS by its URL.
@@ -199,7 +244,10 @@ export async function signIn(o = {}) {
199
244
  const options = { scope, state: wrapState(0, o.state) };
200
245
  if (o.signUp)
201
246
  options.prompt = 'create';
202
- await client.signInRedirect(input, options);
247
+ if (params)
248
+ await redirectWith(client, input, options, params);
249
+ else
250
+ await client.signInRedirect(input, options);
203
251
  }
204
252
  /**
205
253
  * How many times one sign-in is started again at another server. The Techne sign-in page (ePDS) hands a
@@ -116,7 +116,7 @@ export const catalog = {
116
116
  {
117
117
  "nsid": "app.certified.defs",
118
118
  "name": "app.certified.defs",
119
- "group": "pub.techne",
119
+ "group": "app.certified",
120
120
  "kind": "object",
121
121
  "description": "Common type definitions used across certified protocols.",
122
122
  "doc": ({
@@ -159,7 +159,7 @@ export const catalog = {
159
159
  {
160
160
  "nsid": "app.certified.signature.defs",
161
161
  "name": "app.certified.signature.defs",
162
- "group": "pub.techne",
162
+ "group": "app.certified",
163
163
  "kind": "array",
164
164
  "description": "Common type definitions for cryptographic signatures attached to records, per the ATProtocol Attestation Specification. Each signature's `$type` says what it attests.",
165
165
  "doc": ({
@@ -1612,7 +1612,7 @@ export const catalog = {
1612
1612
  {
1613
1613
  "nsid": "org.hypercerts.funding.receipt",
1614
1614
  "name": "org.hypercerts.funding.receipt",
1615
- "group": "pub.techne",
1615
+ "group": "org.hypercerts",
1616
1616
  "kind": "record",
1617
1617
  "key": "tid",
1618
1618
  "description": "Records a payment from a sender to a recipient. Any party may record it, and the sender may stay anonymous. When the sender chose the recipient, record one receipt to the final recipient even if platforms or hosts passed the funds on. When an intermediary chose (regranting), record the payment into it and each onward payment as separate receipts. A receipt may be updated in place under the same record key: its URI does not change, so references by URI keep resolving, but a strongRef (as likes and reposts use) still pins the earlier CID, and signatures bind to content and must be renewed. An earlier version cannot be recalled from readers that kept it.",
@@ -1880,7 +1880,7 @@ export const catalog = {
1880
1880
  {
1881
1881
  "nsid": "org.hypercerts.funding.receipt.query",
1882
1882
  "name": "org.hypercerts.funding.receipt.query",
1883
- "group": "pub.techne",
1883
+ "group": "org.hypercerts",
1884
1884
  "kind": "queryDocument",
1885
1885
  "description": "How a reader takes this record's fields. It fills no query role. It is about its recipient, the record at `to.uri` (when `to` is a strong reference), and a where read finds it there when asked to follow subjects.",
1886
1886
  "doc": ({
@@ -5100,7 +5100,8 @@ export const catalog = {
5100
5100
  "sameUrl",
5101
5101
  "venueNameConflict",
5102
5102
  "placeNameInTitle",
5103
- "placeNameTokens"
5103
+ "placeNameTokens",
5104
+ "edgeResolution"
5104
5105
  ]
5105
5106
  },
5106
5107
  "value": {
@@ -6128,7 +6129,7 @@ export const catalog = {
6128
6129
  "doc": ({
6129
6130
  "lexicon": 1,
6130
6131
  "id": "pub.techne.draft.geo",
6131
- "description": "SUPERSEDED, still written by the commons rules until their writers move to the new shape: a position for someone else's record is a `pub.techne.draft.statement` carrying `#locations`, with `basis` naming the entry it positions. Existing records stay readable. Where a record is: a coordinate. A sidecar about any record (a place, an event, a later type), written in the writer's own repo, never onto the subject, so the subject's author, audience and lifetime are untouched and a reader chooses which writers it trusts. Written only when it adds a coordinate the subject's own record lacks: when a source gives coordinates they stay in the subject's own `locations`, and no geo record is needed. H3 cells are not stored: readers compute them from `location` at index time. It says nothing about who wrote it (the author is the repo it lives in) or how (a `pub.techne.draft.derivation` about it says that), so anyone, not only our rules, can write one honestly. PUBLIC. Written only about public records: no space type declares this collection, so it has no permissioned home. Written by the commons geocode rule.",
6132
+ "description": "SUPERSEDED: the commons geocode rule wrote it until its version geocode-3, which writes a statement instead. A position for someone else's record is a `pub.techne.draft.statement` carrying `#locations`, with `basis` naming the entry it positions. Existing records stay readable until they are retired. Where a record is: a coordinate. A sidecar about any record (a place, an event, a later type), written in the writer's own repo, never onto the subject, so the subject's author, audience and lifetime are untouched and a reader chooses which writers it trusts. Written only when it adds a coordinate the subject's own record lacks: when a source gives coordinates they stay in the subject's own `locations`, and no geo record is needed. H3 cells are not stored: readers compute them from `location` at index time. It says nothing about who wrote it (the author is the repo it lives in) or how (a `pub.techne.draft.derivation` about it says that), so anyone, not only our rules, can write one honestly. PUBLIC. Written only about public records: no space type declares this collection, so it has no permissioned home. Written by the commons geocode rule before geocode-3.",
6132
6133
  "defs": {
6133
6134
  "main": {
6134
6135
  "type": "record",
@@ -10802,7 +10803,7 @@ export const catalog = {
10802
10803
  "doc": ({
10803
10804
  "lexicon": 1,
10804
10805
  "id": "pub.techne.draft.orgAtPlace",
10805
- "description": "SUPERSEDED, still written by the commons rules until their writers move to the new shape: an org's sites are entries in its own `locations` (bounded at 256). Existing records stay readable. A relationship: an organization is at a place (its office, its storefront, or a place it operates). Draft tier, PUBLIC. Its own record, not a field on either end, because an org can be at many places, a place can hold many orgs, and someone in particular claims each link (lexicon constitution, rule 2).",
10806
+ "description": "SUPERSEDED: no source rule writes it now (the commons curator still writes curated copies of existing links). Its successors: an org's sites are entries in its own `locations` (bounded at 256; a `registered` entry is where it is registered), and a site the org's author did not state is a `pub.techne.draft.statement` about the org carrying `locations` (as the commons org-match rule writes its sites statements). Existing records stay readable. A relationship: an organization is at a place (its office, its storefront, or a place it operates). Draft tier, PUBLIC. Its own record, not a field on either end, because an org can be at many places, a place can hold many orgs, and someone in particular claims each link (lexicon constitution, rule 2).",
10806
10807
  "defs": {
10807
10808
  "main": {
10808
10809
  "type": "record",
@@ -17813,7 +17814,7 @@ export const catalog = {
17813
17814
  },
17814
17815
  "locations": {
17815
17816
  "type": "object",
17816
- "description": "Where the subject is, as the writer of the statement says, for a subject of any type. It counts only as the view decides: the subject's own locations win, and a statement fills in only where the subject states no location of that kind, or (with `basis`) gives a position to a subject's entry that has none. A statement the subject's own author writes counts as the subject's own locations. A `basis` equal to the subject record's CID (a legacy claim) counts for any own entry of that kind with no position, while the subject is still that version. When several claims compete for one slot (the same kind, and the same `basis` or none), one counts: the finest grain wins, then the newest, then the lowest source URI; the others are conflicts. Read as written, every writer's claim is weighed; curated, only the subject's author's and those of writers the commons root endorses.",
17817
+ "description": "Where the subject is, as the writer of the statement says, for a subject of any type. It counts only as the view decides: the subject's own locations win, and a statement fills in only where the subject states no location of that kind, or (with `basis`) gives a position to a subject's entry that has none. A statement the subject's own author writes counts as the subject's own locations. A `basis` equal to the subject record's CID (a legacy claim) counts for any own entry of that kind with no position, while the subject is still that version. When several claims compete for one slot (the same kind, and the same `basis` or none), one counts: the finest grain wins, then the newest, then the lowest source URI; the others are conflicts. On a type whose query document reads its entries as sites (`entries: sites`, as on an org), a claim entry that names no own entry (no `basis`, or a legacy `basis` while the subject states no location of that kind) is its own site: it counts beside every other such entry and competes with none. A claim that names an own entry still competes for that entry, and a subject that states a location of that kind still bars a claim with no `basis`. Read as written, every writer's claim is weighed; curated, only the subject's author's and those of writers the commons root endorses.",
17817
17818
  "required": [
17818
17819
  "locations"
17819
17820
  ],
@@ -2705,7 +2705,7 @@ export declare const schemaDict: {
2705
2705
  readonly name: {
2706
2706
  readonly type: "string";
2707
2707
  readonly maxLength: 64;
2708
- readonly knownValues: ["titleSimilarity", "nameSimilarity", "nameContainment", "titleFrequency", "startDelta", "endDelta", "samePlaceCluster", "distance", "placePrecision", "sameAddress", "addressGeoConflict", "categoryConflict", "sameUrl", "venueNameConflict", "placeNameInTitle", "placeNameTokens"];
2708
+ readonly knownValues: ["titleSimilarity", "nameSimilarity", "nameContainment", "titleFrequency", "startDelta", "endDelta", "samePlaceCluster", "distance", "placePrecision", "sameAddress", "addressGeoConflict", "categoryConflict", "sameUrl", "venueNameConflict", "placeNameInTitle", "placeNameTokens", "edgeResolution"];
2709
2709
  };
2710
2710
  readonly value: {
2711
2711
  readonly type: "integer";
@@ -3097,7 +3097,7 @@ export declare const schemaDict: {
3097
3097
  readonly PubTechneDraftGeo: {
3098
3098
  readonly lexicon: 1;
3099
3099
  readonly id: "pub.techne.draft.geo";
3100
- readonly description: "SUPERSEDED, still written by the commons rules until their writers move to the new shape: a position for someone else's record is a `pub.techne.draft.statement` carrying `#locations`, with `basis` naming the entry it positions. Existing records stay readable. Where a record is: a coordinate. A sidecar about any record (a place, an event, a later type), written in the writer's own repo, never onto the subject, so the subject's author, audience and lifetime are untouched and a reader chooses which writers it trusts. Written only when it adds a coordinate the subject's own record lacks: when a source gives coordinates they stay in the subject's own `locations`, and no geo record is needed. H3 cells are not stored: readers compute them from `location` at index time. It says nothing about who wrote it (the author is the repo it lives in) or how (a `pub.techne.draft.derivation` about it says that), so anyone, not only our rules, can write one honestly. PUBLIC. Written only about public records: no space type declares this collection, so it has no permissioned home. Written by the commons geocode rule.";
3100
+ readonly description: "SUPERSEDED: the commons geocode rule wrote it until its version geocode-3, which writes a statement instead. A position for someone else's record is a `pub.techne.draft.statement` carrying `#locations`, with `basis` naming the entry it positions. Existing records stay readable until they are retired. Where a record is: a coordinate. A sidecar about any record (a place, an event, a later type), written in the writer's own repo, never onto the subject, so the subject's author, audience and lifetime are untouched and a reader chooses which writers it trusts. Written only when it adds a coordinate the subject's own record lacks: when a source gives coordinates they stay in the subject's own `locations`, and no geo record is needed. H3 cells are not stored: readers compute them from `location` at index time. It says nothing about who wrote it (the author is the repo it lives in) or how (a `pub.techne.draft.derivation` about it says that), so anyone, not only our rules, can write one honestly. PUBLIC. Written only about public records: no space type declares this collection, so it has no permissioned home. Written by the commons geocode rule before geocode-3.";
3101
3101
  readonly defs: {
3102
3102
  readonly main: {
3103
3103
  readonly type: "record";
@@ -6268,7 +6268,7 @@ export declare const schemaDict: {
6268
6268
  readonly PubTechneDraftOrgAtPlace: {
6269
6269
  readonly lexicon: 1;
6270
6270
  readonly id: "pub.techne.draft.orgAtPlace";
6271
- readonly description: "SUPERSEDED, still written by the commons rules until their writers move to the new shape: an org's sites are entries in its own `locations` (bounded at 256). Existing records stay readable. A relationship: an organization is at a place (its office, its storefront, or a place it operates). Draft tier, PUBLIC. Its own record, not a field on either end, because an org can be at many places, a place can hold many orgs, and someone in particular claims each link (lexicon constitution, rule 2).";
6271
+ readonly description: "SUPERSEDED: no source rule writes it now (the commons curator still writes curated copies of existing links). Its successors: an org's sites are entries in its own `locations` (bounded at 256; a `registered` entry is where it is registered), and a site the org's author did not state is a `pub.techne.draft.statement` about the org carrying `locations` (as the commons org-match rule writes its sites statements). Existing records stay readable. A relationship: an organization is at a place (its office, its storefront, or a place it operates). Draft tier, PUBLIC. Its own record, not a field on either end, because an org can be at many places, a place can hold many orgs, and someone in particular claims each link (lexicon constitution, rule 2).";
6272
6272
  readonly defs: {
6273
6273
  readonly main: {
6274
6274
  readonly type: "record";
@@ -10248,7 +10248,7 @@ export declare const schemaDict: {
10248
10248
  };
10249
10249
  readonly locations: {
10250
10250
  readonly type: "object";
10251
- readonly description: "Where the subject is, as the writer of the statement says, for a subject of any type. It counts only as the view decides: the subject's own locations win, and a statement fills in only where the subject states no location of that kind, or (with `basis`) gives a position to a subject's entry that has none. A statement the subject's own author writes counts as the subject's own locations. A `basis` equal to the subject record's CID (a legacy claim) counts for any own entry of that kind with no position, while the subject is still that version. When several claims compete for one slot (the same kind, and the same `basis` or none), one counts: the finest grain wins, then the newest, then the lowest source URI; the others are conflicts. Read as written, every writer's claim is weighed; curated, only the subject's author's and those of writers the commons root endorses.";
10251
+ readonly description: "Where the subject is, as the writer of the statement says, for a subject of any type. It counts only as the view decides: the subject's own locations win, and a statement fills in only where the subject states no location of that kind, or (with `basis`) gives a position to a subject's entry that has none. A statement the subject's own author writes counts as the subject's own locations. A `basis` equal to the subject record's CID (a legacy claim) counts for any own entry of that kind with no position, while the subject is still that version. When several claims compete for one slot (the same kind, and the same `basis` or none), one counts: the finest grain wins, then the newest, then the lowest source URI; the others are conflicts. On a type whose query document reads its entries as sites (`entries: sites`, as on an org), a claim entry that names no own entry (no `basis`, or a legacy `basis` while the subject states no location of that kind) is its own site: it counts beside every other such entry and competes with none. A claim that names an own entry still competes for that entry, and a subject that states a location of that kind still bars a claim with no `basis`. Read as written, every writer's claim is weighed; curated, only the subject's author's and those of writers the commons root endorses.";
10252
10252
  readonly required: ["locations"];
10253
10253
  readonly properties: {
10254
10254
  readonly locations: {
@@ -14489,7 +14489,7 @@ export declare const schemas: ({
14489
14489
  readonly name: {
14490
14490
  readonly type: "string";
14491
14491
  readonly maxLength: 64;
14492
- readonly knownValues: ["titleSimilarity", "nameSimilarity", "nameContainment", "titleFrequency", "startDelta", "endDelta", "samePlaceCluster", "distance", "placePrecision", "sameAddress", "addressGeoConflict", "categoryConflict", "sameUrl", "venueNameConflict", "placeNameInTitle", "placeNameTokens"];
14492
+ readonly knownValues: ["titleSimilarity", "nameSimilarity", "nameContainment", "titleFrequency", "startDelta", "endDelta", "samePlaceCluster", "distance", "placePrecision", "sameAddress", "addressGeoConflict", "categoryConflict", "sameUrl", "venueNameConflict", "placeNameInTitle", "placeNameTokens", "edgeResolution"];
14493
14493
  };
14494
14494
  readonly value: {
14495
14495
  readonly type: "integer";
@@ -14872,7 +14872,7 @@ export declare const schemas: ({
14872
14872
  } | {
14873
14873
  readonly lexicon: 1;
14874
14874
  readonly id: "pub.techne.draft.geo";
14875
- readonly description: "SUPERSEDED, still written by the commons rules until their writers move to the new shape: a position for someone else's record is a `pub.techne.draft.statement` carrying `#locations`, with `basis` naming the entry it positions. Existing records stay readable. Where a record is: a coordinate. A sidecar about any record (a place, an event, a later type), written in the writer's own repo, never onto the subject, so the subject's author, audience and lifetime are untouched and a reader chooses which writers it trusts. Written only when it adds a coordinate the subject's own record lacks: when a source gives coordinates they stay in the subject's own `locations`, and no geo record is needed. H3 cells are not stored: readers compute them from `location` at index time. It says nothing about who wrote it (the author is the repo it lives in) or how (a `pub.techne.draft.derivation` about it says that), so anyone, not only our rules, can write one honestly. PUBLIC. Written only about public records: no space type declares this collection, so it has no permissioned home. Written by the commons geocode rule.";
14875
+ readonly description: "SUPERSEDED: the commons geocode rule wrote it until its version geocode-3, which writes a statement instead. A position for someone else's record is a `pub.techne.draft.statement` carrying `#locations`, with `basis` naming the entry it positions. Existing records stay readable until they are retired. Where a record is: a coordinate. A sidecar about any record (a place, an event, a later type), written in the writer's own repo, never onto the subject, so the subject's author, audience and lifetime are untouched and a reader chooses which writers it trusts. Written only when it adds a coordinate the subject's own record lacks: when a source gives coordinates they stay in the subject's own `locations`, and no geo record is needed. H3 cells are not stored: readers compute them from `location` at index time. It says nothing about who wrote it (the author is the repo it lives in) or how (a `pub.techne.draft.derivation` about it says that), so anyone, not only our rules, can write one honestly. PUBLIC. Written only about public records: no space type declares this collection, so it has no permissioned home. Written by the commons geocode rule before geocode-3.";
14876
14876
  readonly defs: {
14877
14877
  readonly main: {
14878
14878
  readonly type: "record";
@@ -18001,7 +18001,7 @@ export declare const schemas: ({
18001
18001
  } | {
18002
18002
  readonly lexicon: 1;
18003
18003
  readonly id: "pub.techne.draft.orgAtPlace";
18004
- readonly description: "SUPERSEDED, still written by the commons rules until their writers move to the new shape: an org's sites are entries in its own `locations` (bounded at 256). Existing records stay readable. A relationship: an organization is at a place (its office, its storefront, or a place it operates). Draft tier, PUBLIC. Its own record, not a field on either end, because an org can be at many places, a place can hold many orgs, and someone in particular claims each link (lexicon constitution, rule 2).";
18004
+ readonly description: "SUPERSEDED: no source rule writes it now (the commons curator still writes curated copies of existing links). Its successors: an org's sites are entries in its own `locations` (bounded at 256; a `registered` entry is where it is registered), and a site the org's author did not state is a `pub.techne.draft.statement` about the org carrying `locations` (as the commons org-match rule writes its sites statements). Existing records stay readable. A relationship: an organization is at a place (its office, its storefront, or a place it operates). Draft tier, PUBLIC. Its own record, not a field on either end, because an org can be at many places, a place can hold many orgs, and someone in particular claims each link (lexicon constitution, rule 2).";
18005
18005
  readonly defs: {
18006
18006
  readonly main: {
18007
18007
  readonly type: "record";
@@ -21934,7 +21934,7 @@ export declare const schemas: ({
21934
21934
  };
21935
21935
  readonly locations: {
21936
21936
  readonly type: "object";
21937
- readonly description: "Where the subject is, as the writer of the statement says, for a subject of any type. It counts only as the view decides: the subject's own locations win, and a statement fills in only where the subject states no location of that kind, or (with `basis`) gives a position to a subject's entry that has none. A statement the subject's own author writes counts as the subject's own locations. A `basis` equal to the subject record's CID (a legacy claim) counts for any own entry of that kind with no position, while the subject is still that version. When several claims compete for one slot (the same kind, and the same `basis` or none), one counts: the finest grain wins, then the newest, then the lowest source URI; the others are conflicts. Read as written, every writer's claim is weighed; curated, only the subject's author's and those of writers the commons root endorses.";
21937
+ readonly description: "Where the subject is, as the writer of the statement says, for a subject of any type. It counts only as the view decides: the subject's own locations win, and a statement fills in only where the subject states no location of that kind, or (with `basis`) gives a position to a subject's entry that has none. A statement the subject's own author writes counts as the subject's own locations. A `basis` equal to the subject record's CID (a legacy claim) counts for any own entry of that kind with no position, while the subject is still that version. When several claims compete for one slot (the same kind, and the same `basis` or none), one counts: the finest grain wins, then the newest, then the lowest source URI; the others are conflicts. On a type whose query document reads its entries as sites (`entries: sites`, as on an org), a claim entry that names no own entry (no `basis`, or a legacy `basis` while the subject states no location of that kind) is its own site: it counts beside every other such entry and competes with none. A claim that names an own entry still competes for that entry, and a subject that states a location of that kind still bars a claim with no `basis`. Read as written, every writer's claim is weighed; curated, only the subject's author's and those of writers the commons root endorses.";
21938
21938
  readonly required: ["locations"];
21939
21939
  readonly properties: {
21940
21940
  readonly locations: {
@@ -2881,6 +2881,7 @@ export const schemaDict = {
2881
2881
  'venueNameConflict',
2882
2882
  'placeNameInTitle',
2883
2883
  'placeNameTokens',
2884
+ 'edgeResolution',
2884
2885
  ],
2885
2886
  },
2886
2887
  value: {
@@ -3285,7 +3286,7 @@ export const schemaDict = {
3285
3286
  PubTechneDraftGeo: {
3286
3287
  lexicon: 1,
3287
3288
  id: 'pub.techne.draft.geo',
3288
- description: "SUPERSEDED, still written by the commons rules until their writers move to the new shape: a position for someone else's record is a `pub.techne.draft.statement` carrying `#locations`, with `basis` naming the entry it positions. Existing records stay readable. Where a record is: a coordinate. A sidecar about any record (a place, an event, a later type), written in the writer's own repo, never onto the subject, so the subject's author, audience and lifetime are untouched and a reader chooses which writers it trusts. Written only when it adds a coordinate the subject's own record lacks: when a source gives coordinates they stay in the subject's own `locations`, and no geo record is needed. H3 cells are not stored: readers compute them from `location` at index time. It says nothing about who wrote it (the author is the repo it lives in) or how (a `pub.techne.draft.derivation` about it says that), so anyone, not only our rules, can write one honestly. PUBLIC. Written only about public records: no space type declares this collection, so it has no permissioned home. Written by the commons geocode rule.",
3289
+ description: "SUPERSEDED: the commons geocode rule wrote it until its version geocode-3, which writes a statement instead. A position for someone else's record is a `pub.techne.draft.statement` carrying `#locations`, with `basis` naming the entry it positions. Existing records stay readable until they are retired. Where a record is: a coordinate. A sidecar about any record (a place, an event, a later type), written in the writer's own repo, never onto the subject, so the subject's author, audience and lifetime are untouched and a reader chooses which writers it trusts. Written only when it adds a coordinate the subject's own record lacks: when a source gives coordinates they stay in the subject's own `locations`, and no geo record is needed. H3 cells are not stored: readers compute them from `location` at index time. It says nothing about who wrote it (the author is the repo it lives in) or how (a `pub.techne.draft.derivation` about it says that), so anyone, not only our rules, can write one honestly. PUBLIC. Written only about public records: no space type declares this collection, so it has no permissioned home. Written by the commons geocode rule before geocode-3.",
3289
3290
  defs: {
3290
3291
  main: {
3291
3292
  type: 'record',
@@ -6757,7 +6758,7 @@ export const schemaDict = {
6757
6758
  PubTechneDraftOrgAtPlace: {
6758
6759
  lexicon: 1,
6759
6760
  id: 'pub.techne.draft.orgAtPlace',
6760
- description: "SUPERSEDED, still written by the commons rules until their writers move to the new shape: an org's sites are entries in its own `locations` (bounded at 256). Existing records stay readable. A relationship: an organization is at a place (its office, its storefront, or a place it operates). Draft tier, PUBLIC. Its own record, not a field on either end, because an org can be at many places, a place can hold many orgs, and someone in particular claims each link (lexicon constitution, rule 2).",
6761
+ description: "SUPERSEDED: no source rule writes it now (the commons curator still writes curated copies of existing links). Its successors: an org's sites are entries in its own `locations` (bounded at 256; a `registered` entry is where it is registered), and a site the org's author did not state is a `pub.techne.draft.statement` about the org carrying `locations` (as the commons org-match rule writes its sites statements). Existing records stay readable. A relationship: an organization is at a place (its office, its storefront, or a place it operates). Draft tier, PUBLIC. Its own record, not a field on either end, because an org can be at many places, a place can hold many orgs, and someone in particular claims each link (lexicon constitution, rule 2).",
6761
6762
  defs: {
6762
6763
  main: {
6763
6764
  type: 'record',
@@ -10976,7 +10977,7 @@ export const schemaDict = {
10976
10977
  },
10977
10978
  locations: {
10978
10979
  type: 'object',
10979
- description: "Where the subject is, as the writer of the statement says, for a subject of any type. It counts only as the view decides: the subject's own locations win, and a statement fills in only where the subject states no location of that kind, or (with `basis`) gives a position to a subject's entry that has none. A statement the subject's own author writes counts as the subject's own locations. A `basis` equal to the subject record's CID (a legacy claim) counts for any own entry of that kind with no position, while the subject is still that version. When several claims compete for one slot (the same kind, and the same `basis` or none), one counts: the finest grain wins, then the newest, then the lowest source URI; the others are conflicts. Read as written, every writer's claim is weighed; curated, only the subject's author's and those of writers the commons root endorses.",
10980
+ description: "Where the subject is, as the writer of the statement says, for a subject of any type. It counts only as the view decides: the subject's own locations win, and a statement fills in only where the subject states no location of that kind, or (with `basis`) gives a position to a subject's entry that has none. A statement the subject's own author writes counts as the subject's own locations. A `basis` equal to the subject record's CID (a legacy claim) counts for any own entry of that kind with no position, while the subject is still that version. When several claims compete for one slot (the same kind, and the same `basis` or none), one counts: the finest grain wins, then the newest, then the lowest source URI; the others are conflicts. On a type whose query document reads its entries as sites (`entries: sites`, as on an org), a claim entry that names no own entry (no `basis`, or a legacy `basis` while the subject states no location of that kind) is its own site: it counts beside every other such entry and competes with none. A claim that names an own entry still competes for that entry, and a subject that states a location of that kind still bars a claim with no `basis`. Read as written, every writer's claim is weighed; curated, only the subject's author's and those of writers the commons root endorses.",
10980
10981
  required: ['locations'],
10981
10982
  properties: {
10982
10983
  locations: {
@@ -43,7 +43,7 @@ export declare function isMethod<V>(v: V): v is import("../../../../util.js").$T
43
43
  export declare function validateMethod<V>(v: V): ValidationResult<Method & V>;
44
44
  export interface Signal {
45
45
  $type?: 'pub.techne.draft.derivation#signal';
46
- name: 'titleSimilarity' | 'nameSimilarity' | 'nameContainment' | 'titleFrequency' | 'startDelta' | 'endDelta' | 'samePlaceCluster' | 'distance' | 'placePrecision' | 'sameAddress' | 'addressGeoConflict' | 'categoryConflict' | 'sameUrl' | 'venueNameConflict' | 'placeNameInTitle' | 'placeNameTokens' | (string & {});
46
+ name: 'titleSimilarity' | 'nameSimilarity' | 'nameContainment' | 'titleFrequency' | 'startDelta' | 'endDelta' | 'samePlaceCluster' | 'distance' | 'placePrecision' | 'sameAddress' | 'addressGeoConflict' | 'categoryConflict' | 'sameUrl' | 'venueNameConflict' | 'placeNameInTitle' | 'placeNameTokens' | 'edgeResolution' | (string & {});
47
47
  value: number;
48
48
  }
49
49
  export declare function isSignal<V>(v: V): v is import("../../../../util.js").$TypedObject<V, "pub.techne.draft.derivation", "signal">;
@@ -21,7 +21,7 @@ export interface Main {
21
21
  export declare function isMain<V>(v: V): v is import("../../../../util.js").$TypedObject<V, "pub.techne.draft.statement", "main">;
22
22
  export declare function validateMain<V>(v: V): ValidationResult<Main & V>;
23
23
  export { type Main as Record, isMain as isRecord, validateMain as validateRecord, };
24
- /** Where the subject is, as the writer of the statement says, for a subject of any type. It counts only as the view decides: the subject's own locations win, and a statement fills in only where the subject states no location of that kind, or (with `basis`) gives a position to a subject's entry that has none. A statement the subject's own author writes counts as the subject's own locations. A `basis` equal to the subject record's CID (a legacy claim) counts for any own entry of that kind with no position, while the subject is still that version. When several claims compete for one slot (the same kind, and the same `basis` or none), one counts: the finest grain wins, then the newest, then the lowest source URI; the others are conflicts. Read as written, every writer's claim is weighed; curated, only the subject's author's and those of writers the commons root endorses. */
24
+ /** Where the subject is, as the writer of the statement says, for a subject of any type. It counts only as the view decides: the subject's own locations win, and a statement fills in only where the subject states no location of that kind, or (with `basis`) gives a position to a subject's entry that has none. A statement the subject's own author writes counts as the subject's own locations. A `basis` equal to the subject record's CID (a legacy claim) counts for any own entry of that kind with no position, while the subject is still that version. When several claims compete for one slot (the same kind, and the same `basis` or none), one counts: the finest grain wins, then the newest, then the lowest source URI; the others are conflicts. On a type whose query document reads its entries as sites (`entries: sites`, as on an org), a claim entry that names no own entry (no `basis`, or a legacy `basis` while the subject states no location of that kind) is its own site: it counts beside every other such entry and competes with none. A claim that names an own entry still competes for that entry, and a subject that states a location of that kind still bars a claim with no `basis`. Read as written, every writer's claim is weighed; curated, only the subject's author's and those of writers the commons root endorses. */
25
25
  export interface Locations {
26
26
  $type?: 'pub.techne.draft.statement#locations';
27
27
  /** Entries as in the subject's own `locations` field (lexicon naming register). */