feat(schedule): add durable after reminders

This commit is contained in:
pku-xht
2026-08-06 03:47:37 +08:00
committed by Tianyi Cui
parent f7e7851e3f
commit 8b69252664
41 changed files with 354 additions and 146 deletions
+2 -5
View File
@@ -60,10 +60,7 @@ import { credentialRef } from '@deepseek-ai/dsh-credentials'
// Value edge: the rename impl narrows the title service's validation failure; the import also resolves `ctx.get('sessionTitle')`.
import { SessionTitleInvalidError } from '@deepseek-ai/dsh-session-title'
import type { CallId } from '@deepseek-ai/dsh-llm/brand'
import {
SCHEDULE_REMINDER_PRESENTATION_KEY,
scheduleReminderPresentation,
} from '@deepseek-ai/dsh-tool-schedule'
import { scheduleReminderPresentation } from '@deepseek-ai/dsh-tool-schedule'
import type { ApprovalOutcome, ApprovalRequestId } from '@deepseek-ai/dsh-user-approval'
// Side-effect type import: resolves the `approval/request` waterfall and
// `ctx.get('approval')` without a value dependency on the seam (optional composition).
@@ -486,7 +483,7 @@ function scheduleViewFor(
const view = scheduleReminderPresentation(events, event.seq, header.seedLength ?? 0)
return view === undefined
? undefined
: { for: 'event', presentationKey: SCHEDULE_REMINDER_PRESENTATION_KEY, view }
: { for: 'event', view }
} catch (error: unknown) {
ctx.logger.warn(`api-proxy: Schedule presentation failed at seq ${event.seq}; serving raw event: ${String(error)}`)
return undefined
+3 -5
View File
@@ -33,14 +33,12 @@ export type ToolEventView =
| { for: 'result'; view: ToolResultView }
/**
* Host-computed presentation for one non-surface Session event. The domain
* owns the presentation key and JSON-compatible view shape; the carrier keeps
* both generic so an opt-in client plugin can render the event without adding
* domain vocabulary to the connection package.
* Host-computed presentation for one non-surface Session event. The durable
* event type selects an optional client renderer; the sidecar carries only the
* JSON-compatible view so the connection package adds no domain vocabulary.
*/
export interface PresentedEventView {
for: 'event'
presentationKey: string
view: unknown
}
@@ -193,10 +193,9 @@ export const toolEventViewSchema = z.discriminatedUnion('for', [
z.object({ for: z.literal('result'), view: z.looseObject({ card: z.string() }) }),
]) as unknown as z.ZodType<ToolEventView>
/** Domain-owned presented-event sidecar with a carrier-validated key and present payload. */
/** Domain-owned presented-event sidecar whose durable event supplies the renderer key. */
const presentedEventViewSchema = z.object({
for: z.literal('event'),
presentationKey: z.string().min(1),
view: z.unknown(),
}).refine(value => Object.hasOwn(value, 'view'), {
message: 'presented event view payload is required',