hmcp-web 0.0.1 → 0.2.0

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 (94) hide show
  1. package/LICENSE +77 -0
  2. package/README.md +49 -2
  3. package/THIRD-PARTY-NOTICES.md +110 -0
  4. package/bin/hmcp-web.js +20 -0
  5. package/dist/api.d.ts +22 -0
  6. package/dist/api.js +1458 -0
  7. package/dist/cli.d.ts +2 -0
  8. package/dist/cli.js +40 -0
  9. package/dist/contracts/onboarding.d.ts +233 -0
  10. package/dist/contracts/onboarding.js +1 -0
  11. package/dist/http.d.ts +72 -0
  12. package/dist/http.js +319 -0
  13. package/dist/index.d.ts +7 -0
  14. package/dist/index.js +7 -0
  15. package/dist/model/app-servers.d.ts +85 -0
  16. package/dist/model/app-servers.js +109 -0
  17. package/dist/model/console-settings.d.ts +37 -0
  18. package/dist/model/console-settings.js +74 -0
  19. package/dist/model/doctor.d.ts +68 -0
  20. package/dist/model/doctor.js +254 -0
  21. package/dist/model/fs-browse.d.ts +9 -0
  22. package/dist/model/fs-browse.js +184 -0
  23. package/dist/model/gateway-config.d.ts +287 -0
  24. package/dist/model/gateway-config.js +760 -0
  25. package/dist/model/import-record.d.ts +80 -0
  26. package/dist/model/import-record.js +179 -0
  27. package/dist/model/metrics.d.ts +65 -0
  28. package/dist/model/metrics.js +213 -0
  29. package/dist/model/oauth-flows.d.ts +60 -0
  30. package/dist/model/oauth-flows.js +79 -0
  31. package/dist/model/pipeline.d.ts +58 -0
  32. package/dist/model/pipeline.js +84 -0
  33. package/dist/model/probe.d.ts +155 -0
  34. package/dist/model/probe.js +385 -0
  35. package/dist/model/process.d.ts +100 -0
  36. package/dist/model/process.js +278 -0
  37. package/dist/model/protection.d.ts +378 -0
  38. package/dist/model/protection.js +470 -0
  39. package/dist/model/registry-cache.d.ts +59 -0
  40. package/dist/model/registry-cache.js +238 -0
  41. package/dist/model/scan.d.ts +48 -0
  42. package/dist/model/scan.js +59 -0
  43. package/dist/model/server.d.ts +127 -0
  44. package/dist/model/server.js +243 -0
  45. package/dist/model/tools.d.ts +61 -0
  46. package/dist/model/tools.js +72 -0
  47. package/dist/routes/catalog.d.ts +8 -0
  48. package/dist/routes/catalog.js +47 -0
  49. package/dist/routes/connect-import.d.ts +9 -0
  50. package/dist/routes/connect-import.js +594 -0
  51. package/dist/routes/connect.d.ts +50 -0
  52. package/dist/routes/connect.js +691 -0
  53. package/dist/routes/github.d.ts +97 -0
  54. package/dist/routes/github.js +587 -0
  55. package/dist/routes/guard.d.ts +3 -0
  56. package/dist/routes/guard.js +166 -0
  57. package/dist/routes/oauth.d.ts +55 -0
  58. package/dist/routes/oauth.js +406 -0
  59. package/dist/routes/policy.d.ts +34 -0
  60. package/dist/routes/policy.js +513 -0
  61. package/dist/routes/runtime.d.ts +12 -0
  62. package/dist/routes/runtime.js +921 -0
  63. package/dist/routes/servers-add.d.ts +32 -0
  64. package/dist/routes/servers-add.js +1091 -0
  65. package/dist/routes/system.d.ts +4 -0
  66. package/dist/routes/system.js +13 -0
  67. package/dist/start.d.ts +56 -0
  68. package/dist/start.js +164 -0
  69. package/dist-ui/assets/Activity-CZ78RyRO.js +1 -0
  70. package/dist-ui/assets/Approvals-DPIlNZsv.js +1 -0
  71. package/dist-ui/assets/AttachApp-DjSeWCbS.js +5 -0
  72. package/dist-ui/assets/Connections-qcA96lXh.js +2 -0
  73. package/dist-ui/assets/Gallery-DB_OO7Vw.js +17 -0
  74. package/dist-ui/assets/PreApprovals-C4cKajcK.js +1 -0
  75. package/dist-ui/assets/Protection-B8h-5YAb.js +1 -0
  76. package/dist-ui/assets/Safety-BQqHyYdo.js +1 -0
  77. package/dist-ui/assets/Settings-Cx50zZSt.js +1 -0
  78. package/dist-ui/assets/StartPage-CdX-v7ej.js +1 -0
  79. package/dist-ui/assets/Suggestions-CRo5UOTT.js +1 -0
  80. package/dist-ui/assets/Tools-xo39lPKB.js +4 -0
  81. package/dist-ui/assets/index-DttDjRpu.js +16 -0
  82. package/dist-ui/assets/index-QeJyD5z2.css +2 -0
  83. package/dist-ui/assets/kit-DRVm92_t.js +4 -0
  84. package/dist-ui/brand/logo-256.png +0 -0
  85. package/dist-ui/brand/logo-512.png +0 -0
  86. package/dist-ui/brand/logo.svg +6 -0
  87. package/dist-ui/brand/mark.svg +5 -0
  88. package/dist-ui/fonts/OFL.txt +99 -0
  89. package/dist-ui/fonts/README.md +21 -0
  90. package/dist-ui/fonts/jetbrainsmono-latin.woff2 +0 -0
  91. package/dist-ui/fonts/manrope-latin.woff2 +0 -0
  92. package/dist-ui/index.html +51 -0
  93. package/package.json +69 -6
  94. package/bin/notice.js +0 -7
