glove-foundry 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +7 -0
- package/README.md +220 -0
- package/THIRD_PARTY_NOTICES.md +28 -0
- package/dist/chunk-3GCUECPA.js +368 -0
- package/dist/chunk-CRWY7M66.js +3275 -0
- package/dist/chunk-UNHGCCSA.js +4211 -0
- package/dist/chunk-ZFNMFE3T.js +23 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +760 -0
- package/dist/client-CLkZREDr.d.ts +2186 -0
- package/dist/client.d.ts +14 -0
- package/dist/client.js +10 -0
- package/dist/config.d.ts +49 -0
- package/dist/config.js +8 -0
- package/dist/eslint.d.ts +122 -0
- package/dist/eslint.js +172 -0
- package/dist/execution-agent.d.ts +6 -0
- package/dist/execution-agent.js +23 -0
- package/dist/index.d.ts +103 -0
- package/dist/index.js +402 -0
- package/docs/README.md +13 -0
- package/docs/architecture.md +175 -0
- package/docs/building-with-foundry.md +403 -0
- package/docs/evaluation-checklist.md +89 -0
- package/docs/implementation-backlog.md +67 -0
- package/docs/inspector.md +56 -0
- package/package.json +92 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AccountDirectory,
|
|
3
|
+
AccountId,
|
|
4
|
+
AccountNotFound,
|
|
5
|
+
AccountReference,
|
|
6
|
+
AccountSessionUnavailable,
|
|
7
|
+
AccountSummary,
|
|
8
|
+
AgentBinding,
|
|
9
|
+
AgentDefinitionId,
|
|
10
|
+
AgentId,
|
|
11
|
+
BindingId,
|
|
12
|
+
BindingNotFound,
|
|
13
|
+
CapabilityId,
|
|
14
|
+
EMPTY_AGENT_COMPOSITION,
|
|
15
|
+
EventId,
|
|
16
|
+
EventNotFound,
|
|
17
|
+
EventReference,
|
|
18
|
+
EventStore,
|
|
19
|
+
FoundryApplicationManifest,
|
|
20
|
+
FoundryManifestCapability,
|
|
21
|
+
FoundryManifestTransmission,
|
|
22
|
+
FoundryRuntime,
|
|
23
|
+
FoundryRuntimeError,
|
|
24
|
+
FoundryServer,
|
|
25
|
+
GrantResolutionError,
|
|
26
|
+
GrantResolver,
|
|
27
|
+
InboundRoute,
|
|
28
|
+
ManifestCompilationError,
|
|
29
|
+
MemoryObservabilityAdapter,
|
|
30
|
+
OutboundRoute,
|
|
31
|
+
ReplyPolicy,
|
|
32
|
+
Route,
|
|
33
|
+
RouteId,
|
|
34
|
+
RouteNotFound,
|
|
35
|
+
RunGrant,
|
|
36
|
+
RunId,
|
|
37
|
+
TopologyConflict,
|
|
38
|
+
TopologyStore,
|
|
39
|
+
TransmissionId,
|
|
40
|
+
compileApplicationManifest,
|
|
41
|
+
composeAgent,
|
|
42
|
+
grantResolverLive,
|
|
43
|
+
memoryAccountDirectory,
|
|
44
|
+
memoryEventStore,
|
|
45
|
+
memoryTopologyStore,
|
|
46
|
+
serializeInboundTransmissionXml,
|
|
47
|
+
writeGeneratedTypes
|
|
48
|
+
} from "./chunk-UNHGCCSA.js";
|
|
49
|
+
import {
|
|
50
|
+
FoundryClient,
|
|
51
|
+
FoundryRunHandle,
|
|
52
|
+
createFoundryClient
|
|
53
|
+
} from "./chunk-3GCUECPA.js";
|
|
54
|
+
import {
|
|
55
|
+
defineConfig
|
|
56
|
+
} from "./chunk-ZFNMFE3T.js";
|
|
57
|
+
import {
|
|
58
|
+
EMPTY_CAPABILITY_REGISTRY,
|
|
59
|
+
EMPTY_FOUNDRY_APPLICATION,
|
|
60
|
+
EMPTY_NATIVE_REGISTRY,
|
|
61
|
+
FOUNDRY_AGENT_APPLICATION_BRAND,
|
|
62
|
+
FOUNDRY_AGENT_BRAND,
|
|
63
|
+
FOUNDRY_AGENT_DEFINITION_BRAND,
|
|
64
|
+
FOUNDRY_AGENT_FILE_ENV,
|
|
65
|
+
FOUNDRY_AGENT_ROUTE_ENV,
|
|
66
|
+
FOUNDRY_APPLICATION_BRAND,
|
|
67
|
+
FOUNDRY_APPLICATION_ENV,
|
|
68
|
+
FOUNDRY_COMPOSED_PLAYBOOK_BRAND,
|
|
69
|
+
FOUNDRY_CONNECTION_BRAND,
|
|
70
|
+
FOUNDRY_CORE_COMMAND_EVENT,
|
|
71
|
+
FOUNDRY_EVENT_PREFIX,
|
|
72
|
+
FOUNDRY_EXECUTION_MARKER,
|
|
73
|
+
FOUNDRY_LAYER_BRAND,
|
|
74
|
+
FOUNDRY_MCP_BRAND,
|
|
75
|
+
FOUNDRY_MEMORY_BRAND,
|
|
76
|
+
FOUNDRY_PLAYBOOK_ACTION_BRAND,
|
|
77
|
+
FOUNDRY_REPL_BRAND,
|
|
78
|
+
FOUNDRY_SCHEDULE_BRAND,
|
|
79
|
+
FOUNDRY_SHARED_TOOL_BRAND,
|
|
80
|
+
FOUNDRY_SUBSCRIBER_BRAND,
|
|
81
|
+
FOUNDRY_TRANSMISSION_BRAND,
|
|
82
|
+
FOUNDRY_TRANSMISSION_EVENT_BRAND,
|
|
83
|
+
FOUNDRY_TRANSMISSION_PREDICATE_BRAND,
|
|
84
|
+
FOUNDRY_WORKING_ENVIRONMENT_BRAND,
|
|
85
|
+
MemoryFoundryDataAdapter,
|
|
86
|
+
composePlaybook,
|
|
87
|
+
configureLayer,
|
|
88
|
+
configureMemory,
|
|
89
|
+
createAgentInstance,
|
|
90
|
+
createConversation,
|
|
91
|
+
createFoundryCoreTools,
|
|
92
|
+
createInstalledApplicationTransmissionTools,
|
|
93
|
+
createManifest,
|
|
94
|
+
defineAgent,
|
|
95
|
+
defineAgentApplication,
|
|
96
|
+
defineAgentFromModule,
|
|
97
|
+
defineAgentInstance,
|
|
98
|
+
defineApp,
|
|
99
|
+
defineApplication,
|
|
100
|
+
defineCall,
|
|
101
|
+
defineConnection,
|
|
102
|
+
defineLayer,
|
|
103
|
+
defineMcp,
|
|
104
|
+
defineMemory,
|
|
105
|
+
definePlaybookAction,
|
|
106
|
+
definePlaybookSubscription,
|
|
107
|
+
defineRepl,
|
|
108
|
+
defineRoutes,
|
|
109
|
+
defineSchedule,
|
|
110
|
+
defineSharedTool,
|
|
111
|
+
defineSubagent,
|
|
112
|
+
defineSubscriber,
|
|
113
|
+
defineTransmission,
|
|
114
|
+
defineTransmissionEvent,
|
|
115
|
+
defineTransmissionPredicate,
|
|
116
|
+
defineWorkingEnvironment,
|
|
117
|
+
discoverAgents,
|
|
118
|
+
findAgentFiles,
|
|
119
|
+
foundryDataEnvironmentPersistence,
|
|
120
|
+
install,
|
|
121
|
+
installRegistry,
|
|
122
|
+
installationKey,
|
|
123
|
+
internalAgentName,
|
|
124
|
+
isFoundryAgent,
|
|
125
|
+
isFoundryAgentDefinition,
|
|
126
|
+
isFoundryApplication,
|
|
127
|
+
isFoundryCapability,
|
|
128
|
+
isFoundryLayer,
|
|
129
|
+
isFoundrySchedule,
|
|
130
|
+
isFoundrySubscriber,
|
|
131
|
+
isFoundryTransmission,
|
|
132
|
+
isInboxCapableStore,
|
|
133
|
+
mountAgentDefinitionMemory,
|
|
134
|
+
mountFoundrySurfaces,
|
|
135
|
+
reconstructAgentInstance,
|
|
136
|
+
reconstructPlaybook,
|
|
137
|
+
reconstructPlaybookSubscription,
|
|
138
|
+
routeFromAgentFile,
|
|
139
|
+
routeFromInternalAgentName,
|
|
140
|
+
toGloveMessage,
|
|
141
|
+
toGloveRequestInput,
|
|
142
|
+
transmissionPredicate
|
|
143
|
+
} from "./chunk-CRWY7M66.js";
|
|
144
|
+
|
|
145
|
+
// src/authoring.ts
|
|
146
|
+
import { Schema } from "effect";
|
|
147
|
+
var accountTransmissions = /* @__PURE__ */ new WeakMap();
|
|
148
|
+
var routeTransmissions = /* @__PURE__ */ new WeakMap();
|
|
149
|
+
function defineAccount(options) {
|
|
150
|
+
const { transmission, ...data } = options;
|
|
151
|
+
if (!transmission.account) {
|
|
152
|
+
throw new Error("The referenced transmission has no account contract.");
|
|
153
|
+
}
|
|
154
|
+
const metadata = Schema.decodeUnknownSync(transmission.account.metadata)(data.metadata);
|
|
155
|
+
const decoded = Schema.decodeUnknownSync(AccountReference)({
|
|
156
|
+
...data,
|
|
157
|
+
metadata,
|
|
158
|
+
transmissionId: "pending"
|
|
159
|
+
});
|
|
160
|
+
const account = { ...decoded };
|
|
161
|
+
Object.defineProperty(account, "transmissionId", {
|
|
162
|
+
enumerable: true,
|
|
163
|
+
get: () => transmission.id
|
|
164
|
+
});
|
|
165
|
+
accountTransmissions.set(account, transmission);
|
|
166
|
+
return Object.freeze(account);
|
|
167
|
+
}
|
|
168
|
+
function defineInboundRoute(options) {
|
|
169
|
+
const { transmission, account, ...data } = options;
|
|
170
|
+
if (!transmission.inbound) {
|
|
171
|
+
throw new Error("The referenced transmission has no inbound contract.");
|
|
172
|
+
}
|
|
173
|
+
if (account && accountTransmissions.get(account) !== transmission) {
|
|
174
|
+
throw new Error(`Account "${account.id}" belongs to another transmission.`);
|
|
175
|
+
}
|
|
176
|
+
const config = Schema.decodeUnknownSync(transmission.inbound.config)(data.config);
|
|
177
|
+
const decoded = Schema.decodeUnknownSync(InboundRoute)({
|
|
178
|
+
...data,
|
|
179
|
+
config,
|
|
180
|
+
direction: "inbound",
|
|
181
|
+
transmissionId: "pending",
|
|
182
|
+
...account ? { accountId: account.id } : {}
|
|
183
|
+
});
|
|
184
|
+
const route = { ...decoded };
|
|
185
|
+
Object.defineProperty(route, "transmissionId", {
|
|
186
|
+
enumerable: true,
|
|
187
|
+
get: () => transmission.id
|
|
188
|
+
});
|
|
189
|
+
routeTransmissions.set(route, transmission);
|
|
190
|
+
return Object.freeze(route);
|
|
191
|
+
}
|
|
192
|
+
function defineOutboundRoute(options) {
|
|
193
|
+
const { transmission, account, ...data } = options;
|
|
194
|
+
if (!transmission.outbound) {
|
|
195
|
+
throw new Error("The referenced transmission has no outbound contract.");
|
|
196
|
+
}
|
|
197
|
+
if (account && accountTransmissions.get(account) !== transmission) {
|
|
198
|
+
throw new Error(`Account "${account.id}" belongs to another transmission.`);
|
|
199
|
+
}
|
|
200
|
+
const config = Schema.decodeUnknownSync(transmission.outbound.config)(data.config);
|
|
201
|
+
const decoded = Schema.decodeUnknownSync(OutboundRoute)({
|
|
202
|
+
...data,
|
|
203
|
+
config,
|
|
204
|
+
direction: "outbound",
|
|
205
|
+
transmissionId: "pending",
|
|
206
|
+
...account ? { accountId: account.id } : {}
|
|
207
|
+
});
|
|
208
|
+
const route = { ...decoded };
|
|
209
|
+
Object.defineProperty(route, "transmissionId", {
|
|
210
|
+
enumerable: true,
|
|
211
|
+
get: () => transmission.id
|
|
212
|
+
});
|
|
213
|
+
routeTransmissions.set(route, transmission);
|
|
214
|
+
return Object.freeze(route);
|
|
215
|
+
}
|
|
216
|
+
function defineBinding(options) {
|
|
217
|
+
const {
|
|
218
|
+
agent,
|
|
219
|
+
application,
|
|
220
|
+
transmission,
|
|
221
|
+
account,
|
|
222
|
+
route,
|
|
223
|
+
capabilities,
|
|
224
|
+
reply,
|
|
225
|
+
...data
|
|
226
|
+
} = options;
|
|
227
|
+
if (application && !application.transmissions?.some(
|
|
228
|
+
(candidate) => candidate === transmission
|
|
229
|
+
)) {
|
|
230
|
+
throw new Error(
|
|
231
|
+
`Application "${application.id}" does not own transmission "${transmission.id}".`
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
if (route && routeTransmissions.get(route) !== transmission) {
|
|
235
|
+
throw new Error(
|
|
236
|
+
`Route "${route.id}" does not belong to the referenced transmission.`
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
if (account && accountTransmissions.get(account) !== transmission) {
|
|
240
|
+
throw new Error(
|
|
241
|
+
`Account "${account.id}" does not belong to the referenced transmission.`
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
const decoded = Schema.decodeUnknownSync(AgentBinding)({
|
|
245
|
+
...data,
|
|
246
|
+
agentId: agent.id,
|
|
247
|
+
transmissionId: "pending",
|
|
248
|
+
...account ? { accountId: account.id } : {},
|
|
249
|
+
...route ? { routeId: route.id } : {},
|
|
250
|
+
capabilities: capabilities.map((capability) => capability.id),
|
|
251
|
+
...reply ? {
|
|
252
|
+
reply: reply.mode === "route" ? { mode: "route", routeId: reply.route.id } : reply
|
|
253
|
+
} : {}
|
|
254
|
+
});
|
|
255
|
+
const binding = { ...decoded };
|
|
256
|
+
Object.defineProperty(binding, "transmissionId", {
|
|
257
|
+
enumerable: true,
|
|
258
|
+
get: () => transmission.id
|
|
259
|
+
});
|
|
260
|
+
return Object.freeze(binding);
|
|
261
|
+
}
|
|
262
|
+
export {
|
|
263
|
+
AccountDirectory,
|
|
264
|
+
AccountId,
|
|
265
|
+
AccountNotFound,
|
|
266
|
+
AccountReference,
|
|
267
|
+
AccountSessionUnavailable,
|
|
268
|
+
AccountSummary,
|
|
269
|
+
AgentBinding,
|
|
270
|
+
AgentDefinitionId,
|
|
271
|
+
AgentId,
|
|
272
|
+
BindingId,
|
|
273
|
+
BindingNotFound,
|
|
274
|
+
CapabilityId,
|
|
275
|
+
EMPTY_AGENT_COMPOSITION,
|
|
276
|
+
EMPTY_CAPABILITY_REGISTRY,
|
|
277
|
+
EMPTY_FOUNDRY_APPLICATION,
|
|
278
|
+
EMPTY_NATIVE_REGISTRY,
|
|
279
|
+
EventId,
|
|
280
|
+
EventNotFound,
|
|
281
|
+
EventReference,
|
|
282
|
+
EventStore,
|
|
283
|
+
FOUNDRY_AGENT_APPLICATION_BRAND,
|
|
284
|
+
FOUNDRY_AGENT_BRAND,
|
|
285
|
+
FOUNDRY_AGENT_DEFINITION_BRAND,
|
|
286
|
+
FOUNDRY_AGENT_FILE_ENV,
|
|
287
|
+
FOUNDRY_AGENT_ROUTE_ENV,
|
|
288
|
+
FOUNDRY_APPLICATION_BRAND,
|
|
289
|
+
FOUNDRY_APPLICATION_ENV,
|
|
290
|
+
FOUNDRY_COMPOSED_PLAYBOOK_BRAND,
|
|
291
|
+
FOUNDRY_CONNECTION_BRAND,
|
|
292
|
+
FOUNDRY_CORE_COMMAND_EVENT,
|
|
293
|
+
FOUNDRY_EVENT_PREFIX,
|
|
294
|
+
FOUNDRY_EXECUTION_MARKER,
|
|
295
|
+
FOUNDRY_LAYER_BRAND,
|
|
296
|
+
FOUNDRY_MCP_BRAND,
|
|
297
|
+
FOUNDRY_MEMORY_BRAND,
|
|
298
|
+
FOUNDRY_PLAYBOOK_ACTION_BRAND,
|
|
299
|
+
FOUNDRY_REPL_BRAND,
|
|
300
|
+
FOUNDRY_SCHEDULE_BRAND,
|
|
301
|
+
FOUNDRY_SHARED_TOOL_BRAND,
|
|
302
|
+
FOUNDRY_SUBSCRIBER_BRAND,
|
|
303
|
+
FOUNDRY_TRANSMISSION_BRAND,
|
|
304
|
+
FOUNDRY_TRANSMISSION_EVENT_BRAND,
|
|
305
|
+
FOUNDRY_TRANSMISSION_PREDICATE_BRAND,
|
|
306
|
+
FOUNDRY_WORKING_ENVIRONMENT_BRAND,
|
|
307
|
+
FoundryApplicationManifest,
|
|
308
|
+
FoundryClient,
|
|
309
|
+
FoundryManifestCapability,
|
|
310
|
+
FoundryManifestTransmission,
|
|
311
|
+
FoundryRunHandle,
|
|
312
|
+
FoundryRuntime,
|
|
313
|
+
FoundryRuntimeError,
|
|
314
|
+
FoundryServer,
|
|
315
|
+
GrantResolutionError,
|
|
316
|
+
GrantResolver,
|
|
317
|
+
InboundRoute,
|
|
318
|
+
ManifestCompilationError,
|
|
319
|
+
MemoryFoundryDataAdapter,
|
|
320
|
+
MemoryObservabilityAdapter,
|
|
321
|
+
OutboundRoute,
|
|
322
|
+
ReplyPolicy,
|
|
323
|
+
Route,
|
|
324
|
+
RouteId,
|
|
325
|
+
RouteNotFound,
|
|
326
|
+
RunGrant,
|
|
327
|
+
RunId,
|
|
328
|
+
TopologyConflict,
|
|
329
|
+
TopologyStore,
|
|
330
|
+
TransmissionId,
|
|
331
|
+
compileApplicationManifest,
|
|
332
|
+
composeAgent,
|
|
333
|
+
composePlaybook,
|
|
334
|
+
configureLayer,
|
|
335
|
+
configureMemory,
|
|
336
|
+
createAgentInstance,
|
|
337
|
+
createConversation,
|
|
338
|
+
createFoundryClient,
|
|
339
|
+
createFoundryCoreTools,
|
|
340
|
+
createInstalledApplicationTransmissionTools,
|
|
341
|
+
createManifest,
|
|
342
|
+
defineAccount,
|
|
343
|
+
defineAgent,
|
|
344
|
+
defineAgentApplication,
|
|
345
|
+
defineAgentFromModule,
|
|
346
|
+
defineAgentInstance,
|
|
347
|
+
defineApp,
|
|
348
|
+
defineApplication,
|
|
349
|
+
defineBinding,
|
|
350
|
+
defineCall,
|
|
351
|
+
defineConfig,
|
|
352
|
+
defineConnection,
|
|
353
|
+
defineInboundRoute,
|
|
354
|
+
defineLayer,
|
|
355
|
+
defineMcp,
|
|
356
|
+
defineMemory,
|
|
357
|
+
defineOutboundRoute,
|
|
358
|
+
definePlaybookAction,
|
|
359
|
+
definePlaybookSubscription,
|
|
360
|
+
defineRepl,
|
|
361
|
+
defineRoutes,
|
|
362
|
+
defineSchedule,
|
|
363
|
+
defineSharedTool,
|
|
364
|
+
defineSubagent,
|
|
365
|
+
defineSubscriber,
|
|
366
|
+
defineTransmission,
|
|
367
|
+
defineTransmissionEvent,
|
|
368
|
+
defineTransmissionPredicate,
|
|
369
|
+
defineWorkingEnvironment,
|
|
370
|
+
discoverAgents,
|
|
371
|
+
findAgentFiles,
|
|
372
|
+
foundryDataEnvironmentPersistence,
|
|
373
|
+
grantResolverLive,
|
|
374
|
+
install,
|
|
375
|
+
installRegistry,
|
|
376
|
+
installationKey,
|
|
377
|
+
internalAgentName,
|
|
378
|
+
isFoundryAgent,
|
|
379
|
+
isFoundryAgentDefinition,
|
|
380
|
+
isFoundryApplication,
|
|
381
|
+
isFoundryCapability,
|
|
382
|
+
isFoundryLayer,
|
|
383
|
+
isFoundrySchedule,
|
|
384
|
+
isFoundrySubscriber,
|
|
385
|
+
isFoundryTransmission,
|
|
386
|
+
isInboxCapableStore,
|
|
387
|
+
memoryAccountDirectory,
|
|
388
|
+
memoryEventStore,
|
|
389
|
+
memoryTopologyStore,
|
|
390
|
+
mountAgentDefinitionMemory,
|
|
391
|
+
mountFoundrySurfaces,
|
|
392
|
+
reconstructAgentInstance,
|
|
393
|
+
reconstructPlaybook,
|
|
394
|
+
reconstructPlaybookSubscription,
|
|
395
|
+
routeFromAgentFile,
|
|
396
|
+
routeFromInternalAgentName,
|
|
397
|
+
serializeInboundTransmissionXml,
|
|
398
|
+
toGloveMessage,
|
|
399
|
+
toGloveRequestInput,
|
|
400
|
+
transmissionPredicate,
|
|
401
|
+
writeGeneratedTypes
|
|
402
|
+
};
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Glove Foundry documentation
|
|
2
|
+
|
|
3
|
+
The published, task-oriented handbook lives at
|
|
4
|
+
[glove.dterminal.net/foundry/docs](https://glove.dterminal.net/foundry/docs).
|
|
5
|
+
These package-local documents provide the implementation-level companion reference.
|
|
6
|
+
|
|
7
|
+
- [Building with Foundry](./building-with-foundry.md): project layout and complete authoring flow.
|
|
8
|
+
- [Architecture](./architecture.md): definitions, instances, subscriptions, connections, and adapter boundaries.
|
|
9
|
+
- [Inspector](./inspector.md): page hierarchy, run traces, live updates, and the operator API.
|
|
10
|
+
- [Evaluation checklist](./evaluation-checklist.md): concrete review criteria and verification commands.
|
|
11
|
+
- [Implementation backlog](./implementation-backlog.md): remaining follow-up work, if any.
|
|
12
|
+
|
|
13
|
+
The runnable reference is [`examples/foundry-agent`](../../../examples/foundry-agent).
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
## Boundary rule
|
|
4
|
+
|
|
5
|
+
Foundry exposes concepts that belong to an agentic application. Its execution engine is private and replaceable.
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
file-routed code definitions durable data
|
|
9
|
+
──────────────── ────────────
|
|
10
|
+
agent definition ────────────────┐ agent instance
|
|
11
|
+
application + transmissions ─────┼──▶ installations + playbooks
|
|
12
|
+
tools / MCP / memory / layers ───┤ conversations + workspace state
|
|
13
|
+
working environment / REPL ──────┘ VFS snapshots + artifacts
|
|
14
|
+
subscriptions + delivery claims
|
|
15
|
+
|
|
16
|
+
resolve file identity and serialize here
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
No public config, client, HTTP route, manifest, or inspector component requires knowledge of the private runner.
|
|
20
|
+
|
|
21
|
+
## Definition versus instance
|
|
22
|
+
|
|
23
|
+
An agent definition is immutable code. Its convention filename owns its identity; the definition never repeats that route as an `id`. It describes the catalogue and lazy assembly functions available to all instances of that route. Applications, transmissions, predicates, connections, shared tools, MCPs, memory profiles, layers, subscribers, and playbook actions are reusable code primitives. Playbooks are runtime policy composed by an agent resolver or frontend. Schedules are agent-local definition values reconciled into runtime activation data; neither playbooks nor schedules have a global static registry.
|
|
24
|
+
|
|
25
|
+
An agent instance is mutable desired-state data:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
interface AgentInstance {
|
|
29
|
+
id: string
|
|
30
|
+
definitionId: string
|
|
31
|
+
workspaceId: string
|
|
32
|
+
provisioningKey?: string
|
|
33
|
+
context: Record<string, unknown>
|
|
34
|
+
installations: AgentInstallation[]
|
|
35
|
+
playbooks: AgentPlaybook[]
|
|
36
|
+
createdAt: string
|
|
37
|
+
updatedAt: string
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`FoundryDataAdapter` is the source of truth. Every run reloads the instance and conversation, then assembles a fresh Glove from the referenced definition and current message. Lazy `playbooks` and `schedules` resolvers reconcile desired runtime data before Foundry executes subsequent activations. `configureAgent` atomically replaces frontend-editable context, installations, and playbooks.
|
|
42
|
+
|
|
43
|
+
Definitions never accept an invocation input or output schema. Foundry owns those contracts.
|
|
44
|
+
|
|
45
|
+
## Reference normalization
|
|
46
|
+
|
|
47
|
+
Code references values:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
composePlaybook({
|
|
51
|
+
name: "mention-response",
|
|
52
|
+
transmission: messages,
|
|
53
|
+
match: { event: messageReceived, routes: [inbound], predicate: { definition: isMention } },
|
|
54
|
+
directives: [{ action: respond, instruction: "Answer the message." }],
|
|
55
|
+
applications: [chatApp],
|
|
56
|
+
})
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Persisted records reference ids:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
{
|
|
63
|
+
transmissionId: "messages",
|
|
64
|
+
match: { event: "message-received", routeIds: ["chat-inbound"], predicate: { name: "is-mention" } },
|
|
65
|
+
directives: [{ action: "respond", instruction: "Answer the message." }],
|
|
66
|
+
applications: ["chat-app"]
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
File-routed definition helpers retain direct references for reusable code primitives. `composePlaybook` instead runs inside lazy assembly: Foundry derives a stable instance-scoped id, converts its imported references to strings, and persists the resulting policy. Reconstruction accepts the value-only storage/API form.
|
|
71
|
+
|
|
72
|
+
Runtime records are different: account, route, binding, agent-instance, and conversation IDs are data-owned because those records can be created or edited by a UI or adapter.
|
|
73
|
+
|
|
74
|
+
## Typed config flow
|
|
75
|
+
|
|
76
|
+
Config schemas belong to the definition that consumes them. Zod schemas infer the input accepted by `install`, `configureLayer`, and `configureMemory`, and infer decoded config inside their callbacks. Effect transmission schemas infer account metadata, route config, inbound events, and outbound input/output. All schemas are decoded again at runtime boundaries.
|
|
77
|
+
|
|
78
|
+
`defineConfig` keeps the exact inferred configuration type and rejects unknown framework keys, including nested server, execution, and observability keys.
|
|
79
|
+
|
|
80
|
+
## Applications and transmissions
|
|
81
|
+
|
|
82
|
+
An application owns one or many transmission definitions. A transmission may define:
|
|
83
|
+
|
|
84
|
+
- account metadata schema;
|
|
85
|
+
- capability declarations;
|
|
86
|
+
- inbound config/event schemas, authentication, normalization, classification, predicates, and serialization; and
|
|
87
|
+
- outbound config/input/output schemas and a delivery adapter.
|
|
88
|
+
|
|
89
|
+
Applications are not installed by default. Their optional install hook is a headless factory that may contribute tools without receiving the Glove runtime or store. Foundry passes an operation-scoped account-session function when the user provided one; it never passes raw credentials.
|
|
90
|
+
|
|
91
|
+
## Inbound activation
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
application connection / HTTP fire
|
|
95
|
+
│
|
|
96
|
+
▼
|
|
97
|
+
authenticate + normalize + classify
|
|
98
|
+
│
|
|
99
|
+
▼
|
|
100
|
+
match instance playbooks and durable subscriptions
|
|
101
|
+
│
|
|
102
|
+
├── existing instances
|
|
103
|
+
└── atomically provision zero, one, or many instances
|
|
104
|
+
│
|
|
105
|
+
▼
|
|
106
|
+
merge serialized event into a conversation
|
|
107
|
+
│
|
|
108
|
+
▼
|
|
109
|
+
enqueue agent runs
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The delivery key is `routeId:eventId`. The data adapter claims it before provisioning. A completed claim stores run ids; a retry returns those runs. Failed dispatch releases the pending claim.
|
|
113
|
+
|
|
114
|
+
## Playbook subscription
|
|
115
|
+
|
|
116
|
+
A subscription is durable data containing one playbook and one or more targets. It is evaluated even if no matching instance exists.
|
|
117
|
+
|
|
118
|
+
Each target selects a provisioning policy. The built-in policies derive deterministic `provisioningKey` values. A custom policy calls the application-owned provisioner, which can return multiple instance seeds. `provisionAgent` is atomic at the adapter boundary.
|
|
119
|
+
|
|
120
|
+
The subscription target also carries desired installations and initial context because these are instance data chosen by a frontend/operator, not static agent-definition defaults.
|
|
121
|
+
|
|
122
|
+
## Application connections
|
|
123
|
+
|
|
124
|
+
A connection is colocated with its application and names the inbound transmissions it may emit. It receives a narrow context:
|
|
125
|
+
|
|
126
|
+
- application/connection/definition/workspace identity;
|
|
127
|
+
- safe account metadata and routes;
|
|
128
|
+
- an abort signal;
|
|
129
|
+
- `ready()`;
|
|
130
|
+
- `receive()`; and
|
|
131
|
+
- optional user-owned `withAccountSession()`.
|
|
132
|
+
|
|
133
|
+
The supervisor derives desired connections from installed application + active playbook combinations. It starts, stops, retries, and observes them. Its implementation can use any backend; retry/worker topology is not exposed as an authoring primitive.
|
|
134
|
+
|
|
135
|
+
## Conversations and workspaces
|
|
136
|
+
|
|
137
|
+
Conversations are independent data records owned by an instance. Transmission conversations derive stable ids from route, instance, and external thread. Direct conversations can be created freely.
|
|
138
|
+
|
|
139
|
+
Workspace entries, inbox items, tasks, scoped environment values, and optional working-environment snapshots share the data adapter. They are suitable for document handles and coordination state across agents.
|
|
140
|
+
|
|
141
|
+
## Working environment and REPL boundary
|
|
142
|
+
|
|
143
|
+
Foundry owns contextual selection, mounting, lifecycle, and observability. The native packages retain their own semantics:
|
|
144
|
+
|
|
145
|
+
- `glove-working-environment` owns the guarded VFS, script sandbox, tools, snapshots, limits, adapters, and cleanup;
|
|
146
|
+
- `glove-js`, `glove-python`, and `glove-lisp` own their interpreter sessions and capability catalogs; and
|
|
147
|
+
- consumer adapters own remote VFS storage, locking, credentials, and persistence policy.
|
|
148
|
+
|
|
149
|
+
An agent can resolve either surface from its current instance, conversation, workspace, or message. Foundry exposes the mounted environment and guarded VFS to execution contexts, snapshots before cleanup when a persistence adapter is present, and emits safe mount/save telemetry. It permits one REPL per assembled agent to prevent colliding execution and discovery tool names.
|
|
150
|
+
|
|
151
|
+
The durable boundary is the VFS. Native REPL interpreter bindings are run-scoped and are not serialized by Foundry.
|
|
152
|
+
|
|
153
|
+
## Lazy assembly
|
|
154
|
+
|
|
155
|
+
Every run resolves model, system prompt, tools, memory, inboxes, subscribers, layers, calls, playbooks, schedules, mesh, working environment, REPL, and custom build/run functions against `AgentAssemblyContext`. Resolvers can use both the instance and the current message, which makes message-dependent provisioning a first-class behavior rather than an environment switch.
|
|
156
|
+
|
|
157
|
+
Installable applications, shared tools, and MCPs are filtered by the current instance desired state. Memory belongs to the definition but can be selected lazily. Inboxes must always be lazy functions.
|
|
158
|
+
|
|
159
|
+
## Observability
|
|
160
|
+
|
|
161
|
+
All public events use Foundry categories: agent, run, model, tool, extension, application, inbox, memory, MCP, activation, system, and log. Each event may correlate definition id, run id, sequence, timestamp, and safe data.
|
|
162
|
+
|
|
163
|
+
The inspector presents the causal chain rather than backend logs. Raw event data remains available behind each run for debugging.
|
|
164
|
+
|
|
165
|
+
## Credential boundary
|
|
166
|
+
|
|
167
|
+
Foundry stores only account metadata and opaque access references. It does not:
|
|
168
|
+
|
|
169
|
+
- acquire credentials;
|
|
170
|
+
- refresh tokens;
|
|
171
|
+
- persist secret values in manifests;
|
|
172
|
+
- choose an account for a user; or
|
|
173
|
+
- expose credential material to prompts or the inspector.
|
|
174
|
+
|
|
175
|
+
Applications define account-session and provider adapters. Playbooks and instance installation data select account references.
|