@dbx-tools/shared-genie-code 0.0.0-stage → 0.9.61
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.
- package/LICENSE +202 -0
- package/README.md +28 -3
- package/index.ts +12 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +10 -0
- package/lib/src/config.d.ts +57 -0
- package/lib/src/config.js +48 -0
- package/lib/src/options.d.ts +41 -0
- package/lib/src/options.js +64 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +77 -4
- package/src/config.ts +61 -0
- package/src/options.ts +88 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@dbx-tools/shared-genie-code`
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Browser-safe configuration for the managed Genie Code CLI and its local
|
|
4
|
+
model-gateway sidecar.
|
|
5
|
+
|
|
6
|
+
## Resolve Runtime Options
|
|
7
|
+
|
|
8
|
+
Use `resolveGenieCodeOptions()` to apply the shared defaults. Use
|
|
9
|
+
`genieCodePairingName()` with the first twelve hexadecimal characters of a
|
|
10
|
+
SHA-256 over the exact profile and model values to derive a stable home
|
|
11
|
+
directory name.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { resolveGenieCodeOptions } from "@dbx-tools/shared-genie-code/options";
|
|
15
|
+
|
|
16
|
+
const options = resolveGenieCodeOptions({
|
|
17
|
+
profile: "MY-PROFILE",
|
|
18
|
+
model: "gpt",
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Validate Generated Configuration
|
|
23
|
+
|
|
24
|
+
Use `GenieCodeConfigSchema` at the TOML serialization boundary. It validates the
|
|
25
|
+
selected model, local Responses provider, static process bearer header, trusted
|
|
26
|
+
projects, and terminal model-availability settings.
|
|
27
|
+
|
|
28
|
+
The package contains no filesystem, process, download, or credential logic.
|
|
29
|
+
Those concerns belong to the Node CLI and authentication packages.
|
package/index.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// GENERATED by projen watch - DO NOT EDIT.
|
|
2
|
+
// Regenerated from the exporting modules in ./src.
|
|
3
|
+
// Hand edits are overwritten on the next watch; this file is read-only.
|
|
4
|
+
|
|
5
|
+
export const PACKAGE_IDENTIFIER = "@dbx-tools/shared-genie-code";
|
|
6
|
+
export const PACKAGE_VERSION = "0.9.61";
|
|
7
|
+
export * as config from "./src/config.ts";
|
|
8
|
+
export * as options from "./src/options.ts";
|
|
9
|
+
export { GenieCodeModelProviderSchema, GenieCodeBaseConfigSchema, GenieCodeProviderOverlaySchema, GenieCodeConfigSchema } from "./src/config.ts";
|
|
10
|
+
export type { GenieCodeBaseConfig, GenieCodeProviderOverlay, GenieCodeConfig } from "./src/config.ts";
|
|
11
|
+
export { GENIE_CODE_VERSION, GenieCodeOptionsSchema, GenieCodePairingSchema, GenieCodeRunnerOptionsSchema, GENIE_CODE_DEFAULTS } from "./src/options.ts";
|
|
12
|
+
export type { GenieCodeOptions, ResolvedGenieCodeOptions, GenieCodePairing, GenieCodeRunnerOptions } from "./src/options.ts";
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const PACKAGE_IDENTIFIER = "@dbx-tools/shared-genie-code";
|
|
2
|
+
export declare const PACKAGE_VERSION = "0.9.61";
|
|
3
|
+
export * as config from "./src/config.ts";
|
|
4
|
+
export * as options from "./src/options.ts";
|
|
5
|
+
export { GenieCodeModelProviderSchema, GenieCodeBaseConfigSchema, GenieCodeProviderOverlaySchema, GenieCodeConfigSchema } from "./src/config.ts";
|
|
6
|
+
export type { GenieCodeBaseConfig, GenieCodeProviderOverlay, GenieCodeConfig } from "./src/config.ts";
|
|
7
|
+
export { GENIE_CODE_VERSION, GenieCodeOptionsSchema, GenieCodePairingSchema, GenieCodeRunnerOptionsSchema, GENIE_CODE_DEFAULTS } from "./src/options.ts";
|
|
8
|
+
export type { GenieCodeOptions, ResolvedGenieCodeOptions, GenieCodePairing, GenieCodeRunnerOptions } from "./src/options.ts";
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// GENERATED by projen watch - DO NOT EDIT.
|
|
2
|
+
// Regenerated from the exporting modules in ./src.
|
|
3
|
+
// Hand edits are overwritten on the next watch; this file is read-only.
|
|
4
|
+
export const PACKAGE_IDENTIFIER = "@dbx-tools/shared-genie-code";
|
|
5
|
+
export const PACKAGE_VERSION = "0.9.61";
|
|
6
|
+
export * as config from "./src/config.js";
|
|
7
|
+
export * as options from "./src/options.js";
|
|
8
|
+
export { GenieCodeModelProviderSchema, GenieCodeBaseConfigSchema, GenieCodeProviderOverlaySchema, GenieCodeConfigSchema } from "./src/config.js";
|
|
9
|
+
export { GENIE_CODE_VERSION, GenieCodeOptionsSchema, GenieCodePairingSchema, GenieCodeRunnerOptionsSchema, GENIE_CODE_DEFAULTS } from "./src/options.js";
|
|
10
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwyQ0FBMkM7QUFDM0MsbURBQW1EO0FBQ25ELHdFQUF3RTtBQUV4RSxNQUFNLENBQUMsTUFBTSxrQkFBa0IsR0FBRyw4QkFBOEIsQ0FBQztBQUNq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2RlQ29uZmlnU2NoZW1hIH0gZnJvbSBcIi4vc3JjL2NvbmZpZy50c1wiO1xuZXhwb3J0IHR5cGUgeyBHZW5pZUNvZGVCYXNlQ29uZmlnLCBHZW5pZUNvZGVQcm92aWRlck92ZXJsYXksIEdlbmllQ29kZUNvbmZpZyB9IGZyb20gXCIuL3NyYy9jb25maWcudHNcIjtcbmV4cG9ydCB7IEdFTklFX0NPREVfVkVSU0lPTiwgR2VuaWVDb2RlT3B0aW9uc1NjaGVtYSwgR2VuaWVDb2RlUGFpcmluZ1NjaGVtYSwgR2VuaWVDb2RlUnVubmVyT3B0aW9uc1NjaGVtYSwgR0VOSUVfQ09ERV9ERUZBVUxUUyB9IGZyb20gXCIuL3NyYy9vcHRpb25zLnRzXCI7XG5leHBvcnQgdHlwZSB7IEdlbmllQ29kZU9wdGlvbnMsIFJlc29sdmVkR2VuaWVDb2RlT3B0aW9ucywgR2VuaWVDb2RlUGFpcmluZywgR2VuaWVDb2RlUnVubmVyT3B0aW9ucyB9IGZyb20gXCIuL3NyYy9vcHRpb25zLnRzXCI7XG4iXX0=
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Genie Code `config.toml` wire contract.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
export declare const GenieCodeModelProviderSchema: z.ZodObject<{
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
base_url: z.ZodURL;
|
|
10
|
+
wire_api: z.ZodLiteral<"responses">;
|
|
11
|
+
requires_openai_auth: z.ZodBoolean;
|
|
12
|
+
supports_websockets: z.ZodBoolean;
|
|
13
|
+
http_headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
export declare const GenieCodeBaseConfigSchema: z.ZodObject<{
|
|
16
|
+
model_provider: z.ZodString;
|
|
17
|
+
model: z.ZodString;
|
|
18
|
+
databricks_profile: z.ZodString;
|
|
19
|
+
projects: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
20
|
+
trust_level: z.ZodLiteral<"trusted">;
|
|
21
|
+
}, z.core.$strict>>;
|
|
22
|
+
tui: z.ZodObject<{
|
|
23
|
+
model_availability_nux: z.ZodRecord<z.ZodString, z.ZodLiteral<1>>;
|
|
24
|
+
}, z.core.$strict>;
|
|
25
|
+
}, z.core.$strict>;
|
|
26
|
+
export declare const GenieCodeProviderOverlaySchema: z.ZodObject<{
|
|
27
|
+
model_providers: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
28
|
+
name: z.ZodString;
|
|
29
|
+
base_url: z.ZodURL;
|
|
30
|
+
wire_api: z.ZodLiteral<"responses">;
|
|
31
|
+
requires_openai_auth: z.ZodBoolean;
|
|
32
|
+
supports_websockets: z.ZodBoolean;
|
|
33
|
+
http_headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
34
|
+
}, z.core.$strict>>;
|
|
35
|
+
}, z.core.$strict>;
|
|
36
|
+
export declare const GenieCodeConfigSchema: z.ZodObject<{
|
|
37
|
+
model_provider: z.ZodString;
|
|
38
|
+
model: z.ZodString;
|
|
39
|
+
databricks_profile: z.ZodString;
|
|
40
|
+
projects: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
41
|
+
trust_level: z.ZodLiteral<"trusted">;
|
|
42
|
+
}, z.core.$strict>>;
|
|
43
|
+
tui: z.ZodObject<{
|
|
44
|
+
model_availability_nux: z.ZodRecord<z.ZodString, z.ZodLiteral<1>>;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
model_providers: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
47
|
+
name: z.ZodString;
|
|
48
|
+
base_url: z.ZodURL;
|
|
49
|
+
wire_api: z.ZodLiteral<"responses">;
|
|
50
|
+
requires_openai_auth: z.ZodBoolean;
|
|
51
|
+
supports_websockets: z.ZodBoolean;
|
|
52
|
+
http_headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
53
|
+
}, z.core.$strict>>;
|
|
54
|
+
}, z.core.$strict>;
|
|
55
|
+
export type GenieCodeBaseConfig = z.infer<typeof GenieCodeBaseConfigSchema>;
|
|
56
|
+
export type GenieCodeProviderOverlay = z.infer<typeof GenieCodeProviderOverlaySchema>;
|
|
57
|
+
export type GenieCodeConfig = z.infer<typeof GenieCodeConfigSchema>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Genie Code `config.toml` wire contract.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
export const GenieCodeModelProviderSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
name: z.string().describe("Provider display name."),
|
|
10
|
+
base_url: z.url().describe("OpenAI-compatible provider base URL."),
|
|
11
|
+
wire_api: z.literal("responses").describe("Genie transport protocol."),
|
|
12
|
+
requires_openai_auth: z.boolean().describe("Whether Genie must resolve OpenAI credentials."),
|
|
13
|
+
supports_websockets: z.boolean().describe("Whether the provider accepts Responses WebSockets."),
|
|
14
|
+
http_headers: z.record(z.string(), z.string()).describe("Static HTTP headers."),
|
|
15
|
+
})
|
|
16
|
+
.strict()
|
|
17
|
+
.describe("One custom Genie Code model provider.");
|
|
18
|
+
export const GenieCodeBaseConfigSchema = z
|
|
19
|
+
.object({
|
|
20
|
+
model_provider: z.string().describe("Selected provider identifier."),
|
|
21
|
+
model: z.string().describe("Selected model name."),
|
|
22
|
+
databricks_profile: z.string().describe("Databricks profile represented by this home."),
|
|
23
|
+
projects: z
|
|
24
|
+
.record(z.string(), z.object({ trust_level: z.literal("trusted").describe("Project trust level.") }).strict())
|
|
25
|
+
.describe("Trusted local projects keyed by absolute path."),
|
|
26
|
+
tui: z
|
|
27
|
+
.object({
|
|
28
|
+
model_availability_nux: z
|
|
29
|
+
.record(z.string(), z.literal(1))
|
|
30
|
+
.describe("Models whose availability notice has been acknowledged."),
|
|
31
|
+
})
|
|
32
|
+
.strict()
|
|
33
|
+
.describe("Genie terminal UI settings."),
|
|
34
|
+
})
|
|
35
|
+
.strict()
|
|
36
|
+
.describe("Persistent profile-model Genie Code configuration.");
|
|
37
|
+
export const GenieCodeProviderOverlaySchema = z
|
|
38
|
+
.object({
|
|
39
|
+
model_providers: z
|
|
40
|
+
.record(z.string(), GenieCodeModelProviderSchema)
|
|
41
|
+
.describe("Invocation-local model providers keyed by identifier."),
|
|
42
|
+
})
|
|
43
|
+
.strict()
|
|
44
|
+
.describe("Invocation-specific Genie Code provider overlay.");
|
|
45
|
+
export const GenieCodeConfigSchema = GenieCodeBaseConfigSchema.extend({
|
|
46
|
+
model_providers: GenieCodeProviderOverlaySchema.shape.model_providers,
|
|
47
|
+
}).describe("Merged persistent and invocation-specific Genie Code configuration.");
|
|
48
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7OztHQUlHO0FBRUgsT0FBTyxFQUFFLENBQUMsRUFBRSxNQUFNLEtBQUssQ0FBQztBQUV4QixNQUFNLENBQUMsTUFBTSw0QkFBNEIsR0FBRyxDQUFDO0tBQzFDLE1BQU0sQ0FBQztJQUNOLElBQUksRUFBRSxDQUFDLENBQUMsTUFBTSxFQUFFLENBQUMsUUFBUSxDQUFDLHdCQUF3QixDQUFDO0lBQ25ELFFBQVEsRUFBRSxDQUFDLENBQUMsR0FBRyxFQUFFLENBQUMsUUFBUSxDQUFDLHNDQUFzQyxDQUFDO0lBQ2xFLFFBQVEsRUFBRSxDQUFDLENBQUMsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFDLFFBQVEsQ0FBQywyQkFBMkIsQ0FBQztJQUN0RSxvQkFBb0IsRUFBRSxDQUFDLENBQUMsT0FBTyxFQUFFLENBQUMsUUFBUS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nRpZmllci5cIiksXG4gIH0pXG4gIC5zdHJpY3QoKVxuICAuZGVzY3JpYmUoXCJJbnZvY2F0aW9uLXNwZWNpZmljIEdlbmllIENvZGUgcHJvdmlkZXIgb3ZlcmxheS5cIik7XG5cbmV4cG9ydCBjb25zdCBHZW5pZUNvZGVDb25maWdTY2hlbWEgPSBHZW5pZUNvZGVCYXNlQ29uZmlnU2NoZW1hLmV4dGVuZCh7XG4gIG1vZGVsX3Byb3ZpZGVyczogR2VuaWVDb2RlUHJvdmlkZXJPdmVybGF5U2NoZW1hLnNoYXBlLm1vZGVsX3Byb3ZpZGVycyxcbn0pLmRlc2NyaWJlKFwiTWVyZ2VkIHBlcnNpc3RlbnQgYW5kIGludm9jYXRpb24tc3BlY2lmaWMgR2VuaWUgQ29kZSBjb25maWd1cmF0aW9uLlwiKTtcblxuZXhwb3J0IHR5cGUgR2VuaWVDb2RlQmFzZUNvbmZpZyA9IHouaW5mZXI8dHlwZW9mIEdlbmllQ29kZUJhc2VDb25maWdTY2hlbWE+O1xuXG5leHBvcnQgdHlwZSBHZW5pZUNvZGVQcm92aWRlck92ZXJsYXkgPSB6LmluZmVyPHR5cGVvZiBHZW5pZUNvZGVQcm92aWRlck92ZXJsYXlTY2hlbWE+O1xuXG5leHBvcnQgdHlwZSBHZW5pZUNvZGVDb25maWcgPSB6LmluZmVyPHR5cGVvZiBHZW5pZUNvZGVDb25maWdTY2hlbWE+O1xuIl19
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe configuration for the managed Genie Code CLI.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { options } from "@dbx-tools/shared-core";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
/** Pinned Genie Code release installed by the managed CLI. */
|
|
9
|
+
export declare const GENIE_CODE_VERSION = "0.1.0-beta.2";
|
|
10
|
+
export declare const GenieCodeOptionsSchema: z.ZodObject<{
|
|
11
|
+
profile: z.ZodOptional<z.ZodString>;
|
|
12
|
+
model: z.ZodDefault<z.ZodString>;
|
|
13
|
+
gatewayListen: z.ZodDefault<z.ZodType<options.TcpListenAddress, unknown, z.core.$ZodTypeInternals<options.TcpListenAddress, unknown>>>;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
export declare const GenieCodePairingSchema: z.ZodObject<{
|
|
16
|
+
profile: z.ZodString;
|
|
17
|
+
model: z.ZodString;
|
|
18
|
+
digest: z.ZodString;
|
|
19
|
+
}, z.core.$strict>;
|
|
20
|
+
export declare const GenieCodeRunnerOptionsSchema: z.ZodObject<{
|
|
21
|
+
executable: z.ZodString;
|
|
22
|
+
arguments: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
23
|
+
home: z.ZodString;
|
|
24
|
+
gatewayHealthUrl: z.ZodURL;
|
|
25
|
+
bearerToken: z.ZodString;
|
|
26
|
+
startupTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
export type GenieCodeOptions = z.input<typeof GenieCodeOptionsSchema>;
|
|
29
|
+
export type ResolvedGenieCodeOptions = z.output<typeof GenieCodeOptionsSchema>;
|
|
30
|
+
export type GenieCodePairing = z.input<typeof GenieCodePairingSchema>;
|
|
31
|
+
export type GenieCodeRunnerOptions = z.input<typeof GenieCodeRunnerOptionsSchema>;
|
|
32
|
+
/** Defaults derived from the owning managed Genie Code schema. */
|
|
33
|
+
export declare const GENIE_CODE_DEFAULTS: Readonly<{
|
|
34
|
+
model: string;
|
|
35
|
+
gatewayListen: options.TcpListenAddress;
|
|
36
|
+
profile?: string | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
/** Validate and default managed Genie Code options. */
|
|
39
|
+
export declare function resolveGenieCodeOptions(value?: GenieCodeOptions): ResolvedGenieCodeOptions;
|
|
40
|
+
/** Build the readable directory name for one exact profile-model pairing. */
|
|
41
|
+
export declare function genieCodePairingName(value: GenieCodePairing): string;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe configuration for the managed Genie Code CLI.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { options, stringUtils } from "@dbx-tools/shared-core";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
/** Pinned Genie Code release installed by the managed CLI. */
|
|
9
|
+
export const GENIE_CODE_VERSION = "0.1.0-beta.2";
|
|
10
|
+
const pairingText = (description) => z.string().trim().min(1).describe(description);
|
|
11
|
+
export const GenieCodeOptionsSchema = z
|
|
12
|
+
.object({
|
|
13
|
+
profile: options.DatabricksOptionsSchema.shape.profile.describe("Databricks profile used by the model-gateway sidecar."),
|
|
14
|
+
model: pairingText("Model name resolved by the model gateway.").default("gpt"),
|
|
15
|
+
gatewayListen: options
|
|
16
|
+
.listenAddressSchema({ host: "127.0.0.1", port: 0, loopback: true })
|
|
17
|
+
.describe("Loopback listener allocated for the model-gateway sidecar."),
|
|
18
|
+
})
|
|
19
|
+
.strict()
|
|
20
|
+
.describe("Managed Genie Code runtime options.");
|
|
21
|
+
export const GenieCodePairingSchema = GenieCodeOptionsSchema.pick({
|
|
22
|
+
profile: true,
|
|
23
|
+
model: true,
|
|
24
|
+
})
|
|
25
|
+
.extend({
|
|
26
|
+
profile: GenieCodeOptionsSchema.shape.profile.unwrap(),
|
|
27
|
+
model: GenieCodeOptionsSchema.shape.model.removeDefault(),
|
|
28
|
+
digest: z
|
|
29
|
+
.string()
|
|
30
|
+
.regex(/^[0-9a-f]{12}$/)
|
|
31
|
+
.describe("First twelve lowercase hexadecimal characters of the exact pairing SHA-256."),
|
|
32
|
+
})
|
|
33
|
+
.strict()
|
|
34
|
+
.describe("Inputs used to derive one profile-model Genie home.");
|
|
35
|
+
export const GenieCodeRunnerOptionsSchema = z
|
|
36
|
+
.object({
|
|
37
|
+
executable: z.string().trim().min(1).describe("Installed Genie Code executable."),
|
|
38
|
+
arguments: z.array(z.string()).readonly().describe("Arguments forwarded to Genie Code."),
|
|
39
|
+
home: z.string().trim().min(1).describe("Profile-model-specific GENIE_HOME."),
|
|
40
|
+
gatewayHealthUrl: z.url().describe("Guarded model-gateway health URL."),
|
|
41
|
+
bearerToken: z.string().min(1).describe("Ephemeral model-gateway bearer token."),
|
|
42
|
+
startupTimeoutMs: z
|
|
43
|
+
.number()
|
|
44
|
+
.int()
|
|
45
|
+
.positive()
|
|
46
|
+
.default(60_000)
|
|
47
|
+
.describe("Maximum milliseconds to wait for the gateway."),
|
|
48
|
+
})
|
|
49
|
+
.strict()
|
|
50
|
+
.describe("Serialized options passed to the internal Genie child runner.");
|
|
51
|
+
/** Defaults derived from the owning managed Genie Code schema. */
|
|
52
|
+
export const GENIE_CODE_DEFAULTS = Object.freeze(GenieCodeOptionsSchema.parse({}));
|
|
53
|
+
/** Validate and default managed Genie Code options. */
|
|
54
|
+
export function resolveGenieCodeOptions(value = {}) {
|
|
55
|
+
return GenieCodeOptionsSchema.parse(value);
|
|
56
|
+
}
|
|
57
|
+
/** Build the readable directory name for one exact profile-model pairing. */
|
|
58
|
+
export function genieCodePairingName(value) {
|
|
59
|
+
const pairing = GenieCodePairingSchema.parse(value);
|
|
60
|
+
const profile = stringUtils.toSlugWithOptions({ maxLength: 40, truncateStrategy: "trim" }, pairing.profile);
|
|
61
|
+
const model = stringUtils.toSlugWithOptions({ maxLength: 40, truncateStrategy: "trim" }, pairing.model);
|
|
62
|
+
return `${profile}-${model}-${pairing.digest}`;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3B0aW9ucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9vcHRpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7O0dBSUc7QUFFSCxPQUFPLEVBQUUsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLHdCQUF3QixDQUFDO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IHRydW5jYXRlU3RyYXRlZ3k6IFwidHJpbVwiIH0sXG4gICAgcGFpcmluZy5wcm9maWxlLFxuICApO1xuICBjb25zdCBtb2RlbCA9IHN0cmluZ1V0aWxzLnRvU2x1Z1dpdGhPcHRpb25zKFxuICAgIHsgbWF4TGVuZ3RoOiA0MCwgdHJ1bmNhdGVTdHJhdGVneTogXCJ0cmltXCIgfSxcbiAgICBwYWlyaW5nLm1vZGVsLFxuICApO1xuICByZXR1cm4gYCR7cHJvZmlsZX0tJHttb2RlbH0tJHtwYWlyaW5nLmRpZ2VzdH1gO1xufVxuIl19
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../src/config.ts","../src/options.ts","../index.ts"],"version":"5.9.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,79 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbx-tools/shared-genie-code",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
"description": "Browser-safe managed Genie Code options and profile-model pairing contracts",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/reggie-db/dbx-tools.git",
|
|
7
|
+
"directory": "packages/js/shared/genie-code"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "projen build",
|
|
11
|
+
"compile": "projen compile",
|
|
12
|
+
"default": "projen default",
|
|
13
|
+
"package": "projen package",
|
|
14
|
+
"post-compile": "projen post-compile",
|
|
15
|
+
"pre-compile": "projen pre-compile",
|
|
16
|
+
"prepack": "projen prepack",
|
|
17
|
+
"test": "projen test",
|
|
18
|
+
"watch": "projen watch",
|
|
19
|
+
"projen": "projen"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"typescript": "^5.9.3"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@dbx-tools/shared-core": "^0.9.61",
|
|
26
|
+
"zod": "4.3.6"
|
|
27
|
+
},
|
|
28
|
+
"main": "./lib/index.js",
|
|
29
|
+
"license": "Apache-2.0",
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public",
|
|
32
|
+
"main": "./lib/index.js",
|
|
33
|
+
"types": "./lib/index.d.ts",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./lib/index.d.ts",
|
|
37
|
+
"default": "./lib/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./config": {
|
|
40
|
+
"types": "./lib/src/config.d.ts",
|
|
41
|
+
"default": "./lib/src/config.js"
|
|
42
|
+
},
|
|
43
|
+
"./options": {
|
|
44
|
+
"types": "./lib/src/options.d.ts",
|
|
45
|
+
"default": "./lib/src/options.js"
|
|
46
|
+
},
|
|
47
|
+
"./package.json": "./package.json"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"version": "0.9.61",
|
|
51
|
+
"types": "./lib/index.d.ts",
|
|
52
|
+
"dbxToolsConfig": {
|
|
53
|
+
"tags": [
|
|
54
|
+
"shared"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
"type": "module",
|
|
58
|
+
"exports": {
|
|
59
|
+
".": {
|
|
60
|
+
"types": "./lib/index.d.ts",
|
|
61
|
+
"default": "./lib/index.js"
|
|
62
|
+
},
|
|
63
|
+
"./config": {
|
|
64
|
+
"types": "./lib/src/config.d.ts",
|
|
65
|
+
"default": "./lib/src/config.js"
|
|
66
|
+
},
|
|
67
|
+
"./options": {
|
|
68
|
+
"types": "./lib/src/options.d.ts",
|
|
69
|
+
"default": "./lib/src/options.js"
|
|
70
|
+
},
|
|
71
|
+
"./package.json": "./package.json"
|
|
72
|
+
},
|
|
73
|
+
"files": [
|
|
74
|
+
"index.ts",
|
|
75
|
+
"src",
|
|
76
|
+
"lib"
|
|
77
|
+
],
|
|
78
|
+
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"bunx projen\"."
|
|
79
|
+
}
|
package/src/config.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Genie Code `config.toml` wire contract.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
|
|
9
|
+
export const GenieCodeModelProviderSchema = z
|
|
10
|
+
.object({
|
|
11
|
+
name: z.string().describe("Provider display name."),
|
|
12
|
+
base_url: z.url().describe("OpenAI-compatible provider base URL."),
|
|
13
|
+
wire_api: z.literal("responses").describe("Genie transport protocol."),
|
|
14
|
+
requires_openai_auth: z.boolean().describe("Whether Genie must resolve OpenAI credentials."),
|
|
15
|
+
supports_websockets: z.boolean().describe("Whether the provider accepts Responses WebSockets."),
|
|
16
|
+
http_headers: z.record(z.string(), z.string()).describe("Static HTTP headers."),
|
|
17
|
+
})
|
|
18
|
+
.strict()
|
|
19
|
+
.describe("One custom Genie Code model provider.");
|
|
20
|
+
|
|
21
|
+
export const GenieCodeBaseConfigSchema = z
|
|
22
|
+
.object({
|
|
23
|
+
model_provider: z.string().describe("Selected provider identifier."),
|
|
24
|
+
model: z.string().describe("Selected model name."),
|
|
25
|
+
databricks_profile: z.string().describe("Databricks profile represented by this home."),
|
|
26
|
+
projects: z
|
|
27
|
+
.record(
|
|
28
|
+
z.string(),
|
|
29
|
+
z.object({ trust_level: z.literal("trusted").describe("Project trust level.") }).strict(),
|
|
30
|
+
)
|
|
31
|
+
.describe("Trusted local projects keyed by absolute path."),
|
|
32
|
+
tui: z
|
|
33
|
+
.object({
|
|
34
|
+
model_availability_nux: z
|
|
35
|
+
.record(z.string(), z.literal(1))
|
|
36
|
+
.describe("Models whose availability notice has been acknowledged."),
|
|
37
|
+
})
|
|
38
|
+
.strict()
|
|
39
|
+
.describe("Genie terminal UI settings."),
|
|
40
|
+
})
|
|
41
|
+
.strict()
|
|
42
|
+
.describe("Persistent profile-model Genie Code configuration.");
|
|
43
|
+
|
|
44
|
+
export const GenieCodeProviderOverlaySchema = z
|
|
45
|
+
.object({
|
|
46
|
+
model_providers: z
|
|
47
|
+
.record(z.string(), GenieCodeModelProviderSchema)
|
|
48
|
+
.describe("Invocation-local model providers keyed by identifier."),
|
|
49
|
+
})
|
|
50
|
+
.strict()
|
|
51
|
+
.describe("Invocation-specific Genie Code provider overlay.");
|
|
52
|
+
|
|
53
|
+
export const GenieCodeConfigSchema = GenieCodeBaseConfigSchema.extend({
|
|
54
|
+
model_providers: GenieCodeProviderOverlaySchema.shape.model_providers,
|
|
55
|
+
}).describe("Merged persistent and invocation-specific Genie Code configuration.");
|
|
56
|
+
|
|
57
|
+
export type GenieCodeBaseConfig = z.infer<typeof GenieCodeBaseConfigSchema>;
|
|
58
|
+
|
|
59
|
+
export type GenieCodeProviderOverlay = z.infer<typeof GenieCodeProviderOverlaySchema>;
|
|
60
|
+
|
|
61
|
+
export type GenieCodeConfig = z.infer<typeof GenieCodeConfigSchema>;
|
package/src/options.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe configuration for the managed Genie Code CLI.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { options, stringUtils } from "@dbx-tools/shared-core";
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
|
|
10
|
+
/** Pinned Genie Code release installed by the managed CLI. */
|
|
11
|
+
export const GENIE_CODE_VERSION = "0.1.0-beta.2";
|
|
12
|
+
|
|
13
|
+
const pairingText = (description: string) => z.string().trim().min(1).describe(description);
|
|
14
|
+
|
|
15
|
+
export const GenieCodeOptionsSchema = z
|
|
16
|
+
.object({
|
|
17
|
+
profile: options.DatabricksOptionsSchema.shape.profile.describe(
|
|
18
|
+
"Databricks profile used by the model-gateway sidecar.",
|
|
19
|
+
),
|
|
20
|
+
model: pairingText("Model name resolved by the model gateway.").default("gpt"),
|
|
21
|
+
gatewayListen: options
|
|
22
|
+
.listenAddressSchema({ host: "127.0.0.1", port: 0, loopback: true })
|
|
23
|
+
.describe("Loopback listener allocated for the model-gateway sidecar."),
|
|
24
|
+
})
|
|
25
|
+
.strict()
|
|
26
|
+
.describe("Managed Genie Code runtime options.");
|
|
27
|
+
|
|
28
|
+
export const GenieCodePairingSchema = GenieCodeOptionsSchema.pick({
|
|
29
|
+
profile: true,
|
|
30
|
+
model: true,
|
|
31
|
+
})
|
|
32
|
+
.extend({
|
|
33
|
+
profile: GenieCodeOptionsSchema.shape.profile.unwrap(),
|
|
34
|
+
model: GenieCodeOptionsSchema.shape.model.removeDefault(),
|
|
35
|
+
digest: z
|
|
36
|
+
.string()
|
|
37
|
+
.regex(/^[0-9a-f]{12}$/)
|
|
38
|
+
.describe("First twelve lowercase hexadecimal characters of the exact pairing SHA-256."),
|
|
39
|
+
})
|
|
40
|
+
.strict()
|
|
41
|
+
.describe("Inputs used to derive one profile-model Genie home.");
|
|
42
|
+
|
|
43
|
+
export const GenieCodeRunnerOptionsSchema = z
|
|
44
|
+
.object({
|
|
45
|
+
executable: z.string().trim().min(1).describe("Installed Genie Code executable."),
|
|
46
|
+
arguments: z.array(z.string()).readonly().describe("Arguments forwarded to Genie Code."),
|
|
47
|
+
home: z.string().trim().min(1).describe("Profile-model-specific GENIE_HOME."),
|
|
48
|
+
gatewayHealthUrl: z.url().describe("Guarded model-gateway health URL."),
|
|
49
|
+
bearerToken: z.string().min(1).describe("Ephemeral model-gateway bearer token."),
|
|
50
|
+
startupTimeoutMs: z
|
|
51
|
+
.number()
|
|
52
|
+
.int()
|
|
53
|
+
.positive()
|
|
54
|
+
.default(60_000)
|
|
55
|
+
.describe("Maximum milliseconds to wait for the gateway."),
|
|
56
|
+
})
|
|
57
|
+
.strict()
|
|
58
|
+
.describe("Serialized options passed to the internal Genie child runner.");
|
|
59
|
+
|
|
60
|
+
export type GenieCodeOptions = z.input<typeof GenieCodeOptionsSchema>;
|
|
61
|
+
|
|
62
|
+
export type ResolvedGenieCodeOptions = z.output<typeof GenieCodeOptionsSchema>;
|
|
63
|
+
|
|
64
|
+
export type GenieCodePairing = z.input<typeof GenieCodePairingSchema>;
|
|
65
|
+
|
|
66
|
+
export type GenieCodeRunnerOptions = z.input<typeof GenieCodeRunnerOptionsSchema>;
|
|
67
|
+
|
|
68
|
+
/** Defaults derived from the owning managed Genie Code schema. */
|
|
69
|
+
export const GENIE_CODE_DEFAULTS = Object.freeze(GenieCodeOptionsSchema.parse({}));
|
|
70
|
+
|
|
71
|
+
/** Validate and default managed Genie Code options. */
|
|
72
|
+
export function resolveGenieCodeOptions(value: GenieCodeOptions = {}): ResolvedGenieCodeOptions {
|
|
73
|
+
return GenieCodeOptionsSchema.parse(value);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Build the readable directory name for one exact profile-model pairing. */
|
|
77
|
+
export function genieCodePairingName(value: GenieCodePairing): string {
|
|
78
|
+
const pairing = GenieCodePairingSchema.parse(value);
|
|
79
|
+
const profile = stringUtils.toSlugWithOptions(
|
|
80
|
+
{ maxLength: 40, truncateStrategy: "trim" },
|
|
81
|
+
pairing.profile,
|
|
82
|
+
);
|
|
83
|
+
const model = stringUtils.toSlugWithOptions(
|
|
84
|
+
{ maxLength: 40, truncateStrategy: "trim" },
|
|
85
|
+
pairing.model,
|
|
86
|
+
);
|
|
87
|
+
return `${profile}-${model}-${pairing.digest}`;
|
|
88
|
+
}
|