diff --git a/Dockerfile b/Dockerfile index 07d6e31c..c4f905ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ # Or pull pre-built: # docker pull ghcr.io/outsourc-e/hermes-workspace:latest # -FROM tianon/gosu:1.19-bookworm AS gosu_source +FROM tianon/gosu:1.17-bookworm AS gosu_source # ─── build stage ───────────────────────────────────────────────────────── FROM node:22-slim AS build RUN corepack enable && apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/* diff --git a/src/lib/workspace-message-scope.test.ts b/src/lib/workspace-message-scope.test.ts index ea457ffc..21bb50b1 100644 --- a/src/lib/workspace-message-scope.test.ts +++ b/src/lib/workspace-message-scope.test.ts @@ -1,6 +1,9 @@ import { describe, expect, it } from 'vitest' -import { buildWorkspaceScopedTextMessage } from './workspace-message-scope' +import { + buildWorkspaceScopedTextMessage, + stripWorkspaceDirective, +} from './workspace-message-scope' describe('buildWorkspaceScopedTextMessage', () => { it('prepends an explicit active workspace directive to plain text chat messages', () => { @@ -39,4 +42,12 @@ describe('buildWorkspaceScopedTextMessage', () => { }), ).toBe('hello') }) + + it('strips the workspace directive back out for user-visible rendering', () => { + expect( + stripWorkspaceDirective( + '\n\nRun the tests', + ), + ).toBe('Run the tests') + }) }) diff --git a/src/lib/workspace-message-scope.ts b/src/lib/workspace-message-scope.ts index 05abde12..779b7bd2 100644 --- a/src/lib/workspace-message-scope.ts +++ b/src/lib/workspace-message-scope.ts @@ -4,6 +4,9 @@ export type WorkspaceScope = { isValid?: boolean } +const WORKSPACE_DIRECTIVE_RE = + /^\s*\s*/i + function escapeAttribute(value: string): string { return value .replace(/&/g, '&') @@ -28,3 +31,8 @@ export function buildWorkspaceScopedTextMessage( if (!directive) return message return `${directive}\n\n${message}` } + +export function stripWorkspaceDirective(message: string): string { + if (!message.includes('