@pexis/core 0.0.0-stage → 0.1.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/API.md +130 -0
- package/LICENSE +23 -0
- package/README.md +39 -2
- package/dist/app.d.ts +74 -0
- package/dist/app.js +1008 -0
- package/dist/app.js.map +1 -0
- package/dist/components.d.ts +53 -0
- package/dist/components.js +62 -0
- package/dist/components.js.map +1 -0
- package/dist/context.d.ts +17 -0
- package/dist/context.js +57 -0
- package/dist/context.js.map +1 -0
- package/dist/cors.d.ts +19 -0
- package/dist/cors.js +85 -0
- package/dist/cors.js.map +1 -0
- package/dist/csrf.d.ts +2 -0
- package/dist/csrf.js +42 -0
- package/dist/csrf.js.map +1 -0
- package/dist/form.d.ts +30 -0
- package/dist/form.js +101 -0
- package/dist/form.js.map +1 -0
- package/dist/host.d.ts +2 -0
- package/dist/host.js +16 -0
- package/dist/host.js.map +1 -0
- package/dist/html.d.ts +26 -0
- package/dist/html.js +114 -0
- package/dist/html.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx-runtime.d.ts +464 -0
- package/dist/jsx-runtime.js +166 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/page.d.ts +33 -0
- package/dist/page.js +143 -0
- package/dist/page.js.map +1 -0
- package/dist/rate-limit.d.ts +54 -0
- package/dist/rate-limit.js +117 -0
- package/dist/rate-limit.js.map +1 -0
- package/dist/registry.d.ts +99 -0
- package/dist/registry.js +144 -0
- package/dist/registry.js.map +1 -0
- package/dist/schema.d.ts +154 -0
- package/dist/schema.js +192 -0
- package/dist/schema.js.map +1 -0
- package/dist/security.d.ts +53 -0
- package/dist/security.js +129 -0
- package/dist/security.js.map +1 -0
- package/dist/styles.d.ts +31 -0
- package/dist/styles.js +127 -0
- package/dist/styles.js.map +1 -0
- package/dist/types.d.ts +398 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/urls.d.ts +10 -0
- package/dist/urls.js +16 -0
- package/dist/urls.js.map +1 -0
- package/package.json +39 -4
package/API.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# @pexis/core API reference
|
|
2
|
+
|
|
3
|
+
Every export of `@pexis/core`, which `@pexis/kit` re-exports. For how to use them together, read the guide, `packages/pexis/AGENTS.md`. A test checks that this file names every export, so it cannot fall behind the code.
|
|
4
|
+
|
|
5
|
+
**Stability.** Pexis is before 1.0, so any API may still change in a minor version, with a migration note. Within that:
|
|
6
|
+
|
|
7
|
+
- **Stable**: the API apps are built on. Changes are rare and always noted.
|
|
8
|
+
- **For plugins and adapters**: exported so plugins, adapters and tests can build on the same pieces. Apps rarely need them.
|
|
9
|
+
- **Experimental**: still being designed; may change or go without a deprecation period. Listed at the end.
|
|
10
|
+
|
|
11
|
+
## App
|
|
12
|
+
|
|
13
|
+
| Export | What it is |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `createApp(options)` | Builds the app: pages, actions, layout, plugins, security and navigation options, error pages. Returns an `App` with `fetch(request, connection?)`. |
|
|
16
|
+
| `App` | The app: `fetch`, `config`, `pages`, `actions`, `entries()`, `checkRules`. |
|
|
17
|
+
| `AppOptions` | The options `createApp` takes. |
|
|
18
|
+
| `AppConfig` | The settings plugins and checks read: `origin`, `lang`, `checks`. |
|
|
19
|
+
| `NavigationOptions` | View Transitions and Speculation Rules (`prefetch`), both off by default. |
|
|
20
|
+
| `SecurityOptions` | The Content Security Policy, body limit, CORS, rate limits and time limit. |
|
|
21
|
+
| `ErrorPage` | Your own 404 or 500 page: `{ head, render }`, for `createApp({ errorPages })`. |
|
|
22
|
+
| `Connection` | What an adapter knows about the connection: `clientAddress`. |
|
|
23
|
+
|
|
24
|
+
## Pages and layouts
|
|
25
|
+
|
|
26
|
+
| Export | What it is |
|
|
27
|
+
|---|---|
|
|
28
|
+
| `definePage(definition)` | A page: `path` (or a file in `pages/`), `load`, `head`, `render`, `entries`, `index`, `lang`, `layout`, `stream` (experimental). |
|
|
29
|
+
| `defineLayout(render)` | A layout that wraps page bodies; it must include `<main>`. |
|
|
30
|
+
| `notFound()` | From `load`: answer 404 with the not-found page. |
|
|
31
|
+
| `redirect(location, status?, { external? })` | From `load`: redirect, to this site only unless `external`. |
|
|
32
|
+
| `Page`, `PageDefinition`, `PageContext`, `PathParams` | The types of a page and its definition, context and route parameters. |
|
|
33
|
+
| `UnroutedPage` | A page from a file in `pages/`, before the CLI gives it its path. |
|
|
34
|
+
| `Layout` | The type of a layout. |
|
|
35
|
+
| `HeadData` | A page's head: `title`, `description`, `canonical`, `structuredData`, `extra`. |
|
|
36
|
+
| `Signal`, `NotFound`, `Redirect` | What `notFound()` and `redirect()` return. |
|
|
37
|
+
| `isSignal(value)` | Whether a value is one of those. For plugins and adapters. |
|
|
38
|
+
| `atPath(path, page)` | Gives a page from a file its path; used by the generated `pexis.gen.ts`. For plugins and adapters. |
|
|
39
|
+
|
|
40
|
+
## Actions and fields
|
|
41
|
+
|
|
42
|
+
| Export | What it is |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `defineAction(definition)` | An action: `name`, `title`, `description`, `input`, `risk`, `confirm`, `public` or `permission`, `agents`, `run`, and `undo` (experimental: how a person reverses this write when an agent made it). |
|
|
45
|
+
| `invalid(errors)` | From `run`: refuse values with a message per field (422, and the form shown again). |
|
|
46
|
+
| `field` | Field kinds: `field.text`, `integer`, `number`, `date`, `choice`, `boolean`. |
|
|
47
|
+
| `defineFieldKind(kind)` | A new kind of field that renders a standard control and parses its value. |
|
|
48
|
+
| `Action`, `ActionDefinition`, `ActionContext`, `ActionResult`, `Invalid`, `Risk` | The types of an action, what it receives and what `run` returns. |
|
|
49
|
+
| `Field`, `Fields`, `FieldBase`, `TextField`, `IntegerField`, `NumberField`, `DateField`, `ChoiceField`, `ChoiceOption`, `BooleanField`, `CustomField`, `FieldKind`, `ControlProps` | The types of fields and field kinds. |
|
|
50
|
+
| `Infer` | The typed input an action's `run` receives, from its fields. |
|
|
51
|
+
| `validate(fields, input)` | Checks input against fields, as the server does on every call. |
|
|
52
|
+
| `ValidationResult` | What `validate` returns. |
|
|
53
|
+
| `ActionForm` | The action as an accessible form people fill in and agents read. |
|
|
54
|
+
| `ActionFormProps` | Its props: `action`, `values`, `errors`, `url`, `idPrefix`, and `target` (experimental: the id of a region rendered around the form, which its result replaces in place with JavaScript on and `inPlace()` from `@pexis/client/plugin`). |
|
|
55
|
+
| `hasInPlaceForms(ctx)` | Whether this request rendered an `<ActionForm target>`, so a plugin adds the in-place script only to pages that need it. For plugins. Experimental. |
|
|
56
|
+
| `actionFile(file, name, value)` | Checks an action file found in `actions/`; used by the generated `pexis.gen.ts`. For plugins and adapters. |
|
|
57
|
+
| `describeAction(action)`, `ToolDescriptor` | An action as the tool description agents read. For plugins and adapters. |
|
|
58
|
+
| `createRegistry(actions)`, `Registry` | The registry of actions behind `createApp`. For plugins and adapters. |
|
|
59
|
+
| `toJsonSchema(fields)`, `fieldSchema(field)`, `ObjectSchema` | Fields as JSON Schema, as agents and OpenAPI see them. For plugins and adapters. |
|
|
60
|
+
| `renderForm(action, state?, options?)`, `FormState`, `FormOptions` | The form as markup without JSX, for the `html` template path; `FormOptions.target` (experimental) adds `px-target`. For plugins and adapters. |
|
|
61
|
+
| `TOOLS_PATH` | `/pexis/actions.json`, where agents read the tools. |
|
|
62
|
+
|
|
63
|
+
## Markup and styles
|
|
64
|
+
|
|
65
|
+
| Export | What it is |
|
|
66
|
+
|---|---|
|
|
67
|
+
| `html` | Tagged template for HTML without JSX; every value is escaped, and `javascript:` URLs are blocked. |
|
|
68
|
+
| `raw(html)` | Marks markup you wrote yourself as trusted. Never for user or model content. |
|
|
69
|
+
| `escapeHtml(text)` | Escapes text for HTML. |
|
|
70
|
+
| `SafeHtml`, `Markup`, `Child` | Trusted markup, what components return, and what JSX children can be. |
|
|
71
|
+
| `isSafeHtml(value)` | Whether a value is trusted markup. For plugins and adapters. |
|
|
72
|
+
| `renderToString(markup)` | Waits for async components and returns the HTML. |
|
|
73
|
+
| `htmlResponse(body, init?)` | A `Response` from markup. For plugins and adapters. |
|
|
74
|
+
| `Untrusted` | Wraps content written by users or third parties: agents treat it as data, never instructions. |
|
|
75
|
+
| `UntrustedProps` | Its props: `as`, `class`, `id`, ARIA labels. |
|
|
76
|
+
| `HumanOnly` | Content for people only, left out of Markdown copies and tool lists. Not a security control. |
|
|
77
|
+
| `css` | Scoped component styles; only pages that use them receive them. |
|
|
78
|
+
| `globalCss` | Site-wide styles, for `createApp({ styles })`. |
|
|
79
|
+
| `StyleSheet`, `GlobalStyle` | What `css` and `globalCss` return. |
|
|
80
|
+
| `isStyleSheet(value)`, `minifyCss(text)` | For plugins and adapters. |
|
|
81
|
+
| `jsonLd(data)` | Structured data as a safe `<script type="application/ld+json">` body. For plugins and adapters. |
|
|
82
|
+
| `speculationRules(eagerness, exclude)` | The Speculation Rules JSON behind `navigation.prefetch`. For plugins and adapters. |
|
|
83
|
+
|
|
84
|
+
## Request context
|
|
85
|
+
|
|
86
|
+
| Export | What it is |
|
|
87
|
+
|---|---|
|
|
88
|
+
| `Context` | What pages, actions, middleware and plugins receive: `request`, `url`, `params`, `route`, `app`, `nonce`, `lang`, `clientAddress`, `response`, `signal`, `call`, `agent` and `bearer` (experimental), and fields plugins add (`db`, `user`, `session`, `ai`). |
|
|
89
|
+
| `AgentIdentity` | An agent acting for a person with a token: `user`, `clientId`, `scopes`, `grantId`. Set as `Connection.agent` by plugin code through `api.fetch`, never by an adapter, and seen as `ctx.agent`. Experimental. |
|
|
90
|
+
| `BearerCheck` | `ctx.bearer`: the result of checking an `Authorization: Bearer` token, `{ ok: true, agent }` or `{ ok: false, error: 'invalid_token' }`, set by an authorization plugin only on the routes it protects. Experimental. |
|
|
91
|
+
| `agentRefusal(agent, action)` | Why an agent may not run an action (needs approval, people only, or outside its scopes), or null. The core applies it to every agent request; for plugins that list or stage actions. Experimental. |
|
|
92
|
+
| `UndoDefinition` | An action's `undo`: the registered `action` that reverses it, an `input(input, result)` function returning its input (or null when nothing changed), and `hours` (default 24, at most 168). Experimental. |
|
|
93
|
+
| `AgentWrite`, `AgentWriteRecorder` | An agent's undoable write, and the one recorder an app installs with `api.recordAgentWrites()` (`@pexis/approvals` does). Experimental. |
|
|
94
|
+
| `CallResult` | What `ctx.call(action, input)` returns: `{ ok: true, message, data }`, or `{ ok: false, outcome, message }` with `errors` when the outcome is `invalid`. Experimental. |
|
|
95
|
+
| `peekContext()` | The current request's context, or undefined outside a request; never throws. For plugins such as telemetry that run code which may or may not be in a request. |
|
|
96
|
+
| `getContext()` | The current request's context, from anywhere in the request. |
|
|
97
|
+
| `RouteMatch` | What `ctx.route` holds: the page, action or route matched. |
|
|
98
|
+
| `setContextStorage(storage)`, `runWithContext(ctx, fn)`, `ContextStorage` | How adapters provide request context. For plugins and adapters. |
|
|
99
|
+
|
|
100
|
+
## Plugins
|
|
101
|
+
|
|
102
|
+
| Export | What it is |
|
|
103
|
+
|---|---|
|
|
104
|
+
| `definePlugin(plugin)` | A plugin: a `name`, optional `requires`, and `setup(api)`. |
|
|
105
|
+
| `Plugin`, `PluginApi` | The types of a plugin and the API its `setup` receives: routes, pages, actions, middleware, head and body contributions, rules, admin panels, `fetch`, `maxBodyBytes`, `noPrefetch`. |
|
|
106
|
+
| `Middleware`, `RouteHandler`, `HeadContribution`, `Rewrite` | The functions a plugin registers. |
|
|
107
|
+
| `ActionEvent` | What `api.onAction` listeners receive: field names, never values. |
|
|
108
|
+
| `AdminPanel` | A page a plugin adds to the admin. |
|
|
109
|
+
| `CheckRuleLike` | The shape of a build check rule; see `@pexis/checks`. |
|
|
110
|
+
|
|
111
|
+
## Security and limits
|
|
112
|
+
|
|
113
|
+
| Export | What it is |
|
|
114
|
+
|---|---|
|
|
115
|
+
| `DEFAULT_MAX_BODY_BYTES`, `DEFAULT_ACTION_RATE_LIMIT` | The default body limit and action rate limit. |
|
|
116
|
+
| `readBodyText(request, max)`, `BodyError` | Reads a request body within a byte limit. For plugins and adapters. |
|
|
117
|
+
| `crossSiteRefusal(request, url, trusted)` | The CSRF check: a 403 response for a cross-site write, or null. For plugins and adapters. |
|
|
118
|
+
| `contentSecurityPolicy(nonce, extra?)`, `CspDirective` | The Content Security Policy header. For plugins and adapters. |
|
|
119
|
+
| `createCors(options)`, `CorsOptions` | CORS for the API surface, off by default. For plugins and adapters. |
|
|
120
|
+
| `hostFromHeader(host)` | The host name from a Host header. For plugins and adapters. |
|
|
121
|
+
| `rateLimiter(rule, store?)`, `memoryRateStore(options?)` | Rate limiting by client address. For plugins and adapters. |
|
|
122
|
+
| `RateLimiter`, `RateLimitRule`, `RateLimitStore`, `RateLimitDecision` | Their types; a `RateLimitStore` shares counts across servers. |
|
|
123
|
+
| `clientKey(address)`, `forwardedClient(socket, forwardedFor, trustedProxies)` | How a client address is counted (IPv6 by /64) and read behind proxies. For plugins and adapters. |
|
|
124
|
+
|
|
125
|
+
## Experimental
|
|
126
|
+
|
|
127
|
+
These may change or go without a deprecation period while they are designed:
|
|
128
|
+
|
|
129
|
+
- In other packages: `@pexis/models` (`ctx.ai.answer`), `@pexis/approvals`, `@pexis/mcp`, `@pexis/decorators`, `pexis.config.ts` sources (`@pexis/cli/config`), the WebMCP registration in `@pexis/client`, whose browser API is itself a draft, and `inPlace()` in `@pexis/client/plugin`.
|
|
130
|
+
- In core: in-place updates, `ActionForm`'s `target` with `FormOptions.target` and `hasInPlaceForms(ctx)`, and the fragment the action endpoint sends for a `Px-Target` request.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Intelligant AI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
The spec text in packages/spec/actions.md is licensed under CC BY 4.0.
|
package/README.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @pexis/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Pexis core: app, pages, layouts, routing, actions, fields, context, the JSX runtime, and the security defaults.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @pexis/core
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Most apps install `@pexis/kit`, which re-exports this. Use `@pexis/core` directly in plugins and libraries.
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { ActionForm, createApp, defineAction, definePage, field } from '@pexis/core';
|
|
13
|
+
|
|
14
|
+
const subscribe = defineAction({
|
|
15
|
+
name: 'subscribe',
|
|
16
|
+
title: 'Subscribe',
|
|
17
|
+
description: 'Adds an email address to the newsletter.',
|
|
18
|
+
risk: 'write',
|
|
19
|
+
public: true,
|
|
20
|
+
input: { email: field.text({ label: 'Email', format: 'email' }) },
|
|
21
|
+
run: (input) => ({ message: `Subscribed ${input.email}.` }),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const home = definePage({
|
|
25
|
+
path: '/',
|
|
26
|
+
head: { title: 'News', description: 'Our newsletter.' },
|
|
27
|
+
render: () => <ActionForm action={subscribe} />,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export default createApp({ origin: 'https://example.com', pages: [home], actions: [subscribe] });
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Uses only web-standard APIs (`Request`, `Response`, `fetch`, streams), so it runs on Node, Bun and Cloudflare Workers. On by default: escaping, a nonce-based Content Security Policy, CSRF protection with Fetch Metadata, body limits, rate limits on actions, request time limits, and blocked `javascript:` URLs.
|
|
34
|
+
|
|
35
|
+
## More
|
|
36
|
+
|
|
37
|
+
- The guide for building with Pexis: [`AGENTS.md` in the `@pexis/kit` package](https://github.com/pexis-dev/pexis/blob/main/packages/pexis/AGENTS.md)
|
|
38
|
+
- Source, issues and the other packages: https://github.com/pexis-dev/pexis
|
|
39
|
+
|
|
40
|
+
MIT licensed. Part of [Pexis](https://github.com/pexis-dev/pexis/blob/main/README.md), by Intelligant AI. Not published to npm yet.
|
package/dist/app.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type Action } from './registry.js';
|
|
2
|
+
import { type SecurityOptions } from './security.js';
|
|
3
|
+
import { type GlobalStyle } from './styles.js';
|
|
4
|
+
import type { AgentIdentity, CheckRuleLike, AppConfig, Connection, Layout, Middleware, Page, Plugin, ErrorPage } from './types.js';
|
|
5
|
+
/** The one warning about state kept in memory, or null when there is nothing to say. */
|
|
6
|
+
export declare function memoryStateWarning(items: readonly string[], env: {
|
|
7
|
+
production: boolean;
|
|
8
|
+
singleInstance: boolean;
|
|
9
|
+
}): string | null;
|
|
10
|
+
export interface AppOptions {
|
|
11
|
+
/** Public origin, for example https://example.com. */
|
|
12
|
+
origin: string;
|
|
13
|
+
/** Default <html lang>. Default "en". */
|
|
14
|
+
lang?: string;
|
|
15
|
+
/** Wraps every page body. Default: the body inside <main>. null for no wrapper. */
|
|
16
|
+
layout?: Layout | null;
|
|
17
|
+
pages?: Page[];
|
|
18
|
+
actions?: Action[];
|
|
19
|
+
plugins?: Plugin[];
|
|
20
|
+
/** App middleware, run after plugin middleware. */
|
|
21
|
+
middleware?: Middleware[];
|
|
22
|
+
/** Severity overrides for the build checks. */
|
|
23
|
+
checks?: AppConfig['checks'];
|
|
24
|
+
/** Other origins allowed to submit forms to this app, for example a separate front end. */
|
|
25
|
+
trustedOrigins?: string[];
|
|
26
|
+
/** Site-wide styles from globalCss``, included on every page before component styles. */
|
|
27
|
+
styles?: GlobalStyle[];
|
|
28
|
+
/** Content Security Policy and request limits. Secure by default. */
|
|
29
|
+
security?: SecurityOptions;
|
|
30
|
+
/** Faster, smoother navigation from the platform itself, with no JavaScript. Off by default. */
|
|
31
|
+
navigation?: NavigationOptions;
|
|
32
|
+
/** Your own pages for "not found" (404) and "something went wrong" (500), in the site's layout. */
|
|
33
|
+
errorPages?: {
|
|
34
|
+
notFound?: ErrorPage;
|
|
35
|
+
serverError?: ErrorPage;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export interface NavigationOptions {
|
|
39
|
+
/**
|
|
40
|
+
* Cross-document View Transitions: browsers animate between pages of this
|
|
41
|
+
* site. Turned off for people who prefer reduced motion. Browsers without
|
|
42
|
+
* support navigate as usual.
|
|
43
|
+
*/
|
|
44
|
+
viewTransitions?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Speculation Rules: the browser fetches a same-site page before the visit
|
|
47
|
+
* when a visitor shows intent. "conservative" waits for a press, "moderate"
|
|
48
|
+
* for a hover, "eager" starts sooner. Prefetch only: no page script runs
|
|
49
|
+
* early. Never used for actions, sign-in or /pexis/ addresses.
|
|
50
|
+
*/
|
|
51
|
+
prefetch?: false | 'conservative' | 'moderate' | 'eager';
|
|
52
|
+
}
|
|
53
|
+
export declare function speculationRules(eagerness: 'conservative' | 'moderate' | 'eager', exclude: readonly string[]): string;
|
|
54
|
+
export interface App {
|
|
55
|
+
/**
|
|
56
|
+
* The whole site, as one web-standard request handler. Adapters pass what
|
|
57
|
+
* they know about the connection, such as the client's address.
|
|
58
|
+
*/
|
|
59
|
+
fetch(request: Request, connection?: Connection): Promise<Response>;
|
|
60
|
+
readonly config: AppConfig;
|
|
61
|
+
readonly pages: readonly Page[];
|
|
62
|
+
readonly actions: readonly Action[];
|
|
63
|
+
/** Every public page path, with route parameters filled in. */
|
|
64
|
+
entries(): Promise<string[]>;
|
|
65
|
+
/** Check rules from plugins and the app, for @pexis/checks. */
|
|
66
|
+
readonly checkRules: readonly CheckRuleLike[];
|
|
67
|
+
}
|
|
68
|
+
export declare const TOOLS_PATH = "/pexis/actions.json";
|
|
69
|
+
/** Why an agent with a token may not run this action, or null if it may. */
|
|
70
|
+
export declare function agentRefusal(agent: AgentIdentity, action: Action): string | null;
|
|
71
|
+
/** Serializes JSON-LD for a script block, adding the schema.org context. */
|
|
72
|
+
export declare function jsonLd(data: Record<string, unknown>): string;
|
|
73
|
+
export declare function createApp(options: AppOptions): App;
|
|
74
|
+
export declare function definePlugin(plugin: Plugin): Plugin;
|