mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-08 01:43:07 +00:00
feat: settings toggle for AGENT_NOTIFY_SUMMARY contract injection (#1376)
* feat: settings toggle for AGENT_NOTIFY_SUMMARY contract injection Add a hub-persisted, default-off Settings control so operators can opt agents into emitting the trailing AGENT_NOTIFY_SUMMARY line. Propagate the resolved flag on CLI session bootstrap and inject at call time for Claude, Codex, OpenCode, and Grok (Cursor still unsupported). Closes #1375 Co-authored-by: Cursor <cursoragent@cursor.com> * fix: lock hub settings RMW and restore abort deliveryMode Serialize settings.json updates with the shared .lock protocol and unique temp files so the new hub toggle cannot clobber CLI/relay fields under concurrency. Also supply deliveryMode on abort send-error restore so web typecheck (and CI) pass. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): wrap SettingsGeneralPage tests with QueryClientProvider The hub-settings toggle uses TanStack Query; the settings page suite was rendering without a QueryClient and blew up CI. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): defer summary-contract toggle until settings load Avoid rendering an interactive false switch while the hub GET is still in flight, which could overwrite an enabled preference on early click. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): clarify Grok coverage for summary-contract toggle Local Grok has no instruction inject path; settings copy now matches remote-only Grok support (and still excludes Cursor). Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { EnhancedMode } from '../loop';
|
||||
import type { CodexCliOverrides } from './codexCliOverrides';
|
||||
import type { McpServersConfig } from './buildHapiMcpBridge';
|
||||
import { codexSystemPrompt } from './systemPrompt';
|
||||
import { getCodexSystemPrompt } from './systemPrompt';
|
||||
import type {
|
||||
ApprovalPolicy,
|
||||
SandboxMode,
|
||||
@@ -115,7 +115,7 @@ function resolveInstructions(args: {
|
||||
baseInstructions?: string;
|
||||
developerInstructions?: string;
|
||||
}): { baseInstructions: string; developerInstructions: string } {
|
||||
const baseInstructions = args.baseInstructions ?? codexSystemPrompt;
|
||||
const baseInstructions = args.baseInstructions ?? getCodexSystemPrompt();
|
||||
const developerInstructions = args.developerInstructions
|
||||
? `${baseInstructions}\n\n${args.developerInstructions}`
|
||||
: baseInstructions;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
import { trimIdent } from '@/utils/trimIdent';
|
||||
import { buildSessionCitationSteerInstruction } from '@hapi/protocol/sessionCitation';
|
||||
import { withSessionSummaryInstruction } from '@/modules/common/sessionSummaryInstruction';
|
||||
|
||||
/**
|
||||
* Title instruction for Codex to call the hapi MCP tool.
|
||||
@@ -29,5 +30,11 @@ export const TITLE_INSTRUCTION = trimIdent(`
|
||||
|
||||
/**
|
||||
* The system prompt to inject via developer_instructions in local mode.
|
||||
* Session-summary contract is resolved at call time (hub toggle / env).
|
||||
*/
|
||||
export const codexSystemPrompt = TITLE_INSTRUCTION;
|
||||
export function getCodexSystemPrompt(env: NodeJS.ProcessEnv = process.env): string {
|
||||
return withSessionSummaryInstruction(TITLE_INSTRUCTION, env)
|
||||
}
|
||||
|
||||
/** Alias kept for existing call sites / tests that expect a string constant name. */
|
||||
export const codexSystemPrompt = TITLE_INSTRUCTION
|
||||
|
||||
Reference in New Issue
Block a user