@agent-native/core 0.214.0 → 0.216.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.
Files changed (161) hide show
  1. package/dist/action.js +54 -1
  2. package/dist/agent/actions/disconnect-chatgpt-subscription.js +5 -0
  3. package/dist/agent/actions/get-agentkit-capabilities.js +3 -3
  4. package/dist/agent/actions/manage-builder-connection.js +5 -0
  5. package/dist/agent/actions/manage-provider-key-policy.js +5 -0
  6. package/dist/agent/actions/manage-provider-models.js +5 -0
  7. package/dist/agent/actions/manage-service-providers.js +5 -0
  8. package/dist/agent/actions/select-chatgpt-subscription-account.js +5 -0
  9. package/dist/agent/context-xray/actions/context-evict.js +5 -0
  10. package/dist/agent/context-xray/actions/context-pin.js +5 -0
  11. package/dist/agent/context-xray/actions/context-report.js +5 -0
  12. package/dist/agent/context-xray/actions/context-restore.js +5 -0
  13. package/dist/agent/execution-fence.d.ts +1 -0
  14. package/dist/agent/execution-fence.js +5 -0
  15. package/dist/agent/production-agent.d.ts +35 -2
  16. package/dist/agent/production-agent.js +629 -32
  17. package/dist/agent/run-manager.d.ts +2 -0
  18. package/dist/agent/run-manager.js +397 -115
  19. package/dist/agent/run-slot-lock.d.ts +2 -0
  20. package/dist/agent/run-slot-lock.js +6 -0
  21. package/dist/agent/run-store.d.ts +5 -0
  22. package/dist/agent/run-store.js +423 -156
  23. package/dist/agent/thread-data-builder.js +27 -5
  24. package/dist/agent/types.d.ts +6 -12
  25. package/dist/agentkit/capabilities.d.ts +1 -1
  26. package/dist/application-state/store.d.ts +5 -0
  27. package/dist/application-state/store.js +26 -0
  28. package/dist/chat-threads/schema-migrations.js +17 -0
  29. package/dist/chat-threads/store.d.ts +21 -1
  30. package/dist/chat-threads/store.js +223 -41
  31. package/dist/cli/skills-content/turn-into-app-skill.d.ts +1 -1
  32. package/dist/cli/skills-content/turn-into-app-skill.js +20 -18
  33. package/dist/cli/templates-meta.js +14 -0
  34. package/dist/client/analytics.js +167 -17
  35. package/dist/client/chat/agentkit-agent-native.js +79 -3
  36. package/dist/client/chat/agentkit-protocol.js +80 -42
  37. package/dist/client/chat/runtime.d.ts +5 -1
  38. package/dist/client/chat/runtime.js +46 -3
  39. package/dist/client/consent.d.ts +36 -0
  40. package/dist/client/consent.js +283 -0
  41. package/dist/client/review/use-review.d.ts +2 -0
  42. package/dist/client/review/use-review.js +28 -1
  43. package/dist/client/sharing/useResourceAccessGate.d.ts +3 -2
  44. package/dist/client/sharing/useResourceAccessGate.js +9 -1
  45. package/dist/client/use-chat-thread-list.d.ts +2 -0
  46. package/dist/client/use-chat-thread-list.js +12 -2
  47. package/dist/client/use-chat-threads.d.ts +1 -0
  48. package/dist/client/use-chat-threads.js +2 -0
  49. package/dist/collab/awareness.d.ts +2 -2
  50. package/dist/collab/routes.d.ts +2 -2
  51. package/dist/collab/struct-routes.d.ts +1 -1
  52. package/dist/connections/catalog.d.ts +5 -5
  53. package/dist/connections/catalog.js +22 -3
  54. package/dist/data-widgets/index.d.ts +36 -2
  55. package/dist/data-widgets/index.js +94 -6
  56. package/dist/db/migrations.js +4 -1
  57. package/dist/db/schema-snapshot.generated.js +8 -1
  58. package/dist/feature-flags/actions/set-feature-flag.js +5 -0
  59. package/dist/feature-flags/index.d.ts +1 -1
  60. package/dist/feature-flags/index.js +1 -1
  61. package/dist/feature-flags/store.d.ts +12 -0
  62. package/dist/feature-flags/store.js +79 -7
  63. package/dist/file-upload/actions/manage-file-storage.js +5 -0
  64. package/dist/file-upload/actions/upload-image.d.ts +1 -1
  65. package/dist/file-upload/actions/upload-image.js +5 -0
  66. package/dist/history/actions/create-resource-version.js +5 -0
  67. package/dist/history/actions/restore-resource-version.js +5 -0
  68. package/dist/ingestion/index.d.ts +1 -1
  69. package/dist/ingestion/index.js +1 -1
  70. package/dist/ingestion/pptx.d.ts +11 -0
  71. package/dist/ingestion/pptx.js +81 -1
  72. package/dist/integrations/actions/manage-messaging-channel.js +5 -0
  73. package/dist/jobs/scheduler.js +17 -1
  74. package/dist/labs/actions/set-lab.js +5 -0
  75. package/dist/localization/actions/set-localization-preference.js +5 -0
  76. package/dist/observability/actions/save-observability-instruction-update.js +5 -0
  77. package/dist/observability/actions/save-observability-review-summary.js +5 -0
  78. package/dist/progress/routes.d.ts +1 -1
  79. package/dist/provider-api/actions/custom-provider-registration.d.ts +18 -18
  80. package/dist/provider-api/actions/provider-api.d.ts +14 -14
  81. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  82. package/dist/provider-api/index.js +9 -2
  83. package/dist/review/actions/consume-review-feedback.js +5 -0
  84. package/dist/review/actions/create-review-comment.js +5 -0
  85. package/dist/review/actions/delete-review-comment.js +5 -0
  86. package/dist/review/actions/react-to-review-comment.js +5 -0
  87. package/dist/review/actions/reply-review-comment.js +5 -0
  88. package/dist/review/actions/resolve-review-thread.js +5 -0
  89. package/dist/review/actions/send-review-thread-to-agent.js +5 -0
  90. package/dist/review/actions/set-review-status.js +5 -0
  91. package/dist/review/actions/set-review-thread-muted.js +5 -0
  92. package/dist/review/actions/set-review-thread-unread.js +5 -0
  93. package/dist/review/actions/set-review-threads-unread.js +5 -0
  94. package/dist/review/actions/update-review-comment-anchor.js +5 -0
  95. package/dist/review/actions/update-review-comment.js +5 -0
  96. package/dist/review/suggestions/actions.js +60 -21
  97. package/dist/review/suggestions/store.d.ts +2 -0
  98. package/dist/review/suggestions/store.js +28 -0
  99. package/dist/secrets/actions/delete-api-key.js +5 -0
  100. package/dist/secrets/routes.d.ts +6 -6
  101. package/dist/server/agent-chat/context-tools.js +63 -2
  102. package/dist/server/agent-chat-plugin.d.ts +2 -0
  103. package/dist/server/agent-chat-plugin.js +242 -54
  104. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  105. package/dist/server/agent-engine-default-model-route.d.ts +2 -2
  106. package/dist/server/agent-engine-ollama-models-route.d.ts +1 -1
  107. package/dist/server/application-state-maintenance.d.ts +2 -0
  108. package/dist/server/application-state-maintenance.js +2 -0
  109. package/dist/server/attribution.d.ts +14 -0
  110. package/dist/server/attribution.js +62 -2
  111. package/dist/server/auth.js +7 -0
  112. package/dist/server/consent-route.d.ts +41 -0
  113. package/dist/server/consent-route.js +102 -0
  114. package/dist/server/first-touch-route.d.ts +39 -0
  115. package/dist/server/first-touch-route.js +115 -0
  116. package/dist/server/index.d.ts +1 -0
  117. package/dist/server/index.js +1 -0
  118. package/dist/server/queued-submission-inbox-drain.d.ts +9 -0
  119. package/dist/server/queued-submission-inbox-drain.js +12 -0
  120. package/dist/server/request-origin.d.ts +6 -0
  121. package/dist/server/request-origin.js +12 -0
  122. package/dist/settings/org-settings.d.ts +2 -1
  123. package/dist/settings/org-settings.js +4 -1
  124. package/dist/settings/store.d.ts +8 -0
  125. package/dist/settings/store.js +14 -5
  126. package/dist/shared/consent.d.ts +31 -0
  127. package/dist/shared/consent.js +145 -0
  128. package/dist/shared/first-touch-persistence.d.ts +31 -0
  129. package/dist/shared/first-touch-persistence.js +53 -0
  130. package/dist/sharing/actions/set-resource-visibility.js +5 -0
  131. package/dist/sharing/actions/share-resource.js +5 -0
  132. package/dist/sharing/actions/unshare-resource.js +5 -0
  133. package/dist/templates/chat/.agents/skills/actions/references/action-fields.md +1 -1
  134. package/dist/templates/default/.agents/skills/actions/references/action-fields.md +1 -1
  135. package/dist/templates/factory/.agents/skills/review-latest-feedback/SKILL.md +36 -80
  136. package/dist/templates/factory/.agents/skills/review-latest-feedback/references/channel-inventory.md +54 -16
  137. package/dist/templates/factory/.agents/skills/review-latest-feedback/references/slack-reaction-replies.md +50 -73
  138. package/dist/templates/headless/.agents/skills/actions/references/action-fields.md +1 -1
  139. package/dist/templates/workspace-core/.agents/skills/actions/references/action-fields.md +1 -1
  140. package/dist/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +20 -18
  141. package/dist/triggers/actions/manage-automation.d.ts +1 -1
  142. package/dist/usage/actions/get-usage-metrics.js +27 -4
  143. package/dist/usage/actions/manage-usage-alert.js +5 -0
  144. package/dist/vite/client.js +8 -6
  145. package/dist/workspace-connections/actions/bulk-update-workspace-user-groups.js +5 -0
  146. package/dist/workspace-connections/actions/delete-workspace-user-group.js +5 -0
  147. package/dist/workspace-connections/actions/upsert-workspace-user-group.js +5 -0
  148. package/docs/content/actions-access-control.mdx +8 -8
  149. package/docs/content/actions-defining.mdx +9 -8
  150. package/docs/content/template-design-developers.mdx +9 -9
  151. package/docs/content/template-design-features.mdx +1 -3
  152. package/docs/content/turn-into-app.mdx +4 -0
  153. package/package.json +4 -3
  154. package/src/templates/chat/.agents/skills/actions/references/action-fields.md +1 -1
  155. package/src/templates/default/.agents/skills/actions/references/action-fields.md +1 -1
  156. package/src/templates/factory/.agents/skills/review-latest-feedback/SKILL.md +36 -80
  157. package/src/templates/factory/.agents/skills/review-latest-feedback/references/channel-inventory.md +54 -16
  158. package/src/templates/factory/.agents/skills/review-latest-feedback/references/slack-reaction-replies.md +50 -73
  159. package/src/templates/headless/.agents/skills/actions/references/action-fields.md +1 -1
  160. package/src/templates/workspace-core/.agents/skills/actions/references/action-fields.md +1 -1
  161. package/src/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +20 -18
