pombus 0.1.4 → 0.1.5
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/dist/i18n.js +12 -0
- package/dist/init.js +20 -5
- package/dist/server.js +1 -1
- package/package.json +1 -1
package/dist/i18n.js
CHANGED
|
@@ -70,6 +70,16 @@ const MESSAGES = {
|
|
|
70
70
|
"pt-BR": "Esse domínio ainda não está verificado no seu espaço do Pombus. Verifique em Domínios e rode o init de novo.",
|
|
71
71
|
"es-419": "Ese dominio aún no está verificado en tu espacio de Pombus. Verifícalo en Dominios y vuelve a ejecutar init.",
|
|
72
72
|
},
|
|
73
|
+
init_inbox_limit: {
|
|
74
|
+
"en-US": "Your plan's inbox limit is reached. Delete an inbox or upgrade your plan in Pombus, then run init again.",
|
|
75
|
+
"pt-BR": "Você chegou ao limite de caixas do seu plano. Apague uma caixa ou mude de plano no Pombus e rode o init de novo.",
|
|
76
|
+
"es-419": "Llegaste al límite de casillas de tu plan. Borra una casilla o cambia de plan en Pombus y vuelve a ejecutar init.",
|
|
77
|
+
},
|
|
78
|
+
init_inbox_missing_permission: {
|
|
79
|
+
"en-US": "This API key cannot create inboxes. Use a key with the inbox-create permission (Pombus › Keys), or drop --create-inbox.",
|
|
80
|
+
"pt-BR": "Esta chave de API não pode criar caixas. Use uma chave com a permissão de criar caixa (Pombus › Chaves) ou tire o --create-inbox.",
|
|
81
|
+
"es-419": "Esta clave de API no puede crear casillas. Usa una clave con el permiso de crear casilla (Pombus › Claves) o quita --create-inbox.",
|
|
82
|
+
},
|
|
73
83
|
init_config_written: {
|
|
74
84
|
"en-US": "MCP config written for ",
|
|
75
85
|
"pt-BR": "Config MCP gravada para ",
|
|
@@ -119,6 +129,8 @@ const INSTALLER_CODES = [
|
|
|
119
129
|
"init_inbox_bad_domain",
|
|
120
130
|
"init_inbox_platform_domain",
|
|
121
131
|
"init_inbox_domain_not_verified",
|
|
132
|
+
"init_inbox_limit",
|
|
133
|
+
"init_inbox_missing_permission",
|
|
122
134
|
"init_config_written",
|
|
123
135
|
"init_key_power",
|
|
124
136
|
"init_restart_client",
|
package/dist/init.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
// and is reused. The function takes its side-effects as injected dependencies (key source, fetch,
|
|
7
7
|
// HOME, output sink) so a test drives the whole flow against a fake core and a temp HOME without
|
|
8
8
|
// ever touching real stdin/stdout/disk.
|
|
9
|
+
import { domainToASCII } from "node:url";
|
|
9
10
|
import { CoreClient, CoreError } from "./client.js";
|
|
10
11
|
import { ScopeBinding } from "./scope.js";
|
|
11
12
|
import { clientTargets, printableCodexToml, printableJson, writeJsonConfig, ConfigWriteError, } from "./clients.js";
|
|
@@ -20,11 +21,12 @@ export async function runInit(opts) {
|
|
|
20
21
|
const say = (code, suffix = "") => out(humanMessage(code, locale) + suffix);
|
|
21
22
|
// --create-inbox needs --domain: an extra inbox only exists on a verified domain of your own. Refuse
|
|
22
23
|
// BEFORE the key prompt and any request, with the rule spelled out (the core would answer a bare 403).
|
|
23
|
-
const
|
|
24
|
-
if (opts.createInbox && !
|
|
24
|
+
const rawDomain = (opts.domain ?? "").trim();
|
|
25
|
+
if (opts.createInbox && !rawDomain) {
|
|
25
26
|
say("init_inbox_needs_domain");
|
|
26
27
|
throw new InitAbort("init_inbox_needs_domain");
|
|
27
28
|
}
|
|
29
|
+
const domain = normalizeDomain(rawDomain);
|
|
28
30
|
if (opts.createInbox && !looksLikeDomain(domain)) {
|
|
29
31
|
say("init_inbox_bad_domain");
|
|
30
32
|
throw new InitAbort("init_inbox_bad_domain");
|
|
@@ -51,7 +53,7 @@ export async function runInit(opts) {
|
|
|
51
53
|
created = await client.post("/inboxes", { domain });
|
|
52
54
|
}
|
|
53
55
|
catch (e) {
|
|
54
|
-
// The
|
|
56
|
+
// The refusals a person can act on (INBOX_REFUSALS) get their own line (the key was fine — /auth/me passed
|
|
55
57
|
// above). Anything else rethrows to the CLI's generic handler.
|
|
56
58
|
const why = e instanceof CoreError ? (e.coreCode ?? e.code) : "";
|
|
57
59
|
const human = INBOX_REFUSALS[why];
|
|
@@ -174,12 +176,25 @@ function emptyPrintResult() {
|
|
|
174
176
|
printedFor: [],
|
|
175
177
|
};
|
|
176
178
|
}
|
|
177
|
-
/** The core's create-inbox refusals a person can act on -> their human line. `platform_inbox_not_allowed
|
|
178
|
-
*
|
|
179
|
+
/** The core's create-inbox refusals a person can act on -> their human line. `platform_inbox_not_allowed`,
|
|
180
|
+
* `inbox_limit` and `missing_permission` arrive as a 403 (collapsed to not_found, real code in coreCode);
|
|
181
|
+
* `domain_not_verified` as a 422. */
|
|
179
182
|
const INBOX_REFUSALS = {
|
|
180
183
|
platform_inbox_not_allowed: "init_inbox_platform_domain",
|
|
181
184
|
domain_not_verified: "init_inbox_domain_not_verified",
|
|
185
|
+
inbox_limit: "init_inbox_limit",
|
|
186
|
+
missing_permission: "init_inbox_missing_permission",
|
|
182
187
|
};
|
|
188
|
+
/** `--domain` as the core stores it: lowercase, no trailing dot, IDN in punycode (`café.com` ->
|
|
189
|
+
* `xn--caf-dma.com`). ASCII is restricted to letters/digits/dot/hyphen BEFORE the conversion, because
|
|
190
|
+
* `domainToASCII` parses a URL host and would silently cut `acme.com/x` down to `acme.com`. The caller
|
|
191
|
+
* passes it already trimmed. */
|
|
192
|
+
export function normalizeDomain(raw) {
|
|
193
|
+
const d = raw.toLowerCase();
|
|
194
|
+
if (!/^[a-z0-9.\-\u{80}-\u{10ffff}]+$/u.test(d))
|
|
195
|
+
return "";
|
|
196
|
+
return domainToASCII(d).replace(/\.$/, "");
|
|
197
|
+
}
|
|
183
198
|
/** A basic domain-name shape (labels of letters/digits/hyphens, a dot, a TLD) — catches a typo or a flag
|
|
184
199
|
* swallowed as the value BEFORE any request. The core is the authority on whether it is verified. */
|
|
185
200
|
function looksLikeDomain(d) {
|
package/dist/server.js
CHANGED
|
@@ -13,7 +13,7 @@ import { CoreClient, CoreError, readApiKey } from "./client.js";
|
|
|
13
13
|
import { ScopeBinding, ScopeError } from "./scope.js";
|
|
14
14
|
import { specByName, toolDescriptors, callTool, callOrgTool, isOrgTool, ToolArgError, } from "./tools.js";
|
|
15
15
|
const SERVER_NAME = "pombus";
|
|
16
|
-
const SERVER_VERSION = "0.1.
|
|
16
|
+
const SERVER_VERSION = "0.1.5";
|
|
17
17
|
/** Build and connect the MCP server over stdio. Fails fast (before connecting) when the key is absent,
|
|
18
18
|
* so a misconfigured client sees a clear stderr line instead of a server that answers every tool with
|
|
19
19
|
* an auth error. */
|
package/package.json
CHANGED