@bjorntech/key-ferry 0.1.7 → 0.1.9

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 (56) hide show
  1. package/README.md +80 -14
  2. package/SECURITY.md +20 -0
  3. package/dist/broker-registry.d.ts +30 -0
  4. package/dist/broker-registry.d.ts.map +1 -0
  5. package/dist/broker-registry.js +347 -0
  6. package/dist/broker-registry.js.map +1 -0
  7. package/dist/contracts.d.ts +23 -0
  8. package/dist/contracts.d.ts.map +1 -1
  9. package/dist/contracts.js.map +1 -1
  10. package/dist/options.d.ts +7 -0
  11. package/dist/options.d.ts.map +1 -1
  12. package/dist/options.js +28 -2
  13. package/dist/options.js.map +1 -1
  14. package/dist/plugin.d.ts +7 -1
  15. package/dist/plugin.d.ts.map +1 -1
  16. package/dist/plugin.js +90 -169
  17. package/dist/plugin.js.map +1 -1
  18. package/dist/project-config.d.ts +3 -0
  19. package/dist/project-config.d.ts.map +1 -0
  20. package/dist/project-config.js +3 -0
  21. package/dist/project-config.js.map +1 -0
  22. package/dist/rpc.d.ts +141 -6
  23. package/dist/rpc.d.ts.map +1 -1
  24. package/dist/rpc.js +117 -35
  25. package/dist/rpc.js.map +1 -1
  26. package/dist/scoped-config.d.ts +35 -0
  27. package/dist/scoped-config.d.ts.map +1 -0
  28. package/dist/scoped-config.js +224 -0
  29. package/dist/scoped-config.js.map +1 -0
  30. package/dist/scoped-controller.d.ts +40 -0
  31. package/dist/scoped-controller.d.ts.map +1 -0
  32. package/dist/scoped-controller.js +468 -0
  33. package/dist/scoped-controller.js.map +1 -0
  34. package/dist/scopes/controller-helpers.d.ts +47 -0
  35. package/dist/scopes/controller-helpers.d.ts.map +1 -0
  36. package/dist/scopes/controller-helpers.js +268 -0
  37. package/dist/scopes/controller-helpers.js.map +1 -0
  38. package/dist/scopes/controller-types.d.ts +22 -0
  39. package/dist/scopes/controller-types.d.ts.map +1 -0
  40. package/dist/scopes/controller-types.js +2 -0
  41. package/dist/scopes/controller-types.js.map +1 -0
  42. package/dist/tui.d.ts +31 -33
  43. package/dist/tui.d.ts.map +1 -1
  44. package/dist/tui.js +111 -35
  45. package/dist/tui.js.map +1 -1
  46. package/docs/architecture.md +27 -1
  47. package/docs/troubleshooting.md +27 -2
  48. package/examples/README.md +47 -0
  49. package/examples/global/.env.schema +6 -0
  50. package/examples/global/opencode.json +31 -0
  51. package/examples/project/.env.schema +6 -0
  52. package/examples/project/.opencode/key-ferry.jsonc +10 -0
  53. package/examples/project/opencode.json +11 -0
  54. package/examples/{opencode.jsonc → single-project/opencode.json} +18 -17
  55. package/package.json +4 -1
  56. /package/examples/{.env.schema → single-project/.env.schema} +0 -0
package/dist/rpc.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Schema } from "effect";
2
2
  import { VarlockError, type SafeStatus } from "./contracts.js";
