feat(server): add Hermes Agent ACP provider #9158
Closedraman325(GitHub profile, opens in a new tab)wants to merge 21 commits into
main fromrefs/pull/9158/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
- apps/server/src/provider/Layers/HermesAdapter.ts lines 911 to 928Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +796,21 @@796+ // Count this prompt immediately so a superseded in-flight prompt797+ // resolving from here on does not settle the turn; the matching798+ // decrement is the `ensuring` below.799+ ctx.promptsInFlight += 1;800+801+ return yield* Effect.gen(function* () {802+ const turnModelSelection =803+ input.modelSelection?.instanceId === boundInstanceId ? input.modelSelection : undefined;804+ const model = turnModelSelection?.model ?? ctx.session.model;805+ yield* applyRequestedSessionConfiguration({806+ runtime: ctx.acp,807+ runtimeMode: ctx.session.runtimeMode,808+ interactionMode: input.interactionMode,809+ modelSelection: model === undefined ? undefined : { model },810+ currentModelId: ctx.session.model,811+ mapError: ({ cause, method }) =>812+ mapAcpToAdapterError(PROVIDER, input.threadId, method, cause),813+ });814+ ctx.activeTurnId = turnId;815+ if (steeringTurnId === undefined) {816+ ctx.lastPlanFingerprint = undefined;apps/server/src/provider/Layers/HermesProvider.ts lines 115 to 129Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +102,21 @@102+103+function buildHermesDiscoveredModelsFromSessionModelState(104+ modelState: EffectAcpSchema.SessionModelState | null | undefined,105+): ReadonlyArray<ServerProviderModel> {106+ if (!modelState || modelState.availableModels.length === 0) {107+ return [];108+ }109+ const seen = new Set<string>();110+ return modelState.availableModels.flatMap((model) => {111+ const slug = model.modelId.trim();112+ if (!slug || seen.has(slug)) {113+ return [];114+ }115+ seen.add(slug);116+ return [117+ {118+ slug,119+ name: model.name.trim() || slug,120+ isCustom: false,121+ capabilities: EMPTY_CAPABILITIES,122+ } satisfies ServerProviderModel,apps/server/src/provider/Layers/HermesAdapter.ts line 455Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +351,21 @@351+ new EffectAcpErrors.AcpTransportError({352+ detail: "Failed to process Hermes ACP callback.",353+ cause,354+ }),355+ ),356+ );357+358+ const offerRuntimeEvent = (event: ProviderRuntimeEvent) =>359+ PubSub.publish(runtimeEventPubSub, event).pipe(Effect.asVoid);360+361+ const getThreadSemaphore = (threadId: string) =>362+ SynchronizedRef.modifyEffect(threadLocksRef, (current) => {363+ const existing: Option.Option<Semaphore.Semaphore> = Option.fromNullishOr(364+ current.get(threadId),365+ );366+ return Option.match(existing, {367+ onNone: () =>368+ Semaphore.make(1).pipe(369+ Effect.map((semaphore) => {370+ const next = new Map(current);371+ next.set(threadId, semaphore);
- apps/server/src/provider/Drivers/HermesDriver.ts lines 76 to 90OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +70,21 @@70+ | HttpClient.HttpClient71+ | Path.Path72+ | ProviderEventLoggers73+ | ServerConfig74+ | ServerSettingsService;75+76+const withInstanceIdentity =77+ (input: {78+ readonly instanceId: ProviderInstance["instanceId"];79+ readonly displayName: string | undefined;80+ readonly accentColor: string | undefined;81+ readonly continuationGroupKey: string;82+ }) =>83+ (snapshot: ServerProviderDraft): ServerProvider => ({84+ ...snapshot,85+ instanceId: input.instanceId,86+ driver: DRIVER_KIND,87+ ...(input.displayName ? { displayName: input.displayName } : {}),88+ ...(input.accentColor ? { accentColor: input.accentColor } : {}),89+ continuation: { groupKey: input.continuationGroupKey },90+ });
- apps/server/src/provider/Layers/HermesProvider.ts lines 246 to 250Resolvedby raman325(GitHub profile, opens in a new tab)@@ -0,0 +223,21 @@223+/** Interpret `hermes --version` output as a probe result. */224+export function parseHermesVersionOutput(result: CommandResult): HermesVersionResult {225+ const version = parseHermesCliVersion(`${result.stdout}\n${result.stderr}`);226+ if (result.code !== 0) {227+ return {228+ version,229+ status: "error",230+ auth: { status: "unknown" },231+ message: "Hermes Agent CLI is installed but failed to run.",232+ };233+ }234+ return { version, status: "ready", auth: { status: "unknown" } };235+}236+237+const runHermesVersionCommand = (hermesSettings: HermesSettings, environment?: NodeJS.ProcessEnv) =>238+ Effect.gen(function* () {239+ const command = hermesSettings.binaryPath || "hermes";240+ const spawnCommand = yield* resolveSpawnCommand(241+ command,242+ ["--version"],243+ environment ? { env: environment } : {},packages/contracts/src/settings.ts lines 989 to 996OutdatedResolvedby raman325(GitHub profile, opens in a new tab)@@ -738,6 +764,7 @@738764 claudeAgent: ClaudeSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),739765 cursor: CursorSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),740766 grok: GrokSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),767+ hermes: HermesSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),741768 opencode: OpenCodeSettings.pipe(Schema.withDecodingDefault(Effect.succeed({}))),742769 }).pipe(Schema.withDecodingDefault(Effect.succeed({}))),743770 // New driver-agnostic instance map. Keyed by `ProviderInstanceId`; values
- apps/server/src/provider/acp/HermesAcpSupport.ts line 121Resolvedby raman325(GitHub profile, opens in a new tab)@@ -0,0 +89,21 @@89+ *90+ * `session/set_config_option` is not usable here: the real `hermes acp`91+ * binary treats configId `"model"` as a silent no-op (it always returns92+ * `{ configOptions: [] }`, even for invalid values), so model changes must93+ * go through the unstable `session/set_model` capability instead.94+ */95+export function applyHermesAcpModelSelection<E>(input: {96+ readonly runtime: HermesAcpModelSelectionRuntime;97+ readonly currentModelId: string | undefined;98+ readonly model: string;99+ readonly mapError: (context: HermesAcpModelSelectionErrorContext) => E;100+}): Effect.Effect<void, E> {101+ const requestedModelId = input.model.trim();102+ if (requestedModelId.length === 0 || requestedModelId === input.currentModelId) {103+ return Effect.void;104+ }105+ return input.runtime.setSessionModel(requestedModelId).pipe(106+ Effect.asVoid,107+ Effect.mapError((cause) => input.mapError({ cause })),108+ );109+}apps/server/src/provider/Layers/HermesAdapter.ts line 811OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +791,21 @@791+ // A sendTurn while a prompt is in flight is a steer: the agent folds792+ // the new prompt into the ongoing work, so the active turn id is793+ // reused instead of opening a new turn.794+ const steeringTurnId = ctx.promptsInFlight > 0 ? ctx.activeTurnId : undefined;795+ const turnId = steeringTurnId ?? TurnId.make(yield* randomUUIDv4);796+ // Count this prompt immediately so a superseded in-flight prompt797+ // resolving from here on does not settle the turn; the matching798+ // decrement is the `ensuring` below.799+ ctx.promptsInFlight += 1;800+801+ return yield* Effect.gen(function* () {802+ const turnModelSelection =803+ input.modelSelection?.instanceId === boundInstanceId ? input.modelSelection : undefined;804+ const model = turnModelSelection?.model ?? ctx.session.model;805+ yield* applyRequestedSessionConfiguration({806+ runtime: ctx.acp,807+ runtimeMode: ctx.session.runtimeMode,808+ interactionMode: input.interactionMode,809+ modelSelection: model === undefined ? undefined : { model },810+ currentModelId: ctx.session.model,811+ mapError: ({ cause, method }) =>
- apps/server/src/textGeneration/HermesTextGeneration.test.ts line 1OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +1 @@1+// @effect-diagnostics nodeBuiltinImport:offapps/server/src/provider/Layers/HermesAdapter.test.ts line 1OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +1 @@1+// @effect-diagnostics nodeBuiltinImport:off
- apps/server/src/provider/Layers/HermesAdapter.ts line 706Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +596,21 @@596+ "[unserializable params]",597+ args: params,598+ source: "acp.jsonrpc",599+ method: "session/request_permission",600+ rawPayload: params,601+ }),602+ );603+ const resolved = yield* Deferred.await(decision);604+ pendingApprovals.delete(requestId);605+ yield* offerRuntimeEvent(606+ makeAcpRequestResolvedEvent({607+ stamp: yield* makeEventStamp(),608+ provider: PROVIDER,609+ threadId: input.threadId,610+ turnId: ctx?.activeTurnId,611+ requestId: runtimeRequestId,612+ permissionRequest,613+ decision: resolved,614+ }),615+ );616+ return {
- apps/server/src/provider/Layers/HermesAdapter.ts line 921Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +810,21 @@810+ const turnId = steeringTurnId ?? TurnId.make(yield* randomUUIDv4);811+ // Count this prompt immediately so a superseded in-flight prompt812+ // resolving from here on does not settle the turn; the matching813+ // decrement is the `ensuring` below. The active turn id must land in814+ // the same synchronous window: a concurrent sendTurn arriving during815+ // the awaited session configuration below reads it to merge into this816+ // turn instead of opening a duplicate.817+ ctx.promptsInFlight += 1;818+ ctx.activeTurnId = turnId;819+820+ return yield* Effect.gen(function* () {821+ const turnModelSelection =822+ input.modelSelection?.instanceId === boundInstanceId ? input.modelSelection : undefined;823+ // The `default` product slug means "keep the configured model", so824+ // it resolves to the session's tracked model rather than being sent825+ // or stored as if it were a real ACP model id.826+ const requestedTurnModel =827+ turnModelSelection?.model && turnModelSelection.model !== HERMES_DEFAULT_MODEL_SLUG828+ ? turnModelSelection.model829+ : undefined;830+ const model = requestedTurnModel ?? ctx.session.model;
- apps/server/src/provider/Layers/HermesAdapter.ts line 354Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +284,21 @@284+ cause,285+ method: "session/set_mode",286+ }),287+ ),288+ );289+ });290+}291+292+/**293+ * Resolve a user's approval decision to an option id the agent actually294+ * advertised. Hermes mints its own option ids, so the decision must be matched295+ * by `kind` and answered with the advertised id — replying with a canonical296+ * literal leaves the permission-gated turn blocked whenever the agent uses297+ * opaque ids. Falls back to `allow_once` for a session-wide accept, since an298+ * agent that omits `allow_always` still honours a one-shot allow.299+ */300+export function selectHermesPermissionOptionId(301+ request: EffectAcpSchema.RequestPermissionRequest,302+ decision: Exclude<ProviderApprovalDecision, "cancel">,303+): string | undefined {304+ const preferredKind =apps/server/src/provider/Layers/HermesAdapter.ts line 887OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +867,21 @@867+ // Captured before the session record below adopts `model`: the868+ // skip-if-match guard must compare against the model the ACP session869+ // is actually on, not the one this turn is about to request.870+ const sessionModelBeforeTurn = ctx.session.model;871+872+ if (steeringTurnId === undefined) {873+ ctx.lastPlanFingerprint = undefined;874+ }875+ ctx.session = {876+ ...ctx.session,877+ activeTurnId: turnId,878+ model: model ?? ctx.session.model,879+ updatedAt: yield* nowIso,880+ };881+882+ // Announce the turn before the awaited configuration below. A steer883+ // that merges into this turn skips its own `turn.started`, so if884+ // preparation could fail after the id was published the merged turn885+ // would settle without ever having started.886+ if (steeringTurnId === undefined) {887+ yield* offerRuntimeEvent({
- apps/server/src/provider/Layers/HermesAdapter.ts lines 930 to 935Resolvedby raman325(GitHub profile, opens in a new tab)@@ -0,0 +860,21 @@860+ // it resolves to the session's tracked model rather than being sent861+ // or stored as if it were a real ACP model id.862+ const requestedTurnModel =863+ turnModelSelection?.model && turnModelSelection.model !== HERMES_DEFAULT_MODEL_SLUG864+ ? turnModelSelection.model865+ : undefined;866+ const model = requestedTurnModel ?? ctx.session.model;867+ // Captured before the session record below adopts `model`: the868+ // skip-if-match guard must compare against the model the ACP session869+ // is actually on, not the one this turn is about to request.870+ const sessionModelBeforeTurn = ctx.session.model;871+872+ if (steeringTurnId === undefined) {873+ ctx.lastPlanFingerprint = undefined;874+ }875+ ctx.session = {876+ ...ctx.session,877+ activeTurnId: turnId,878+ model: model ?? ctx.session.model,879+ updatedAt: yield* nowIso,880+ };
- apps/server/src/provider/Layers/HermesAdapter.ts line 905OutdatedResolvedby raman325(GitHub profile, opens in a new tab)@@ -0,0 +885,21 @@885+ // would settle without ever having started.886+ if (steeringTurnId === undefined) {887+ yield* offerRuntimeEvent({888+ type: "turn.started",889+ ...(yield* makeEventStamp()),890+ provider: PROVIDER,891+ threadId: input.threadId,892+ turnId,893+ payload: model === undefined ? {} : { model },894+ });895+ }896+897+ yield* applyRequestedSessionConfiguration({898+ runtime: ctx.acp,899+ runtimeMode: ctx.session.runtimeMode,900+ interactionMode: input.interactionMode,901+ modelSelection: model === undefined ? undefined : { model },902+ currentModelId: sessionModelBeforeTurn,903+ mapError: ({ cause, method }) =>904+ mapAcpToAdapterError(PROVIDER, input.threadId, method, cause),905+ });apps/server/src/provider/Layers/HermesAdapter.ts line 905OutdatedResolvedby raman325(GitHub profile, opens in a new tab)@@ -0,0 +885,21 @@885+ // would settle without ever having started.886+ if (steeringTurnId === undefined) {887+ yield* offerRuntimeEvent({888+ type: "turn.started",889+ ...(yield* makeEventStamp()),890+ provider: PROVIDER,891+ threadId: input.threadId,892+ turnId,893+ payload: model === undefined ? {} : { model },894+ });895+ }896+897+ yield* applyRequestedSessionConfiguration({898+ runtime: ctx.acp,899+ runtimeMode: ctx.session.runtimeMode,900+ interactionMode: input.interactionMode,901+ modelSelection: model === undefined ? undefined : { model },902+ currentModelId: sessionModelBeforeTurn,903+ mapError: ({ cause, method }) =>904+ mapAcpToAdapterError(PROVIDER, input.threadId, method, cause),905+ });
- apps/server/src/provider/Layers/HermesAdapter.ts line 1013Resolvedby raman325(GitHub profile, opens in a new tab)@@ -0,0 +949,21 @@949+ mapAcpToAdapterError(PROVIDER, input.threadId, method, cause),950+ });951+952+ // Announced only once both fallible preparation steps — prompt953+ // validation and session configuration — have passed, so a turn954+ // consumers can see is always a turn that can settle. Keyed on the955+ // session flag rather than "am I a steer" so a steer that overtook a956+ // not-yet-announced turn still announces it, exactly once.957+ if (!ctx.activeTurnAnnounced) {958+ ctx.activeTurnAnnounced = true;959+ yield* offerRuntimeEvent({960+ type: "turn.started",961+ ...(yield* makeEventStamp()),962+ provider: PROVIDER,963+ threadId: input.threadId,964+ turnId,965+ payload: model === undefined ? {} : { model },966+ });967+ }968+969+ const result = yield* ctx.acpapps/server/src/provider/Layers/HermesAdapter.ts line 1039Resolvedby raman325(GitHub profile, opens in a new tab)@@ -0,0 +975,21 @@975+ mapAcpToAdapterError(PROVIDER, input.threadId, "session/prompt", error),976+ ),977+ );978+979+ const turnRecord = ctx.turns.find((turn) => turn.id === turnId);980+ if (turnRecord) {981+ turnRecord.items.push({ prompt: promptParts, result });982+ } else {983+ ctx.turns.push({ id: turnId, items: [{ prompt: promptParts, result }] });984+ }985+ ctx.session = {986+ ...ctx.session,987+ activeTurnId: turnId,988+ updatedAt: yield* nowIso,989+ ...(model === undefined ? {} : { model }),990+ };991+992+ // Only the last remaining prompt settles the turn — a steer-993+ // superseded prompt resolving (usually cancelled) while another is994+ // in flight or pending must leave the merged turn running.995+ if (ctx.promptsInFlight === 1) {
- apps/web/src/components/settings/providerDriverMeta.ts line 86OutdatedResolvedby raman325(GitHub profile, opens in a new tab)@@ -67,3 +76,11 @@6776 icon: OpenCodeIcon,6877 settingsSchema: OpenCodeSettings,6978 },79+ // [fork-only] Hermes is not part of the upstream provider set; see80+ // `HermesIcon` in `../Icons` for why it's a generic monogram rather than81+ // a brand mark.82+ {83+ value: ProviderDriverKind.make("hermes"),84+ label: "Hermes",85+ icon: HermesIcon,86+ badgeLabel: "Experimental",
- apps/server/src/provider/Layers/HermesAdapter.ts line 986Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +922,21 @@922+ cause,923+ }),924+ ),925+ );926+ promptParts.push({927+ type: "image",928+ data: Buffer.from(bytes).toString("base64"),929+ mimeType: attachment.mimeType,930+ });931+ }932+ }933+934+ if (promptParts.length === 0) {935+ return yield* new ProviderAdapterValidationError({936+ provider: PROVIDER,937+ operation: "sendTurn",938+ issue: "Turn requires non-empty text or attachments.",939+ });940+ }941+942+ yield* applyRequestedSessionConfiguration({apps/server/src/provider/Layers/HermesAdapter.ts lines 208 to 208OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +188,21 @@188+ .replace(/[^a-z0-9]+/g, " ")189+ .trim();190+}191+192+function findModeByAliases(193+ modes: ReadonlyArray<AcpSessionMode>,194+ aliases: ReadonlyArray<string>,195+): AcpSessionMode | undefined {196+ const normalizedAliases = aliases.map((alias) => alias.toLowerCase());197+ for (const alias of normalizedAliases) {198+ const exact = modes.find((mode) => {199+ const id = mode.id.toLowerCase();200+ const name = mode.name.toLowerCase();201+ return id === alias || name === alias;202+ });203+ if (exact) {204+ return exact;205+ }206+ }207+ for (const alias of normalizedAliases) {208+ const partial = modes.find((mode) => normalizeModeSearchText(mode).includes(alias));
- apps/server/src/provider/Layers/HermesAdapter.ts lines 166 to 175Resolvedby raman325(GitHub profile, opens in a new tab)@@ -0,0 +155,21 @@155+ * arriving before the first prompt announced the turn must announce it, so156+ * exactly one start is emitted and no turn can settle without one. */157+ activeTurnAnnounced: boolean;158+ /** Number of sendTurn prompts currently in flight or being prepared.159+ * >0 means a turn is actively running, so a new sendTurn is a steer that160+ * continues it, and only the last remaining prompt settles the turn. */161+ promptsInFlight: number;162+ stopped: boolean;163+}164+165+function settlePendingApprovalsAsCancelled(166+ pendingApprovals: ReadonlyMap<ApprovalRequestId, PendingApproval>,167+): Effect.Effect<void> {168+ const pendingEntries = Array.from(pendingApprovals.values());169+ return Effect.forEach(170+ pendingEntries,171+ (pending) => Deferred.succeed(pending.decision, "cancel").pipe(Effect.ignore),172+ {173+ discard: true,174+ },175+ );
- apps/server/src/serverSettings.ts line 371Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -333,3 +339,4 @@333339 ...DEFAULT_SERVER_SETTINGS.providers,334340 cursor: { ...DEFAULT_SERVER_SETTINGS.providers.cursor, enabled: undefined },335341 grok: { ...DEFAULT_SERVER_SETTINGS.providers.grok, enabled: undefined },342+ hermes: { ...DEFAULT_SERVER_SETTINGS.providers.hermes, enabled: undefined },
- @@ -0,0 +414,21 @@414+ // Steer while the first prompt is still in flight. The steer must415+ // observe the first turn's id — assigned synchronously with the416+ // in-flight increment, before the awaited session configuration — and417+ // merge into it; a second turn.started is the duplicate-turn418+ // regression.419+ const firstSendTurnFiber = yield* adapter420+ .sendTurn({ threadId, input: "start work", attachments: [] })421+ .pipe(Effect.forkChild);422+ yield* Deferred.await(contentDelta).pipe(Effect.timeout("2 seconds"), TestClock.withLive);423+424+ const steerSendTurnFiber = yield* adapter425+ .sendTurn({ threadId, input: "steer the running turn", attachments: [] })426+ .pipe(Effect.forkChild);427+ for (let yieldAttempt = 0; yieldAttempt < 12; yieldAttempt += 1) {428+ yield* Effect.yieldNow;429+ }430+431+ // The steer folded into the running turn: exactly one turn.started,432+ // one distinct turn id. A second of either is the regression.433+ const turnStartedEvents = runtimeEvents.filter((event) => event.type === "turn.started");434+ assert.lengthOf(turnStartedEvents, 1);@@ -0,0 +1178,21 @@1178+1179+ const streamEvents = Stream.fromPubSub(runtimeEventPubSub);1180+1181+ return {1182+ provider: PROVIDER,1183+ capabilities: { sessionModelSwitch: "in-session" },1184+ startSession,1185+ sendTurn,1186+ interruptTurn,1187+ readThread,1188+ rollbackThread,1189+ respondToRequest,1190+ respondToUserInput,1191+ stopSession,1192+ listSessions,1193+ hasSession,1194+ stopAll,1195+ streamEvents,1196+ } satisfies HermesAdapterShape;1197+ });1198+}@@ -0,0 +28,21 @@28+ return `'${value.replaceAll("'", `'"'"'`)}'`;29+}30+31+const HermesTextGenerationTestLayer = ServerConfig.ServerConfig.layerTest(process.cwd(), {32+ prefix: "t3code-hermes-text-generation-test-",33+}).pipe(Layer.provideMerge(NodeServices.layer));34+35+function makeAcpAgentWrapper(dir: string, env: Record<string, string>): string {36+ const binDir = NodePath.join(dir, "bin");37+ const agentPath = NodePath.join(binDir, "agent");38+ NodeFS.mkdirSync(binDir, { recursive: true });39+ NodeFS.writeFileSync(40+ agentPath,41+ [42+ "#!/bin/sh",43+ ...Object.entries(env).map(([key, value]) => `export ${key}=${shellSingleQuote(value)}`),44+ 'if [ "$1" != "acp" ]; then',45+ ' printf "%s\\n" "unexpected args: $*" >&2',46+ " exit 11",47+ "fi",48+ `exec node ${JSON.stringify(mockAgentPath)}`,@@ -0,0 +71,21 @@71+ return yield* effectFn(textGeneration);72+ }).pipe(Effect.scoped);73+}74+75+function waitForFileContent(path: string): Effect.Effect<string> {76+ return Effect.gen(function* () {77+ const deadline = (yield* Clock.currentTimeMillis) + 5_000;78+ for (;;) {79+ const result = yield* Effect.exit(Effect.sync(() => NodeFS.readFileSync(path, "utf8")));80+ if (Exit.isSuccess(result)) {81+ return result.value;82+ }83+ {84+ if ((yield* Clock.currentTimeMillis) >= deadline) {85+ return yield* Effect.die(result.cause);86+ }87+ }88+ yield* Effect.sleep(25);89+ }90+ });91+}@@ -0,0 +68,21 @@68+ environment: resolvedEnvironment,69+ childProcessSpawner: commandSpawner,70+ cwd,71+ clientInfo: { name: "t3-code-git-text", version: "0.0.0" },72+ }).pipe(Effect.provideService(Crypto.Crypto, crypto));73+74+ yield* runtime.handleSessionUpdate((notification) => {75+ const update = notification.update;76+ if (update.sessionUpdate !== "agent_message_chunk") {77+ return Effect.void;78+ }79+ const content = update.content;80+ if (content.type !== "text") {81+ return Effect.void;82+ }83+ return Ref.update(outputRef, (current) => current + content.text);84+ });85+86+ const promptResult = yield* Effect.gen(function* () {87+ const started = yield* runtime.start();88+ yield* Effect.ignore(runtime.setMode("ask"));
juliusmarminge closed this
Sign in to join this conversation.


macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed