Repository navigation
feat(provider): integrate Muse Code SDK and usage #12192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
maria-rcks
wants to merge
15
commits into
pingdotgg:main
from
maria-rcks:t3code/integrate-muse-code-provider
Closed
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
8d7baa3
feat(provider): integrate Muse Code SDK and usage
maria-rcks 35760bd
chore: resolve upstream composer conflict
maria-rcks 55652a6
fix(muse): preserve native model routes and add Meta branding
maria-rcks ce27007
fix(muse): retain tool details and native usage semantics
maria-rcks 15a41ca
fix(muse): reuse the driver error predicate
maria-rcks 4e55201
fix(muse): release failed session scopes
maria-rcks e05afd5
fix(muse): preserve approval and selection constraints
maria-rcks 736f522
fix(muse): ignore replayed deltas and settled turn starts
maria-rcks f1d17bd
fix(web): list muse code above antigravity
maria-rcks cfb33eb
fix(muse): display readable native model names
maria-rcks 396b02f
feat(muse): discover native reasoning effort options
maria-rcks 1af716d
fix(muse): retain usage until context arrives
maria-rcks 19f1107
fix(muse): preserve context capacity in usage snapshots
maria-rcks 2654265
fix(muse): settle removed queued turns
maria-rcks e5ae9ac
fix(muse): use blue for subscription limits
maria-rcks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,150 @@ | ||
| import { MuseSettings, ProviderDriverKind, TextGenerationError } from "@t3tools/contracts"; | ||
| import * as Effect from "effect/Effect"; | ||
| import * as FileSystem from "effect/FileSystem"; | ||
| import * as Path from "effect/Path"; | ||
| import * as Schema from "effect/Schema"; | ||
| import { ChildProcessSpawner } from "effect/unstable/process"; | ||
|
|
||
| import * as BackgroundPolicy from "../../background/BackgroundPolicy.ts"; | ||
| import * as ServerConfig from "../../config.ts"; | ||
| import * as ServerSettings from "../../serverSettings.ts"; | ||
| import { ProviderDriverError } from "../Errors.ts"; | ||
| import * as MuseAdapter from "../Layers/MuseAdapter.ts"; | ||
| import { | ||
| buildInitialMuseProviderSnapshot, | ||
| checkMuseProviderStatus, | ||
| } from "../Layers/MuseProvider.ts"; | ||
| import { makeManagedServerProvider } from "../makeManagedServerProvider.ts"; | ||
| import { | ||
| defaultProviderContinuationIdentity, | ||
| type ProviderDriver, | ||
| type ProviderInstance, | ||
| } from "../ProviderDriver.ts"; | ||
| import { mergeProviderInstanceEnvironment } from "../ProviderInstanceEnvironment.ts"; | ||
| import { makeManualOnlyProviderMaintenanceCapabilities } from "../providerMaintenance.ts"; | ||
| import { | ||
| haveProviderSnapshotSettingsChanged, | ||
| makeProviderSnapshotSettingsSource, | ||
| } from "../providerUpdateSettings.ts"; | ||
| import type { ServerProviderDraft } from "../providerSnapshot.ts"; | ||
| import { withInstanceIdentity } from "./instanceIdentity.ts"; | ||
| import { discoverMuseSkills } from "./MuseSkills.ts"; | ||
|
|
||
| const DRIVER_KIND = ProviderDriverKind.make("muse"); | ||
| const decodeSettings = Schema.decodeSync(MuseSettings); | ||
| const isProviderDriverError = Schema.is(ProviderDriverError); | ||
| const MAINTENANCE = makeManualOnlyProviderMaintenanceCapabilities({ | ||
| provider: DRIVER_KIND, | ||
| packageName: null, | ||
| }); | ||
| const unavailableTextGeneration = (operation: string) => | ||
| Effect.fail( | ||
| new TextGenerationError({ | ||
| operation, | ||
| detail: | ||
| "Muse Code does not yet support tool-free background text generation. Select another provider for generated titles and source control text.", | ||
| }), | ||
| ); | ||
|
|
||
| export type MuseDriverEnv = | ||
| | BackgroundPolicy.BackgroundPolicy | ||
| | ChildProcessSpawner.ChildProcessSpawner | ||
| | FileSystem.FileSystem | ||
| | Path.Path | ||
| | ServerConfig.ServerConfig | ||
| | ServerSettings.ServerSettingsService; | ||
|
|
||
| export const MuseDriver: ProviderDriver<MuseSettings, MuseDriverEnv> = { | ||
| driverKind: DRIVER_KIND, | ||
|
maria-rcks marked this conversation as resolved.
Resolved
maria-rcks marked this conversation as resolved.
Resolved
|
||
| metadata: { displayName: "Muse Code", supportsMultipleInstances: true }, | ||
| configSchema: MuseSettings, | ||
| defaultConfig: () => decodeSettings({}), | ||
| create: ({ instanceId, displayName, accentColor, environment, enabled, config }) => | ||
| Effect.gen(function* () { | ||
| const { cwd } = yield* ServerConfig.ServerConfig; | ||
| const serverSettings = yield* ServerSettings.ServerSettingsService; | ||
| const spawner = yield* ChildProcessSpawner.ChildProcessSpawner; | ||
| const path = yield* Path.Path; | ||
| const processEnv = mergeProviderInstanceEnvironment(environment); | ||
| const effectiveConfig = { ...config, enabled }; | ||
| const continuationIdentity = defaultProviderContinuationIdentity({ | ||
| driverKind: DRIVER_KIND, | ||
| instanceId, | ||
| }); | ||
| const stampInstance = withInstanceIdentity({ | ||
| instanceId, | ||
| driverKind: DRIVER_KIND, | ||
| displayName, | ||
| accentColor, | ||
| continuationGroupKey: continuationIdentity.continuationKey, | ||
| }); | ||
| const stampIdentity = (snapshot: ServerProviderDraft) => ({ | ||
| ...stampInstance(snapshot), | ||
| supportsTextGeneration: false, | ||
| }); | ||
| const adapter = yield* MuseAdapter.make(effectiveConfig, { | ||
| environment: processEnv, | ||
| instanceId, | ||
| }); | ||
| const snapshotSettings = makeProviderSnapshotSettingsSource(effectiveConfig, serverSettings); | ||
| const snapshot = yield* makeManagedServerProvider({ | ||
| resolveMaintenance: () => Effect.succeed(MAINTENANCE), | ||
| getSettings: snapshotSettings.getSettings, | ||
| streamSettings: snapshotSettings.streamSettings, | ||
| haveSettingsChanged: haveProviderSnapshotSettingsChanged, | ||
| initialSnapshot: (settings) => | ||
| buildInitialMuseProviderSnapshot(settings.provider).pipe(Effect.map(stampIdentity)), | ||
| checkProvider: checkMuseProviderStatus(effectiveConfig, processEnv, cwd).pipe( | ||
| Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner), | ||
| Effect.map(stampIdentity), | ||
| ), | ||
| }); | ||
| const snapshotForCwd = (workspaceCwd: string) => | ||
| !effectiveConfig.enabled | ||
| ? snapshot.getSnapshot | ||
| : Effect.all([ | ||
| snapshot.getSnapshot, | ||
| discoverMuseSkills(effectiveConfig, processEnv, workspaceCwd).pipe( | ||
| Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner), | ||
| Effect.provideService(Path.Path, path), | ||
| Effect.mapError( | ||
| (cause) => | ||
| new ProviderDriverError({ | ||
| driver: DRIVER_KIND, | ||
| instanceId, | ||
| detail: "Failed to discover Muse skills for this workspace.", | ||
| cause, | ||
| }), | ||
|
maria-rcks marked this conversation as resolved.
Resolved
maria-rcks marked this conversation as resolved.
Resolved
maria-rcks marked this conversation as resolved.
Resolved
|
||
| ), | ||
| ), | ||
| ]).pipe(Effect.map(([machineSnapshot, skills]) => ({ ...machineSnapshot, skills }))); | ||
| return { | ||
| instanceId, | ||
| driverKind: DRIVER_KIND, | ||
| continuationIdentity, | ||
| displayName, | ||
| accentColor, | ||
| enabled, | ||
| snapshot, | ||
| snapshotForCwd, | ||
| adapter, | ||
| textGeneration: { | ||
| generateCommitMessage: () => unavailableTextGeneration("generateCommitMessage"), | ||
| generatePrContent: () => unavailableTextGeneration("generatePrContent"), | ||
| generateBranchName: () => unavailableTextGeneration("generateBranchName"), | ||
| generateThreadTitle: () => unavailableTextGeneration("generateThreadTitle"), | ||
| }, | ||
| } satisfies ProviderInstance; | ||
| }).pipe( | ||
| Effect.mapError((cause) => | ||
| isProviderDriverError(cause) | ||
| ? cause | ||
| : new ProviderDriverError({ | ||
| driver: DRIVER_KIND, | ||
| instanceId, | ||
| detail: "Failed to initialize the Muse Code provider.", | ||
| cause, | ||
| }), | ||
| ), | ||
|
macroscopeapp[bot] marked this conversation as resolved.
Resolved
|
||
| ), | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.