sanoma 0.4.2 → 0.6.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/README.md CHANGED
@@ -9,7 +9,7 @@ mkdir acme && cd acme
9
9
  npx sanoma
10
10
  ```
11
11
 
12
- In an empty directory (dotfiles aside), `sanoma` starts a company there, then runs it: it copies the template this package ships (`template/`: `sanoma.config.ts`, a `publish-post` workflow with its scenarios, `policies/policy.cedar`, `resources/people.ts` with you as its first person (your GitHub login as `gh` is signed in, else this machine's user name, named as git's `user.name`), an empty `resources/` tree, `AGENTS.md`, `.env.example`), names the package after the directory, writes `.env` with the default `SANOMA_DATABASE_URL` and a new `SANOMA_SECRETS_KEY` (keeping what a `.env` there already sets), commits what it wrote (never a dotfile that was already there) as the first commit of a git repository on `main`, "Start a Sanoma company", as your git user, then installs with the package manager that ran it (`npm_config_user_agent`; pnpm when it names none) and adds the lockfile to that commit. The `sanoma` it installed then serves the company. Without git or a git user it stops before writing anything; a failed install leaves the commit, to install and run `sanoma` again in. A directory holding anything else and no `sanoma.config.ts` is refused, as for every command.
12
+ In an empty directory (dotfiles aside), `sanoma` starts a company there, then runs it: it copies the template this package ships (`template/`: `sanoma.config.ts`, a `publish-post` workflow with its scenarios, `policies/policy.cedar`, `resources/people.ts` with you as its first person (your GitHub login as `gh` is signed in, else this machine's user name, named as git's `user.name`), an empty `resources/` tree, `AGENTS.md`, `.env.example`), names the package after the directory, writes `.env` with the default `SANOMA_DATABASE_URL` and a new `SANOMA_SECRETS_KEY` (keeping what a `.env` there already sets), commits what it wrote (never a dotfile that was already there) as the first commit of a git repository on `main`, "Start a Sanoma company", as your git user, then installs with the package manager that ran it (`npm_config_user_agent`; pnpm when it names none), with `sanoma` at its own version and each other package the template names at `latest`, and adds the lockfile to that commit. The `sanoma` it installed then serves the company. Without git or a git user it stops before writing anything; a failed install leaves the commit, to install and run `sanoma` again in. A directory holding anything else and no `sanoma.config.ts` is refused, as for every command.
13
13
 
14
14
  ## Install
15
15
 
@@ -56,7 +56,7 @@ export default defineWorkflow({
56
56
  });
57
57
  ```
58
58
 
