Skip to content

Commit 1a3608f

Browse files
committed
fix(grok): provide FileSystem to snapshot effects and decode utf-8
Check failed: initialSnapshot and checkProvider still required FileSystem and Path after workflow discovery moved onto Effect, and TextDecoder rejected the 'utf8' label. Provide those services the same way Claude does. Decode the capped prefix with the default utf-8 decoder.
1 parent 56d7255 commit 1a3608f

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎apps/server/src/provider/Drivers/GrokDriver.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ export const GrokDriver: ProviderDriver<GrokSettings, GrokDriverEnv> = {
8686
Effect.gen(function* () {
8787
const crypto = yield* Crypto.Crypto;
8888
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
89+
const fileSystem = yield* FileSystem.FileSystem;
90+
const path = yield* Path.Path;
8991
const httpClient = yield* HttpClient.HttpClient;
9092
const serverSettings = yield* ServerSettingsService;
9193
const eventLoggers = yield* ProviderEventLoggers;
@@ -118,6 +120,8 @@ export const GrokDriver: ProviderDriver<GrokSettings, GrokDriverEnv> = {
118120
Effect.map(stampIdentity),
119121
Effect.provideService(Crypto.Crypto, crypto),
120122
Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),
123+
Effect.provideService(FileSystem.FileSystem, fileSystem),
124+
Effect.provideService(Path.Path, path),
121125
);
122126

123127
const snapshotSettings = makeProviderSnapshotSettingsSource(effectiveConfig, serverSettings);
@@ -130,7 +134,11 @@ export const GrokDriver: ProviderDriver<GrokSettings, GrokDriverEnv> = {
130134
buildInitialGrokProviderSnapshot(settings.provider, {
131135
environment: processEnv,
132136
projectRoot,
133-
}).pipe(Effect.map(stampIdentity)),
137+
}).pipe(
138+
Effect.map(stampIdentity),
139+
Effect.provideService(FileSystem.FileSystem, fileSystem),
140+
Effect.provideService(Path.Path, path),
141+
),
134142
checkProvider,
135143
enrichSnapshot: ({ settings, snapshot: currentSnapshot, publishSnapshot }) =>
136144
enrichGrokSnapshot({

‎apps/server/src/provider/acp/GrokWorkflowCommands.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const readWorkflowDir = Effect.fn("grok.readWorkflowDir")(function* (
9999
if (Option.isNone(bytes)) {
100100
continue;
101101
}
102-
const source = new TextDecoder("utf8").decode(bytes.value);
102+
const source = new TextDecoder().decode(bytes.value);
103103
const fallbackName = entry.endsWith(".rhai") ? entry.slice(0, -".rhai".length) : entry;
104104
const meta = parseGrokWorkflowScriptMeta(source, fallbackName);
105105
if (!meta) {

0 commit comments

Comments
 (0)