@sentry/junior 0.250.0 → 0.252.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{admin-DMKyXi83.js → admin-C_-XEdym.js} +1 -1
- package/dist/{agent-hooks-CtZuJPTU.js → agent-hooks-DcoKnnxn.js} +36 -13
- package/dist/{agent-runner-CNiTpIpb.js → agent-runner-B-7S_DCS.js} +357 -99
- package/dist/api/schema.d.ts +46 -32
- package/dist/api/schema.js +2 -2
- package/dist/api.js +50 -65
- package/dist/app.js +52 -81
- package/dist/{assistant-reply-K5r1pcgJ.js → assistant-reply-DbPLvsnL.js} +1 -1
- package/dist/{briefs-8xyS3oeV.js → briefs-D4SMqc-r.js} +4 -4
- package/dist/{catalog-runtime-BQ3g3OX_.js → catalog-runtime-BQQiwwA7.js} +1 -1
- package/dist/cli/chat.js +15 -15
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +3 -3
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client-Q27hki0Y.js → client-ROZeVjq0.js} +2 -2
- package/dist/{config-Cb--Qs-g.js → config-DNNkxfGS.js} +2 -2
- package/dist/{connections-DZ70JeSN.js → connections-DJV6mLrH.js} +9 -9
- package/dist/{conversation-NutPJ8S8.js → conversation-T18Xlkx9.js} +9 -1
- package/dist/{conversation-privacy-BIDN1sW3.js → conversation-privacy-B19umzIL.js} +1 -1
- package/dist/{credential-sync-CyAN-Gos.js → credential-sync-CEd2F5PS.js} +14 -14
- package/dist/{executor-D8y7v95s.js → executor-_4bdoCxe.js} +59 -19
- package/dist/{images-BkGhqKIK.js → images-BAN7DHuO.js} +3 -3
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-uGq6Grnt.js → job-queue-DSQx1qFY.js} +1 -1
- package/dist/{logging-C22RdmU8.js → logging-COUsTFIL.js} +1 -1
- package/dist/{message-D0RPetp-.js → message-CtDDEwwV.js} +3 -3
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-DF_Odkvh.js → oauth-callback-server-CCiKrS0s.js} +2 -2
- package/dist/{pending-auth-Bg3A1-pE.js → pending-auth-DDx3EU4M.js} +2 -2
- package/dist/{profile-DK9umvav.js → profile-DP4LKL6V.js} +4 -4
- package/dist/{prompt-kYP1FAX_.js → prompt-C04mP1hu.js} +1 -1
- package/dist/{registry-BvsLuoLK.js → registry-CeEpPna6.js} +1 -1
- package/dist/{resolve-C9btOXju.js → resolve-B5ma3igH.js} +2 -2
- package/dist/{result-CcdQ2iau.js → result-Da0RVuWG.js} +7 -7
- package/dist/{runner-Bem4DUHN.js → runner-se1W_jGZ.js} +10 -10
- package/dist/{sandbox-egress-signals-Bl-4cF7E.js → sandbox-egress-signals-CS959-wm.js} +1 -1
- package/dist/{schema-DELmAdjR.js → schema-C9Vnyb_f.js} +1 -1
- package/dist/{session-stop-DteRDRCi.js → session-stop-DlRDisF5.js} +11 -11
- package/dist/{skills-CVwSL6Gc.js → skills-CSzgs0EC.js} +2 -2
- package/dist/{spawn-CA0YYtzr.js → spawn-DT9fMjtd.js} +2 -2
- package/dist/{store-Dw3eBN9S.js → store-Dx1U69mm.js} +6 -6
- package/dist/{task-queue-C7cyjcVj.js → task-queue-BX9YrIsw.js} +3 -3
- package/dist/{task-runner-BbSyWmOq.js → task-runner-CO55Olal.js} +46 -13
- package/dist/{tasks-B8nH3ND_.js → tasks-DwGlFX9i.js} +166 -212
- package/dist/{thread-state-BTOLzCM-.js → thread-state-Ces6tXmB.js} +6 -6
- package/dist/{turn-failure-response-BwNfO8Xt.js → turn-failure-response-B4VCvEQf.js} +8 -8
- package/dist/{turn-lifecycle-DSN0xGW7.js → turn-lifecycle-B1VV58Yo.js} +1 -1
- package/dist/{turn-session-routing-BRKYIn6n.js → turn-session-routing-Dw2Kamg9.js} +1 -1
- package/dist/{validation-CBkyzKCP.js → validation-yJF9LKOv.js} +1 -1
- package/dist/{version-CkwwLVLb.js → version-CZYqvIFh.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-DdzigZQh.js → viewer-D96vo_42.js} +3 -3
- package/dist/{web-input-BjdnnpuN.js → web-input-5mls-41-.js} +105 -104
- package/dist/{work-qQEjtmlv.js → work-D2M2-zCO.js} +9 -9
- package/dist/{worker-C-CSZMy_.js → worker-BwCpf8tB.js} +5 -5
- package/migrations/0055_automations.sql +125 -0
- package/migrations/meta/0055_snapshot.json +3948 -0
- package/migrations/meta/_journal.json +8 -1
- package/package.json +5 -5
package/dist/app.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { B as effectiveTaskOutcomes, Ct as
|
|
2
|
-
import { C as withLogContext, O as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, S as withContext, d as logException, f as logInfo, j as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, p as logWarn, r as createRequestContext, v as setSpanAttributes, w as withSpan, y as setSpanStatus } from "./logging-
|
|
1
|
+
import { At as consumeSandboxEgressPermissionDeniedSignal, B as effectiveTaskOutcomes, Ct as ingestEvent, Dt as SANDBOX_EGRESS_PROXY_PATH, E as requestAttachmentDeletion, Et as shouldPropagateSandboxEgressTrace, F as logScheduledAutomationRunSkipped, I as scheduledAutomationRunAttributes, It as startOAuthFlow, Kt as getConfigDefaults, Lt as createUserTokenStore, Nt as formatProviderLabel, O as parseSlackThreadId, Ot as clearSandboxEgressSignals, St as processWorkspaceSnapshotJob, Tt as normalizeSandboxEgressTracePropagationDomains, U as stopConversationSession, W as recordSubagentEnded, b as unpublishedArtifactHeaders, i as executeCredentialedEgressRequest, jt as parseSandboxEgressCredentialToken, kt as consumeSandboxEgressAuthRequiredSignal, lt as listPendingAgentInvocationMailboxAppends, n as executeAgentRun, qt as setConfigDefaults, t as createAgentRunner, ut as listPendingAgentInvocationResults, v as publicArtifactHeaders, w as collectAttachmentGarbage, wt as resolveSandboxEgressProviderForHost, x as lookupSlackUserProfile, y as readPublicArtifact } from "./agent-runner-B-7S_DCS.js";
|
|
2
|
+
import { C as withLogContext, O as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, S as withContext, d as logException, f as logInfo, j as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, p as logWarn, r as createRequestContext, v as setSpanAttributes, w as withSpan, y as setSpanStatus } from "./logging-COUsTFIL.js";
|
|
3
3
|
import { n as captureMessage, r as continueTrace } from "./sentry-CgWZM_kV.js";
|
|
4
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
5
|
-
import { _ as snapshotRuntimeConfig, d as restoreRuntimeConfig, f as setBotModelConfig, g as setSlackReactionConfig, h as setRuntimeLimits, i as getChatConfig, m as setProfiles, n as botConfig, o as getSlackBotToken, p as setCrossActorMidRunMode, u as resetRuntimeConfig } from "./config-
|
|
4
|
+
import { t as JUNIOR_VERSION } from "./version-CZYqvIFh.js";
|
|
5
|
+
import { _ as snapshotRuntimeConfig, d as restoreRuntimeConfig, f as setBotModelConfig, g as setSlackReactionConfig, h as setRuntimeLimits, i as getChatConfig, m as setProfiles, n as botConfig, o as getSlackBotToken, p as setCrossActorMidRunMode, u as resetRuntimeConfig } from "./config-DNNkxfGS.js";
|
|
6
6
|
import { _ as slackMessageTsSchema, d as parseSlackTeamId, f as parseSlackUserId, h as slackUserIdSchema, m as slackTeamIdSchema, o as parseActorUserId, p as slackChannelIdSchema } from "./actor-BTtLaeWy.js";
|
|
7
|
-
import { c as getConversationEventStore, d as getDb, f as getSqlExecutor, g as withConversationMutationLock, m as withConversationEventLock, r as readActorIdentity, u as getConversationStore } from "./viewer-
|
|
7
|
+
import { c as getConversationEventStore, d as getDb, f as getSqlExecutor, g as withConversationMutationLock, m as withConversationEventLock, r as readActorIdentity, u as getConversationStore } from "./viewer-D96vo_42.js";
|
|
8
8
|
import { a as juniorAgentInvocations, d as juniorDestinations, i as juniorAgentBindings, s as juniorConversations } from "./agent-invocations-D_YoNnAn.js";
|
|
9
|
-
import {
|
|
10
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
11
|
-
import { C as eventAutomationRunLimitReason, F as slackMention, G as slackExternalRefIdSchema, S as admitEventAutomationRun, W as slackEntitySchema, Wt as appendConversationMessages, Xt as settleConversationTitleWork, a as readScheduledAutomation, c as scheduledRunId, d as collectEventAutomationMatchKeys, h as findMatchingEventAutomations, l as withScheduledAutomationLock, n as listScheduledAutomations, qt as projectConversationMessages, r as listScheduledAutomationsForTeam, s as saveScheduledAutomationInLock, u as blockEventAutomation } from "./tasks-
|
|
12
|
-
import { $ as
|
|
13
|
-
import { W as annotationCard } from "./conversation-
|
|
14
|
-
import { O as withLock$1, w as getStateAdapter } from "./profile-
|
|
15
|
-
import { c as getThreadStopDecision } from "./pending-auth-
|
|
16
|
-
import { O as renderTaskInput, f as slackChannelMessageEvent, l as getEventCatalog, p as slackChannelMessageReplyThreadTs, u as SLACK_EVENT_NAMESPACE, y as eventGuidance } from "./session-stop-
|
|
9
|
+
import { a as juniorSchedulerRuns, g as juniorConversationEvents, p as juniorConversationBriefs, s as juniorAutomations } from "./executor-_4bdoCxe.js";
|
|
10
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BQQiwwA7.js";
|
|
11
|
+
import { C as eventAutomationRunLimitReason, F as slackMention, G as slackExternalRefIdSchema, S as admitEventAutomationRun, W as slackEntitySchema, Wt as appendConversationMessages, Xt as settleConversationTitleWork, a as readScheduledAutomation, c as scheduledRunId, d as collectEventAutomationMatchKeys, h as findMatchingEventAutomations, l as withScheduledAutomationLock, n as listScheduledAutomations, qt as projectConversationMessages, r as listScheduledAutomationsForTeam, s as saveScheduledAutomationInLock, u as blockEventAutomation } from "./tasks-DwGlFX9i.js";
|
|
12
|
+
import { $ as bindSlackDirectCredentialSubject, At as resolveRootVisibility, Ht as getSlackClient, Jt as getWorkspaceTeamId, Nt as listConversationAnnotations, Q as bindScheduledAutomationCredentialSubject, U as collectEventMatchKeys, Wt as isDmChannel, X as takeDueTimerWatches, Yt as runWithWorkspaceTeamId, Z as bindEventAutomationCredentialSubject, a as getPluginRoutes, at as getDashboardConversationLink, ct as setDashboardConversationLinkOptions, d as setPlugins, et as verifyEventAutomationCredentialSubject, f as validatePlugins, ft as createPluginLogger, h as setBriefsConfig, i as getPluginApiRoutes, lt as createPluginState, nt as verifySlackDirectCredentialSubject, pt as readConversationAccessFromSql, q as findMatchingWatches, st as getDashboardTaskLink, tt as verifyScheduledAutomationCredentialSubject, u as getPlugins } from "./agent-hooks-DcoKnnxn.js";
|
|
13
|
+
import { W as annotationCard } from "./conversation-T18Xlkx9.js";
|
|
14
|
+
import { O as withLock$1, w as getStateAdapter } from "./profile-DP4LKL6V.js";
|
|
15
|
+
import { c as getThreadStopDecision } from "./pending-auth-DDx3EU4M.js";
|
|
16
|
+
import { O as renderTaskInput, f as slackChannelMessageEvent, l as getEventCatalog, p as slackChannelMessageReplyThreadTs, u as SLACK_EVENT_NAMESPACE, y as eventGuidance } from "./session-stop-DlRDisF5.js";
|
|
17
17
|
import { n as getNextRunAtMs } from "./cadence-D00SCzT1.js";
|
|
18
|
-
import { f as setSandboxResourceConfig, u as getSandboxResourceConfig } from "./resolve-
|
|
19
|
-
import { a as getVercelConversationWorkQueue, g as isConversationQueueMessageRejectedError, h as conversationQueueMessageSchema, i as verifyWorkspaceSnapshotJobMessage, o as resolveConversationWorkQueueTopic, s as verifyConversationQueueMessage, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-
|
|
20
|
-
import { A as hasRunnableConversationWork$1, M as isInvalidConversationRecordError, O as CONVERSATION_WORK_STALE_ENQUEUE_MS, S as removeActiveConversation, _ as hasRunnableConversationWork, c as clearExpiredConversationLease, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, v as listActiveConversationIds } from "./store-
|
|
18
|
+
import { f as setSandboxResourceConfig, u as getSandboxResourceConfig } from "./resolve-B5ma3igH.js";
|
|
19
|
+
import { a as getVercelConversationWorkQueue, g as isConversationQueueMessageRejectedError, h as conversationQueueMessageSchema, i as verifyWorkspaceSnapshotJobMessage, o as resolveConversationWorkQueueTopic, s as verifyConversationQueueMessage, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-DSQx1qFY.js";
|
|
20
|
+
import { A as hasRunnableConversationWork$1, M as isInvalidConversationRecordError, O as CONVERSATION_WORK_STALE_ENQUEUE_MS, S as removeActiveConversation, _ as hasRunnableConversationWork, c as clearExpiredConversationLease, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, v as listActiveConversationIds } from "./store-Dx1U69mm.js";
|
|
21
21
|
import { D as scheduledRunSchema } from "./automation-gznOMaQ2.js";
|
|
22
22
|
import { i as setExperimentalFeatures, n as getExperimentalFeatures, r as isExperimentalFeatureEnabled } from "./experimental-Qn9rKLgx.js";
|
|
23
|
-
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-
|
|
23
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-yJF9LKOv.js";
|
|
24
24
|
import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-egKWjgue.js";
|
|
25
|
-
import { A as withNormalizedThreadId, C as buildSlackInboundMessage, D as isSlackMessageStopped, E as verifySlackSignature, F as renderSlackObjectCard, I as createVercelAttachmentStorage, M as THREAD_OPTOUT_ACK, N as startProcessingReaction, O as stopSlackThread, P as parseContent, R as enqueueAgentDispatch, S as recordSkippedConversationMessage, T as runWithSlackInstallation, a as recordWebConversationActivity, c as createProductionSlackWebhookServices, f as createSlackWebApiStatusSender, j as stopConversationTurn, k as normalizeIncomingSlackThreadId, l as getProductionSlackAdapter, n as conversationTurnIdForMessage, o as webActorFromEmail, s as createProductionConversationWorkOptions, t as appendAndEnqueueWebMessage, v as readViewerAutomationSummary, w as clearSlackPendingReactions, z as GET$3 } from "./web-input-
|
|
26
|
-
import {
|
|
27
|
-
import { o as getAuthPausedConversationTurnId, t as enqueueAgentInvocationResult } from "./result-
|
|
28
|
-
import { r as enqueueAgentInvocation } from "./work-
|
|
29
|
-
import { s as coerceThreadConversationState } from "./thread-state-
|
|
30
|
-
import { o as unlinkProvider } from "./connections-
|
|
31
|
-
import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-
|
|
32
|
-
import { a as registerVercelPluginTaskDevConsumer, n as createVercelPluginTaskCallback, s as queueCallback } from "./task-queue-
|
|
33
|
-
import { t as processConversationWork } from "./worker-
|
|
34
|
-
import { t as bindMessageAgent } from "./message-
|
|
35
|
-
import { t as bindSpawnAgent } from "./spawn-
|
|
25
|
+
import { A as withNormalizedThreadId, C as buildSlackInboundMessage, D as isSlackMessageStopped, E as verifySlackSignature, F as renderSlackObjectCard, I as createVercelAttachmentStorage, M as THREAD_OPTOUT_ACK, N as startProcessingReaction, O as stopSlackThread, P as parseContent, R as enqueueAgentDispatch, S as recordSkippedConversationMessage, T as runWithSlackInstallation, a as recordWebConversationActivity, c as createProductionSlackWebhookServices, f as createSlackWebApiStatusSender, j as stopConversationTurn, k as normalizeIncomingSlackThreadId, l as getProductionSlackAdapter, n as conversationTurnIdForMessage, o as webActorFromEmail, s as createProductionConversationWorkOptions, t as appendAndEnqueueWebMessage, v as readViewerAutomationSummary, w as clearSlackPendingReactions, z as GET$3 } from "./web-input-5mls-41-.js";
|
|
26
|
+
import { a as confirmDispatchMailboxAppend, b as notifyAutomationBlocked, f as getPluginDispatchProjection, j as recordAutomationExecution, m as listPendingDispatchMailboxAppends, o as createOrGetDispatch, p as isTerminalDispatchStatus, s as getDispatchConversationId, t as processPluginTask, u as getDispatchRecord, v as markDispatchFailed } from "./task-runner-CO55Olal.js";
|
|
27
|
+
import { o as getAuthPausedConversationTurnId, t as enqueueAgentInvocationResult } from "./result-Da0RVuWG.js";
|
|
28
|
+
import { r as enqueueAgentInvocation } from "./work-D2M2-zCO.js";
|
|
29
|
+
import { s as coerceThreadConversationState } from "./thread-state-Ces6tXmB.js";
|
|
30
|
+
import { o as unlinkProvider } from "./connections-DJV6mLrH.js";
|
|
31
|
+
import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-CEd2F5PS.js";
|
|
32
|
+
import { a as registerVercelPluginTaskDevConsumer, n as createVercelPluginTaskCallback, s as queueCallback } from "./task-queue-BX9YrIsw.js";
|
|
33
|
+
import { t as processConversationWork } from "./worker-BwCpf8tB.js";
|
|
34
|
+
import { t as bindMessageAgent } from "./message-CtDDEwwV.js";
|
|
35
|
+
import { t as bindSpawnAgent } from "./spawn-DT9fMjtd.js";
|
|
36
36
|
import { createRequire } from "node:module";
|
|
37
37
|
import { Hono } from "hono";
|
|
38
38
|
import { z } from "zod";
|
|
@@ -343,6 +343,16 @@ async function getScheduledAutomationDispatch(id) {
|
|
|
343
343
|
});
|
|
344
344
|
}
|
|
345
345
|
//#endregion
|
|
346
|
+
//#region src/chat/automations/reply-attribution.ts
|
|
347
|
+
/** Name the Automation in the footer of the replies that its runs post. */
|
|
348
|
+
function automationReplyAttribution(title) {
|
|
349
|
+
const detail = (title ?? "").replace(/\s+/g, " ").trim().slice(0, 128).trim();
|
|
350
|
+
return detail ? {
|
|
351
|
+
label: "Automation",
|
|
352
|
+
detail
|
|
353
|
+
} : { label: "Automation" };
|
|
354
|
+
}
|
|
355
|
+
//#endregion
|
|
346
356
|
//#region src/chat/scheduled-automations/runs.ts
|
|
347
357
|
const PENDING_CLAIM_STALE_MS = 6e4;
|
|
348
358
|
const MISSED_RUN_MAX_AGE_MS = 864e5;
|
|
@@ -472,7 +482,7 @@ async function claimDueScheduledRun(db, args) {
|
|
|
472
482
|
const skippedRuns = [];
|
|
473
483
|
const claimed = await db.transaction(async (tx) => {
|
|
474
484
|
await tx.execute(sql`SELECT pg_advisory_xact_lock(hashtext('junior:scheduler:claim'))`);
|
|
475
|
-
const rows = await tx.select({ id:
|
|
485
|
+
const rows = await tx.select({ id: juniorAutomations.id }).from(juniorAutomations).where(and(eq(juniorAutomations.kind, "scheduled"), eq(juniorAutomations.status, "active"), or(and(isNotNull(juniorAutomations.runNowAtMs), lte(juniorAutomations.runNowAtMs, args.nowMs)), and(isNotNull(juniorAutomations.nextRunAtMs), lte(juniorAutomations.nextRunAtMs, args.nowMs))))).orderBy(asc(juniorAutomations.createdAtMs), asc(juniorAutomations.id));
|
|
476
486
|
for (const row of rows) {
|
|
477
487
|
const run = await withScheduledAutomationLock(tx, row.id, async (taskTx) => {
|
|
478
488
|
const task = await readScheduledAutomation(taskTx, row.id);
|
|
@@ -493,7 +503,16 @@ async function claimDueScheduledRun(db, args) {
|
|
|
493
503
|
await writeRun(taskTx, reclaimed);
|
|
494
504
|
return reclaimed;
|
|
495
505
|
}
|
|
496
|
-
|
|
506
|
+
const finishedRun = await readRun(taskTx, runId);
|
|
507
|
+
if (finishedRun) {
|
|
508
|
+
if (finishedRun.status === "blocked" || finishedRun.status === "completed" || finishedRun.status === "failed") await advanceScheduledAutomationAfterRun(taskTx, {
|
|
509
|
+
errorMessage: finishedRun.errorMessage,
|
|
510
|
+
nowMs: args.nowMs,
|
|
511
|
+
run: finishedRun,
|
|
512
|
+
status: finishedRun.status
|
|
513
|
+
});
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
497
516
|
if (scheduledForMs + MISSED_RUN_MAX_AGE_MS < args.nowMs) {
|
|
498
517
|
const skipped = await skipMissedRun(taskTx, {
|
|
499
518
|
nowMs: args.nowMs,
|
|
@@ -643,24 +662,6 @@ async function advanceScheduledAutomationAfterRun(db, args) {
|
|
|
643
662
|
//#endregion
|
|
644
663
|
//#region src/chat/scheduled-automations/heartbeat.ts
|
|
645
664
|
const SCHEDULED_AUTOMATION_HEARTBEAT_LIMIT = 10;
|
|
646
|
-
const SCHEDULE_FREQUENCY_COPY = {
|
|
647
|
-
daily: {
|
|
648
|
-
label: "Daily",
|
|
649
|
-
unit: "day"
|
|
650
|
-
},
|
|
651
|
-
weekly: {
|
|
652
|
-
label: "Weekly",
|
|
653
|
-
unit: "week"
|
|
654
|
-
},
|
|
655
|
-
monthly: {
|
|
656
|
-
label: "Monthly",
|
|
657
|
-
unit: "month"
|
|
658
|
-
},
|
|
659
|
-
yearly: {
|
|
660
|
-
label: "Yearly",
|
|
661
|
-
unit: "year"
|
|
662
|
-
}
|
|
663
|
-
};
|
|
664
665
|
function singleLineMetadataValue(value) {
|
|
665
666
|
return value.replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").trim();
|
|
666
667
|
}
|
|
@@ -689,25 +690,6 @@ function buildDispatchMetadata(args) {
|
|
|
689
690
|
} : void 0
|
|
690
691
|
};
|
|
691
692
|
}
|
|
692
|
-
function replyAttribution$1(task) {
|
|
693
|
-
if (task.schedule.kind === "one_off") return {
|
|
694
|
-
label: "Scheduled automation",
|
|
695
|
-
detail: "One-time"
|
|
696
|
-
};
|
|
697
|
-
const recurrence = task.schedule.recurrence;
|
|
698
|
-
if (!recurrence) return {
|
|
699
|
-
label: "Scheduled automation",
|
|
700
|
-
detail: "Recurring"
|
|
701
|
-
};
|
|
702
|
-
const frequency = SCHEDULE_FREQUENCY_COPY[recurrence.frequency];
|
|
703
|
-
return recurrence.interval === 1 ? {
|
|
704
|
-
label: "Scheduled automation",
|
|
705
|
-
detail: frequency.label
|
|
706
|
-
} : {
|
|
707
|
-
label: "Scheduled automation",
|
|
708
|
-
detail: `Every ${recurrence.interval} ${frequency.unit}s`
|
|
709
|
-
};
|
|
710
|
-
}
|
|
711
693
|
function shouldSkipRun(task, run) {
|
|
712
694
|
if (task.status === "deleted") return `Scheduled automation ${task.id} was deleted before the run started.`;
|
|
713
695
|
if (task.status !== "active") return `Scheduled automation ${task.id} was ${task.status} before the run started.`;
|
|
@@ -948,7 +930,7 @@ async function runScheduledAutomationHeartbeat(args) {
|
|
|
948
930
|
destinationVisibility: task.conversationAccess.visibility,
|
|
949
931
|
input: buildDispatchInput(task),
|
|
950
932
|
metadata,
|
|
951
|
-
replyAttribution:
|
|
933
|
+
replyAttribution: automationReplyAttribution(task.title),
|
|
952
934
|
outcomes: effectiveTaskOutcomes(task.outcomes, task.destination)
|
|
953
935
|
}
|
|
954
936
|
});
|
|
@@ -2016,17 +1998,6 @@ function textMentionsBot(text, botUserId) {
|
|
|
2016
1998
|
function eventAutomationDispatchKey(taskId, namespace, eventKey) {
|
|
2017
1999
|
return `event-automation:${createHash("sha256").update(`${taskId}\0${namespace}\0${eventKey}`).digest("hex").slice(0, 32)}`;
|
|
2018
2000
|
}
|
|
2019
|
-
function oneLine(value) {
|
|
2020
|
-
return value.replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").trim().slice(0, 512);
|
|
2021
|
-
}
|
|
2022
|
-
/** Compact destination-visible context for event-automation replies. */
|
|
2023
|
-
function replyAttribution(task) {
|
|
2024
|
-
const detail = oneLine(task.trigger.label).slice(0, 128).trim();
|
|
2025
|
-
return detail ? {
|
|
2026
|
-
label: "Event automation",
|
|
2027
|
-
detail
|
|
2028
|
-
} : { label: "Event automation" };
|
|
2029
|
-
}
|
|
2030
2001
|
/** Render plain agent input for one matching event automation. */
|
|
2031
2002
|
function eventInput(task, event, outcomes) {
|
|
2032
2003
|
const guidance = eventGuidance(getEventCatalog(), event.namespace, task.trigger.resourceType, event.eventType);
|
|
@@ -2108,7 +2079,7 @@ async function ingestEventAutomations(input, options) {
|
|
|
2108
2079
|
destinationVisibility: task.destinationVisibility,
|
|
2109
2080
|
input: eventInput(task, event, outcomes),
|
|
2110
2081
|
metadata: { eventAutomationId: task.id },
|
|
2111
|
-
replyAttribution:
|
|
2082
|
+
replyAttribution: automationReplyAttribution(task.title),
|
|
2112
2083
|
outcomes
|
|
2113
2084
|
}
|
|
2114
2085
|
})).status === "created") dispatched += 1;
|
|
@@ -2308,7 +2279,7 @@ function renderAutomationDetails(automation) {
|
|
|
2308
2279
|
entity_payload: {
|
|
2309
2280
|
attributes: {
|
|
2310
2281
|
title: { text: automation.title },
|
|
2311
|
-
display_type:
|
|
2282
|
+
display_type: "Automation"
|
|
2312
2283
|
},
|
|
2313
2284
|
custom_fields: fields
|
|
2314
2285
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as completeObject } from "./client-
|
|
1
|
+
import { r as completeObject } from "./client-ROZeVjq0.js";
|
|
2
2
|
import { r as defaultModelId } from "./model-profile-BwU8mqwD.js";
|
|
3
|
-
import { U as parseBriefInput, d as conversationDetailReportSchema, p as conversationEventPageSchema, z as briefCodeChangeSchema } from "./conversation-
|
|
4
|
-
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-
|
|
3
|
+
import { U as parseBriefInput, d as conversationDetailReportSchema, p as conversationEventPageSchema, z as briefCodeChangeSchema } from "./conversation-T18Xlkx9.js";
|
|
4
|
+
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-C04mP1hu.js";
|
|
5
5
|
import { CLI_USAGE } from "./cli/run.js";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { z } from "zod";
|
|
@@ -269,7 +269,7 @@ async function parseRunOptions(argv) {
|
|
|
269
269
|
* `DATABASE_URL` at import, and `briefs pull` must work with only a token.
|
|
270
270
|
*/
|
|
271
271
|
async function configuredDefaultModelId() {
|
|
272
|
-
const { botConfig } = await import("./config-
|
|
272
|
+
const { botConfig } = await import("./config-DNNkxfGS.js").then((n) => n.r);
|
|
273
273
|
return defaultModelId(botConfig);
|
|
274
274
|
}
|
|
275
275
|
function apiUrl(baseUrl, pathname) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import { t as createPluginCatalogRuntime } from "./registry-
|
|
2
|
+
import { t as createPluginCatalogRuntime } from "./registry-CeEpPna6.js";
|
|
3
3
|
//#region src/chat/plugins/catalog-runtime.ts
|
|
4
4
|
var catalog_runtime_exports = /* @__PURE__ */ __exportAll({ pluginCatalogRuntime: () => pluginCatalogRuntime });
|
|
5
5
|
const pluginCatalogRuntime = createPluginCatalogRuntime();
|
package/dist/cli/chat.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-
|
|
1
|
+
import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-B-7S_DCS.js";
|
|
2
2
|
import { t as loadAppPluginSet } from "../plugin-module-CVvEUSMH.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -100,10 +100,10 @@ async function loadLocalPluginSet() {
|
|
|
100
100
|
async function configureLocalChatPlugins(pluginSet) {
|
|
101
101
|
const [pluginsModule, agentHooksModule, catalogRuntimeModule, validationModule, databaseModule] = await Promise.all([
|
|
102
102
|
import("../plugins-egKWjgue.js").then((n) => n.o),
|
|
103
|
-
import("../agent-hooks-
|
|
104
|
-
import("../catalog-runtime-
|
|
105
|
-
import("../validation-
|
|
106
|
-
import("../viewer-
|
|
103
|
+
import("../agent-hooks-DcoKnnxn.js").then((n) => n.t),
|
|
104
|
+
import("../catalog-runtime-BQQiwwA7.js").then((n) => n.t),
|
|
105
|
+
import("../validation-yJF9LKOv.js").then((n) => n.r),
|
|
106
|
+
import("../viewer-D96vo_42.js").then((n) => n.s)
|
|
107
107
|
]);
|
|
108
108
|
const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
|
|
109
109
|
const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
|
|
@@ -155,19 +155,19 @@ async function prepareLocalChatRun(io, pluginSet) {
|
|
|
155
155
|
await configureLocalChatPlugins(pluginSet);
|
|
156
156
|
const { setExperimentalFeatures } = await import("../experimental-Qn9rKLgx.js").then((n) => n.t);
|
|
157
157
|
setExperimentalFeatures({ subagents: true });
|
|
158
|
-
const { setBriefsConfig } = await import("../agent-hooks-
|
|
158
|
+
const { setBriefsConfig } = await import("../agent-hooks-DcoKnnxn.js").then((n) => n.m);
|
|
159
159
|
setBriefsConfig({ enabled: true });
|
|
160
|
-
const { runLocalAgentTurn } = await import("../runner-
|
|
161
|
-
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-
|
|
160
|
+
const { runLocalAgentTurn } = await import("../runner-se1W_jGZ.js");
|
|
161
|
+
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-CCiKrS0s.js");
|
|
162
162
|
const { createLocalOAuthState } = await import("../oauth-relay-CdCnu80W.js").then((n) => n.t);
|
|
163
|
-
const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-
|
|
164
|
-
const { bindSpawnAgent } = await import("../spawn-
|
|
165
|
-
const { bindMessageAgent } = await import("../message-
|
|
166
|
-
const { createAgentInvocationWorker, routeAgentInvocationWork } = await import("../work-
|
|
167
|
-
const { startAgentInvocationsForChildInput } = await import("../result-
|
|
168
|
-
const { skipInputBeforeConversationStop } = await import("../session-stop-
|
|
163
|
+
const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-CS959-wm.js");
|
|
164
|
+
const { bindSpawnAgent } = await import("../spawn-DT9fMjtd.js").then((n) => n.n);
|
|
165
|
+
const { bindMessageAgent } = await import("../message-CtDDEwwV.js").then((n) => n.n);
|
|
166
|
+
const { createAgentInvocationWorker, routeAgentInvocationWork } = await import("../work-D2M2-zCO.js").then((n) => n.a);
|
|
167
|
+
const { startAgentInvocationsForChildInput } = await import("../result-Da0RVuWG.js").then((n) => n.r);
|
|
168
|
+
const { skipInputBeforeConversationStop } = await import("../session-stop-DlRDisF5.js").then((n) => n.r);
|
|
169
169
|
const { createLocalConversationWork } = await import("../conversation-work-C6y3T5Hx.js");
|
|
170
|
-
const { processConversationWork } = await import("../worker-
|
|
170
|
+
const { processConversationWork } = await import("../worker-BwCpf8tB.js").then((n) => n.n);
|
|
171
171
|
let agentRunner;
|
|
172
172
|
const localConversationWork = createLocalConversationWork(async (message) => {
|
|
173
173
|
if (!agentRunner) throw new Error("Local agent runner is not ready");
|
package/dist/cli/check.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as JUNIOR_HEARTBEAT_ROUTE, M as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, T as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-
|
|
2
|
-
import { _ as parsePluginManifest, g as parseInlinePluginManifest } from "../registry-
|
|
3
|
-
import { i as parseSkillFile } from "../skills-
|
|
1
|
+
import { D as JUNIOR_HEARTBEAT_ROUTE, M as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, T as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-COUsTFIL.js";
|
|
2
|
+
import { _ as parsePluginManifest, g as parseInlinePluginManifest } from "../registry-CeEpPna6.js";
|
|
3
|
+
import { i as parseSkillFile } from "../skills-CSzgs0EC.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import fs from "node:fs/promises";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
package/dist/cli/main.js
CHANGED
|
@@ -25,10 +25,10 @@ async function runChat(argv, pluginSet) {
|
|
|
25
25
|
return await (await import("./chat.js")).runChat(argv, void 0, { pluginSet });
|
|
26
26
|
}
|
|
27
27
|
async function runAdmin(argv) {
|
|
28
|
-
return await (await import("../admin-
|
|
28
|
+
return await (await import("../admin-C_-XEdym.js")).runAdmin(argv);
|
|
29
29
|
}
|
|
30
30
|
async function runBriefs(argv) {
|
|
31
|
-
return await (await import("../briefs-
|
|
31
|
+
return await (await import("../briefs-D4SMqc-r.js")).runBriefs(argv);
|
|
32
32
|
}
|
|
33
33
|
function topLevelCommand(argv) {
|
|
34
34
|
return (argv[0] === "--" ? argv.slice(1) : argv)[0];
|
package/dist/cli/plugins.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { d as getDb } from "../viewer-
|
|
2
|
-
import { n as pluginCatalogRuntime } from "../catalog-runtime-
|
|
3
|
-
import { d as setPlugins,
|
|
4
|
-
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-
|
|
1
|
+
import { d as getDb } from "../viewer-D96vo_42.js";
|
|
2
|
+
import { n as pluginCatalogRuntime } from "../catalog-runtime-BQQiwwA7.js";
|
|
3
|
+
import { d as setPlugins, f as validatePlugins, ft as createPluginLogger } from "../agent-hooks-DcoKnnxn.js";
|
|
4
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-yJF9LKOv.js";
|
|
5
5
|
import { a as pluginRuntimeRegistrationsFromPluginSet, i as pluginCliRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "../plugins-egKWjgue.js";
|
|
6
6
|
import { t as loadAppPluginSet } from "../plugin-module-CVvEUSMH.js";
|
|
7
7
|
import { stderr, stdout } from "node:process";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as pluginCatalogRuntime } from "../catalog-runtime-
|
|
2
|
-
import { S as disconnectStateAdapter, t as create } from "../profile-
|
|
3
|
-
import { r as resolve } from "../resolve-
|
|
1
|
+
import { n as pluginCatalogRuntime } from "../catalog-runtime-BQQiwwA7.js";
|
|
2
|
+
import { S as disconnectStateAdapter, t as create } from "../profile-DP4LKL6V.js";
|
|
3
|
+
import { r as resolve } from "../resolve-B5ma3igH.js";
|
|
4
4
|
//#region src/cli/snapshot-create.ts
|
|
5
5
|
const DEFAULT_RUNTIME = "node22";
|
|
6
6
|
const DEFAULT_TIMEOUT_MS = 6e5;
|
package/dist/cli/upgrade.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as getChatConfig } from "../config-
|
|
2
|
-
import { t as createJuniorSqlExecutor } from "../executor-
|
|
3
|
-
import { t as createPluginCatalogRuntime } from "../registry-
|
|
1
|
+
import { i as getChatConfig } from "../config-DNNkxfGS.js";
|
|
2
|
+
import { t as createJuniorSqlExecutor } from "../executor-_4bdoCxe.js";
|
|
3
|
+
import { t as createPluginCatalogRuntime } from "../registry-CeEpPna6.js";
|
|
4
4
|
import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-egKWjgue.js";
|
|
5
5
|
import { t as loadAppPluginSet } from "../plugin-module-CVvEUSMH.js";
|
|
6
6
|
import { basename, dirname, join, resolve } from "node:path";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as logException, g as serializeGenAiAttribute, i as extractGenAiUsageAttributes, m as normalizeGenAiFinishReason, p as logWarn, w as withSpan } from "./logging-
|
|
2
|
-
import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-
|
|
1
|
+
import { d as logException, g as serializeGenAiAttribute, i as extractGenAiUsageAttributes, m as normalizeGenAiFinishReason, p as logWarn, w as withSpan } from "./logging-COUsTFIL.js";
|
|
2
|
+
import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-B19umzIL.js";
|
|
3
3
|
import { calculateCost, completeSimple, getEnvApiKey, getModels, registerApiProvider } from "@earendil-works/pi-ai/compat";
|
|
4
4
|
import { stream as streamAnthropic, streamSimple as streamSimpleAnthropic } from "@earendil-works/pi-ai/api/anthropic-messages";
|
|
5
5
|
import { createGatewayProvider } from "@ai-sdk/gateway";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import { S as toOptionalTrimmed, o as resolveGatewayModel } from "./client-
|
|
3
|
-
import { p as logWarn } from "./logging-
|
|
2
|
+
import { S as toOptionalTrimmed, o as resolveGatewayModel } from "./client-ROZeVjq0.js";
|
|
3
|
+
import { p as logWarn } from "./logging-COUsTFIL.js";
|
|
4
4
|
import { l as TURN_REASONING_LEVELS, s as modelProfileSchema, t as DEFAULT_MODEL_PROFILES, u as parseTurnReasoningLevel } from "./model-profile-BwU8mqwD.js";
|
|
5
5
|
//#region src/chat/slack/emoji.ts
|
|
6
6
|
const SLACK_EMOJI_NAME_RE = /^(?:[a-z0-9_+-]+)(?:::(?:skin-tone-[2-6]))?$/;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { D as deleteProviderIdentityForSlackUser, c as getConversationEventStore, f as getSqlExecutor } from "./viewer-
|
|
3
|
-
import { u as hasRequiredOAuthScope } from "./registry-
|
|
4
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
5
|
-
import { Q as getTurnRecord, Z as failTurnRecord, q as loadTurnCheckpoint } from "./tasks-
|
|
6
|
-
import { w as getStateAdapter } from "./profile-
|
|
7
|
-
import { a as getVercelConversationWorkQueue } from "./job-queue-
|
|
8
|
-
import { m as ensureConversationWake, w as requestConversationWork } from "./store-
|
|
9
|
-
import { n as resolveTurnSessionRouting } from "./turn-session-routing-
|
|
1
|
+
import { It as startOAuthFlow, c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-B-7S_DCS.js";
|
|
2
|
+
import { D as deleteProviderIdentityForSlackUser, c as getConversationEventStore, f as getSqlExecutor } from "./viewer-D96vo_42.js";
|
|
3
|
+
import { u as hasRequiredOAuthScope } from "./registry-CeEpPna6.js";
|
|
4
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BQQiwwA7.js";
|
|
5
|
+
import { Q as getTurnRecord, Z as failTurnRecord, q as loadTurnCheckpoint } from "./tasks-DwGlFX9i.js";
|
|
6
|
+
import { w as getStateAdapter } from "./profile-DP4LKL6V.js";
|
|
7
|
+
import { a as getVercelConversationWorkQueue } from "./job-queue-DSQx1qFY.js";
|
|
8
|
+
import { m as ensureConversationWake, w as requestConversationWork } from "./store-Dx1U69mm.js";
|
|
9
|
+
import { n as resolveTurnSessionRouting } from "./turn-session-routing-Dw2Kamg9.js";
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
12
12
|
//#region src/chat/task-execution/authorized-turn.ts
|
|
@@ -446,7 +446,15 @@ const conversationSourceTaskSchema = z.object({
|
|
|
446
446
|
id: z.string().min(1).optional(),
|
|
447
447
|
kind: z.enum(["scheduled", "event"]),
|
|
448
448
|
label: z.string().min(1).optional(),
|
|
449
|
-
title: z.string().min(1).optional()
|
|
449
|
+
title: z.string().min(1).optional(),
|
|
450
|
+
/** Message id of the run's trigger input, which is not from a person. */
|
|
451
|
+
triggerMessageId: z.string().min(1).optional(),
|
|
452
|
+
/** Short trigger text, such as an event or a schedule. */
|
|
453
|
+
triggerLabel: z.string().min(1).optional(),
|
|
454
|
+
/** Credential mode this run used. Unset when the run record is gone. */
|
|
455
|
+
credentialMode: z.enum(["creator", "system"]).optional(),
|
|
456
|
+
/** Name of the creator whose credentials this run used. */
|
|
457
|
+
credentialUser: z.string().min(1).optional()
|
|
450
458
|
}).strict().superRefine((value, context) => {
|
|
451
459
|
if (Boolean(value.id) !== Boolean(value.label)) context.addIssue({
|
|
452
460
|
code: "custom",
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { Ft as
|
|
2
|
-
import { f as escapeXml } from "./client-
|
|
3
|
-
import { d as logException, h as runBestEffort, p as logWarn } from "./logging-
|
|
4
|
-
import { a as getRuntimeMetadata, n as botConfig } from "./config-
|
|
1
|
+
import { Ft as resolveBaseUrl, Lt as createUserTokenStore, Nt as formatProviderLabel, Pt as parseOAuthStatePayload, _ as resolvePluginOAuthAccount, d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, x as lookupSlackUserProfile, xt as getMcpProviderErrorAttributes } from "./agent-runner-B-7S_DCS.js";
|
|
2
|
+
import { f as escapeXml } from "./client-ROZeVjq0.js";
|
|
3
|
+
import { d as logException, h as runBestEffort, p as logWarn } from "./logging-COUsTFIL.js";
|
|
4
|
+
import { a as getRuntimeMetadata, n as botConfig } from "./config-DNNkxfGS.js";
|
|
5
5
|
import { f as parseSlackUserId } from "./actor-BTtLaeWy.js";
|
|
6
|
-
import { A as upsertIdentity, f as getSqlExecutor, j as upsertLinkedIdentity } from "./viewer-
|
|
6
|
+
import { A as upsertIdentity, f as getSqlExecutor, j as upsertLinkedIdentity } from "./viewer-D96vo_42.js";
|
|
7
7
|
import { i as homeDir } from "./package-discovery-BVvSnQBB.js";
|
|
8
|
-
import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-
|
|
9
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
10
|
-
import { t as discoverSkills } from "./skills-
|
|
11
|
-
import { It as recordAuthenticationLinked, Lt as recordAuthorizationCompleted, Q as getTurnRecord, V as postSlackMessage } from "./tasks-
|
|
12
|
-
import {
|
|
13
|
-
import { E as acquireActiveLock, w as getStateAdapter } from "./profile-
|
|
14
|
-
import { i as getConversationPendingAuth } from "./pending-auth-
|
|
15
|
-
import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-
|
|
16
|
-
import { c as deleteWebAuthorization, f as wakeAuthorizedTurn, i as readConnectedOAuthTokens, p as wakePausedTurn } from "./connections-
|
|
8
|
+
import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-CeEpPna6.js";
|
|
9
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BQQiwwA7.js";
|
|
10
|
+
import { t as discoverSkills } from "./skills-CSzgs0EC.js";
|
|
11
|
+
import { It as recordAuthenticationLinked, Lt as recordAuthorizationCompleted, Q as getTurnRecord, V as postSlackMessage } from "./tasks-DwGlFX9i.js";
|
|
12
|
+
import { Ht as getSlackClient } from "./agent-hooks-DcoKnnxn.js";
|
|
13
|
+
import { E as acquireActiveLock, w as getStateAdapter } from "./profile-DP4LKL6V.js";
|
|
14
|
+
import { i as getConversationPendingAuth } from "./pending-auth-DDx3EU4M.js";
|
|
15
|
+
import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-Ces6tXmB.js";
|
|
16
|
+
import { c as deleteWebAuthorization, f as wakeAuthorizedTurn, i as readConnectedOAuthTokens, p as wakePausedTurn } from "./connections-DJV6mLrH.js";
|
|
17
17
|
import { n as relayLocalOAuthCallback } from "./oauth-relay-CdCnu80W.js";
|
|
18
18
|
import path from "node:path";
|
|
19
19
|
import { z } from "zod";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as logException } from "./logging-
|
|
1
|
+
import { d as logException } from "./logging-COUsTFIL.js";
|
|
2
2
|
import { g as startSpanManual } from "./sentry-CgWZM_kV.js";
|
|
3
|
-
import "./config-
|
|
3
|
+
import "./config-DNNkxfGS.js";
|
|
4
4
|
import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, f as timestamptz, i as juniorAgentBindings, l as juniorUsers, s as juniorConversations } from "./agent-invocations-D_YoNnAn.js";
|
|
5
5
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
6
|
import { sql } from "drizzle-orm";
|
|
@@ -285,13 +285,10 @@ const juniorEventAutomations = pgTable("junior_event_tasks", {
|
|
|
285
285
|
namespace: text("namespace").notNull(),
|
|
286
286
|
identifier: text("identifier").notNull(),
|
|
287
287
|
createdAtMs: bigint("created_at_ms", { mode: "number" }).notNull(),
|
|
288
|
-
|
|
289
|
-
status: text("status").$type().notNull().default("active"),
|
|
290
|
-
/** Why a run blocked this automation. Kept while paused; cleared on resume. */
|
|
288
|
+
status: text("status").notNull().default("active"),
|
|
291
289
|
statusReason: text("status_reason"),
|
|
292
|
-
/** Short display title generated from the task instruction. */
|
|
293
290
|
title: text("title"),
|
|
294
|
-
task: jsonb("task_json")
|
|
291
|
+
task: jsonb("task_json").notNull()
|
|
295
292
|
}, (table) => [index("junior_event_tasks_team_idx").on(table.teamId, table.createdAtMs, table.id).where(sql`${table.status} <> 'deleted'`), index("junior_event_tasks_match_idx").on(table.namespace, table.identifier, table.createdAtMs, table.id).where(sql`${table.status} <> 'deleted'`)]);
|
|
296
293
|
//#endregion
|
|
297
294
|
//#region src/db/schema/stats.ts
|
|
@@ -347,10 +344,49 @@ const juniorAutomationExecutions = pgTable("junior_task_executions", {
|
|
|
347
344
|
index("junior_task_executions_conversation_time_idx").on(table.conversationId, table.executedAtMs)
|
|
348
345
|
]);
|
|
349
346
|
//#endregion
|
|
347
|
+
//#region src/db/schema/automations.ts
|
|
348
|
+
/**
|
|
349
|
+
* One row per Automation of either kind. `record` holds the fields that have
|
|
350
|
+
* no column. Each write also copies the nested fields that queries filter or
|
|
351
|
+
* search on into columns: `team_id`, `channel_id`, `creator_slack_user_id`,
|
|
352
|
+
* `instruction`, and the event trigger `namespace` and `identifier`.
|
|
353
|
+
*/
|
|
354
|
+
const juniorAutomations = pgTable("junior_automations", {
|
|
355
|
+
id: text("id").primaryKey(),
|
|
356
|
+
kind: text("kind").$type().notNull(),
|
|
357
|
+
teamId: text("team_id").notNull(),
|
|
358
|
+
channelId: text("channel_id").notNull(),
|
|
359
|
+
creatorSlackUserId: text("creator_slack_user_id").notNull(),
|
|
360
|
+
/** Provider identity that created a Scheduled automation. */
|
|
361
|
+
creatorIdentityId: text("creator_identity_id"),
|
|
362
|
+
status: text("status").$type().notNull(),
|
|
363
|
+
/** Why a run blocked this Automation, until its creator resumes it. */
|
|
364
|
+
statusReason: text("status_reason"),
|
|
365
|
+
title: text("title"),
|
|
366
|
+
instruction: text("instruction").notNull(),
|
|
367
|
+
createdAtMs: bigint("created_at_ms", { mode: "number" }).notNull(),
|
|
368
|
+
nextRunAtMs: bigint("next_run_at_ms", { mode: "number" }),
|
|
369
|
+
runNowAtMs: bigint("run_now_at_ms", { mode: "number" }),
|
|
370
|
+
namespace: text("namespace"),
|
|
371
|
+
identifier: text("identifier"),
|
|
372
|
+
record: jsonb("record").$type().notNull()
|
|
373
|
+
}, (table) => [
|
|
374
|
+
check("junior_automations_kind_check", sql`${table.kind} in ('scheduled', 'event')`),
|
|
375
|
+
check("junior_automations_status_check", sql`${table.status} in ('active', 'blocked', 'paused', 'completed', 'deleted')`),
|
|
376
|
+
check("junior_automations_record_check", sql`jsonb_typeof(${table.record}) = 'object'`),
|
|
377
|
+
check("junior_automations_trigger_check", sql`(${table.kind} = 'scheduled' and ${table.namespace} is null and ${table.identifier} is null) or (${table.kind} = 'event' and ${table.namespace} is not null and ${table.identifier} is not null and ${table.nextRunAtMs} is null and ${table.runNowAtMs} is null and ${table.status} <> 'completed')`),
|
|
378
|
+
index("junior_automations_team_idx").on(table.teamId, table.createdAtMs, table.id).where(sql`${table.status} <> 'deleted'`),
|
|
379
|
+
index("junior_automations_creator_idx").on(table.teamId, table.creatorSlackUserId, table.createdAtMs, table.id),
|
|
380
|
+
index("junior_automations_creator_identity_idx").on(table.creatorIdentityId, table.createdAtMs, table.id).where(sql`${table.creatorIdentityId} IS NOT NULL`),
|
|
381
|
+
index("junior_automations_run_now_due_idx").on(table.runNowAtMs, table.createdAtMs, table.id).where(sql`${table.status} = 'active' AND ${table.runNowAtMs} IS NOT NULL`),
|
|
382
|
+
index("junior_automations_next_run_due_idx").on(table.nextRunAtMs, table.createdAtMs, table.id).where(sql`${table.status} = 'active' AND ${table.nextRunAtMs} IS NOT NULL`),
|
|
383
|
+
index("junior_automations_match_idx").on(table.namespace, table.identifier, table.createdAtMs, table.id).where(sql`${table.status} <> 'deleted'`)
|
|
384
|
+
]);
|
|
385
|
+
//#endregion
|
|
350
386
|
//#region src/db/schema/automation-versions.ts
|
|
351
387
|
/** One saved Automation definition. Lifecycle and scheduler state are not versioned. */
|
|
352
388
|
const juniorAutomationVersions = pgTable("junior_automation_versions", {
|
|
353
|
-
kind: text("kind").$type()
|
|
389
|
+
kind: text("kind").$type(),
|
|
354
390
|
automationId: text("automation_id").notNull(),
|
|
355
391
|
/** Starts at 1 and increases by 1 for each saved definition change. */
|
|
356
392
|
version: integer("version").notNull(),
|
|
@@ -358,14 +394,18 @@ const juniorAutomationVersions = pgTable("junior_automation_versions", {
|
|
|
358
394
|
/** Slack principal that saved this definition. Null when unknown. */
|
|
359
395
|
editedBy: jsonb("edited_by"),
|
|
360
396
|
definition: jsonb("definition").notNull()
|
|
361
|
-
}, (table) => [
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
table.automationId,
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
397
|
+
}, (table) => [
|
|
398
|
+
check("junior_automation_versions_kind_check", sql`${table.kind} in ('scheduled', 'event')`),
|
|
399
|
+
primaryKey({
|
|
400
|
+
name: "junior_automation_versions_pk",
|
|
401
|
+
columns: [table.automationId, table.version]
|
|
402
|
+
}),
|
|
403
|
+
foreignKey({
|
|
404
|
+
name: "junior_automation_versions_automation_id_fk",
|
|
405
|
+
columns: [table.automationId],
|
|
406
|
+
foreignColumns: [juniorAutomations.id]
|
|
407
|
+
}).onDelete("cascade")
|
|
408
|
+
]);
|
|
369
409
|
//#endregion
|
|
370
410
|
//#region src/db/schema/scheduled-automations.ts
|
|
371
411
|
const juniorSchedulerTasks = pgTable("junior_scheduler_tasks", {
|
|
@@ -377,9 +417,8 @@ const juniorSchedulerTasks = pgTable("junior_scheduler_tasks", {
|
|
|
377
417
|
nextRunAtMs: bigint("next_run_at_ms", { mode: "number" }),
|
|
378
418
|
runNowAtMs: bigint("run_now_at_ms", { mode: "number" }),
|
|
379
419
|
createdAtMs: bigint("created_at_ms", { mode: "number" }).notNull(),
|
|
380
|
-
/** Short display title generated from the task instruction. */
|
|
381
420
|
title: text("title"),
|
|
382
|
-
record: jsonb("record")
|
|
421
|
+
record: jsonb("record").notNull()
|
|
383
422
|
}, (table) => [
|
|
384
423
|
index("junior_scheduler_tasks_creator_idx").on(table.teamId, table.creatorSlackUserId, table.createdAtMs, table.id).where(sql`${table.status} <> 'deleted'`),
|
|
385
424
|
index("junior_scheduler_tasks_creator_identity_idx").on(table.creatorIdentityId, table.createdAtMs, table.id).where(sql`${table.status} <> 'deleted' AND ${table.creatorIdentityId} IS NOT NULL`),
|
|
@@ -474,6 +513,7 @@ const juniorSqlSchema = {
|
|
|
474
513
|
juniorStats,
|
|
475
514
|
juniorAutomationExecutions,
|
|
476
515
|
juniorAutomationVersions,
|
|
516
|
+
juniorAutomations,
|
|
477
517
|
juniorSchedulerRuns,
|
|
478
518
|
juniorSchedulerTasks,
|
|
479
519
|
juniorUsers,
|
|
@@ -1018,4 +1058,4 @@ function createJuniorSqlExecutor(args) {
|
|
|
1018
1058
|
});
|
|
1019
1059
|
}
|
|
1020
1060
|
//#endregion
|
|
1021
|
-
export { juniorArtifacts as
|
|
1061
|
+
export { juniorArtifacts as S, juniorApiTokens as _, juniorSchedulerRuns as a, juniorCodeRepositories as b, juniorAutomationExecutions as c, juniorConversationParticipants as d, juniorConversationBindings as f, juniorConversationEvents as g, juniorConversationMetrics as h, juniorWorkspaces as i, juniorStats as l, CONVERSATION_METRICS as m, juniorSnapshots as n, juniorAutomationVersions as o, juniorConversationBriefs as p, juniorWorkspaceRepos as r, juniorAutomations as s, createJuniorSqlExecutor as t, juniorLocationConfigurations as u, juniorConversationAnnotations as v, juniorAttachments as x, juniorCodeChanges as y };
|