Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(skill-market): report an unanswered resolver as such, not as a policy refusal

vastsa906f619f2d84
diff --git a/apps/desktop/electron/main/ipc/skills-ipc.ts b/apps/desktop/electron/main/ipc/skills-ipc.ts
index fc60a2409..4a09adbdf 100644
--- a/apps/desktop/electron/main/ipc/skills-ipc.ts
+++ b/apps/desktop/electron/main/ipc/skills-ipc.ts
@@ -9,7 +9,11 @@ import {
type SkillMarketDocument,
type SkillMarketSearchResult,
} from "../skill-market-catalog";
-import { skillMarketFailureDetail, skillMarketHost } from "../skill-market-scan";
+import {
+ skillMarketFailureDetail,
+ type SkillMarketFailureDetail,
+ type SkillMarketFailureKind,
+} from "../skill-market-scan";
import type { IpcRegistrar } from "./types";
export type SkillsIpcDependencies = {
@@ -47,26 +51,48 @@ export function registerSkillsIpc({
refuses a URL the browser reaches) was therefore impossible to diagnose
from a user's logs. `diagnostics` is the category spec 09 gives to blocked
requests; the payload is host + source + kind only, never the full URL.
+
+ `reason` and `addressKind` were added for the same issue: "the resolver
+ answered nothing" and "the resolved address is not public" need different
+ fixes, and a single `kind` could not tell them apart in a report.
*/
- const logSourceFailure = (
- source: { name?: unknown; url?: unknown },
- kind: "policy" | "network",
- ) => {
- const host = skillMarketHost(source.url);
+ /**
+ * The code a refusal is logged under. Two codes, because the guard refuses
+ * for two different reasons: a judged address is a policy decision
+ * (`NETWORK_POLICY_BLOCKED`), while a resolver that answered nothing is an
+ * environment condition (`NETWORK_RESOLVE_FAILED`). A plain transport failure
+ * carries no code, as before.
+ */
+ const refusalCode = (kind: SkillMarketFailureKind): string | undefined => {
+ if (kind === "policy") return ErrorCodes.NETWORK_POLICY_BLOCKED;
+ if (kind === "unresolved") return ErrorCodes.NETWORK_RESOLVE_FAILED;
+ return undefined;
+ };
+ const logSourceFailure = (name: string, detail: SkillMarketFailureDetail) => {
+ const code = refusalCode(detail.kind);
logger.app("diagnostics", "warn", "skill market source produced no entries", {
- ...(kind === "policy" ? { code: ErrorCodes.NETWORK_POLICY_BLOCKED } : {}),
+ ...(code ? { code } : {}),
event: "skillMarket.sourceFailed",
data: {
- ...(typeof source.name === "string" && source.name ? { source: source.name } : {}),
- ...(host ? { host } : {}),
- kind,
+ ...(name ? { source: name } : {}),
+ ...(detail.host ? { host: detail.host } : {}),
+ kind: detail.kind,
+ ...(detail.reason ? { reason: detail.reason } : {}),
+ ...(detail.addressKind ? { addressKind: detail.addressKind } : {}),
},
});
};
- const marketFailureKind = (
- result: SkillMarketSearchResult,
- name: string,
- ): "policy" | "network" => (result.failureKinds?.[name] === "policy" ? "policy" : "network");
+ /**
+ * What one failed source reports. `failureDetails` carries the host and the
+ * guard's own reason; `failureKinds` is the earlier name-only view, kept so a
+ * result that predates the details still logs a kind rather than nothing.
+ */
+ const marketFailure = (result: SkillMarketSearchResult, name: string): SkillMarketFailureDetail => {
+ const detail = result.failureDetails?.[name];
+ if (detail) return detail;
+ const kind = result.failureKinds?.[name];
+ return { kind: kind === "policy" || kind === "unresolved" ? kind : "network" };
+ };
let host: HostProcess | null = null;
const handle = (channel: string, fn: (...args: any[]) => Promise<any>) => {
registrar.handle(channel, async (...args) => {
@@ -86,10 +112,7 @@ export function registerSkillsIpc({
// One record per source that produced nothing. The panel shows the names,
// so without this the reason and the host exist nowhere a user can reach.
for (const name of result.failedSources ?? []) {
- logSourceFailure(
- requested.find((source) => source?.name === name) ?? { name },
- marketFailureKind(result, name),
- );
+ logSourceFailure(name, marketFailure(result, name));
}
return result;
},
@@ -103,8 +126,9 @@ export function registerSkillsIpc({
// The install sheet shows this refusal; the log is what makes it
// diagnosable after the fact, and it survives the sheet closing.
const detail = skillMarketFailureDetail(entry, error);
+ const code = refusalCode(detail.kind);
logger.app("diagnostics", "warn", "skill market document fetch failed", {
- ...(detail.kind === "policy" ? { code: ErrorCodes.NETWORK_POLICY_BLOCKED } : {}),
+ ...(code ? { code } : {}),
event: "skillMarket.documentFailed",
data: detail,
});
diff --git a/apps/desktop/electron/main/public-https-fetch.ts b/apps/desktop/electron/main/public-https-fetch.ts
index 4f717fb17..f23bb2e1f 100644
--- a/apps/desktop/electron/main/public-https-fetch.ts
+++ b/apps/desktop/electron/main/public-https-fetch.ts
@@ -2,9 +2,12 @@ import { lookup as dnsLookup } from "node:dns/promises";
import {
ErrorCodes,
PUBLIC_NETWORK_POLICY_ERROR,
- isPublicIpLiteral,
+ classifyIpLiteral,
isPublicNetworkPolicyFailure,
isSafePublicHttpsUrl,
+ publicNetworkRefusalReason,
+ type PublicNetworkAddressKind,
+ type PublicNetworkRefusalReason,
} from "@pi-desktop/shared";
const DEFAULT_TIMEOUT_MS = 8_000;
@@ -18,16 +21,52 @@ export type PublicHttpsFetch = (
export type PublicHttpsLookup = (host: string) => Promise<Array<{ address: string }>>;
+/** The resolver's own error code, for the log line. Never its message. */
+function resolverCode(error: unknown): string {
+ const code = (error as { code?: unknown } | null | undefined)?.code;
+ return typeof code === "string" && /^[A-Z0-9_]{1,32}$/.test(code) ? ` (${code})` : "";
+}
+
+/** The structured description of a refusal; see `PublicNetworkRefusalReason`. */
+export type PublicNetworkRefusal = {
+ reason: PublicNetworkRefusalReason;
+ /** The hostname the guard was classifying, when it got that far. */
+ host?: string;
+ /** The address that failed the policy (`non-public-address` only). */
+ address?: string;
+ /** That address's class — `benchmark` for a TUN fake-IP, `private` for RFC1918. */
+ addressKind?: PublicNetworkAddressKind;
+};
+
export class PublicNetworkPolicyError extends Error {
readonly code = "PUBLIC_NETWORK_POLICY";
/**
* Stable code the IPC wrapper forwards to the renderer, so a policy refusal
- * can be told apart from an ordinary network failure (spec 08 §3.1).
+ * can be told apart from an ordinary network failure (spec 08 §3.1). A
+ * refusal that judged no address reports `NETWORK_RESOLVE_FAILED`: "the local
+ * resolver had no answer" and "the resolved address is not public" need
+ * different fixes, so they must not share one explanation (issue #419).
*/
- readonly errorCode = ErrorCodes.NETWORK_POLICY_BLOCKED;
- constructor(message: string) {
+ readonly errorCode: string;
+ /** Which refusal this is, so a caller can explain it without parsing text. */
+ readonly reason: PublicNetworkRefusalReason;
+ /** The hostname the refusal is about, when the guard knows it. */
+ readonly host?: string;
+ /** The address that made this a refusal (`non-public-address` only). */
+ readonly address?: string;
+ /** The class of `address`, not just the address: it names the cause. */
+ readonly addressKind?: PublicNetworkAddressKind;
+ constructor(message: string, refusal: PublicNetworkRefusal = { reason: "non-public-address" }) {
super(message);
this.name = PUBLIC_NETWORK_POLICY_ERROR;
+ this.reason = refusal.reason;
+ this.host = refusal.host;
+ this.address = refusal.address;
+ this.addressKind = refusal.addressKind;
+ this.errorCode =
+ refusal.reason === "resolve-failed"
+ ? ErrorCodes.NETWORK_RESOLVE_FAILED
+ : ErrorCodes.NETWORK_POLICY_BLOCKED;
}
}
@@ -44,6 +83,11 @@ export type PublicHttpsClient = {
* Main-process HTTPS client: syntactic guard, DNS classification, and
* per-hop re-validation of redirects. Fetch and lookup are injectable so
* tests can exercise the policy without Electron or the network.
+ *
+ * Every branch still fails closed. The structured `reason` and the
+ * `NETWORK_RESOLVE_FAILED` code change what the app can *say* about a block —
+ * which host, and whether an address was judged at all — never whether it
+ * blocks (issue #419).
*/
export function createPublicHttpsClient(options: {
fetchImpl: PublicHttpsFetch;
@@ -57,15 +101,41 @@ export function createPublicHttpsClient(options: {
async function assertPublicUrl(url: string): Promise<void> {
if (!isSafePublicHttpsUrl(url)) {
- throw new PublicNetworkPolicyError(`url rejected by the public-network policy: ${url}`);
+ throw new PublicNetworkPolicyError(`url rejected by the public-network policy: ${url}`, {
+ reason: "url-syntax",
+ });
}
const host = new URL(url).hostname.toLowerCase().replace(/\.+$/, "");
if (host.startsWith("[") || /^\d{1,3}(\.\d{1,3}){3}$/.test(host)) return;
- const addresses = await lookupImpl(host);
- if (!addresses.length) throw new PublicNetworkPolicyError(`hostname does not resolve: ${host}`);
+ let addresses: Array<{ address: string }>;
+ try {
+ addresses = await lookupImpl(host);
+ } catch (error) {
+ // Node's resolver throws (ENOTFOUND, EAI_AGAIN, a stub that refuses)
+ // instead of returning an empty answer, so a proxied, split-horizon or
+ // offline resolver lands here. Nothing was classified: still refused, but
+ // this is the absence of a verdict, not a verdict on an address (#419).
+ throw new PublicNetworkPolicyError(`hostname does not resolve: ${host}${resolverCode(error)}`, {
+ reason: "resolve-failed",
+ host,
+ });
+ }
+ if (!addresses.length) {
+ throw new PublicNetworkPolicyError(`hostname does not resolve: ${host}`, {
+ reason: "resolve-failed",
+ host,
+ });
+ }
for (const address of addresses) {
- if (!isPublicIpLiteral(address.address)) {
- throw new PublicNetworkPolicyError(`hostname resolves to a private address: ${host} -> ${address.address}`);
+ const addressKind = classifyIpLiteral(address.address);
+ if (addressKind !== "public") {
+ // The class travels with the refusal: `benchmark` is a TUN fake-IP
+ // (198.18.0.0/15) and `private` is a real RFC1918 target, and only the
+ // class tells those apart in the log and in the panel.
+ throw new PublicNetworkPolicyError(
+ `hostname resolves to a non-public address: ${host} -> ${address.address} (${addressKind})`,
+ { reason: "non-public-address", host, address: address.address, addressKind },
+ );
}
}
}
@@ -87,7 +157,7 @@ export function createPublicHttpsClient(options: {
if (!response.ok) throw new Error(`responded ${response.status}`);
return kind === "json" ? ((await response.json()) as unknown) : await response.text();
}
- throw new PublicNetworkPolicyError("too many redirects");
+ throw new PublicNetworkPolicyError("too many redirects", { reason: "redirect-limit" });
}
async function request(url: string, kind: "json" | "text"): Promise<unknown> {
@@ -97,7 +167,14 @@ export function createPublicHttpsClient(options: {
return await requestOnce(url, kind);
} catch (error) {
lastError = error;
- if (isPublicNetworkPolicyError(error) || attempt === MAX_ATTEMPTS - 1) throw error;
+ // A refusal the guard decided is final: a syntax rejection, a
+ // non-public address, a redirect loop. A resolver that answered nothing
+ // is not final — every attempt re-classifies from scratch, so a
+ // transient DNS failure can still succeed inside this loop.
+ const settled =
+ isPublicNetworkPolicyError(error) &&
+ publicNetworkRefusalReason(error) !== "resolve-failed";
+ if (settled || attempt === MAX_ATTEMPTS - 1) throw error;
}
}
throw lastError;
diff --git a/apps/desktop/electron/main/skill-market-scan.ts b/apps/desktop/electron/main/skill-market-scan.ts
index aeee16678..35e6e9996 100644
--- a/apps/desktop/electron/main/skill-market-scan.ts
+++ b/apps/desktop/electron/main/skill-market-scan.ts
@@ -5,11 +5,14 @@
* (the public-HTTPS client). One failing source only costs itself.
*/
import {
- isPublicNetworkPolicyFailure,
+ PUBLIC_NETWORK_POLICY_ERROR,
isSafeSkillSourceUrl,
+ publicNetworkRefusalDetail,
sanitizeSkillCatalogId,
splitSkillDocument,
validateSkillCatalogFile,
+ type PublicNetworkAddressKind,
+ type PublicNetworkRefusalReason,
type SkillCatalogCategory,
type SkillCatalogEntry,
type SkillMarketSource,
@@ -18,21 +21,52 @@ import {
export type CatalogRequest = (url: string, kind: "json" | "text") => Promise<unknown>;
-/** Why a source failed: the public-network guard refused it, or it errored. */
-export type SkillMarketFailureKind = "policy" | "network";
+/**
+ * Why a source failed. `policy` means the guard judged an address (or the URL
+ * itself) and refused it. `unresolved` means the local resolver produced no
+ * answer at all, so nothing was judged — an environment condition that a proxy
+ * or a working resolver fixes, and that must never be reported as an
+ * address-check block (issue #419). `network` is everything else.
+ */
+export type SkillMarketFailureKind = "policy" | "unresolved" | "network";
+
+/** Everything the panel and the log may say about one failed source. */
+export type SkillMarketFailureDetail = {
+ kind: SkillMarketFailureKind;
+ /**
+ * The host that actually failed. For a GitHub scan that is `api.github.com`
+ * or `cdn.jsdelivr.net`, not the repository URL the user typed, so the
+ * diagnostics name the host the guard really refused.
+ */
+ host?: string;
+ /** The guard's structured reason, when a guard refusal produced this. */
+ reason?: PublicNetworkRefusalReason;
+ /**
+ * The class of the address that failed a policy check — `benchmark` for a TUN
+ * fake-IP, `private` for RFC1918, `loopback` for a redirect to localhost. The
+ * class is what tells a resolver artifact apart from a real private target.
+ * The address itself is deliberately not carried.
+ */
+ addressKind?: PublicNetworkAddressKind;
+};
export type SkillMarketSearchResult = {
entries: SourcedSkillEntry[];
failedSources: string[];
/**
* `failedSources` alone cannot tell the user why the market went quiet. Keyed
- * by the same display name so the panel can explain a policy refusal (the
- * local DNS lookup could not classify the host, which is what a proxy that
- * answers DNS itself produces) apart from a source that is merely
- * unreachable. Repeated names collapse, exactly as they already do in
- * `failedSources`.
+ * by the same display name so the panel can explain a policy refusal apart
+ * from a source that is merely unreachable, or from a host the *local
+ * resolver* never answered. Repeated names collapse, exactly as they already
+ * do in `failedSources`, keeping the most specific explanation.
*/
failureKinds: Record<string, SkillMarketFailureKind>;
+ /**
+ * The same keys as `failureKinds`, with the host and the structured reason —
+ * what the panel and the diagnostics log need to name the refused host
+ * instead of just the source label (issue #419).
+ */
+ failureDetails: Record<string, SkillMarketFailureDetail>;
};
export type SkillMarketDocument = {
@@ -53,8 +87,11 @@ const SKILL_FILE = /(?:^|\/)SKILL\.md$/;
*/
export function classifySkillMarketFailure(error: unknown): SkillMarketFailureKind {
// Structural check so this module keeps no dependency on the client's
- // `node:dns` import and stays testable as a pure module.
- return isPublicNetworkPolicyFailure(error) ? "policy" : "network";
+ // `node:dns` import and stays testable as a pure module. A refusal that
+ // cannot name its reason is still a refusal, so it stays `policy`.
+ const refusal = publicNetworkRefusalDetail(error);
+ if (!refusal) return "network";
+ return refusal.reason === "resolve-failed" ? "unresolved" : "policy";
}
/**
@@ -72,22 +109,39 @@ export function skillMarketHost(url: unknown): string | undefined {
}
/**
- * The diagnostics payload for one failed catalog source. Built here, not at the
- * call site, so the shape is unit-testable without Electron and so every
- * failure record carries the same fields.
+ * The diagnostics payload for one failed source. Built here, not at the call
+ * site, so the shape is unit-testable without Electron and so every failure
+ * record carries the same fields.
*/
export function skillMarketFailureDetail(
source: { name?: unknown; url?: unknown },
error: unknown,
-): { source?: string; host?: string; kind: SkillMarketFailureKind } {
- const host = skillMarketHost(source.url);
+): { source?: string; host?: string; kind: SkillMarketFailureKind } & Omit<
+ SkillMarketFailureDetail,
+ "kind" | "host"
+> {
+ const refusal = publicNetworkRefusalDetail(error);
+ // A guard refusal knows the host it was classifying, which is the host that
+ // actually failed. The source URL is only a fallback: a GitHub `owner/repo`
+ // source is scanned through `api.github.com`, and naming the repository's
+ // host there would point the user at a host that was never refused.
+ const host = refusal?.host ?? skillMarketHost(source.url);
return {
...(typeof source.name === "string" && source.name ? { source: source.name } : {}),
...(host ? { host } : {}),
kind: classifySkillMarketFailure(error),
+ ...(refusal ? { reason: refusal.reason } : {}),
+ ...(refusal?.addressKind ? { addressKind: refusal.addressKind } : {}),
};
}
+/** The most specific explanation wins when one display name maps to two sources. */
+const FAILURE_RANK: Record<SkillMarketFailureKind, number> = {
+ network: 0,
+ unresolved: 1,
+ policy: 2,
+};
+
const SKILL_CATEGORY_KEYWORDS: ReadonlyArray<readonly [SkillCatalogCategory, string[]]> = [
["data", ["data", "sql", "database", "postgres", "mongo", "redis", "analytics", "dataset", "spreadsheet", "excel", "xlsx", "csv", "dashboard", "chart", "visualization"]],
["workflow", ["workflow", "review", "planning", "brainstorm", "checklist", "process", "sop", "handoff", "standup", "retro", "discernment", "verification", "triage", "audit", "security", "incident"]],
@@ -212,14 +266,27 @@ export function createSkillMarketAggregator(request: CatalogRequest) {
const failedSources = refused.map((source) => source.name);
// Two sources can carry the same display name (a default source and a user
// source with the same label), and `failedSources` already cannot tell such
- // a pair apart. The refusal is the one worth surfacing, so `policy` wins
- // the merge. A `Map` plus `Object.fromEntries` also keeps a source called
- // `__proto__` from disappearing into the prototype.
- const failures = new Map<string, SkillMarketFailureKind>();
- const markFailure = (name: string, kind: SkillMarketFailureKind) => {
- failures.set(name, failures.get(name) === "policy" || kind === "policy" ? "policy" : "network");
+ // a pair apart. The most specific explanation is the one worth surfacing,
+ // so `FAILURE_RANK` decides the merge. A `Map` plus `Object.fromEntries`
+ // also keeps a source called `__proto__` from disappearing into the
+ // prototype.
+ const details = new Map<string, SkillMarketFailureDetail>();
+ const markFailure = (name: string, detail: SkillMarketFailureDetail) => {
+ const current = details.get(name);
+ if (!current || FAILURE_RANK[detail.kind] > FAILURE_RANK[current.kind]) {
+ details.set(name, detail);
+ }
};
- for (const source of refused) markFailure(source.name, "policy");
+ for (const source of refused) {
+ // Nothing left the process, so the syntactic check is the reason and the
+ // source URL is the only host this refusal is allowed to name.
+ const host = skillMarketHost(source.url);
+ markFailure(source.name, {
+ kind: "policy",
+ reason: "url-syntax",
+ ...(host ? { host } : {}),
+ });
+ }
const settled = await Promise.allSettled(
usable.map(async (source) => {
const entries = await loadSource(source);
@@ -235,9 +302,16 @@ export function createSkillMarketAggregator(request: CatalogRequest) {
const seen = new Set<string>();
settled.forEach((result, index) => {
if (result.status === "rejected") {
- const name = usable[index].name;
- failedSources.push(name);
- markFailure(name, classifySkillMarketFailure(result.reason));
+ const source = usable[index];
+ failedSources.push(source.name);
+ const refusal = publicNetworkRefusalDetail(result.reason);
+ const host = refusal?.host ?? skillMarketHost(source.url);
+ markFailure(source.name, {
+ kind: classifySkillMarketFailure(result.reason),
+ ...(host ? { host } : {}),
+ ...(refusal ? { reason: refusal.reason } : {}),
+ ...(refusal?.addressKind ? { addressKind: refusal.addressKind } : {}),
+ });
return;
}
for (const entry of result.value) {
@@ -246,11 +320,25 @@ export function createSkillMarketAggregator(request: CatalogRequest) {
entries.push(entry);
}
});
- return { entries, failedSources, failureKinds: Object.fromEntries(failures) };
+ return {
+ entries,
+ failedSources,
+ failureKinds: Object.fromEntries([...details].map(([name, detail]) => [name, detail.kind])),
+ failureDetails: Object.fromEntries(details),
+ };
}
async function fetchEntryDocument(entry: SkillCatalogEntry): Promise<SkillMarketDocument> {
- if (!isSafeSkillSourceUrl(entry.url)) throw new Error("document url must be a public https address");
+ if (!isSafeSkillSourceUrl(entry.url)) {
+ // A document URL the syntactic guard refuses is a decision about the URL,
+ // not a dead host. Carrying the shared name and reason means the one
+ // classifier reports it as the policy refusal it is, instead of telling
+ // the user the document was unreachable.
+ throw Object.assign(new Error("document url must be a public https address"), {
+ name: PUBLIC_NETWORK_POLICY_ERROR,
+ reason: "url-syntax" satisfies PublicNetworkRefusalReason,
+ });
+ }
return fetchDocument(entry.url);
}
diff --git a/apps/desktop/src/components/settings/SkillMarketPanel.tsx b/apps/desktop/src/components/settings/SkillMarketPanel.tsx
index 3039fc41b..bc84e9bd9 100644
--- a/apps/desktop/src/components/settings/SkillMarketPanel.tsx
+++ b/apps/desktop/src/components/settings/SkillMarketPanel.tsx
@@ -30,6 +30,7 @@ import { LatestWinsGate } from "../../lib/latest-wins";
import {
classifySkillMarketFailure,
hasPolicyFailure,
+ hasUnresolvedFailure,
skillMarketFailureDetail,
type SkillMarketFailureKind,
} from "../../lib/skill-market-failure";
@@ -63,12 +64,23 @@ function CategoryGlyph({ entry, size }: { entry: SkillCatalogEntry; size: number
type MarketItem = SkillCatalogEntry & { sourceId?: string };
+/**
+ * The part of a failed source's detail the list renders: the host the guard was
+ * classifying, the guard's own reason, and the class of address it refused. The
+ * main process sends these so the panel can name the refused host instead of
+ * only the source label — a policy refusal is a statement about one address
+ * (issue #419). The address itself is never sent.
+ */
+type RemoteFailureDetail = { host?: string; reason?: string; addressKind?: string };
+
type RemoteState = {
status: "idle" | "loading" | "ready" | "error";
entries: MarketItem[];
failed: string[];
/** Why each named source failed, so a policy/DNS refusal can be explained. */
failureKinds: Record<string, SkillMarketFailureKind>;
+ /** Which host each of those names points at, so the refusal can name it. */
+ failureDetails: Record<string, RemoteFailureDetail>;
/**
* Query-level failure reason (bridge or preload unavailable). Such a rejection
* carries no per-source detail, and it used to be discarded with no trace.
@@ -81,6 +93,7 @@ const REMOTE_IDLE: RemoteState = {
entries: [],
failed: [],
failureKinds: {},
+ failureDetails: {},
queryError: "",
};
@@ -176,6 +189,7 @@ export function SkillMarketPanel({
entries: current.entries,
failed: current.failed,
failureKinds: current.failureKinds,
+ failureDetails: current.failureDetails,
queryError: current.queryError,
}
: current,
@@ -191,6 +205,7 @@ export function SkillMarketPanel({
entries,
failed,
failureKinds: result.failureKinds ?? {},
+ failureDetails: result.failureDetails ?? {},
queryError: "",
});
}
@@ -202,6 +217,7 @@ export function SkillMarketPanel({
entries: [],
failed: [],
failureKinds: {},
+ failureDetails: {},
queryError: skillMarketFailureDetail(error),
});
}
@@ -324,14 +340,28 @@ export function SkillMarketPanel({
setDraftSource({ name: "", url: "" });
};
- // A bare `remoteError` could not tell a policy refusal from a dead host, so
- // the two now carry different copy and the policy case gets the proxy hint.
+ // A bare `remoteError` could not tell a policy refusal from a dead host, and
+ // one `policy` bucket could not tell an address the guard *judged* from a
+ // resolver that never answered at all. The three now carry different copy,
+ // and each failure names the host it is about.
const remoteErrorText = () => {
if (remote.queryError) return t("settings.sklm.remoteErrorQuery");
if (hasPolicyFailure(remote.failureKinds)) return t("settings.sklm.remoteErrorPolicy");
+ if (hasUnresolvedFailure(remote.failureKinds)) return t("settings.sklm.remoteErrorUnresolved");
return t("settings.sklm.remoteError");
};
+ /**
+ * One label per failed source, naming the host the guard actually classified
+ * when the main process reported one. A source label alone ("anthropics/skills")
+ * cannot say what was refused, and for a refusal the host *is* the message.
+ */
+ const failedSourceLabels = () =>
+ remote.failed.map((name) => {
+ const host = remote.failureDetails[name]?.host;
+ return host ? t("settings.sklm.failureSourceHost", { name, host }) : name;
+ });
+
const sourcesSheet = sourcesOpen ? (
<div
className="overlay ext-sheet-overlay sklm-overlay"
@@ -483,7 +513,9 @@ export function SkillMarketPanel({
{t(
previewFailure.kind === "policy"
? "settings.sklm.previewPolicyError"
- : "settings.sklm.previewError",
+ : previewFailure.kind === "unresolved"
+ ? "settings.sklm.previewResolveError"
+ : "settings.sklm.previewError",
)}
</p>
) : (
@@ -492,6 +524,9 @@ export function SkillMarketPanel({
{previewFailure?.kind === "policy" ? (
<p className="sklm-note">{t("settings.sklm.proxyHint")}</p>
) : null}
+ {previewFailure?.kind === "unresolved" ? (
+ <p className="sklm-note">{t("settings.sklm.dnsHint")}</p>
+ ) : null}
{previewFailure?.detail ? (
<p className="sklm-note">
<span className="sklm-note-label">{t("settings.sklm.failureDetail")}</span>
@@ -584,8 +619,10 @@ export function SkillMarketPanel({
<>
<p className="sklm-status is-error" role="status">
{remoteErrorText()}
- {remote.failed.length ? ` (${remote.failed.join(", ")})` : ""}
</p>
+ {remote.failed.length ? (
+ <p className="sklm-status">{failedSourceLabels().join(", ")}</p>
+ ) : null}
{remote.queryError ? (
<p className="sklm-status">
<span className="sklm-note-label">{t("settings.sklm.failureDetail")}</span>
@@ -595,16 +632,22 @@ export function SkillMarketPanel({
{hasPolicyFailure(remote.failureKinds) ? (
<p className="sklm-status">{t("settings.sklm.proxyHint")}</p>
) : null}
+ {hasUnresolvedFailure(remote.failureKinds) ? (
+ <p className="sklm-status">{t("settings.sklm.dnsHint")}</p>
+ ) : null}
</>
) : null}
{remote.status === "ready" && remote.failed.length ? (
<>
<p className="sklm-status">
- {t("settings.sklm.remotePartial", { names: remote.failed.join(", ") })}
+ {t("settings.sklm.remotePartial", { names: failedSourceLabels().join(", ") })}
</p>
{hasPolicyFailure(remote.failureKinds) ? (
<p className="sklm-status">{t("settings.sklm.proxyHint")}</p>
) : null}
+ {hasUnresolvedFailure(remote.failureKinds) ? (
+ <p className="sklm-status">{t("settings.sklm.dnsHint")}</p>
+ ) : null}
</>
) : null}
diff --git a/apps/desktop/src/lib/api.ts b/apps/desktop/src/lib/api.ts
index ddfac9746..6f09b3c3f 100644
--- a/apps/desktop/src/lib/api.ts
+++ b/apps/desktop/src/lib/api.ts
@@ -734,7 +734,13 @@ export const api = {
* Why each named source failed, so the market can explain a policy/DNS
* refusal instead of reporting every source as merely unreachable.
*/
- failureKinds?: Record<string, "policy" | "network">;
+ failureKinds?: Record<string, "policy" | "unresolved" | "network">;
+ /**
+ * The host and the guard's own reason behind each failed source. Without
+ * it the panel can say a source was refused but not *what* was refused,
+ * and a policy refusal is a statement about one address (issue #419).
+ */
+ failureDetails?: Record<string, { host?: string; reason?: string; addressKind?: string }>;
}>(IPC.invoke.skillMarketSearch, { query, sources }),
/** Fetch one catalog document (frontmatter split off) for preview/install. */
fetchSkillMarketDocument: (entry: SkillCatalogEntry) =>
diff --git a/apps/desktop/src/lib/skill-market-failure.ts b/apps/desktop/src/lib/skill-market-failure.ts
index 233496580..a887a2850 100644
--- a/apps/desktop/src/lib/skill-market-failure.ts
+++ b/apps/desktop/src/lib/skill-market-failure.ts
@@ -4,21 +4,27 @@ import { ErrorCodes } from "@pi-desktop/shared";
* Why a skill market request failed, as far as the renderer can tell.
*
* `policy` means the main process refused the fetch inside its public-network
- * guard, so the request never reached the network. The guard classifies the
- * host with a *local* DNS lookup, while the request itself would have gone
- * through the configured proxy (ADR 0177, ADR 0243). A user behind a proxy or
- * TUN resolver that answers DNS itself — Clash fake-IP in `198.18.0.0/15`, a
- * corporate split resolver, an offline resolver — gets a policy refusal for a
- * URL that opens fine in their browser. That distinction is the whole point of
- * surfacing this: it tells the user to look at the proxy setting instead of
- * assuming the source is down.
+ * guard, and that refusal judged an address (or the URL itself): a verdict that
+ * the destination is not a public host.
+ *
+ * `unresolved` means the guard reached no verdict at all — the local DNS lookup
+ * returned no answer. The guard classifies the host with a *local* resolver,
+ * while the request itself would have gone through the configured proxy
+ * (ADR 0177, ADR 0243). A user behind a proxy or TUN resolver that answers DNS
+ * itself — Clash fake-IP in `198.18.0.0/15`, a corporate split resolver, an
+ * offline resolver — can hit either case, and the two need different advice:
+ * one is about the destination, the other about the resolver. Keeping them
+ * apart is the whole point of surfacing this instead of one generic failure
+ * (issue #419).
*/
-export type SkillMarketFailureKind = "policy" | "network";
+export type SkillMarketFailureKind = "policy" | "unresolved" | "network";
/** Classify a rejected `api.fetchSkillMarketDocument` / search call. */
export function classifySkillMarketFailure(error: unknown): SkillMarketFailureKind {
const code = (error as { code?: unknown } | null | undefined)?.code;
- return code === ErrorCodes.NETWORK_POLICY_BLOCKED ? "policy" : "network";
+ if (code === ErrorCodes.NETWORK_POLICY_BLOCKED) return "policy";
+ if (code === ErrorCodes.NETWORK_RESOLVE_FAILED) return "unresolved";
+ return "network";
}
/**
@@ -34,9 +40,19 @@ export function skillMarketFailureDetail(error: unknown): string {
}
/**
- * Whether a list of failed sources contains at least one policy refusal, which
- * is what makes the app-level proxy hint worth showing.
+ * Whether a list of failed sources contains at least one policy refusal — a
+ * verdict on an address — which is what makes the address-check explanation and
+ * its resolver hint worth showing.
*/
export function hasPolicyFailure(kinds: Record<string, unknown> | undefined): boolean {
return Object.values(kinds ?? {}).includes("policy");
}
+
+/**
+ * Whether any source failed because the local resolver had no answer. Always
+ * checked *after* `hasPolicyFailure`: when both are present the panel leads with
+ * the stronger, address-level refusal.
+ */
+export function hasUnresolvedFailure(kinds: Record<string, unknown> | undefined): boolean {
+ return Object.values(kinds ?? {}).includes("unresolved");
+}
diff --git a/apps/desktop/test/public-https-fetch.test.mjs b/apps/desktop/test/public-https-fetch.test.mjs
index d9ff5846e..f9ba5f0f9 100644
--- a/apps/desktop/test/public-https-fetch.test.mjs
+++ b/apps/desktop/test/public-https-fetch.test.mjs
@@ -16,14 +16,18 @@ function jsonResponse(status, body, location) {
};
}
-test("rejects a hostname that resolves to a private address", async () => {
+test("rejects a hostname that resolves to a non-public address", async () => {
const client = createPublicHttpsClient({
fetchImpl: async () => jsonResponse(200, { ok: true }),
lookupImpl: async () => [{ address: "10.0.0.8" }],
});
await assert.rejects(
() => client.request("https://evil.example/catalog.json", "json"),
- (error) => error instanceof PublicNetworkPolicyError && /private address/.test(error.message),
+ (error) =>
+ error instanceof PublicNetworkPolicyError &&
+ /non-public address/.test(error.message) &&
+ error.reason === "non-public-address" &&
+ error.addressKind === "private",
);
});
@@ -86,9 +90,11 @@ test("does not retry policy failures", async () => {
});
test("a policy refusal carries the stable error code the renderer classifies on", async () => {
- // Issue #419: the renderer can only tell a local-DNS policy refusal (what a
- // proxied user hits) from an ordinary failure by this code, because `wrap()`
- // forwards nothing but code and message across the IPC boundary.
+ // Issue #419: the renderer can only tell a guard refusal from an ordinary
+ // failure by this code, because `wrap()` forwards nothing but code and
+ // message across the IPC boundary. A fake-IP answer is an address the guard
+ // judged, so it keeps the policy code — and now also says which class of
+ // address it judged.
const client = createPublicHttpsClient({
fetchImpl: async () => jsonResponse(200, { ok: true }),
lookupImpl: async () => [{ address: "198.18.0.4" }],
@@ -98,7 +104,11 @@ test("a policy refusal carries the stable error code the renderer classifies on"
(error) =>
error instanceof PublicNetworkPolicyError &&
error.errorCode === ErrorCodes.NETWORK_POLICY_BLOCKED &&
- /private address/.test(error.message),
+ error.reason === "non-public-address" &&
+ error.addressKind === "benchmark" &&
+ error.host === "cdn.jsdelivr.net" &&
+ /non-public address/.test(error.message) &&
+ /benchmark/.test(error.message),
);
});
diff --git a/apps/desktop/test/skill-market-failure.test.mjs b/apps/desktop/test/skill-market-failure.test.mjs
index b8abf6d66..89f670de9 100644
--- a/apps/desktop/test/skill-market-failure.test.mjs
+++ b/apps/desktop/test/skill-market-failure.test.mjs
@@ -4,6 +4,7 @@ import { ErrorCodes } from "@pi-desktop/shared";
import {
classifySkillMarketFailure,
hasPolicyFailure,
+ hasUnresolvedFailure,
skillMarketFailureDetail,
} from "../src/lib/skill-market-failure.ts";
@@ -11,18 +12,30 @@ import {
* Regression cover for issue #419: behind a proxy the main process can refuse a
* skill market fetch inside its local-DNS public-network guard, and the install
* sheet used to swallow that rejection and leave the install button disabled
- * with no reason. The renderer can only tell the two cases apart by the stable
- * error code the IPC wrapper forwards, so that mapping is what gets pinned here.
+ * with no reason. The renderer can only tell the cases apart by the stable error
+ * code the IPC wrapper forwards, so that mapping is what gets pinned here.
+ *
+ * Two refusals, not one: an address the guard *judged* is a policy decision,
+ * while a resolver that answered nothing never reached a verdict. Reporting the
+ * second as the first is what told a proxied user their sources were "blocked by
+ * the app's address check" when no address had been classified.
*/
-test("a policy refusal is told apart from an ordinary network failure", () => {
- const policy = Object.assign(new Error("hostname resolves to a private address: api.github.com -> 198.18.0.4"), {
- code: ErrorCodes.NETWORK_POLICY_BLOCKED,
+test("a judged address, an unanswered resolver and a dead host are three cases", () => {
+ const judged = Object.assign(
+ new Error("hostname resolves to a non-public address: api.github.com -> 198.18.0.4 (benchmark)"),
+ { code: ErrorCodes.NETWORK_POLICY_BLOCKED },
+ );
+ assert.equal(classifySkillMarketFailure(judged), "policy");
+
+ const unresolved = Object.assign(new Error("hostname does not resolve: api.github.com (ENOTFOUND)"), {
+ code: ErrorCodes.NETWORK_RESOLVE_FAILED,
});
- assert.equal(classifySkillMarketFailure(policy), "policy");
+ assert.equal(classifySkillMarketFailure(unresolved), "unresolved");
for (const other of [
Object.assign(new Error("responded 502"), { code: ErrorCodes.INTERNAL }),
+ Object.assign(new Error("responded 403"), { code: ErrorCodes.RATE_LIMITED }),
Object.assign(new Error("responded 404"), { code: ErrorCodes.NOT_FOUND }),
new Error("no code at all"),
"a bare string",
@@ -34,18 +47,28 @@ test("a policy refusal is told apart from an ordinary network failure", () => {
});
test("the sheet keeps the main-process reason and never invents one", () => {
- const policy = Object.assign(new Error("hostname does not resolve: api.github.com"), {
- code: ErrorCodes.NETWORK_POLICY_BLOCKED,
+ const unresolved = Object.assign(new Error("hostname does not resolve: api.github.com"), {
+ code: ErrorCodes.NETWORK_RESOLVE_FAILED,
});
- assert.equal(skillMarketFailureDetail(policy), "hostname does not resolve: api.github.com");
+ assert.equal(skillMarketFailureDetail(unresolved), "hostname does not resolve: api.github.com");
assert.equal(skillMarketFailureDetail("plain"), "plain");
assert.equal(skillMarketFailureDetail(undefined), "");
assert.equal(skillMarketFailureDetail({}), "");
});
-test("the app-level proxy hint appears only when a source was actually refused", () => {
+test("the two hints are chosen by cause, not by failure count", () => {
+ // An address-level refusal is the stronger statement and leads; a resolver
+ // that answered nothing gets the resolver hint instead. Neither may claim the
+ // other's cause.
assert.equal(hasPolicyFailure({ "anthropics/skills": "policy" }), true);
+ assert.equal(hasPolicyFailure({ "anthropics/skills": "unresolved" }), false);
assert.equal(hasPolicyFailure({ "anthropics/skills": "network" }), false);
assert.equal(hasPolicyFailure({}), false);
assert.equal(hasPolicyFailure(undefined), false);
+
+ assert.equal(hasUnresolvedFailure({ "anthropics/skills": "unresolved" }), true);
+ assert.equal(hasUnresolvedFailure({ "anthropics/skills": "policy" }), false);
+ assert.equal(hasUnresolvedFailure({ "anthropics/skills": "network" }), false);
+ assert.equal(hasUnresolvedFailure({}), false);
+ assert.equal(hasUnresolvedFailure(undefined), false);
});
diff --git a/apps/desktop/test/skill-market-panel.test.mjs b/apps/desktop/test/skill-market-panel.test.mjs
index 3bb08df38..6178b0148 100644
--- a/apps/desktop/test/skill-market-panel.test.mjs
+++ b/apps/desktop/test/skill-market-panel.test.mjs
@@ -107,18 +107,43 @@ test("the market list explains a policy refusal instead of a bare unreachable",
assert.match(panel, /queryError: skillMarketFailureDetail\(error\)/);
});
+test("a resolver with no answer is explained as that, not as an address check", () => {
+ // Issue #419, second round: one `policy` bucket meant a local resolver that
+ // answered nothing produced the same sentence as an address the guard had
+ // judged — "blocked by the app's address check" — for a check that had never
+ // reached a verdict. The two now carry different copy and different hints.
+ assert.match(
+ panel,
+ /if \(hasUnresolvedFailure\(remote\.failureKinds\)\) return t\("settings\.sklm\.remoteErrorUnresolved"\)/,
+ );
+ assert.match(panel, /settings\.sklm\.dnsHint/);
+ assert.match(panel, /previewFailure\.kind === "unresolved"/);
+ assert.match(panel, /settings\.sklm\.previewResolveError/);
+ // The refusal names the host it is about, not just the source label: a policy
+ // refusal is a statement about one address.
+ assert.match(panel, /settings\.sklm\.failureSourceHost/);
+ assert.match(panel, /remote\.failureDetails\[name\]\?\.host/);
+ // And the host reaches the state from the IPC result.
+ assert.match(panel, /failureDetails: result\.failureDetails \?\? \{\}/);
+ assert.match(panel, /failureDetails: current\.failureDetails/);
+});
+
test("every shipped locale carries the new skill market strings", async () => {
const { readFile } = await import("node:fs/promises");
const ids = ["en", "zh-CN", "zh-TW", "de", "es", "fr", "ko", "tr"];
const keys = [
"previewError",
"previewPolicyError",
+ "previewResolveError",
"proxyHint",
+ "dnsHint",
"failureDetail",
"retryPreview",
"remoteErrorPolicy",
+ "remoteErrorUnresolved",
"remoteErrorQuery",
"remotePartial",
+ "failureSourceHost",
];
for (const id of ids) {
const locale = await readFile(
@@ -126,7 +151,9 @@ test("every shipped locale carries the new skill market strings", async () => {
"utf8",
);
for (const key of keys) {
- assert.match(locale, new RegExp(`${key}: "`), `${id} ${key}`);
+ // Both layouts ship in these files: `key: "text"` on one line, and the
+ // long strings broken after the colon. Either one carries the key.
+ assert.match(locale, new RegExp(`${key}:\\s*"`), `${id} ${key}`);
}
}
});
diff --git a/apps/desktop/test/skill-market-policy-refusal.test.mjs b/apps/desktop/test/skill-market-policy-refusal.test.mjs
new file mode 100644
index 000000000..fee31d6bf
--- /dev/null
+++ b/apps/desktop/test/skill-market-policy-refusal.test.mjs
@@ -0,0 +1,210 @@
+import assert from "node:assert/strict";
+import test from "node:test";
+import { ErrorCodes } from "@pi-desktop/shared";
+import { createPublicHttpsClient } from "../electron/main/public-https-fetch.ts";
+import { createSkillMarketAggregator } from "../electron/main/skill-market-scan.ts";
+
+/**
+ * Regression cover for the remaining half of issue #419.
+ *
+ * The public-network guard classifies the target host with a *local* resolver
+ * while the request itself would travel through the configured proxy (ADR 0177,
+ * ADR 0243), so a proxied or TUN user's local resolver can answer with a fake
+ * address — Clash fake-IP in `198.18.0.0/15` — or with nothing at all. Only the
+ * first is a verdict on an address. Collapsing both into one `policy` bucket let
+ * the app tell users their catalog sources "were blocked by the app's address
+ * check" when no address had ever been judged: that is the exact line the
+ * reporter quoted.
+ *
+ * Nothing here changes *whether* the guard blocks. Every case below is still
+ * refused, and the last test pins that. What is pinned is what the app says about
+ * it — which host, and which of the two causes.
+ */
+
+const composio = {
+ id: "composio-awesome",
+ name: "ComposioHQ/awesome-claude-skills",
+ url: "https://github.com/ComposioHQ/awesome-claude-skills",
+};
+
+/** The first hop of a GitHub scan, which is the host the guard classifies first. */
+const SCAN_HOST = "api.github.com";
+
+test("a resolver with no answer is not reported as an address-check refusal", async () => {
+ // An empty answer is what the panel used to explain with
+ // `settings.sklm.remoteErrorPolicy` ("blocked by the app's address check"),
+ // even though nothing was classified.
+ const client = createPublicHttpsClient({
+ fetchImpl: async () => {
+ throw new Error("a refused request must never reach the network");
+ },
+ lookupImpl: async () => [],
+ });
+ const aggregator = createSkillMarketAggregator(client.request);
+ const result = await aggregator.search("", [composio]);
+
+ assert.deepEqual(result.entries, []);
+ assert.deepEqual(result.failedSources, [composio.name]);
+ assert.equal(result.failureKinds[composio.name], "unresolved");
+ assert.deepEqual(result.failureDetails[composio.name], {
+ kind: "unresolved",
+ reason: "resolve-failed",
+ host: SCAN_HOST,
+ });
+});
+
+test("a resolver that throws is unresolved too, and that one is retried", async () => {
+ // Node's resolver throws (ENOTFOUND, EAI_AGAIN, a stub that refuses) instead
+ // of returning an empty answer, so this is the shape a blocked local resolver
+ // actually produces.
+ let lookups = 0;
+ const client = createPublicHttpsClient({
+ fetchImpl: async () => {
+ throw new Error("a refused request must never reach the network");
+ },
+ lookupImpl: async () => {
+ lookups += 1;
+ throw Object.assign(new Error(`getaddrinfo ENOTFOUND ${SCAN_HOST}`), { code: "ENOTFOUND" });
+ },
+ });
+ const aggregator = createSkillMarketAggregator(client.request);
+ const result = await aggregator.search("", [composio]);
+
+ assert.equal(result.failureKinds[composio.name], "unresolved");
+ assert.equal(result.failureDetails[composio.name].reason, "resolve-failed");
+ // A resolver that answered nothing is worth retrying — every attempt
+ // re-classifies from scratch. A judged address is not, and never was.
+ assert.equal(lookups, 3);
+});
+
+test("a TUN fake-IP is still refused, and the refusal now names what it refused", async () => {
+ // Clash's default fake-IP range. This *is* an address verdict, so the guard
+ // keeps refusing it. What changed is the explanation: the refusal now carries
+ // the host, the reason, and the class of address, instead of the one word
+ // "private" that fit none of the benchmark/CGNAT/loopback cases.
+ const client = createPublicHttpsClient({
+ fetchImpl: async () => {
+ throw new Error("a refused request must never reach the network");
+ },
+ lookupImpl: async () => [{ address: "198.18.0.4" }],
+ });
+ const aggregator = createSkillMarketAggregator(client.request);
+ const result = await aggregator.search("", [composio]);
+
+ assert.equal(result.failureKinds[composio.name], "policy");
+ assert.deepEqual(result.failureDetails[composio.name], {
+ kind: "policy",
+ reason: "non-public-address",
+ host: SCAN_HOST,
+ addressKind: "benchmark",
+ });
+});
+
+test("a real private target and a fake-IP are told apart in the record", async () => {
+ // Both are refused. Only the class says whether a resolver artifact or an
+ // actual RFC1918 destination produced the answer — which is the difference
+ // between "fix your proxy" and "this source points inside your network".
+ const refusedKind = async (address) => {
+ const client = createPublicHttpsClient({
+ fetchImpl: async () => {
+ throw new Error("a refused request must never reach the network");
+ },
+ lookupImpl: async () => [{ address }],
+ });
+ try {
+ await client.assertPublicUrl(`https://${SCAN_HOST}/x`);
+ return assert.fail(`expected ${address} to be refused`);
+ } catch (error) {
+ return error.addressKind;
+ }
+ };
+ assert.equal(await refusedKind("198.18.0.4"), "benchmark");
+ assert.equal(await refusedKind("10.0.0.8"), "private");
+ assert.equal(await refusedKind("127.0.0.1"), "loopback");
+});
+
+test("the install sheet's code separates the two causes, and both stay refusals", async () => {
+ const unresolved = createPublicHttpsClient({
+ fetchImpl: async () => {
+ throw new Error("no network");
+ },
+ lookupImpl: async () => [],
+ });
+ await assert.rejects(
+ () => unresolved.assertPublicUrl(`https://${SCAN_HOST}/x`),
+ (error) =>
+ error.errorCode === ErrorCodes.NETWORK_RESOLVE_FAILED &&
+ error.reason === "resolve-failed" &&
+ error.host === SCAN_HOST,
+ );
+
+ const fakeIp = createPublicHttpsClient({
+ fetchImpl: async () => {
+ throw new Error("no network");
+ },
+ lookupImpl: async () => [{ address: "198.18.0.4" }],
+ });
+ await assert.rejects(
+ () => fakeIp.assertPublicUrl(`https://${SCAN_HOST}/x`),
+ (error) =>
+ error.errorCode === ErrorCodes.NETWORK_POLICY_BLOCKED &&
+ error.reason === "non-public-address" &&
+ error.addressKind === "benchmark",
+ );
+
+ // A syntactic rejection is a verdict too, and keeps the policy code.
+ const syntax = createPublicHttpsClient({
+ fetchImpl: async () => {
+ throw new Error("no network");
+ },
+ });
+ await assert.rejects(
+ () => syntax.assertPublicUrl("https://127.0.0.1/catalog.json"),
+ (error) =>
+ error.errorCode === ErrorCodes.NETWORK_POLICY_BLOCKED && error.reason === "url-syntax",
+ );
+
+ assert.notEqual(ErrorCodes.NETWORK_RESOLVE_FAILED, ErrorCodes.NETWORK_POLICY_BLOCKED);
+});
+
+test("a document URL the syntactic guard refuses is a refusal, not a dead host", async () => {
+ // This branch used to throw a bare `Error`, so the install sheet reported an
+ // internal-policy rejection as "the document was unreachable".
+ const aggregator = createSkillMarketAggregator(async () => {
+ throw new Error("must not fetch");
+ });
+ await assert.rejects(
+ () => aggregator.fetchEntryDocument({ id: "x", name: "x", url: "https://10.0.0.8/x.md" }),
+ (error) => error.name === "PublicNetworkPolicyError" && error.reason === "url-syntax",
+ );
+});
+
+test("all seven built-in sources stay refused under a TUN resolver, never admitted", async () => {
+ // The guard's decision is unchanged by this fix: this is the reporter's
+ // environment, and the request still must not leave the process.
+ const sources = [
+ { id: "anthropics-skills", name: "anthropics/skills", url: "https://github.com/anthropics/skills" },
+ {
+ id: "composio-awesome",
+ name: "ComposioHQ/awesome-claude-skills",
+ url: "https://github.com/ComposioHQ/awesome-claude-skills",
+ },
+ ];
+ let fetched = 0;
+ const client = createPublicHttpsClient({
+ fetchImpl: async () => {
+ fetched += 1;
+ return { status: 200, ok: true, headers: { get: () => null }, json: async () => ({}), text: async () => "" };
+ },
+ lookupImpl: async () => [{ address: "198.18.0.4" }],
+ });
+ const aggregator = createSkillMarketAggregator(client.request);
+ const result = await aggregator.search("", sources);
+
+ assert.equal(fetched, 0, "a fake-IP answer must never be fetched through");
+ assert.deepEqual(result.entries, []);
+ assert.deepEqual([...result.failedSources].sort(), sources.map((source) => source.name).sort());
+ for (const source of sources) {
+ assert.equal(result.failureKinds[source.name], "policy");
+ }
+});
diff --git a/apps/desktop/test/skill-market-scan.test.mjs b/apps/desktop/test/skill-market-scan.test.mjs
index a9b24f8b3..410cd6393 100644
--- a/apps/desktop/test/skill-market-scan.test.mjs
+++ b/apps/desktop/test/skill-market-scan.test.mjs
@@ -115,7 +115,13 @@ test("a failed source reports whether the policy or the transport refused it", a
const aggregator = createSkillMarketAggregator(async (url) => {
if (url.includes("blocked.example")) {
throw new PublicNetworkPolicyError(
- "hostname resolves to a private address: blocked.example -> 198.18.0.4",
+ "hostname resolves to a non-public address: blocked.example -> 198.18.0.4 (benchmark)",
+ {
+ reason: "non-public-address",
+ host: "blocked.example",
+ address: "198.18.0.4",
+ addressKind: "benchmark",
+ },
);
}
throw new Error("responded 502");
@@ -134,6 +140,20 @@ test("a failed source reports whether the policy or the transport refused it", a
"down/repo": "network",
local: "policy",
});
+ // …and each name now carries what it was about, not just which bucket it
+ // landed in. A transport failure answers a 502 with a bare host.
+ assert.deepEqual(result.failureDetails["blocked/repo"], {
+ kind: "policy",
+ host: "blocked.example",
+ reason: "non-public-address",
+ addressKind: "benchmark",
+ });
+ assert.deepEqual(result.failureDetails.local, {
+ kind: "policy",
+ host: "127.0.0.1",
+ reason: "url-syntax",
+ });
+ assert.deepEqual(result.failureDetails["down/repo"], { kind: "network", host: "down.example" });
});
test("a repeated display name keeps the refusal, and a hostile name stays own", async () => {
@@ -153,24 +173,106 @@ test("a repeated display name keeps the refusal, and a hostile name stays own",
assert.equal(Object.hasOwn(result.failureKinds, "__proto__"), true);
assert.equal(result.failureKinds.__proto__, "policy");
assert.deepEqual(Object.values(result.failureKinds), ["policy", "policy"]);
+ // `failureDetails` is keyed the same way, and inherits the same hazard.
+ assert.equal(Object.hasOwn(result.failureDetails, "__proto__"), true);
+ assert.deepEqual(Object.keys(result.failureDetails).sort(), ["__proto__", "same"]);
+});
+
+test("the most specific failure survives a shared display name", async () => {
+ // One label can hide three causes, and `failedSources` cannot tell them apart.
+ // The merge keeps the most specific: a judged address beats a resolver with no
+ // answer, which beats a plain transport failure. Surfacing the weaker one
+ // would send the user after the wrong problem.
+ const request = async (url) => {
+ if (url.includes("judged.example")) {
+ throw new PublicNetworkPolicyError("hostname resolves to a non-public address", {
+ reason: "non-public-address",
+ host: "judged.example",
+ addressKind: "benchmark",
+ });
+ }
+ if (url.includes("silent.example")) {
+ throw new PublicNetworkPolicyError("hostname does not resolve: silent.example", {
+ reason: "resolve-failed",
+ host: "silent.example",
+ });
+ }
+ throw new Error("responded 502");
+ };
+ const withJudged = await createSkillMarketAggregator(request).search("", [
+ { id: "a", name: "shared", url: "https://silent.example/catalog.json" },
+ { id: "b", name: "shared", url: "https://down.example/catalog.json" },
+ { id: "c", name: "shared", url: "https://judged.example/catalog.json" },
+ ]);
+ assert.equal(withJudged.failureKinds.shared, "policy");
+ assert.equal(withJudged.failureDetails.shared.reason, "non-public-address");
+
+ const withoutJudged = await createSkillMarketAggregator(request).search("", [
+ { id: "a", name: "shared", url: "https://silent.example/catalog.json" },
+ { id: "b", name: "shared", url: "https://down.example/catalog.json" },
+ ]);
+ assert.equal(withoutJudged.failureKinds.shared, "unresolved");
+ assert.equal(withoutJudged.failureDetails.shared.reason, "resolve-failed");
});
-test("a diagnostics record names the host, never the URL or its credentials", () => {
+test("a diagnostics record names the host, never the URL or its credentials", async () => {
// Issue #419: the market's failures wrote nothing to the app log, so a user
- // behind a proxy had no way to report which host was refused. The record is
- // built here so its shape is fixed and its redaction is testable.
+ // behind a proxy had no way to report which host was refused — or whether the
+ // resolver had answered at all. The record is built here so its shape is fixed
+ // and its redaction is testable.
assert.deepEqual(
skillMarketFailureDetail(
{ name: "anthropics/skills", url: "https://user:[email protected]:8443/org/repo?token=abc#x" },
- new PublicNetworkPolicyError("hostname resolves to a private address"),
+ new PublicNetworkPolicyError("hostname resolves to a non-public address", {
+ reason: "non-public-address",
+ host: "api.github.com",
+ address: "198.18.0.4",
+ addressKind: "benchmark",
+ }),
),
- { source: "anthropics/skills", host: "github.com", kind: "policy" },
+ {
+ source: "anthropics/skills",
+ // The host the guard classified wins over the source's own host: a GitHub
+ // `owner/repo` source is scanned through `api.github.com`, and naming the
+ // repository host there would point at a host that was never refused.
+ host: "api.github.com",
+ kind: "policy",
+ reason: "non-public-address",
+ addressKind: "benchmark",
+ },
);
- // A transport failure is not a refusal.
- assert.equal(
- skillMarketFailureDetail(source, new Error("responded 502")).kind,
- "network",
+ // The class travels, the address never does.
+ const judged = skillMarketFailureDetail(
+ { name: "anthropics/skills", url: "https://github.com/anthropics/skills" },
+ new PublicNetworkPolicyError("hostname resolves to a non-public address: api.github.com -> 198.18.0.4", {
+ reason: "non-public-address",
+ host: "api.github.com",
+ address: "198.18.0.4",
+ addressKind: "benchmark",
+ }),
);
+ assert.equal(JSON.stringify(judged).includes("198.18.0.4"), false);
+ // A resolver that answered nothing is not an address verdict, and the record
+ // must not claim one.
+ assert.deepEqual(
+ skillMarketFailureDetail(
+ { name: "anthropics/skills", url: "https://github.com/anthropics/skills" },
+ new PublicNetworkPolicyError("hostname does not resolve: api.github.com (ENOTFOUND)", {
+ reason: "resolve-failed",
+ host: "api.github.com",
+ }),
+ ),
+ {
+ source: "anthropics/skills",
+ host: "api.github.com",
+ kind: "unresolved",
+ reason: "resolve-failed",
+ },
+ );
+ // A transport failure is not a refusal — including a 403, which is what a
+ // rate-limited GitHub scan answers with.
+ assert.equal(skillMarketFailureDetail(source, new Error("responded 502")).kind, "network");
+ assert.equal(skillMarketFailureDetail(source, new Error("responded 403")).kind, "network");
// A source the syntactic guard never let out still logs its name.
assert.deepEqual(
skillMarketFailureDetail({ name: "broken", url: "http://insecure.example" }, undefined),
@@ -186,20 +288,30 @@ test("a diagnostics record names the host, never the URL or its credentials", ()
test("the classifier matches the aggregator's own classification", async () => {
// One classifier, so the log line and the panel can never disagree.
- const policy = new PublicNetworkPolicyError("hostname does not resolve: x.example");
- assert.equal(classifySkillMarketFailure(policy), "policy");
+ const unresolved = new PublicNetworkPolicyError("hostname does not resolve: x.example", {
+ reason: "resolve-failed",
+ host: "x.example",
+ });
+ const judged = new PublicNetworkPolicyError("hostname resolves to a non-public address: x.example", {
+ reason: "non-public-address",
+ host: "x.example",
+ addressKind: "benchmark",
+ });
+ assert.equal(classifySkillMarketFailure(unresolved), "unresolved");
+ assert.equal(classifySkillMarketFailure(judged), "policy");
assert.equal(classifySkillMarketFailure(new Error("fetch failed")), "network");
const aggregator = createSkillMarketAggregator(async () => {
- throw policy;
+ throw unresolved;
});
const result = await aggregator.search("", [source]);
- assert.equal(result.failureKinds["anthropics/skills"], classifySkillMarketFailure(policy));
+ assert.equal(result.failureKinds["anthropics/skills"], classifySkillMarketFailure(unresolved));
+ assert.equal(result.failureDetails["anthropics/skills"].reason, "resolve-failed");
});
test("both market channels report their failures to the app log", () => {
// `skills-ipc.ts` imports Electron, so the wiring is asserted on the source:
- // the refusal reason, the host and the stable code must all reach the log,
- // and the log must not carry the full URL.
+ // the host, the guard's own reason and the class of address must all reach the
+ // log, and the log must never carry the full URL.
const src = readFileSync(
join(dirname(fileURLToPath(import.meta.url)), "../electron/main/ipc/skills-ipc.ts"),
"utf8",
@@ -210,8 +322,14 @@ test("both market channels report their failures to the app log", () => {
assert.match(src, /logger\.app\("diagnostics", "warn", "skill market document fetch failed"/);
assert.match(src, /event: "skillMarket\.sourceFailed"/);
assert.match(src, /event: "skillMarket\.documentFailed"/);
- assert.match(src, /code: ErrorCodes\.NETWORK_POLICY_BLOCKED/);
- assert.match(src, /host: skillMarketHost\(source\.url\)|const host = skillMarketHost\(source\.url\)/);
+ // Two codes, because only one of the two refusals judged an address.
+ assert.match(src, /ErrorCodes\.NETWORK_POLICY_BLOCKED/);
+ assert.match(src, /ErrorCodes\.NETWORK_RESOLVE_FAILED/);
+ // The record carries the guard's own reason and the address class — the two
+ // fields that tell "the resolver answered nothing" from "the address is not
+ // public" (§09 diagnostics).
+ assert.match(src, /reason: detail\.reason/);
+ assert.match(src, /addressKind: detail\.addressKind/);
assert.doesNotMatch(src, /data: \{ url|url: source\.url/);
// The registration site must supply the logger, or the wiring above is dead.
const register = readFileSync(
diff --git a/docs/spec/03-runtime/01-ipc-protocol.md b/docs/spec/03-runtime/01-ipc-protocol.md
index d20f67ca3..2a25f74db 100644
--- a/docs/spec/03-runtime/01-ipc-protocol.md
+++ b/docs/spec/03-runtime/01-ipc-protocol.md
@@ -1461,15 +1461,20 @@ state is pruned during the next scan.
Desktop-only skill market channels (not host RPC) live on Electron IPC:
- `pi-desktop/skill/market/search` — `{ query, sources[] }` →
- `{ entries, failedSources, failureKinds }`. Main aggregates builtin-safe
- catalog JSON and GitHub repo SKILL.md scans. Source URLs must pass the
- public-HTTPS policy (ADR 0243). One failing source is dropped; the rest still
- return. `failureKinds` maps each name in `failedSources` to `policy` (the
- public-network guard refused it, so the request never left the process) or
- `network`, which is what lets the panel explain a policy/DNS refusal — the
- case a proxied user hits — instead of reporting every source as unreachable.
- A guard refusal also surfaces as `NETWORK_POLICY_BLOCKED` (spec 08 §3.1), the
- code the install sheet classifies a failed preview on.
+ `{ entries, failedSources, failureKinds, failureDetails }`. Main aggregates
+ builtin-safe catalog JSON and GitHub repo SKILL.md scans. Source URLs must pass
+ the public-HTTPS policy (ADR 0243). One failing source is dropped; the rest
+ still return. `failureKinds` maps each name in `failedSources` to `policy`
+ (the public-network guard judged the target and refused it, so the request
+ never left the process), `unresolved` (the local DNS lookup returned no answer,
+ so no address was judged — a resolver or proxy condition, not a verdict on the
+ source), or `network`. `failureDetails` carries the same keys with the host
+ that actually failed, the guard's own `reason`, and the class of the refused
+ address, which is what lets the panel name *what* was refused instead of only
+ which source went quiet. A judged refusal also surfaces as
+ `NETWORK_POLICY_BLOCKED` and an unanswered resolver as `NETWORK_RESOLVE_FAILED`
+ (spec 08 §3.1); the install sheet classifies a failed preview on those two
+ codes.
- `pi-desktop/skill/market/fetch` — `{ entry }` → `{ name?, description?, body, resources? }`.
Main fetches the document over the same policy, splits frontmatter, and may
attach sibling `.md` files from a jsDelivr listing. The renderer installs
diff --git a/docs/spec/03-runtime/08-error-codes.md b/docs/spec/03-runtime/08-error-codes.md
index bcbc33ea9..7a9e5e8aa 100644
--- a/docs/spec/03-runtime/08-error-codes.md
+++ b/docs/spec/03-runtime/08-error-codes.md
@@ -66,7 +66,8 @@ registered; reserved codes in §3.7 remain intentionally absent from
| `APPROVAL_STALE` | no | RACP: the approval was already settled or belongs to an older turn |
| `PAYLOAD_TOO_LARGE` | no | RACP: a frame exceeded the negotiated size bound |
| `TIMEOUT` | yes | generic timeout |
-| `NETWORK_POLICY_BLOCKED` | no | the main-process public-network guard refused a fetch: the URL failed the syntactic public-HTTPS check, or the local DNS lookup could not classify the host as public (ADR 0243). A desktop-only code; retrying cannot succeed until the address or the resolver changes. |
+| `NETWORK_POLICY_BLOCKED` | no | the main-process public-network guard refused a fetch because it *judged* the target: the URL failed the syntactic public-HTTPS check, or the local DNS lookup returned an address the policy classifies as non-public (ADR 0243). A desktop-only code; a refusal is a verdict, so retrying cannot succeed until the address changes. A resolver that returned no answer at all is `NETWORK_RESOLVE_FAILED` instead (issue #419). |
+| `NETWORK_RESOLVE_FAILED` | yes | the main-process public-network guard could not classify the target host: the local DNS lookup returned no answer, or threw before returning one. The request is refused exactly as a policy refusal is, but no address was judged, so no page or log may report it as an address-check decision. Distinct from `NETWORK_ERROR`, which is a failure of the request itself. Retriable: a resolver or proxy that starts answering the same host makes the same request succeed (ADR 0243, issue #419). |
| `HOST_SHUTTING_DOWN` | yes | the host received EOF and is draining; the call was refused rather than started |
| `RATE_LIMITED` | yes | a per-caller host budget (plugin session import, batch operations) was exceeded inside its window |
| `LIMIT_EXCEEDED` | no | a payload exceeded a fixed host bound (item count, byte size, or a 64 MiB NDJSON request line) and was refused |
diff --git a/docs/spec/03-runtime/09-logging-and-observability.md b/docs/spec/03-runtime/09-logging-and-observability.md
index b98e78f2f..34d7f718d 100644
--- a/docs/spec/03-runtime/09-logging-and-observability.md
+++ b/docs/spec/03-runtime/09-logging-and-observability.md
@@ -54,12 +54,19 @@ The application categories are:
- `diagnostics` — blocked navigation, menu, template, and outbound-fetch
diagnostics. The skill market's two channels record one
`skillMarket.sourceFailed` / `skillMarket.documentFailed` record per source
- or document that produced nothing, with `source`, `host` and `kind`
- (`policy` for a public-network-guard refusal, `network` otherwise) in `data`
- and `NETWORK_POLICY_BLOCKED` in `code` for a refusal. The record carries the
- host name only — never the URL, its path, query or credentials — because a
- catalog source URL is user-supplied and the refused host is the whole
- diagnostic value (issue #419).
+ or document that produced nothing, with `source`, `host`, `kind` and — for a
+ guard refusal — `reason` and `addressKind` in `data`. `kind` is `policy` when
+ the guard judged the target, `unresolved` when the local resolver returned no
+ answer, and `network` otherwise; `code` is `NETWORK_POLICY_BLOCKED` for the
+ first and `NETWORK_RESOLVE_FAILED` for the second, so one log line separates
+ "the address is not public" from "the resolver answered nothing". `reason`
+ names the guard's own branch (`url-syntax`, `resolve-failed`,
+ `non-public-address`, `redirect-limit`) and `addressKind` the class of the
+ refused address (`benchmark` for a TUN fake-IP, `private` for RFC1918). The
+ record carries the host name and that class only — never the address, the URL,
+ its path, query or credentials — because a catalog source URL is
+ user-supplied, the refused host is the whole diagnostic value, and the class
+ is what tells a resolver artifact from a real private target (issue #419).
- `runtime` — host/sidecar lifecycle, uncategorized child output, and
main-process `uncaughtException` / `unhandledRejection` records
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 36d358146..7b5622f79 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -12169,11 +12169,15 @@ plugin-form fixtures in an isolated temporary directory at runtime.
`https://127.0.0.1/`.
- **Expected**: Every bypass form is rejected. A public CDN URL is accepted.
DNS that yields a private address and a redirect onto loopback both throw a
- policy error without fetching the private target. Policy failures are not
- retried. Each refusal carries `NETWORK_POLICY_BLOCKED` (spec 08 §3.1) so the
- install sheet can name the reason and offer a retry instead of leaving the
- install button disabled with no explanation, and the market list can tell a
- refused source apart from a merely unreachable one.
+ policy error without fetching the private target. A judged refusal is not
+ retried; a local resolver that answered nothing is, and is reported as
+ `NETWORK_RESOLVE_FAILED` (`kind` `unresolved`) rather than as an address-check
+ refusal — the guard reached no verdict, so nothing may claim it did. Every
+ other refusal carries `NETWORK_POLICY_BLOCKED` (spec 08 §3.1) with its
+ `reason` and the class of the refused address, so the install sheet can name
+ the reason and offer a retry instead of leaving the install button disabled
+ with no explanation, and the market list can tell a refused source apart from
+ a merely unreachable one.
- **Specs linked**: `05-security/01-security.md`, ADR 0243,
`03-runtime/01-ipc-protocol.md` §12b
- **Acceptance**: Security, Quality
@@ -12182,6 +12186,7 @@ plugin-form fixtures in an isolated temporary directory at runtime.
`apps/desktop/test/public-https-fetch.test.mjs`,
`apps/desktop/test/skill-market-scan.test.mjs`,
`apps/desktop/test/skill-market-failure.test.mjs`,
+ `apps/desktop/test/skill-market-policy-refusal.test.mjs`,
`packages/shared/src/public-network.test.ts`)
#### E2E-SKILL-MARKET-EXPANSION: Adjacent markdown resources inline before install
diff --git a/docs/zh-CN/spec/03-runtime/01-ipc-protocol.md b/docs/zh-CN/spec/03-runtime/01-ipc-protocol.md
index 5d2606cc9..98c777c3f 100644
--- a/docs/zh-CN/spec/03-runtime/01-ipc-protocol.md
+++ b/docs/zh-CN/spec/03-runtime/01-ipc-protocol.md
@@ -1212,10 +1212,10 @@ ASCII slug:frontmatter `name` 能 slugify 时用它,否则 `SKILL.md` 用技
桌面专用技能市场通道(不是 host RPC)走 Electron IPC:
- `pi-desktop/skill/market/search` — `{ query, sources[] }` →
- `{ entries, failedSources, failureKinds }`。
+ `{ entries, failedSources, failureKinds, failureDetails }`。
主进程聚合目录 JSON 与 GitHub 仓库 SKILL.md 扫描。源 URL 必须通过公网 HTTPS 策略(ADR 0243)。单源失败只丢掉该源。
- `failureKinds` 把 `failedSources` 中的每个名字映射到 `policy`(公网策略守卫拒绝,请求从未离开进程)或 `network`;面板据此区分策略/DNS 拒绝(即代理用户的典型情况)与单纯不可达。
- 守卫拒绝会以 `NETWORK_POLICY_BLOCKED`(spec 08 §3.1)暴露,安装面板正是按该错误码分类。
+ `failureKinds` 把 `failedSources` 中的每个名字映射到 `policy`(公网策略守卫判定了目标并拒绝,请求从未离开进程)、`unresolved`(本地 DNS 解析没有返回答案,因此没有判定任何地址——这是解析器或代理的环境状况,不是对源的判定)或 `network`。`failureDetails` 以同样的键携带真正失败的主机、守卫自己的 `reason` 以及被拒地址的类别;面板据此说明**被拒的是什么**,而不只是哪个源没出结果。
+ 判定型拒绝以 `NETWORK_POLICY_BLOCKED` 暴露,解析器无应答以 `NETWORK_RESOLVE_FAILED` 暴露(spec 08 §3.1);安装面板正是按这两个错误码分类。
- `pi-desktop/skill/market/fetch` — `{ entry }` → `{ name?, description?, body, resources? }`。
主进程按同一策略拉取文档、拆 frontmatter,并可能附上 jsDelivr 目录中的兄弟 `.md`。渲染层通过现有 `skills.create` 安装。该策略即主进程公网网络客户端:语法 URL 防护、DNS 分类、逐跳重定向复核与响应上限——渲染层绝不直接触网。目录 id 会净化为 host `valid_capability_id`。
diff --git a/docs/zh-CN/spec/03-runtime/08-error-codes.md b/docs/zh-CN/spec/03-runtime/08-error-codes.md
index d5102cd47..d8a566550 100644
--- a/docs/zh-CN/spec/03-runtime/08-error-codes.md
+++ b/docs/zh-CN/spec/03-runtime/08-error-codes.md
@@ -68,7 +68,8 @@ type AppError = {
| `APPROVAL_STALE` | 不 | RACP:审批已被处理或属于更早的回合 |
| `PAYLOAD_TOO_LARGE` | 不 | RACP:帧超过协商的大小上限 |
| `TIMEOUT` | 是的 | 通用超时 |
-| `NETWORK_POLICY_BLOCKED` | 不 | 主进程公网策略守卫拒绝了一次抓取:URL 未通过公网 HTTPS 语法检查,或本地 DNS 解析无法把该主机判定为公网地址(ADR 0243)。仅桌面端使用;在地址或解析器改变前,重试不会成功。 |
+| `NETWORK_POLICY_BLOCKED` | 不 | 主进程公网策略守卫拒绝了一次抓取,因为它**判定了**目标:URL 未通过公网 HTTPS 语法检查,或本地 DNS 解析返回了策略判定为非公网的地址(ADR 0243)。仅桌面端使用;拒绝即判定,因此在地址改变前重试不会成功。本地解析完全没有返回答案时改用 `NETWORK_RESOLVE_FAILED`(issue #419)。 |
+| `NETWORK_RESOLVE_FAILED` | 是的 | 主进程公网策略守卫无法判定目标主机:本地 DNS 解析没有返回答案,或在返回前抛错。请求仍与策略拒绝一样被拒,但没有判定任何地址,因此任何界面或日志都不得把它描述成地址校验的判定结果。与 `NETWORK_ERROR` 不同,后者是请求本身的失败。可重试:当解析器或代理开始应答同一主机时,同一请求即可成功(ADR 0243,issue #419)。 |
| `HOST_SHUTTING_DOWN` | 是的 | 主机收到 EOF 正在排空;调用被拒绝而不是被启动 |
| `RATE_LIMITED` | 是的 | 某个按调用方计的主机预算(插件会话导入、批量操作)在其窗口内被超出 |
| `LIMIT_EXCEEDED` | 不 | 载荷超过了固定的主机上限(条目数、字节数)并被拒绝 |
diff --git a/docs/zh-CN/spec/03-runtime/09-logging-and-observability.md b/docs/zh-CN/spec/03-runtime/09-logging-and-observability.md
index 94989ac56..a852c957a 100644
--- a/docs/zh-CN/spec/03-runtime/09-logging-and-observability.md
+++ b/docs/zh-CN/spec/03-runtime/09-logging-and-observability.md
@@ -52,7 +52,7 @@ host 和 agent stderr 使用标记进行分类;无法分类的子进程输出
- `provider` — provider/model 发现、重试和缓存失败
- `persistence` — 成绩单和发件箱持久化失败
- `updater` — 更新器诊断和错误
-- `diagnostics` — 阻止导航、菜单、模板以及对外请求的诊断。技能市场的两个通道会为每个没有产出结果的源或文档各记录一条 `skillMarket.sourceFailed` / `skillMarket.documentFailed`:`data` 里带 `source`、`host` 与 `kind`(被公共网络守卫拒绝为 `policy`,其余为 `network`),被拒绝时 `code` 为 `NETWORK_POLICY_BLOCKED`。记录中只保留主机名 —— 绝不包含 URL、其路径、查询串或凭据 —— 因为目录源 URL 由用户提供,而被拒绝的主机正是全部诊断价值所在(issue #419)。
+- `diagnostics` — 阻止导航、菜单、模板以及对外请求的诊断。技能市场的两个通道会为每个没有产出结果的源或文档各记录一条 `skillMarket.sourceFailed` / `skillMarket.documentFailed`:`data` 里带 `source`、`host`、`kind`,以及被守卫拒绝时的 `reason` 与 `addressKind`。`kind` 在守卫判定了目标时为 `policy`,本地解析没有返回答案时为 `unresolved`,其余为 `network`;`code` 前者为 `NETWORK_POLICY_BLOCKED`,后者为 `NETWORK_RESOLVE_FAILED`,因此一行日志即可区分「地址不是公网」与「解析器没有应答」。`reason` 记录守卫自己的分支(`url-syntax`、`resolve-failed`、`non-public-address`、`redirect-limit`),`addressKind` 记录被拒地址的类别(TUN fake-IP 为 `benchmark`,RFC1918 为 `private`)。记录中只保留主机名与该类别 —— 绝不包含地址、URL、其路径、查询串或凭据 —— 因为目录源 URL 由用户提供,被拒绝的主机正是全部诊断价值所在,而该类别正是区分解析器产物与真实私网目标的依据(issue #419)。
- `runtime` — host/sidecar 生命周期、未分类的子进程输出,以及主进程
`uncaughtException` / `unhandledRejection` 记录
diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
index 2014fa398..e377701cd 100644
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@ -7367,11 +7367,11 @@ runner 会在运行时的隔离临时目录中生成六个插件形态 fixture
- **前提条件**:共享 public-network helper,以及可注入 fetch/DNS 的主进程公网 HTTPS 客户端。
- **步骤**:1)分类 trailing-dot localhost、IPv4 回环、IPv4-mapped IPv6、ULA、link-local、RFC1918 与 `http://`。2)将公网主机名解析到私网 A 记录。3)跟随 Location 为 `https://127.0.0.1/` 的 302。
-- **预期**:上述绕过形态全部拒绝;公共 CDN 放行。解析到私网地址或 redirect 到回环会抛出策略错误,且不会请求私网目标。策略失败不重试。每次拒绝都带上 `NETWORK_POLICY_BLOCKED`(spec 08 §3.1),使安装面板能给出原因并提供重试,而不是让安装按钮无解释地保持禁用;市场列表也能把被拒绝的源与单纯不可达的源区分开。
+- **预期**:上述绕过形态全部拒绝;公共 CDN 放行。解析到私网地址或 redirect 到回环会抛出策略错误,且不会请求私网目标。判定型拒绝不重试;本地解析没有返回答案时会重试,并且报为 `NETWORK_RESOLVE_FAILED`(`kind` 为 `unresolved`),而不是报成地址校验拒绝——守卫并未得出判定,任何文案都不得声称它得出了。其余每次拒绝都带上 `NETWORK_POLICY_BLOCKED`(spec 08 §3.1)及其 `reason` 与被拒地址的类别,使安装面板能给出原因并提供重试,而不是让安装按钮无解释地保持禁用;市场列表也能把被拒绝的源与单纯不可达的源区分开。
- **链接规格**:`05-security/01-security.md`、ADR 0243、`03-runtime/01-ipc-protocol.md` §12b
- **验收**:Security、Quality
- **里程碑**:M6+
-- **状态**:已自动化(`pnpm test:e2e:skill-market`、`apps/desktop/test/public-https-fetch.test.mjs`、`apps/desktop/test/skill-market-scan.test.mjs`、`apps/desktop/test/skill-market-failure.test.mjs`、`packages/shared/src/public-network.test.ts`)
+- **状态**:已自动化(`pnpm test:e2e:skill-market`、`apps/desktop/test/public-https-fetch.test.mjs`、`apps/desktop/test/skill-market-scan.test.mjs`、`apps/desktop/test/skill-market-failure.test.mjs`、`apps/desktop/test/skill-market-policy-refusal.test.mjs`、`packages/shared/src/public-network.test.ts`)
#### E2E-SKILL-MARKET-EXPANSION:相邻 markdown 资源在安装前内联
diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.ts
index 8d4529639..2834cf9b3 100644
--- a/packages/i18n/src/locales/de/index.ts
+++ b/packages/i18n/src/locales/de/index.ts
@@ -540,6 +540,13 @@ sklm: {
failureDetail: "Details: ",
retryPreview: "Erneut versuchen",
remoteErrorPolicy: "Katalogquellen wurden von der Adressprüfung der App blockiert – integrierte Auswahl wird angezeigt",
+ remoteErrorUnresolved:
+ "Der lokale Resolver konnte die Katalogquellen nicht auflösen – integrierte Auswahl wird angezeigt",
+ previewResolveError:
+ "Die Adressprüfung der App konnte diesen Host nicht auflösen – es wurde nichts installiert.",
+ dnsHint:
+ "Diese Prüfung löst den Host lokal auf, der Download selbst würde jedoch über deinen Proxy laufen. Wenn du einen Proxy, ein VPN oder ein eigenes DNS-Setup verwendest, prüfe Einstellungen → Allgemein → Netzwerk.",
+ failureSourceHost: "{{name}} ({{host}})",
remoteErrorQuery: "Der Skill-Markt konnte nicht abgefragt werden – integrierte Auswahl wird angezeigt",
remotePartial: "Einige Katalogquellen sind nicht verfügbar ({{names}})",
},
diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.ts
index cce232e08..885592f9b 100644
--- a/packages/i18n/src/locales/en/index.ts
+++ b/packages/i18n/src/locales/en/index.ts
@@ -547,6 +547,13 @@ sklm: {
failureDetail: "Details: ",
retryPreview: "Retry",
remoteErrorPolicy: "Catalog sources were blocked by the app's address check — showing built-in picks",
+ remoteErrorUnresolved:
+ "The local resolver could not answer for the catalog sources — showing built-in picks",
+ previewResolveError:
+ "The app's address check could not resolve this host — nothing was installed.",
+ dnsHint:
+ "That check resolves the host locally, while the download itself would use your proxy. If you use a proxy, a VPN, or a custom DNS setup, check Settings → General → Network.",
+ failureSourceHost: "{{name}} ({{host}})",
remoteErrorQuery: "Could not query the skill market — showing built-in picks",
remotePartial: "Some catalog sources are unavailable ({{names}})",
},
diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.ts
index c7a9ded71..d8a9fc543 100644
--- a/packages/i18n/src/locales/es/index.ts
+++ b/packages/i18n/src/locales/es/index.ts
@@ -540,6 +540,13 @@ sklm: {
failureDetail: "Detalles: ",
retryPreview: "Reintentar",
remoteErrorPolicy: "La comprobación de direcciones de la aplicación bloqueó las fuentes del catálogo: se muestran las selecciones integradas",
+ remoteErrorUnresolved:
+ "El resolutor local no pudo resolver las fuentes del catálogo: se muestran las selecciones integradas",
+ previewResolveError:
+ "La comprobación de direcciones de la aplicación no pudo resolver este host: no se instaló nada.",
+ dnsHint:
+ "Esa comprobación resuelve el host localmente, mientras que la descarga usaría tu proxy. Si usas un proxy, una VPN o una configuración de DNS propia, revisa Ajustes → General → Red.",
+ failureSourceHost: "{{name}} ({{host}})",
remoteErrorQuery: "No se pudo consultar el mercado de skills: se muestran las selecciones integradas",
remotePartial: "Algunas fuentes del catálogo no están disponibles ({{names}})",
},
diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.ts
index 400f0fbef..2c743a09b 100644
--- a/packages/i18n/src/locales/fr/index.ts
+++ b/packages/i18n/src/locales/fr/index.ts
@@ -540,6 +540,13 @@ sklm: {
failureDetail: "Détails : ",
retryPreview: "Réessayer",
remoteErrorPolicy: "Les sources du catalogue ont été bloquées par le contrôle d'adresse de l'application – sélection intégrée affichée",
+ remoteErrorUnresolved:
+ "Le résolveur local n'a pas pu résoudre les sources du catalogue – sélection intégrée affichée",
+ previewResolveError:
+ "Le contrôle d'adresse de l'application n'a pas pu résoudre cet hôte – rien n'a été installé.",
+ dnsHint:
+ "Ce contrôle résout l'hôte localement, alors que le téléchargement passerait par votre proxy. Si vous utilisez un proxy, un VPN ou une configuration DNS personnalisée, vérifiez Paramètres → Général → Réseau.",
+ failureSourceHost: "{{name}} ({{host}})",
remoteErrorQuery: "Impossible d'interroger le marché de skills – sélection intégrée affichée",
remotePartial: "Certaines sources du catalogue sont indisponibles ({{names}})",
},
diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.ts
index cb913dffd..295895a41 100644
--- a/packages/i18n/src/locales/ko/index.ts
+++ b/packages/i18n/src/locales/ko/index.ts
@@ -549,6 +549,13 @@ sklm: {
failureDetail: "세부 정보: ",
retryPreview: "다시 시도",
remoteErrorPolicy: "앱의 주소 검사가 카탈로그 소스를 차단했습니다. 내장 목록을 표시합니다",
+ remoteErrorUnresolved:
+ "로컬 리졸버가 카탈로그 소스를 확인하지 못했습니다. 내장 목록을 표시합니다",
+ previewResolveError:
+ "앱의 주소 검사가 이 호스트를 확인하지 못했습니다. 아무것도 설치되지 않았습니다.",
+ dnsHint:
+ "이 검사는 호스트를 로컬에서 확인하지만, 다운로드 자체는 프록시를 사용합니다. 프록시, VPN 또는 별도 DNS 설정을 사용한다면 설정 → 일반 → 네트워크를 확인하세요.",
+ failureSourceHost: "{{name}} ({{host}})",
remoteErrorQuery: "스킬 마켓을 조회하지 못했습니다. 내장 목록을 표시합니다",
remotePartial: "일부 카탈로그 소스를 사용할 수 없습니다 ({{names}})",
},
diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.ts
index a2cdb4020..6194ba453 100644
--- a/packages/i18n/src/locales/tr/index.ts
+++ b/packages/i18n/src/locales/tr/index.ts
@@ -549,6 +549,13 @@ sklm: {
failureDetail: "Ayrıntılar: ",
retryPreview: "Yeniden dene",
remoteErrorPolicy: "Uygulamanın adres denetimi katalog kaynaklarını engelledi – yerleşik seçkiler gösteriliyor",
+ remoteErrorUnresolved:
+ "Yerel çözümleyici katalog kaynaklarını çözemedi – yerleşik seçkiler gösteriliyor",
+ previewResolveError:
+ "Uygulamanın adres denetimi bu ana bilgisayarı çözemedi – hiçbir şey yüklenmedi.",
+ dnsHint:
+ "Bu denetim ana bilgisayarı yerel olarak çözer, indirmenin kendisi ise proxy'nizden geçer. Proxy, VPN veya özel bir DNS kurulumu kullanıyorsanız Ayarlar → Genel → Ağ bölümünü kontrol edin.",
+ failureSourceHost: "{{name}} ({{host}})",
remoteErrorQuery: "Skill market sorgulanamadı – yerleşik seçkiler gösteriliyor",
remotePartial: "Bazı katalog kaynakları kullanılamıyor ({{names}})",
},
diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.ts
index 4dd6d096a..8cb6faac8 100644
--- a/packages/i18n/src/locales/zh-CN/index.ts
+++ b/packages/i18n/src/locales/zh-CN/index.ts
@@ -544,6 +544,11 @@ sklm: {
failureDetail: "详情: ",
retryPreview: "重试",
remoteErrorPolicy: "目录源被应用的地址校验阻止,已显示内置精选",
+ remoteErrorUnresolved: "本机 DNS 无法解析目录源,已显示内置精选",
+ previewResolveError: "应用的地址校验无法解析该主机,未安装任何内容。",
+ dnsHint:
+ "该校验在本机解析主机,而下载本身会走代理。如果你使用代理、VPN 或自定义 DNS,请检查 设置 → 通用 → 网络。",
+ failureSourceHost: "{{name}}({{host}})",
remoteErrorQuery: "无法查询技能市场,已显示内置精选",
remotePartial: "部分目录源不可用({{names}})",
},
diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.ts
index 25406d547..c454520ab 100644
--- a/packages/i18n/src/locales/zh-TW/index.ts
+++ b/packages/i18n/src/locales/zh-TW/index.ts
@@ -544,6 +544,11 @@ sklm: {
failureDetail: "詳情: ",
retryPreview: "重試",
remoteErrorPolicy: "目錄源被應用程式的地址校驗阻止,已顯示內建精選",
+ remoteErrorUnresolved: "本機 DNS 無法解析目錄源,已顯示內建精選",
+ previewResolveError: "應用程式的地址校驗無法解析該主機,未安裝任何內容。",
+ dnsHint:
+ "該校驗在本機解析主機,而下載本身會走代理。如果你使用代理、VPN 或自訂 DNS,請檢查 設定 → 一般 → 網路。",
+ failureSourceHost: "{{name}}({{host}})",
remoteErrorQuery: "無法查詢技能市場,已顯示內建精選",
remotePartial: "部分目錄源不可用({{names}})",
},
diff --git a/packages/shared/src/errors.ts b/packages/shared/src/errors.ts
index 4a5608f75..9e121dc0b 100644
--- a/packages/shared/src/errors.ts
+++ b/packages/shared/src/errors.ts
@@ -43,13 +43,28 @@ export const ErrorCodes = {
NETWORK_ERROR: "NETWORK_ERROR",
/**
* The main-process public-network guard refused a fetch: the URL failed the
- * syntactic public-HTTPS check, or a local DNS lookup could not classify the
- * host as public. Users behind a proxy that answers DNS itself (Clash
- * fake-IP, a TUN resolver, a corporate split resolver) hit this even though
- * the same URL opens in a browser, because the guard resolves locally while
- * `net.fetch` goes through the proxy (ADR 0177, ADR 0243).
+ * syntactic public-HTTPS check, or the local DNS lookup returned an address
+ * the policy classifies as non-public. Users behind a proxy that answers DNS
+ * itself (Clash fake-IP, a TUN resolver, a corporate split resolver) hit this
+ * even though the same URL opens in a browser, because the guard resolves
+ * locally while `net.fetch` goes through the proxy (ADR 0177, ADR 0243).
+ *
+ * This is a verdict on an address the resolver produced. A resolver that
+ * produces no answer at all is `NETWORK_RESOLVE_FAILED` instead, because
+ * reporting it as an address-check refusal names a decision the guard never
+ * made (issue #419).
*/
NETWORK_POLICY_BLOCKED: "NETWORK_POLICY_BLOCKED",
+ /**
+ * The main-process public-network guard could not classify the target host:
+ * the local DNS lookup returned no answer, or threw before returning one. The
+ * request is refused exactly as before — this is the absence of a verdict,
+ * never permission — but no address was judged, so it must not be reported as
+ * an address-check refusal (ADR 0243, issue #419). Retriable: unlike a policy
+ * refusal, a resolver or proxy that starts answering the same host makes the
+ * same request succeed.
+ */
+ NETWORK_RESOLVE_FAILED: "NETWORK_RESOLVE_FAILED",
AGENT_BUSY: "AGENT_BUSY",
AGENT_NOT_FOUND: "AGENT_NOT_FOUND",
TURN_NOT_FOUND: "TURN_NOT_FOUND",
diff --git a/packages/shared/src/public-network.test.ts b/packages/shared/src/public-network.test.ts
index c6c25a081..9d419ba0e 100644
--- a/packages/shared/src/public-network.test.ts
+++ b/packages/shared/src/public-network.test.ts
@@ -7,6 +7,8 @@ import {
PUBLIC_NETWORK_POLICY_ERROR,
isPublicHostname,
isPublicNetworkPolicyFailure,
+ publicNetworkRefusalDetail,
+ publicNetworkRefusalReason,
} from "./public-network.js";
describe("public network address policy", () => {
@@ -97,4 +99,44 @@ describe("public network address policy", () => {
expect(isPublicNetworkPolicyFailure("PublicNetworkPolicyError")).toBe(false);
expect(PUBLIC_NETWORK_POLICY_ERROR).toBe("PublicNetworkPolicyError");
});
+
+ it("reads a refusal's own reason, and treats an unnamed one as a refusal", () => {
+ // Issue #419: "the resolver answered nothing" and "the resolved address is
+ // not public" need different fixes, so a refusal has to say which one it is
+ // without the reader parsing its message.
+ expect(
+ publicNetworkRefusalDetail({
+ name: PUBLIC_NETWORK_POLICY_ERROR,
+ reason: "resolve-failed",
+ host: "api.github.com",
+ }),
+ ).toEqual({ reason: "resolve-failed", host: "api.github.com" });
+ // An unrecognized or absent reason is still a refusal — never permission —
+ // so a caller that needs the stricter reading gets `undefined`, not a pass.
+ expect(publicNetworkRefusalReason({ name: PUBLIC_NETWORK_POLICY_ERROR })).toBeUndefined();
+ expect(publicNetworkRefusalReason({ name: PUBLIC_NETWORK_POLICY_ERROR, reason: "made-up" })).toBeUndefined();
+ expect(publicNetworkRefusalDetail({ name: PUBLIC_NETWORK_POLICY_ERROR })).toBeUndefined();
+ expect(isPublicNetworkPolicyFailure({ name: PUBLIC_NETWORK_POLICY_ERROR })).toBe(true);
+ // The class travels, the address never does: `benchmark` is a TUN fake-IP
+ // and `private` is a real RFC1918 target, and only the class separates them.
+ expect(
+ publicNetworkRefusalDetail({
+ name: PUBLIC_NETWORK_POLICY_ERROR,
+ reason: "non-public-address",
+ host: "api.github.com",
+ address: "198.18.0.4",
+ addressKind: "benchmark",
+ }),
+ ).toEqual({ reason: "non-public-address", host: "api.github.com", addressKind: "benchmark" });
+ // An unknown class is dropped rather than passed through.
+ expect(
+ publicNetworkRefusalDetail({
+ name: PUBLIC_NETWORK_POLICY_ERROR,
+ reason: "non-public-address",
+ addressKind: "made-up",
+ }),
+ ).toEqual({ reason: "non-public-address" });
+ expect(publicNetworkRefusalDetail(new Error("responded 502"))).toBeUndefined();
+ expect(publicNetworkRefusalDetail(undefined)).toBeUndefined();
+ });
});
diff --git a/packages/shared/src/public-network.ts b/packages/shared/src/public-network.ts
index 9dbd3417b..bcc2b3a9e 100644
--- a/packages/shared/src/public-network.ts
+++ b/packages/shared/src/public-network.ts
@@ -153,6 +153,87 @@ export function isPublicNetworkPolicyFailure(error: unknown): boolean {
);
}
+/**
+ * Why the guard refused, at the granularity a user can act on. Only
+ * `non-public-address` and `url-syntax` are verdicts on the URL itself;
+ * `resolve-failed` means the local resolver produced no answer at all, which is
+ * an environment condition — a proxied or offline resolver — rather than a
+ * policy decision about a resolved address (issue #419, ADR 0243).
+ */
+export type PublicNetworkRefusalReason =
+ | "url-syntax"
+ | "resolve-failed"
+ | "non-public-address"
+ | "redirect-limit";
+
+/**
+ * The structured reason a public-network refusal carries, or `undefined` for an
+ * unrecognized refusal. Callers that must keep the guard's fail-closed behavior
+ * but want to explain it — the skill market's classifier and its diagnostics —
+ * read this instead of re-parsing the message. `undefined` is never permission:
+ * a refusal that cannot name its reason is still a refusal.
+ */
+export function publicNetworkRefusalReason(error: unknown): PublicNetworkRefusalReason | undefined {
+ if (!isPublicNetworkPolicyFailure(error)) return undefined;
+ const reason = (error as { reason?: unknown }).reason;
+ return reason === "url-syntax" ||
+ reason === "resolve-failed" ||
+ reason === "non-public-address" ||
+ reason === "redirect-limit"
+ ? reason
+ : undefined;
+}
+/** A refusal's own account of itself, extractable without importing the client. */
+export type PublicNetworkRefusalDetail = {
+ reason: PublicNetworkRefusalReason;
+ /** The hostname the guard was classifying, when it got that far. */
+ host?: string;
+ /** The class of the address that failed the policy, never the address. */
+ addressKind?: PublicNetworkAddressKind;
+};
+
+const PUBLIC_NETWORK_ADDRESS_KINDS: ReadonlyArray<PublicNetworkAddressKind> = [
+ "public",
+ "invalid",
+ "unspecified",
+ "loopback",
+ "private",
+ "cgnat",
+ "link-local",
+ "multicast",
+ "reserved",
+ "documentation",
+ "benchmark",
+ "ula",
+ "site-local",
+];
+
+/**
+ * What a refusal says about itself: why, which host, and which class of address
+ * failed. Callers that must explain a block — the skill market's classifier and
+ * its diagnostics — read this instead of parsing the message. `addressKind`
+ * travels without the address: the class is what separates a resolver artifact
+ * (`benchmark`, a TUN fake-IP) from a real private target (`private`, RFC1918),
+ * and it is not a secret.
+ */
+export function publicNetworkRefusalDetail(error: unknown): PublicNetworkRefusalDetail | undefined {
+ const reason = publicNetworkRefusalReason(error);
+ if (!reason) return undefined;
+ const source = error as { host?: unknown; addressKind?: unknown };
+ const host = typeof source.host === "string" && source.host ? source.host : undefined;
+ const addressKind = PUBLIC_NETWORK_ADDRESS_KINDS.includes(
+ source.addressKind as PublicNetworkAddressKind,
+ )
+ ? (source.addressKind as PublicNetworkAddressKind)
+ : undefined;
+ return {
+ reason,
+ ...(host ? { host } : {}),
+ ...(addressKind ? { addressKind } : {}),
+ };
+}
+
+
function parseIpv4(value: string): number | null {
const parts = value.split(".");
if (