@@ -0,0 +1,97 @@
1
+ import { type Effect, type Policy } from "hmcp-core";
2
+ import { type ProbeOutcome, type Upstream } from "hmcp-gateway";
3
+ import type { ApiOptions } from "../api.js";
4
+ import { type Route } from "../http.js";
5
+ import { type LoadedServer } from "../model/server.js";
6
+ /**
7
+ * Making hmcp the only way an AI app changes GitHub.
8
+ *
9
+ * Three parts. The doors: every other way a change could reach GitHub from
10
+ * this computer, which are only ever read here and reported without a
11
+ * value. Claude Code's own block, which writes three deny rules into its
12
+ * settings and can be undone. And the toolbox's GitHub server itself: one
13
+ * switch from GitHub's read-only address to the one that can make changes,
14
+ * which writes the GitHub pack's rules first so every change still waits for
15
+ * the person, and a self-check that says whether it works.
16
+ */
17
+ /** A probe of one server, overridable so a test needs no GitHub. */
18
+ export type GithubProbe = (spec: Upstream, server: LoadedServer) => Promise<ProbeOutcome>;
19
+ export interface GithubRouteDeps {
20
+ readonly probe?: GithubProbe;
21
+ }
22
+ /**
23
+ * What a change to GitHub would actually meet in this toolbox, from
24
+ * `decide()` over the GitHub pack's change tools -- so the card says "waits
25
+ * for you" only when it does. Computed whether or not changes are switched
26
+ * on yet: on the read-only address, it is what switching would lead to.
27
+ */
28
+ export interface GithubChangeState {
29
+ /**
30
+ * waits: every change asks first. refused: every change is blocked.
31
+ * partly-refused: some are. runs: some run unasked. observe: nothing is
32
+ * enforced. unchecked: the server's tools aren't known yet. no-changes: it
33
+ * lists none that change anything.
34
+ */
35
+ readonly kind: "waits" | "refused" | "partly-refused" | "runs" | "observe" | "unchecked" | "no-changes";
36
+ /** The toolbox's stance (read-only / approve-writes / locked), for the words. */
37
+ readonly posture: string;
38
+ /** An active pre-approval covers one of the change tools. */
39
+ readonly preApproved: boolean;
40
+ /** The tools that run unasked or are refused, for "runs" and "partly-refused". */
41
+ readonly tools?: readonly string[];
42
+ }
43
+ /** Each toolbox's GitHub servers, and which of GitHub's two hosted addresses each uses. */
44
+ export interface GithubServerView {
45
+ readonly gatewayId: string;
46
+ readonly gatewayLabel: string;
47
+ readonly configPath: string;
48
+ readonly upstream: string;
49
+ /** "readonly" / "changes" for GitHub's hosted server, null for any other GitHub server. */
50
+ readonly access: "readonly" | "changes" | null;
51
+ /** The gateway.yaml digest, for the switch's lost-update check. */
52
+ readonly digest: string;
53
+ /** Null when the toolbox's policy can't be loaded. */
54
+ readonly changes: GithubChangeState | null;
55
+ }
56
+ /** One tool as the server really lists it. */
57
+ export interface KnownTool {
58
+ /** The server's own name for it. */
59
+ readonly name: string;
60
+ /** As the AI app sees it, `<upstream>__<tool>`. */
61
+ readonly exposedName: string;
62
+ /** The gateway's own reading of it; undefined when nothing classified it. */
63
+ readonly effect: Effect | undefined;
64
+ }
65
+ export declare function rememberListed(gatewayId: string, upstream: string, outcome: ProbeOutcome | null): void;
66
+ /**
67
+ * What a change would meet, graded over the tools the server really lists:
68
+ * every one that isn't a read is a change tool. With no list yet, it says
69
+ * so ("unchecked") rather than guess from the pack's names, most of which
70
+ * a given release of GitHub's server doesn't use.
71
+ */
72
+ export declare function changeState(server: LoadedServer, gatewayId: string, upstream: string): GithubChangeState;
73
+ /**
74
+ * The tools whose decision is less strict under `after` than under `before`
75
+ * (deny → approve or allow, approve → allow). The same posture, enforcement
76
+ * and tenant hold in both, since only rules are added, so any difference is
77
+ * the rules'. A pack rule placed above a rule the person wrote would show
78
+ * here, which is the case this exists for.
79
+ */
80
+ export declare function loosenedTools(before: Policy, after: Policy, tools: readonly (string | {
81
+ readonly name: string;
82
+ readonly effect?: Effect | undefined;
83
+ })[]): string[];
84
+ export interface CheckLine {
85
+ readonly ok: boolean;
86
+ readonly text: string;
87
+ }
88
+ export declare const KEY_NOTE: string;
89
+ /**
90
+ * Whether the toolbox side works: the server connects, it offers tools that
91
+ * make changes, and how every tool it lists is decided under the policy as it
92
+ * is now. Green only when every tool that isn't a read waits for the person
93
+ * (or is refused, which is said in so many words). Whether the key itself may
94
+ * write can only be known from a call.
95
+ */
96
+ export declare function checkLines(outcome: ProbeOutcome, upstream: Upstream, policy: Policy): CheckLine[];
97
+ export declare function githubRoutes(options: ApiOptions, deps?: GithubRouteDeps): Route[];