glove-foundry 0.10.1 → 0.12.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.
@@ -1,5 +1,6 @@
1
1
  import * as glove_core from 'glove-core';
2
2
  import { Displaymanager, DisplayManagerAdapter, Slot, StoreAdapter, Message, IGloveRunnable, GloveFoldArgs, Tool, SubscriberAdapter, RuntimeContextProvider, RuntimeContextOptions, ModelAdapter, HookHandler, DefineSkillArgs, DefineSubAgentArgs, InboxItem, ContentPart, AgentEvent } from 'glove-core';
3
+ import * as effect from 'effect';
3
4
  import { Schema, Effect } from 'effect';
4
5
  import { z } from 'zod';
5
6
  import { AgentIdentity, MeshAdapter } from 'glove-mesh';
@@ -14,6 +15,63 @@ import { FactAdapter, FactScope, FactStore, FactInput } from 'glove-facts';
14
15
  import { GoalAdapter, GoalScope, GoalProgram, GoalRunner } from 'glove-memory/goals';
15
16
  import { FormAdapter, FormRunner } from 'glove-memory/forms';
16
17
 
18
+ /**
19
+ * queued: never attempted. Kept when a call ends; a late-chat policy may take it.
20
+ * dispatching: an attempt began and its outcome may be unknown. Never replayed
21
+ * into another run or call, and never sent to chat instead.
22
+ * accepted: the provider took it. Redelivery acknowledges without saying it again.
23
+ * suppressed: fresh preparation said nothing is due. Redelivery stays silent.
24
+ * redirecting: a provably undispatched event is being handed to a late-chat
25
+ * effect under `effectId`; recovery retries that effect, never voice.
26
+ * redirected: the late-chat effect finished.
27
+ */
28
+ type FoundryEventReceiptStatus = "queued" | "dispatching" | "accepted" | "suppressed" | "redirecting" | "redirected";
29
+ interface FoundryEventReceipt {
30
+ /** The event's journal id: one receipt per event per conversation. */
31
+ readonly id: string;
32
+ /** The event's own id, as its sender gave it. */
33
+ readonly eventId: string;
34
+ readonly agentId: string;
35
+ readonly conversationId: string;
36
+ readonly workspaceId: string;
37
+ readonly status: FoundryEventReceiptStatus;
38
+ /** The run and call that last moved it, `<runId>/<callId>`. Another generation never replays a dispatch. */
39
+ readonly generation?: string;
40
+ readonly runId?: string;
41
+ /** What was dispatched (accepted) or about to be (dispatching). */
42
+ readonly text?: string;
43
+ /** Why it was suppressed. */
44
+ readonly reason?: string;
45
+ /** The idempotency key of its late-chat effect, derived from the event. */
46
+ readonly effectId?: string;
47
+ /** Set once the transcript line for an accepted event is written. */
48
+ readonly transcriptMessageId?: string;
49
+ readonly createdAt: string;
50
+ readonly updatedAt: string;
51
+ readonly dispatchedAt?: string;
52
+ readonly acceptedAt?: string;
53
+ readonly settledAt?: string;
54
+ }
55
+ interface FoundryEventReceiptFilter {
56
+ readonly agentId?: string;
57
+ readonly conversationId?: string;
58
+ readonly status?: FoundryEventReceiptStatus | ReadonlyArray<FoundryEventReceiptStatus>;
59
+ }
60
+ /** The late-chat effect id for an event: the same on every retry. */
61
+ declare function lateChatEffectId(receiptId: string): string;
62
+ /** The transcript message id for an event's spoken line: the same on every repair. */
63
+ declare function eventTranscriptMessageId(receiptId: string): string;
64
+ interface EventReceiptStore {
65
+ /** False when the data adapter has no receipt methods: receipts last only as long as this process. */
66
+ readonly durable: boolean;
67
+ get(id: string): Promise<FoundryEventReceipt | null>;
68
+ /** Insert if absent. False, and no change, when it exists. */
69
+ claim(receipt: FoundryEventReceipt): Promise<boolean>;
70
+ put(receipt: FoundryEventReceipt): Promise<void>;
71
+ }
72
+ /** Receipts through the application's data adapter, or in this process when it keeps none. */
73
+ declare function eventReceiptStore(data: FoundryDataAdapter): EventReceiptStore;
74
+
17
75
  declare const FOUNDRY_SCHEDULE_BRAND: unique symbol;
18
76
  /**
19
77
  * What a recurring schedule does about occurrences that passed while the
@@ -164,6 +222,14 @@ interface FoundryApproval {
164
222
  readonly resumeRunId?: string;
165
223
  /** The run that asked read the decision itself, so no resume is owed. */
166
224
  readonly settledInRun?: boolean;
225
+ /**
226
+ * A mesh message the application's gate drafted. Approved, it is
227
+ * delivered; denied (or expired), it is dropped. The sender is not told.
228
+ */
229
+ readonly mesh?: {
230
+ readonly threadId: string;
231
+ readonly messageId: string;
232
+ };
167
233
  }
