/** * What dshline can truthfully say about its own installation, and where each * answer comes from. * * Setup exists because a person can reach a working profile and still have no * model, and the reasons are spread across surfaces they would otherwise have * to know the names of. This module gathers those surfaces once. It reads * nothing it does not already have an authority for, and every answer it * cannot establish is an explicit "unknown" rather than a default: * * ``` * Harness generation package manifests on disk, via ../profiles/harness.ts * the running profile the same reading (ctx.dshHomePath + ctx.baseUrl) * routes, sign-ins, ../connect/catalog.ts — the SAME pass `/connect` draws * credentials, seams * ``` * * The connect reading is deliberately the real `ConnectCatalog` rather than a * cheaper summary of its inputs. Setup's whole claim is "here is why `/model` * has nothing to offer," and any second, simpler gathering would be a second * opinion about it — one that could tell a reader their route was dormant * while `/connect`, a keystroke later, said otherwise. * * ## Why the Harness generation is read off disk * * Harness publishes no runtime version service at the adopted generation. * There is no `ctx.version`, `dsh-brand` carries only compile-time branding, * and `dsh-plugin-package-inventory-deepseek` builds a package list solely as * request metadata for the official API — nothing a surface can ask. So the * only evidence is manifests, which is exactly what `/profiles` already reads * and tests: {@link readProfiles} resolves each bundle through the two * directories a bundle can live in, in Harness's own documented order. * * The two sides of the comparison: * * - **Adopted** — this package's own `peerDependencies`. That is the * repository's real authority and not a copy of one: * `tools/harness-target.mjs` and its spec fail the suite unless every * `dsh-*` spec in this manifest is exactly `HARNESS_TARGET.version`, so * there is no constant here to drift and no example version written down. * - **Installed** — the running profile's `@deepseek-ai/dsh-base` version. * Upstream cuts one version across every package in a release commit, so a * bundle's version IS the generation. * * Node is deliberately reported WITHOUT a verdict. The one thing a check here * could add is whether this runtime satisfies `engines`, and answering that * means evaluating a semver range — a version-compatibility engine, which is * the thing this repository refuses to grow and has no dependency budget for. * The version itself is what a bug report asks for, so it is reported as a * fact and nothing is claimed about it. * @module dshline/setup/harness */ import type { Context } from '@deepseek-ai/cordis'; import type { ModelSelection } from '@deepseek-ai/dsh-agent'; import type { ConnectState } from '../connect/index.ts'; import type { SetupReason } from './model.ts'; /** How the installed Harness generation compares with the adopted one. */ export type HarnessGeneration = /** Both were read and they agree. */ { readonly kind: 'match'; readonly version: string; } /** Both were read and they differ. */ | { readonly kind: 'mismatch'; readonly adopted: string; readonly installed: string; } /** * At least one side could not be read, so nothing is claimed about either. * Whichever side WAS read is still carried, because half an answer is worth * printing and is not worth guessing the other half from. */ | { readonly kind: 'unknown'; readonly adopted: string | undefined; readonly installed: string | undefined; }; /** Everything one setup pass established. */ export interface SetupFacts { /** The Node this process runs on. Reported, never judged; see the module note. */ readonly node: string; /** This frontend's version, from the one constant the banner already prints. */ readonly dshline: string; /** How the installed Harness generation compares with the adopted one. */ readonly harness: HarnessGeneration; /** The profile this Host booted, or undefined when it cannot be determined. */ readonly profile: string | undefined; /** * The same reading `/connect` draws: routes, sign-ins, mounted seams, and * which sign-ins are authorized against a route nothing has registered. */ readonly connect: ConnectState; /** * The selection the next model step would use, read from the window's own * ref — the same one `/model` writes — rather than resolved a second time * here. */ readonly selected: SetupSelection | undefined; /** * Why this launch cannot send a turn, or undefined when it can. Carried on * the facts so the report and the offered steps answer from one judgement * instead of each re-deriving it. */ readonly reason: SetupReason | undefined; /** * The credential reference the selected route names, when it names one and * the reading reached it. Present so the report can say WHICH reference to * set rather than only that one is missing. */ readonly credentialRef: string | undefined; } /** The parts of a model selection setup reports and reasons about. */ export type SetupSelection = Pick; /** * The Harness generation this build of dshline adopted. * * Read from the manifest rather than a constant, because a constant would be a * second place for the target to be written down and a third thing for a * release check to keep in step. The manifest ships in every published tarball * (npm always includes it), and `src/` and `lib/` are siblings, so the same * relative path resolves whether this module was loaded from source in a test * or from the compiled output in a profile. * @returns the version every `dsh-*` peer is pinned to, or undefined when the * manifest cannot be read or pins nothing. */ export declare function adoptedGeneration(): string | undefined; /** * Compare what is installed against what was adopted. * @param adopted - the adopted generation, when it could be read. * @param installed - the installed generation, when it could be read. * @returns the comparison, with `unknown` whenever either side is missing. */ export declare function compareGenerations(adopted: string | undefined, installed: string | undefined): HarnessGeneration; /** * Compare the installed Harness generation with the adopted one. * * The one comparison the report and the startup gate both use. A second * reading written for the gate would be a second authority that could tell a * reader their pair is coherent while the report beside it said otherwise — * exactly the disagreement the report's single-pass design exists to prevent. * @param ctx - the plugin context carrying `dshHomePath` and `baseUrl`. * @returns the comparison, with `unknown` whenever either side is missing. */ export declare function readHarnessGeneration(ctx: Context): Promise; /** * Read every surface setup reports on, once. * @param ctx - the plugin context carrying the Harness seams. * @param version - this frontend's version, from the runner's own constant. * @param selected - the window's current model selection, when it has one. * @returns the facts, with each unreadable one marked rather than defaulted. */ export declare function gatherSetupFacts(ctx: Context, version: string, selected: SetupSelection | undefined): Promise; //# sourceMappingURL=harness.d.ts.map