Merge remote-tracking branch 'upstream/main' into josh/desktop-wsl-parallel-backends
This commit is contained in:
commit
0bb1553690
80 files changed
+4666
-189
No files matched your search
@@ -15,6 +15,7 @@ import type {
|
||||
EnvironmentScopeRequiredError,
|
||||
} from "@t3tools/contracts";
|
||||
import { encodeOAuthScope } from "@t3tools/shared/oauthScope";
|
||||
import { httpHeaderRedactionLayer } from "@t3tools/shared/httpObservability";
|
||||
import * as Data from "effect/Data";
|
||||
import * as Duration from "effect/Duration";
|
||||
import * as Effect from "effect/Effect";
|
||||
@@ -111,7 +112,10 @@ export type RemoteEnvironmentAuthError =
|
||||
export const remoteHttpClientLayer = (
|
||||
fetchFn: typeof globalThis.fetch,
|
||||
): Layer.Layer<HttpClient.HttpClient> =>
|
||||
FetchHttpClient.layer.pipe(Layer.provide(Layer.succeed(FetchHttpClient.Fetch, fetchFn)));
|
||||
Layer.merge(
|
||||
FetchHttpClient.layer.pipe(Layer.provide(Layer.succeed(FetchHttpClient.Fetch, fetchFn))),
|
||||
httpHeaderRedactionLayer,
|
||||
);
|
||||
|
||||
const failRemoteRequest = (
|
||||
requestUrl: string,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@t3tools/contracts",
|
||||
"version": "0.0.24",
|
||||
"version": "0.0.26",
|
||||
"private": true,
|
||||
"files": [
|
||||
"dist"
|
||||
|
||||
@@ -130,6 +130,7 @@ export type ModelCapabilities = typeof ModelCapabilities.Type;
|
||||
const CODEX_DRIVER_KIND = ProviderDriverKind.make("codex");
|
||||
const CLAUDE_DRIVER_KIND = ProviderDriverKind.make("claudeAgent");
|
||||
const CURSOR_DRIVER_KIND = ProviderDriverKind.make("cursor");
|
||||
const GROK_DRIVER_KIND = ProviderDriverKind.make("grok");
|
||||
const OPENCODE_DRIVER_KIND = ProviderDriverKind.make("opencode");
|
||||
|
||||
export const DEFAULT_MODEL = "gpt-5.4";
|
||||
@@ -139,6 +140,7 @@ export const DEFAULT_MODEL_BY_PROVIDER: Partial<Record<ProviderDriverKind, strin
|
||||
[CODEX_DRIVER_KIND]: DEFAULT_MODEL,
|
||||
[CLAUDE_DRIVER_KIND]: "claude-sonnet-4-6",
|
||||
[CURSOR_DRIVER_KIND]: "auto",
|
||||
[GROK_DRIVER_KIND]: "grok-build",
|
||||
[OPENCODE_DRIVER_KIND]: "openai/gpt-5",
|
||||
};
|
||||
|
||||
@@ -201,5 +203,6 @@ export const PROVIDER_DISPLAY_NAMES: Partial<Record<ProviderDriverKind, string>>
|
||||
[CODEX_DRIVER_KIND]: "Codex",
|
||||
[CLAUDE_DRIVER_KIND]: "Claude",
|
||||
[CURSOR_DRIVER_KIND]: "Cursor",
|
||||
[GROK_DRIVER_KIND]: "Grok",
|
||||
[OPENCODE_DRIVER_KIND]: "OpenCode",
|
||||
};
|
||||
@@ -165,6 +165,7 @@ export const ServerProvider = Schema.Struct({
|
||||
badgeLabel: Schema.optional(TrimmedNonEmptyString),
|
||||
continuation: Schema.optional(ServerProviderContinuation),
|
||||
showInteractionModeToggle: Schema.optional(Schema.Boolean),
|
||||
requiresNewThreadForModelChange: Schema.optional(Schema.Boolean),
|
||||
enabled: Schema.Boolean,
|
||||
installed: Schema.Boolean,
|
||||
version: Schema.NullOr(TrimmedNonEmptyString),
|
||||
|
||||
@@ -281,6 +281,30 @@ export const CursorSettings = makeProviderSettingsSchema(
|
||||
);
|
||||
export type CursorSettings = typeof CursorSettings.Type;
|
||||
|
||||
export const GrokSettings = makeProviderSettingsSchema(
|
||||
{
|
||||
enabled: Schema.Boolean.pipe(
|
||||
Schema.withDecodingDefault(Effect.succeed(true)),
|
||||
Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
|
||||
),
|
||||
binaryPath: makeBinaryPathSetting("grok").pipe(
|
||||
Schema.annotateKey({
|
||||
title: "Binary path",
|
||||
description: "Path to the Grok CLI binary.",
|
||||
providerSettingsForm: { placeholder: "grok", clearWhenEmpty: "omit" },
|
||||
}),
|
||||
),
|
||||
customModels: Schema.Array(Schema.String).pipe(
|
||||
Schema.withDecodingDefault(Effect.succeed([])),
|
||||
Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
|
||||
),
|
||||
},
|
||||
{
|
||||
order: ["binaryPath"],
|
||||
},
|
||||
);
|
||||
export type GrokSettings = typeof GrokSettings.Type;
|
||||
|
||||
export const OpenCodeSettings = makeProviderSettingsSchema(
|
||||
{
|
||||
enabled: Schema.Boolean.pipe(
|
||||
@@ -369,6 +393,7 @@ export const ServerSettings = Schema.Struct({
|
||||
codex: CodexSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
|
||||
claudeAgent: ClaudeSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
|
||||
cursor: CursorSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
|
||||
grok: GrokSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
|
||||
opencode: OpenCodeSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
|
||||
}).pipe(Schema.withDecodingDefault(Effect.succeed({}))),
|
||||
// New driver-agnostic instance map. Keyed by `ProviderInstanceId`; values
|
||||
@@ -437,6 +462,12 @@ const CursorSettingsPatch = Schema.Struct({
|
||||
customModels: Schema.optionalKey(Schema.Array(Schema.String)),
|
||||
});
|
||||
|
||||
const GrokSettingsPatch = Schema.Struct({
|
||||
enabled: Schema.optionalKey(Schema.Boolean),
|
||||
binaryPath: Schema.optionalKey(TrimmedString),
|
||||
customModels: Schema.optionalKey(Schema.Array(Schema.String)),
|
||||
});
|
||||
|
||||
const OpenCodeSettingsPatch = Schema.Struct({
|
||||
enabled: Schema.optionalKey(Schema.Boolean),
|
||||
binaryPath: Schema.optionalKey(TrimmedString),
|
||||
@@ -463,6 +494,7 @@ export const ServerSettingsPatch = Schema.Struct({
|
||||
codex: Schema.optionalKey(CodexSettingsPatch),
|
||||
claudeAgent: Schema.optionalKey(ClaudeSettingsPatch),
|
||||
cursor: Schema.optionalKey(CursorSettingsPatch),
|
||||
grok: Schema.optionalKey(GrokSettingsPatch),
|
||||
opencode: Schema.optionalKey(OpenCodeSettingsPatch),
|
||||
}),
|
||||
),
|
||||
|
||||
@@ -31,6 +31,10 @@
|
||||
"types": "./src/observability.ts",
|
||||
"import": "./src/observability.ts"
|
||||
},
|
||||
"./httpObservability": {
|
||||
"types": "./src/httpObservability.ts",
|
||||
"import": "./src/httpObservability.ts"
|
||||
},
|
||||
"./shell": {
|
||||
"types": "./src/shell.ts",
|
||||
"import": "./src/shell.ts"
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as Headers from "effect/unstable/http/Headers";
|
||||
|
||||
export const httpHeaderRedactionLayer = Layer.effect(
|
||||
Headers.CurrentRedactedNames,
|
||||
Effect.map(Headers.CurrentRedactedNames, (names) => [...names, "dpop"]),
|
||||
);
|
||||
@@ -94,6 +94,9 @@ describe("resolveModelSlugForProvider", () => {
|
||||
expect(resolveModelSlugForProvider(ProviderDriverKind.make("ollama"), undefined)).toBe(
|
||||
DEFAULT_MODEL,
|
||||
);
|
||||
expect(resolveModelSlugForProvider(ProviderDriverKind.make("grok"), undefined)).toBe(
|
||||
"grok-build",
|
||||
);
|
||||
});
|
||||
|
||||
it("preserves normalized unknown models", () => {
|
||||
|
||||
Reference in new issue
Block a user