mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-18 03:27:08 +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,5 +1,6 @@
|
||||
import axios from 'axios'
|
||||
import type { AgentState, ClearOpencodeSessionCallbackRequest, ClearOpencodeSessionResponse, CreateMachineResponse, CreateSessionResponse, RunnerState, Machine, MachineMetadata, Metadata, Session } from '@/api/types'
|
||||
import { applyHubSessionSummaryContract } from '@/modules/common/sessionSummaryInstruction'
|
||||
import type { LocalResumeTarget, ResumableSession } from '@hapi/protocol'
|
||||
import {
|
||||
AgentStateSchema,
|
||||
@@ -84,6 +85,10 @@ export class ApiClient {
|
||||
throw apiValidationError('Invalid /cli/sessions response', response)
|
||||
}
|
||||
|
||||
if (typeof parsed.data.sessionSummaryContract === 'boolean') {
|
||||
applyHubSessionSummaryContract(parsed.data.sessionSummaryContract)
|
||||
}
|
||||
|
||||
const raw = parsed.data.session
|
||||
|
||||
const metadata = (() => {
|
||||
@@ -136,6 +141,10 @@ export class ApiClient {
|
||||
throw apiValidationError('Invalid /cli/sessions/:id response', response)
|
||||
}
|
||||
|
||||
if (typeof parsed.data.sessionSummaryContract === 'boolean') {
|
||||
applyHubSessionSummaryContract(parsed.data.sessionSummaryContract)
|
||||
}
|
||||
|
||||
const raw = parsed.data.session
|
||||
const metadata = (() => {
|
||||
if (raw.metadata == null) return null
|
||||
|
||||
Reference in New Issue
Block a user