package/dist/action.js CHANGED
@@ -205,6 +205,50 @@ export function ranCallEmitsChange(entry, outcome, args, fallbackReadOnly) {
205
205
  const readOnly = actionCallReadOnly(entry, args) ?? fallbackReadOnly;
206
206
  return invocationEffect(entry, outcome, { readOnly }).changed;
207
207
  }
208
+ /**
209
+ * PostgreSQL breaks a deadlock (40P01) or a serializable conflict (40001) by
210
+ * rolling back one whole transaction. Drivers and Drizzle surface that as an
211
+ * untyped "Failed query", which reads as a bug and hides the rollback, so an
212
+ * action reports it as a typed conflict. The message must not claim nothing
213
+ * was saved: an action can commit an earlier transaction or an external write
214
+ * before the one that rolled back.
215
+ */
216
+ const TRANSACTION_CONFLICT_SQLSTATES = new Set(["40P01", "40001"]);
217
+ /** What a run that threw `error` throws: a transaction conflict as typed. */
218
+ function typedTransactionConflict(error) {
219
+ let sqlState;
220
+ try {
221
+ sqlState = transactionConflictSqlState(error);
222
+ }
223
+ catch {
224
+ // Any read of a thrown value may throw. That value goes on as thrown,
225
+ // so readableFailure reports it as unreadable instead of the read's own
226
+ // error replacing it.
227
+ return error;
228
+ }
229
+ if (!sqlState)
230
+ return error;
231
+ return new ActionContractError("The database rolled back this action's transaction because it conflicted with another transaction running at the same time. Anything the action saved outside that transaction stays saved, so read the current state and redo only what is missing.", {
232
+ errorCode: "transaction_conflict",
233
+ statusCode: 409,
234
+ details: { sqlState },
235
+ });
236
+ }
237
+ function transactionConflictSqlState(error) {
238
+ if (isActionContractError(error))
239
+ return null;
240
+ let cause = error;
241
+ for (let depth = 0; depth < 5; depth += 1) {
242
+ if (!cause || typeof cause !== "object")
243
+ return null;
244
+ const code = cause.code;
245
+ if (typeof code === "string" && TRANSACTION_CONFLICT_SQLSTATES.has(code)) {
246
+ return code;
247
+ }
248
+ cause = cause.cause;
249
+ }
250
+ return null;
251
+ }
208
252
  export class AgentActionStopError extends Error {
209
253
  agentNativeStop = true;
210
254
  errorCode;
@@ -360,9 +404,18 @@ export function defineAction(options) {
360
404
  }
361
405
  return options.run(args, ctx);
362
406
  };
