glove-foundry 0.6.1 → 0.8.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/README.md +80 -4
- package/dist/chunk-CYOIHSUX.js +1365 -0
- package/dist/{chunk-X6EWEWWM.js → chunk-DTFCEX67.js} +2003 -200
- package/dist/{chunk-OBTOFA7W.js → chunk-EUGKVW3J.js} +470 -638
- package/dist/{chunk-B36BGF5R.js → chunk-J6NHL4SM.js} +370 -74
- package/dist/{chunk-7F7QVO6I.js → chunk-L5JQVTHD.js} +30 -0
- package/dist/{chunk-RSU7NEDK.js → chunk-X3HZYVZS.js} +36 -1
- package/dist/cli.js +4 -4
- package/dist/{client-DWPYe_Nc.d.ts → client-CekanYLW.d.ts} +252 -161
- package/dist/client.d.ts +3 -3
- package/dist/client.js +1 -1
- package/dist/config.d.ts +7 -0
- package/dist/{definition-A8o11aez.d.ts → event-delivery-CNCsVqi8.d.ts} +1380 -871
- package/dist/execution-agent.d.ts +0 -1
- package/dist/execution-agent.js +3 -14
- package/dist/execution-daemon.js +10 -5
- package/dist/execution-loader.js +1171 -8
- package/dist/index.d.ts +21 -6
- package/dist/index.js +178 -32
- package/dist/voice.d.ts +12 -8
- package/dist/voice.js +51 -10
- package/docs/README.md +1 -1
- package/docs/architecture.md +8 -0
- package/docs/building-with-foundry.md +137 -5
- package/docs/durable-subagents.md +337 -0
- package/docs/execution.md +4 -0
- package/docs/inspector.md +137 -29
- package/package.json +12 -11
- package/templates/travel-concierge/README.md +1 -1
- package/dist/chunk-K2EU63MB.js +0 -468
- package/dist/chunk-TFGETZYH.js +0 -917
package/README.md
CHANGED
|
@@ -11,6 +11,19 @@ Build guided conversations with first-class, lazy `goals`, `facts`, `forms`, and
|
|
|
11
11
|
evidence and answers. See [the guidance handbook](./docs/guidance.md) for scope,
|
|
12
12
|
durable SQLite setup, preparation, and a runnable example.
|
|
13
13
|
|
|
14
|
+
## Agents are data
|
|
15
|
+
|
|
16
|
+
A definition (`agents/<route>/agent.ts`) is everything a kind of agent can be,
|
|
17
|
+
like a server-rendered page that renders any props. The agents themselves are
|
|
18
|
+
instances, and who each one is lives in data: its `name`, `description`,
|
|
19
|
+
`context`, `installations` and `workspaceId`. Write one `bot` definition, not a
|
|
20
|
+
definition per bot; adding a bot, renaming it or giving it an app is a write
|
|
21
|
+
(`createAgent`, `configureAgent`, `install`), never a deploy. Read names, jobs
|
|
22
|
+
and per-user settings from the instance in resolvers, branch on its data rather
|
|
23
|
+
than its id, and let agents change their own data with tools. Split definitions
|
|
24
|
+
only by what a kind of agent can do or must load. See
|
|
25
|
+
[Agents are data](https://glove.dterminal.net/foundry/docs/agents-are-data).
|
|
26
|
+
|
|
14
27
|
## Your first agent application
|
|
15
28
|
|
|
16
29
|
Dependency installation is selected by default in the setup wizard. Foundry runs
|
|
@@ -258,6 +271,25 @@ export default defineAgent({
|
|
|
258
271
|
|
|
259
272
|
Credential acquisition and refresh still belong to `mcpAdapterFor`; persisted installation config should contain only a reference such as an environment-variable or vault-record name.
|
|
260
273
|
|
|
274
|
+
### Apps people connect
|
|
275
|
+
|
|
276
|
+
When each person connects their own account (Gmail, Linear, a calendar), put the provider's MCP server on a Foundry app. The app opens it with the installation's account, decides per tool, and also owns the sends and incoming events:
|
|
277
|
+
|
|
278
|
+
```ts
|
|
279
|
+
export default defineApp({
|
|
280
|
+
description: "Gmail: read mail, send as the owner, new mail as it arrives",
|
|
281
|
+
outbound: [gmail], // glove_app_gmail__gmail_send, delivered by Foundry after approval
|
|
282
|
+
connections: [gmailWatch], // new mail into a playbook
|
|
283
|
+
mcp: {
|
|
284
|
+
entry: { name: "gmail", description: "Read the owner's mail", url: "https://gmailmcp.googleapis.com/mcp/v1" },
|
|
285
|
+
auth: (session) => ({ authorization: `Bearer ${(session as GoogleSession).accessToken}` }), // inside accountSessions.withSession
|
|
286
|
+
tools: (tool) => (tool.readOnly ? "allow" : "ask"), // or "hide"
|
|
287
|
+
},
|
|
288
|
+
})
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Install it with `accountId`. `defineRepl({ programmaticTools: { select: ({ apps }) => apps.flatMap((app) => app.tools.filter((tool) => tool.readOnly)), keepDirect: false } })` gives the reads to the program as `gmail.search_threads(...)` and takes them out of the direct tool list. Keep accounts in your own store and hand Foundry an `AccountDirectory` through `defineApplication({ services })`; `fileTopologyStore(file)` keeps the routes and bindings you write at runtime.
|
|
292
|
+
|
|
261
293
|
## Background playbooks and lazy provisioning
|
|
262
294
|
|
|
263
295
|
A playbook is serializable runtime policy. It is composed by an agent resolver or frontend from transmission primitives, then persisted on the instance. Executable normalization, authentication, predicates, serialization, and delivery live on the transmission definition.
|
|
@@ -317,7 +349,7 @@ store. Foundry does not fabricate history from retained runs or UI state.
|
|
|
317
349
|
## Least-privilege subagents
|
|
318
350
|
|
|
319
351
|
Subagents may declare fixed tools or project an invocation-time subset from the
|
|
320
|
-
fully assembled parent. That lets a
|
|
352
|
+
fully assembled parent. That lets a subagent inherit an installed application or
|
|
321
353
|
MCP read operation without receiving the parent's write/admin surface. The
|
|
322
354
|
projection is resolved only when the subagent is called, after instance
|
|
323
355
|
installations and message-dependent assembly have completed.
|
|
@@ -325,7 +357,7 @@ installations and message-dependent assembly have completed.
|
|
|
325
357
|
```ts
|
|
326
358
|
import { getToolJsonSchema } from "glove-core"
|
|
327
359
|
|
|
328
|
-
// Names of tools the parent has mounted that the
|
|
360
|
+
// Names of tools the parent has mounted that the subagent may use.
|
|
329
361
|
const READ_ONLY = new Set(["web_search", "web_read", "workspace_read_file"])
|
|
330
362
|
|
|
331
363
|
defineSubagent({
|
|
@@ -347,7 +379,7 @@ defineSubagent({
|
|
|
347
379
|
The child keeps its isolated store, compaction policy, model, prompt and skills.
|
|
348
380
|
Its `layers` and `subscribers` mount when the subagent is invoked and are
|
|
349
381
|
disposed when its request ends. Parent subscribers still receive the subagent
|
|
350
|
-
lifecycle bracket, so
|
|
382
|
+
lifecycle bracket, so the subagent call remains visible in the same run trace.
|
|
351
383
|
|
|
352
384
|
## Layered agents: delegates
|
|
353
385
|
|
|
@@ -401,6 +433,50 @@ delegations appear in the interactor's runtime context, and
|
|
|
401
433
|
`runtime.listDelegations()` lists them all. See
|
|
402
434
|
[`examples/foundry-layered-assistant`](../../examples/foundry-layered-assistant).
|
|
403
435
|
|
|
436
|
+
## Messaging existing agents: the hosted mesh
|
|
437
|
+
|
|
438
|
+
Workers an agent owns belong in `delegates` or `durableSubagents`. When the
|
|
439
|
+
agents are peers that already exist, each its own instance in one workspace (a
|
|
440
|
+
person's bots, say), Foundry can host [Glove Mesh](../glove-mesh) between
|
|
441
|
+
them. `mesh: true` gives an agent `glove_mesh_list_agents`,
|
|
442
|
+
`glove_mesh_send_message`, `glove_mesh_broadcast` and `glove_mesh_acknowledge`,
|
|
443
|
+
and it messages its peers by instance id. Its peers are the other instances in
|
|
444
|
+
its workspace, so who is on a team is data.
|
|
445
|
+
|
|
446
|
+
```ts
|
|
447
|
+
// agents/bot/agent.ts — one definition; every bot is an instance
|
|
448
|
+
export default defineAgent({
|
|
449
|
+
description: "One of a person's bots",
|
|
450
|
+
model: botModel,
|
|
451
|
+
systemPrompt: botPrompt,
|
|
452
|
+
mesh: { waitMs: 60_000 },
|
|
453
|
+
})
|
|
454
|
+
|
|
455
|
+
// your application — the bots are instances in the person's workspace
|
|
456
|
+
await foundry.createAgent("bot", { id: "ada-sales", workspaceId: "ada", name: "Sales" })
|
|
457
|
+
await foundry.createAgent("bot", { id: "ada-ops", workspaceId: "ada", name: "Ops" })
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
A new message starts a thread: a conversation on the recipient. The recipient's
|
|
461
|
+
final reply goes back on its own; a failed or cancelled run sends a failure. It
|
|
462
|
+
can ask back with `glove_mesh_send_message`, and the sender answers with
|
|
463
|
+
`in_reply_to`. Messages reach a run that is listening (`ctx.onMeshMessage`, used
|
|
464
|
+
by `voiceCall`) directly. Otherwise they wait until the conversation is free and
|
|
465
|
+
start one run (`source.kind` `"mesh"`) carrying everything that arrived, as
|
|
466
|
+
`<mesh-message>` blocks. A blocking send waits up to `waitMs` (default 90 s)
|
|
467
|
+
inside the same run, so a worker holding a browser or sandbox session keeps it;
|
|
468
|
+
after that the run suspends and the reply starts a new run. Open threads appear
|
|
469
|
+
in the sender's runtime context, and `runtime.listThreads()` lists them.
|
|
470
|
+
Mesh messages ride the same event journal as delegation updates, so they are
|
|
471
|
+
handed over again after a restart.
|
|
472
|
+
|
|
473
|
+
`peers(self, peer)` narrows who an agent may message, from data; an agent can
|
|
474
|
+
always answer whoever messaged it. `mount(ctx)` decides per run whether the
|
|
475
|
+
tools are there, so a scheduled research run can be kept from messaging anyone.
|
|
476
|
+
A `mesh` value with an `adapter` is the raw Glove Mesh transport instead
|
|
477
|
+
(`FoundryMeshConfig`). See
|
|
478
|
+
[`examples/foundry-bot-crew`](../../examples/foundry-bot-crew).
|
|
479
|
+
|
|
404
480
|
## Voice calls
|
|
405
481
|
|
|
406
482
|
`glove-foundry/voice` runs an agent as a live call. Use it as the definition's
|
|
@@ -417,7 +493,7 @@ run: voiceCall({
|
|
|
417
493
|
|
|
418
494
|
The call uses the assembled agent's prompt, tools and runtime context, saves
|
|
419
495
|
what both sides say to the conversation store, and speaks delegation results
|
|
420
|
-
and questions at the next pause. Foundry's bookkeeping tools and any tool that
|
|
496
|
+
and questions, and mesh messages, at the next pause. Foundry's bookkeeping tools and any tool that
|
|
421
497
|
needs an approval stay off the call; delegate that work instead. A room is any
|
|
422
498
|
`{ open(call), close() }`: `webSocketRoom` serves PCM16 over one WebSocket, and
|
|
423
499
|
a LiveKit or phone room calls `call.joined()` and `call.left()` the same way.
|