3
3
  export declare const SafeStatusSchema: Schema.Struct<{
4
- readonly phase: Schema.String;
4
+ readonly phase: Schema.Literals<readonly ["stopped", "starting", "ready", "degraded", "failed", "stopping"]>;
5
5
  readonly projectDirectory: Schema.String;
6
6
  readonly generation: Schema.Number;
7
7
  readonly pid: Schema.optional<Schema.Number>;
@@ -17,14 +17,37 @@ export declare const SafeStatusSchema: Schema.Struct<{
17
17
  readonly server: Schema.String;
18
18
  readonly message: Schema.String;
19
19
  }>>>;
20
+ readonly scopes: Schema.optional<Schema.$Array<Schema.Struct<{
21
+ readonly scope: Schema.Literals<readonly ["global", "project"]>;
22
+ readonly projectDirectory: Schema.String;
23
+ readonly phase: Schema.Literals<readonly ["stopped", "starting", "ready", "degraded", "failed", "stopping"]>;
24
+ readonly generation: Schema.Number;
25
+ readonly pid: Schema.optional<Schema.Number>;
26
+ readonly lastRefreshAt: Schema.optional<Schema.String>;
27
+ readonly error: Schema.optional<Schema.Struct<{
28
+ readonly code: Schema.String;
29
+ readonly message: Schema.String;
30
+ readonly retryable: Schema.Boolean;
31
+ }>>;
32
+ readonly diagnostics: Schema.optional<Schema.$Array<Schema.Struct<{
33
+ readonly code: Schema.String;
34
+ readonly server: Schema.String;
35
+ readonly message: Schema.String;
36
+ }>>>;
37
+ readonly activation: Schema.optional<Schema.Literals<readonly ["auto", "manual", "awaiting_activation"]>>;
38
+ }>>>;
39
+ readonly bindings: Schema.optional<Schema.$Record<Schema.String, Schema.Literals<readonly ["global", "project"]>>>;
20
40
  }>;
