mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-01 23:43:16 +01:00
Preserve the complete owner patch and all current master behavior. Co-Authored-By: Paperclip <noreply@paperclip.ing>
154 lines
7.2 KiB
TypeScript
154 lines
7.2 KiB
TypeScript
import { signalDatabaseWork, subscribeDatabaseWork } from "@paperclipai/db/work-signals";
|
|
|
|
/** Topics for existing durable queues; register intent before their writes. */
|
|
export const DELIVERY_QUEUES = {
|
|
deferredExecutionReceipts: "deferred-execution-receipts",
|
|
taskRetryReceiptSettlement: "task-retry-receipt-settlement",
|
|
nativeStatusWakeIntents: "native-status-wake-intents",
|
|
orphanBlockers: "orphan-blockers",
|
|
activeRecoveryActions: "active-recovery-actions",
|
|
strandedAssignments: "stranded-assignments",
|
|
resolvedDependencies: "resolved-dependencies",
|
|
taskWatchdogs: "task-watchdogs",
|
|
staleIssueLocks: "stale-issue-locks",
|
|
scheduledRetryDispatch: "scheduled-retry-dispatch",
|
|
queuedRunDispatch: "queued-run-dispatch",
|
|
statusCardEvaluation: "status-card-evaluation",
|
|
runEvidenceMigration: "run-evidence-migration",
|
|
providerTraceRetention: "provider-trace-retention",
|
|
nativeRunnerEvidenceRetention: "native-runner-evidence-retention",
|
|
skillVersionRetention: "skill-version-retention",
|
|
externalObjectRefresh: "external-object-refresh",
|
|
databaseBackups: "database-backups",
|
|
importSpoolCleanup: "import-spool-cleanup",
|
|
externalConversationSettlement: "external-conversation-settlement",
|
|
nativeRecoveryNotices: "native-recovery-notices",
|
|
nativeEnvironmentSettlement: "native-environment-settlement",
|
|
nativeRunProjection: "native-run-projection",
|
|
nativeResultCommit: "native-result-commit",
|
|
nativeWorkspaceFinalization: "native-workspace-finalization",
|
|
retainedNativeSessionCleanup: "retained-native-session-cleanup",
|
|
nativeStatusReassessment: "native-status-reassessment",
|
|
nativeReviewResponse: "native-review-response",
|
|
nativeResponsePresentation: "native-response-presentation",
|
|
nativePendingEffects: "native-pending-effects",
|
|
unsafeWorkspaceExportRecovery: "unsafe-workspace-export-recovery",
|
|
automaticCompletionReviews: "automatic-completion-reviews",
|
|
obsoletePolicyReviews: "obsolete-policy-reviews",
|
|
cancelledWorkspacePreservation: "cancelled-workspace-preservation",
|
|
instructionCollection: "instruction-collection",
|
|
directoryCleanup: "directory-cleanup",
|
|
instructionCommit: "instruction-commit",
|
|
scheduledRetryCancellation: "scheduled-retry-cancellation",
|
|
executionFinalization: "execution-finalization",
|
|
workspaceRecovery: "workspace-recovery",
|
|
executionReplacement: "execution-replacement",
|
|
executionContinuation: "execution-continuation",
|
|
executionStatus: "execution-status",
|
|
executionDisposition: "execution-disposition",
|
|
environmentCleanup: "environment-cleanup",
|
|
approvalQueueSeeding: "approval-queue-seeding",
|
|
attentionRetention: "attention-retention",
|
|
approvalRetention: "approval-retention",
|
|
joinRequestRetention: "join-request-retention",
|
|
decisionTargets: "decision-targets",
|
|
decisionEffectRecovery: "decision-effect-recovery",
|
|
decisionExpiry: "decision-expiry",
|
|
decisionContinuation: "decision-continuation",
|
|
|
|
decisionArchiveDelivery: "decision-archive-delivery",
|
|
toolConnectionHealth: "tool-connection-health",
|
|
toolReviewProjection: "tool-review-projection",
|
|
toolReviewInterruption: "tool-review-interruption",
|
|
toolReviewRecovery: "tool-review-recovery",
|
|
toolReviewExpiry: "tool-review-expiry",
|
|
gatewayCredentialExpiry: "gateway-credential-expiry",
|
|
secretProposalExpiry: "secret-proposal-expiry",
|
|
customImageExpiry: "custom-image-expiry",
|
|
historicalCleanup: "historical-cleanup",
|
|
adapterLoginCleanup: "adapter-login-cleanup",
|
|
setupTokenCleanup: "setup-token-cleanup",
|
|
localLoginCleanup: "local-login-cleanup",
|
|
budgetEnforcement: "budget-enforcement",
|
|
accounting: "cost-accounting",
|
|
taskDrainExpiry: "task-drain-expiry",
|
|
agentLifecycle: "agent-lifecycle",
|
|
chatBoardMessages: "chat-board-messages",
|
|
chatTaskStarts: "chat-task-starts",
|
|
chatReceiptReactions: "chat-receipt-reactions",
|
|
chatSessionStops: "chat-session-stops",
|
|
chatProviderEffects: "chat-provider-effects",
|
|
chatGitHubWebhookRecovery: "chat-github-webhook-recovery",
|
|
chatGitHubIngress: "chat-github-ingress",
|
|
chatGitHubPublications: "chat-github-publications",
|
|
chatGitHubReviewProjection: "chat-github-review-projection",
|
|
chatGitHubReviewChecks: "chat-github-review-checks",
|
|
chatGitHubTerminalResponses: "chat-github-terminal-responses",
|
|
chatGitHubAcknowledgements: "chat-github-acknowledgements",
|
|
chatFailedRunRetries: "chat-failed-run-retries",
|
|
chatTelegramMaintenance: "chat-telegram-maintenance",
|
|
chatReceivers: "chat-receivers",
|
|
voiceSessionRecovery: "voice-session-recovery",
|
|
voiceReports: "voice-call-reports",
|
|
voiceInboundRetention: "voice-inbound-retention",
|
|
voiceInboundCleanup: "voice-inbound-cleanup",
|
|
voiceReplies: "voice-reply-delivery",
|
|
chatTeamsConsentExpiry: "chat-teams-consent-expiry",
|
|
chatTeamsAttemptRecovery: "chat-teams-attempt-recovery",
|
|
chatCommandRegistration: "chat-command-registration",
|
|
chatTelegramSubscriptions: "chat-telegram-subscriptions",
|
|
chatSessionSyncs: "chat-session-syncs",
|
|
chatVerification: "chat-verification",
|
|
chatInbound: "chat-inbound",
|
|
chatPublications: "chat-publications",
|
|
chatNativeProgress: "chat-native-progress",
|
|
chatInboundWakeNotices: "chat-inbound-wake-notices",
|
|
chatInteractionContinuations: "chat-interaction-continuations",
|
|
chatTerminalConfirmations: "chat-terminal-confirmations",
|
|
chatFailedRetryNotices: "chat-failed-retry-notices",
|
|
chatRunMilestones: "chat-run-milestones",
|
|
chatReceipts: "chat-slack-receipts",
|
|
browser: "browser-use",
|
|
email: "email-channels",
|
|
museMaintenance: "muse-maintenance",
|
|
mergedPullRequestConfirmations: "merged-pull-request-confirmations",
|
|
mcpEvents: "mcp-events",
|
|
dotEvents: "dot-events",
|
|
grokDispatch: "grok-dispatch",
|
|
skillSourceSync: "skill-source-sync",
|
|
skillPackages: "skill-packages",
|
|
runtimeAssetRetention: "runtime-asset-retention",
|
|
fastResponse: "fast-responses",
|
|
feedback: "feedback-exports",
|
|
chatCompletion: "chat-completions",
|
|
connection: "connection-continuations",
|
|
connectionEvents: "connection-events",
|
|
connectionContinuity: "connection-continuity",
|
|
gitRestorePoints: "git-restore-points",
|
|
nativeWorkspaceSyncRetention: "native-workspace-sync-retention",
|
|
question: "question-responses",
|
|
pluginSchedules: "plugin-schedules",
|
|
pluginLifecycle: "plugin-resource-lifecycle",
|
|
toolAction: "tool-action-receipts",
|
|
terminalWorkspaces: "terminal-workspaces",
|
|
routineExecutionStatus: "routine-execution-status",
|
|
routineSchedules: "routine-schedules",
|
|
issueMonitors: "issue-monitors",
|
|
agentTimers: "agent-timers",
|
|
caseHandoffs: "case-handoffs",
|
|
nativeHarnessBackupExpiration: "native-harness-backup-expiration",
|
|
nativeCheckpointExpiration: "native-checkpoint-expiration",
|
|
} as const;
|
|
export type DeliveryQueue = typeof DELIVERY_QUEUES[keyof typeof DELIVERY_QUEUES];
|
|
|
|
export async function notifyDeliveryWork(transaction: object, queue: DeliveryQueue, hint?: string): Promise<void> {
|
|
await signalDatabaseWork(transaction, queue, hint);
|
|
}
|
|
// Public delivery notification observers only see settled work. The coordinator
|
|
// uses the lower-level lifecycle subscription to also fence in-flight writes.
|
|
export function subscribeDeliveryWork(owner: object, queue: DeliveryQueue, wake: () => void): () => void {
|
|
return subscribeDatabaseWork(owner, queue, event => {
|
|
if (event === "settled") wake();
|
|
});
|
|
}
|