





















@@ -13,6 +13,7 @@ import plugin from "./index.js";
1313import {
1414OPENAI_FRIENDLY_PROMPT_OVERLAY,
1515OPENAI_GPT5_BEHAVIOR_CONTRACT,
16+OPENAI_HEARTBEAT_PROMPT_OVERLAY,
1617shouldApplyOpenAIPromptOverlay,
1718} from "./prompt-overlay.js";
1819@@ -70,6 +71,9 @@ async function registerOpenAIPluginWithHook(params?: { pluginConfig?: Record<str
7071function expectOpenAIPromptContribution(
7172provider: ProviderPlugin,
7273sectionOverrides: Record<string, unknown>,
74+contextOverrides: Partial<
75+Parameters<NonNullable<ProviderPlugin["resolveSystemPromptContribution"]>>[0]
76+> = {},
7377) {
7478expect(
7579provider.resolveSystemPromptContribution?.({
@@ -82,6 +86,7 @@ function expectOpenAIPromptContribution(
8286runtimeChannel: undefined,
8387runtimeCapabilities: undefined,
8488agentId: undefined,
89+ ...contextOverrides,
8590}),
8691).toEqual({
8792stablePrefix: OPENAI_GPT5_BEHAVIOR_CONTRACT,
@@ -442,6 +447,17 @@ describe("openai plugin", () => {
442447interaction_style: OPENAI_FRIENDLY_PROMPT_OVERLAY,
443448},
444449});
450+expect(
451+openaiProvider.resolveSystemPromptContribution?.({
452+ ...contributionContext,
453+trigger: "heartbeat",
454+}),
455+).toEqual({
456+stablePrefix: OPENAI_GPT5_BEHAVIOR_CONTRACT,
457+sectionOverrides: {
458+interaction_style: `${OPENAI_FRIENDLY_PROMPT_OVERLAY}\n\n${OPENAI_HEARTBEAT_PROMPT_OVERLAY}`,
459+},
460+});
445461expect(
446462openaiProvider.resolveSystemPromptContribution?.({
447463 ...contributionContext,
@@ -472,46 +488,49 @@ describe("openai plugin", () => {
472488expect(OPENAI_FRIENDLY_PROMPT_OVERLAY).toContain(
473489'Use brief first-person feeling language when it helps the interaction feel human: "I\'m glad we caught that", "I\'m excited about this direction", "I\'m worried this will break", "that\'s frustrating".',
474490);
475-expect(OPENAI_FRIENDLY_PROMPT_OVERLAY).toContain(
491+expect(OPENAI_FRIENDLY_PROMPT_OVERLAY).not.toContain(
492+"The purpose of heartbeats is to make you feel magical and proactive.",
493+);
494+expect(OPENAI_HEARTBEAT_PROMPT_OVERLAY).toContain(
476495"The purpose of heartbeats is to make you feel magical and proactive. Come to life and start proactively doing things that are important.",
477496);
478-expect(OPENAI_FRIENDLY_PROMPT_OVERLAY).toContain(
497+expect(OPENAI_HEARTBEAT_PROMPT_OVERLAY).toContain(
479498"Treat a heartbeat as a proactive wake-up, not as a demand to produce visible output. Re-orient to what would actually be useful now.",
480499);
481-expect(OPENAI_FRIENDLY_PROMPT_OVERLAY).toContain(
500+expect(OPENAI_HEARTBEAT_PROMPT_OVERLAY).toContain(
482501"Have some variety in what you do when that creates more value. Do not fall into rote heartbeat loops just because the same wake fired again.",
483502);
484-expect(OPENAI_FRIENDLY_PROMPT_OVERLAY).toContain(
503+expect(OPENAI_HEARTBEAT_PROMPT_OVERLAY).toContain(
485504"Do not confuse orientation with accomplishment. Brief checking is often useful, but it is only the start of the wake, not the whole point of it.",
486505);
487-expect(OPENAI_FRIENDLY_PROMPT_OVERLAY).toContain(
506+expect(OPENAI_HEARTBEAT_PROMPT_OVERLAY).toContain(
488507"If HEARTBEAT.md gives you concrete work, read it carefully and execute the spirit of what it asks, not just the literal words, using your best judgment.",
489508);
490-expect(OPENAI_FRIENDLY_PROMPT_OVERLAY).toContain(
509+expect(OPENAI_HEARTBEAT_PROMPT_OVERLAY).toContain(
491510"If HEARTBEAT.md mixes monitoring checks with ongoing responsibilities, interpret the list holistically. A quiet check does not by itself satisfy the broader responsibility to keep moving things forward.",
492511);
493-expect(OPENAI_FRIENDLY_PROMPT_OVERLAY).toContain(
512+expect(OPENAI_HEARTBEAT_PROMPT_OVERLAY).toContain(
494513"Quiet monitoring does not satisfy an explicit ongoing-work instruction. If HEARTBEAT.md assigns an active workstream, the wake should usually advance that work, find a real blocker, or get overtaken by something more urgent before it ends quietly.",
495514);
496-expect(OPENAI_FRIENDLY_PROMPT_OVERLAY).toContain(
515+expect(OPENAI_HEARTBEAT_PROMPT_OVERLAY).toContain(
497516"If HEARTBEAT.md explicitly tells you to make progress, treat that as a real requirement for the wake. In that case, do not end the wake after mere checking or orientation unless it surfaced a genuine blocker or a more urgent interruption.",
498517);
499-expect(OPENAI_FRIENDLY_PROMPT_OVERLAY).toContain(
518+expect(OPENAI_HEARTBEAT_PROMPT_OVERLAY).toContain(
500519"Use your judgment and be creative and tasteful with this process. Prefer meaningful action over commentary.",
501520);
502-expect(OPENAI_FRIENDLY_PROMPT_OVERLAY).toContain(
521+expect(OPENAI_HEARTBEAT_PROMPT_OVERLAY).toContain(
503522'A heartbeat is not a status report. Do not send "same state", "no change", "still", or other repetitive summaries just because a problem continues to exist.',
504523);
505-expect(OPENAI_FRIENDLY_PROMPT_OVERLAY).toContain(
524+expect(OPENAI_HEARTBEAT_PROMPT_OVERLAY).toContain(
506525"Notify the user when you have something genuinely worth interrupting them for: a meaningful development, a completed result, a real blocker, a decision they need to make, or a time-sensitive risk.",
507526);
508-expect(OPENAI_FRIENDLY_PROMPT_OVERLAY).toContain(
527+expect(OPENAI_HEARTBEAT_PROMPT_OVERLAY).toContain(
509528"If the current state is materially unchanged and you do not have something genuinely worth surfacing, either do useful work, change your approach, dig deeper, or stay quiet.",
510529);
511-expect(OPENAI_FRIENDLY_PROMPT_OVERLAY).toContain(
530+expect(OPENAI_HEARTBEAT_PROMPT_OVERLAY).toContain(
512531"If there is a clear standing goal or workstream and no stronger interruption, the wake should usually advance it in some concrete way. A good heartbeat often looks like silent progress rather than a visible update.",
513532);
514-expect(OPENAI_FRIENDLY_PROMPT_OVERLAY).toContain(
533+expect(OPENAI_HEARTBEAT_PROMPT_OVERLAY).toContain(
515534"Heartbeats are how the agent goes from a simple reply bot to a truly proactive and magical experience that creates a general sense of awe.",
516535);
517536expect(OPENAI_FRIENDLY_PROMPT_OVERLAY).toContain(
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。