Skip to content

Commit 5d6f618

Browse files
dcramercodex
andcommitted
feat(events): Add install-owned event prompts
Add version-controlled event prompt bindings and the first Slack root-message event producer. Route matching events through core dispatch with idempotency and explicit Slack mention suppression. Also keep the example build test in sync with the dashboard trusted plugin package after rebasing onto main. Refs GH-435 Co-Authored-By: GPT-5 Codex <codex@openai.com>
1 parent 1c4fee4 commit 5d6f618

21 files changed

Lines changed: 2321 additions & 53 deletions

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ Co-Authored-By: (agent model name) <email>
119119
- `specs/context-compaction.md` (reusable Pi history compaction, internal context forks, and visible-thread compaction bounds)
120120
- `specs/advisor-tool.md` (provider-agnostic advisor tool contract)
121121
- `specs/scheduler.md` (scheduled Junior task contract)
122+
- `specs/event-prompts.md` (install-owned event prompt bindings and plugin event definition contract)
122123
- `specs/trusted-plugin-heartbeat.md` (trusted plugin heartbeat and tool hook contract)
123124
- `specs/trusted-plugin-dispatch.md` (durable trusted plugin agent dispatch contract)
124125
- `specs/harness-agent.md` (agent loop and output contract)

packages/junior-plugin-api/src/index.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,43 @@ export interface ToolRegistrationHookContext extends AgentPluginContext {
118118
userText?: string;
119119
}
120120

121+
export interface AgentEventEnvelope {
122+
actor?: {
123+
id?: string;
124+
login?: string;
125+
type?: string;
126+
};
127+
event: string;
128+
occurredAtMs: number;
129+
payload: Record<string, unknown>;
130+
scope: Record<string, unknown>;
131+
sourceEventId: string;
132+
sourceUrl?: string;
133+
}
134+
135+
export interface AgentEventContextBlockRenderContext {
136+
envelope: AgentEventEnvelope;
137+
}
138+
139+
export interface AgentEventContextBlockDefinition {
140+
description: string;
141+
render?(ctx: AgentEventContextBlockRenderContext): Promise<string> | string;
142+
}
143+
144+
export interface AgentEventDeliveryTargetDefinition {
145+
description?: string;
146+
target: string;
147+
}
148+
149+
export interface AgentEventDefinition {
150+
contextBlocks?: Record<string, AgentEventContextBlockDefinition>;
151+
deliveryTargets: AgentEventDeliveryTargetDefinition[];
152+
filterKeys?: string[];
153+
scopeKeys?: string[];
154+
}
155+
156+
export interface EventRegistrationHookContext extends AgentPluginContext {}
157+
121158
export interface DispatchOptions {
122159
credentialSubject?: {
123160
type: "user";
@@ -214,6 +251,9 @@ export interface AgentPluginHooks {
214251
tools?(
215252
ctx: ToolRegistrationHookContext,
216253
): Record<string, AgentPluginToolDefinition>;
254+
events?(
255+
ctx: EventRegistrationHookContext,
256+
): Record<string, AgentEventDefinition>;
217257
heartbeat?(
218258
ctx: HeartbeatHookContext,
219259
): Promise<HeartbeatResult | void> | HeartbeatResult | void;

packages/junior/src/app.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
setAgentPlugins,
1515
validateAgentPlugins,
1616
} from "@/chat/plugins/agent-hooks";
17+
import { loadEventPromptRegistry } from "@/chat/events/registry";
1718
import type { PluginConfig } from "@/chat/plugins/types";
1819
import type {
1920
AgentPluginRouteMethod,
@@ -237,6 +238,7 @@ export async function createApp(options?: JuniorAppOptions): Promise<Hono> {
237238
getPluginCatalogSignature();
238239
}
239240
agentPluginRoutes = getAgentPluginRoutes();
241+
await loadEventPromptRegistry();
240242
} catch (error) {
241243
setPluginConfig(previousPluginConfig);
242244
setAgentPlugins(previousAgentPlugins);

0 commit comments

Comments
 (0)