21
41
  export declare const KeyFerryRpc: {
22
42
  readonly id: "key-ferry";
23
43
  readonly methods: {
24
44
  readonly status: {
25
- readonly input: Schema.Struct<{}>;
45
+ readonly input: Schema.Struct<{
46
+ readonly scope: Schema.optional<Schema.Literals<readonly ["global", "project"]>>;
47
+ readonly server: Schema.optional<Schema.NonEmptyString>;
48
+ }>;
26
49
  readonly output: Schema.Struct<{
27
- readonly phase: Schema.String;
50
+ readonly phase: Schema.Literals<readonly ["stopped", "starting", "ready", "degraded", "failed", "stopping"]>;
28
51
  readonly projectDirectory: Schema.String;
29
52
  readonly generation: Schema.Number;
30
53
  readonly pid: Schema.optional<Schema.Number>;
@@ -40,6 +63,26 @@ export declare const KeyFerryRpc: {
40
63
  readonly server: Schema.String;
41
64
  readonly message: Schema.String;
42
65
  }>>>;
66
+ readonly scopes: Schema.optional<Schema.$Array<Schema.Struct<{
67
+ readonly scope: Schema.Literals<readonly ["global", "project"]>;
68
+ readonly projectDirectory: Schema.String;
69
+ readonly phase: Schema.Literals<readonly ["stopped", "starting", "ready", "degraded", "failed", "stopping"]>;
70
+ readonly generation: Schema.Number;
71
+ readonly pid: Schema.optional<Schema.Number>;
72
+ readonly lastRefreshAt: Schema.optional<Schema.String>;
73
+ readonly error: Schema.optional<Schema.Struct<{
74
+ readonly code: Schema.String;
75
+ readonly message: Schema.String;
76
+ readonly retryable: Schema.Boolean;
77
+ }>>;
78
+ readonly diagnostics: Schema.optional<Schema.$Array<Schema.Struct<{
79
+ readonly code: Schema.String;
80
+ readonly server: Schema.String;
81
+ readonly message: Schema.String;
82
+ }>>>;
83
+ readonly activation: Schema.optional<Schema.Literals<readonly ["auto", "manual", "awaiting_activation"]>>;
84
+ }>>>;
85
+ readonly bindings: Schema.optional<Schema.$Record<Schema.String, Schema.Literals<readonly ["global", "project"]>>>;
43
86
  }>;
44
87
  readonly errors: {
45
88
  readonly unavailable: Schema.Struct<{
@@ -48,9 +91,12 @@ export declare const KeyFerryRpc: {
48
91
  };
49
92
  };
50
93
  readonly refresh: {
51
- readonly input: Schema.Struct<{}>;
94
+ readonly input: Schema.Struct<{
95
+ readonly scope: Schema.optional<Schema.Literals<readonly ["global", "project"]>>;
96
+ readonly server: Schema.optional<Schema.NonEmptyString>;
97
+ }>;
52
98
  readonly output: Schema.Struct<{
53
- readonly phase: Schema.String;
99
+ readonly phase: Schema.Literals<readonly ["stopped", "starting", "ready", "degraded", "failed", "stopping"]>;
54
100
  readonly projectDirectory: Schema.String;
55
101
  readonly generation: Schema.Number;
56
102
  readonly pid: Schema.optional<Schema.Number>;
@@ -66,6 +112,26 @@ export declare const KeyFerryRpc: {
66
112
  readonly server: Schema.String;
67
113
  readonly message: Schema.String;
68
114
  }>>>;
115
+ readonly scopes: Schema.optional<Schema.$Array<Schema.Struct<{
116
+ readonly scope: Schema.Literals<readonly ["global", "project"]>;
117
+ readonly projectDirectory: Schema.String;
118
+ readonly phase: Schema.Literals<readonly ["stopped", "starting", "ready", "degraded", "failed", "stopping"]>;
119
+ readonly generation: Schema.Number;
120
+ readonly pid: Schema.optional<Schema.Number>;
121
+ readonly lastRefreshAt: Schema.optional<Schema.String>;
122
+ readonly error: Schema.optional<Schema.Struct<{
123
+ readonly code: Schema.String;
124
+ readonly message: Schema.String;
125
+ readonly retryable: Schema.Boolean;
126
+ }>>;
127
+ readonly diagnostics: Schema.optional<Schema.$Array<Schema.Struct<{
128
+ readonly code: Schema.String;
129
+ readonly server: Schema.String;
130
+ readonly message: Schema.String;
131
+ }>>>;
132
+ readonly activation: Schema.optional<Schema.Literals<readonly ["auto", "manual", "awaiting_activation"]>>;
133
+ }>>>;
134
+ readonly bindings: Schema.optional<Schema.$Record<Schema.String, Schema.Literals<readonly ["global", "project"]>>>;
69
135
  }>;
70
136
  readonly errors: {
71
137
  readonly unavailable: Schema.Struct<{
@@ -74,9 +140,58 @@ export declare const KeyFerryRpc: {
74
140
  };
75
141
  };
76
142
  readonly doctor: {
143
+ readonly input: Schema.Struct<{
144
+ readonly scope: Schema.optional<Schema.Literals<readonly ["global", "project"]>>;
145
+ readonly server: Schema.optional<Schema.NonEmptyString>;
146
+ }>;
147
+ readonly output: Schema.Struct<{
148
+ readonly phase: Schema.Literals<readonly ["stopped", "starting", "ready", "degraded", "failed", "stopping"]>;
149
+ readonly projectDirectory: Schema.String;
150
+ readonly generation: Schema.Number;
151
+ readonly pid: Schema.optional<Schema.Number>;
152
+ readonly endpoint: Schema.optional<Schema.String>;
153
+ readonly lastRefreshAt: Schema.optional<Schema.String>;
154
+ readonly error: Schema.optional<Schema.Struct<{
155
+ readonly code: Schema.String;
156
+ readonly message: Schema.String;
157
+ readonly retryable: Schema.Boolean;
158
+ }>>;
159
+ readonly diagnostics: Schema.optional<Schema.$Array<Schema.Struct<{
160
+ readonly code: Schema.String;
161
+ readonly server: Schema.String;
162
+ readonly message: Schema.String;
163
+ }>>>;
164
+ readonly scopes: Schema.optional<Schema.$Array<Schema.Struct<{
165
+ readonly scope: Schema.Literals<readonly ["global", "project"]>;
166
+ readonly projectDirectory: Schema.String;
167
+ readonly phase: Schema.Literals<readonly ["stopped", "starting", "ready", "degraded", "failed", "stopping"]>;
168
+ readonly generation: Schema.Number;
169
+ readonly pid: Schema.optional<Schema.Number>;
170
+ readonly lastRefreshAt: Schema.optional<Schema.String>;
171
+ readonly error: Schema.optional<Schema.Struct<{
172
+ readonly code: Schema.String;
173
+ readonly message: Schema.String;
174
+ readonly retryable: Schema.Boolean;
175
+ }>>;
176
+ readonly diagnostics: Schema.optional<Schema.$Array<Schema.Struct<{
177
+ readonly code: Schema.String;
178
+ readonly server: Schema.String;
179
+ readonly message: Schema.String;
180
+ }>>>;
181
+ readonly activation: Schema.optional<Schema.Literals<readonly ["auto", "manual", "awaiting_activation"]>>;
182
+ }>>>;
183
+ readonly bindings: Schema.optional<Schema.$Record<Schema.String, Schema.Literals<readonly ["global", "project"]>>>;
184
+ }>;
185
+ readonly errors: {
186
+ readonly unavailable: Schema.Struct<{
187
+ readonly code: Schema.String;
188
+ }>;
189
+ };
190
+ };
191
+ readonly activateProject: {
77
192
  readonly input: Schema.Struct<{}>;
78
193
  readonly output: Schema.Struct<{
79
- readonly phase: Schema.String;
194
+ readonly phase: Schema.Literals<readonly ["stopped", "starting", "ready", "degraded", "failed", "stopping"]>;
80
195
  readonly projectDirectory: Schema.String;
81
196
  readonly generation: Schema.Number;
82
197
  readonly pid: Schema.optional<Schema.Number>;
@@ -92,6 +207,26 @@ export declare const KeyFerryRpc: {
92
207
  readonly server: Schema.String;
93
208
  readonly message: Schema.String;
94
209
  }>>>;
210
+ readonly scopes: Schema.optional<Schema.$Array<Schema.Struct<{
211
+ readonly scope: Schema.Literals<readonly ["global", "project"]>;
212
+ readonly projectDirectory: Schema.String;
213
+ readonly phase: Schema.Literals<readonly ["stopped", "starting", "ready", "degraded", "failed", "stopping"]>;
214
+ readonly generation: Schema.Number;
215
+ readonly pid: Schema.optional<Schema.Number>;
216
+ readonly lastRefreshAt: Schema.optional<Schema.String>;
217
+ readonly error: Schema.optional<Schema.Struct<{
218
+ readonly code: Schema.String;
219
+ readonly message: Schema.String;
220
+ readonly retryable: Schema.Boolean;
221
+ }>>;
222
+ readonly diagnostics: Schema.optional<Schema.$Array<Schema.Struct<{
223
+ readonly code: Schema.String;
224
+ readonly server: Schema.String;
225
+ readonly message: Schema.String;
226
+ }>>>;
227
+ readonly activation: Schema.optional<Schema.Literals<readonly ["auto", "manual", "awaiting_activation"]>>;
228
+ }>>>;
229
+ readonly bindings: Schema.optional<Schema.$Record<Schema.String, Schema.Literals<readonly ["global", "project"]>>>;
95
230
  }>;
96
231
  readonly errors: {
97
232
  readonly unavailable: Schema.Struct<{
package/dist/rpc.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAQ/D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;EAiB3B,CAAC;AAcH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BtB,CAAC;AAEH,QAAA,MAAM,aAAa,GAAI,OAAO,YAAY,0PAmBzC,CAAC;AAEF,uEAAuE;AACvE,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAkC7D;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,YAAY;;EAE3C;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EACL,YAAY,EAGZ,KAAK,UAAU,EAEhB,MAAM,gBAAgB,CAAC;AAkCxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW3B,CAAC;AAkBH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCtB,CAAC;AAEH,QAAA,MAAM,aAAa,GAAI,OAAO,YAAY,0PAmBzC,CAAC;AAEF,uEAAuE;AACvE,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAQ7D;AAsFD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,YAAY;;EAE3C;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
package/dist/rpc.js CHANGED
@@ -1,24 +1,51 @@
1
1
  import { Rpc } from "@opencode/plugin/effect";
2
2
  import { Schema } from "effect";
3
- import { VarlockError } from "./contracts.js";
3
+ import { VarlockError, } from "./contracts.js";
4
4
  const statusError = Schema.Struct({
5
5
  code: Schema.String,
6
6
  message: Schema.String,
7
7
  retryable: Schema.Boolean,
8
8
  });
9
+ const scopeId = Schema.Literals(["global", "project"]);
10
+ const managerPhase = Schema.Literals([
11
+ "stopped",
12
+ "starting",
13
+ "ready",
14
+ "degraded",
15
+ "failed",
16
+ "stopping",
17
+ ]);
18
+ const diagnostic = Schema.Struct({
19
+ code: Schema.String,
20
+ server: Schema.String,
21
+ message: Schema.String,
22
+ });
23
+ const scopeStatus = Schema.Struct({
24
+ scope: scopeId,
25
+ projectDirectory: Schema.String,
26
+ phase: managerPhase,
27
+ generation: Schema.Number,
28
+ pid: Schema.optional(Schema.Number),
29
+ lastRefreshAt: Schema.optional(Schema.String),
30
+ error: Schema.optional(statusError),
31
+ diagnostics: Schema.optional(Schema.Array(diagnostic)),
32
+ activation: Schema.optional(Schema.Literals(["auto", "manual", "awaiting_activation"])),
33
+ });
9
34
  export const SafeStatusSchema = Schema.Struct({
10
- phase: Schema.String,
35
+ phase: managerPhase,
11
36
  projectDirectory: Schema.String,
12
37
  generation: Schema.Number,
13
38
  pid: Schema.optional(Schema.Number),
14
39
  endpoint: Schema.optional(Schema.String),
15
40
  lastRefreshAt: Schema.optional(Schema.String),
16
41
  error: Schema.optional(statusError),
17
- diagnostics: Schema.optional(Schema.Array(Schema.Struct({
18
- code: Schema.String,
19
- server: Schema.String,
20
- message: Schema.String,
21
- }))),
42
+ diagnostics: Schema.optional(Schema.Array(diagnostic)),
43
+ scopes: Schema.optional(Schema.Array(scopeStatus)),
44
+ bindings: Schema.optional(Schema.Record(Schema.String, scopeId)),
45
+ });
46
+ const selector = Schema.Struct({
47
+ scope: Schema.optional(scopeId),
48
+ server: Schema.optional(Schema.NonEmptyString),
22
49
  });
23
50
  const Empty = Schema.Struct({});
24
51
  const isVarlockErrorCode = (value) => value === "invalid_config" ||
@@ -33,20 +60,27 @@ export const KeyFerryRpc = Rpc.define({
33
60
  id: "key-ferry",
34
61
  methods: {
35
62
  status: {
36
- input: Empty,
63
+ input: selector,
37
64
  output: SafeStatusSchema,
38
65
  errors: {
39
66
  unavailable: Schema.Struct({ code: Schema.String }),
40
67
  },
41
68
  },
42
69
  refresh: {
43
- input: Empty,
70
+ input: selector,
44
71
  output: SafeStatusSchema,
45
72
  errors: {
46
73
  unavailable: Schema.Struct({ code: Schema.String }),
47
74
  },
48
75
  },
49
76
  doctor: {
77
+ input: selector,
78
+ output: SafeStatusSchema,
79
+ errors: {
80
+ unavailable: Schema.Struct({ code: Schema.String }),
81
+ },
82
+ },
83
+ activateProject: {
50
84
  input: Empty,
51
85
  output: SafeStatusSchema,
52
86
  errors: {
@@ -78,38 +112,86 @@ const publicMessage = (error) => {
78
112
  };
79
113
  /** Rebuild a safe status without trusting an adapter error message. */
80
114
  export function sanitizeStatus(status) {
81
- const errorCode = isVarlockErrorCode(status.error?.code) ? status.error.code : "unavailable";
82
115
  return {
83
116
  phase: status.phase,
84
117
  projectDirectory: status.projectDirectory,
85
118
  generation: status.generation,
86
- ...(status.pid === undefined ? {} : { pid: status.pid }),
87
- ...(status.endpoint === undefined ? {} : { endpoint: status.endpoint }),
88
- ...(status.lastRefreshAt === undefined ? {} : { lastRefreshAt: status.lastRefreshAt }),
89
- ...(status.error === undefined
90
- ? {}
91
- : {
92
- error: new VarlockError({
93
- code: errorCode,
94
- message: publicMessage(new VarlockError({
95
- code: errorCode,
96
- message: "",
97
- retryable: status.error.retryable === true,
98
- })),
99
- retryable: status.error.retryable,
100
- }),
101
- }),
102
- ...(status.diagnostics === undefined
103
- ? {}
104
- : {
105
- diagnostics: status.diagnostics.map((item) => ({
106
- code: item.code,
107
- server: item.server,
108
- message: item.message,
109
- })),
110
- }),
119
+ ...sanitizeLegacyFields(status),
120
+ ...sanitizeAggregateFields(status),
111
121
  };
112
122
  }
123
+ function optionalField(key, value) {
124
+ return value === undefined ? {} : { [key]: value };
125
+ }
126
+ function sanitizeLegacyFields(status) {
127
+ return {
128
+ ...optionalField("pid", status.pid),
129
+ ...optionalField("endpoint", status.endpoint),
130
+ ...optionalField("lastRefreshAt", status.lastRefreshAt),
131
+ ...optionalField("error", status.error === undefined ? undefined : sanitizeError(status.error)),
132
+ };
133
+ }
134
+ function sanitizeAggregateFields(status) {
135
+ return {
136
+ ...optionalField("diagnostics", status.diagnostics?.map(sanitizeDiagnostic)),
137
+ ...optionalField("scopes", status.scopes?.map(sanitizeScopeStatus)),
138
+ ...optionalField("bindings", status.bindings === undefined ? undefined : sanitizeBindings(status.bindings)),
139
+ };
140
+ }
141
+ function sanitizeDiagnostic(item) {
142
+ const messages = {
143
+ remote_unavailable: "Remote server is unavailable",
144
+ remote_invalid_url: "Remote server URL is invalid",
145
+ remote_oauth_required: "set oauth:false for API-key relay mode, or remove this Varlock mapping to keep native OAuth",
146
+ remote_missing_placeholder: "Remote server mapping is incomplete",
147
+ remote_invalid_header: "Remote server header configuration is invalid",
148
+ remote_relay_failed: "Remote server relay failed",
149
+ project_root_unavailable: "Project root is unavailable",
150
+ project_config_escape: "Project configuration path is invalid",
151
+ project_config_unavailable: "Project configuration is unavailable",
152
+ project_config_too_large: "Project configuration is too large",
153
+ project_config_invalid: "Project configuration is invalid",
154
+ };
155
+ const message = Object.hasOwn(messages, item.code)
156
+ ? messages[item.code]
157
+ : "Diagnostic information is unavailable";
158
+ return {
159
+ code: item.code,
160
+ server: item.server,
161
+ // Only messages produced by this adapter's known diagnostic codes cross
162
+ // the boundary. Provider text is intentionally never used as a fallback.
163
+ message,
164
+ };
165
+ }
166
+ function sanitizeScopeStatus(status) {
167
+ return {
168
+ scope: status.scope,
169
+ projectDirectory: status.projectDirectory,
170
+ phase: status.phase,
171
+ generation: status.generation,
172
+ ...optionalField("pid", status.pid),
173
+ ...optionalField("lastRefreshAt", status.lastRefreshAt),
174
+ ...optionalField("error", status.error === undefined ? undefined : sanitizeError(status.error)),
175
+ ...optionalField("diagnostics", status.diagnostics?.map(sanitizeDiagnostic)),
176
+ ...optionalField("activation", status.activation),
177
+ };
178
+ }
179
+ function sanitizeError(error) {
180
+ const code = isVarlockErrorCode(error.code) ? error.code : "unavailable";
181
+ return new VarlockError({
182
+ code,
183
+ message: publicMessage(new VarlockError({ code, message: "", retryable: false })),
184
+ retryable: error.retryable === true,
185
+ });
186
+ }
187
+ function sanitizeBindings(bindings) {
188
+ const result = {};
189
+ for (const [server, scope] of Object.entries(bindings)) {
190
+ if (server.length > 0 && (scope === "global" || scope === "project"))
191
+ result[server] = scope;
192
+ }
193
+ return result;
194
+ }
113
195
  export function rpcError(error) {
114
196
  return { code: error.code };
115
197
  }
package/dist/rpc.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"rpc.js","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,YAAY,EAAmB,MAAM,gBAAgB,CAAC;AAE/D,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,SAAS,EAAE,MAAM,CAAC,OAAO;CAC1B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5C,KA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AK,CAAC;IAC/F,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAmB;IAC1C,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;AAC9B,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,35 @@
1
+ import type { ProjectDirectory } from "./contracts.js";
2
+ import { managerOptions, type ProjectConfigActivation, type ServerProtection, type ValidatedOptions } from "./options.js";
3
+ export interface ScopedConfigurationLocation {
4
+ readonly project: {
5
+ readonly directory: string;
6
+ };
7
+ }
8
+ export interface ScopedConfigurationFileSystem {
9
+ readonly readFile: (path: string) => Promise<string>;
10
+ readonly realpath?: (path: string) => Promise<string>;
11
+ }
12
+ export interface ScopedGroup {
13
+ readonly id: "global" | "project";
14
+ readonly sourceRoot: ProjectDirectory;
15
+ readonly options: ValidatedOptions;
16
+ readonly manager: ReturnType<typeof managerOptions>;
17
+ readonly environmentKeys: readonly string[];
18
+ readonly servers: Readonly<Record<string, ServerProtection>>;
19
+ }
20
+ export interface ScopedProjectError {
21
+ readonly code: string;
22
+ readonly server: string;
23
+ readonly message: string;
24
+ }
25
+ export interface ScopedConfiguration {
26
+ readonly global: ScopedGroup;
27
+ readonly project?: ScopedGroup;
28
+ readonly activation: ProjectConfigActivation;
29
+ readonly bindings: Readonly<Record<string, "global" | "project">>;
30
+ readonly diagnostics: readonly ScopedProjectError[];
31
+ }
32
+ export declare const MAX_PROJECT_CONFIG_BYTES: number;
33
+ export declare const MAX_PROJECT_CONFIG_DEPTH = 64;
34
+ export declare function loadScopedConfiguration(globalRaw: unknown, location: ScopedConfigurationLocation, fs?: ScopedConfigurationFileSystem): Promise<ScopedConfiguration>;
35
+ //# sourceMappingURL=scoped-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scoped-config.d.ts","sourceRoot":"","sources":["../src/scoped-config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK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