168
234
  declare function createFoundryApproval(directory: string, input: {
169
235
  readonly runId: string;
@@ -964,258 +1030,6 @@ interface FoundryAccountSessionAdapter {
964
1030
  declare function installRegistry(options: InstallRegistryOptions): Effect.Effect<ReadonlyArray<AgentInstallation>, unknown, never>;
965
1031
  declare function isFoundryCapability(value: unknown): boolean;
966
1032
 
967
- declare const FOUNDRY_WORKING_ENVIRONMENT_BRAND: unique symbol;
968
- declare const FOUNDRY_REPL_BRAND: unique symbol;
969
- type FoundryVfs = Vfs;
970
- type FoundryVfsHandle = EnvFsHandle;
971
- interface FoundryWorkingEnvironmentPersistenceContext {
972
- readonly definitionId: string;
973
- readonly agentId: string;
974
- readonly conversationId: string;
975
- readonly workspaceId: string;
976
- readonly runId: string;
977
- readonly data: FoundryDataAdapter;
978
- readonly signal: AbortSignal;
979
- }
980
- /**
981
- * Storage is deliberately adapter-owned. Foundry never chooses a database,
982
- * object store, locking policy, or credential lifecycle for an environment.
983
- */
984
- interface FoundryWorkingEnvironmentPersistenceAdapter {
985
- readonly identifier: string;
986
- readonly load: (context: FoundryWorkingEnvironmentPersistenceContext) => Resolvable<EnvSnapshot | null>;
987
- readonly save: (snapshot: EnvSnapshot, context: FoundryWorkingEnvironmentPersistenceContext) => Resolvable<void>;
988
- }
989
- interface FoundryWorkingEnvironmentCreateContext {
990
- readonly assembly: AgentAssemblyContext<FoundryRequest>;
991
- readonly snapshot: EnvSnapshot | null;
992
- }
993
- interface DefineFoundryWorkingEnvironmentOptions {
994
- /**
995
- * Build the native Glove environment. Use this when creation itself needs
996
- * custom logic. The loaded snapshot is provided but never applied implicitly.
997
- */
998
- readonly create?: (context: FoundryWorkingEnvironmentCreateContext) => Resolvable<WorkingEnvironment>;
999
- /**
1000
- * Native environment options. When persistence returns a snapshot and no
1001
- * filesystem is supplied, Foundry restores that snapshot automatically.
1002
- */
1003
- readonly options?: CreateWorkingEnvironmentOptions | ((context: FoundryWorkingEnvironmentCreateContext) => Resolvable<CreateWorkingEnvironmentOptions>);
1004
- readonly persistence?: FoundryWorkingEnvironmentPersistenceAdapter;
1005
- /** Native mount behavior: prompt priming and optional tool prefix. */
1006
- readonly mount?: Omit<MountWorkingEnvironmentConfig, "env">;
1007
- /** Close worker/adaptor resources after the run. Default true. */
1008
- readonly close?: boolean;
1009
- }
1010
- type FoundryWorkingEnvironmentDefinition = Readonly<DefineFoundryWorkingEnvironmentOptions> & {
1011
- readonly [FOUNDRY_WORKING_ENVIRONMENT_BRAND]: true;
1012
- };
1013
- declare function defineWorkingEnvironment(options?: DefineFoundryWorkingEnvironmentOptions): FoundryWorkingEnvironmentDefinition;
1014
- /**
1015
- * Convenience persistence over the configured FoundryDataAdapter's private
1016
- * snapshot seam. VFS contents never become public workspace entries.
1017
- * Scope "agent" (default) keeps one snapshot per instance, "conversation" one
1018
- * per conversation, and "workspace" one shared by every agent in the
1019
- * workspace. Saves replace the snapshot, so with "workspace" the last run to
1020
- * finish wins; give agents that write at the same time a live machine instead.
1021
- */
1022
- declare function foundryDataEnvironmentPersistence(options?: {
1023
- readonly scope?: "agent" | "conversation" | "workspace";
1024
- }): FoundryWorkingEnvironmentPersistenceAdapter;
1025
- interface FoundryReplBase {
1026
- readonly [FOUNDRY_REPL_BRAND]: true;
1027
- /**
1028
- * Project an explicit set of the fully assembled agent's tools into the
1029
- * sandbox as ordinary functions. Selection happens after applications,
1030
- * installed capabilities, memory, mesh, calls, and `configure` have mounted.
1031
- *
1032
- * Returning the actual tool values keeps code relationships referential;
1033
- * Foundry never accepts a second list of copied string ids here.
1034
- */
1035
- readonly programmaticTools?: FoundryProgrammaticTools;
1036
- }
1037
- interface FoundryProgrammaticToolSelection {
1038
- /** One of the exact live tools supplied to the selector context. */
1039
- readonly tool: Tool<unknown>;
1040
- /** Optional valid interpreter identifier when the tool name is unsuitable. */
1041
- readonly name?: string;
1042
- /** Informational effect hint used by capability discovery. */
1043
- readonly readOnly?: boolean;
1044
- /** Optional capability group used by progressive discovery. */
1045
- readonly server?: string;
1046
- readonly serverDescription?: string;
1047
- readonly resultShape?: string;
1048
- }
1049
- /** An installed app, with its live tools ready to select into the REPL. */
1050
- interface FoundryReplApp {
1051
- readonly id: string;
1052
- readonly description: string;
1053
- readonly accountId?: string;
1054
- /** Each tool grouped under the app, named for code, and marked when it only reads. */
1055
- readonly tools: ReadonlyArray<FoundryProgrammaticToolSelection>;
1056
- }
1057
- interface FoundryProgrammaticToolContext {
1058
- readonly assembly: AgentAssemblyContext<FoundryRequest>;
1059
- readonly glove: IGloveRunnable;
1060
- /** Snapshot of every tool mounted before the programmatic surface itself. */
1061
- readonly tools: ReadonlyArray<Tool<unknown>>;
1062
- /** The apps installed on this agent, one group per app. */
1063
- readonly apps: ReadonlyArray<FoundryReplApp>;
1064
- readonly workingEnvironment?: WorkingEnvironment;
1065
- readonly vfs?: EnvFsHandle;
1066
- }
1067
- interface FoundryProgrammaticTools {
1068
- /**
1069
- * Select direct live tool references. A selection may decorate its callable
1070
- * name and discovery metadata without replacing the underlying capability.
1071
- */
1072
- readonly select: (context: FoundryProgrammaticToolContext) => Resolvable<ReadonlyArray<Tool<unknown> | FoundryProgrammaticToolSelection>>;
1073
- /** Total underlying calls permitted during this assembled run. Default 50. */
1074
- readonly maxCalls?: number;
1075
- /**
1076
- * Keep selected tools in the model's direct tool list as well. Default true.
1077
- * Pass false to reach them only from code, which keeps a large app
1078
- * catalogue out of context. A tool that needs approval always stays direct.
1079
- */
1080
- readonly keepDirect?: boolean;
1081
- }
1082
- type FoundryJavaScriptReplDefinition = FoundryReplBase & Readonly<{
1083
- readonly language: "javascript";
1084
- readonly session: JsSession;
1085
- readonly mount?: Omit<MountJsConfig, "session">;
1086
- }>;
1087
- type FoundryPythonReplDefinition = FoundryReplBase & Readonly<{
1088
- readonly language: "python";
1089
- readonly session: PySession;
1090
- readonly mount?: Omit<MountPyConfig, "session">;
1091
- }>;
1092
- type FoundryLispReplDefinition = FoundryReplBase & Readonly<{
1093
- readonly language: "lisp";
1094
- readonly session: LispSession;
1095
- readonly mount?: Omit<MountLispConfig, "session">;
1096
- }>;
1097
- type FoundryReplDefinition = FoundryJavaScriptReplDefinition | FoundryPythonReplDefinition | FoundryLispReplDefinition;
1098
- type DefineFoundryReplOptions = Omit<FoundryJavaScriptReplDefinition, typeof FOUNDRY_REPL_BRAND> | Omit<FoundryPythonReplDefinition, typeof FOUNDRY_REPL_BRAND> | Omit<FoundryLispReplDefinition, typeof FOUNDRY_REPL_BRAND>;
1099
- declare function defineRepl(options: DefineFoundryReplOptions): FoundryReplDefinition;
1100
- type FoundryMountedRepl = Readonly<{
1101
- readonly language: "javascript";
1102
- readonly session: JsSession;
1103
- }> | Readonly<{
1104
- readonly language: "python";
1105
- readonly session: PySession;
1106
- }> | Readonly<{
1107
- readonly language: "lisp";
1108
- readonly session: LispSession;
1109
- }>;
1110
-
1111
- declare const FOUNDRY_LAYER_BRAND: unique symbol;
1112
- declare const FOUNDRY_SUBSCRIBER_BRAND: unique symbol;
1113
- interface FoundrySurfaceContext<TInput = unknown> {
1114
- readonly definitionId: string;
1115
- readonly agentId: string;
1116
- readonly conversationId: string;
1117
- readonly workspaceId: string;
1118
- readonly runId: string;
1119
- readonly input: TInput;
1120
- readonly request: FoundryRequest;
1121
- readonly message: Message;
1122
- readonly messageInput: FoundryMessageInput;
1123
- readonly messageText: string;
1124
- readonly history: ReadonlyArray<Message>;
1125
- readonly messages: ReadonlyArray<Message>;
1126
- readonly glove: IGloveRunnable;
1127
- readonly workingEnvironment?: WorkingEnvironment;
1128
- readonly vfs?: FoundryVfsHandle;
1129
- readonly repl?: FoundryMountedRepl;
1130
- readonly signal: AbortSignal;
1131
- readonly emit: (event: {
1132
- type: string;
1133
- data?: unknown;
1134
- }) => void;
1135
- }
1136
- type FoundrySurfaceCleanup = () => void | Promise<void> | Effect.Effect<void, unknown, never>;
1137
- interface FoundryLayerOptions<TConfigSchema extends z.ZodType | undefined = undefined> {
1138
- /** @deprecated File-routed definitions derive identity from their filename. */
1139
- readonly id?: string;
1140
- readonly description: string;
1141
- readonly config?: TConfigSchema;
1142
- /**
1143
- * Mount any Glove-native package or application concern onto the compiled
1144
- * runnable. Mesh, memory subagent composition, scratchpads, image surfaces,
1145
- * voice bridges and future Glove packages all fit through this seam.
1146
- */
1147
- readonly setup: (context: FoundrySurfaceContext & {
1148
- readonly config: TConfigSchema extends z.ZodType ? z.output<TConfigSchema> : unknown;
1149
- }) => Effect.Effect<void | FoundrySurfaceCleanup, unknown, never>;
1150
- }
1151
- type FoundryLayer<TConfigSchema extends z.ZodType | undefined = undefined> = Readonly<FoundryLayerOptions<TConfigSchema>> & {
1152
- readonly id: string;
1153
- readonly [FOUNDRY_LAYER_BRAND]: true;
1154
- };
1155
- declare function defineLayer<TConfigSchema extends z.ZodType | undefined = undefined>(options: FoundryLayerOptions<TConfigSchema>): FoundryLayer<TConfigSchema>;
1156
- interface FoundryLayerReference<TLayer extends FoundryLayer<any> = FoundryLayer<any>> {
1157
- readonly layer: TLayer;
1158
- readonly config?: TLayer extends FoundryLayer<infer TSchema> ? TSchema extends z.ZodType ? z.input<TSchema> : never : never;
1159
- }
1160
- type FoundryLayerSelection = FoundryLayerReference<any> | FoundryLayer<any>;
1161
- /** Select a configured layer with schema-inferred input. */
1162
- declare function configureLayer<TLayer extends FoundryLayer<any>>(layer: TLayer, config: FoundryLayerReference<TLayer>["config"]): FoundryLayerReference<TLayer>;
1163
- interface FoundrySubscriberOptions {
1164
- /** @deprecated File-routed definitions derive identity from their filename. */
1165
- readonly id?: string;
1166
- readonly description: string;
1167
- readonly create: SubscriberAdapter | ((context: FoundrySurfaceContext) => SubscriberAdapter | Promise<SubscriberAdapter> | Effect.Effect<SubscriberAdapter, unknown, never>);
1168
- }
1169
- type FoundrySubscriber = Readonly<FoundrySubscriberOptions> & {
1170
- readonly id: string;
1171
- readonly [FOUNDRY_SUBSCRIBER_BRAND]: true;
1172
- };
1173
- declare function defineSubscriber(options: FoundrySubscriberOptions): FoundrySubscriber;
1174
- type FoundrySubscriberSelection = FoundrySubscriber;
1175
- interface FoundryNativeRegistry {
1176
- readonly layers: ReadonlyArray<FoundryLayer<any>>;
1177
- readonly subscribers: ReadonlyArray<FoundrySubscriber>;
1178
- }
1179
- interface FoundryNativeManifestEntry {
1180
- readonly id: string;
1181
- readonly kind: "layer" | "subscriber";
1182
- readonly description: string;
1183
- readonly file?: string;
1184
- }
1185
- interface FoundryNativeManifest {
1186
- readonly layers: ReadonlyArray<FoundryNativeManifestEntry>;
1187
- readonly subscribers: ReadonlyArray<FoundryNativeManifestEntry>;
1188
- }
1189
- declare const EMPTY_NATIVE_REGISTRY: FoundryNativeRegistry;
1190
- declare function mountFoundrySurfaces(options: {
1191
- readonly registry: FoundryNativeRegistry;
1192
- readonly layers?: ReadonlyArray<FoundryLayerSelection>;
1193
- readonly subscribers?: ReadonlyArray<FoundrySubscriberSelection | SubscriberAdapter>;
1194
- readonly context: FoundrySurfaceContext;
1195
- }): Promise<() => Promise<void>>;
1196
- declare function isFoundryLayer(value: unknown): value is FoundryLayer;
1197
- declare function isFoundrySubscriber(value: unknown): value is FoundrySubscriber;
1198
-
1199
- type FoundryAgentComponent = FoundrySharedTool<any> | FoundryAgentApplication | FoundryMcp | FoundryMemoryProfile | FoundryLayer<any> | FoundrySubscriber;
1200
- /**
1201
- * A colocated `*.tool.ts` may export the Glove tool body directly. Foundry
1202
- * supplies the runtime tool name from the file route, so the authored module
1203
- * never has to repeat its identity as a string.
1204
- */
1205
- type FoundryToolBody = Omit<GloveFoldArgs<any>, "name">;
1206
- interface FoundryAgentComposition {
1207
- readonly capabilities: FoundryCapabilityRegistry;
1208
- readonly native: FoundryNativeRegistry;
1209
- }
1210
- type FoundryCompositionSource = FoundryAgentComponent | FoundryToolBody | FoundryAgentComposition | ReadonlyArray<FoundryCompositionSource> | (() => FoundryCompositionSource) | false | null | undefined;
1211
- /**
1212
- * Compose colocated, headless agent parts into one immutable catalogue.
1213
- * Functions are factories, not runtime installers: they return definitions and
1214
- * never receive or mutate a Glove instance.
1215
- */
1216
- declare function composeAgent(...sources: ReadonlyArray<FoundryCompositionSource>): FoundryAgentComposition;
1217
- declare const EMPTY_AGENT_COMPOSITION: FoundryAgentComposition;
1218
-
1219
1033
  /**
1220
1034
  * Put an agent on the mesh. Its peers are the other agent instances in its
1221
1035
  * workspace, found from data: a person's bots, a team's agents, whatever the
@@ -1238,11 +1052,32 @@ interface FoundryMeshOptions {
1238
1052
  }
1239
1053
  /** How an agent appears to its peers: from its instance data. */
1240
1054
  declare function meshIdentity(agent: AgentInstance): AgentIdentity;
1241
- type FoundryMeshThreadStatus = "working" | "waiting" | "replied" | "failed" | "cancelled";
1055
+ type FoundryMeshThreadStatus = "working" | "waiting" | "replied" | "failed" | "cancelled" | "taken-over";
1242
1056
  interface FoundryMeshParty {
1243
1057
  readonly agentId: string;
1244
1058
  readonly name: string;
1245
1059
  readonly definitionId: string;
1060
+ /** The party's workspace. Older records: the thread's `workspaceId`. */
1061
+ readonly workspaceId?: string;
1062
+ }
1063
+ /** A message the application's gate held or drafted: stored, not delivered. */
1064
+ interface FoundryMeshHeldMessage {
1065
+ readonly message: FoundryMeshMessage;
1066
+ readonly side: "recipient" | "starter";
1067
+ readonly decision: "hold" | "draft";
1068
+ /** The approval that decides a draft. */
1069
+ readonly approvalId?: string;
1070
+ /** What delivering it changes on the thread, such as a question the starter is now asked. */
1071
+ readonly onDeliver?: {
1072
+ readonly status?: FoundryMeshThreadStatus;
1073
+ readonly question?: string;
1074
+ readonly reply?: string;
1075
+ };
1076
+ }
1077
+ /** A message on its way: committed to the application's record (or about to be), not yet handed over. */
1078
+ interface FoundryMeshOutgoing {
1079
+ readonly message: FoundryMeshMessage;
1080
+ readonly side: "recipient" | "starter";
1246
1081
  }
1247
1082
  /**
1248
1083
  * A conversation between two agents. Its id is also the recipient's
@@ -1269,6 +1104,18 @@ interface FoundryMeshThread {
1269
1104
  /** The recipient's last reply. */
1270
1105
  readonly reply?: string;
1271
1106
  readonly error?: string;
1107
+ /** The application's record this thread is bound to (`mesh.bindThread`). Default: the thread id. */
1108
+ readonly record?: string;
1109
+ /** Messages the application's gate held or drafted, until they are released or discarded. */
1110
+ readonly held?: ReadonlyArray<FoundryMeshHeldMessage>;
1111
+ /** Messages being committed to the application's record and handed over. Retried at start. */
1112
+ readonly outbox?: ReadonlyArray<FoundryMeshOutgoing>;
1113
+ /** Who took the thread over, and which agents left it. */
1114
+ readonly takenOver?: {
1115
+ readonly by: string;
1116
+ readonly agentIds: ReadonlyArray<string>;
1117
+ readonly at: string;
1118
+ };
1272
1119
  /**
1273
1120
  * Older records only: messages not handed over yet, for the starter's
1274
1121
  * conversation and for this one. On start Foundry moves them to the event
@@ -1289,9 +1136,14 @@ interface FoundryMeshMessage {
1289
1136
  readonly kind: "message" | "reply" | "failed" | "ack";
1290
1137
  readonly id: string;
1291
1138
  readonly threadId: string;
1139
+ /**
1140
+ * Who sent it. For a person (`kind: "human"`, entered with
1141
+ * `runtime.meshHumanMessage`), `agentId` is the application's id for them.
1142
+ */
1292
1143
  readonly from: {
1293
1144
  readonly agentId: string;
1294
1145
  readonly name: string;
1146
+ readonly kind?: "agent" | "human";
1295
1147
  };
1296
1148
  readonly to: string;
1297
1149
  readonly content: string;
@@ -1326,6 +1178,119 @@ type FoundryMeshCommand = (MeshCommandBase & {
1326
1178
  readonly messageId: string;
1327
1179
  readonly note: string;
1328
1180
  });
1181
+ /** An agent the application lets a sender see. Name and description default to the instance's. */
1182
+ interface FoundryMeshPeer {
1183
+ readonly agentId: string;
1184
+ readonly name?: string;
1185
+ readonly description?: string;
1186
+ }
1187
+ /** What the application's hooks get besides their input. */
1188
+ interface FoundryMeshHookContext {
1189
+ readonly data: FoundryDataAdapter;
1190
+ /** The run that sent it, when an agent did. */
1191
+ readonly runId?: string;
1192
+ }
1193
+ /**
1194
+ * One message on its way, for the gate. The sender is the run's own
1195
+ * instance, checked by the controller: never what the model claimed.
1196
+ */
1197
+ interface FoundryMeshSend {
1198
+ /** "message": sent with glove_mesh_send_message. "reply": the recipient's final answer. "ack": a read receipt. */
1199
+ readonly kind: "message" | "reply" | "ack";
1200
+ /** Stable across retries. */
1201
+ readonly messageId: string;
1202
+ /** The thread it continues. Absent when it would start one. */
1203
+ readonly thread?: FoundryMeshThread;
1204
+ readonly sender: AgentInstance;
1205
+ /** The sender's conversation it was sent from. */
1206
+ readonly senderConversationId: string;
1207
+ readonly recipient: AgentInstance;
1208
+ readonly content: string;
1209
+ readonly inReplyTo?: string;
1210
+ }
1211
+ /**
1212
+ * What happens to a message. To the sender, "deliver", "hold" and "draft"
1213
+ * look the same. "refuse" fails the send with `message`, your wording.
1214
+ */
1215
+ type FoundryMeshDecision = {
1216
+ readonly decision: "deliver";
1217
+ }
1218
+ /** Stored, not delivered, until `runtime.releaseMeshMessage`. */
1219
+ | {
1220
+ readonly decision: "hold";
1221
+ }
1222
+ /**
1223
+ * Stored, not delivered, behind a Foundry approval: approved, it is
1224
+ * delivered; denied, it is dropped. Pass `approvalId` (`approval_<uuid>`)
1225
+ * to choose its id.
1226
+ */
1227
+ | {
1228
+ readonly decision: "draft";
1229
+ readonly approvalId?: string;
1230
+ } | {
1231
+ readonly decision: "refuse";
1232
+ readonly message: string;
1233
+ };
1234
+ /** A thread about to start, for the application to bind to its record. */
1235
+ interface FoundryMeshThreadStart {
1236
+ /** The id Foundry would use. */
1237
+ readonly proposedId: string;
1238
+ readonly sender: AgentInstance;
1239
+ readonly senderConversationId: string;
1240
+ readonly recipient: AgentInstance;
1241
+ readonly messageId: string;
1242
+ readonly content: string;
1243
+ }
1244
+ /** A message for the application's record, before it is delivered. */
1245
+ interface FoundryMeshRecordedMessage {
1246
+ readonly thread: FoundryMeshThread;
1247
+ readonly message: FoundryMeshMessage;
1248
+ /** The side it goes to. */
1249
+ readonly side: "recipient" | "starter";
1250
+ }
1251
+ type MeshResolvable<T> = T | Promise<T> | effect.Effect.Effect<T, unknown, never>;
1252
+ interface FoundryApplicationMesh {
1253
+ /**
1254
+ * Who `sender` can see and message, in any workspace. Replaces the
1255
+ * workspace's agents when set; a definition's own `mesh.peers` still
1256
+ * narrows it. Asked again for every list and every new thread, so a block
1257
+ * takes effect at once.
1258
+ */
1259
+ readonly peers?: (sender: AgentInstance, context: FoundryMeshHookContext) => MeshResolvable<ReadonlyArray<FoundryMeshPeer>>;
1260
+ /**
1261
+ * The gate, asked before every message is delivered: new threads, replies
1262
+ * in open threads (both ways), recipients' final answers and read
1263
+ * receipts. Default: deliver.
1264
+ */
1265
+ readonly authorize?: (send: FoundryMeshSend, context: FoundryMeshHookContext) => MeshResolvable<FoundryMeshDecision>;
1266
+ /**
1267
+ * Name a new thread after your record, such as your conversation id.
1268
+ * `threadId` is the recipient's conversation id in Foundry, so it is new
1269
+ * per direction; `record` (default `threadId`) is what `commit` gets.
1270
+ * Returning the id of a thread between the same two agents, in the same
1271
+ * direction, continues that thread.
1272
+ */
1273
+ readonly bindThread?: (start: FoundryMeshThreadStart, context: FoundryMeshHookContext) => MeshResolvable<{
1274
+ readonly threadId: string;
1275
+ readonly record?: string;
1276
+ }>;
1277
+ /**
1278
+ * Write a message to your record before it is delivered. Must be
1279
+ * idempotent on `message.id`: after a crash Foundry commits again, then
1280
+ * delivers. A person's message (`runtime.meshHumanMessage`) came from your
1281
+ * record and is not committed again.
1282
+ */
1283
+ readonly commit?: (recorded: FoundryMeshRecordedMessage, context: FoundryMeshHookContext) => MeshResolvable<{
1284
+ readonly recordId?: string;
1285
+ } | void>;
1286
+ /**
1287
+ * What a sender reads when Foundry itself refuses: an agent it cannot
1288
+ * reach, or a thread it was taken off. Default: "Your message could not be sent."
1289
+ */
1290
+ readonly refusal?: string;
1291
+ }
1292
+ /** The default wording when the application's mesh refuses a send. */
1293
+ declare const DEFAULT_MESH_REFUSAL = "Your message could not be sent.";
1329
1294
 
1330
1295
  declare const FOUNDRY_CORE_COMMAND_EVENT = "foundry.core.command";
1331
1296
  type FoundryCoreCommand = {
@@ -1422,55 +1387,351 @@ type FoundryCoreCommand = {
1422
1387
  readonly message: string;
1423
1388
  } | {
1424
1389
  readonly id: string;
1425
- readonly type: "background";
1390
+ readonly type: "background";
1391
+ readonly definitionId: string;
1392
+ readonly agentId: string;
1393
+ readonly conversationId: string;
1394
+ readonly workspaceId: string;
1395
+ readonly message: string;
1396
+ readonly payload?: unknown;
1397
+ readonly reconvene: boolean;
1398
+ } | {
1399
+ readonly id: string;
1400
+ readonly type: "transmit";
1401
+ readonly definitionId: string;
1402
+ readonly agentId: string;
1403
+ readonly conversationId: string;
1404
+ readonly workspaceId: string;
1405
+ readonly routeId: string;
1406
+ readonly payload: unknown;
1407
+ readonly observability?: unknown;
1408
+ readonly applicationId?: string;
1409
+ readonly transmissionId?: string;
1410
+ } | FoundryDelegationCommand | DurableMessageCommand | FoundryMeshCommand;
1411
+ /** Resolve an installed app's generated outbound tool without duplicating ids. */
1412
+ declare function installedApplicationTransmissionToolName(application: {
1413
+ readonly id: string;
1414
+ }, transmission: {
1415
+ readonly id: string;
1416
+ }): string;
1417
+ /**
1418
+ * Installed apps expose one namespaced Glove tool per outbound transmission.
1419
+ * The parent runtime remains authoritative for grants, credentials, and the
1420
+ * delivery adapter. A private request/result bridge returns the adapter's
1421
+ * validated output to the calling tool without moving those concerns into the
1422
+ * agent subprocess.
1423
+ */
1424
+ declare function createInstalledApplicationTransmissionTools(context: AgentAssemblyContext, applications: ReadonlyArray<FoundryAgentApplication>, installations: ReadonlyArray<AgentInstallation>, playbooks?: ReadonlyArray<AgentPlaybook>): ReadonlyArray<GloveFoldArgs<any>>;
1425
+ /** An application as the transmit tool sees it: its id and the transmissions it owns. */
1426
+ interface OutboundOwner {
1427
+ readonly id: string;
1428
+ readonly transmissions?: ReadonlyArray<AnyFoundryTransmission>;
1429
+ }
1430
+ /** Framework-owned orchestration tools. They emit commands for Foundry's runtime adapters. */
1431
+ declare function createFoundryCoreTools(context: AgentAssemblyContext, desiredSchedules?: Extract<FoundryCoreCommand, {
1432
+ readonly type: "schedule.sync";
1433
+ }>["schedules"], outbound?: {
1434
+ /** The playbooks resolved for this run. Default: the instance's stored ones. */
1435
+ readonly playbooks?: ReadonlyArray<AgentPlaybook>;
1436
+ /** The definition's applications, so the approval rule of a route's transmission applies. */
1437
+ readonly applications?: ReadonlyArray<OutboundOwner>;
1438
+ }): ReadonlyArray<GloveFoldArgs<any>>;
1439
+
1440
+ /**
1441
+ * Which of Foundry's built-in tools a run gets.
1442
+ *
1443
+ * Every run gets every built-in unless its definition says otherwise with
1444
+ * `builtins`. A policy is an allow list, a block list or a filter, and is
1445
+ * resolved per run, so it can depend on the conversation. Names may end in
1446
+ * `*` to match a prefix (`glove_foundry_*`, `glove_mesh_*`).
1447
+ *
1448
+ * A built-in a run did not get is withheld, not refused: the model never sees
1449
+ * it. The controller also refuses any command from that run that only a
1450
+ * withheld tool could have sent.
1451
+ */
1452
+
1453
+ /** What a built-in does, for filters that decide by kind rather than by name. */
1454
+ type FoundryBuiltinGroup = "scheduling" | "spawning" | "transmission" | "conversations" | "workspace" | "environment" | "delegation" | "messaging" | "mesh";
1455
+ interface FoundryBuiltinTool {
1456
+ readonly name: string;
1457
+ readonly group: FoundryBuiltinGroup;
1458
+ /** Reads or writes data shared by the whole workspace (or every conversation of the instance). */
1459
+ readonly workspaceWide: boolean;
1460
+ }
1461
+ declare const FOUNDRY_BUILTIN_TOOLS: ReadonlyArray<FoundryBuiltinTool>;
1462
+ declare function isFoundryBuiltin(name: string): boolean;
1463
+ /**
1464
+ * Which built-ins a run gets:
1465
+ *
1466
+ * - `["glove_foundry_schedule", "glove_mesh_*"]` or `{ allow: [...] }`: only
1467
+ * these. A built-in added in a later release stays off.
1468
+ * - `{ block: [...] }`: every built-in but these. A later built-in is on.
1469
+ * - `{ filter: (tool) => boolean }`: decide per tool, by name, group, or
1470
+ * whether it reaches workspace-wide data.
1471
+ *
1472
+ * Omitted, every built-in is on.
1473
+ */
1474
+ type FoundryBuiltinsPolicy = ReadonlyArray<string> | {
1475
+ readonly allow: ReadonlyArray<string>;
1476
+ } | {
1477
+ readonly block: ReadonlyArray<string>;
1478
+ } | {
1479
+ readonly filter: (tool: FoundryBuiltinTool) => boolean;
1480
+ };
1481
+ /** Whether a built-in is on under this policy. Names that are not built-ins are always on. */
1482
+ declare function builtinAllowed(policy: FoundryBuiltinsPolicy | undefined): (name: string) => boolean;
1483
+
1484
+ declare const FOUNDRY_WORKING_ENVIRONMENT_BRAND: unique symbol;
1485
+ declare const FOUNDRY_REPL_BRAND: unique symbol;
1486
+ type FoundryVfs = Vfs;
1487
+ type FoundryVfsHandle = EnvFsHandle;
1488
+ interface FoundryWorkingEnvironmentPersistenceContext {
1489
+ readonly definitionId: string;
1490
+ readonly agentId: string;
1491
+ readonly conversationId: string;
1492
+ readonly workspaceId: string;
1493
+ readonly runId: string;
1494
+ readonly data: FoundryDataAdapter;
1495
+ readonly signal: AbortSignal;
1496
+ }
1497
+ /**
1498
+ * Storage is deliberately adapter-owned. Foundry never chooses a database,
1499
+ * object store, locking policy, or credential lifecycle for an environment.
1500
+ */
1501
+ interface FoundryWorkingEnvironmentPersistenceAdapter {
1502
+ readonly identifier: string;
1503
+ readonly load: (context: FoundryWorkingEnvironmentPersistenceContext) => Resolvable<EnvSnapshot | null>;
1504
+ readonly save: (snapshot: EnvSnapshot, context: FoundryWorkingEnvironmentPersistenceContext) => Resolvable<void>;
1505
+ }
1506
+ interface FoundryWorkingEnvironmentCreateContext {
1507
+ readonly assembly: AgentAssemblyContext<FoundryRequest>;
1508
+ readonly snapshot: EnvSnapshot | null;
1509
+ }
1510
+ interface DefineFoundryWorkingEnvironmentOptions {
1511
+ /**
1512
+ * Build the native Glove environment. Use this when creation itself needs
1513
+ * custom logic. The loaded snapshot is provided but never applied implicitly.
1514
+ */
1515
+ readonly create?: (context: FoundryWorkingEnvironmentCreateContext) => Resolvable<WorkingEnvironment>;
1516
+ /**
1517
+ * Native environment options. When persistence returns a snapshot and no
1518
+ * filesystem is supplied, Foundry restores that snapshot automatically.
1519
+ */
1520
+ readonly options?: CreateWorkingEnvironmentOptions | ((context: FoundryWorkingEnvironmentCreateContext) => Resolvable<CreateWorkingEnvironmentOptions>);
1521
+ readonly persistence?: FoundryWorkingEnvironmentPersistenceAdapter;
1522
+ /** Native mount behavior: prompt priming and optional tool prefix. */
1523
+ readonly mount?: Omit<MountWorkingEnvironmentConfig, "env">;
1524
+ /** Close worker/adaptor resources after the run. Default true. */
1525
+ readonly close?: boolean;
1526
+ }
1527
+ type FoundryWorkingEnvironmentDefinition = Readonly<DefineFoundryWorkingEnvironmentOptions> & {
1528
+ readonly [FOUNDRY_WORKING_ENVIRONMENT_BRAND]: true;
1529
+ };
1530
+ declare function defineWorkingEnvironment(options?: DefineFoundryWorkingEnvironmentOptions): FoundryWorkingEnvironmentDefinition;
1531
+ /**
1532
+ * Convenience persistence over the configured FoundryDataAdapter's private
1533
+ * snapshot seam. VFS contents never become public workspace entries.
1534
+ * Scope "agent" (default) keeps one snapshot per instance, "conversation" one
1535
+ * per conversation, and "workspace" one shared by every agent in the
1536
+ * workspace. Saves replace the snapshot, so with "workspace" the last run to
1537
+ * finish wins; give agents that write at the same time a live machine instead.
1538
+ */
1539
+ declare function foundryDataEnvironmentPersistence(options?: {
1540
+ readonly scope?: "agent" | "conversation" | "workspace";
1541
+ }): FoundryWorkingEnvironmentPersistenceAdapter;
1542
+ interface FoundryReplBase {
1543
+ readonly [FOUNDRY_REPL_BRAND]: true;
1544
+ /**
1545
+ * Project an explicit set of the fully assembled agent's tools into the
1546
+ * sandbox as ordinary functions. Selection happens after applications,
1547
+ * installed capabilities, memory, mesh, calls, and `configure` have mounted.
1548
+ *
1549
+ * Returning the actual tool values keeps code relationships referential;
1550
+ * Foundry never accepts a second list of copied string ids here.
1551
+ */
1552
+ readonly programmaticTools?: FoundryProgrammaticTools;
1553
+ }
1554
+ interface FoundryProgrammaticToolSelection {
1555
+ /** One of the exact live tools supplied to the selector context. */
1556
+ readonly tool: Tool<unknown>;
1557
+ /** Optional valid interpreter identifier when the tool name is unsuitable. */
1558
+ readonly name?: string;
1559
+ /** Informational effect hint used by capability discovery. */
1560
+ readonly readOnly?: boolean;
1561
+ /** Optional capability group used by progressive discovery. */
1562
+ readonly server?: string;
1563
+ readonly serverDescription?: string;
1564
+ readonly resultShape?: string;
1565
+ }
1566
+ /** An installed app, with its live tools ready to select into the REPL. */
1567
+ interface FoundryReplApp {
1568
+ readonly id: string;
1569
+ readonly description: string;
1570
+ readonly accountId?: string;
1571
+ /** Each tool grouped under the app, named for code, and marked when it only reads. */
1572
+ readonly tools: ReadonlyArray<FoundryProgrammaticToolSelection>;
1573
+ }
1574
+ interface FoundryProgrammaticToolContext {
1575
+ readonly assembly: AgentAssemblyContext<FoundryRequest>;
1576
+ readonly glove: IGloveRunnable;
1577
+ /** Snapshot of every tool mounted before the programmatic surface itself. */
1578
+ readonly tools: ReadonlyArray<Tool<unknown>>;
1579
+ /** The apps installed on this agent, one group per app. */
1580
+ readonly apps: ReadonlyArray<FoundryReplApp>;
1581
+ readonly workingEnvironment?: WorkingEnvironment;
1582
+ readonly vfs?: EnvFsHandle;
1583
+ }
1584
+ interface FoundryProgrammaticTools {
1585
+ /**
1586
+ * Select direct live tool references. A selection may decorate its callable
1587
+ * name and discovery metadata without replacing the underlying capability.
1588
+ */
1589
+ readonly select: (context: FoundryProgrammaticToolContext) => Resolvable<ReadonlyArray<Tool<unknown> | FoundryProgrammaticToolSelection>>;
1590
+ /** Total underlying calls permitted during this assembled run. Default 50. */
1591
+ readonly maxCalls?: number;
1592
+ /**
1593
+ * Keep selected tools in the model's direct tool list as well. Default true.
1594
+ * Pass false to reach them only from code, which keeps a large app
1595
+ * catalogue out of context. A tool that needs approval always stays direct.
1596
+ */
1597
+ readonly keepDirect?: boolean;
1598
+ }
1599
+ type FoundryJavaScriptReplDefinition = FoundryReplBase & Readonly<{
1600
+ readonly language: "javascript";
1601
+ readonly session: JsSession;
1602
+ readonly mount?: Omit<MountJsConfig, "session">;
1603
+ }>;
1604
+ type FoundryPythonReplDefinition = FoundryReplBase & Readonly<{
1605
+ readonly language: "python";
1606
+ readonly session: PySession;
1607
+ readonly mount?: Omit<MountPyConfig, "session">;
1608
+ }>;
1609
+ type FoundryLispReplDefinition = FoundryReplBase & Readonly<{
1610
+ readonly language: "lisp";
1611
+ readonly session: LispSession;
1612
+ readonly mount?: Omit<MountLispConfig, "session">;
1613
+ }>;
1614
+ type FoundryReplDefinition = FoundryJavaScriptReplDefinition | FoundryPythonReplDefinition | FoundryLispReplDefinition;
1615
+ type DefineFoundryReplOptions = Omit<FoundryJavaScriptReplDefinition, typeof FOUNDRY_REPL_BRAND> | Omit<FoundryPythonReplDefinition, typeof FOUNDRY_REPL_BRAND> | Omit<FoundryLispReplDefinition, typeof FOUNDRY_REPL_BRAND>;
1616
+ declare function defineRepl(options: DefineFoundryReplOptions): FoundryReplDefinition;
1617
+ type FoundryMountedRepl = Readonly<{
1618
+ readonly language: "javascript";
1619
+ readonly session: JsSession;
1620
+ }> | Readonly<{
1621
+ readonly language: "python";
1622
+ readonly session: PySession;
1623
+ }> | Readonly<{
1624
+ readonly language: "lisp";
1625
+ readonly session: LispSession;
1626
+ }>;
1627
+
1628
+ declare const FOUNDRY_LAYER_BRAND: unique symbol;
1629
+ declare const FOUNDRY_SUBSCRIBER_BRAND: unique symbol;
1630
+ interface FoundrySurfaceContext<TInput = unknown> {
1426
1631
  readonly definitionId: string;
1427
1632
  readonly agentId: string;
1428
1633
  readonly conversationId: string;
1429
1634
  readonly workspaceId: string;
1430
- readonly message: string;
1431
- readonly payload?: unknown;
1432
- readonly reconvene: boolean;
1433
- } | {
1635
+ readonly runId: string;
1636
+ readonly input: TInput;
1637
+ readonly request: FoundryRequest;
1638
+ readonly message: Message;
1639
+ readonly messageInput: FoundryMessageInput;
1640
+ readonly messageText: string;
1641
+ readonly history: ReadonlyArray<Message>;
1642
+ readonly messages: ReadonlyArray<Message>;
1643
+ readonly glove: IGloveRunnable;
1644
+ readonly workingEnvironment?: WorkingEnvironment;
1645
+ readonly vfs?: FoundryVfsHandle;
1646
+ readonly repl?: FoundryMountedRepl;
1647
+ readonly signal: AbortSignal;
1648
+ readonly emit: (event: {
1649
+ type: string;
1650
+ data?: unknown;
1651
+ }) => void;
1652
+ }
1653
+ type FoundrySurfaceCleanup = () => void | Promise<void> | Effect.Effect<void, unknown, never>;
1654
+ interface FoundryLayerOptions<TConfigSchema extends z.ZodType | undefined = undefined> {
1655
+ /** @deprecated File-routed definitions derive identity from their filename. */
1656
+ readonly id?: string;
1657
+ readonly description: string;
1658
+ readonly config?: TConfigSchema;
1659
+ /**
1660
+ * Mount any Glove-native package or application concern onto the compiled
1661
+ * runnable. Mesh, memory subagent composition, scratchpads, image surfaces,
1662
+ * voice bridges and future Glove packages all fit through this seam.
1663
+ */
1664
+ readonly setup: (context: FoundrySurfaceContext & {
1665
+ readonly config: TConfigSchema extends z.ZodType ? z.output<TConfigSchema> : unknown;
1666
+ }) => Effect.Effect<void | FoundrySurfaceCleanup, unknown, never>;
1667
+ }
1668
+ type FoundryLayer<TConfigSchema extends z.ZodType | undefined = undefined> = Readonly<FoundryLayerOptions<TConfigSchema>> & {
1434
1669
  readonly id: string;
1435
- readonly type: "transmit";
1436
- readonly definitionId: string;
1437
- readonly agentId: string;
1438
- readonly conversationId: string;
1439
- readonly workspaceId: string;
1440
- readonly routeId: string;
1441
- readonly payload: unknown;
1442
- readonly observability?: unknown;
1443
- readonly applicationId?: string;
1444
- readonly transmissionId?: string;
1445
- } | FoundryDelegationCommand | DurableMessageCommand | FoundryMeshCommand;
1446
- /** Resolve an installed app's generated outbound tool without duplicating ids. */
1447
- declare function installedApplicationTransmissionToolName(application: {
1670
+ readonly [FOUNDRY_LAYER_BRAND]: true;
1671
+ };
1672
+ declare function defineLayer<TConfigSchema extends z.ZodType | undefined = undefined>(options: FoundryLayerOptions<TConfigSchema>): FoundryLayer<TConfigSchema>;
1673
+ interface FoundryLayerReference<TLayer extends FoundryLayer<any> = FoundryLayer<any>> {
1674
+ readonly layer: TLayer;
1675
+ readonly config?: TLayer extends FoundryLayer<infer TSchema> ? TSchema extends z.ZodType ? z.input<TSchema> : never : never;
1676
+ }
1677
+ type FoundryLayerSelection = FoundryLayerReference<any> | FoundryLayer<any>;
1678
+ /** Select a configured layer with schema-inferred input. */
1679
+ declare function configureLayer<TLayer extends FoundryLayer<any>>(layer: TLayer, config: FoundryLayerReference<TLayer>["config"]): FoundryLayerReference<TLayer>;
1680
+ interface FoundrySubscriberOptions {
1681
+ /** @deprecated File-routed definitions derive identity from their filename. */
1682
+ readonly id?: string;
1683
+ readonly description: string;
1684
+ readonly create: SubscriberAdapter | ((context: FoundrySurfaceContext) => SubscriberAdapter | Promise<SubscriberAdapter> | Effect.Effect<SubscriberAdapter, unknown, never>);
1685
+ }
1686
+ type FoundrySubscriber = Readonly<FoundrySubscriberOptions> & {
1448
1687
  readonly id: string;
1449
- }, transmission: {
1688
+ readonly [FOUNDRY_SUBSCRIBER_BRAND]: true;
1689
+ };
1690
+ declare function defineSubscriber(options: FoundrySubscriberOptions): FoundrySubscriber;
1691
+ type FoundrySubscriberSelection = FoundrySubscriber;
1692
+ interface FoundryNativeRegistry {
1693
+ readonly layers: ReadonlyArray<FoundryLayer<any>>;
1694
+ readonly subscribers: ReadonlyArray<FoundrySubscriber>;
1695
+ }
1696
+ interface FoundryNativeManifestEntry {
1450
1697
  readonly id: string;
1451
- }): string;
1698
+ readonly kind: "layer" | "subscriber";
1699
+ readonly description: string;
1700
+ readonly file?: string;
1701
+ }
1702
+ interface FoundryNativeManifest {
1703
+ readonly layers: ReadonlyArray<FoundryNativeManifestEntry>;
1704
+ readonly subscribers: ReadonlyArray<FoundryNativeManifestEntry>;
1705
+ }
1706
+ declare const EMPTY_NATIVE_REGISTRY: FoundryNativeRegistry;
1707
+ declare function mountFoundrySurfaces(options: {
1708
+ readonly registry: FoundryNativeRegistry;
1709
+ readonly layers?: ReadonlyArray<FoundryLayerSelection>;
1710
+ readonly subscribers?: ReadonlyArray<FoundrySubscriberSelection | SubscriberAdapter>;
1711
+ readonly context: FoundrySurfaceContext;
1712
+ }): Promise<() => Promise<void>>;
1713
+ declare function isFoundryLayer(value: unknown): value is FoundryLayer;
1714
+ declare function isFoundrySubscriber(value: unknown): value is FoundrySubscriber;
1715
+
1716
+ type FoundryAgentComponent = FoundrySharedTool<any> | FoundryAgentApplication | FoundryMcp | FoundryMemoryProfile | FoundryLayer<any> | FoundrySubscriber;
1452
1717
  /**
1453
- * Installed apps expose one namespaced Glove tool per outbound transmission.
1454
- * The parent runtime remains authoritative for grants, credentials, and the
1455
- * delivery adapter. A private request/result bridge returns the adapter's
1456
- * validated output to the calling tool without moving those concerns into the
1457
- * agent subprocess.
1718
+ * A colocated `*.tool.ts` may export the Glove tool body directly. Foundry
1719
+ * supplies the runtime tool name from the file route, so the authored module
1720
+ * never has to repeat its identity as a string.
1458
1721
  */
1459
- declare function createInstalledApplicationTransmissionTools(context: AgentAssemblyContext, applications: ReadonlyArray<FoundryAgentApplication>, installations: ReadonlyArray<AgentInstallation>, playbooks?: ReadonlyArray<AgentPlaybook>): ReadonlyArray<GloveFoldArgs<any>>;
1460
- /** An application as the transmit tool sees it: its id and the transmissions it owns. */
1461
- interface OutboundOwner {
1462
- readonly id: string;
1463
- readonly transmissions?: ReadonlyArray<AnyFoundryTransmission>;
1722
+ type FoundryToolBody = Omit<GloveFoldArgs<any>, "name">;
1723
+ interface FoundryAgentComposition {
1724
+ readonly capabilities: FoundryCapabilityRegistry;
1725
+ readonly native: FoundryNativeRegistry;
1464
1726
  }
1465
- /** Framework-owned orchestration tools. They emit commands for Foundry's runtime adapters. */
1466
- declare function createFoundryCoreTools(context: AgentAssemblyContext, desiredSchedules?: Extract<FoundryCoreCommand, {
1467
- readonly type: "schedule.sync";
1468
- }>["schedules"], outbound?: {
1469
- /** The playbooks resolved for this run. Default: the instance's stored ones. */
1470
- readonly playbooks?: ReadonlyArray<AgentPlaybook>;
1471
- /** The definition's applications, so the approval rule of a route's transmission applies. */
1472
- readonly applications?: ReadonlyArray<OutboundOwner>;
1473
- }): ReadonlyArray<GloveFoldArgs<any>>;
1727
+ type FoundryCompositionSource = FoundryAgentComponent | FoundryToolBody | FoundryAgentComposition | ReadonlyArray<FoundryCompositionSource> | (() => FoundryCompositionSource) | false | null | undefined;
1728
+ /**
1729
+ * Compose colocated, headless agent parts into one immutable catalogue.
1730
+ * Functions are factories, not runtime installers: they return definitions and
1731
+ * never receive or mutate a Glove instance.
1732
+ */
1733
+ declare function composeAgent(...sources: ReadonlyArray<FoundryCompositionSource>): FoundryAgentComposition;
1734
+ declare const EMPTY_AGENT_COMPOSITION: FoundryAgentComposition;
1474
1735
 
1475
1736
  /** Conversation isolation is the default. Instance scope deliberately shares conversations. */
1476
1737
  type FoundryGuidanceScope = "conversation" | "instance";
@@ -1629,6 +1890,20 @@ interface FoundryExecutionContext<TInput = unknown> extends FoundrySurfaceContex
1629
1890
  * listening; anything that arrives after it goes to that turn, or to a new run.
1630
1891
  */
1631
1892
  readonly onMeshMessage: (handler: (messages: ReadonlyArray<FoundryMeshMessage>) => void | Promise<void>) => () => Promise<void>;
1893
+ /**
1894
+ * Take addressed events (agent messages and transmissions, not delegation,
1895
+ * mesh or approval deliveries) inside this run, one at a time, with explicit
1896
+ * acknowledgement. The handler gets the events that started the run and any
1897
+ * that arrive while it is registered, optionally only those `match` accepts.
1898
+ * Only `event.ack()` consumes one: registering, returning, or the run ending
1899
+ * does not. An event the handler did not acknowledge stays pending: one that
1900
+ * arrived mid-run goes back to the runtime when the run ends, and one that
1901
+ * started the run is in the next run's events. The returned function stops
1902
+ * taking events and waits for handler calls still running.
1903
+ */
1904
+ readonly onEvent: (handler: (event: FoundryHandledEvent) => void | Promise<void>, match?: (event: glove_core.AgentEvent) => boolean) => () => Promise<void>;
1905
+ /** True when this run was started for addressed events rather than a message of its own. */
1906
+ readonly eventTurn?: boolean;
1632
1907
  }
1633
1908
  interface AgentHandlerContext<TInput = unknown> extends FoundryExecutionContext<TInput> {
1634
1909
  /** Run the standard Glove loop, optionally with a handler-enriched message. */
@@ -1666,7 +1941,25 @@ interface AgentAssemblyOptions<TInput = unknown> {
1666
1941
  */
1667
1942
  readonly delegates?: FoundryListResolver<FoundryDelegate, TInput>;
1668
1943
  readonly durableSubagents?: DurableSubagents;
1944
+ /**
1945
+ * Which of Foundry's built-in tools this run gets, resolved per run like
1946
+ * `tools`: an allow list (`["glove_foundry_schedule", "glove_mesh_*"]` or
1947
+ * `{ allow }`), a block list (`{ block }`) or `{ filter: (tool) => boolean }`.
1948
+ * Omitted, every built-in is on. A withheld built-in is never shown to the
1949
+ * model, and the controller refuses commands only it could have sent.
1950
+ */
1951
+ readonly builtins?: FoundryResolver<FoundryBuiltinsPolicy, TInput>;
1669
1952
  readonly eventDelivery?: FoundryEventPolicy;
1953
+ /**
1954
+ * Read current facts for an addressed event (an agent message or a
1955
+ * transmission) just before a text turn sees it, whether it starts the run
1956
+ * or joins a turn already going. Return `{ say }` to give the turn fresh
1957
+ * text in place of the event's content, or `{ suppress }` when nothing is
1958
+ * due any more: the event is then finished with and the turn never sees it.
1959
+ * Throwing withholds it: the turn does not see it, it is not acknowledged,
1960
+ * and the next attempt prepares it again.
1961
+ */
1962
+ readonly prepareEvent?: (event: glove_core.AgentEvent, context: FoundryEventPreparationContext) => FoundryEventPreparation | Promise<FoundryEventPreparation>;
1670
1963
  /**
1671
1964
  * When this agent works on a delegated task, how long glove_foundry_ask
1672
1965
  * waits in the same run for an answer before the run suspends. Default 90s.
@@ -1791,6 +2084,8 @@ interface FoundryAgentConventionModule {
1791
2084
  readonly delegates?: AgentAssemblyOptions["delegates"];
1792
2085
  readonly durableSubagents?: DurableSubagents;
1793
2086
  readonly eventDelivery?: FoundryEventPolicy;
2087
+ readonly prepareEvent?: AgentAssemblyOptions["prepareEvent"];
2088
+ readonly builtins?: AgentAssemblyOptions["builtins"];
1794
2089
  readonly answerWaitMs?: number;
1795
2090
  readonly memory?: AgentAssemblyOptions["memory"];
1796
2091
  readonly goals?: AgentAssemblyOptions["goals"];
@@ -2163,6 +2458,19 @@ interface FoundryDataAdapter {
2163
2458
  putScheduleOccurrence?(occurrence: FoundryScheduleOccurrence): Effect.Effect<void, unknown, never>;
2164
2459
  getScheduleOccurrence?(id: string): Effect.Effect<FoundryScheduleOccurrence | null, unknown, never>;
2165
2460
  listScheduleOccurrences?(filter?: FoundryScheduleOccurrenceFilter): Effect.Effect<ReadonlyArray<FoundryScheduleOccurrence>, unknown, never>;
2461
+ /**
2462
+ * Event delivery receipts (optional). A handler that tells someone about an
2463
+ * event (a voice call speaking it) records here whether it was never tried,
2464
+ * possibly sent, accepted by the provider, suppressed, or handed to a late
2465
+ * chat effect, so a redelivery after a crash never says it twice. Kept apart
2466
+ * from workspace entries: agent workspace tools cannot read or change them.
2467
+ * `claimEventReceipt` is an atomic insert-if-absent by `id`. Without these,
2468
+ * receipts last only as long as the process that wrote them.
2469
+ */
2470
+ claimEventReceipt?(receipt: FoundryEventReceipt): Effect.Effect<boolean, unknown, never>;
2471
+ putEventReceipt?(receipt: FoundryEventReceipt): Effect.Effect<void, unknown, never>;
2472
+ getEventReceipt?(id: string): Effect.Effect<FoundryEventReceipt | null, unknown, never>;
2473
+ listEventReceipts?(filter?: FoundryEventReceiptFilter): Effect.Effect<ReadonlyArray<FoundryEventReceipt>, unknown, never>;
2166
2474
  getActivation(id: string): Effect.Effect<FoundryActivationRecord | null, unknown, never>;
2167
2475
  putActivation(activation: FoundryActivationRecord): Effect.Effect<void, unknown, never>;
2168
2476
  listActivations(workspaceId?: string): Effect.Effect<ReadonlyArray<FoundryActivationRecord>, unknown, never>;
@@ -2219,6 +2527,8 @@ declare function toGloveRequestInput(input: FoundryMessageInput): string | Conte
2219
2527
  interface FoundryResult {
2220
2528
  /** Internal event receipts, acknowledged by the controller only after successful completion. */
2221
2529
  readonly consumedEventIds?: ReadonlyArray<string>;
2530
+ /** Events this run withheld because preparing them failed; the runtime retries them after a delay. */
2531
+ readonly retryEventIds?: ReadonlyArray<string>;
2222
2532
  readonly status: "completed" | "suspended";
2223
2533
  readonly value: unknown;
2224
2534
  readonly agentId: string;
@@ -2294,6 +2604,7 @@ declare class MemoryFoundryDataAdapter implements FoundryDataAdapter {
2294
2604
  private readonly approvals;
2295
2605
  private readonly activations;
2296
2606
  private readonly occurrences;
2607
+ private readonly receipts;
2297
2608
  private readonly conversations;
2298
2609
  private readonly workspace;
2299
2610
  private readonly workingEnvironments;
@@ -2328,6 +2639,10 @@ declare class MemoryFoundryDataAdapter implements FoundryDataAdapter {
2328
2639
  claimEvent(record: FoundryEventRecord): Effect.Effect<boolean, never, never>;
2329
2640
  putEvent(record: FoundryEventRecord): Effect.Effect<void, never, never>;
2330
2641
  listEvents(): Effect.Effect<FoundryEventRecord[], never, never>;
2642
+ claimEventReceipt(receipt: FoundryEventReceipt): Effect.Effect<boolean, never, never>;
2643
+ putEventReceipt(receipt: FoundryEventReceipt): Effect.Effect<void, never, never>;
2644
+ getEventReceipt(id: string): Effect.Effect<FoundryEventReceipt | null, never, never>;
2645
+ listEventReceipts(filter?: FoundryEventReceiptFilter): Effect.Effect<FoundryEventReceipt[], never, never>;
2331
2646
  claimScheduleOccurrence(occurrence: FoundryScheduleOccurrence): Effect.Effect<boolean, never, never>;
2332
2647
  putScheduleOccurrence(occurrence: FoundryScheduleOccurrence): Effect.Effect<void, never, never>;
2333
2648
  getScheduleOccurrence(id: string): Effect.Effect<FoundryScheduleOccurrence | null, never, never>;
@@ -2479,6 +2794,8 @@ interface FoundryMeshDelivery {
2479
2794
  readonly kind: "mesh";
2480
2795
  readonly side: "recipient" | "starter";
2481
2796
  readonly message: FoundryMeshMessage;
2797
+ /** The agent on the other side, for a person's message that reaches the starter. */
2798
+ readonly peer?: string;
2482
2799
  }
2483
2800
  interface DelegationCommandBase {
2484
2801
  readonly id: string;
@@ -2531,5 +2848,41 @@ interface FoundryEventRecord {
2531
2848
  readonly runId?: string;
2532
2849
  readonly createdAt: string;
2533
2850
  }
2851
+ /**
2852
+ * An addressed event handed to a handler registered with `context.onEvent`.
2853
+ * Nothing acknowledges it but `ack()`: an event the handler did not finish
2854
+ * stays pending and is delivered again, to this conversation's next run.
2855
+ */
2856
+ interface FoundryHandledEvent {
2857
+ /** The event's journal id: the same on every redelivery. Key receipts and effects on it. */
2858
+ readonly id: string;
2859
+ /** The event as its sender wrote it. */
2860
+ readonly event: AgentEvent;
2861
+ /** True when the event started this run; false when it arrived while the run was going. */
2862
+ readonly initial: boolean;
2863
+ /** This event is finished with. The run reports it consumed; nothing else is. */
2864
+ ack(): void;
2865
+ }
2866
+ /**
2867
+ * What to do with an event about to be told, decided just before telling it.
2868
+ * `say`: the current facts to tell, freshly read. `suppress`: nothing is due
2869
+ * any more (cancelled, moved, too late); the event is finished with silently.
2870
+ * Throwing tells nothing and keeps the event for a later attempt.
2871
+ */
2872
+ type FoundryEventPreparation = {
2873
+ readonly say: string;
2874
+ } | {
2875
+ readonly suppress: string;
2876
+ };
2877
+ interface FoundryEventPreparationContext {
2878
+ readonly runId: string;
2879
+ readonly definitionId: string;
2880
+ readonly agentId: string;
2881
+ readonly conversationId: string;
2882
+ readonly workspaceId: string;
2883
+ /** The event's journal id. */
2884
+ readonly eventRecordId: string;
2885
+ readonly signal: AbortSignal;
2886
+ }
2534
2887
 
2535
- export { type AppRestrictions as $, type AgentHandlerContext as A, AccountSummary as B, type Conversation as C, type AgentApplicationContribution as D, type EnvironmentValue as E, type FoundryDelegationUpdate as F, type AgentApplicationInstallContext as G, type AgentApplicationOptions as H, type InboundDeliveryClaim as I, type AgentAssemblyContext as J, type AgentAssemblyOptions as K, AgentDefinitionId as L, type AgentDefinitionSurfaceContext as M, type AgentFactoryContext as N, OutboundRoute as O, type PlaybookSubscription as P, AgentId as Q, type AgentInstallContext as R, type SharedInboxItem as S, type AgentInstallation as T, type AgentInstallationKind as U, type AgentMessageReceipt as V, type WorkspaceEntry as W, type AgentPlaybookInput as X, type AgentProvisioningPolicy as Y, type AgentRuntimeControls as Z, type AnyFoundryAgent as _, type FoundryMeshMessage as a, type FoundryAgentDefinition as a$, type ApplicationConnectionContext as a0, type ApplicationConnectionState as a1, type ApplicationConnectionStatus as a2, BindingId as a3, BindingNotFound as a4, CapabilityId as a5, type ComposedAgentPlaybook as a6, type ComposedAgentPlaybookInput as a7, type ConnectionReceiveInput as a8, type CreateAgentInstanceOptions as a9, FOUNDRY_AGENT_DEFINITION_BRAND as aA, FOUNDRY_AGENT_FILE_ENV as aB, FOUNDRY_AGENT_ROUTE_ENV as aC, FOUNDRY_APPLICATION_ENV as aD, FOUNDRY_APPROVAL_DIRECTORY_ENV as aE, FOUNDRY_COMPOSED_PLAYBOOK_BRAND as aF, FOUNDRY_CONNECTION_BRAND as aG, FOUNDRY_CORE_COMMAND_EVENT as aH, FOUNDRY_EVENT_PREFIX as aI, FOUNDRY_EXECUTION_MARKER as aJ, FOUNDRY_LAYER_BRAND as aK, FOUNDRY_MCP_BRAND as aL, FOUNDRY_MEMORY_BRAND as aM, FOUNDRY_PLAYBOOK_ACTION_BRAND as aN, FOUNDRY_REPL_BRAND as aO, FOUNDRY_SCHEDULE_BRAND as aP, FOUNDRY_SHARED_TOOL_BRAND as aQ, FOUNDRY_SUBSCRIBER_BRAND as aR, FOUNDRY_TRANSMISSION_BRAND as aS, FOUNDRY_TRANSMISSION_EVENT_BRAND as aT, FOUNDRY_TRANSMISSION_PREDICATE_BRAND as aU, FOUNDRY_WORKING_ENVIRONMENT_BRAND as aV, type FoundryAccountSessionAdapter as aW, type FoundryAgent as aX, type FoundryAgentComponent as aY, type FoundryAgentComposition as aZ, type FoundryAgentConventionModule as a_, type CreateConversationOptions as aa, type CustomProvisionedAgent as ab, type CustomProvisioningContext as ac, DEFAULT_APPROVAL_EXPIRES_AFTER_MS as ad, DEFAULT_APPROVAL_WAIT_MS as ae, type DefineAgentOptions as af, type DefineConnectionOptions as ag, type DefineFoundryReplOptions as ah, type DefineFoundryScheduleOptions as ai, type DefineFoundrySubagentOptions as aj, type DefineFoundryWorkingEnvironmentOptions as ak, type DefinePlaybookSubscriptionOptions as al, type DefinitionConfigInput as am, type DurableSubagentOptions as an, type DurableSubagentOwnership as ao, type DurableSubagents as ap, EMPTY_AGENT_COMPOSITION as aq, EMPTY_CAPABILITY_REGISTRY as ar, EMPTY_NATIVE_REGISTRY as as, type EgressAdapter as at, type EgressContext as au, EventId as av, EventNotFound as aw, EventReference as ax, FOUNDRY_AGENT_APPLICATION_BRAND as ay, FOUNDRY_AGENT_BRAND as az, type FoundryDataAdapter as b, type FoundryProgrammaticToolContext as b$, type FoundryAgentMode as b0, type FoundryApp as b1, type FoundryAppMcp as b2, type FoundryAppMcpTool as b3, type FoundryAppToolDecision as b4, type FoundryApplicationConnection as b5, type FoundryApprovalDecision as b6, FoundryApprovalDisplayManager as b7, type FoundryApprovalPolicy as b8, type FoundryApprovalStatus as b9, type FoundryInstalledApp as bA, type FoundryInstanceProvisioner as bB, type FoundryJavaScriptReplDefinition as bC, type FoundryLayer as bD, type FoundryLayerOptions as bE, type FoundryLayerReference as bF, type FoundryLayerSelection as bG, type FoundryLispReplDefinition as bH, type FoundryListResolver as bI, type FoundryMcp as bJ, type FoundryMcpOptions as bK, type FoundryMemoryProfile as bL, type FoundryMemoryProfileOptions as bM, type FoundryMemoryReference as bN, type FoundryMemorySelection as bO, type FoundryMeshConfig as bP, type FoundryMeshOptions as bQ, type FoundryMeshParty as bR, type FoundryMeshThread as bS, type FoundryMeshThreadStatus as bT, type FoundryMessageInput as bU, type FoundryMessageOptions as bV, type FoundryMountedRepl as bW, type FoundryNativeManifest as bX, type FoundryNativeManifestEntry as bY, type FoundryNativeRegistry as bZ, type FoundryPlaybookAction as b_, type FoundryCall as ba, type FoundryCallContext as bb, type FoundryCallOptions as bc, type FoundryCapabilityKind as bd, type FoundryCapabilityManifest as be, type FoundryCapabilityManifestEntry as bf, type FoundryCapabilityRegistry as bg, type FoundryCompositionSource as bh, type FoundryContextProvider as bi, type FoundryCoreCommand as bj, type FoundryDelegate as bk, type FoundryDelegateOptions as bl, type FoundryDelegation as bm, type FoundryDelegationReply as bn, type FoundryDelegationStatus as bo, type FoundryDomainError as bp, type FoundryEventPolicy as bq, type FoundryEventTarget as br, type FoundryExecutionContext as bs, type FoundryFactsOptions as bt, type FoundryFormsOptions as bu, type FoundryGoalsOptions as bv, type FoundryGuidanceHandles as bw, type FoundryGuidanceScope as bx, type FoundryHookDefinition as by, type FoundryInstallable as bz, type AgentInstance as c, type TransmissionEventDirection as c$, type FoundryProgrammaticToolSelection as c0, type FoundryProgrammaticTools as c1, type FoundryPythonReplDefinition as c2, type FoundryReplApp as c3, type FoundryReplDefinition as c4, type FoundryRequest as c5, type FoundryResolvedMcp as c6, type FoundryResolver as c7, type FoundryResult as c8, type FoundryRouteMap as c9, type InferAgentOutput as cA, type InferInboundEvent as cB, type InferOutboundInput as cC, type InferOutboundOutput as cD, type IngressAdapter as cE, type IngressContext as cF, type InstallationSelection as cG, type McpAdapterFactory as cH, MemoryFoundryDataAdapter as cI, type OutboundContract as cJ, type PlaybookActionOptions as cK, type PlaybookDirective as cL, type PlaybookDirectiveInput as cM, type PlaybookMatch as cN, type PlaybookMatchInput as cO, type PlaybookOutboundDirective as cP, type PlaybookOutboundInput as cQ, type PlaybookSubscriptionTarget as cR, type PlaybookSubscriptionTargetInput as cS, ReplyPolicy as cT, Route as cU, RouteId as cV, RouteNotFound as cW, RunGrant as cX, RunId as cY, type SharedToolOptions as cZ, TopologyConflict as c_, type FoundryScheduleDefinition as ca, type FoundryScheduleMisfirePolicy as cb, type FoundryScheduleOccurrenceStatus as cc, type FoundryScheduleTiming as cd, type FoundryScheduleTimingInput as ce, type FoundrySharedTool as cf, type FoundrySubagentToolContext as cg, type FoundrySubscriber as ch, type FoundrySubscriberOptions as ci, type FoundrySubscriberSelection as cj, type FoundrySurfaceContext as ck, type FoundrySuspension as cl, type FoundryToolBody as cm, type FoundryTransmission as cn, type FoundryTransmissionDelivery as co, type FoundryTransmissionEvent as cp, type FoundryTransmissionPredicate as cq, type FoundryVfs as cr, type FoundryVfsHandle as cs, type FoundryWorkingEnvironmentCreateContext as ct, type FoundryWorkingEnvironmentDefinition as cu, type FoundryWorkingEnvironmentPersistenceAdapter as cv, type FoundryWorkingEnvironmentPersistenceContext as cw, GrantResolutionError as cx, type InboundContract as cy, type InferAgentInput as cz, type FoundryActivationRecord as d, mountFoundrySurfaces as d$, type TransmissionEventOptions as d0, TransmissionId as d1, type TransmissionOptions as d2, type TransmissionPredicateOptions as d3, type TransmissionSerializationContext as d4, type UpdateAgentInstanceOptions as d5, type UpdateConversationOptions as d6, activationScheduleRevision as d7, composeAgent as d8, composePlaybook as d9, defineSharedTool as dA, defineSubagent as dB, defineSubscriber as dC, defineTransmission as dD, defineTransmissionEvent as dE, defineTransmissionPredicate as dF, defineWorkingEnvironment as dG, foundryDataEnvironmentPersistence as dH, foundryGuidanceSubject as dI, hostedMeshOptions as dJ, install as dK, installRegistry as dL, installationKey as dM, installedApplicationTransmissionToolName as dN, internalAgentName as dO, isFoundryAgent as dP, isFoundryAgentDefinition as dQ, isFoundryCapability as dR, isFoundryLayer as dS, isFoundrySchedule as dT, isFoundrySubscriber as dU, isFoundryTransmission as dV, isInboxCapableStore as dW, isMeshTransport as dX, listFoundryApprovals as dY, meshIdentity as dZ, mountAgentDefinitionMemory as d_, configureLayer as da, configureMemory as db, createAgentInstance as dc, createConversation as dd, createFoundryApproval as de, createFoundryCoreTools as df, createInstalledApplicationTransmissionTools as dg, defineAgent as dh, defineAgentApplication as di, defineAgentFromModule as dj, defineAgentInstance as dk, defineApp as dl, defineCall as dm, defineConnection as dn, defineFacts as dp, defineForms as dq, defineGoals as dr, defineLayer as ds, defineMcp as dt, defineMemory as du, definePlaybookAction as dv, definePlaybookSubscription as dw, defineRepl as dx, defineRoutes as dy, defineSchedule as dz, type ProvisionAgentOptions as e, reconstructAgentInstance as e0, reconstructPlaybook as e1, reconstructPlaybookSubscription as e2, resolveFoundryApproval as e3, restrictApp as e4, routeFromInternalAgentName as e5, scheduleOccurrenceId as e6, scheduleRevisionMatches as e7, toGloveMessage as e8, toGloveRequestInput as e9, transmissionPredicate as ea, withFoundryPermissions as eb, type FoundryEventRecord as f, type FoundryScheduleOccurrence as g, type FoundryScheduleOccurrenceFilter as h, type FoundryPendingInbound as i, type FoundryApproval as j, type FoundryWorkingEnvironmentSnapshotOwner as k, type FoundryTask as l, type AgentPlaybook as m, type AnyFoundryTransmission as n, AccountReference as o, type InferAccountMetadata as p, AgentBinding as q, type FoundryAgentApplication as r, InboundRoute as s, type CapabilityDefinition as t, type InferInboundConfig as u, type InferOutboundConfig as v, type AccountContract as w, AccountId as x, AccountNotFound as y, AccountSessionUnavailable as z };
2888
+ export { type AgentProvisioningPolicy as $, type AgentHandlerContext as A, AccountId as B, type Conversation as C, AccountNotFound as D, type EnvironmentValue as E, type FoundryEventPreparation as F, AccountSessionUnavailable as G, AccountSummary as H, type InboundDeliveryClaim as I, type AgentApplicationContribution as J, type AgentApplicationInstallContext as K, type AgentApplicationOptions as L, type AgentAssemblyContext as M, type AgentAssemblyOptions as N, OutboundRoute as O, type PlaybookSubscription as P, AgentDefinitionId as Q, type AgentDefinitionSurfaceContext as R, type SharedInboxItem as S, type AgentFactoryContext as T, AgentId as U, type AgentInstallContext as V, type WorkspaceEntry as W, type AgentInstallation as X, type AgentInstallationKind as Y, type AgentMessageReceipt as Z, type AgentPlaybookInput as _, type FoundryEventReceipt as a, FOUNDRY_WORKING_ENVIRONMENT_BRAND as a$, type AgentRuntimeControls as a0, type AnyFoundryAgent as a1, type AppRestrictions as a2, type ApplicationConnectionContext as a3, type ApplicationConnectionState as a4, type ApplicationConnectionStatus as a5, BindingId as a6, BindingNotFound as a7, CapabilityId as a8, type ComposedAgentPlaybook as a9, EventNotFound as aA, type EventReceiptStore as aB, EventReference as aC, FOUNDRY_AGENT_APPLICATION_BRAND as aD, FOUNDRY_AGENT_BRAND as aE, FOUNDRY_AGENT_DEFINITION_BRAND as aF, FOUNDRY_AGENT_FILE_ENV as aG, FOUNDRY_AGENT_ROUTE_ENV as aH, FOUNDRY_APPLICATION_ENV as aI, FOUNDRY_APPROVAL_DIRECTORY_ENV as aJ, FOUNDRY_BUILTIN_TOOLS as aK, FOUNDRY_COMPOSED_PLAYBOOK_BRAND as aL, FOUNDRY_CONNECTION_BRAND as aM, FOUNDRY_CORE_COMMAND_EVENT as aN, FOUNDRY_EVENT_PREFIX as aO, FOUNDRY_EXECUTION_MARKER as aP, FOUNDRY_LAYER_BRAND as aQ, FOUNDRY_MCP_BRAND as aR, FOUNDRY_MEMORY_BRAND as aS, FOUNDRY_PLAYBOOK_ACTION_BRAND as aT, FOUNDRY_REPL_BRAND as aU, FOUNDRY_SCHEDULE_BRAND as aV, FOUNDRY_SHARED_TOOL_BRAND as aW, FOUNDRY_SUBSCRIBER_BRAND as aX, FOUNDRY_TRANSMISSION_BRAND as aY, FOUNDRY_TRANSMISSION_EVENT_BRAND as aZ, FOUNDRY_TRANSMISSION_PREDICATE_BRAND as a_, type ComposedAgentPlaybookInput as aa, type ConnectionReceiveInput as ab, type CreateAgentInstanceOptions as ac, type CreateConversationOptions as ad, type CustomProvisionedAgent as ae, type CustomProvisioningContext as af, DEFAULT_APPROVAL_EXPIRES_AFTER_MS as ag, DEFAULT_APPROVAL_WAIT_MS as ah, DEFAULT_MESH_REFUSAL as ai, type DefineAgentOptions as aj, type DefineConnectionOptions as ak, type DefineFoundryReplOptions as al, type DefineFoundryScheduleOptions as am, type DefineFoundrySubagentOptions as an, type DefineFoundryWorkingEnvironmentOptions as ao, type DefinePlaybookSubscriptionOptions as ap, type DefinitionConfigInput as aq, type DurableSubagentOptions as ar, type DurableSubagentOwnership as as, type DurableSubagents as at, EMPTY_AGENT_COMPOSITION as au, EMPTY_CAPABILITY_REGISTRY as av, EMPTY_NATIVE_REGISTRY as aw, type EgressAdapter as ax, type EgressContext as ay, EventId as az, type FoundryDelegationUpdate as b, type FoundryMemorySelection as b$, type FoundryAccountSessionAdapter as b0, type FoundryAgent as b1, type FoundryAgentComponent as b2, type FoundryAgentComposition as b3, type FoundryAgentConventionModule as b4, type FoundryAgentDefinition as b5, type FoundryAgentMode as b6, type FoundryApp as b7, type FoundryAppMcp as b8, type FoundryAppMcpTool as b9, type FoundryEventPolicy as bA, type FoundryEventPreparationContext as bB, type FoundryEventReceiptStatus as bC, type FoundryEventTarget as bD, type FoundryExecutionContext as bE, type FoundryFactsOptions as bF, type FoundryFormsOptions as bG, type FoundryGoalsOptions as bH, type FoundryGuidanceHandles as bI, type FoundryGuidanceScope as bJ, type FoundryHandledEvent as bK, type FoundryHookDefinition as bL, type FoundryInstallable as bM, type FoundryInstalledApp as bN, type FoundryInstanceProvisioner as bO, type FoundryJavaScriptReplDefinition as bP, type FoundryLayer as bQ, type FoundryLayerOptions as bR, type FoundryLayerReference as bS, type FoundryLayerSelection as bT, type FoundryLispReplDefinition as bU, type FoundryListResolver as bV, type FoundryMcp as bW, type FoundryMcpOptions as bX, type FoundryMemoryProfile as bY, type FoundryMemoryProfileOptions as bZ, type FoundryMemoryReference as b_, type FoundryAppToolDecision as ba, type FoundryApplicationConnection as bb, type FoundryApplicationMesh as bc, type FoundryApprovalDecision as bd, FoundryApprovalDisplayManager as be, type FoundryApprovalPolicy as bf, type FoundryApprovalStatus as bg, type FoundryBuiltinGroup as bh, type FoundryBuiltinTool as bi, type FoundryBuiltinsPolicy as bj, type FoundryCall as bk, type FoundryCallContext as bl, type FoundryCallOptions as bm, type FoundryCapabilityKind as bn, type FoundryCapabilityManifest as bo, type FoundryCapabilityManifestEntry as bp, type FoundryCapabilityRegistry as bq, type FoundryCompositionSource as br, type FoundryContextProvider as bs, type FoundryCoreCommand as bt, type FoundryDelegate as bu, type FoundryDelegateOptions as bv, type FoundryDelegation as bw, type FoundryDelegationReply as bx, type FoundryDelegationStatus as by, type FoundryDomainError as bz, type FoundryMeshMessage as c, type InstallationSelection as c$, type FoundryMeshConfig as c0, type FoundryMeshDecision as c1, type FoundryMeshHeldMessage as c2, type FoundryMeshHookContext as c3, type FoundryMeshOptions as c4, type FoundryMeshOutgoing as c5, type FoundryMeshParty as c6, type FoundryMeshPeer as c7, type FoundryMeshRecordedMessage as c8, type FoundryMeshSend as c9, type FoundrySharedTool as cA, type FoundrySubagentToolContext as cB, type FoundrySubscriber as cC, type FoundrySubscriberOptions as cD, type FoundrySubscriberSelection as cE, type FoundrySurfaceContext as cF, type FoundrySuspension as cG, type FoundryToolBody as cH, type FoundryTransmission as cI, type FoundryTransmissionDelivery as cJ, type FoundryTransmissionEvent as cK, type FoundryTransmissionPredicate as cL, type FoundryVfs as cM, type FoundryVfsHandle as cN, type FoundryWorkingEnvironmentCreateContext as cO, type FoundryWorkingEnvironmentDefinition as cP, type FoundryWorkingEnvironmentPersistenceAdapter as cQ, type FoundryWorkingEnvironmentPersistenceContext as cR, GrantResolutionError as cS, type InboundContract as cT, type InferAgentInput as cU, type InferAgentOutput as cV, type InferInboundEvent as cW, type InferOutboundInput as cX, type InferOutboundOutput as cY, type IngressAdapter as cZ, type IngressContext as c_, type FoundryMeshThread as ca, type FoundryMeshThreadStart as cb, type FoundryMeshThreadStatus as cc, type FoundryMessageInput as cd, type FoundryMessageOptions as ce, type FoundryMountedRepl as cf, type FoundryNativeManifest as cg, type FoundryNativeManifestEntry as ch, type FoundryNativeRegistry as ci, type FoundryPlaybookAction as cj, type FoundryProgrammaticToolContext as ck, type FoundryProgrammaticToolSelection as cl, type FoundryProgrammaticTools as cm, type FoundryPythonReplDefinition as cn, type FoundryReplApp as co, type FoundryReplDefinition as cp, type FoundryRequest as cq, type FoundryResolvedMcp as cr, type FoundryResolver as cs, type FoundryResult as ct, type FoundryRouteMap as cu, type FoundryScheduleDefinition as cv, type FoundryScheduleMisfirePolicy as cw, type FoundryScheduleOccurrenceStatus as cx, type FoundryScheduleTiming as cy, type FoundryScheduleTimingInput as cz, type FoundryDataAdapter as d, defineTransmissionPredicate as d$, type McpAdapterFactory as d0, MemoryFoundryDataAdapter as d1, type OutboundContract as d2, type PlaybookActionOptions as d3, type PlaybookDirective as d4, type PlaybookDirectiveInput as d5, type PlaybookMatch as d6, type PlaybookMatchInput as d7, type PlaybookOutboundDirective as d8, type PlaybookOutboundInput as d9, createConversation as dA, createFoundryApproval as dB, createFoundryCoreTools as dC, createInstalledApplicationTransmissionTools as dD, defineAgent as dE, defineAgentApplication as dF, defineAgentFromModule as dG, defineAgentInstance as dH, defineApp as dI, defineCall as dJ, defineConnection as dK, defineFacts as dL, defineForms as dM, defineGoals as dN, defineLayer as dO, defineMcp as dP, defineMemory as dQ, definePlaybookAction as dR, definePlaybookSubscription as dS, defineRepl as dT, defineRoutes as dU, defineSchedule as dV, defineSharedTool as dW, defineSubagent as dX, defineSubscriber as dY, defineTransmission as dZ, defineTransmissionEvent as d_, type PlaybookSubscriptionTarget as da, type PlaybookSubscriptionTargetInput as db, ReplyPolicy as dc, Route as dd, RouteId as de, RouteNotFound as df, RunGrant as dg, RunId as dh, type SharedToolOptions as di, TopologyConflict as dj, type TransmissionEventDirection as dk, type TransmissionEventOptions as dl, TransmissionId as dm, type TransmissionOptions as dn, type TransmissionPredicateOptions as dp, type TransmissionSerializationContext as dq, type UpdateAgentInstanceOptions as dr, type UpdateConversationOptions as ds, activationScheduleRevision as dt, builtinAllowed as du, composeAgent as dv, composePlaybook as dw, configureLayer as dx, configureMemory as dy, createAgentInstance as dz, type AgentInstance as e, defineWorkingEnvironment as e0, eventReceiptStore as e1, eventTranscriptMessageId as e2, foundryDataEnvironmentPersistence as e3, foundryGuidanceSubject as e4, hostedMeshOptions as e5, install as e6, installRegistry as e7, installationKey as e8, installedApplicationTransmissionToolName as e9, transmissionPredicate as eA, withFoundryPermissions as eB, internalAgentName as ea, isFoundryAgent as eb, isFoundryAgentDefinition as ec, isFoundryBuiltin as ed, isFoundryCapability as ee, isFoundryLayer as ef, isFoundrySchedule as eg, isFoundrySubscriber as eh, isFoundryTransmission as ei, isInboxCapableStore as ej, isMeshTransport as ek, lateChatEffectId as el, listFoundryApprovals as em, meshIdentity as en, mountAgentDefinitionMemory as eo, mountFoundrySurfaces as ep, reconstructAgentInstance as eq, reconstructPlaybook as er, reconstructPlaybookSubscription as es, resolveFoundryApproval as et, restrictApp as eu, routeFromInternalAgentName as ev, scheduleOccurrenceId as ew, scheduleRevisionMatches as ex, toGloveMessage as ey, toGloveRequestInput as ez, type FoundryActivationRecord as f, type ProvisionAgentOptions as g, type FoundryEventRecord as h, type FoundryEventReceiptFilter as i, type FoundryScheduleOccurrence as j, type FoundryScheduleOccurrenceFilter as k, type FoundryPendingInbound as l, type FoundryApproval as m, type FoundryWorkingEnvironmentSnapshotOwner as n, type FoundryTask as o, type AgentPlaybook as p, type AnyFoundryTransmission as q, AccountReference as r, type InferAccountMetadata as s, AgentBinding as t, type FoundryAgentApplication as u, InboundRoute as v, type CapabilityDefinition as w, type InferInboundConfig as x, type InferOutboundConfig as y, type AccountContract as z };