@flue/client 0.0.20 → 0.0.22

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.
@@ -10,6 +10,7 @@ import { i as ProxyService, n as ProxyPolicy, r as ProxyPresetResult, t as Polic
10
10
  */
11
11
  declare function anthropic(opts?: {
12
12
  apiKey?: string;
13
+ policy?: string | ProxyPolicy;
13
14
  }): ProxyService;
14
15
  //#endregion
15
16
  //#region src/proxies/github.d.ts
@@ -26,6 +26,7 @@ function anthropic(opts) {
26
26
  filtered["x-api-key"] = apiKey;
27
27
  return { headers: filtered };
28
28
  },
29
+ policy: opts?.policy ?? "allow-all",
29
30
  isModelProvider: true,
30
31
  providerConfig: {
31
32
  providerKey: "anthropic",
@@ -94,17 +95,32 @@ function github(opts) {
94
95
  function resolveGitHubPolicy(policy) {
95
96
  if (typeof policy !== "string") return policy;
96
97
  switch (policy) {
97
- case "read-only": return { default: "deny-non-safe" };
98
- case "read-only+clone": return {
98
+ case "read-only": return {
99
99
  default: "deny-non-safe",
100
100
  allow: [{
101
101
  method: "POST",
102
- path: "/*/git-upload-pack"
103
- }, {
104
- method: "GET",
105
- path: "/*/info/refs"
102
+ path: "/graphql",
103
+ body: githubBody.graphql()
106
104
  }]
107
105
  };
106
+ case "read-only+clone": return {
107
+ default: "deny-non-safe",
108
+ allow: [
109
+ {
110
+ method: "POST",
111
+ path: "/graphql",
112
+ body: githubBody.graphql()
113
+ },
114
+ {
115
+ method: "POST",
116
+ path: "/*/git-upload-pack"
117
+ },
118
+ {
119
+ method: "GET",
120
+ path: "/*/info/refs"
121
+ }
122
+ ]
123
+ };
108
124
  case "allow-all": return { default: "allow-all" };
109
125
  default: throw new Error(`Unknown github() policy level: '${policy}'`);
110
126
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flue/client",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "exports": {