/** * wire-verb-availability.ts, the runtime discriminator that lets a memory wire * consumer tell "no such record" apart from "this daemon does not serve this verb". * * THE PROBLEM THIS SOLVES. A newer consumer may talk to an OLDER daemon that never * registered an extended memory route (list / update / links / search-semantic / * export …). Calling such a route hits the daemon's terminal route-not-found 404. * A record-scoped verb (update / link) against a CURRENT daemon can ALSO 404, when * the addressed record genuinely does not exist. Both are HTTP 404, so a consumer * that inspects only the status folds BOTH to `null` and then reports an existing * record as "not found" against an older daemon, a silent data lie on the exact * version-skew path the wire feature advertises as supported. * * THE RUNTIME SIGNAL. The daemon already distinguishes the two in the response BODY: * a genuine record-miss carries `code: MEMORY_RECORD_NOT_FOUND_CODE` * (daemon-sdk's memory handlers), while a route-not-found carries the terminal * 404's `code: 'NOT_FOUND'`. So the disposition is read from the body code, NOT the * transport object's shape: * - 404 + record-missing code → 'record-missing' (safe to fold to null) * - 404 + any OTHER code, or NO code → 'method-unavailable' (honest reject) * - anything that is not a 404 → 'other' (propagate unchanged) * * THE LEGACY-404 RULING. A pre-error-unification daemon may answer a bare 404 with * no structured code at all. That 404 is ambiguous, it could be either case, and * we deliberately treat it as 'method-unavailable', NOT 'record-missing'. A loud * wrong ("this daemon does not serve X" when the record was in fact simply absent) * is recoverable and honest; a silent wrong (reporting an existing record as gone) * is the exact dishonest-recall failure this whole design exists to prevent. Never * silently null on an ambiguous 404. */ /** How a caught wire error should be treated by an extended-verb call site. */ export type MemoryWire404Disposition = 'record-missing' | 'method-unavailable' | 'other'; /** * Classify a caught memory wire error. Returns 'other' for anything that is not a * 404 (network, auth, malformed body, 5xx) so the caller propagates it unchanged. */ export declare function classifyMemoryWireError(error: unknown): MemoryWire404Disposition; /** * The single canonical "the adopted daemon does not serve this verb" rejection. * Every consumer (the SDK client's own fallback plus each wire transport) throws * THIS so the surfaced message is identical everywhere. */ export declare function memoryVerbUnavailableError(verb: string, cause?: unknown): Error; /** * The fold a transport's extended-verb catch block runs. Given the caught wire * error: * - 'method-unavailable' → throw {@link memoryVerbUnavailableError} (the older * daemon never served this route, a loud, honest reject); * - 'record-missing' → return normally (the caller decides what a genuine * record-miss means for its return type: `null` for a nullable verb, or a * rethrow for a non-nullable one); * - 'other' → rethrow the original error unchanged. * * A nullable record-scoped verb uses it as `foldMemoryWireExtendedError(v, e); return null;` *, the fold throws for the version-skew case and only falls through to `null` * for a genuine record-miss. */ export declare function foldMemoryWireExtendedError(verb: string, error: unknown): void; //# sourceMappingURL=wire-verb-availability.d.ts.map