@pollis-inc/app 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.
@@ -0,0 +1,18 @@
1
+ /// <reference path="./interfaces/pollis-app-host.d.ts" />
2
+ /// <reference path="./interfaces/pollis-app-types.d.ts" />
3
+ declare module 'pollis:app/app@0.1.0' {
4
+ export type Message = import('pollis:app/types@0.1.0').Message;
5
+ export type Command = import('pollis:app/types@0.1.0').Command;
6
+ export type Schedule = import('pollis:app/types@0.1.0').Schedule;
7
+ export type Request = import('pollis:app/types@0.1.0').Request;
8
+ export type Webhook = import('pollis:app/types@0.1.0').Webhook;
9
+ export type * as PollisAppHost010 from 'pollis:app/host@0.1.0'; // import pollis:app/host@0.1.0
10
+ export type * as PollisAppTypes010 from 'pollis:app/types@0.1.0'; // import pollis:app/types@0.1.0
11
+ export function onMessage(message: Message): void;
12
+ export function onMention(message: Message): void;
13
+ export function onCommand(command: Command): void;
14
+ export function onSchedule(schedule: Schedule): void;
15
+ export function onRequest(request: Request): void;
16
+ export function onWebhook(webhook: Webhook): void;
17
+ export type Result<T, E> = { tag: 'ok', val: T } | { tag: 'err', val: E };
18
+ }
@@ -0,0 +1,59 @@
1
+ /// <reference path="./pollis-app-types.d.ts" />
2
+ declare module 'pollis:app/host@0.1.0' {
3
+ /**
4
+ * Queue a new message in a granted channel. Applied only if the handler
5
+ * returns ok.
6
+ */
7
+ export function post(channel: ChannelId, text: string): void;
8
+ /**
9
+ * Queue a reply to a message in a granted channel.
10
+ */
11
+ export function reply(message: MessageId, text: string): void;
12
+ /**
13
+ * Queue a reaction on a message in a granted channel.
14
+ */
15
+ export function react(message: MessageId, emoji: string): void;
16
+ /**
17
+ * Queue an edit of a message this bot sent.
18
+ */
19
+ export function editOwn(message: MessageId, text: string): void;
20
+ /**
21
+ * Queue deletion of a message this bot sent.
22
+ */
23
+ export function deleteOwn(message: MessageId): void;
24
+ /**
25
+ * Messages from granted channels inside the granted history window.
26
+ */
27
+ export function queryMessages(filter: MessageFilter): Array<Message>;
28
+ /**
29
+ * Sealed per-installation key-value state, within the manifest's quota.
30
+ * Writes become durable only if the handler returns ok.
31
+ */
32
+ export function kvGet(key: string): Uint8Array | undefined;
33
+ export function kvSet(key: string, value: Uint8Array): void;
34
+ export function kvDelete(key: string): void;
35
+ /**
36
+ * One HTTPS request to a host in the granted egress list. Redirects are
37
+ * followed only within the same host.
38
+ */
39
+ export function httpFetch(request: HttpRequest): HttpResponse;
40
+ /**
41
+ * Write to the runtime's log. Never reaches the group.
42
+ */
43
+ export function log(level: LogLevel, text: string): void;
44
+ /**
45
+ * Unix milliseconds.
46
+ */
47
+ export function now(): bigint;
48
+ /**
49
+ * A cryptographically random value.
50
+ */
51
+ export function random(): bigint;
52
+ export type MessageId = import('pollis:app/types@0.1.0').MessageId;
53
+ export type ChannelId = import('pollis:app/types@0.1.0').ChannelId;
54
+ export type Message = import('pollis:app/types@0.1.0').Message;
55
+ export type MessageFilter = import('pollis:app/types@0.1.0').MessageFilter;
56
+ export type HttpRequest = import('pollis:app/types@0.1.0').HttpRequest;
57
+ export type HttpResponse = import('pollis:app/types@0.1.0').HttpResponse;
58
+ export type LogLevel = import('pollis:app/types@0.1.0').LogLevel;
59
+ }
@@ -0,0 +1,138 @@
1
+ declare module 'pollis:app/types@0.1.0' {
2
+ /**
3
+ * Opaque message id (the envelope id).
4
+ */
5
+ export type MessageId = string;
6
+ /**
7
+ * Opaque channel id.
8
+ */
9
+ export type ChannelId = string;
10
+ export interface Author {
11
+ id: string,
12
+ displayName: string,
13
+ isBot: boolean,
14
+ }
15
+ /**
16
+ * Attachment metadata only. Attachment bytes are a later capability.
17
+ */
18
+ export interface Attachment {
19
+ name: string,
20
+ mimeType: string,
21
+ size: bigint,
22
+ }
23
+ export interface Message {
24
+ id: MessageId,
25
+ channel: ChannelId,
26
+ author: Author,
27
+ text: string,
28
+ attachments: Array<Attachment>,
29
+ /**
30
+ * The message this one replies to, if any.
31
+ */
32
+ replyTo?: MessageId,
33
+ /**
34
+ * The thread root this message belongs to, if any.
35
+ */
36
+ thread?: MessageId,
37
+ /**
38
+ * Unix milliseconds.
39
+ */
40
+ sentAt: bigint,
41
+ /**
42
+ * Unix milliseconds of the last edit, if edited.
43
+ */
44
+ editedAt?: bigint,
45
+ }
46
+ /**
47
+ * A slash command addressed to this App (#2018).
48
+ */
49
+ export interface Command {
50
+ /**
51
+ * Command name without the leading slash.
52
+ */
53
+ name: string,
54
+ /**
55
+ * Everything after the command name, unparsed.
56
+ */
57
+ args: string,
58
+ /**
59
+ * The message that carried the command.
60
+ */
61
+ message: Message,
62
+ }
63
+ /**
64
+ * A schedule firing.
65
+ */
66
+ export interface Schedule {
67
+ /**
68
+ * The schedule's name as declared by the App.
69
+ */
70
+ name: string,
71
+ /**
72
+ * The slot this firing is for, unix milliseconds.
73
+ */
74
+ slot: bigint,
75
+ }
76
+ /**
77
+ * A request addressed to this App by a member.
78
+ */
79
+ export interface Request {
80
+ id: string,
81
+ requester: Author,
82
+ body: string,
83
+ }
84
+ /**
85
+ * An inbound webhook delivery.
86
+ */
87
+ export interface Webhook {
88
+ deliveryId: string,
89
+ headers: Array<[string, string]>,
90
+ body: Uint8Array,
91
+ }
92
+ export interface MessageFilter {
93
+ /**
94
+ * Only this channel; all granted channels when absent.
95
+ */
96
+ channel?: ChannelId,
97
+ /**
98
+ * Unix milliseconds, inclusive. Clamped to the granted history window.
99
+ */
100
+ since?: bigint,
101
+ /**
102
+ * Unix milliseconds, exclusive.
103
+ */
104
+ until?: bigint,
105
+ /**
106
+ * Upper bound on results; the runtime may return fewer.
107
+ */
108
+ limit: number,
109
+ }
110
+ export interface HttpRequest {
111
+ method: string,
112
+ /**
113
+ * Absolute `https://` URL whose host is in the granted egress list.
114
+ */
115
+ url: string,
116
+ headers: Array<[string, string]>,
117
+ body?: Uint8Array,
118
+ }
119
+ export interface HttpResponse {
120
+ status: number,
121
+ headers: Array<[string, string]>,
122
+ body: Uint8Array,
123
+ }
124
+ /**
125
+ * # Variants
126
+ *
127
+ * ## `"trace"`
128
+ *
129
+ * ## `"debug"`
130
+ *
131
+ * ## `"info"`
132
+ *
133
+ * ## `"warn"`
134
+ *
135
+ * ## `"error"`
136
+ */
137
+ export type LogLevel = "trace" | "debug" | "info" | "warn" | "error";
138
+ }
@@ -0,0 +1,213 @@
1
+ /**
2
+ * `@pollis-inc/app`: write a Pollis App in TypeScript.
3
+ *
4
+ * An App is a default export of {@link app}: a manifest saying what it needs,
5
+ * and handlers the bot runtime calls when something happens in the group.
6
+ * `pollis app build` compiles it into a sandboxed WebAssembly component and
7
+ * writes the manifest beside it as `pollis-app.json`.
8
+ *
9
+ * ```ts
10
+ * import { app } from "@pollis-inc/app";
11
+ *
12
+ * export default app({
13
+ * manifest: { read: { channels: ["#support"] }, actions: ["reply"] },
14
+ * async onCommand(cmd, ctx) {
15
+ * await ctx.reply(cmd.message, `Hello, ${cmd.message.author.displayName}!`);
16
+ * },
17
+ * });
18
+ * ```
19
+ *
20
+ * Everything here is types plus the `app()` marker, so it imports cleanly in
21
+ * Node (the build reads the manifest that way). The code that talks to the
22
+ * runtime is `@pollis-inc/app/runtime`, which only the built component loads.
23
+ */
24
+ export type { Action, CommandSpec, ScheduleSpec, EventKind, Manifest, ResolvedManifest, Trigger, } from "./manifest.js";
25
+ import type { Manifest } from "./manifest.js";
26
+ /** Who sent a message. */
27
+ export interface Author {
28
+ /** Opaque user id. */
29
+ id: string;
30
+ displayName: string;
31
+ /** True for bots, including this one. */
32
+ isBot: boolean;
33
+ }
34
+ /** Attachment metadata. Apps never receive attachment bytes. */
35
+ export interface Attachment {
36
+ name: string;
37
+ mimeType: string;
38
+ /** Bytes. */
39
+ size: number;
40
+ }
41
+ /** A message in a channel the App was granted. */
42
+ export interface Message {
43
+ /** Opaque message id. */
44
+ id: string;
45
+ /** Opaque channel id. Pass it to `ctx.post` to answer in the same channel. */
46
+ channel: string;
47
+ author: Author;
48
+ text: string;
49
+ attachments: Attachment[];
50
+ /** The message this one replies to, if any. */
51
+ replyTo?: string;
52
+ /** The thread root this message belongs to, if any. */
53
+ thread?: string;
54
+ /** Unix milliseconds. */
55
+ sentAt: number;
56
+ /** Unix milliseconds of the last edit, if edited. */
57
+ editedAt?: number;
58
+ }
59
+ /** A slash command addressed to this App: `/name args`. */
60
+ export interface Command {
61
+ /** The command name, without the slash. */
62
+ name: string;
63
+ /** Everything after the name (and after `@bot`, if the member addressed one), trimmed. */
64
+ args: string;
65
+ /** The message that carried the command. Reply to it to answer. */
66
+ message: Message;
67
+ }
68
+ /** A schedule firing. */
69
+ export interface Schedule {
70
+ name: string;
71
+ /** The slot this firing is for, Unix milliseconds. */
72
+ slot: number;
73
+ }
74
+ /** A request a member sent to this App. */
75
+ export interface Request {
76
+ id: string;
77
+ requester: Author;
78
+ body: string;
79
+ }
80
+ /**
81
+ * An inbound webhook delivery: the request body as sent, and its
82
+ * `content-type`, `user-agent` and `x-*` headers (never `authorization`,
83
+ * cookies or the signature).
84
+ */
85
+ export interface Webhook {
86
+ deliveryId: string;
87
+ headers: [string, string][];
88
+ body: Uint8Array;
89
+ /** The body as UTF-8 text. */
90
+ text(): string;
91
+ /** The body parsed as JSON. */
92
+ json<T = unknown>(): T;
93
+ }
94
+ /** What `ctx.messages()` returns. All fields optional. */
95
+ export interface MessageQuery {
96
+ /** One channel id; all granted channels when absent. */
97
+ channel?: string;
98
+ /** Inclusive. Clamped to the history window the App was granted. */
99
+ since?: Date | number;
100
+ /** Exclusive. */
101
+ until?: Date | number;
102
+ /** At most this many (default 50; the runtime may return fewer). */
103
+ limit?: number;
104
+ }
105
+ /** The request half of `ctx.fetch`, shaped like the web's `RequestInit`. */
106
+ export interface FetchInit {
107
+ method?: string;
108
+ headers?: Record<string, string> | [string, string][] | Iterable<[string, string]>;
109
+ body?: string | Uint8Array | ArrayBuffer;
110
+ }
111
+ /** Response headers, shaped like the web's `Headers` (read-only). */
112
+ export interface FetchHeaders extends Iterable<[string, string]> {
113
+ get(name: string): string | null;
114
+ has(name: string): boolean;
115
+ forEach(fn: (value: string, name: string) => void): void;
116
+ entries(): IterableIterator<[string, string]>;
117
+ }
118
+ /** The response half of `ctx.fetch`, shaped like the web's `Response`. */
119
+ export interface FetchResponse {
120
+ readonly status: number;
121
+ /** `status` is 200 to 299. */
122
+ readonly ok: boolean;
123
+ readonly headers: FetchHeaders;
124
+ text(): Promise<string>;
125
+ json<T = unknown>(): Promise<T>;
126
+ bytes(): Promise<Uint8Array>;
127
+ arrayBuffer(): Promise<ArrayBuffer>;
128
+ }
129
+ /**
130
+ * The installation's key-value state: sealed, shared by every host that runs
131
+ * the bot, limited to the manifest's `state.quota` bytes. Writes are kept only
132
+ * if the handler finishes without throwing.
133
+ */
134
+ export interface State {
135
+ get(key: string): Promise<Uint8Array | undefined>;
136
+ getText(key: string): Promise<string | undefined>;
137
+ getJSON<T = unknown>(key: string): Promise<T | undefined>;
138
+ set(key: string, value: string | Uint8Array): Promise<void>;
139
+ setJSON(key: string, value: unknown): Promise<void>;
140
+ delete(key: string): Promise<void>;
141
+ }
142
+ /** The runtime's log (`pollis-bot` output). Never shown in the group. */
143
+ export interface Logger {
144
+ trace(text: string): void;
145
+ debug(text: string): void;
146
+ info(text: string): void;
147
+ warn(text: string): void;
148
+ error(text: string): void;
149
+ }
150
+ /**
151
+ * What a handler can do. Every call is checked against what the admin
152
+ * granted; a refused call rejects with a {@link RefusedError} whose message
153
+ * names the manifest field, e.g. "`http-fetch` to `api.x.com` refused: not
154
+ * in `egress`".
155
+ *
156
+ * Messages you post, reply, react, edit or delete are queued, and sent only
157
+ * after the handler finishes without throwing. If it throws, nothing is sent
158
+ * and no state is written.
159
+ */
160
+ export interface Context {
161
+ /** Post a new message in a channel (by id, e.g. `message.channel`). Needs `post`. */
162
+ post(channel: string, text: string): Promise<void>;
163
+ /** Reply to a message. Needs `reply`. */
164
+ reply(to: Message | string, text: string): Promise<void>;
165
+ /** React to a message with an emoji. Needs `react`. */
166
+ react(to: Message | string, emoji: string): Promise<void>;
167
+ /** Edit a message this bot sent. Needs `edit_own`. */
168
+ editOwn(message: Message | string, text: string): Promise<void>;
169
+ /** Delete a message this bot sent. Needs `delete_own`. */
170
+ deleteOwn(message: Message | string): Promise<void>;
171
+ /** Messages from granted channels within the granted history window (`read.history`). */
172
+ messages(query?: MessageQuery): Promise<Message[]>;
173
+ /** The installation's key-value state. Needs `state.quota` above 0. */
174
+ state: State;
175
+ /**
176
+ * One HTTPS request to a host listed in `egress`, shaped like the web's
177
+ * `fetch`. Redirects are followed only within the same host.
178
+ */
179
+ fetch(url: string | URL, init?: FetchInit): Promise<FetchResponse>;
180
+ log: Logger;
181
+ /** Unix milliseconds, from the runtime's clock. */
182
+ now(): number;
183
+ }
184
+ /** The handlers an App may define. Each needs its trigger in the manifest. */
185
+ export interface Handlers {
186
+ /** Every new message in a granted channel. Trigger: `messages`. */
187
+ onMessage?(message: Message, ctx: Context): void | Promise<void>;
188
+ /** A message that @mentions the bot by its username (`@all` does not count). Trigger: `mentions`. */
189
+ onMention?(message: Message, ctx: Context): void | Promise<void>;
190
+ /** A slash command declared in `manifest.commands`. Trigger: `commands`. */
191
+ onCommand?(command: Command, ctx: Context): void | Promise<void>;
192
+ /** A schedule from `manifest.schedules` firing. Trigger: `schedule`. */
193
+ onSchedule?(schedule: Schedule, ctx: Context): void | Promise<void>;
194
+ /** A member's request. Trigger: `requests`. */
195
+ onRequest?(request: Request, ctx: Context): void | Promise<void>;
196
+ /** An inbound webhook. Trigger: `webhook`. */
197
+ onWebhook?(webhook: Webhook, ctx: Context): void | Promise<void>;
198
+ }
199
+ /** An App: its manifest and its handlers. */
200
+ export interface AppDefinition extends Handlers {
201
+ manifest: Manifest;
202
+ }
203
+ /** A host function refused a call. The message says which manifest field refused it. */
204
+ export declare class RefusedError extends Error {
205
+ constructor(message: string);
206
+ }
207
+ /**
208
+ * Define an App. Use it as the module's default export:
209
+ * `export default app({ manifest: {...}, onCommand(cmd, ctx) {...} })`.
210
+ */
211
+ export declare function app<T extends AppDefinition>(definition: T): T;
212
+ /** Whether a value came from {@link app}. */
213
+ export declare function isApp(value: unknown): value is AppDefinition;
package/dist/index.js ADDED
@@ -0,0 +1,49 @@
1
+ /**
2
+ * `@pollis-inc/app`: write a Pollis App in TypeScript.
3
+ *
4
+ * An App is a default export of {@link app}: a manifest saying what it needs,
5
+ * and handlers the bot runtime calls when something happens in the group.
6
+ * `pollis app build` compiles it into a sandboxed WebAssembly component and
7
+ * writes the manifest beside it as `pollis-app.json`.
8
+ *
9
+ * ```ts
10
+ * import { app } from "@pollis-inc/app";
11
+ *
12
+ * export default app({
13
+ * manifest: { read: { channels: ["#support"] }, actions: ["reply"] },
14
+ * async onCommand(cmd, ctx) {
15
+ * await ctx.reply(cmd.message, `Hello, ${cmd.message.author.displayName}!`);
16
+ * },
17
+ * });
18
+ * ```
19
+ *
20
+ * Everything here is types plus the `app()` marker, so it imports cleanly in
21
+ * Node (the build reads the manifest that way). The code that talks to the
22
+ * runtime is `@pollis-inc/app/runtime`, which only the built component loads.
23
+ */
24
+ const APP_MARK = Symbol.for("pollis.app");
25
+ /** A host function refused a call. The message says which manifest field refused it. */
26
+ export class RefusedError extends Error {
27
+ constructor(message) {
28
+ super(message);
29
+ this.name = "RefusedError";
30
+ }
31
+ }
32
+ /**
33
+ * Define an App. Use it as the module's default export:
34
+ * `export default app({ manifest: {...}, onCommand(cmd, ctx) {...} })`.
35
+ */
36
+ export function app(definition) {
37
+ if (definition === null || typeof definition !== "object") {
38
+ throw new TypeError("app() takes an object: { manifest, onMessage, onCommand, ... }");
39
+ }
40
+ if (definition.manifest === null || typeof definition.manifest !== "object") {
41
+ throw new TypeError("app() needs a `manifest` object");
42
+ }
43
+ Object.defineProperty(definition, APP_MARK, { value: true });
44
+ return definition;
45
+ }
46
+ /** Whether a value came from {@link app}. */
47
+ export function isApp(value) {
48
+ return typeof value === "object" && value !== null && value[APP_MARK] === true;
49
+ }
@@ -0,0 +1,119 @@
1
+ /**
2
+ * The manifest: what an App asks for. Written in code, inside `app({ manifest })`,
3
+ * and emitted as `pollis-app.json` by `pollis app build`, so it cannot drift from
4
+ * what the code expects. An admin can narrow it when approving the App, never
5
+ * widen it, and the runtime enforces it.
6
+ *
7
+ * The rules here mirror the runtime's (`pollis-app-manifest`) so a mistake is
8
+ * reported at build time; the build then checks the emitted file with the
9
+ * runtime's own parser too.
10
+ */
11
+ /** What can wake an App. Each maps to one handler. */
12
+ export type Trigger = "messages" | "mentions" | "commands" | "schedule" | "requests" | "webhook";
13
+ /** What an App may do in the group. There are no moderation actions. */
14
+ export type Action = "post" | "reply" | "react" | "edit_own" | "delete_own" | "transfer_history";
15
+ /** Message event kinds an App may see. */
16
+ export type EventKind = "created" | "edited";
17
+ /** A slash command members can pick in the composer. */
18
+ export interface CommandSpec {
19
+ /** Typed after the slash: lowercase letters, digits, '-' and '_', starting with a letter, up to 32 characters. */
20
+ name: string;
21
+ /** One line (up to 100 characters) shown beside the name. */
22
+ description: string;
23
+ /** What to type after the name, shown greyed (`"<title>"`). Leave it out for a command without arguments. */
24
+ arg_hint?: string;
25
+ /** Deliver privately to the bot (`onRequest`, trigger `requests`) instead of posting in the channel (`onCommand`). */
26
+ request?: boolean;
27
+ }
28
+ /** When `onSchedule` runs: at every Unix time `k * every + offset` (UTC seconds). */
29
+ export interface ScheduleSpec {
30
+ /** Lowercase letters, digits and '-', up to 32 characters; passed to `onSchedule`. */
31
+ name: string;
32
+ /** Period in seconds, 60 (a minute) to 604800 (a week). */
33
+ every: number;
34
+ /** Seconds after each period boundary, less than `every`. Default 0. */
35
+ offset?: number;
36
+ }
37
+ export interface Manifest {
38
+ /** Lowercase letters, digits and '-'. Default: the package name, without its scope. */
39
+ name?: string;
40
+ /** Default: the package version. */
41
+ version?: string;
42
+ /** Default: the package description. */
43
+ description?: string;
44
+ /** Default: one trigger per handler you define. If given, it must match your handlers. */
45
+ triggers?: Trigger[];
46
+ read?: {
47
+ /** `"#name"` for one channel, or `"*"` for whichever channels the admin grants. */
48
+ channels?: string[];
49
+ /** Days of history `ctx.messages()` may reach back. Default 0: none. */
50
+ history?: number;
51
+ /** Default `["created"]`. Add `"edited"` to also see edits. */
52
+ events?: EventKind[];
53
+ };
54
+ actions?: Action[];
55
+ state?: {
56
+ /** Bytes of keys plus values. Default 0: no state. */
57
+ quota?: number;
58
+ };
59
+ /** Exact host names `ctx.fetch` may reach. Empty: the App cannot send data outside the group. */
60
+ egress?: string[];
61
+ /** Slash commands (up to 25). Needed for `onCommand`; a `request` command needs `onRequest`. */
62
+ commands?: CommandSpec[];
63
+ /** When `onSchedule` runs. Needed for `onSchedule`. */
64
+ schedules?: ScheduleSpec[];
65
+ }
66
+ /** The manifest exactly as `pollis-app.json` holds it. */
67
+ export interface ResolvedManifest {
68
+ name: string;
69
+ version: string;
70
+ description: string;
71
+ triggers: Trigger[];
72
+ read: {
73
+ channels: string[];
74
+ history: number;
75
+ events: EventKind[];
76
+ };
77
+ actions: Action[];
78
+ state: {
79
+ quota: number;
80
+ };
81
+ egress: string[];
82
+ /** Present only when not empty. */
83
+ commands?: CommandSpec[];
84
+ /** Present only when not empty. */
85
+ schedules?: ScheduleSpec[];
86
+ }
87
+ export declare const TRIGGERS: readonly Trigger[];
88
+ export declare const ACTIONS: readonly Action[];
89
+ export declare const EVENTS: readonly EventKind[];
90
+ /** Which handler each trigger calls. */
91
+ export declare const HANDLER_FOR: Readonly<Record<Trigger, string>>;
92
+ /** A mistake in the manifest, with the field it is about. */
93
+ export declare class ManifestError extends Error {
94
+ constructor(message: string);
95
+ }
96
+ export declare const MAX_COMMANDS = 25;
97
+ export declare const MIN_SCHEDULE_SECS = 60;
98
+ export declare const MAX_SCHEDULE_SECS: number;
99
+ /** The parts of package.json the manifest defaults come from. */
100
+ export interface PackageInfo {
101
+ name?: string;
102
+ version?: string;
103
+ description?: string;
104
+ }
105
+ /** A package name as an App name: `@acme/Linear_Bot` becomes `linear-bot`. */
106
+ export declare function nameFromPackage(pkg: string | undefined): string | undefined;
107
+ /**
108
+ * Check a manifest exactly as the runtime does (`Manifest::from_json` in
109
+ * pollis-app-manifest), in the same order and with the same messages. The
110
+ * input is the manifest as `pollis-app.json` holds it.
111
+ */
112
+ export declare function validateManifest(json: unknown): ResolvedManifest;
113
+ /**
114
+ * Fill in defaults from package.json and the handlers, check that triggers
115
+ * and handlers agree, then check every rule the runtime applies
116
+ * ({@link validateManifest}). Returns the manifest as it will be written.
117
+ * `handlers` are the handler names the App defines.
118
+ */
119
+ export declare function resolveManifest(manifest: Manifest, handlers: string[], pkg?: PackageInfo): ResolvedManifest;