Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions apps/loopover-ui/public/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -14584,6 +14584,25 @@
"recommendation",
"summary"
]
},
"AmsNotificationsAccepted": {
"type": "object",
"properties": {
"login": {
"type": "string"
},
"accepted": {
"type": "number"
},
"enqueued": {
"type": "number"
}
},
"required": [
"login",
"accepted",
"enqueued"
]
}
},
"parameters": {},
Expand Down Expand Up @@ -19004,6 +19023,108 @@
}
]
}
},
"/v1/contributors/{login}/ams-notifications": {
"post": {
"summary": "Enqueue AMS notification events for a contributor",
"parameters": [
{
"schema": {
"type": "string"
},
"required": true,
"name": "login",
"in": "path"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"events": {
"type": "array",
"items": {
"type": "object",
"properties": {
"eventType": {
"type": "string",
"enum": [
"ams_attempt_started",
"ams_attempt_failed",
"ams_governor_paused",
"ams_pr_outcome"
]
},
"repoFullName": {
"type": "string"
},
"pullNumber": {
"type": "integer",
"minimum": 0
},
"dedupKey": {
"type": "string"
},
"deeplink": {
"type": "string"
},
"actorLogin": {
"type": "string"
},
"detectedAt": {
"type": "string"
}
},
"required": [
"eventType",
"repoFullName",
"pullNumber",
"dedupKey",
"deeplink",
"actorLogin",
"detectedAt"
]
},
"minItems": 1,
"maxItems": 20
}
},
"required": [
"events"
]
}
}
}
},
"responses": {
"200": {
"description": "Accepts AMS-relevant notification events (attempt start/fail, governor pause, PR outcome) and evaluates them through the existing notify-evaluate → notify-deliver path (#7657).",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AmsNotificationsAccepted"
}
}
}
},
"400": {
"description": "Invalid AMS notification body"
},
"403": {
"description": "Forbidden when login does not match the authenticated session"
}
},
"security": [
{
"LoopOverBearer": []
},
{
"LoopOverSessionCookie": []
}
]
}
}
},
"servers": [
Expand Down
65 changes: 65 additions & 0 deletions packages/loopover-miner/lib/ams-notifications.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
export type AmsNotificationEventPayload = {
eventType: "ams_attempt_started" | "ams_attempt_failed" | "ams_governor_paused" | "ams_pr_outcome";
recipientLogin: string;
repoFullName: string;
pullNumber: number;
dedupKey: string;
deeplink: string;
actorLogin: string;
detectedAt: string;
};
export type AmsNotificationPublishResult = {
sent: number;
error?: string;
};
export type AmsNotificationFetch = (url: string, init?: {
method?: string;
headers?: Record<string, string>;
body?: string;
signal?: AbortSignal;
}) => Promise<Response>;
export type PublishAmsNotificationEventsOptions = {
env?: Record<string, string | undefined>;
fetchFn?: AmsNotificationFetch;
timeoutMs?: number;
/** Test/self-host inject: mirrors job-dispatch evaluate → notify-deliver without HTTP. */
dispatch?: (events: AmsNotificationEventPayload[]) => Promise<void>;
};
export declare const DEFAULT_AMS_NOTIFICATION_TIMEOUT_MS = 10000;
export declare function buildAmsAttemptStartedPayload(input: {
recipientLogin: string;
repoFullName: string;
issueNumber: number;
attemptId: string;
detectedAt?: string;
}): AmsNotificationEventPayload;
export declare function buildAmsAttemptFailedPayload(input: {
recipientLogin: string;
repoFullName: string;
issueNumber: number;
attemptId: string;
reason?: string | null;
detectedAt?: string;
}): AmsNotificationEventPayload;
export declare function buildAmsGovernorPausedPayload(input: {
recipientLogin: string;
reason?: string | null;
pausedAt?: string;
detectedAt?: string;
}): AmsNotificationEventPayload;
export declare function buildAmsPrOutcomePayload(input: {
recipientLogin: string;
repoFullName: string;
pullNumber: number;
decision: "merged" | "closed";
closedAt?: string | null;
detectedAt?: string;
}): AmsNotificationEventPayload;
/**
* Publish AMS notification events through the hosted evaluate → notify-deliver path. Prefer an injected
* `dispatch` (tests / in-process self-host). Otherwise POST to `/v1/contributors/:login/ams-notifications`
* when a loopover-mcp session is on disk. Never throws.
*/
export declare function publishAmsNotificationEvents(events: AmsNotificationEventPayload[], options?: PublishAmsNotificationEventsOptions): Promise<AmsNotificationPublishResult>;
/** Fire-and-forget wrapper for sync call sites (never awaits into the caller's critical path). */
export declare function scheduleAmsNotificationEvents(events: AmsNotificationEventPayload[], options?: PublishAmsNotificationEventsOptions): void;
146 changes: 146 additions & 0 deletions packages/loopover-miner/lib/ams-notifications.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading