@capybara-hq/plugin-sdk 0.1.0-rc.45 → 0.1.0-rc.46
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/agent-docs/extension-points/push-provider.md +17 -0
- package/agent-docs/extensions.md +1 -0
- package/agent-docs/plugin-format.md +7 -4
- package/dist/extension-point.js +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/push.d.ts +75 -0
- package/dist/push.js +87 -0
- package/dist/setup-check.d.ts +20 -7
- package/dist/setup-guide.d.ts +4 -2
- package/dist/setup-guide.js +14 -2
- package/dist/shell-capabilities.d.ts +26 -0
- package/dist/shell-capabilities.js +1 -0
- package/dist/shell-environment.js +1 -0
- package/package.json +1 -1
- package/schemas/plugin.v1.schema.json +2 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Authoring: extension point push-provider
|
|
2
|
+
|
|
3
|
+
<!-- generated:extension-point -->
|
|
4
|
+
- Name: `push-provider` (a ref is `push-provider@<major>`)
|
|
5
|
+
- Delivers push notifications to people's mobile apps through one channel (APNs, FCM, an aggregator).
|
|
6
|
+
- Providers: several
|
|
7
|
+
- Enabled per org: no
|
|
8
|
+
- Brokered by the platform: yes (extensions use it only through `ctx`)
|
|
9
|
+
<!-- /generated -->
|
|
10
|
+
|
|
11
|
+
Contract: PushProvider (`push.ts`)
|
|
12
|
+
|
|
13
|
+
`send` answers one `PushResult` per registration (`checkPushResults`); a thrown `PushError` applies to every registration of the call. No retries inside: the kernel's queue retries `transient` and `rate_limited`, deletes an `unregistered` registration and tells the platform about `auth`. `apps()` is synchronous and derived from deployment config.
|
|
14
|
+
|
|
15
|
+
Map the channel-neutral `PushMessage` to the channel's payload: `title` and `body` as the alert, `path` and `origin` as data for the app, `threadId` as the grouping key (APNs `thread-id`), and `collapseId` as the channel's collapse key (APNs `apns-collapse-id`, FCM `collapse_key`): it is the same for every send of one event to one device, so a resend after a crash or a timeout replaces the notification. Never log a token.
|
|
16
|
+
|
|
17
|
+
See `extensions` for the rules every extension follows.
|
package/agent-docs/extensions.md
CHANGED
|
@@ -82,6 +82,7 @@ look like `channel@1`: name and major version. The registered points:
|
|
|
82
82
|
| `web-search` | multi | yes | Searches the web for the WebSearch tool; each org picks a default provider. |
|
|
83
83
|
| `context` | multi | yes | Adds text to the model's context at run start in conversations of orgs that enable it. |
|
|
84
84
|
| `web-fetch` | multi | yes | Fetches and extracts web pages for the WebFetch tool; each org picks a default provider. |
|
|
85
|
+
| `push-provider` | multi | no | Delivers push notifications to people's mobile apps through one channel (APNs, FCM, an aggregator). |
|
|
85
86
|
<!-- /generated -->
|
|
86
87
|
|
|
87
88
|
Read `extension-points/<name>` for each one. Which points a deployment actually has loaded, and
|
|
@@ -60,9 +60,11 @@ Rules that the schema cannot show:
|
|
|
60
60
|
- `setupGuides` (at most 8): `{ id, place, template? }`. Each guide is a Markdown document at
|
|
61
61
|
`guides/<id>.md` (English, required) and `guides/<id>.zh.md` (Chinese, optional), shown where a
|
|
62
62
|
person sets up what the plugin brings. `place` is `channel-connection` (New channel and the channel
|
|
63
|
-
detail; the extension must provide `channel@1`; one per plugin)
|
|
64
|
-
(`template` names one of the plugin's `connectors/<id>.json`; one per template)
|
|
65
|
-
|
|
63
|
+
detail; the extension must provide `channel@1`; one per plugin), `connector-template`
|
|
64
|
+
(`template` names one of the plugin's `connectors/<id>.json`; one per template) or
|
|
65
|
+
`extension-deployment` (the super admin's page of the extension; its checks get the extension's
|
|
66
|
+
platform deployment config and `orgId: null`, for credentials such as a push provider's key). See
|
|
67
|
+
"Setup guides" below.
|
|
66
68
|
- `extension` is written by the packer; never write it by hand.
|
|
67
69
|
|
|
68
70
|
## Setup guides
|
|
@@ -74,7 +76,8 @@ A guide is CommonMark + GFM:
|
|
|
74
76
|
- `{{name}}` variables come from the place, and none is ever a secret: everywhere `publicUrl`,
|
|
75
77
|
`orgName`, `pluginName`, `pluginVersion`, `mode`; `channel-connection` adds `webhookUrl`,
|
|
76
78
|
`signInCallbackUrl`, `connectionName`; `connector-template` adds `oauthCallbackUrl`,
|
|
77
|
-
`signInCallbackUrl`, `templateId`, `templateName`, `connectorName
|
|
79
|
+
`signInCallbackUrl`, `templateId`, `templateName`, `connectorName`; `extension-deployment` adds
|
|
80
|
+
none (no modes, admin audience only). In `yaml` / `json` code put a
|
|
78
81
|
variable inside double quotes. Directive lines and fence info strings hold no variables.
|
|
79
82
|
- Sections: a line `::: mode webhook` (modes `long_connection`, `webhook`; channel guides) or
|
|
80
83
|
`::: audience member` (audiences `admin`, `member`; connector template guides) opens one, `:::`
|
package/dist/extension-point.js
CHANGED
|
@@ -22,6 +22,7 @@ export const EXTENSION_POINTS = {
|
|
|
22
22
|
"web-search": info([1], "Searches the web for the WebSearch tool; each org picks a default provider.", "multi", true, true, "org-default"),
|
|
23
23
|
context: info([1], "Adds text to the model's context at run start in conversations of orgs that enable it.", "multi", true, true),
|
|
24
24
|
"web-fetch": info([1], "Fetches and extracts web pages for the WebFetch tool; each org picks a default provider.", "multi", true, true, "org-default"),
|
|
25
|
+
"push-provider": info([1], "Delivers push notifications to people's mobile apps through one channel (APNs, FCM, an aggregator).", "multi", true),
|
|
25
26
|
};
|
|
26
27
|
/** Cardinality of the registered extension points (derived from EXTENSION_POINTS). */
|
|
27
28
|
export const EXTENSION_POINT_CARDINALITY = Object.fromEntries(Object.entries(EXTENSION_POINTS).map(([k, v]) => [k, v.cardinality]));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.1.0-rc.
|
|
1
|
+
export declare const SDK_VERSION = "0.1.0-rc.46";
|
|
2
2
|
export * from "./agent-template.js";
|
|
3
3
|
export * from "./bootstrap.js";
|
|
4
4
|
export * from "./cards.js";
|
|
@@ -29,6 +29,7 @@ export * from "./org-access.js";
|
|
|
29
29
|
export * from "./permissions.js";
|
|
30
30
|
export * from "./plugin-manifest.js";
|
|
31
31
|
export * from "./plugin-package.js";
|
|
32
|
+
export * from "./push.js";
|
|
32
33
|
export * from "./sandbox.js";
|
|
33
34
|
export * from "./sandbox-operation.js";
|
|
34
35
|
export { SANDBOX_RUNTIME_SOURCE } from "./sandbox-runtime-source.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.1.0-rc.
|
|
1
|
+
export const SDK_VERSION = "0.1.0-rc.46";
|
|
2
2
|
export * from "./agent-template.js";
|
|
3
3
|
export * from "./bootstrap.js";
|
|
4
4
|
export * from "./cards.js";
|
|
@@ -29,6 +29,7 @@ export * from "./org-access.js";
|
|
|
29
29
|
export * from "./permissions.js";
|
|
30
30
|
export * from "./plugin-manifest.js";
|
|
31
31
|
export * from "./plugin-package.js";
|
|
32
|
+
export * from "./push.js";
|
|
32
33
|
export * from "./sandbox.js";
|
|
33
34
|
export * from "./sandbox-operation.js";
|
|
34
35
|
export { SANDBOX_RUNTIME_SOURCE } from "./sandbox-runtime-source.js";
|
package/dist/push.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/** Push provider extension point ref (`push-provider@1`): delivers push notifications to mobile apps. */
|
|
2
|
+
export declare const PUSH_PROVIDER_EXTENSION_POINT = "push-provider@1";
|
|
3
|
+
/** Limits the kernel enforces on push registrations and messages. */
|
|
4
|
+
export declare const PUSH_LIMITS: {
|
|
5
|
+
readonly titleChars: 100;
|
|
6
|
+
readonly bodyChars: 240;
|
|
7
|
+
readonly pathChars: 512;
|
|
8
|
+
readonly collapseIdChars: 64;
|
|
9
|
+
readonly tokenChars: 4096;
|
|
10
|
+
readonly appIdChars: 255;
|
|
11
|
+
readonly deviceNameChars: 64;
|
|
12
|
+
readonly sendTimeoutMs: 15000;
|
|
13
|
+
readonly registrationsPerAccount: 20;
|
|
14
|
+
};
|
|
15
|
+
export type PushPlatform = "ios" | "android";
|
|
16
|
+
export interface PushMessage {
|
|
17
|
+
title: string;
|
|
18
|
+
body: string;
|
|
19
|
+
/** In-app path opened on tap; starts with `/`. */
|
|
20
|
+
path: string;
|
|
21
|
+
threadId: string;
|
|
22
|
+
/**
|
|
23
|
+
* The same id for every send of one event to one device (1..64 of `A-Z a-z 0-9 . _ -`): map it
|
|
24
|
+
* to the channel's collapse key (APNs `apns-collapse-id`, FCM `collapse_key`), so a resend after
|
|
25
|
+
* a crash or a timeout replaces the notification instead of showing it twice.
|
|
26
|
+
*/
|
|
27
|
+
collapseId: string;
|
|
28
|
+
badge?: number;
|
|
29
|
+
/** The deployment origin (scheme://host[:port]); the shell matches it to a profile. */
|
|
30
|
+
origin: string;
|
|
31
|
+
}
|
|
32
|
+
/** One device registration a message is sent to. */
|
|
33
|
+
export interface PushTarget {
|
|
34
|
+
id: string;
|
|
35
|
+
platform: PushPlatform;
|
|
36
|
+
appId: string;
|
|
37
|
+
token: string;
|
|
38
|
+
}
|
|
39
|
+
export type PushErrorKind = "auth" | "rate_limited" | "transient";
|
|
40
|
+
/** Thrown by a provider; applies to every registration of the call. */
|
|
41
|
+
export declare class PushError extends Error {
|
|
42
|
+
readonly kind: PushErrorKind;
|
|
43
|
+
readonly retryAfterMs?: number;
|
|
44
|
+
constructor(message: string, opts: {
|
|
45
|
+
kind: PushErrorKind;
|
|
46
|
+
retryAfterMs?: number;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
export type PushResult = {
|
|
50
|
+
registrationId: string;
|
|
51
|
+
status: "delivered";
|
|
52
|
+
} | {
|
|
53
|
+
registrationId: string;
|
|
54
|
+
status: "unregistered";
|
|
55
|
+
} | {
|
|
56
|
+
registrationId: string;
|
|
57
|
+
status: "failed";
|
|
58
|
+
kind: PushErrorKind;
|
|
59
|
+
message: string;
|
|
60
|
+
retryAfterMs?: number;
|
|
61
|
+
};
|
|
62
|
+
/** No retries inside; a thrown PushError applies to every registration of the call, any other throw is transient. */
|
|
63
|
+
export interface PushProvider {
|
|
64
|
+
/** App ids (bundle / application ids) the configured credentials cover; synchronous, from config. */
|
|
65
|
+
apps(): readonly string[];
|
|
66
|
+
send(args: {
|
|
67
|
+
registrations: readonly PushTarget[];
|
|
68
|
+
message: PushMessage;
|
|
69
|
+
signal: AbortSignal;
|
|
70
|
+
}): Promise<PushResult[]>;
|
|
71
|
+
}
|
|
72
|
+
/** null when `results` answers every registration exactly once, else the problem (no token in it). */
|
|
73
|
+
export declare function checkPushResults(registrations: readonly PushTarget[], results: unknown): string | null;
|
|
74
|
+
/** null when the message is within PUSH_LIMITS and well formed, else the problem. */
|
|
75
|
+
export declare function validatePushMessage(m: PushMessage): string | null;
|
package/dist/push.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/** Push provider extension point ref (`push-provider@1`): delivers push notifications to mobile apps. */
|
|
2
|
+
export const PUSH_PROVIDER_EXTENSION_POINT = "push-provider@1";
|
|
3
|
+
/** Limits the kernel enforces on push registrations and messages. */
|
|
4
|
+
export const PUSH_LIMITS = {
|
|
5
|
+
titleChars: 100,
|
|
6
|
+
bodyChars: 240,
|
|
7
|
+
pathChars: 512,
|
|
8
|
+
collapseIdChars: 64,
|
|
9
|
+
tokenChars: 4096,
|
|
10
|
+
appIdChars: 255,
|
|
11
|
+
deviceNameChars: 64,
|
|
12
|
+
sendTimeoutMs: 15_000,
|
|
13
|
+
registrationsPerAccount: 20,
|
|
14
|
+
};
|
|
15
|
+
/** Thrown by a provider; applies to every registration of the call. */
|
|
16
|
+
export class PushError extends Error {
|
|
17
|
+
kind;
|
|
18
|
+
retryAfterMs;
|
|
19
|
+
constructor(message, opts) {
|
|
20
|
+
super(message);
|
|
21
|
+
this.name = "PushError";
|
|
22
|
+
this.kind = opts.kind;
|
|
23
|
+
if (opts.retryAfterMs !== undefined)
|
|
24
|
+
this.retryAfterMs = opts.retryAfterMs;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const KINDS = ["auth", "rate_limited", "transient"];
|
|
28
|
+
/** null when `results` answers every registration exactly once, else the problem (no token in it). */
|
|
29
|
+
export function checkPushResults(registrations, results) {
|
|
30
|
+
if (!Array.isArray(results))
|
|
31
|
+
return "push provider returned a non-array result";
|
|
32
|
+
const known = new Set(registrations.map((r) => r.id));
|
|
33
|
+
const seen = new Set();
|
|
34
|
+
for (const r of results) {
|
|
35
|
+
if (typeof r !== "object" || r === null)
|
|
36
|
+
return "push provider returned a non-object result";
|
|
37
|
+
const o = r;
|
|
38
|
+
const id = o.registrationId;
|
|
39
|
+
if (typeof id !== "string" || !known.has(id)) {
|
|
40
|
+
return "push provider answered an unknown registration id";
|
|
41
|
+
}
|
|
42
|
+
if (seen.has(id))
|
|
43
|
+
return `push provider answered registration ${id} more than once`;
|
|
44
|
+
seen.add(id);
|
|
45
|
+
if (o.status === "failed") {
|
|
46
|
+
if (typeof o.kind !== "string" || !KINDS.includes(o.kind)) {
|
|
47
|
+
return `push provider returned a failed result without a known kind for ${id}`;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else if (o.status !== "delivered" && o.status !== "unregistered") {
|
|
51
|
+
return `push provider returned an unknown status for ${id}`;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (seen.size !== known.size)
|
|
55
|
+
return "push provider left a registration unanswered";
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
/** null when the message is within PUSH_LIMITS and well formed, else the problem. */
|
|
59
|
+
export function validatePushMessage(m) {
|
|
60
|
+
if (m.title.length > PUSH_LIMITS.titleChars) {
|
|
61
|
+
return `title exceeds ${PUSH_LIMITS.titleChars} characters`;
|
|
62
|
+
}
|
|
63
|
+
if (m.body.length > PUSH_LIMITS.bodyChars) {
|
|
64
|
+
return `body exceeds ${PUSH_LIMITS.bodyChars} characters`;
|
|
65
|
+
}
|
|
66
|
+
if (!m.path.startsWith("/") || m.path.length > PUSH_LIMITS.pathChars) {
|
|
67
|
+
return `path must start with "/" and be at most ${PUSH_LIMITS.pathChars} characters`;
|
|
68
|
+
}
|
|
69
|
+
if (m.collapseId.length === 0 ||
|
|
70
|
+
m.collapseId.length > PUSH_LIMITS.collapseIdChars ||
|
|
71
|
+
!/^[A-Za-z0-9._-]+$/.test(m.collapseId)) {
|
|
72
|
+
return `collapseId must be 1 to ${PUSH_LIMITS.collapseIdChars} characters of A-Z a-z 0-9 . _ -`;
|
|
73
|
+
}
|
|
74
|
+
let url;
|
|
75
|
+
try {
|
|
76
|
+
url = new URL(m.origin);
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return "origin must be scheme://host[:port]";
|
|
80
|
+
}
|
|
81
|
+
if ((url.protocol !== "https:" && url.protocol !== "http:") ||
|
|
82
|
+
url.origin !== m.origin ||
|
|
83
|
+
m.origin.endsWith("/")) {
|
|
84
|
+
return "origin must be scheme://host[:port] with no path";
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}
|
package/dist/setup-check.d.ts
CHANGED
|
@@ -10,12 +10,15 @@
|
|
|
10
10
|
* - A check never writes, at the third party or in Capybara, and stays cheap (one or two reads).
|
|
11
11
|
* - Pass `signal` to every request; the kernel aborts it at {@link SETUP_CHECK_LIMITS}.timeoutMs.
|
|
12
12
|
* - No retries inside the check: the person retries, retry policy is the kernel's.
|
|
13
|
-
* - Never put a secret in `reason` or `fix
|
|
14
|
-
*
|
|
13
|
+
* - Never put a secret, or any part of one, in `reason` or `fix`: the result is shown to people
|
|
14
|
+
* and to models (the `Platform` tool returns it). The kernel replaces known secret values with
|
|
15
|
+
* `[REDACTED]` before caching or returning, but only as exact matches of whole values of 8
|
|
16
|
+
* characters or more: a prefix, suffix, shorter secret or transformed copy is not redacted.
|
|
15
17
|
*
|
|
16
18
|
* What a check receives is what the extension already receives for the same target, nothing more:
|
|
17
|
-
* a channel connection's config (as `channel@1` `verify` and `connect` get it),
|
|
18
|
-
* ids and OAuth client id
|
|
19
|
+
* a channel connection's config (as `channel@1` `verify` and `connect` get it), a connector's
|
|
20
|
+
* ids and OAuth client id, or the extension's own platform deployment config (as its `ctx.config`,
|
|
21
|
+
* for the `extension-deployment` place, run only by a super admin). A check never gets the OAuth client secret or a member's token; those
|
|
19
22
|
* stay with the kernel and the connector extension's `auth()` (decided 2026-11-09).
|
|
20
23
|
*/
|
|
21
24
|
import type { SetupGuidePlace } from "./setup-guide.js";
|
|
@@ -44,7 +47,7 @@ export interface SetupCheckResult {
|
|
|
44
47
|
/**
|
|
45
48
|
* What a check is about. The kernel builds it field by field; it only ever names targets of the
|
|
46
49
|
* check's own plugin (a channel connection on the plugin, a connector made from one of its
|
|
47
|
-
* templates).
|
|
50
|
+
* templates, the plugin's own deployment).
|
|
48
51
|
*/
|
|
49
52
|
export type SetupCheckTarget = {
|
|
50
53
|
readonly kind: "channel-connection";
|
|
@@ -59,11 +62,21 @@ export type SetupCheckTarget = {
|
|
|
59
62
|
readonly clientId: string | null;
|
|
60
63
|
/** The viewing member's account, for member-audience checks; never their token. */
|
|
61
64
|
readonly accountId: string | null;
|
|
65
|
+
} | {
|
|
66
|
+
readonly kind: "extension-deployment";
|
|
67
|
+
/** The check's own plugin. */
|
|
68
|
+
readonly plugin: string;
|
|
69
|
+
/** The extension's platform deployment config as its `ctx.config` holds it, secrets included. */
|
|
70
|
+
readonly config: unknown;
|
|
62
71
|
};
|
|
63
72
|
/** What `run` receives. */
|
|
64
73
|
export interface SetupCheckArgs {
|
|
65
|
-
|
|
66
|
-
|
|
74
|
+
/** The org the check runs for; null for the `extension-deployment` place (the platform). */
|
|
75
|
+
readonly orgId: string | null;
|
|
76
|
+
/**
|
|
77
|
+
* The extension's effective config for the org (platform config plus the org's copy); for the
|
|
78
|
+
* `extension-deployment` place, its platform deployment config.
|
|
79
|
+
*/
|
|
67
80
|
readonly config: unknown;
|
|
68
81
|
readonly locale: "en" | "zh";
|
|
69
82
|
/** The guide's mode (`long_connection`, `webhook`), or null when the place has none. */
|
package/dist/setup-guide.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Where a guide is shown. `channel-connection`: "New channel" and the channel detail page;
|
|
3
|
-
* `connector-template`: the pages of a connector template and the connectors made from it
|
|
3
|
+
* `connector-template`: the pages of a connector template and the connectors made from it;
|
|
4
|
+
* `extension-deployment`: the super admin's page of the extension, whose checks verify the
|
|
5
|
+
* platform deployment config (a push provider's credentials).
|
|
4
6
|
*/
|
|
5
|
-
export declare const SETUP_GUIDE_PLACES: readonly ["channel-connection", "connector-template"];
|
|
7
|
+
export declare const SETUP_GUIDE_PLACES: readonly ["channel-connection", "connector-template", "extension-deployment"];
|
|
6
8
|
export type SetupGuidePlace = (typeof SETUP_GUIDE_PLACES)[number];
|
|
7
9
|
/** Who the rendered text is for: `admin` sets the integration up, `member` uses it. */
|
|
8
10
|
export type SetupGuideAudience = "admin" | "member";
|
package/dist/setup-guide.js
CHANGED
|
@@ -13,9 +13,15 @@ import { createHash } from "node:crypto";
|
|
|
13
13
|
import { analyzeSetupGuide, checkMarkerIndex, ENCODED_SENTINEL_RE, lineSelected, normalizeGuideSource, parseGuideMarkdown, preparedGuideText, SENTINEL_RE, scanGuide, visitGuide, } from "./setup-guide-parse.js";
|
|
14
14
|
/**
|
|
15
15
|
* Where a guide is shown. `channel-connection`: "New channel" and the channel detail page;
|
|
16
|
-
* `connector-template`: the pages of a connector template and the connectors made from it
|
|
16
|
+
* `connector-template`: the pages of a connector template and the connectors made from it;
|
|
17
|
+
* `extension-deployment`: the super admin's page of the extension, whose checks verify the
|
|
18
|
+
* platform deployment config (a push provider's credentials).
|
|
17
19
|
*/
|
|
18
|
-
export const SETUP_GUIDE_PLACES = [
|
|
20
|
+
export const SETUP_GUIDE_PLACES = [
|
|
21
|
+
"channel-connection",
|
|
22
|
+
"connector-template",
|
|
23
|
+
"extension-deployment",
|
|
24
|
+
];
|
|
19
25
|
const COMMON_VARIABLES = {
|
|
20
26
|
publicUrl: "url",
|
|
21
27
|
orgName: "text",
|
|
@@ -49,6 +55,12 @@ export const SETUP_GUIDE_PLACE_INFO = {
|
|
|
49
55
|
},
|
|
50
56
|
drift: true,
|
|
51
57
|
},
|
|
58
|
+
"extension-deployment": {
|
|
59
|
+
modes: [],
|
|
60
|
+
audiences: ["admin"],
|
|
61
|
+
variables: { ...COMMON_VARIABLES, pluginName: "text" },
|
|
62
|
+
drift: false,
|
|
63
|
+
},
|
|
52
64
|
};
|
|
53
65
|
/** Limits of setup guides. */
|
|
54
66
|
export const SETUP_GUIDE_LIMITS = {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PushPlatform } from "./push.js";
|
|
1
2
|
/**
|
|
2
3
|
* Desktop shell capabilities (desktop client spec §8): the shapes of the objects a desktop shell
|
|
3
4
|
* puts in `window.capybaraShell.capabilities` under the keys of `SHELL_CAPABILITY_KEYS`. Types and
|
|
@@ -16,6 +17,7 @@ export declare const SHELL_CAPABILITY_KEYS: {
|
|
|
16
17
|
readonly menu: "menu@1";
|
|
17
18
|
readonly nav: "nav@1";
|
|
18
19
|
readonly profiles: "profiles@1";
|
|
20
|
+
readonly push: "push@1";
|
|
19
21
|
};
|
|
20
22
|
export type KeepAwakeMode = "off" | "while-busy" | "connected";
|
|
21
23
|
export type DeviceConnection = "starting" | "online" | "offline" | "draining" | "stopped";
|
|
@@ -199,3 +201,27 @@ export interface ProfilesCapabilityV1 {
|
|
|
199
201
|
/** Opens the native profile switcher; resolves when it closes, with nothing. */
|
|
200
202
|
show(): Promise<void>;
|
|
201
203
|
}
|
|
204
|
+
export type PushPermission = "granted" | "denied" | "prompt";
|
|
205
|
+
export interface PushStatus {
|
|
206
|
+
permission: PushPermission;
|
|
207
|
+
/** The server-side registration id this install holds, or null. */
|
|
208
|
+
registrationId: string | null;
|
|
209
|
+
/** The OS token differs from the one last registered. */
|
|
210
|
+
tokenChanged: boolean;
|
|
211
|
+
}
|
|
212
|
+
/** What the shell hands the web app to register with the deployment. */
|
|
213
|
+
export interface PushRegistration {
|
|
214
|
+
platform: PushPlatform;
|
|
215
|
+
appId: string;
|
|
216
|
+
provider: string;
|
|
217
|
+
token: string;
|
|
218
|
+
}
|
|
219
|
+
/** `push@1`: native push registration (mobile shells). */
|
|
220
|
+
export interface PushCapabilityV1 {
|
|
221
|
+
status(): Promise<PushStatus>;
|
|
222
|
+
/** User activation only when permission is "prompt"; rejects { code: "cancelled" } when denied. */
|
|
223
|
+
register(): Promise<PushRegistration>;
|
|
224
|
+
/** Tells the shell the deployment's registration id for this install. */
|
|
225
|
+
registered(id: string): Promise<void>;
|
|
226
|
+
unregister(): Promise<void>;
|
|
227
|
+
}
|
|
@@ -18,4 +18,5 @@ export const SHELL_CAPABILITIES = [
|
|
|
18
18
|
{ key: "menu@1", owner: "mobile app spec (2026-11-20-mobile-app-design.md), §5.2" },
|
|
19
19
|
{ key: "nav@1", owner: "mobile app spec (2026-11-20-mobile-app-design.md), §5.2" },
|
|
20
20
|
{ key: "profiles@1", owner: "mobile app spec (2026-11-20-mobile-app-design.md), §5.2" },
|
|
21
|
+
{ key: "push@1", owner: "mobile app spec (2026-11-20-mobile-app-design.md), §5.2 and §9" },
|
|
21
22
|
];
|
package/package.json
CHANGED