59
- A workflow imports from `sanoma` what the lint lets it (`defineWorkflow`, `mayDecide`, `errorCode`, `z`, and types); `zod` itself and `@sanoma-ai/workflows` are accepted too. The config file imports `defineConfig` (and a ledger store, `jsonlLedger`, `memoryLedger` or `postgresLedger`, when it names one) from `sanoma`, and its connectors from their packages. A site, `sites/<name>/` (pages the app serves under `/sites/<name>/`), imports `defineSite`, the app's route APIs (`Link`, `Outlet`, `useNavigate`, …) and `api`, which calls the company's operations and workflows as the person on the page ([calling operations and workflows](https://www.npmjs.com/package/@sanoma-ai/app#calling-operations-and-workflows)), from `sanoma/site`, and `createFileRoute` from `@tanstack/react-router`; the [app's README](https://www.npmjs.com/package/@sanoma-ai/app#a-sites-imports) has the whole list. A data file under `resources/` imports `secret` and `sanoma` (the people types) from `sanoma/resources`, and `resources/data.ts`, the company's [collections](../workflows/README.md#collections), imports `collection` from `sanoma/data` and nothing else:
59
+ A workflow imports from `sanoma` what the lint lets it (`defineWorkflow`, `mayDecide`, `errorCode`, `z`, and types); `zod` itself and `@sanoma-ai/workflows` are accepted too. The config file imports `defineConfig` (and a ledger store, `jsonlLedger`, `memoryLedger` or `postgresLedger`, when it names one) from `sanoma`, and its connectors from their packages. A site, `sites/<name>/` (pages the app serves under `/sites/<name>/`; `defineSite({ public: true, login })` in its `site.ts` marks one for visitors, served at the root of its own host too, and `locales` its languages), imports `defineSite`, the app's route APIs (`Link`, `Outlet`, `useNavigate`, …) and `api`, which calls the company's operations and workflows as the person on the page ([calling operations and workflows](https://www.npmjs.com/package/@sanoma-ai/app#calling-operations-and-workflows)), from `sanoma/site` with the rest of what talks to the app (`RunForm`, a workflow's start form, and `useActor`, who is signed in), how its pages look (the app's components, presentational only) from `sanoma/ui`, and `createFileRoute` from `@tanstack/react-router`; the [app's README](https://www.npmjs.com/package/@sanoma-ai/app#a-sites-imports) has the whole list. A data file under `resources/` imports `secret` and `sanoma` (the people types) from `sanoma/resources`, and `resources/data.ts`, the company's [collections](../workflows/README.md#collections), imports `collection` from `sanoma/data` and nothing else:
60
60
 
61
61
  ```ts
62
62
  // resources/data.ts
@@ -92,22 +92,22 @@ forbid (principal, action in [Sanoma::Action::"effect:publish", Sanoma::Action::
92
92
  unless { principal in Sanoma::Group::"editor" };
93
93
  ```
94
94
 
95
- Only a declared person signs in to the app (on this machine by picking their name; with GitHub sign-in by their verified email, then their `github` login), starts a run, calls an operation or decides an approval, and nobody decides an approval on a run they started while someone else in the group could (a founder alone in a group decides their own, and the ledger says so). Everything is allowed unless a `forbid` refuses it: one with `@hold` waits for that group's or person's approval, one without is denied with its `@reason`. Write them against `.sanoma/schema.cedarschema`, which `sanoma check` and `sanoma` write from the config: each operation's id as an action in its effect's group, `workflow:<name>` for a run's start, the groups the people file declares, and each operation's input as `context.input`. `sanoma check` reports a policy problem at its place and runs no scenario until there are none; `sanoma` refuses to start on one. A scenario runs as the agent `scenarios` unless it says who is acting (`Given bo is acting`), and checks the policy with `Then ghost.post.publish was held for group "editor"` and `Then <op> was denied with "<reason>"`. The app's Permissions page shows what the policies answer for each group.
95
+ Only a declared person signs in to the app (on this machine by picking their name; with GitHub sign-in by their verified email, then their `github` login), starts a run, calls an operation or decides an approval, and nobody decides an approval on a run they started while someone else in the group could (a founder alone in a group decides their own, and the ledger says so). Everything is allowed unless a `forbid` refuses it: one with `@hold` waits for that group's or person's approval, one without is denied with its `@reason`. A visitor of a public site, in the group `visitors` (or `anonymous`, when nobody is signed in), is the exception: it may start a run or call an operation directly only where a `permit` names it, the one `permit` a policy file may hold (`permit (principal in Sanoma::Group::"visitors", action == Sanoma::Action::"workflow:signup", resource);`), and inside a run it started its calls are allowed as anyone's, the forbids still holding. Write them against `.sanoma/schema.cedarschema`, which `sanoma check` and `sanoma` write from the config: each operation's id as an action in its effect's group, `workflow:<name>` for a run's start, the groups the people file declares, and each operation's input as `context.input`. `sanoma check` reports a policy problem at its place and runs no scenario until there are none; `sanoma` refuses to start on one. A scenario runs as the agent `scenarios` unless it says who is acting (`Given bo is acting`, `Given a visitor is acting`, `Given anonymous is acting`), and checks the policy with `Then ghost.post.publish was held for group "editor"` and `Then <op> was denied with "<reason>"`. The app's Permissions page shows what the policies answer for each group.
96
96
 
97
97
  ## Commands
98
98
 
99
99
  Run them from the directory that holds `sanoma.config.ts`. Each loads `.env` there first, when there is one (a variable already set wins), then the config.
100
100
 
101
- | Command | What it does |
102
- | --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
103
- | `sanoma` | Makes `SANOMA_SECRETS_KEY`, which encrypts the stored credentials, when the environment and `.env` have none, appending it to `.env` with one line saying so; makes sure Postgres answers (see [Postgres](#postgres)), then starts the worker (promoted, so a local worker takes every queued run) and the app in one process, and prints `<appName> running <workflows>` and `<appName> at http://127.0.0.1:3000; ctrl-c to stop`; the worker says `sanoma: 2 of 5 connectors not configured yet: ghost, resend; …` first when some vendors' variables are missing or invalid (a call to one fails, naming them, until they are set; nothing when all are set). When the repo has [sites](#sites), it serves the app and the sites from a dev server that shows each edit as it is saved (see [Developing a site](#developing-a-site)). In [dev mode](#dev-mode) it runs them in a child it restarts. In an empty directory it first [starts a company](#start-a-company). The worker and the app are given the repo's git checkout as their `source`, which commits to the current branch. |
104
- | `sanoma worker`, `sanoma app` | One of the two alone, for a deployment that runs them apart (`app` builds the app with the [sites](#sites)). Neither touches Docker. |
105
- | `sanoma check` | Writes [`.sanoma/api.ts`](#sites) and `.sanoma/schema.cedarschema` first, each when it changed; then `tsc -p tsconfig.json`; oxlint over `workflows/`, `resources/` and `sites/` (those that exist) with the repo's `.oxlintrc.json`, written when missing (see [the lint](#the-lint)); every problem `describeConfig` finds (an import a workflow may not make, what its graph cannot draw, a data file outside the subset: what the worker would refuse; a site's call to a workflow, collection or operation the config does not have); every problem in the [policies](#people-and-policies), at its `file:line:col` with the policy's id; with [sites](#sites), the app built with them and `tsc -p sites/tsconfig.json`; then, unless the policies have a problem, every scenario against the fakes, on a database of its own (`<database>_check`), each step that did not hold a problem. Prints each problem on a line, `file:line:col: message` or `scenario › step: message`, and exits 1 when there is one. No vitest. |
106
- | `sanoma env [--check]` | Writes `.env.example`: the variables `sanoma` reads, then every variable the connectors' drivers declare, by vendor, with its description; optional ones commented out. `--check` writes nothing and exits 1 with "`.env.example` is out of date: run `sanoma env`" when the file differs, for CI. |
107
- | `sanoma ledger export <runId> [--out <file>]` | A run's ledger records from the config's store (the Postgres ledger on its database when it names none), as JSON lines (the shape `jsonlLedger` keeps), to stdout or `--out`. |
108
- | `sanoma --help` | The usage. |
101
+ | Command | What it does |
102
+ | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
103
+ | `sanoma` | Makes `SANOMA_SECRETS_KEY`, which encrypts the stored credentials, when the environment and `.env` have none, appending it to `.env` with one line saying so; makes sure Postgres answers (see [Postgres](#postgres)), then starts the worker (promoted, so a local worker takes every queued run) and the app in one process, and prints `<appName> running <workflows>` and `<appName> at http://127.0.0.1:3000; ctrl-c to stop`; the worker says `sanoma: 2 of 5 connectors not configured yet: ghost, resend; …` first when some vendors' variables are missing or invalid (a call to one fails, naming them, until they are set; nothing when all are set). When the repo has [sites](#sites), it serves the app and the sites from a dev server that shows each edit as it is saved (see [Developing a site](#developing-a-site)). In [dev mode](#dev-mode) it runs them in a child it restarts. In an empty directory it first [starts a company](#start-a-company). The worker and the app are given the repo's git checkout as their `source`, which commits to the current branch. |
104
+ | `sanoma worker`, `sanoma app` | One of the two alone, for a deployment that runs them apart (`app` builds the app with the [sites](#sites)). Neither touches Docker. |
105
+ | `sanoma check` | Writes [`.sanoma/api.ts`](#sites) and `.sanoma/schema.cedarschema` first, each when it changed; then `tsc -p tsconfig.json`; oxlint over `workflows/`, `resources/` and `sites/` (those that exist) with the repo's `.oxlintrc.json`, written when missing (see [the lint](#the-lint)); every problem `describeConfig` finds (an import a workflow may not make, what its graph cannot draw, a data file outside the subset: what the worker would refuse; a site's call to a workflow, collection or operation the config does not have, or a public site's start or direct call no `permit` lets a visitor make; a domain a host gives a site that is not public, or gives two sites); every problem in the [policies](#people-and-policies), at its `file:line:col` with the policy's id; with [sites](#sites), the app built with them, `tsc -p sites/tsconfig.json` and what is wrong under `content/`; then, unless the policies have a problem, every scenario against the fakes, on a database of its own (`<database>_check`), each step that did not hold a problem. Prints each problem on a line, `file:line:col: message` or `scenario › step: message`, and exits 1 when there is one; before them each warning, `file:line:col: warning: message` (a public site's page the sitemap cannot list the entries of), which never fails it. No vitest. |
106
+ | `sanoma env [--check]` | Writes `.env.example`: the variables `sanoma` reads, then every variable the connectors' drivers declare, by vendor, with its description; optional ones commented out. `--check` writes nothing and exits 1 with "`.env.example` is out of date: run `sanoma env`" when the file differs, for CI. |
107
+ | `sanoma ledger export <runId> [--out <file>]` | A run's ledger records from the config's store (the Postgres ledger on its database when it names none), as JSON lines (the shape `jsonlLedger` keeps), to stdout or `--out`. |
108
+ | `sanoma --help` | The usage. |
109
109
 
110
- Exit codes: 2 for a mistake in the call or the repo (no `sanoma.config.ts`, an unknown command or option, a bad argument), printed with the usage where it helps; 1 for failed checks and failures while running; 0 otherwise. `SANOMA_APP_PORT` is the app's port (default 3000; 0 for any free port, which the printed address reports). `SANOMA_APP_HOST` is its address (default 127.0.0.1); any other needs [GitHub sign-in](../app/README.md#github), which `SANOMA_GITHUB_CLIENT_ID` and `SANOMA_GITHUB_CLIENT_SECRET` turn on (both or neither, with `SANOMA_SECRETS_KEY` set; on a host beyond this machine, or with one of them set, the other may be the stored one the app's Go live page saved when it created the GitHub App); a mistake in them exits 2 before anything starts, as does a problem in the policies. On SIGINT or SIGTERM the app, then the worker, stop, and the process exits 0.
110
+ Exit codes: 2 for a mistake in the call or the repo (no `sanoma.config.ts`, an unknown command or option, a bad argument), printed with the usage where it helps; 1 for failed checks and failures while running; 0 otherwise. `SANOMA_APP_PORT` is the app's port (default 3000; 0 for any free port, which the printed address reports). `SANOMA_APP_HOST` is its address (default 127.0.0.1); `SANOMA_DOMAINS` gives a [public site](../app/README.md#public-sites) its domain, `<site>=<hostname>[,<site>=<hostname>…]` (`www=sanoma.example`, which a host resource's `domains` sets), and a malformed one exits 2; any other needs [GitHub sign-in](../app/README.md#github), which `SANOMA_GITHUB_CLIENT_ID` and `SANOMA_GITHUB_CLIENT_SECRET` turn on (both or neither, with `SANOMA_SECRETS_KEY` set; on a host beyond this machine, or with one of them set, the other may be the stored one the app's Go live page saved when it created the GitHub App); a mistake in them exits 2 before anything starts, as does a problem in the policies. On SIGINT or SIGTERM the app, then the worker, stop, and the process exits 0.
111
111
 
112
112
  ## Postgres
113
113
 
@@ -127,42 +127,47 @@ The worker and the app run on `SANOMA_DATABASE_URL` (default `postgresql://postg
127
127
  }
128
128
  ```
129
129
 
130
- `sanoma/oxlint.json` is self-contained (it extends nothing): `@sanoma-ai/workflows`'s rules (the clock, randomness, the network, the environment, the imports a workflow may make, the data-file subset, with its plugin inside `sanoma`), a site's (client code only: no server function, `*.server.*` file or route `server` handlers, no import of the runtime, a connector, Postgres, DBOS, Node's modules or TanStack Start, no relative import out of `sites/`, no `process` or `require`; types may be imported from anywhere; `sites/__virtual.ts`, the build's listing, aside) and the rules this repo holds its own code to. Add your own rules beside the `extends`; `sanoma check` leaves an existing file alone.
130
+ `sanoma/oxlint.json` is self-contained (it extends nothing): `@sanoma-ai/workflows`'s rules (the clock, randomness, the network, the environment, the imports a workflow may make, the data-file subset, with its plugin inside `sanoma`), a site's (client code only: no server function, `*.server.*` file or route `server` handlers, no import of the runtime, a connector, Postgres, DBOS, Node's modules or TanStack Start, the app only through `sanoma/site` and `sanoma/ui`, no relative import out of `sites/`, no `virtual:` module (content comes through `content`), no `process` or `require`; types may be imported from anywhere; `sites/__virtual.ts`, the build's listing, aside) and the rules this repo holds its own code to. Add your own rules beside the `extends`; `sanoma check` leaves an existing file alone.
131
131
 
132
132
  ## Sites
133
133
 
134
134
  A folder under `sites/` with a `routes/` directory is a site: TanStack Router file routes the app serves under `/sites/<name>`, in its shell (see [`@sanoma-ai/app`'s Sites](../app/README.md#sites)). A route file imports `createFileRoute` from `@tanstack/react-router`; the repo installs nothing for it but `sanoma`.
135
135
 
136
- - `sanoma app` (and `sanoma` when `SANOMA_APP_HOST` is another machine's) builds the app with the repo's sites before anything starts (`building the app with 1 site (hello)`), into `.sanoma/app/build/<key>`, and serve that build. The key covers the app's version and every file under `sites/`, so a start with nothing changed reuses the build (`app build up to date`). With no site, they serve the build the app ships and write nothing under `.sanoma/` but `api.ts`. A build that fails stops the command before the worker starts.
136
+ - `sanoma app` (and `sanoma` when `SANOMA_APP_HOST` is another machine's) builds the app with the repo's sites before anything starts (`building the app with 1 site (hello)`), into `.sanoma/app/build/<key>`, and serve that build. The key covers the app's version and every file under `sites/` and `content/`, so a start with nothing changed reuses the build (`app build up to date`). With no site, they serve the build the app ships and write nothing under `.sanoma/` but `api.ts`. A build that fails stops the command before the worker starts.
137
137
  - `.sanoma/api.ts` is the generated SDK: `sanoma check` (first, before tsc), and `sanoma`, `sanoma serve` and `sanoma app` at start, write it from the config when its text changed, with sites or without; while `sanoma` serves the sites from its dev server, it writes it again (`wrote .sanoma/api.ts`) when `sanoma.config.ts` or any TypeScript file in the repo outside `sites/`, `.sanoma/` and `node_modules/` changes. It types `api` from `sanoma/site`: `api.<workflow>` (the workflow's name in camelCase, `WorkflowFn` of its input), `api.<vendor>.<resource>.<op>` for each operation a person may call directly (a vendor's read, `OpFn` of its input) and `api.data.<collection>` (`CollectionApi` of the collection's record), each with its title and descriptions as JSDoc, so whoever writes a site sees what each call is and `tsc -p sites/tsconfig.json` refuses a call that does not fit. The sites' tsconfig is the only one that reads it: the repo's root `tsconfig.json` (Node, no DOM) must not include it. A workflow whose api name another workflow, a vendor or `data` has is left out of it, and `sanoma check` reports it. Never edit it.
138
- - `sanoma check`, when there is a site, writes the sites' generated files, then, beside tsc, oxlint and the config, builds the app with the sites (reused when nothing changed) and runs `tsc -p sites/tsconfig.json`, which types every `Link` against every page of the app and the sites. Each of these is a problem: a type error at its `file:line:col`; two pages claiming one path (`More than one page claims /sites/hello/: …`); a site importing server code (`sites/hello/routes/index.tsx:4:28: Import denied in client environment: "@sanoma-ai/workflows"`); and a folder whose name is not one URL segment (`sites/<name>: a site's folder name is a URL segment (lowercase letters, digits and dashes)`), which the app does not mount.
138
+ - `sanoma check`, when there is a site, writes the sites' generated files, then, beside tsc, oxlint and the config, builds the app with the sites (reused when nothing changed) and runs `tsc -p sites/tsconfig.json`, which types every `Link` against every page of the app and the sites. Each of these is a problem: a type error at its `file:line:col`; two pages claiming one path (`More than one page claims /sites/hello/: …`); a site importing server code (`sites/hello/routes/index.tsx:4:28: Import denied in client environment: "@sanoma-ai/workflows"`); a folder whose name is not one URL segment (`sites/<name>: a site's folder name is a URL segment (lowercase letters, digits and dashes)`), which the app does not mount; and under `content/`, front matter that is not a YAML mapping, at its line (`content/posts/bad.md:2:1: front matter: Tabs are not allowed as indentation`), or a folder or file whose name is not a URL segment, which the sites do not see.
139
+ - On a public site, `sanoma check` reports each start (`api.signup(…)`, `.start(…)`, a `RunForm`) and each direct call (`api.data.<collection>.<op>`, `api.<vendor>.<resource>.<op>`) that no `permit` in `policies/` could let a visitor make, whatever its `when` and `unless` (one for `anonymous`; on a site with a `login`, for `anonymous` or `visitors`), at its `file:line:col` with the line to add: `sites/www/routes/index.tsx:8:9: a visitor's call to workflow "signup" is refused: no permit in policies/ names anonymous for workflow:signup. Add: permit (principal == Sanoma::Principal::"anonymous", action == Sanoma::Action::"workflow:signup", resource);`. Nothing is held to the policies while they have a problem. Whatever they say, a public site's call of a built-in workflow, or read of a workflow's runs but `.result`, is reported too: the app refuses it to every visitor.
140
+ - `content/` holds the Markdown a site reads through `content` from `sanoma/site` ([`@sanoma-ai/app`'s Content](../app/README.md#content)): `content/<kind>/<slug>.md`, front matter and a body, found by convention as `sites/` is. `.sanoma/content.ts` types it from the files' front matter, written with the sites' generated files and, on the dev server, again when a file under `content/` changes. A file with `draft: true` shows on the dev server and never in a build.
139
141
 
140
142
  ### Developing a site
141
143
 
142
144
  `sanoma` serves the app and the sites from Vite's dev server instead of a build (`serving the app with 1 site (hello) from Vite's dev server: edits show as they are saved`), behind the same login, and writes no build:
143
145
 
144
146
  - An edit to a site's file shows in the open page as it is saved, without a reload, the page's state kept (hot module replacement); the server's render of the page follows on the next request.
145
- - A new page, or a new site folder, is live once its first route file is written: the route tree is regenerated and open pages reload, with no restart. A Tailwind class in a new file is styled too.
147
+ - A file saved under `content/` shows on the next render of a page that reads it, drafts included, with no restart, and `.sanoma/content.ts` is written again.
148
+ - A new page, or a new site folder, is live once its first route file is written: the route tree is regenerated and open pages reload, with no restart. A Tailwind class in a new file is styled too, by the app's stylesheet and by a site's own ([`@sanoma-ai/app`'s A site's own stylesheet](../app/README.md#a-sites-own-stylesheet)).
146
149
  - A change to `sites/__virtual.ts` itself needs a restart: the route generator loads that file once. `sanoma` writes it; never edit it.
147
150
  - `sanoma check` beside it builds the app with the same route options, so it leaves the dev server's route tree alone.
148
151
  - The dev server listens on this machine only: with `SANOMA_APP_HOST` naming another, `sanoma` builds the sites and serves the build, as `sanoma app` does.
152
+ - A public site (`defineSite({ public: true })`) answers at the root of `<name>.localhost` on the app's port, with hot updates too, as its visitors see it ([public sites](../app/README.md#public-sites)); `sanoma`, `sanoma serve` and `sanoma app` print each one's address after they start (`www: http://www.localhost:3000`). Browsers send `*.localhost` to this machine with no setup.
149
153
 
150
154
  ## Generated files
151
155
 
152
- | File | Written by | Commit it |
153
- | ----------------------------------------------------- | ----------------------------------------- | --------------- |
154
- | `.env.example` | `sanoma env` | yes |
155
- | `.oxlintrc.json` | `sanoma check`, when missing | yes |
156
- | `sites/__virtual.ts` | `sanoma` and `sanoma check`, with sites | yes |
157
- | `sites/tsconfig.json` | `sanoma` and `sanoma check`, when missing | yes |
158
- | `.sanoma/api.ts` (the sites' typed `api`) | `sanoma` and `sanoma check` | no (`.sanoma/`) |
159
- | `.sanoma/app/` (the route tree, its tsconfig, builds) | `sanoma` and `sanoma check`, with sites | no (`.sanoma/`) |
156
+ | File | Written by | Commit it |
157
+ | ----------------------------------------------------- | ----------------------------------------- | ----------------------------------------- |
158
+ | `.env.example` | `sanoma env` | yes |
159
+ | `.oxlintrc.json` | `sanoma check`, when missing | yes |
160
+ | `sites/__virtual.ts` | `sanoma` and `sanoma check`, with sites | yes |
161
+ | `sites/tsconfig.json` | `sanoma` and `sanoma check`, when missing | yes |
162
+ | `.sanoma/api.ts` (the sites' typed `api`) | `sanoma` and `sanoma check` | no (`.sanoma/`) |
163
+ | `.sanoma/content.ts` (the sites' typed `content`) | `sanoma` and `sanoma check`, with sites | no (`.sanoma/`) |
164
+ | `.sanoma/app/` (the route tree, its tsconfig, builds) | `sanoma` and `sanoma check`, with sites | no (`.sanoma/`, and its own `.gitignore`) |
160
165
 
161
166
  ## Dev mode
162
167
 
163
- When the repo's `node_modules/sanoma` or any `node_modules/@sanoma-ai/*` is a link into a sanoma checkout (`pnpm link`), or `SANOMA_DEV_REPO` names one, `sanoma` runs `sanoma serve --dev` in a child process (serving the [sites](#developing-a-site) as `sanoma` does) and, in every linked package's directory, its `pnpm run watch` (each package's own watch build: `tsc --watch`, and `vite build --watch` too for the app). A change under any linked package's `dist/` restarts the child, after three quarters of a second of quiet (with sites, except the app's own pages in `dist/client` and `dist/server`: the dev server serves the app's source from the checkout and hot-updates it), one restart at a time; a child that exits on its own is reported and started again on the next change. The child and each watch run in a process group of their own, so a terminal's ctrl-c reaches `sanoma` alone, which then ends each group (SIGTERM, SIGKILL after 5 seconds) and exits.
168
+ When the repo's `node_modules/sanoma` or any `node_modules/@sanoma-ai/*` is a link into a sanoma checkout (`pnpm link`), or `SANOMA_DEV_REPO` names one, `sanoma` runs `sanoma serve --dev` in a child process (serving the [sites](#developing-a-site) as `sanoma` does) and, in the directory of every package it reaches in the checkout, its `pnpm run watch` (each package's own watch build: `tsc --watch`, and `vite build --watch` too for the app). Those are the linked packages and each of `sanoma`, `@sanoma-ai/workflows`, `@sanoma-ai/app` and `@sanoma-ai/bridge` that Node resolves into the checkout through them, so a link of `sanoma` alone builds all four. A change under any of their `dist/` restarts the child, after three quarters of a second of quiet (with sites, except the app's own pages in `dist/client` and `dist/server`: the dev server serves the app's source from the checkout and hot-updates it), one restart at a time; a child that exits on its own is reported and started again on the next change. The child and each watch run in a process group of their own, so a terminal's ctrl-c reaches `sanoma` alone, which then ends each group (SIGTERM, SIGKILL after 5 seconds) and exits. It does the same, saying `dev mode: the repo no longer links <checkout>; stopping`, once none of the repo's links into the checkout is left (`sanoma-dev unlink`, an install; `node_modules` is looked at every second, and a link gone on two looks in a row is gone), so the checkout's server writes nothing more into the repo's `.sanoma/app` beside the installed sanoma.
164
169
 
165
- Linking some of `sanoma`, `@sanoma-ai/workflows`, `@sanoma-ai/app` and `@sanoma-ai/bridge` and not the others works, with two copies of a package in one process (the linked one, and the one an installed package depends on), and `sanoma` says which still come from their tarballs before it starts the child: `dev mode: sanoma, @sanoma-ai/app, @sanoma-ai/bridge still come from their tarballs: edits to them in the checkout will not show until you pnpm link them too`. Link all four to run the checkout alone.
170
+ Linking a core package while another still comes from a tarball (`@sanoma-ai/workflows` linked and `sanoma` not, or a declared `@sanoma-ai/app` left installed beside a linked `sanoma`) works, with two copies of a package in one process (the linked one, and the one an installed package depends on), and `sanoma` says which still come from their tarballs before it starts the child: `dev mode: sanoma, @sanoma-ai/app, @sanoma-ai/bridge still come from their tarballs, so edits to them in the checkout will not show`. [`@sanoma-ai/dev`](../dev/README.md)'s `sanoma-dev link` links `sanoma` and every declared `@sanoma-ai/*` package the checkout has.
166
171
 
167
172
  ## Hosting it yourself
168
173
 
package/dist/check.d.ts CHANGED
@@ -3,6 +3,8 @@ export interface CheckResult {
3
3
  ok: boolean;
4
4
  /** One printable line each: `<file>:<line>:<col>: <message>`, or `<scenario> › <step>: <message>`. */
5
5
  problems: string[];
6
+ /** What is worth fixing but not wrong, one line each, `<file>:<line>:<col>: warning: <message>`: the sites' `warnings`. */
7
+ warnings: string[];
6
8
  }
7
9
  export interface CheckOptions {
8
10
  /** The Postgres the scenarios' worker runs on: a database of its own, never the config's. */
@@ -24,9 +26,9 @@ export interface CheckOptions {
24
26
  * `describeConfig` finds in the data files and the workflows' files (the import rules and what
25
27
  * the outline cannot draw: what the worker refuses to start with), and each site's call to what
26
28
  * the config does not have; with sites, their generated files written first and, beside those
27
- * three, the app built with them and `tsc -p sites/tsconfig.json` (`checkSites`). Their problems
28
- * in the order tsc, the sites' tsc, oxlint, the policies, the config, the folders refused as
29
- * sites, the sites' build. Then, unless the policies do not hold, every scenario against the fakes (`runScenarios`), each step that did not hold a
30
- * problem. `ok` when there are no problems.
29
+ * three, the app built with them and `tsc -p sites/tsconfig.json` (`checkSites`), and what is
30
+ * wrong under `content/` (as `writeSiteFiles` reads it). Their problems in the order tsc, the sites' tsc, oxlint,
31
+ * the policies, the config, the folders refused as sites, the content's problems, the sites' build. Then, unless the policies do not hold, every scenario against the fakes (`runScenarios`), each step that did not hold a
32
+ * problem. `ok` when there are no problems; the sites' `warnings` beside them never make it not.
31
33
  */
32
34
  export declare function check({ config, root, resolved }: Loaded, { databaseUrl, ready, log }: CheckOptions): Promise<CheckResult>;
package/dist/check.js CHANGED
@@ -5,7 +5,7 @@ import { fileURLToPath } from "node:url";
5
5
  import { promisify } from "node:util";
6
6
  import { errorMessage } from "@sanoma-ai/workflows";
7
7
  import { describeConfig, readPeople, schemaOf, writeGenerated, } from "@sanoma-ai/workflows/describe";
8
- import { problemLine } from "@sanoma-ai/workflows/shared";
8
+ import { problemLine, warningLine } from "@sanoma-ai/workflows/shared";
9
9
  import { runScenarios } from "@sanoma-ai/workflows/scenarios";
10
10
  import { runtimeFrom, siteBuild } from "./sites.js";
11
11
  /** The directories oxlint reads, those that exist. */
@@ -19,10 +19,10 @@ const LINTED = ["workflows", "resources", "sites"];
19
19
  * `describeConfig` finds in the data files and the workflows' files (the import rules and what
20
20
  * the outline cannot draw: what the worker refuses to start with), and each site's call to what
21
21
  * the config does not have; with sites, their generated files written first and, beside those
22
- * three, the app built with them and `tsc -p sites/tsconfig.json` (`checkSites`). Their problems
23
- * in the order tsc, the sites' tsc, oxlint, the policies, the config, the folders refused as
24
- * sites, the sites' build. Then, unless the policies do not hold, every scenario against the fakes (`runScenarios`), each step that did not hold a
25
- * problem. `ok` when there are no problems.
22
+ * three, the app built with them and `tsc -p sites/tsconfig.json` (`checkSites`), and what is
23
+ * wrong under `content/` (as `writeSiteFiles` reads it). Their problems in the order tsc, the sites' tsc, oxlint,
24
+ * the policies, the config, the folders refused as sites, the content's problems, the sites' build. Then, unless the policies do not hold, every scenario against the fakes (`runScenarios`), each step that did not hold a
25
+ * problem. `ok` when there are no problems; the sites' `warnings` beside them never make it not.
26
26
  */
27
27
  export async function check({ config, root, resolved }, { databaseUrl, ready = Promise.resolve(), log }) {
28
28
  // Awaited below when there are scenarios; otherwise its failure is nobody's.
@@ -36,8 +36,7 @@ export async function check({ config, root, resolved }, { databaseUrl, ready = P
36
36
  const build = await siteBuild(root);
37
37
  const { sites, refused } = build?.sitesOf(root) ?? { sites: [], refused: [] };
38
38
  // Before tsc and oxlint read sites/, as `sanoma` writes them: only when there is a site.
39
- if (build && sites.length)
40
- build.writeSiteFiles(root);
39
+ const content = build && sites.length ? build.writeSiteFiles(root).problems.map(problemLine) : [];
41
40
  const [tsc, checked, lints] = await Promise.all([
42
41
  typecheck(root, log),
43
42
  build && sites.length ? checkSites(build, sites, root, log) : { typed: [], built: [] },
@@ -45,7 +44,16 @@ export async function check({ config, root, resolved }, { databaseUrl, ready = P
45
44
  ]);
46
45
  const read = configProblems(description, root);
47
46
  const unmounted = refused.map((name) => `sites/${name}: a site's folder name is a URL segment (lowercase letters, digits and dashes)`);
48
- const problems = [...tsc, ...checked.typed, ...lints, ...policies, ...read, ...unmounted, ...checked.built];
47
+ const problems = [
48
+ ...tsc,
49
+ ...checked.typed,
50
+ ...lints,
51
+ ...policies,
52
+ ...read,
53
+ ...unmounted,
54
+ ...content,
55
+ ...checked.built,
56
+ ];
49
57
  if (resolved.scenarios === undefined) {
50
58
  log("no scenarios: the config's root has no `scenarios/` directory");
51
59
  }
@@ -59,7 +67,8 @@ export async function check({ config, root, resolved }, { databaseUrl, ready = P
59
67
  for (const f of failed)
60
68
  problems.push(`${f.scenario} › ${f.step}: ${f.message}`);
61
69
  }
62
- return { ok: problems.length === 0, problems };
70
+ const warnings = description.sites.flatMap((site) => site.warnings.map(warningLine));
71
+ return { ok: problems.length === 0, problems, warnings };
63
72
  }
64
73
  /**
65
74
  * The sites: the app built with them (`buildApp`, reused when nothing changed), so two pages
package/dist/check.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"check.js","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAEL,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CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC1E,OAAO,GAAG,KAAK,KAAK,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;IACH,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,sBAAsB,IAAI,KAAK,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACjG,OAAO,KAAK,CAAC;AACf,CAAC"}
package/dist/cli.js CHANGED
@@ -35,7 +35,8 @@ Runs the repo in the working directory, from its sanoma.config.ts (after its .en
35
35
  SANOMA_DATABASE_URL names Postgres (default postgresql://postgres:dbos@localhost:5433/sanoma); SANOMA_APP_PORT the
36
36
  app's port (default 3000; 0 for any free port); SANOMA_APP_HOST its address (default 127.0.0.1; any other needs
37
37
  GitHub sign-in, see .env.example). With sanoma or a @sanoma-ai package linked from a sanoma checkout,
38
- or SANOMA_DEV_REPO set, \`sanoma\` also runs each linked package's watch build and restarts on a new build.
38
+ or SANOMA_DEV_REPO set, \`sanoma\` also runs the watch build of each package it reaches in the checkout and
39
+ restarts on a new build.
39
40
  `;
40
41
  /** Exit codes: 2 for how the bin was called or what it found, 1 for failed checks and failures while running. */
41
42
  const USAGE_EXIT = 2;
@@ -134,6 +135,9 @@ async function keep({ config, resolved }, start) {
134
135
  }
135
136
  else {
136
137
  console.log(running);
138
+ // Each public site at its own host, before the line that says how to stop.
139
+ for (const [name, url] of Object.entries(started.sites ?? {}))
140
+ console.log(`${name}: ${url}`);
137
141
  console.log(`${resolved.appName} at ${started.url}; ctrl-c to stop`);
138
142
  }
139
143
  onSignal(() => started.stop());
@@ -164,20 +168,21 @@ async function serveStarted(cwd) {
164
168
  return run([]);
165
169
  }
166
170
  /**
167
- * Dev mode: `sanoma serve --dev` in a child it restarts on a new build, and each linked package's
168
- * `watch`. With sites, the child serves the app's source from Vite's dev server, which updates it
169
- * in place: a new build of the app's pages (its `dist/client` and `dist/server`) restarts nothing.
171
+ * Dev mode: `sanoma serve --dev` in a child it restarts on a new build, and the `watch` of each
172
+ * package reached in the checkout (`linkedPackages`). With sites, the child serves the app's
173
+ * source from Vite's dev server, which updates it in place: a new build of the app's pages (its
174
+ * `dist/client` and `dist/server`) restarts nothing.
170
175
  * Each runs in a process group of its own, so a terminal's ctrl-c reaches this process alone, and
171
176
  * its `stop` is the one path that ends them.
172
177
  */
173
178
  async function dev(repo, packages) {
174
- const { partialLink, startWatchers, supervise } = await import("./dev.js");
179
+ const { partialLink, startWatchers, supervise, whenUnlinked } = await import("./dev.js");
175
180
  const cwd = process.cwd();
176
181
  log(`dev mode: ${repo}; building ${packages.map((p) => p.name).join(", ") || "nothing"} as it changes`);
177
182
  const fromTarballs = partialLink(cwd);
178
183
  if (fromTarballs.length) {
179
- log(`dev mode: ${fromTarballs.join(", ")} still come from their tarballs: ` +
180
- "edits to them in the checkout will not show until you pnpm link them too");
184
+ log(`dev mode: ${fromTarballs.join(", ")} still come from their tarballs, ` +
185
+ "so edits to them in the checkout will not show");
181
186
  }
182
187
  const watchers = startWatchers(packages, log);
183
188
  const cli = fileURLToPath(import.meta.url);
@@ -191,10 +196,18 @@ async function dev(repo, packages) {
191
196
  ignore: hot ? [join(app.dir, "dist", "client"), join(app.dir, "dist", "server")] : [],
192
197
  log,
193
198
  });
194
- onSignal(async () => {
199
+ const shutdown = onSignal(async () => {
200
+ unwatch();
195
201
  await child.stop();
196
202
  await watchers.stop();
197
203
  });
204
+ // Once the repo is unlinked (`sanoma-dev unlink`, an install), the checkout's server must not
205
+ // keep running in it, nor start again on the checkout's next build: it would write its own
206
+ // route tree and tsconfig into `.sanoma/app` beside the installed sanoma's.
207
+ const unwatch = whenUnlinked(cwd, packages, () => {
208
+ log(`dev mode: the repo no longer links ${repo}; stopping`);
209
+ shutdown();
210
+ });
198
211
  return new Promise(() => { });
199
212
  }
200
213
  /** `sanoma api` (hidden): writes the generated files from the config, as `check` and `serve` do. */
@@ -215,9 +228,9 @@ async function runCheck() {
215
228
  own.pathname = `${own.pathname}_check`;
216
229
  // Started here, handed to check at once (which handles its failure), awaited before the scenarios.
217
230
  const ready = ensurePostgres(databaseUrl, { appName, log });
218
- const { ok, problems } = await check(loaded, { databaseUrl: own.toString(), ready, log });
219
- for (const problem of problems)
220
- console.log(problem);
231
+ const { ok, problems, warnings } = await check(loaded, { databaseUrl: own.toString(), ready, log });
232
+ for (const line of [...warnings, ...problems])
233
+ console.log(line);
221
234
  log(ok ? "ok" : `${problems.length} problem${problems.length === 1 ? "" : "s"}`);
222
235
  return ok ? 0 : 1;
223
236
  }
@@ -245,7 +258,10 @@ async function ledgerExport(runId, out) {
245
258
  }
246
259
  return 0;
247
260
  }
248
- /** On the first SIGINT or SIGTERM, stops what runs and exits 0; a second signal exits at once. */
261
+ /**
262
+ * On the first SIGINT or SIGTERM, stops what runs and exits 0; a second signal exits at once.
263
+ * Returns the same handler, for a caller with a reason of its own to stop.
264
+ */
249
265
  function onSignal(stop) {
250
266
  let stopping = false;
251
267
  const handle = () => {
@@ -259,6 +275,7 @@ function onSignal(stop) {
259
275
  };
260
276
  process.once("SIGINT", handle);
261
277
  process.once("SIGTERM", handle);
278
+ return handle;
262
279
  }
263
280
  if (import.meta.main) {
264
281
  try {
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE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AAC,SAAS,GAAG,EAAE,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;GAGG;AACH,SAAS,QAAQ,CAAC,IAAyB;IACzC,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,IAAI,QAAQ;YAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChC,QAAQ,GAAG,IAAI,CAAC;QAChB,IAAI,EAAE,CAAC,IAAI,CACT,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EACrB,CAAC,GAAY,EAAE,EAAE;YACf,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CACF,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC/B,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAChC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,IAAI,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;IACrB,IAAI,CAAC;QACH,OAAO,CAAC,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QACpB,OAAO,CAAC,QAAQ,GAAG,GAAG,YAAY,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
package/dist/dev.d.ts CHANGED
@@ -6,16 +6,17 @@ export interface LinkedPackage {
6
6
  dir: string;
7
7
  }
8
8
  /**
9
- * `node_modules/sanoma` and every package under `node_modules/@sanoma-ai/` whose real path is
10
- * outside any `node_modules`: the ones a `pnpm link` points into a checkout.
9
+ * The packages dev mode builds: `node_modules/sanoma` and every package under
10
+ * `node_modules/@sanoma-ai/` whose real path is outside any `node_modules` (the ones a `pnpm link`
11
+ * points into a checkout), then, when there is one, each core package (`corePackages`) that
12
+ * resolves into the checkout through them, such as `sanoma`'s own dependencies when `sanoma` alone
13
+ * is linked. Nothing when nothing is linked, wherever an installed package's dependencies resolve.
11
14
  */
12
15
  export declare function linkedPackages(cwd: string): LinkedPackage[];
13
16
  /**
14
- * Of `sanoma`, `@sanoma-ai/workflows`, `@sanoma-ai/app` and `@sanoma-ai/bridge`, those installed (from a
15
- * tarball or a registry) while another of them resolves into a checkout: a partial link, under
16
- * which two copies of a package run in one process. Empty when none is linked, or all are. Each
17
- * is found as Node finds it, from the repo's root, else from where `sanoma` really is (where pnpm
18
- * puts sanoma's own dependencies, `@sanoma-ai/app` among them).
17
+ * Of the core packages (`corePackages`), those installed (from a tarball or a registry) while
18
+ * another of them resolves into a checkout: a partial link, under which two copies of a package
19
+ * run in one process. Empty when none is linked, or all are.
19
20
  */
20
21
  export declare function partialLink(cwd: string): string[];
21
22
  /**
@@ -24,6 +25,13 @@ export declare function partialLink(cwd: string): string[];
24
25
  * mode: nothing linked, and the variable unset.
25
26
  */
26
27
  export declare function devRepo(cwd: string, linked?: readonly LinkedPackage[]): string | undefined;
28
+ /**
29
+ * Calls `onUnlinked` once, when none of `packages` is linked into the repo in `cwd` any more: its
30
+ * `node_modules/<name>` no longer the package's directory on two looks in a row, `intervalMs`
31
+ * apart, so a link an install swaps for a moment is not taken for an unlink. Nothing when none is
32
+ * linked to begin with (`SANOMA_DEV_REPO`). Returns what stops the looks.
33
+ */
34
+ export declare function whenUnlinked(cwd: string, packages: readonly LinkedPackage[], onUnlinked: () => void, intervalMs?: number): () => void;
27
35
  export interface SuperviseOptions {
28
36
  /** Starts the child, in a process group of its own (`detached: true`); called again for each restart. */
29
37
  spawn: () => ChildProcess;
package/dist/dev.js CHANGED
@@ -6,14 +6,17 @@ import { createInterface } from "node:readline";
6
6
  import { pathToFileURL } from "node:url";
7
7
  /*
8
8
  * Dev mode: when the repo's `sanoma` or a `@sanoma-ai/*` package resolves into a sanoma checkout (a
9
- * `pnpm link`), or `SANOMA_DEV_REPO` is set, `sanoma` runs each linked package's `watch` script
10
- * and restarts `sanoma serve` when one's `dist/` changes.
9
+ * `pnpm link`), or `SANOMA_DEV_REPO` is set, `sanoma` runs the `watch` script of each package it
10
+ * reaches in the checkout and restarts `sanoma serve` when one's `dist/` changes.
11
11
  */
12
12
  /** Whether a path is inside some `node_modules` directory. */
13
13
  const installed = (path) => path.split(sep).includes("node_modules");
14
14
  /**
15
- * `node_modules/sanoma` and every package under `node_modules/@sanoma-ai/` whose real path is
16
- * outside any `node_modules`: the ones a `pnpm link` points into a checkout.
15
+ * The packages dev mode builds: `node_modules/sanoma` and every package under
16
+ * `node_modules/@sanoma-ai/` whose real path is outside any `node_modules` (the ones a `pnpm link`
17
+ * points into a checkout), then, when there is one, each core package (`corePackages`) that
18
+ * resolves into the checkout through them, such as `sanoma`'s own dependencies when `sanoma` alone
19
+ * is linked. Nothing when nothing is linked, wherever an installed package's dependencies resolve.
17
20
  */
18
21
  export function linkedPackages(cwd) {
19
22
  const modules = join(cwd, "node_modules");
@@ -30,33 +33,41 @@ export function linkedPackages(cwd) {
30
33
  if (!installed(dir))
31
34
  linked.push({ name, dir });
32
35
  }
36
+ if (!linked.length)
37
+ return linked;
38
+ for (const core of corePackages(cwd)) {
39
+ if (!installed(core.dir) && !linked.some((p) => p.name === core.name))
40
+ linked.push(core);
41
+ }
33
42
  return linked;
34
43
  }
35
44
  /** The packages a `sanoma` process loads besides the connectors. */
36
45
  const CORE = ["sanoma", "@sanoma-ai/workflows", "@sanoma-ai/app", "@sanoma-ai/bridge"];
37
46
  /**
38
- * Of `sanoma`, `@sanoma-ai/workflows`, `@sanoma-ai/app` and `@sanoma-ai/bridge`, those installed (from a
39
- * tarball or a registry) while another of them resolves into a checkout: a partial link, under
40
- * which two copies of a package run in one process. Empty when none is linked, or all are. Each
41
- * is found as Node finds it, from the repo's root, else from where `sanoma` really is (where pnpm
42
- * puts sanoma's own dependencies, `@sanoma-ai/app` among them).
47
+ * Where `sanoma`, `@sanoma-ai/workflows`, `@sanoma-ai/app` and `@sanoma-ai/bridge` really are, those
48
+ * Node finds: each from the repo's root, else from where `sanoma` really is (where pnpm puts
49
+ * sanoma's own dependencies, `@sanoma-ai/app` among them, or the checkout's workspace links).
43
50
  */
44
- export function partialLink(cwd) {
51
+ function corePackages(cwd) {
45
52
  const sanoma = findPackage("sanoma", cwd);
46
- const fromTarballs = [];
47
- let linked = false;
53
+ const found = [];
48
54
  for (const name of CORE) {
49
55
  const dir = name === "sanoma"
50
56
  ? sanoma
51
57
  : (findPackage(name, cwd) ?? (sanoma === undefined ? undefined : findPackage(name, sanoma)));
52
- if (dir === undefined)
53
- continue;
54
- if (installed(dir))
55
- fromTarballs.push(name);
56
- else
57
- linked = true;
58
+ if (dir !== undefined)
59
+ found.push({ name, dir });
58
60
  }
59
- return linked ? fromTarballs : [];
61
+ return found;
62
+ }
63
+ /**
64
+ * Of the core packages (`corePackages`), those installed (from a tarball or a registry) while
65
+ * another of them resolves into a checkout: a partial link, under which two copies of a package
66
+ * run in one process. Empty when none is linked, or all are.
67
+ */
68
+ export function partialLink(cwd) {
69
+ const core = corePackages(cwd);
70
+ return core.some((p) => !installed(p.dir)) ? core.filter((p) => installed(p.dir)).map((p) => p.name) : [];
60
71
  }
61
72
  /** The real directory of package `name` as Node resolves it from the directory `from`, if it does. */
62
73
  function findPackage(name, from) {
@@ -81,6 +92,33 @@ export function devRepo(cwd, linked = linkedPackages(cwd)) {
81
92
  const [first] = linked;
82
93
  return first && dirname(dirname(first.dir));
83
94
  }
95
+ /**
96
+ * Calls `onUnlinked` once, when none of `packages` is linked into the repo in `cwd` any more: its
97
+ * `node_modules/<name>` no longer the package's directory on two looks in a row, `intervalMs`
98
+ * apart, so a link an install swaps for a moment is not taken for an unlink. Nothing when none is
99
+ * linked to begin with (`SANOMA_DEV_REPO`). Returns what stops the looks.
100
+ */
101
+ export function whenUnlinked(cwd, packages, onUnlinked, intervalMs = 1000) {
102
+ const linked = () => packages.some(({ name, dir }) => {
103
+ try {
104
+ return realpathSync(join(cwd, "node_modules", name)) === dir;
105
+ }
106
+ catch {
107
+ return false;
108
+ }
109
+ });
110
+ if (!linked())
111
+ return () => { };
112
+ let misses = 0;
113
+ const timer = setInterval(() => {
114
+ misses = linked() ? 0 : misses + 1;
115
+ if (misses < 2)
116
+ return;
117
+ clearInterval(timer);
118
+ onUnlinked();
119
+ }, intervalMs);
120
+ return () => clearInterval(timer);
121
+ }
84
122
  /**
85
123
  * Runs the child and restarts it when anything under a watched directory changes, after
86
124
  * `debounceMs` of quiet: its group ended (`end`), then `spawn` again. Restarts run one at a time,
package/dist/dev.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"dev.js","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;GAIG;AAEH,8DAA8D;AAC9D,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;AAS7E;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,G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K,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YAClD,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;QACnG,CAAC;QACD,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,sBAAsB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC7E,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3E,CAAC"}
package/dist/init.js CHANGED
@@ -6,7 +6,7 @@ import { fileURLToPath } from "node:url";
6
6
  import { promisify } from "node:util";
7
7
  import { RUNTIME_AGENTS } from "@sanoma-ai/workflows";
8
8
  import { readPeople } from "@sanoma-ai/workflows/describe";
9
- import { groupNamesOf, principalIdsOf } from "@sanoma-ai/workflows/shared";
9
+ import { groupNamesOf, isVisitor, principalIdsOf } from "@sanoma-ai/workflows/shared";
10
10
  import { addToEnv, writeSecretsKey } from "./key.js";
11
11
  const run = promisify(execFile);
12
12
  /** The company template this package ships (`files`): `template/` beside `src/` and `dist/`. */
@@ -49,9 +49,8 @@ export async function startCompany(cwd, { install = installWith, creator = whoIs
49
49
  const name = packageName(basename(cwd));
50
50
  // npm refuses to install a package into one of the same name (`sanoma` in `sanoma/`).
51
51
  pkg.name = name in pkg.dependencies ? `${name}-company` : name;
52
- // The template's packages at this launcher's version: Sanoma releases them together.
53
- for (const dep of Object.keys(pkg.dependencies))
54
- pkg.dependencies[dep] = `^${own.version}`;
52
+ // The template is this launcher's, so `sanoma` at its version; the rest (each versioned on its own) at `latest`.
53
+ pkg.dependencies.sanoma = `^${own.version}`;
55
54
  writeFileSync(manifest, `${JSON.stringify(pkg, null, 2)}\n`);
56
55
  const people = join(cwd, "resources", "people.ts");
57
56
  writeFileSync(people, declareFounder(readFileSync(people, "utf8"), await creator()));
@@ -91,13 +90,13 @@ export function declareFounder(text, creator) {
91
90
  /** What a command prints, trimmed; empty when it fails or is missing. */
92
91
  const output = (cmd, args) => run(cmd, args, { timeout: 10_000 }).then(({ stdout }) => stdout.trim(), () => "");
93
92
  /**
94
- * `id`, unless it is empty or taken, by a person, agent or group the template declares or by one
95
- * of the runtime's own agents: then "founder".
93
+ * `id`, unless it is empty or taken, by a person, agent or group the template declares, by one
94
+ * of the runtime's own agents or by the visitors (`isVisitor`): then "founder".
96
95
  */
97
96
  function free(id) {
98
97
  const { people } = readPeople(fileURLToPath(TEMPLATE));
99
98
  const taken = [...principalIdsOf(people), ...groupNamesOf(people), ...RUNTIME_AGENTS];
100
- return id && !taken.includes(id) ? id : "founder";
99
+ return id && !taken.includes(id) && !isVisitor({ id }) ? id : "founder";
101
100
  }
102
101
  /** This machine's user name as one word; empty when the OS names none. */
103
102
  function machineUser() {
package/dist/init.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,cAAc,EACd,MAAM,EACN,UAAU,EACV,WAAW,EACX,YAAY,EACZ,UAAU,EACV,MAAM,EACN,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,UAA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IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;AAC7E,CAAC;AAED,yHAAyH;AACzH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,EAAE,CACzC,GAAG;KACA,WAAW,EAAE;KACb,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC;KAC9B,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC;AAE9C,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,cAAsB,EAAE,EAAE,CAC1D,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IACpC,MAAM,KAAK,GAAG,KAAK,CAAC,cAAc,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAC5E,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC5B,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAC1B,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,cAAc,8BAA8B,GAAG,eAAe,CAAC,CAAC,CAC9G,CAAC;AACJ,CAAC,CAAC,CAAC"}
package/dist/serve.d.ts CHANGED
@@ -6,6 +6,8 @@ export interface Stoppable {
6
6
  export interface Served extends Stoppable {
7
7
  /** Where the app listens, such as `http://127.0.0.1:3000`. */
8
8
  url: string;
9
+ /** Each public site, by name, at its own host on this machine: `http://www.localhost:3000` (`App.sites`). */
10
+ sites: Record<string, string>;
9
11
  }
10
12
  /** Starts the worker, promoted: a local worker is always the version to take queued runs, even one seen before. */
11
13
  export declare function runWorker(config: SanomaConfig): Promise<Stoppable>;
@@ -24,12 +26,19 @@ export declare function runApp(config: SanomaConfig, options: ServeOptions): Pro
24
26
  /** Reads stored secrets by name (`SanomaClient.secrets`): the values found, the environment's first. */
25
27
  export type ReadSecrets = (names: string[]) => Promise<Map<string, string>>;
26
28
  /**
27
- * The app's host (`SANOMA_APP_HOST`, default 127.0.0.1) and, when the `SANOMA_GITHUB_*` variables
28
- * are set, GitHub sign-in; both or neither, and any host but this machine needs it. An empty
29
- * value is the same as unset. On a host beyond this machine, or with one of them set, one the
30
- * environment leaves unset is read from the stored secrets (`readSecrets`), where creating the
31
- * GitHub App on the app's connect page put them. A mistake in them is a UsageError.
29
+ * `SANOMA_DOMAINS`, a public site's domain by its name: `<site>=<hostname>[,<site>=<hostname>…]`,
30
+ * as a host resource's `domains` sets it (`www=sanoma.example`); unset or empty, none. A
31
+ * malformed one is a UsageError.
32
32
  */
33
- export declare function appOptions(readSecrets?: ReadSecrets): Promise<Pick<AppOptions, "host" | "login">>;
33
+ export declare function parseDomains(value: string | undefined): Record<string, string> | undefined;
34
+ /**
35
+ * The app's host (`SANOMA_APP_HOST`, default 127.0.0.1), the public sites' domains
36
+ * (`SANOMA_DOMAINS`, `parseDomains`) and, when the `SANOMA_GITHUB_*` variables are set, GitHub
37
+ * sign-in; both or neither, and any host but this machine needs it. An empty value is the same
38
+ * as unset. On a host beyond this machine, or with one of them set, one the environment leaves
39
+ * unset is read from the stored secrets (`readSecrets`), where creating the GitHub App on the
40
+ * app's connect page put them. A mistake in them is a UsageError.
41
+ */
42
+ export declare function appOptions(readSecrets?: ReadSecrets): Promise<Pick<AppOptions, "host" | "login" | "domains">>;
34
43
  /** The sites' build, the worker, then the app, in this process; `stop` stops the app, then the worker. */
35
44
  export declare function serve(config: SanomaConfig, serveOptions: ServeOptions): Promise<Served>;
package/dist/serve.js CHANGED
@@ -5,6 +5,7 @@ import { fileURLToPath } from "node:url";
5
5
  import { githubLogin, startApp } from "@sanoma-ai/app";
6
6
  import { errorMessage, isLoopback, resolveConfig, SanomaClient, startWorker, } from "@sanoma-ai/workflows";
7
7
  import { describeConfig, readPeople, schemaOf, writeGenerated } from "@sanoma-ai/workflows/describe";
8
+ import { domainsOf } from "@sanoma-ai/workflows/shared";
8
9
  import { UsageError } from "./config.js";
9
10
  import { runtimeFrom, siteBuild } from "./sites.js";
10
11
  import { localGitSource } from "./source.js";
@@ -35,7 +36,7 @@ async function appStart(config, { port, log, dev = false, resolved = resolveConf
35
36
  }
36
37
  async function served(config, options) {
37
38
  const app = await startApp(config, { ...options, source: sourceOf(config) });
38
- return { url: app.url, stop: () => app.close() };
39
+ return { url: app.url, sites: app.sites, stop: () => app.close() };
39
40
  }
40
41
  /**
41
42
  * What the app serves: with sites, its own build of the app and every site, built into
@@ -123,15 +124,33 @@ const secretsOf = (config) => async (names) => {
123
124
  }
124
125
  };
125
126
  /**
126
- * The app's host (`SANOMA_APP_HOST`, default 127.0.0.1) and, when the `SANOMA_GITHUB_*` variables
127
- * are set, GitHub sign-in; both or neither, and any host but this machine needs it. An empty
128
- * value is the same as unset. On a host beyond this machine, or with one of them set, one the
129
- * environment leaves unset is read from the stored secrets (`readSecrets`), where creating the
130
- * GitHub App on the app's connect page put them. A mistake in them is a UsageError.
127
+ * `SANOMA_DOMAINS`, a public site's domain by its name: `<site>=<hostname>[,<site>=<hostname>…]`,
128
+ * as a host resource's `domains` sets it (`www=sanoma.example`); unset or empty, none. A
129
+ * malformed one is a UsageError.
130
+ */
131
+ export function parseDomains(value) {
132
+ if (!value)
133
+ return undefined;
134
+ try {
135
+ return domainsOf(value);
136
+ }
137
+ catch (err) {
138
+ throw new UsageError(errorMessage(err));
139
+ }
140
+ }
141
+ /**
142
+ * The app's host (`SANOMA_APP_HOST`, default 127.0.0.1), the public sites' domains
143
+ * (`SANOMA_DOMAINS`, `parseDomains`) and, when the `SANOMA_GITHUB_*` variables are set, GitHub
144
+ * sign-in; both or neither, and any host but this machine needs it. An empty value is the same
145
+ * as unset. On a host beyond this machine, or with one of them set, one the environment leaves
146
+ * unset is read from the stored secrets (`readSecrets`), where creating the GitHub App on the
147
+ * app's connect page put them. A mistake in them is a UsageError.
131
148
  */
132
149
  export async function appOptions(readSecrets) {
133
150
  const env = process.env;
151
+ const domains = parseDomains(env.SANOMA_DOMAINS);
134
152
  const host = env.SANOMA_APP_HOST || undefined;
153
+ const options = { host, ...(domains && { domains }) };
135
154
  const beyond = host !== undefined && !isLoopback(host);
136
155
  const found = new Map(GITHUB.flatMap((name) => (env[name] ? [[name, env[name]]] : [])));
137
156
  if ((beyond || found.size) && readSecrets && found.size < GITHUB.length) {
@@ -146,14 +165,14 @@ export async function appOptions(readSecrets) {
146
165
  if (!clientId && !clientSecret) {
147
166
  if (beyond)
148
167
  throw new UsageError(`SANOMA_APP_HOST=${host} needs GitHub sign-in: set ${GITHUB.join(", ")}`);
149
- return { host };
168
+ return options;
150
169
  }
151
170
  if (!clientId || !clientSecret) {
152
171
  const missing = GITHUB.filter((name) => !found.has(name));
153
172
  throw new UsageError(`GitHub sign-in needs ${GITHUB.join(", ")}: ${missing.join(", ")} not set`);
154
173
  }
155
174
  try {
156
- return { host, login: githubLogin({ clientId, clientSecret }) };
175
+ return { ...options, login: githubLogin({ clientId, clientSecret }) };
157
176
  }
158
177
  catch (err) {
159
178
  throw new UsageError(errorMessage(err));
@@ -174,6 +193,7 @@ export async function serve(config, serveOptions) {
174
193
  }
175
194
  return {
176
195
  url: app.url,
196
+ sites: app.sites,
177
197
  async stop() {
178
198
  try {
179
199
  await app.stop();
package/dist/serve.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"serve.js","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAmB,WAAW,EAAE,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AE,GAAG,CAAC,GAAG;QACZ,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,KAAK,CAAC,IAAI;YACR,IAAI,CAAC;gBACH,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YACnB,CAAC;oBAAS,CAAC;gBACT,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YACtB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
package/dist/site-lint.js CHANGED
@@ -32,7 +32,7 @@ export const siteFile = {
32
32
  const imported = (node) => {
33
33
  if (leaves(node)) {
34
34
  context.report({
35
- message: `A site imports only from inside sites/, \`sanoma/site\`, \`@sanoma-ai/app/ui\` and its packages: ${String(node.source.value)} leaves sites/.`,
35
+ message: `A site imports only from inside sites/, \`sanoma/site\`, \`sanoma/ui\` and its packages: ${String(node.source.value)} leaves sites/.`,
36
36
  node: node.source,
37
37
  });
38
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"site-lint.js","sourceRoot":"","sources":["../src/site-lint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAmB5E,8FAA8F;AAC9F,MAAM,CAAC,MAAM,MAAM,GAAG,yEAAyE,CAAC;AAEhG,kFAAkF;AAClF,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,gBAAgB,EAAE,oBAAoB,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAE3F,kGAAkG;AAClG,MAAM,UAAU,GAAG,CAAC,MAAe,EAAsB,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AAErH,4CAA4C;AAC5C,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,IAAY,EAAW,EAAE;IACpD,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG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U,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACrC,IAAI,IAAI,KAAK,SAAS,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;oBACjD,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,oCAAoC,IAAI,KAAK,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;oBACtG,OAAO;gBACT,CAAC;gBACD,qDAAqD;gBACrD,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,gBAAgB,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,iBAAiB;oBAAE,OAAO;gBAC1G,MAAM,MAAM,GAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,UAAoC,EAAE,IAAI,CAC3E,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,QAAQ,CACxF,CAAC;gBACF,IAAI,MAAM,EAAE,CAAC;oBACX,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,8CAA8C,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;gBACpG,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
package/oxlint.json CHANGED
@@ -231,7 +231,7 @@
231
231
  },
232
232
  {
233
233
  "name": "@sanoma-ai/app",
234
- "message": "A site imports the app's components from `@sanoma-ai/app/ui`; the rest of the app is its server.",
234
+ "message": "A site imports how a page looks from `sanoma/ui` and what talks to the app (its route APIs, `api`, `RunForm`, `useActor`) from `sanoma/site`; the rest of the app is its server.",
235
235
  "allowTypeImports": true
236
236
  },
237
237
  {
@@ -245,6 +245,7 @@
245
245
  "group": [
246
246
  "sanoma/**",
247
247
  "!sanoma/site",
248
+ "!sanoma/ui",
248
249
  "@sanoma-ai/workflows/**",
249
250
  "@sanoma-ai/bridge/**",
250
251
  "@dbos-inc/**",
@@ -256,10 +257,9 @@
256
257
  },
257
258
  {
258
259
  "group": [
259
- "@sanoma-ai/app/**",
260
- "!@sanoma-ai/app/ui"
260
+ "@sanoma-ai/app/**"
261
261
  ],
262
- "message": "A site imports the app's components from `@sanoma-ai/app/ui`; the rest of the app is its server.",
262
+ "message": "A site imports how a page looks from `sanoma/ui` and what talks to the app (its route APIs, `api`, `RunForm`, `useActor`) from `sanoma/site`; the rest of the app is its server.",
263
263
  "allowTypeImports": true
264
264
  },
265
265
  {
@@ -284,6 +284,14 @@
284
284
  ],
285
285
  "message": "A site runs in the browser: call an operation or start a workflow through `api` from `sanoma/site`.",
286
286
  "allowTypeImports": true
287
+ },
288
+ {
289
+ "group": [
290
+ "virtual:*",
291
+ "virtual:*/**"
292
+ ],
293
+ "message": "A site reads content through `content` from `sanoma/site`.",
294
+ "allowTypeImports": true
287
295
  }
288
296
  ]
289
297
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanoma",
3
- "version": "0.4.2",
3
+ "version": "0.6.0",
4
4
  "description": "One command over a Sanoma repo: run the worker and the app, check it, write its .env.example, export a run's ledger",
5
5
  "keywords": [
6
6
  "approvals",
@@ -28,7 +28,9 @@
28
28
  "README.md",
29
29
  "LICENSE",
30
30
  "site.js",
31
- "site.d.ts"
31
+ "site.d.ts",
32
+ "ui.js",
33
+ "ui.d.ts"
32
34
  ],
33
35
  "type": "module",
34
36
  "sideEffects": false,
@@ -47,6 +49,10 @@
47
49
  "types": "./site.d.ts",
48
50
  "default": "./site.js"
49
51
  },
52
+ "./ui": {
53
+ "types": "./ui.d.ts",
54
+ "default": "./ui.js"
55
+ },
50
56
  "./data": {
51
57
  "types": "./dist/data.d.ts",
52
58
  "default": "./dist/data.js"
@@ -57,9 +63,9 @@
57
63
  "access": "public"
58
64
  },
59
65
  "dependencies": {
60
- "@sanoma-ai/app": "0.4.2",
61
- "@sanoma-ai/bridge": "0.4.2",
62
- "@sanoma-ai/workflows": "0.4.2",
66
+ "@sanoma-ai/app": "0.6.0",
67
+ "@sanoma-ai/bridge": "0.4.4",
68
+ "@sanoma-ai/workflows": "0.6.0",
63
69
  "@types/node": "^26.6.4",
64
70
  "oxlint": "^1.87.0",
65
71
  "pg": "^8.23.1",
@@ -67,7 +73,7 @@
67
73
  "zod": "^4.6.5"
68
74
  },
69
75
  "devDependencies": {
70
- "@sanoma-ai/connector-ghost": "0.4.2",
76
+ "@sanoma-ai/connector-ghost": "0.4.4",
71
77
  "@sanoma-ai/testing": "0.1.0",
72
78
  "@types/pg": "^8.23.1"
73
79
  },
@@ -35,7 +35,32 @@ npm run env # rewrites .env.example from the connectors' variables
35
35
  - Every operation a workflow calls is listed in its `uses`; add the connector to `sanoma.config.ts` and to `package.json`.
36
36
  - Declare the company's own records as collections in `resources/data.ts`, which imports only `collection` from `sanoma/data` and holds nothing else: the runtime imports it, and so does a workflow that names a collection's operations (`import { outbound } from "../resources/data.ts"`, the one file outside `workflows/` a workflow may import). Every other data file is read, never run.
37
37
  - Only a person declared with `sanoma.person` (in `resources/people.ts` by convention, a data file like any other) signs in to the app (by `id` on this machine; with GitHub sign-in by email, then `github` login), starts a run, calls an operation or decides an approval, in the groups that list them (`sanoma.group({ name, members: [ada, refundBot] })`, the one place a membership is written). An agent (`sanoma.agent({ id, onBehalfOf: bo })`) is in the group `agents` besides; it never signs in. A new colleague is an edit to that file before their first sign-in. Nobody decides an approval on a run they started while someone else in the group could; alone in it, they decide, and the ledger says so.
38
- - The policies are `policies/*.cedar`, written in [Cedar](https://docs.cedarpolicy.com) against `.sanoma/schema.cedarschema`. Everything is allowed unless a `forbid` refuses it; the runtime writes the one `permit`, so a `permit` here is a problem. A `forbid` with `@hold("<group>")` (or a person's id, or `"on-behalf-of"` for whom an agent acts) waits for that approver, with `@title` as its title in the Inbox, and the run goes on once they approve; one without `@hold` is denied, with `@reason` as the message. Actions are each operation's id (`Sanoma::Action::"ghost.post.publish"`), in its effect's group (`Sanoma::Action::"effect:publish"`), and `Sanoma::Action::"workflow:<name>"` for starting a run; `principal in Sanoma::Group::"editor"` is membership; `context.input` is the call's input. The app's Permissions page shows what they answer for each group. The `check` script reports a policy problem (a field, action or group the schema lacks, a `@hold` naming no one declared) at its `file:line:col`, and runs no scenario until there are none; `npm run dev` refuses to start on them.
38
+ - The policies are `policies/*.cedar`, written in [Cedar](https://docs.cedarpolicy.com) against `.sanoma/schema.cedarschema`. Everything is allowed unless a `forbid` refuses it; the runtime writes the `permit` for people and agents, so a `permit` here is a problem unless it is for a public site's visitors (its principal `in Sanoma::Group::"visitors"` or `== Sanoma::Principal::"anonymous"`), who may do nothing else. A `forbid` with `@hold("<group>")` (or a person's id, or `"on-behalf-of"` for whom an agent acts) waits for that approver, with `@title` as its title in the Inbox, and the run goes on once they approve; one without `@hold` is denied, with `@reason` as the message. Actions are each operation's id (`Sanoma::Action::"ghost.post.publish"`), in its effect's group (`Sanoma::Action::"effect:publish"`), and `Sanoma::Action::"workflow:<name>"` for starting a run; `principal in Sanoma::Group::"editor"` is membership; `context.input` is the call's input. The app's Permissions page shows what they answer for each group. The `check` script reports a policy problem (a field, action or group the schema lacks, a `@hold` naming no one declared) at its `file:line:col`, and runs no scenario until there are none; `npm run dev` refuses to start on them.
39
39
  - Describe each workflow's expected runs in `scenarios/<workflow>/<name>.feature`, and run the `check` script after every change. A scenario runs as the runtime's own agent `scenarios` unless it says who is acting (`Given reviewer is acting`), and checks the policy with `Then <op> was held for group "<group>"` and `Then <op> was denied with "<reason>"`; a scenario's approver (`is approved by reviewer`) must be declared. `reviewer` in `resources/people.ts` is a stand-in who can sign in and approve: replace them with a real colleague, in the scenarios too.
40
- - A site, `sites/<name>/routes/` (pages the app serves under `/sites/<name>/`, with an optional `sites/<name>/site.ts` naming it with `defineSite`), is browser code: no server code, credential or `process.env` under `sites/`, which the `check` script holds it to, and the folder's name is its URL segment (lowercase letters, digits and dashes). Its route files import `createFileRoute` from `@tanstack/react-router`, routing (`Link`, `Outlet`, `useNavigate`, `defineSite`, …) from `sanoma/site`, and UI from `@sanoma-ai/app/ui`: the app's own components (`Button`, `Card`, `Table`, `Region`, `Facts`, …) and `<RunForm workflow="<name>" />`, the app's start form for a workflow. A page reaches data and workflows only through `api` from `sanoma/site`, as the person on the page: `api.data.<collection>.list()`, a vendor's read such as `api.<vendor>.<resource>.get(…)`, `await api.<workflow>(input)` or `api.<workflow>.start(input)` (the workflow's name in camelCase); see the app package's README (Sites). Name what a page calls with literals (`workflow="announce"`, `api.announce.start(…)`, not a variable): the app reads a site's calls from its code to list them under each workflow's Used by, and the `check` script fails on a call to a workflow, collection or operation that does not exist. While the `dev` script runs, an edit to a site shows in the open page as it is saved, and a new site folder is live without a restart.
40
+ - A site, `sites/<name>/routes/` (pages the app serves under `/sites/<name>/`, with an optional `sites/<name>/site.ts` naming it with `defineSite`), is browser code: no server code, credential or `process.env` under `sites/`, which the `check` script holds it to, and the folder's name is its URL segment (lowercase letters, digits and dashes). Its route files import `createFileRoute` from `@tanstack/react-router`; what talks to the app from `sanoma/site`: routing (`Link`, `Outlet`, `useNavigate`, `defineSite`, …), `api`, `<RunForm workflow="<name>" />` (the app's start form for a workflow) and `useActor()` (who is signed in); and how a page looks from `sanoma/ui`, the app's own components, presentational only (`Button`, `Card`, `Table`, `PageHeader`, `Region`, `Facts`, `FloatingCard`, …): `import { RunForm } from "sanoma/site";` beside `import { Region } from "sanoma/ui";`. Colour a page with the theme's utilities (`bg-card`, `text-muted-foreground`, `border-border`, `bg-primary/10` for a tint), never raw colours: the app's theme has no `bg-white` or `text-red-500` (a public site with a look of its own brings its own stylesheet, as the app package's README shows). A page reaches data and workflows only through `api` from `sanoma/site`, as the person on the page: `api.data.<collection>.list()`, a vendor's read such as `api.<vendor>.<resource>.get(…)`, `await api.<workflow>(input)` or `api.<workflow>.start(input)` (the workflow's name in camelCase); see the app package's README (Sites). Name what a page calls with literals (`workflow="announce"`, `api.announce.start(…)`, not a variable): the app reads a site's calls from its code to list them under each workflow's Used by, and the `check` script fails on a call to a workflow, collection or operation that does not exist. While the `dev` script runs, an edit to a site shows in the open page as it is saved, and a new site folder is live without a restart.
41
41
  - Never put credentials in a file here. They live in `.env` or on the app's connector pages, which store them encrypted in the database.
42
+
43
+ ## Example: a public site with a visitor login
44
+
45
+ A public site is served to visitors rather than to the people in `resources/people.ts`, and a login connector signs them in. With Better Auth (`@sanoma-ai/connector-better-auth`, added to `package.json`), whose visitors' accounts live in the company's own database:
46
+
47
+ ```ts
48
+ // sites/account/site.ts
49
+ import { defineSite } from "sanoma/site";
50
+
51
+ export default defineSite({ title: "Account", public: true, login: "better-auth" });
52
+ ```
53
+
54
+ ```ts
55
+ // sanoma.config.ts
56
+ import { betterAuth } from "@sanoma-ai/connector-better-auth";
57
+
58
+ export default defineConfig({ workflows, connectors: [betterAuth] });
59
+ ```
60
+
61
+ ```cedar
62
+ // policies/visitors.cedar: a visitor may do nothing a permit does not name
63
+ permit (principal in Sanoma::Group::"visitors", action == Sanoma::Action::"workflow:hello", resource);
64
+ ```
65
+
66
+ There is no secret to set: the login signs its cookies with a key derived from `SANOMA_SECRETS_KEY`. The site's sign-in and sign-up pages are forms from `sanoma/ui` that `fetch` POST JSON to `/auth/better-auth/sign-in/email` and `/auth/better-auth/sign-up/email`; `useActor()`, from `sanoma/site`, says who signed in (`visitor:better-auth:<id>`, in `visitors`). The connector's README has the routes.
@@ -8,8 +8,8 @@
8
8
  "env": "sanoma env"
9
9
  },
10
10
  "dependencies": {
11
- "@sanoma-ai/connector-ghost": "^0.4.2",
12
- "sanoma": "^0.4.2"
11
+ "@sanoma-ai/connector-ghost": "latest",
12
+ "sanoma": "latest"
13
13
  },
14
14
  "engines": {
15
15
  "node": "^24.2 || >=26"
@@ -4,6 +4,7 @@
4
4
  // decided here. Write against .sanoma/schema.cedarschema, which `sanoma check` writes: the
5
5
  // actions (each operation's id, in its effect's group, and `workflow:<name>`), the groups
6
6
  // resources/people.ts declares, and each operation's input as `context.input`.
7
+ // A `permit` is only for a public site's visitors: its principal `in Sanoma::Group::"visitors"` or `== Sanoma::Principal::"anonymous"`.
7
8
 
8
9
  // Publishing or sending waits for someone in editor, unless someone in editor asked for it.
9
10
  @id("editor-reviews")
package/ui.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ // `sanoma/ui`, how a site's page looks: the app's kit (`@sanoma-ai/app/ui`), which ships as
2
+ // source for the company's Vite build. Outside src/, so this package's own tsc never follows it.
3
+ export * from "@sanoma-ai/app/ui";
package/ui.js ADDED
@@ -0,0 +1,3 @@
1
+ // `sanoma/ui`, how a site's page looks: the app's kit (`@sanoma-ai/app/ui`), which ships as
2
+ // source for the company's Vite build. Outside src/, so this package's own tsc never follows it.
3
+ export * from "@sanoma-ai/app/ui";