363
- const guardedRun = typeof options.authorize === "function" || options.access
407
+ const accessCheckedRun = typeof options.authorize === "function" || options.access
364
408
  ? wrapRunWithAccess(handlerRun, options.access, options.authorize)
365
409
  : handlerRun;
410
+ // Access checks query the database too, so they convert the same way.
411
+ const guardedRun = async (args, ctx, gateArgs) => {
412
+ try {
413
+ return await accessCheckedRun(args, ctx, gateArgs);
414
+ }
415
+ catch (error) {
416
+ throw typedTransactionConflict(error);
417
+ }
418
+ };
366
419
  const uiOnlyGuardedRun = options.uiOnly === true
367
420
  ? async (args, ctx, gateArgs) => {
368
421
  if (ctx?.caller !== "frontend") {
@@ -13,6 +13,11 @@ export default defineAction({
13
13
  .optional()
14
14
  .describe("Remove the user's unusable credential from the older experimental ChatGPT flow."),
15
15
  }),
16
+ mcpAnnotations: {
17
+ readOnlyHint: false,
18
+ destructiveHint: true,
19
+ openWorldHint: true,
20
+ },
16
21
  run: async (_args, ctx) => {
17
22
  const email = ctx?.userEmail;
18
23
  if (!email)
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  import { defineAction, fail } from "../../action.js";
3
3
  import { listAgentKitCapabilities, } from "../../agentkit/capabilities.js";
4
4
  export default defineAction({
5
- description: "Read the signed-in user's AgentKit context-source and integration capabilities for Design or Slides. Returns only supported, connected capability labels and availability; never returns credentials or connection details.",
5
+ description: "Read the signed-in user's AgentKit context-source and integration capabilities for Design, Slides, or Slides 2. Returns only supported, connected capability labels and availability; never returns credentials or connection details.",
6
6
  schema: z.object({}),
7
7
  http: { method: "GET" },
8
8
  readOnly: true,
@@ -10,8 +10,8 @@ export default defineAction({
10
10
  toolCallable: false,
11
11
  run: async (_args, ctx) => {
12
12
  const appId = ctx?.appId;
13
- if (appId !== "design" && appId !== "slides") {
14
- fail("AgentKit capabilities are only available in Design and Slides.", {
13
+ if (appId !== "design" && appId !== "slides" && appId !== "slides-2") {
14
+ fail("AgentKit capabilities are only available in Design, Slides, and Slides 2.", {
15
15
  errorCode: "agentkit_capabilities_unsupported_app",
16
16
  statusCode: 400,
17
17
  });
@@ -30,6 +30,11 @@ export default defineAction({
30
30
  },
31
31
  // disconnectBuilderConnectionAtScope records the disconnect at its scope.
32
32
  audit: { enabled: false },
33
+ mcpAnnotations: {
34
+ readOnlyHint: false,
35
+ destructiveHint: true,
36
+ openWorldHint: true,
37
+ },
33
38
  run: async (args, ctx) => {
34
39
  const email = ctx?.userEmail?.trim().toLowerCase();
35
40
  if (!email) {
@@ -52,6 +52,11 @@ export default defineAction({
52
52
  },
53
53
  // Only real changes (and refused ones) are recorded, below.
54
54
  audit: { enabled: false },
55
+ mcpAnnotations: {
56
+ readOnlyHint: false,
57
+ destructiveHint: false,
58
+ openWorldHint: false,
59
+ },
55
60
  run: async (args, ctx) => {
56
61
  const email = ctx?.userEmail?.trim().toLowerCase();
57
62
  const orgId = ctx?.orgId?.trim();
@@ -40,6 +40,11 @@ export default defineAction({
40
40
  : `Set ${scope} ${args.provider} models (${args.models?.length ?? 0})`;
41
41
  },
42
42
  },
43
+ mcpAnnotations: {
44
+ readOnlyHint: false,
45
+ destructiveHint: false,
46
+ openWorldHint: false,
47
+ },
43
48
  run: async (args, ctx) => {
44
49
  if (!ctx?.userEmail)
45
50
  fail("Not authenticated.", { statusCode: 401 });
@@ -134,6 +134,11 @@ export default defineAction({
134
134
  toolCallable: false,
135
135
  // Only real changes (and refused ones) are recorded, below.
136
136
  audit: { enabled: false },
137
+ mcpAnnotations: {
138
+ readOnlyHint: false,
139
+ destructiveHint: false,
140
+ openWorldHint: false,
141
+ },
137
142
  run: async (args, ctx) => {
138
143
  const email = ctx?.userEmail?.trim().toLowerCase();
139
144
  const orgId = ctx?.orgId?.trim();
@@ -6,6 +6,11 @@ export default defineAction({
6
6
  schema: z.object({
7
7
  accountId: z.string().min(1).max(80),
8
8
  }),
9
+ mcpAnnotations: {
10
+ readOnlyHint: false,
11
+ destructiveHint: false,
12
+ openWorldHint: false,
13
+ },
9
14
  run: async (args, ctx) => {
10
15
  const email = ctx?.userEmail;
11
16
  if (!email)
@@ -10,6 +10,11 @@ export default defineAction({
10
10
  threadId: z.string(),
11
11
  segmentId: z.string(),
12
12
  }),
13
+ mcpAnnotations: {
14
+ readOnlyHint: false,
15
+ destructiveHint: false,
16
+ openWorldHint: false,
17
+ },
13
18
  run: async (args) => {
14
19
  const ownerEmail = getRequestUserEmail();
15
20
  if (!ownerEmail)
@@ -10,6 +10,11 @@ export default defineAction({
10
10
  threadId: z.string(),
11
11
  segmentId: z.string(),
12
12
  }),
13
+ mcpAnnotations: {
14
+ readOnlyHint: false,
15
+ destructiveHint: false,
16
+ openWorldHint: false,
17
+ },
13
18
  run: async (args) => {
14
19
  const ownerEmail = getRequestUserEmail();
15
20
  if (!ownerEmail)
@@ -21,6 +21,11 @@ export default defineAction({
21
21
  model: z.string().optional(),
22
22
  segments: z.array(reportedSegmentSchema).default([]),
23
23
  }),
24
+ mcpAnnotations: {
25
+ readOnlyHint: false,
26
+ destructiveHint: false,
27
+ openWorldHint: false,
28
+ },
24
29
  run: async (args) => {
25
30
  const ownerEmail = getRequestUserEmail();
26
31
  if (!ownerEmail)
@@ -10,6 +10,11 @@ export default defineAction({
10
10
  threadId: z.string(),
11
11
  segmentId: z.string(),
12
12
  }),
13
+ mcpAnnotations: {
14
+ readOnlyHint: false,
15
+ destructiveHint: false,
16
+ openWorldHint: false,
17
+ },
13
18
  run: async (args) => {
14
19
  const ownerEmail = getRequestUserEmail();
15
20
  if (!ownerEmail)
@@ -23,6 +23,7 @@ export declare function currentExecutionFenceForScope(scope: {
23
23
  }): ExecutionFence | undefined;
24
24
  export declare function withExecutionLeaseRequested<T>(work: () => T): T;
25
25
  export declare function withExecutionFence<T>(fence: ExecutionFence, work: () => T): T;
26
+ export declare function runWithoutExecutionFence<T>(work: () => T): T;
26
27
  export declare function lockAndAssertCurrentExecutionFences(tx: DbExec): Promise<void>;
27
28
  export declare function withFencedExecutionWrite<T>(write: (tx: DbExec) => Promise<T>, scope?: {
28
29
  runId?: string;
@@ -61,6 +61,11 @@ export function withExecutionFence(fence, work) {
61
61
  executionLeaseRequested: true,
62
62
  }, work);
63
63
  }
64
+ export function runWithoutExecutionFence(work) {
65
+ // A follow-up turn scheduled by a completed run must not inherit that run's
66
+ // now-expired lease through AsyncLocalStorage.
67
+ return executionFenceStorage.run({ fences: [], executionLeaseRequested: false }, work);
68
+ }
64
69
  export async function lockAndAssertCurrentExecutionFences(tx) {
65
70
  const fences = executionFenceStorage.getStore()?.fences ?? [];
66
71
  for (const activeFence of fences) {
@@ -1,4 +1,4 @@
1
- import { type AgentSubmissionPayload } from "@agent-native/agentkit/protocol";
1
+ import { type AgentRunOptions, type AgentSubmissionReference, type AgentSubmissionPayload } from "@agent-native/agentkit/protocol";
2
2
  import type { EventHandler as H3EventHandler } from "h3";
3
3
  import "../authorization/check-action.js";
4
4
  import type { Task } from "../a2a/types.js";
@@ -23,7 +23,7 @@ import type { AgentEngine, EngineTool, EngineMessage, EngineContentPart, EngineI
23
23
  import { type Processor } from "./processors.js";
24
24
  import { subscribeToRun, getActiveRunForThread, getActiveRunForThreadAsync, getRun, abortRun, abortRunDurably, abortRunAndTurnDurably, abortRunAtSafeBoundaryDurably, abortTurnByRefDurably, abortTurnDurably } from "./run-manager.js";
25
25
  import type { ActiveRun } from "./run-manager.js";
26
- import { type AgentTurnInitiator, insertRun, isTurnAborted, markRunAborted, updateRunHeartbeat, updateRunStatusIfRunning, updateRunTerminalStateIfRunning, setRunError, setRunTerminalReason, claimBackgroundRun, readBackgroundRunClaim, recordRunDiagnostic, countRunsForTurn } from "./run-store.js";
26
+ import { type AgentTurnInitiator, insertRun, isRunAborted, isTurnAborted, markRunAborted, updateRunHeartbeat, updateRunStatusIfRunning, updateRunTerminalStateIfRunning, setRunError, setRunTerminalReason, claimBackgroundRun, readBackgroundRunClaim, recordRunDiagnostic, countRunsForTurn } from "./run-store.js";
27
27
  import { type AgentActionScope, ActionTool, AgentChatAttachment, AgentChatEvent, AgentFileMutationProof, AgentChatReference, AgentChatStructuredMessage } from "./types.js";
28
28
  import { type ToolWriteReceipt } from "./write-receipts.js";
29
29
  export { PROVIDER_TO_ENV };
@@ -719,6 +719,19 @@ export declare function shouldGuardRepeatedSourceSweep(opts: {
719
719
  message: string;
720
720
  } | null;
721
721
  type ModelInputObserver = (messages: readonly unknown[]) => void | Promise<void>;
722
+ export type QueuedRunInterruptBoundaryResult = "none" | "aborted" | "pending";
723
+ export declare function createRunSafeBoundaryGuards(input: {
724
+ signal: AbortSignal;
725
+ flushEvents: () => Promise<void>;
726
+ interruptRequestedAtBoundary: () => Promise<QueuedRunInterruptBoundaryResult>;
727
+ }): {
728
+ beforeModelDispatch: BeforeModelDispatch;
729
+ beforeWrite: () => Promise<void>;
730
+ };
731
+ export declare function confirmQueuedRunInterrupt(input: {
732
+ abort: () => Promise<boolean>;
733
+ defer: () => Promise<unknown>;
734
+ }): Promise<Exclude<QueuedRunInterruptBoundaryResult, "none">>;
722
735
  export declare function runAgentLoop(opts: {
723
736
  engine: AgentEngine;
724
737
  model: string;
@@ -915,6 +928,25 @@ export declare function resolvePriorContinuationState(backgroundRunMarker: Recor
915
928
  };
916
929
  export declare function resolvePriorContinuationReason(backgroundRunMarker: Record<string, unknown> | null | undefined, body: Record<string, unknown>): string | undefined;
917
930
  declare function readTurnStartedAt(threadId: string, turnId: string): Promise<number | null>;
931
+ interface AdmittedQueuedMessagePromotion {
932
+ id: string;
933
+ text: string;
934
+ attachments?: unknown[];
935
+ requestAttachments?: Record<string, unknown>[];
936
+ references?: AgentSubmissionReference[];
937
+ metadata?: Record<string, unknown>;
938
+ options?: AgentRunOptions;
939
+ }
940
+ /** @internal exported for unit tests only */
941
+ export declare function readAdmittedQueuedMessagePromotion(opts: {
942
+ ownerEmail: string | null;
943
+ orgId: string | null;
944
+ threadId?: string;
945
+ messageId: unknown;
946
+ claimId: unknown;
947
+ message: string;
948
+ continuationRequested: boolean;
949
+ }): Promise<AdmittedQueuedMessagePromotion | null>;
918
950
  /** @internal exported for unit tests only */
919
951
  export declare function queuedPromotionAttachments(attachments: unknown[], requestAttachments?: Record<string, unknown>[]): AgentChatAttachment[];
920
952
  declare function emitRunText(run: ActiveRun, text: string): Promise<void>;
@@ -933,6 +965,7 @@ export interface ChainServerDrivenContinuationDeps {
933
965
  setRunError?: typeof setRunError;
934
966
  recordRunDiagnostic?: typeof recordRunDiagnostic;
935
967
  markBackgroundContinuationChunkTerminal?: typeof markBackgroundContinuationChunkTerminal;
968
+ isRunAborted?: typeof isRunAborted;
936
969
  generateRunId?: typeof generateRunId;
937
970
  sleep?: (ms: number) => Promise<void>;
938
971
  }