@sentry/junior 0.115.0 → 0.116.1
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/{agent-hooks-4EUUXP2F.js → agent-hooks-GUAAS3XH.js} +9 -9
- package/dist/api/conversations/detail.d.ts +18 -0
- package/dist/api/conversations/event-page.d.ts +1 -1
- package/dist/api/conversations/events.d.ts +1 -1
- package/dist/api/people/profile.d.ts +2 -2
- package/dist/api/people/shared.d.ts +1 -1
- package/dist/api/personal-tokens/create.d.ts +11 -0
- package/dist/api/personal-tokens/list.d.ts +12 -0
- package/dist/api/personal-tokens/revoke.d.ts +5 -0
- package/dist/api/personal-tokens/routes.d.ts +4 -0
- package/dist/api/plugins.d.ts +0 -1
- package/dist/api/route.d.ts +1 -1
- package/dist/api/schema/conversation.d.ts +18 -0
- package/dist/api/schema/person.d.ts +3 -3
- package/dist/api/schema/personal-token.d.ts +38 -0
- package/dist/api/schema.d.ts +2 -0
- package/dist/api/schema.js +15 -3
- package/dist/api.d.ts +1 -0
- package/dist/api.js +179 -39
- package/dist/app.js +1035 -853
- package/dist/{catalog-runtime-Y32UEQLB.js → catalog-runtime-WMPC4J4U.js} +5 -5
- package/dist/chat/agent/request.d.ts +1 -0
- package/dist/chat/agent/resume.d.ts +1 -0
- package/dist/chat/agent/sandbox.d.ts +1 -0
- package/dist/chat/agent/tools.d.ts +1 -0
- package/dist/chat/agent-dispatch/context.d.ts +2 -0
- package/dist/chat/agent-dispatch/heartbeat.d.ts +11 -5
- package/dist/chat/agent-dispatch/signing.d.ts +14 -5
- package/dist/chat/agent-dispatch/store.d.ts +36 -15
- package/dist/chat/agent-dispatch/types.d.ts +23 -10
- package/dist/chat/agent-dispatch/work.d.ts +58 -0
- package/dist/chat/app/factory.d.ts +12 -3
- package/dist/chat/conversations/history.d.ts +285 -290
- package/dist/chat/conversations/projection.d.ts +2 -2
- package/dist/chat/mcp/tool-manager.d.ts +2 -1
- package/dist/chat/pi/conversation-events.d.ts +6 -2
- package/dist/chat/plugins/annotations.d.ts +8 -0
- package/dist/chat/plugins/registry.d.ts +0 -3
- package/dist/chat/plugins/types.d.ts +0 -2
- package/dist/chat/runtime/agent-continue-runner.d.ts +4 -0
- package/dist/chat/runtime/reply-executor.d.ts +6 -1
- package/dist/chat/runtime/slack-resume.d.ts +5 -1
- package/dist/chat/runtime/turn-input.d.ts +3 -0
- package/dist/chat/sandbox/sandbox.d.ts +2 -1
- package/dist/chat/sandbox/session.d.ts +2 -11
- package/dist/chat/sandbox/workspace.d.ts +10 -2
- package/dist/chat/services/turn-session-record.d.ts +14 -1
- package/dist/chat/slack/dispatch-turn.d.ts +25 -0
- package/dist/chat/state/turn-session.d.ts +11 -0
- package/dist/chat/tool-support/text-range-result.d.ts +3 -0
- package/dist/chat/tool-support/zod-tool.d.ts +1 -0
- package/dist/chat/tools/definition.d.ts +3 -10
- package/dist/chat/tools/query-conversation-events.d.ts +68 -0
- package/dist/chat/tools/sandbox/file-utils.d.ts +8 -1
- package/dist/chat/tools/sandbox/find-files.d.ts +2 -1
- package/dist/chat/tools/sandbox/grep.d.ts +2 -1
- package/dist/{chunk-6V762AB4.js → chunk-2YYPXQNQ.js} +1 -1
- package/dist/{chunk-MIAKQNYX.js → chunk-6ZK6FZIV.js} +1 -1
- package/dist/{chunk-67CVNDJ7.js → chunk-7CSVG54J.js} +1 -1
- package/dist/{chunk-HWCQRGLL.js → chunk-BFYVIOTS.js} +105 -37
- package/dist/{chunk-LYA2AB5G.js → chunk-CGXLCMWI.js} +8 -52
- package/dist/{chunk-SYJT7AKB.js → chunk-CY7NXM32.js} +1 -1
- package/dist/{chunk-2QG4MZQ7.js → chunk-DLLW5ITL.js} +2 -2
- package/dist/{chunk-NVUQSFWX.js → chunk-F3SWGSPG.js} +3 -15
- package/dist/{chunk-CWEZEPD4.js → chunk-FAEALXEH.js} +68 -2
- package/dist/{chunk-43RYMWJ2.js → chunk-GDAXWEIJ.js} +809 -213
- package/dist/{chunk-AGLQYELI.js → chunk-H35BDAUS.js} +170 -170
- package/dist/{chunk-YCLO7D7M.js → chunk-JPKGW6L6.js} +77 -26
- package/dist/{chunk-G5SX4UPR.js → chunk-KNCELO2M.js} +2 -2
- package/dist/{chunk-FHC4JUSF.js → chunk-N3C4XCRE.js} +1 -2
- package/dist/{chunk-6FKLPVF3.js → chunk-OY2PQQ4P.js} +1 -1
- package/dist/{chunk-6OPTF4BQ.js → chunk-PE44LDDQ.js} +0 -1
- package/dist/{chunk-JQFJO5WH.js → chunk-RXRQJF7Y.js} +74 -17
- package/dist/{chunk-CEYOL62C.js → chunk-RYFAVWP3.js} +120 -20
- package/dist/{chunk-G36V2YGB.js → chunk-TC4ZEM2D.js} +33 -1
- package/dist/{chunk-PVZHG2XZ.js → chunk-VBMMMVVQ.js} +112 -35
- package/dist/{chunk-SG5WAA7H.js → chunk-WKU7TY22.js} +0 -3
- package/dist/{chunk-TVE25LPW.js → chunk-WLT72MRP.js} +1 -1
- package/dist/{chunk-EW5MLKT5.js → chunk-XA3VLFPK.js} +1 -55
- package/dist/{chunk-RAVKCKXA.js → chunk-ZYHLNTC2.js} +20 -5
- package/dist/cli/chat.js +23 -23
- package/dist/cli/check.js +6 -6
- package/dist/cli/plugins.js +13 -13
- package/dist/cli/snapshot-warmup.js +8 -8
- package/dist/cli/upgrade.js +7 -7
- package/dist/db/schema/api-tokens.d.ts +160 -0
- package/dist/db/schema/conversation-annotations.d.ts +142 -0
- package/dist/db/schema.d.ts +305 -1
- package/dist/{db-KBSJHAZU.js → db-FH4R5ZQ4.js} +6 -6
- package/dist/handlers/agent-dispatch.d.ts +7 -3
- package/dist/instrumentation.js +2 -2
- package/dist/nitro.js +5 -5
- package/dist/{oauth-callback-server-EYRMJTCS.js → oauth-callback-server-C2SSJ3FQ.js} +18 -18
- package/dist/personal-tokens/store.d.ts +27 -0
- package/dist/{plugins-PZMDS7AT.js → plugins-IUJA4VBU.js} +1 -1
- package/dist/reporting-schema.d.ts +0 -2
- package/dist/{runner-RQGZ5Z2S.js → runner-NAALFIXM.js} +12 -12
- package/dist/{skills-JJQIE3BT.js → skills-UN2JXYYF.js} +6 -6
- package/dist/{validation-MZ47PZP5.js → validation-EEF4ROHR.js} +6 -6
- package/dist/version.js +1 -1
- package/migrations/0008_sticky_rage.sql +14 -0
- package/migrations/0009_slippery_harrier.sql +12 -0
- package/migrations/0010_native_conversation_history.sql +142 -0
- package/migrations/meta/0008_snapshot.json +1076 -0
- package/migrations/meta/0009_snapshot.json +1146 -0
- package/migrations/meta/0010_snapshot.json +1190 -0
- package/migrations/meta/_journal.json +22 -1
- package/package.json +5 -6
- package/dist/chat/agent-dispatch/runner.d.ts +0 -13
- package/dist/chat/capabilities/catalog.d.ts +0 -16
- package/dist/{chunk-KNFROR7R.js → chunk-5I6ORJUY.js} +1 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pluginCatalogRuntime
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-OY2PQQ4P.js";
|
|
4
|
+
import "./chunk-XA3VLFPK.js";
|
|
5
5
|
import "./chunk-W3U3YQYI.js";
|
|
6
6
|
import "./chunk-HZF5P5UN.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-F3SWGSPG.js";
|
|
8
8
|
import "./chunk-OB42YVAE.js";
|
|
9
9
|
import "./chunk-F3B2YJ76.js";
|
|
10
10
|
import "./chunk-6GWA276C.js";
|
|
11
11
|
import "./chunk-B3IT5END.js";
|
|
12
12
|
import "./chunk-3V7OFJZC.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-WLT72MRP.js";
|
|
14
|
+
import "./chunk-N3C4XCRE.js";
|
|
15
15
|
import "./chunk-MLKGABMK.js";
|
|
16
16
|
export {
|
|
17
17
|
pluginCatalogRuntime
|
|
@@ -23,6 +23,7 @@ type SessionRecordLogContext = NonNullable<Parameters<typeof persistRunningSessi
|
|
|
23
23
|
interface ResumeStateArgs {
|
|
24
24
|
channelName?: string;
|
|
25
25
|
destination: Destination;
|
|
26
|
+
dispatchId?: string;
|
|
26
27
|
durability: AgentRunDurability;
|
|
27
28
|
getLoadedSkillNames: () => string[];
|
|
28
29
|
getModelId: () => string;
|
|
@@ -36,6 +36,7 @@ export interface AgentSandbox {
|
|
|
36
36
|
readonly tools: SandboxTools;
|
|
37
37
|
readonly workspace: SandboxWorkspace;
|
|
38
38
|
sandboxRef(): SandboxRef | undefined;
|
|
39
|
+
close(): void;
|
|
39
40
|
writeGeneratedArtifacts(files: FileUpload[]): Promise<GeneratedArtifactFileRef[]>;
|
|
40
41
|
}
|
|
41
42
|
/** Create run-scoped sandbox capabilities adapted to the current agent context. */
|
|
@@ -68,6 +68,7 @@ export interface ToolWiring {
|
|
|
68
68
|
mcpToolManager: McpToolManager;
|
|
69
69
|
pluginHooks: PluginHookRunner;
|
|
70
70
|
getSandboxRef: () => SandboxRef | undefined;
|
|
71
|
+
close(): Promise<void>;
|
|
71
72
|
toolGuidance: Array<{
|
|
72
73
|
name: string;
|
|
73
74
|
promptGuidelines: AnyToolDefinition["promptGuidelines"];
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { HeartbeatHookContext, PluginRegistration } from "@sentry/junior-plugin-api";
|
|
2
|
+
import type { ConversationWorkQueue } from "@/chat/task-execution/queue";
|
|
2
3
|
/** Build the plugin-scoped heartbeat context that gates durable dispatch access. */
|
|
3
4
|
export declare function createHeartbeatContext(args: {
|
|
5
|
+
conversationWorkQueue: ConversationWorkQueue;
|
|
4
6
|
nowMs: number;
|
|
5
7
|
plugin: string | PluginRegistration;
|
|
6
8
|
}): HeartbeatHookContext;
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import type { ConversationWorkQueue } from "@/chat/task-execution/queue";
|
|
2
|
-
/** Re-drive stale core dispatches before invoking plugin heartbeat hooks. */
|
|
3
|
-
export declare function recoverStaleDispatches(args: {
|
|
4
|
-
limit?: number;
|
|
5
|
-
nowMs: number;
|
|
6
|
-
}): Promise<number>;
|
|
7
2
|
/** Run plugin heartbeat hooks with bounded per-invocation work. */
|
|
8
3
|
export declare function runPluginHeartbeats(args: {
|
|
4
|
+
conversationWorkQueue: ConversationWorkQueue;
|
|
9
5
|
limit?: number;
|
|
10
6
|
nowMs: number;
|
|
11
7
|
}): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Repair bounded dispatch mailbox appends, including pre-cutover records.
|
|
10
|
+
*
|
|
11
|
+
* This index is only an ingress receipt; conversation work owns execution,
|
|
12
|
+
* leases, retries, and continuation after the mailbox append succeeds.
|
|
13
|
+
*/
|
|
14
|
+
export declare function recoverPendingDispatchMailboxAppends(args: {
|
|
15
|
+
conversationWorkQueue: ConversationWorkQueue;
|
|
16
|
+
nowMs: number;
|
|
17
|
+
}): Promise<void>;
|
|
12
18
|
/** Run the core heartbeat phases. */
|
|
13
19
|
export declare function runHeartbeat(args: {
|
|
14
20
|
conversationWorkQueue?: ConversationWorkQueue;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const legacyDispatchCallbackSchema: z.ZodObject<{
|
|
3
|
+
expectedVersion: z.ZodNumber;
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
}, z.core.$strict>;
|
|
6
|
+
type LegacyDispatchCallback = z.infer<typeof legacyDispatchCallbackSchema>;
|
|
7
|
+
/**
|
|
8
|
+
* Verify callbacks emitted before dispatches moved to conversation work.
|
|
9
|
+
*
|
|
10
|
+
* TODO(v0.116.0): Remove the legacy callback route after v0.114.x callbacks
|
|
11
|
+
* can no longer arrive.
|
|
12
|
+
*/
|
|
13
|
+
export declare function verifyDispatchCallbackRequest(request: Request): Promise<LegacyDispatchCallback | undefined>;
|
|
14
|
+
export {};
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import type { StateAdapter } from "chat";
|
|
2
|
-
import { type SlackDestination } from "@sentry/junior-plugin-api";
|
|
3
1
|
import type { BoundDispatchOptions, DispatchCreateResult, DispatchProjection, DispatchRecord, DispatchStatus } from "./types";
|
|
4
|
-
/**
|
|
2
|
+
/** Return the durable key for one plugin-facing dispatch projection. */
|
|
5
3
|
export declare function getDispatchStorageKey(id: string): string;
|
|
6
|
-
/** Parse
|
|
4
|
+
/** Parse current and rollout-compatible dispatch projection records. */
|
|
7
5
|
export declare function parseDispatchRecord(value: unknown): DispatchRecord | undefined;
|
|
8
|
-
/**
|
|
9
|
-
export declare function getDispatchDestinationLockId(destination: SlackDestination): string;
|
|
10
|
-
/** Return the isolated persisted conversation key for one dispatch run. */
|
|
6
|
+
/** Return the isolated durable conversation id for one dispatch. */
|
|
11
7
|
export declare function getDispatchConversationId(dispatch: Pick<DispatchRecord, "id">): string;
|
|
12
|
-
/**
|
|
8
|
+
/** Return the stable synthetic input message id for one dispatch turn. */
|
|
9
|
+
export declare function getDispatchInputMessageId(dispatchId: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Return the synthetic input id written by the pre-conversation-work runner.
|
|
12
|
+
*
|
|
13
|
+
* TODO(v0.116.0): Remove after v0.114 dispatch sessions can no longer resume.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getLegacyDispatchInputMessageId(dispatchId: string): string;
|
|
16
|
+
/** Return every persisted input id accepted while resuming one dispatch. */
|
|
17
|
+
export declare function getDispatchInputMessageIds(dispatchId: string): readonly string[];
|
|
18
|
+
/** Return the stable turn id used by every run of one dispatch. */
|
|
13
19
|
export declare function getDispatchTurnId(dispatchId: string): string;
|
|
14
20
|
/** Gate recovery to dispatches that can still make progress. */
|
|
15
21
|
export declare function isTerminalDispatchStatus(status: DispatchStatus): boolean;
|
|
16
|
-
/**
|
|
17
|
-
export declare function withDispatchLock<T>(dispatchId: string, callback: (state: StateAdapter) => Promise<T>): Promise<T>;
|
|
18
|
-
/** Load dispatch state for callback, recovery, and plugin projection paths. */
|
|
22
|
+
/** Load dispatch state for conversation work and plugin projections. */
|
|
19
23
|
export declare function getDispatchRecord(id: string): Promise<DispatchRecord | undefined>;
|
|
20
24
|
/** Create a plugin dispatch idempotently from the plugin's idempotency key. */
|
|
21
25
|
export declare function createOrGetDispatch(args: {
|
|
@@ -23,10 +27,27 @@ export declare function createOrGetDispatch(args: {
|
|
|
23
27
|
options: BoundDispatchOptions;
|
|
24
28
|
plugin: string;
|
|
25
29
|
}): Promise<DispatchCreateResult>;
|
|
26
|
-
/**
|
|
27
|
-
export declare function
|
|
28
|
-
/**
|
|
29
|
-
export declare function
|
|
30
|
+
/** Mark a dispatch projection as actively running. */
|
|
31
|
+
export declare function markDispatchRunning(id: string): Promise<DispatchRecord | undefined>;
|
|
32
|
+
/** Project a durable awaiting-resume turn state to the plugin API. */
|
|
33
|
+
export declare function markDispatchAwaitingResume(id: string): Promise<DispatchRecord | undefined>;
|
|
34
|
+
/** Project a blocked turn to the plugin API. */
|
|
35
|
+
export declare function markDispatchBlocked(id: string, errorMessage: string, resultMessageTs?: string): Promise<DispatchRecord | undefined>;
|
|
36
|
+
/** Project a completed turn and its accepted Slack message to the plugin API. */
|
|
37
|
+
export declare function markDispatchCompleted(id: string, resultMessageTs?: string): Promise<DispatchRecord | undefined>;
|
|
38
|
+
/** Project a terminal conversation turn failure to the plugin API. */
|
|
39
|
+
export declare function markDispatchFailed(id: string, errorMessage: string, resultMessageTs?: string): Promise<DispatchRecord | undefined>;
|
|
40
|
+
/** Remove a dispatch after its durable mailbox append has succeeded. */
|
|
41
|
+
export declare function confirmDispatchMailboxAppend(id: string): Promise<void>;
|
|
42
|
+
/** List dispatches whose durable mailbox append may not have completed. */
|
|
43
|
+
export declare function listPendingDispatchMailboxAppends(): Promise<string[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Atomically move a rollout-era record behind conversation-owned execution.
|
|
46
|
+
*
|
|
47
|
+
* Rewriting the canonical record under the dispatch lock removes the callback
|
|
48
|
+
* version/lease claim before mailbox work can become visible.
|
|
49
|
+
*/
|
|
50
|
+
export declare function claimDispatchMailboxAppend(id: string, nowMs: number): Promise<DispatchRecord | undefined>;
|
|
30
51
|
/** Return a plugin-scoped dispatch projection without exposing raw runtime state. */
|
|
31
52
|
export declare function getPluginDispatchProjection(args: {
|
|
32
53
|
id: string;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { DispatchOptions, DestinationVisibility, Source, SlackDestination } from "@sentry/junior-plugin-api";
|
|
2
|
-
import type { CredentialSubject, CredentialSystemActor } from "@/chat/credentials/context";
|
|
2
|
+
import type { CredentialContext, CredentialSubject, CredentialSystemActor } from "@/chat/credentials/context";
|
|
3
|
+
import type { AgentRunRouting } from "@/chat/agent/request";
|
|
4
|
+
import type { AgentTurnSurface } from "@/chat/state/turn-session";
|
|
5
|
+
import type { ChannelConfigurationService } from "@/chat/configuration/types";
|
|
3
6
|
export type DispatchStatus = "pending" | "running" | "awaiting_resume" | "completed" | "failed" | "blocked";
|
|
4
7
|
export type SlackDispatchOptions = Omit<DispatchOptions, "destination"> & {
|
|
5
8
|
destination: SlackDestination;
|
|
@@ -9,7 +12,6 @@ export interface BoundDispatchOptions extends Omit<SlackDispatchOptions, "creden
|
|
|
9
12
|
}
|
|
10
13
|
export interface DispatchRecord {
|
|
11
14
|
actor: CredentialSystemActor;
|
|
12
|
-
attempt: number;
|
|
13
15
|
createdAtMs: number;
|
|
14
16
|
credentialSubject?: CredentialSubject;
|
|
15
17
|
destination: SlackDestination;
|
|
@@ -18,16 +20,12 @@ export interface DispatchRecord {
|
|
|
18
20
|
id: string;
|
|
19
21
|
idempotencyKey: string;
|
|
20
22
|
input: string;
|
|
21
|
-
lastCallbackAtMs?: number;
|
|
22
|
-
leaseExpiresAtMs?: number;
|
|
23
|
-
maxAttempts: number;
|
|
24
23
|
metadata?: Record<string, string>;
|
|
25
24
|
plugin: string;
|
|
26
25
|
resultMessageTs?: string;
|
|
27
26
|
source: Source;
|
|
28
27
|
status: DispatchStatus;
|
|
29
28
|
updatedAtMs: number;
|
|
30
|
-
version: number;
|
|
31
29
|
}
|
|
32
30
|
export interface DispatchProjection {
|
|
33
31
|
errorMessage?: string;
|
|
@@ -35,11 +33,26 @@ export interface DispatchProjection {
|
|
|
35
33
|
resultMessageTs?: string;
|
|
36
34
|
status: DispatchStatus;
|
|
37
35
|
}
|
|
38
|
-
export interface DispatchCallback {
|
|
39
|
-
expectedVersion: number;
|
|
40
|
-
id: string;
|
|
41
|
-
}
|
|
42
36
|
export interface DispatchCreateResult {
|
|
43
37
|
record: DispatchRecord;
|
|
44
38
|
status: "created" | "already_exists";
|
|
45
39
|
}
|
|
40
|
+
export type DispatchTurnOutcome = "awaiting_resume" | "blocked" | "completed" | "failed";
|
|
41
|
+
/** Facts returned by one attempt to advance a dispatched turn. */
|
|
42
|
+
export interface DispatchTurnResult {
|
|
43
|
+
errorMessage?: string;
|
|
44
|
+
outcome?: DispatchTurnOutcome;
|
|
45
|
+
resultMessageTs?: string;
|
|
46
|
+
}
|
|
47
|
+
/** Dispatch-owned authority supplied to the shared turn runtime. */
|
|
48
|
+
export interface DispatchTurnContext {
|
|
49
|
+
authorizationFlowMode: "disabled";
|
|
50
|
+
channelConfiguration: ChannelConfigurationService;
|
|
51
|
+
credentialContext: CredentialContext;
|
|
52
|
+
destinationVisibility: DestinationVisibility;
|
|
53
|
+
dispatch: NonNullable<AgentRunRouting["dispatch"]>;
|
|
54
|
+
skipProviderDefaultConfig: true;
|
|
55
|
+
source: Source;
|
|
56
|
+
surface: Extract<AgentTurnSurface, "api">;
|
|
57
|
+
turnId: string;
|
|
58
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin dispatch mailbox adapter.
|
|
3
|
+
*
|
|
4
|
+
* Dispatch metadata selects exact authority and maintains the plugin-facing
|
|
5
|
+
* projection. The shared conversation worker and turn runtime own execution,
|
|
6
|
+
* leases, retries, continuation, delivery, and recovery.
|
|
7
|
+
*/
|
|
8
|
+
import type { StateAdapter } from "chat";
|
|
9
|
+
import type { ConversationStore } from "@/chat/conversations/store";
|
|
10
|
+
import { type InboundMessage } from "@/chat/task-execution/store";
|
|
11
|
+
import type { ConversationWorkQueue } from "@/chat/task-execution/queue";
|
|
12
|
+
import type { ConversationWorkerContext, ConversationWorkerResult } from "@/chat/task-execution/worker";
|
|
13
|
+
import type { DispatchRecord, DispatchTurnContext, DispatchTurnResult } from "./types";
|
|
14
|
+
export declare const AGENT_DISPATCH_MAX_AGE_MS: number;
|
|
15
|
+
type DispatchRoutingContext = Pick<DispatchTurnContext, "credentialContext" | "destinationVisibility" | "dispatch" | "surface"> & {
|
|
16
|
+
actor: DispatchRecord["actor"];
|
|
17
|
+
};
|
|
18
|
+
/** Restore the exact actor, credential, and dispatch routing for every slice. */
|
|
19
|
+
export declare function buildDispatchRoutingContext(dispatch: DispatchRecord): DispatchRoutingContext;
|
|
20
|
+
interface EnqueueAgentDispatchOptions {
|
|
21
|
+
conversationStore?: ConversationStore;
|
|
22
|
+
nowMs?: number;
|
|
23
|
+
queue: ConversationWorkQueue;
|
|
24
|
+
state?: StateAdapter;
|
|
25
|
+
}
|
|
26
|
+
/** Dependencies for dispatch work owned by the conversation worker. */
|
|
27
|
+
export interface AgentDispatchConversationWorkerOptions {
|
|
28
|
+
resumeTurn: (dispatch: DispatchRecord, hooks: {
|
|
29
|
+
shouldYield?: () => boolean;
|
|
30
|
+
}) => Promise<void>;
|
|
31
|
+
runTurn: (dispatch: DispatchRecord, hooks: {
|
|
32
|
+
ack: () => Promise<void>;
|
|
33
|
+
shouldYield?: () => boolean;
|
|
34
|
+
}) => Promise<DispatchTurnResult>;
|
|
35
|
+
}
|
|
36
|
+
/** Build the stable mailbox work item for one plugin dispatch. */
|
|
37
|
+
export declare function buildAgentDispatchInboundMessage(dispatch: DispatchRecord, nowMs?: number): InboundMessage;
|
|
38
|
+
/** Persist dispatch mailbox work before sending its conversation wake-up. */
|
|
39
|
+
export declare function enqueueAgentDispatch(dispatch: DispatchRecord, options: EnqueueAgentDispatchOptions): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Resolve a dispatch from concrete mailbox metadata or the active turn.
|
|
42
|
+
*
|
|
43
|
+
* Provider source and conversation-id conventions are deliberately not
|
|
44
|
+
* execution routing authority.
|
|
45
|
+
*/
|
|
46
|
+
export declare function resolveAgentDispatchId(context: ConversationWorkerContext): Promise<string | undefined>;
|
|
47
|
+
/**
|
|
48
|
+
* Route leased work through dispatch execution when durable metadata owns it.
|
|
49
|
+
*
|
|
50
|
+
* The fallback retains ownership of every other conversation source.
|
|
51
|
+
*/
|
|
52
|
+
export declare function createAgentDispatchWorkRouter(options: {
|
|
53
|
+
dispatchWorker: (context: ConversationWorkerContext, dispatchId: string) => Promise<ConversationWorkerResult>;
|
|
54
|
+
fallbackWorker: (context: ConversationWorkerContext) => Promise<ConversationWorkerResult>;
|
|
55
|
+
}): (context: ConversationWorkerContext) => Promise<ConversationWorkerResult>;
|
|
56
|
+
/** Run one dispatch start or resume under the owning conversation lease. */
|
|
57
|
+
export declare function createAgentDispatchConversationWorker(options: AgentDispatchConversationWorkerOptions): (context: ConversationWorkerContext, dispatchId: string) => Promise<ConversationWorkerResult>;
|
|
58
|
+
export {};
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import type { SlackAdapter } from "@chat-adapter/slack";
|
|
2
|
-
import
|
|
2
|
+
import type { Message } from "chat";
|
|
3
|
+
import { type AssistantLifecycleEvent } from "@/chat/runtime/slack-runtime";
|
|
3
4
|
import type { JuniorRuntimeServiceOverrides } from "@/chat/app/services";
|
|
4
|
-
import { type PreparedTurnState } from "@/chat/runtime/turn-preparation";
|
|
5
5
|
export interface CreateSlackRuntimeOptions {
|
|
6
6
|
getSlackAdapter: () => SlackAdapter;
|
|
7
7
|
now?: () => number;
|
|
8
8
|
services?: JuniorRuntimeServiceOverrides;
|
|
9
9
|
}
|
|
10
|
-
export declare function createSlackRuntime(options: CreateSlackRuntimeOptions):
|
|
10
|
+
export declare function createSlackRuntime(options: CreateSlackRuntimeOptions): {
|
|
11
|
+
runDispatchTurn: (dispatch: import("../agent-dispatch/types").DispatchRecord, hooks: {
|
|
12
|
+
ack: () => Promise<void>;
|
|
13
|
+
shouldYield?: () => boolean;
|
|
14
|
+
}) => Promise<import("../agent-dispatch/types").DispatchTurnResult>;
|
|
15
|
+
handleAssistantContextChanged: (event: AssistantLifecycleEvent) => Promise<void>;
|
|
16
|
+
handleAssistantThreadStarted: (event: AssistantLifecycleEvent) => Promise<void>;
|
|
17
|
+
handleNewMention: (thread: import("chat").Thread, message: Message, hooks: import("@/chat/runtime/slack-runtime").SlackTurnOptions) => Promise<void>;
|
|
18
|
+
handleSubscribedMessage: (thread: import("chat").Thread, message: Message, hooks: import("@/chat/runtime/slack-runtime").SlackTurnOptions) => Promise<void>;
|
|
19
|
+
};
|