@every-app/sdk 0.2.0 → 0.3.0-rc.10
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/LICENSE +21 -0
- package/README.md +609 -3
- package/dist/cloudflare/catalogSettings.generated.d.ts +81 -0
- package/dist/cloudflare/catalogSettings.generated.d.ts.map +1 -0
- package/dist/cloudflare/catalogSettings.generated.js +174 -0
- package/dist/cloudflare/index.d.ts +23 -0
- package/dist/cloudflare/index.d.ts.map +1 -0
- package/dist/cloudflare/index.js +24 -0
- package/dist/cloudflare/sentinel.d.ts +127 -0
- package/dist/cloudflare/sentinel.d.ts.map +1 -0
- package/dist/cloudflare/sentinel.js +85 -0
- package/dist/cloudflare/worker.d.ts +805 -0
- package/dist/cloudflare/worker.d.ts.map +1 -0
- package/dist/cloudflare/worker.js +997 -0
- package/dist/dev/index.d.ts +8 -0
- package/dist/dev/index.d.ts.map +1 -0
- package/dist/dev/index.js +7 -0
- package/dist/dev/keypair.d.ts +26 -0
- package/dist/dev/keypair.d.ts.map +1 -0
- package/dist/dev/keypair.js +62 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/internal/aiDefault.d.ts +204 -0
- package/dist/internal/aiDefault.d.ts.map +1 -0
- package/dist/internal/aiDefault.js +334 -0
- package/dist/internal/aiProviders.d.ts +72 -0
- package/dist/internal/aiProviders.d.ts.map +1 -0
- package/dist/internal/aiProviders.js +233 -0
- package/dist/internal/appSettings.d.ts +315 -0
- package/dist/internal/appSettings.d.ts.map +1 -0
- package/dist/internal/appSettings.js +549 -0
- package/dist/internal/audit.d.ts +108 -0
- package/dist/internal/audit.d.ts.map +1 -0
- package/dist/internal/audit.js +235 -0
- package/dist/internal/capabilities.d.ts +3174 -0
- package/dist/internal/capabilities.d.ts.map +1 -0
- package/dist/internal/capabilities.js +1110 -0
- package/dist/internal/catalog/commerce.d.ts +394 -0
- package/dist/internal/catalog/commerce.d.ts.map +1 -0
- package/dist/internal/catalog/commerce.js +477 -0
- package/dist/internal/catalog/comms.d.ts +375 -0
- package/dist/internal/catalog/comms.d.ts.map +1 -0
- package/dist/internal/catalog/comms.js +520 -0
- package/dist/internal/catalog/index.d.ts +1973 -0
- package/dist/internal/catalog/index.d.ts.map +1 -0
- package/dist/internal/catalog/index.js +19 -0
- package/dist/internal/catalog/inference.d.ts +393 -0
- package/dist/internal/catalog/inference.d.ts.map +1 -0
- package/dist/internal/catalog/inference.js +460 -0
- package/dist/internal/catalog/infra.d.ts +423 -0
- package/dist/internal/catalog/infra.d.ts.map +1 -0
- package/dist/internal/catalog/infra.js +543 -0
- package/dist/internal/catalog/search.d.ts +400 -0
- package/dist/internal/catalog/search.d.ts.map +1 -0
- package/dist/internal/catalog/search.js +463 -0
- package/dist/internal/devProviders.d.ts +49 -0
- package/dist/internal/devProviders.d.ts.map +1 -0
- package/dist/internal/devProviders.js +80 -0
- package/dist/internal/email.d.ts +280 -0
- package/dist/internal/email.d.ts.map +1 -0
- package/dist/internal/email.js +613 -0
- package/dist/internal/events.d.ts +193 -0
- package/dist/internal/events.d.ts.map +1 -0
- package/dist/internal/events.js +367 -0
- package/dist/internal/gatewaySettings.d.ts +83 -0
- package/dist/internal/gatewaySettings.d.ts.map +1 -0
- package/dist/internal/gatewaySettings.js +215 -0
- package/dist/internal/identity.d.ts +57 -5
- package/dist/internal/identity.d.ts.map +1 -1
- package/dist/internal/identity.js +99 -22
- package/dist/internal/index.d.ts +22 -1
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +22 -1
- package/dist/internal/members.d.ts +36 -0
- package/dist/internal/members.d.ts.map +1 -0
- package/dist/internal/members.js +7 -0
- package/dist/internal/oauthClient.d.ts +61 -0
- package/dist/internal/oauthClient.d.ts.map +1 -0
- package/dist/internal/oauthClient.js +133 -0
- package/dist/internal/oauthPresets.d.ts +33 -0
- package/dist/internal/oauthPresets.d.ts.map +1 -0
- package/dist/internal/oauthPresets.js +1064 -0
- package/dist/internal/oauthScopes.d.ts +172 -0
- package/dist/internal/oauthScopes.d.ts.map +1 -0
- package/dist/internal/oauthScopes.js +510 -0
- package/dist/internal/oauthSpec.d.ts +102 -0
- package/dist/internal/oauthSpec.d.ts.map +1 -0
- package/dist/internal/oauthSpec.js +789 -0
- package/dist/internal/organizationName.d.ts +18 -0
- package/dist/internal/organizationName.d.ts.map +1 -0
- package/dist/internal/organizationName.js +24 -0
- package/dist/internal/protocol.d.ts +150 -3
- package/dist/internal/protocol.d.ts.map +1 -1
- package/dist/internal/protocol.js +163 -2
- package/dist/internal/providerApps.d.ts +75 -0
- package/dist/internal/providerApps.d.ts.map +1 -0
- package/dist/internal/providerApps.js +59 -0
- package/dist/internal/providerRegistry.d.ts +218 -0
- package/dist/internal/providerRegistry.d.ts.map +1 -0
- package/dist/internal/providerRegistry.js +432 -0
- package/dist/internal/providerSpec.d.ts +66 -0
- package/dist/internal/providerSpec.d.ts.map +1 -0
- package/dist/internal/providerSpec.js +1154 -0
- package/dist/internal/remoteMcp.d.ts +188 -0
- package/dist/internal/remoteMcp.d.ts.map +1 -0
- package/dist/internal/remoteMcp.js +543 -0
- package/dist/internal/signInProviders.d.ts +104 -0
- package/dist/internal/signInProviders.d.ts.map +1 -0
- package/dist/internal/signInProviders.js +245 -0
- package/dist/internal/tools.d.ts +115 -0
- package/dist/internal/tools.d.ts.map +1 -0
- package/dist/internal/tools.js +80 -0
- package/dist/manifest.d.ts +238 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +30 -0
- package/dist/server/ai.d.ts +111 -0
- package/dist/server/ai.d.ts.map +1 -0
- package/dist/server/ai.js +145 -0
- package/dist/server/aiBinding.d.ts +68 -0
- package/dist/server/aiBinding.d.ts.map +1 -0
- package/dist/server/aiBinding.js +294 -0
- package/dist/server/attribution.d.ts +43 -0
- package/dist/server/attribution.d.ts.map +1 -0
- package/dist/server/attribution.js +75 -0
- package/dist/server/authorizeUrl.d.ts +43 -0
- package/dist/server/authorizeUrl.d.ts.map +1 -0
- package/dist/server/authorizeUrl.js +106 -0
- package/dist/server/connectUrl.d.ts +21 -0
- package/dist/server/connectUrl.d.ts.map +1 -0
- package/dist/server/connectUrl.js +37 -0
- package/dist/server/context.d.ts +68 -0
- package/dist/server/context.d.ts.map +1 -0
- package/dist/server/context.js +117 -0
- package/dist/server/emailBinding.d.ts +72 -0
- package/dist/server/emailBinding.d.ts.map +1 -0
- package/dist/server/emailBinding.js +124 -0
- package/dist/server/emit.d.ts +63 -0
- package/dist/server/emit.d.ts.map +1 -0
- package/dist/server/emit.js +101 -0
- package/dist/server/env.d.ts +44 -0
- package/dist/server/env.d.ts.map +1 -0
- package/dist/server/env.js +1 -0
- package/dist/server/everyApp.d.ts +65 -19
- package/dist/server/everyApp.d.ts.map +1 -1
- package/dist/server/everyApp.js +195 -30
- package/dist/server/fromMcpTools.d.ts +89 -0
- package/dist/server/fromMcpTools.d.ts.map +1 -0
- package/dist/server/fromMcpTools.js +192 -0
- package/dist/server/gatewayFetch.d.ts +54 -14
- package/dist/server/gatewayFetch.d.ts.map +1 -1
- package/dist/server/gatewayFetch.js +201 -37
- package/dist/server/gatewayUrl.d.ts +13 -0
- package/dist/server/gatewayUrl.d.ts.map +1 -0
- package/dist/server/gatewayUrl.js +34 -0
- package/dist/server/index.d.ts +23 -3
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +19 -2
- package/dist/server/integrationFetch.d.ts +162 -0
- package/dist/server/integrationFetch.d.ts.map +1 -0
- package/dist/server/integrationFetch.js +688 -0
- package/dist/server/listMembers.d.ts +32 -0
- package/dist/server/listMembers.d.ts.map +1 -0
- package/dist/server/listMembers.js +71 -0
- package/dist/server/nodeServer.d.ts +48 -0
- package/dist/server/nodeServer.d.ts.map +1 -0
- package/dist/server/nodeServer.js +45 -0
- package/dist/server/refusal.d.ts +55 -0
- package/dist/server/refusal.d.ts.map +1 -0
- package/dist/server/refusal.js +193 -0
- package/dist/server/sendEmail.d.ts +39 -0
- package/dist/server/sendEmail.d.ts.map +1 -0
- package/dist/server/sendEmail.js +114 -0
- package/dist/server/tools.d.ts +184 -0
- package/dist/server/tools.d.ts.map +1 -0
- package/dist/server/tools.js +347 -0
- package/dist/server/toolsEndpoint.d.ts +32 -0
- package/dist/server/toolsEndpoint.d.ts.map +1 -0
- package/dist/server/toolsEndpoint.js +237 -0
- package/dist/tanstack-start/index.d.ts +9 -0
- package/dist/tanstack-start/index.d.ts.map +1 -0
- package/dist/tanstack-start/index.js +29 -0
- package/dist/testing/index.d.ts +93 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +156 -0
- package/package.json +42 -8
- package/dist/server/mcp.d.ts +0 -66
- package/dist/server/mcp.d.ts.map +0 -1
- package/dist/server/mcp.js +0 -147
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an app needs set before it works, and whether it is: the model
|
|
3
|
+
* behind "needs setup" wherever an app is shown (the gateway's home and
|
|
4
|
+
* Admin → Apps, `everyapp status`, `everyapp secret list`, the end of
|
|
5
|
+
* `everyapp deploy`, and what `everyapp configure <app>` walks through).
|
|
6
|
+
*
|
|
7
|
+
* A manifest declares three kinds of setting. An AI provider
|
|
8
|
+
* (`providers`) and a capability (`capabilities`) are the Gateway's: their
|
|
9
|
+
* keys and clients live on the Gateway Worker, set once for every app
|
|
10
|
+
* with `everyapp secret set <NAME>`. The app's own secrets (`secrets`)
|
|
11
|
+
* live on its Worker, set from its directory. Each declaration carries a
|
|
12
|
+
* need: required (the default; the app doesn't open until it is set),
|
|
13
|
+
* optional (the app opens, and the feature says what is missing where it
|
|
14
|
+
* is used), or a member of a named any-of group (the app opens once any
|
|
15
|
+
* member is set; only for an app that picks among the set members at run
|
|
16
|
+
* time). Each may say `why` it is needed and where it comes from
|
|
17
|
+
* (`docs`, an https URL); for providers and capabilities the registries
|
|
18
|
+
* here supply a default. An app's plain settings (`settings`: a host, a
|
|
19
|
+
* project id, a region) are held like its secrets, on its Worker, but are
|
|
20
|
+
* values rather than keys: each says what it takes (a URL, a number, one
|
|
21
|
+
* of a list) and may give a default.
|
|
22
|
+
*
|
|
23
|
+
* Everything in this module is pure and tenant-neutral: a manifest ships
|
|
24
|
+
* in a release, and what is set is asked of the caller (`isSet`), which
|
|
25
|
+
* reads the Gateway's env, cf's secret list, or the registry's record of
|
|
26
|
+
* the app Worker's secret names.
|
|
27
|
+
*/
|
|
28
|
+
import { type ApiKeyCapability, type CapabilityLookup } from "./capabilities.js";
|
|
29
|
+
import { type IsSet } from "./aiDefault.js";
|
|
30
|
+
/** A provider as `providers` lists it: its id, or an entry with a need. */
|
|
31
|
+
export interface ProviderEntry extends SettingNeedFields {
|
|
32
|
+
id: string;
|
|
33
|
+
}
|
|
34
|
+
/** A secret as `secrets` lists it: its name, or an entry with a need. */
|
|
35
|
+
export interface SecretEntry extends SettingNeedFields {
|
|
36
|
+
name: string;
|
|
37
|
+
}
|
|
38
|
+
/** What a plain setting's value is: text by default, or a URL, a number, a switch. */
|
|
39
|
+
export type SettingValueType = "text" | "url" | "number" | "boolean";
|
|
40
|
+
/**
|
|
41
|
+
* An app's plain setting as `settings` lists it: a value that isn't a
|
|
42
|
+
* secret (a PostHog host, a project id, a region) and differs per
|
|
43
|
+
* install, set like a secret with `everyapp configure <app>` and read
|
|
44
|
+
* from `env` as a string.
|
|
45
|
+
*/
|
|
46
|
+
export interface SettingEntry {
|
|
47
|
+
name: string;
|
|
48
|
+
why?: string;
|
|
49
|
+
docs?: string;
|
|
50
|
+
optional?: boolean;
|
|
51
|
+
/** What it takes; `text` when not given. */
|
|
52
|
+
type?: SettingValueType;
|
|
53
|
+
/** The values it may take, for a `text` setting that is one of a list. */
|
|
54
|
+
values?: readonly string[];
|
|
55
|
+
/** What the deploy sets it to while nobody has set it. */
|
|
56
|
+
default?: string;
|
|
57
|
+
}
|
|
58
|
+
/** What a plain setting's value must be: what `configure` checks and every surface says. */
|
|
59
|
+
export interface SettingValueRule {
|
|
60
|
+
type: SettingValueType;
|
|
61
|
+
values?: string[];
|
|
62
|
+
default?: string;
|
|
63
|
+
}
|
|
64
|
+
/** What any declaration may say about its need. */
|
|
65
|
+
export interface SettingNeedFields {
|
|
66
|
+
/** Why the app needs it, for whoever sets it (200 characters at most). */
|
|
67
|
+
why?: string;
|
|
68
|
+
/** Where the key or client comes from: an https URL. */
|
|
69
|
+
docs?: string;
|
|
70
|
+
/** The app works without it; the feature using it says so where it is used. */
|
|
71
|
+
optional?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* For an app's own secret: its setup guide, relative to the everyapp
|
|
74
|
+
* skill (`setup/main-secret.md`). Providers and capabilities take theirs
|
|
75
|
+
* from the registries and can't override it.
|
|
76
|
+
*/
|
|
77
|
+
setup?: string;
|
|
78
|
+
/**
|
|
79
|
+
* The name of a group of which one set member is enough ("AI model").
|
|
80
|
+
* Only for an app that picks among the set members at run time: the
|
|
81
|
+
* gateway refuses a call to a provider whose key isn't set, whichever
|
|
82
|
+
* others are.
|
|
83
|
+
*/
|
|
84
|
+
anyOf?: string;
|
|
85
|
+
}
|
|
86
|
+
/** The manifest fields this module reads, as a stored or authored manifest has them. */
|
|
87
|
+
export interface SettingsManifestLike {
|
|
88
|
+
readonly providers?: ReadonlyArray<string | ProviderEntry>;
|
|
89
|
+
readonly capabilities?: {
|
|
90
|
+
readonly [id: string]: unknown;
|
|
91
|
+
};
|
|
92
|
+
readonly secrets?: ReadonlyArray<string | SecretEntry>;
|
|
93
|
+
readonly settings?: ReadonlyArray<SettingEntry>;
|
|
94
|
+
readonly ai?: {
|
|
95
|
+
readonly routes?: readonly string[];
|
|
96
|
+
/** The app needs the Gateway's default chat model (`/api/ai/default`): `true`, or an entry with its need. */
|
|
97
|
+
readonly chat?: boolean | SettingNeedFields;
|
|
98
|
+
};
|
|
99
|
+
/** A remote MCP app's registration (./remoteMcp.ts): its credential is a required Gateway setting. */
|
|
100
|
+
readonly remote?: unknown;
|
|
101
|
+
readonly name?: string;
|
|
102
|
+
}
|
|
103
|
+
export type SettingKind = "provider" | "capability" | "secret"
|
|
104
|
+
/** An app's plain setting (`settings`): a value on its Worker, not a key. */
|
|
105
|
+
| "setting" | "ai-routes"
|
|
106
|
+
/** The Gateway's default model provider (`ai.chat`): one key of any provider in the order, or the operator's choice. */
|
|
107
|
+
| "ai-default"
|
|
108
|
+
/** A remote MCP app's credential (./remoteMcp.ts): one Gateway setting named by the row. */
|
|
109
|
+
| "remote-mcp";
|
|
110
|
+
/** Which Worker holds a setting: the Gateway's, or the app's own. */
|
|
111
|
+
export type SettingHolder = "gateway" | "app";
|
|
112
|
+
export type SettingNeed = {
|
|
113
|
+
kind: "required";
|
|
114
|
+
} | {
|
|
115
|
+
kind: "optional";
|
|
116
|
+
} | {
|
|
117
|
+
kind: "anyOf";
|
|
118
|
+
group: string;
|
|
119
|
+
};
|
|
120
|
+
/** What `appSettings` may be told about the Gateway, for the default model provider. */
|
|
121
|
+
export interface AppSettingsOptions {
|
|
122
|
+
/** The operator's stored default provider (`everyapp ai default`), or none. */
|
|
123
|
+
aiDefault?: string | null;
|
|
124
|
+
/** What is set, to put the configured provider first; absent, the order decides. */
|
|
125
|
+
isSet?: IsSet;
|
|
126
|
+
}
|
|
127
|
+
/** One thing the app needs set, as the manifest declares it. */
|
|
128
|
+
export interface AppSetting {
|
|
129
|
+
kind: SettingKind;
|
|
130
|
+
/** The provider id, capability id or secret name; "ai-routes" for the AI proxy's extra routes. */
|
|
131
|
+
id: string;
|
|
132
|
+
/** "OpenRouter", "DataForSEO", "MAIN_SECRET", "AI proxy routes". */
|
|
133
|
+
label: string;
|
|
134
|
+
holder: SettingHolder;
|
|
135
|
+
/** Every one of these must be set for the setting to count as set (or any one group of `alternatives`). */
|
|
136
|
+
names: string[];
|
|
137
|
+
/**
|
|
138
|
+
* For the default model provider: the settings of each provider that
|
|
139
|
+
* could serve it, any one group of which, all set, makes the setting
|
|
140
|
+
* set; `names` is the first group, what to ask for.
|
|
141
|
+
*/
|
|
142
|
+
alternatives?: string[][];
|
|
143
|
+
/** Read when set, never required (a capability's optional settings). */
|
|
144
|
+
alsoReads: string[];
|
|
145
|
+
need: SettingNeed;
|
|
146
|
+
why?: string;
|
|
147
|
+
docs?: string;
|
|
148
|
+
/**
|
|
149
|
+
* The everyapp skill's setup guide for it, relative to the skill
|
|
150
|
+
* (`setup/dataforseo.md`; in an app `.claude/skills/everyapp/setup/…`, in
|
|
151
|
+
* the checkout `packages/cli/skills/everyapp/setup/…`): what an agent
|
|
152
|
+
* reads to set it up end to end. From the registries for providers and
|
|
153
|
+
* capabilities; from the manifest entry for an app's own secret.
|
|
154
|
+
*/
|
|
155
|
+
setup?: string;
|
|
156
|
+
/**
|
|
157
|
+
* What the key is and where it comes from, in a sentence or three, from
|
|
158
|
+
* the provider's entry (its `hint`, and each secret's own after it):
|
|
159
|
+
* what the "Needs setup" dialog, `everyapp status` and `everyapp
|
|
160
|
+
* configure` show beside `why`. A provider registered on the gateway
|
|
161
|
+
* has no guide, so this is what an agent reads for it.
|
|
162
|
+
*/
|
|
163
|
+
hint?: string;
|
|
164
|
+
/**
|
|
165
|
+
* For an app's plain setting (`kind: "setting"`): what its value must
|
|
166
|
+
* be, and its default. A setting without one is a credential, never
|
|
167
|
+
* shown.
|
|
168
|
+
*/
|
|
169
|
+
value?: SettingValueRule;
|
|
170
|
+
}
|
|
171
|
+
/** A setting with whether it is set, and whether that keeps the app closed. */
|
|
172
|
+
export interface EvaluatedSetting extends AppSetting {
|
|
173
|
+
/**
|
|
174
|
+
* True: every name is set. False: one isn't. Null: not known (an app
|
|
175
|
+
* Worker whose secret names were never recorded), which never blocks.
|
|
176
|
+
*/
|
|
177
|
+
set: boolean | null;
|
|
178
|
+
/** This setting keeps the app from opening: required and unset, or a member of an any-of group none of whose members is set. */
|
|
179
|
+
blocking: boolean;
|
|
180
|
+
}
|
|
181
|
+
/** An any-of group: met once any member is set. */
|
|
182
|
+
export interface AnyOfGroup {
|
|
183
|
+
group: string;
|
|
184
|
+
members: EvaluatedSetting[];
|
|
185
|
+
met: boolean;
|
|
186
|
+
}
|
|
187
|
+
/** What `evaluateAppSettings` finds: whether the app opens, and every setting's state. */
|
|
188
|
+
export interface AppSettingsReport {
|
|
189
|
+
/** No required setting is unset and every any-of group is met. */
|
|
190
|
+
ready: boolean;
|
|
191
|
+
/** Every setting, in manifest order: providers, capabilities, the AI routes, secrets. */
|
|
192
|
+
settings: EvaluatedSetting[];
|
|
193
|
+
groups: AnyOfGroup[];
|
|
194
|
+
/** The settings that keep the app closed, in manifest order. */
|
|
195
|
+
unmet: EvaluatedSetting[];
|
|
196
|
+
}
|
|
197
|
+
/** The need an entry declares; required unless it says otherwise. */
|
|
198
|
+
export declare function needOf(entry: SettingNeedFields | undefined): SettingNeed;
|
|
199
|
+
/** The providers the manifest lists, each as an entry whatever form it took. */
|
|
200
|
+
export declare function providerEntries(manifest: Pick<SettingsManifestLike, "providers">): ProviderEntry[];
|
|
201
|
+
/** The provider ids the manifest lists, in order. */
|
|
202
|
+
export declare function providerIds(manifest: Pick<SettingsManifestLike, "providers">): string[];
|
|
203
|
+
/** The app's own secrets the manifest lists, each as an entry whatever form it took. */
|
|
204
|
+
export declare function secretEntries(manifest: Pick<SettingsManifestLike, "secrets">): SecretEntry[];
|
|
205
|
+
/** The names of the app's own secrets, in order. */
|
|
206
|
+
export declare function secretNames(manifest: Pick<SettingsManifestLike, "secrets">): string[];
|
|
207
|
+
/** The app's plain settings the manifest lists, each as an entry. */
|
|
208
|
+
export declare function settingEntries(manifest: Pick<SettingsManifestLike, "settings">): SettingEntry[];
|
|
209
|
+
/** The names of the app's plain settings, in order. */
|
|
210
|
+
export declare function settingNames(manifest: Pick<SettingsManifestLike, "settings">): string[];
|
|
211
|
+
/**
|
|
212
|
+
* Every name the manifest puts on the app's own Workers: its secrets,
|
|
213
|
+
* then its plain settings. What `secret set` routes to the app and what
|
|
214
|
+
* `apps.secret_names` records.
|
|
215
|
+
*/
|
|
216
|
+
export declare function appWorkerNames(manifest: Pick<SettingsManifestLike, "secrets" | "settings">): string[];
|
|
217
|
+
/** A plain setting's rule, from its entry. */
|
|
218
|
+
export declare function settingValueRule(entry: SettingEntry): SettingValueRule;
|
|
219
|
+
/**
|
|
220
|
+
* What a plain setting takes, completing "Takes …": "an http or https
|
|
221
|
+
* URL", "one of us or eu", with ", default <value>" when it has one.
|
|
222
|
+
*/
|
|
223
|
+
export declare function settingValueTakes(rule: SettingValueRule): string;
|
|
224
|
+
/**
|
|
225
|
+
* Why `value` won't do for a plain setting (one sentence), or null when
|
|
226
|
+
* it will: never empty, and of its type, or one of its values exactly.
|
|
227
|
+
*/
|
|
228
|
+
export declare function settingValueProblem(rule: Pick<SettingValueRule, "type" | "values">, value: string): string | null;
|
|
229
|
+
/**
|
|
230
|
+
* Every setting the manifest declares, in manifest order: its AI
|
|
231
|
+
* providers, its capabilities, the AI proxy's extra routes when `ai.routes`
|
|
232
|
+
* asks for any, then the app's own secrets. A provider or capability the
|
|
233
|
+
* gateway doesn't offer contributes nothing (the manifest validator refuses
|
|
234
|
+
* it elsewhere); so does a capability with nothing to set (`members`),
|
|
235
|
+
* which is always set. `lookup` is where ids are found: the catalog alone
|
|
236
|
+
* by default, or a gateway's registry with its registered rows.
|
|
237
|
+
*/
|
|
238
|
+
export declare function appSettings(manifest: SettingsManifestLike, lookup?: CapabilityLookup, options?: AppSettingsOptions): AppSetting[];
|
|
239
|
+
export interface EvaluateOptions {
|
|
240
|
+
/**
|
|
241
|
+
* A capability's own readiness rule, where names alone don't say (the
|
|
242
|
+
* gateway's email is configured once a sender parses and a provider is
|
|
243
|
+
* selectable): a boolean or null overrides the names; undefined defers
|
|
244
|
+
* to them.
|
|
245
|
+
*/
|
|
246
|
+
readiness?: (setting: AppSetting) => boolean | null | undefined;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Every setting against what is set. `isSet` answers per holder and name:
|
|
250
|
+
* true, false, or null when it can't tell (the registry never recorded
|
|
251
|
+
* the app Worker's secret names), which never blocks. An any-of group is
|
|
252
|
+
* met once any member is set; while none is and none is unknown, every
|
|
253
|
+
* member blocks.
|
|
254
|
+
*/
|
|
255
|
+
export declare function evaluateAppSettings(settings: readonly AppSetting[], isSet: (holder: SettingHolder, name: string) => boolean | null, options?: EvaluateOptions): AppSettingsReport;
|
|
256
|
+
/** The one command that opens the app. */
|
|
257
|
+
export interface SetupCommand {
|
|
258
|
+
/**
|
|
259
|
+
* `everyapp configure <app>`: asks for every required setting the app
|
|
260
|
+
* lacks, then offers the optional ones, and sets each where it is held.
|
|
261
|
+
*/
|
|
262
|
+
command: string;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* What to run for an app that needs setup: `everyapp configure <app>`,
|
|
266
|
+
* which reads the app's manifest (from the registry, so it runs from
|
|
267
|
+
* anywhere), prompts for each unmet setting (one member of an any-of group
|
|
268
|
+
* is enough: it asks which) and sets them where they are held. Null when
|
|
269
|
+
* the app is ready. `cli` is how the operator runs everyapp (`pnpm
|
|
270
|
+
* everyapp` from a checkout). Scripts that set one name at a time use
|
|
271
|
+
* `everyapp secret set NAME [--app <id>]` instead.
|
|
272
|
+
*
|
|
273
|
+
* A provider app (`provider`: the gateway's own, with no Worker and no
|
|
274
|
+
* directory; `everyapp mcp on <id>`, an MCP app) has nothing to configure: its
|
|
275
|
+
* command is the `secret set` of its Gateway key (the first member of an
|
|
276
|
+
* unmet any-of group), as `mcp list` says it.
|
|
277
|
+
*/
|
|
278
|
+
export declare function setupCommand(report: Pick<AppSettingsReport, "unmet" | "groups">, { cli, appId, provider, }: {
|
|
279
|
+
cli: string;
|
|
280
|
+
appId: string;
|
|
281
|
+
provider?: boolean;
|
|
282
|
+
}): SetupCommand | null;
|
|
283
|
+
/** One setting as `AppSetup` carries it: the evaluation without what only the CLI reads. */
|
|
284
|
+
export type AppSetupSetting = Omit<EvaluatedSetting, "alsoReads">;
|
|
285
|
+
/**
|
|
286
|
+
* An app's setup state as every surface shows it, the same on the
|
|
287
|
+
* gateway's app lists (`setup`), `everyapp status --json`
|
|
288
|
+
* (`apps[].setup`) and `everyapp secret list --json`: whether it opens,
|
|
289
|
+
* every setting with its state, the any-of groups, and the one command
|
|
290
|
+
* that opens it, `everyapp configure <app>` (null when it is ready, or
|
|
291
|
+
* when whoever reads this can't run it: a shared app seen from another
|
|
292
|
+
* organization).
|
|
293
|
+
*/
|
|
294
|
+
export interface AppSetup {
|
|
295
|
+
ready: boolean;
|
|
296
|
+
settings: AppSetupSetting[];
|
|
297
|
+
unmet: AppSetupSetting[];
|
|
298
|
+
groups: Array<{
|
|
299
|
+
group: string;
|
|
300
|
+
met: boolean;
|
|
301
|
+
members: string[];
|
|
302
|
+
}>;
|
|
303
|
+
command: SetupCommand | null;
|
|
304
|
+
}
|
|
305
|
+
export declare function appSetupOf(report: AppSettingsReport, options: {
|
|
306
|
+
cli: string;
|
|
307
|
+
appId: string;
|
|
308
|
+
withCommand?: boolean;
|
|
309
|
+
provider?: boolean;
|
|
310
|
+
}): AppSetup;
|
|
311
|
+
/** The provider registry's labels, for anything that names a provider to a person. */
|
|
312
|
+
export declare function providerLabel(id: string, lookup?: CapabilityLookup): string;
|
|
313
|
+
/** The capability `id` names in `lookup`, as an API-key provider, or undefined. */
|
|
314
|
+
export declare function apiKeyCapabilityOf(id: string, lookup?: CapabilityLookup): ApiKeyCapability | undefined;
|
|
315
|
+
//# sourceMappingURL=appSettings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appSettings.d.ts","sourceRoot":"","sources":["../../src/internal/appSettings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAKL,KAAK,gBAAgB,EAErB,KAAK,gBAAgB,EACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAIL,KAAK,KAAK,EACX,MAAM,gBAAgB,CAAC;AAWxB,2EAA2E;AAC3E,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD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