@sentropic/h2a 0.90.1 → 0.90.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +1 -1
  3. package/dist/cli-contract.js +2 -2
  4. package/dist/cli-contract.js.map +1 -1
  5. package/dist/cli.d.ts +6 -1
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +66 -6
  8. package/dist/cli.js.map +1 -1
  9. package/dist/hosts/installation-doctor.d.ts +124 -0
  10. package/dist/hosts/installation-doctor.d.ts.map +1 -0
  11. package/dist/hosts/installation-doctor.js +2201 -0
  12. package/dist/hosts/installation-doctor.js.map +1 -0
  13. package/dist/index.d.ts +1 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +1 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/runtime/feed/index.d.ts +1 -0
  18. package/dist/runtime/feed/index.d.ts.map +1 -1
  19. package/dist/runtime/feed/index.js +1 -0
  20. package/dist/runtime/feed/index.js.map +1 -1
  21. package/dist/runtime/feed/local.d.ts +43 -0
  22. package/dist/runtime/feed/local.d.ts.map +1 -0
  23. package/dist/runtime/feed/local.js +31 -0
  24. package/dist/runtime/feed/local.js.map +1 -0
  25. package/dist/runtime/host-config-root.d.ts +15 -0
  26. package/dist/runtime/host-config-root.d.ts.map +1 -0
  27. package/dist/runtime/host-config-root.js +26 -0
  28. package/dist/runtime/host-config-root.js.map +1 -0
  29. package/dist/runtime/identity/readers.d.ts.map +1 -1
  30. package/dist/runtime/identity/readers.js +4 -3
  31. package/dist/runtime/identity/readers.js.map +1 -1
  32. package/dist/runtime/local-files/paths.d.ts.map +1 -1
  33. package/dist/runtime/local-files/paths.js +10 -1
  34. package/dist/runtime/local-files/paths.js.map +1 -1
  35. package/dist/runtime/version/agent-version.d.ts.map +1 -1
  36. package/dist/runtime/version/agent-version.js +3 -2
  37. package/dist/runtime/version/agent-version.js.map +1 -1
  38. package/package.json +2 -2
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Host-installation convergence for `h2a doctor`.
3
+ *
4
+ * The h2a plugin is the canonical host integration. A direct `mcp-serve`
5
+ * configuration alongside that plugin starts a second endpoint, and the old
6
+ * standalone Track MCP starts a competing projection of `track_*` tools. This
7
+ * module treats both as an incoherent installation rather than a warning.
8
+ *
9
+ * Host plugin CLIs retain authority over their own installation registries.
10
+ * Doctor repairs their plain configuration/cache residue itself, then asks the
11
+ * native CLI to install/update the canonical `h2a@sentropic` plugin. A command
12
+ * failure is retained as an unrepaired finding; it must never become a clean
13
+ * result merely because a config file was edited.
14
+ */
15
+ import type { H2ASession } from "../session.js";
16
+ export declare const H2A_PLUGIN_SELECTOR = "h2a@sentropic";
17
+ export declare const H2A_MARKETPLACE_NAME = "sentropic";
18
+ export declare const H2A_MARKETPLACE_REPOSITORY = "rhanka/h2a";
19
+ export declare const H2A_MARKETPLACE_GIT_URL = "https://github.com/rhanka/h2a.git";
20
+ export declare const HOST_REPAIR_FRESHNESS_GUARANTEE = "doctor guarantees the coherence of the repairs it performed. It does not detect installation changes made by other tools; after changing your installation by hand, restart your sessions.";
21
+ export declare const HOST_REPAIR_NATIVE_COMMAND_FAILURE_LIMIT = "If a native host CLI fails after it has already changed the installation, doctor reports the failure as host-command-failed and does not undo what that CLI already did. Doctor's own configuration writes are atomic. It has no snapshot of third-party state and does not simulate one: a partial restore would promise a recovery it cannot deliver. After a reported native failure, verify the host installation before relying on it.";
22
+ type Host = "claude" | "codex";
23
+ export interface HostCommandResult {
24
+ readonly ok: boolean;
25
+ readonly message?: string;
26
+ }
27
+ export type HostCommandRunner = (command: "claude" | "codex", args: readonly string[]) => HostCommandResult;
28
+ export interface HostInstallationDoctorOptions {
29
+ readonly home?: string;
30
+ /** `false` is inspect-only. `true` performs the documented repair. */
31
+ readonly repair?: boolean;
32
+ /** Injectable for hermetic tests; production uses the running CLI version. */
33
+ readonly version?: string;
34
+ /** Injectable for hermetic tests; production invokes the native host CLI. */
35
+ readonly runHostCommand?: HostCommandRunner;
36
+ /** Test-only native-CLI reachability override; configuration artifacts decide host installation. */
37
+ readonly testHostCliReachable?: (host: Host) => boolean;
38
+ /** Test-only responses from the known-good and candidate Codex configuration probes. */
39
+ readonly testCodexConfigurationOracle?: {
40
+ readonly knownGood: HostCommandResult;
41
+ readonly candidate: HostCommandResult;
42
+ };
43
+ /** Test-only responses from the known-good and candidate Claude configuration probes. */
44
+ readonly testClaudeConfigurationOracle?: {
45
+ readonly knownGood: HostCommandResult;
46
+ readonly candidate: HostCommandResult;
47
+ };
48
+ /** Injectable for hermetic tests; production writes the durable repair marker. */
49
+ readonly writeRepairMarker?: (path: string, content: string) => void;
50
+ /** Report host repair findings and planned actions without mutating the host. */
51
+ readonly dryRun?: boolean;
52
+ /** Test-only Claude uninstall requests used to exercise the native-command boundary. */
53
+ readonly testClaudePluginUninstalls?: readonly string[];
54
+ /** Test-only fault injection for the atomic configuration-write boundary. */
55
+ readonly testConfigurationWrite?: {
56
+ readonly mutateRendered?: (path: string, format: "json" | "toml", rendered: string) => string;
57
+ readonly beforeRename?: (path: string, temporaryPath: string) => void;
58
+ readonly rename?: (temporaryPath: string, path: string) => void;
59
+ };
60
+ }
61
+ export interface HostInstallationFinding {
62
+ readonly code: "config-preserved" | "config-invalid" | "marketplace-missing" | "marketplace-stale" | "plugin-missing" | "plugin-stale" | "version-skew" | "orphan-cache" | "h2a-endpoint-count" | "standalone-track-mcp" | "host-command-failed" | "host-command-refused" | "host-command-unavailable" | "host-cli-unreachable" | "host-cli-unavailable" | "host-config-unavailable" | "host-config-unverifiable" | "host-not-installed" | "ownership-unverified" | "repair-marker-unavailable" | "repair-marker-write-failed" | "runtime-artifact-unavailable";
63
+ readonly message: string;
64
+ readonly path?: string;
65
+ }
66
+ export interface HostRepairMarker {
67
+ readonly path: string;
68
+ readonly repairedAt: string;
69
+ /** Concrete paths that a completed repair actually changed. */
70
+ readonly repairedPaths: readonly string[];
71
+ }
72
+ export interface HostInstallationReport {
73
+ readonly host: Host;
74
+ readonly ok: boolean;
75
+ readonly findings: readonly HostInstallationFinding[];
76
+ /** Non-blocking inspection notes; never a host-health or session-freshness verdict. */
77
+ readonly diagnostics: readonly HostInstallationFinding[];
78
+ readonly changed: readonly string[];
79
+ /** Deliberately retained host state, named precisely and never a health failure. */
80
+ readonly preserved: readonly HostInstallationFinding[];
81
+ /** Operations doctor attempted but could not complete; always prevent a healthy host verdict. */
82
+ readonly failures: readonly HostInstallationFinding[];
83
+ /** State doctor needed to verify but could not establish safely; always prevents a healthy host verdict. */
84
+ readonly unverifiable: readonly HostInstallationFinding[];
85
+ /** Backward-compatible flat view of blocking failures and unverifiable state. */
86
+ readonly unrepaired: readonly HostInstallationFinding[];
87
+ /** Declared artifacts retained for diagnostics and to determine precisely what a repair rewrote. */
88
+ readonly coherencePaths: readonly string[];
89
+ /** Host actions proposed by doctor; legacy-plugin transitions retain their prior value. */
90
+ readonly plannedActions: readonly string[];
91
+ /** Expected durable repair-marker location, whether or not it currently exists. */
92
+ readonly repairMarkerPath: string;
93
+ /** Durable fact recorded after this host installation was repaired. */
94
+ readonly repairMarker?: HostRepairMarker;
95
+ }
96
+ export interface HostInstallationDoctorReport {
97
+ readonly ok: boolean;
98
+ readonly repair: boolean;
99
+ readonly dryRun: boolean;
100
+ /** Exact boundary of the live-session restart guarantee. */
101
+ readonly sessionFreshnessGuarantee: string;
102
+ /** Exact boundary of recovery from a native host CLI failure. */
103
+ readonly nativeCommandFailureLimit: string;
104
+ readonly version: string;
105
+ readonly hosts: readonly HostInstallationReport[];
106
+ }
107
+ export interface LiveHostSessionFinding {
108
+ readonly host: Host;
109
+ readonly sessionId: string;
110
+ readonly startedAt: string;
111
+ readonly configPath: string;
112
+ readonly message: string;
113
+ }
114
+ /** Inspect, and optionally repair, the H2A installation state of both supported hosts. */
115
+ export declare function doctorHostInstallations(options?: HostInstallationDoctorOptions): HostInstallationDoctorReport;
116
+ /**
117
+ * A host repair cannot rewire an already-open stdio connection. A recorded
118
+ * repair marker is authoritative for our repairs. Doctor does not infer the
119
+ * complete runtime load graph, so externally modified artifacts are diagnostic
120
+ * only and never become a live-session freshness verdict.
121
+ */
122
+ export declare function findLiveSessionsPredatingHostConfig(sessions: readonly H2ASession[], hosts: readonly HostInstallationReport[]): LiveHostSessionFinding[];
123
+ export {};
124
+ //# sourceMappingURL=installation-doctor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installation-doctor.d.ts","sourceRoot":"","sources":["../../src/hosts/installation-doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAuBH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAIhD,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AACnD,eAAO,MAAM,oBAAoB,cAAc,CAAC;AAChD,eAAO,MAAM,0BAA0B,eAAe,CAAC;AACvD,eAAO,MAAM,uBAAuB,sCAAsC,CAAC;AAC3E,eAAO,MAAM,+BAA+B,+LACkJ,CAAC;AAC/L,eAAO,MAAM,wCAAwC,gbAC0X,CAAC;AAEhb,KAAK,IAAI,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE/B,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,MAAM,iBAAiB,GAAG,CAC9B,OAAO,EAAE,QAAQ,GAAG,OAAO,EAC3B,IAAI,EAAE,SAAS,MAAM,EAAE,KACpB,iBAAiB,CAAC;AAEvB,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,6EAA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