glove-foundry 0.10.1 → 0.11.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/dist/{chunk-J6NHL4SM.js → chunk-2JCISE2U.js} +103 -4
- package/dist/{chunk-VLD3DKPI.js → chunk-4WBQ7XVF.js} +30 -1
- package/dist/{chunk-X3HZYVZS.js → chunk-LCDEHWRB.js} +1 -1
- package/dist/{chunk-CYOIHSUX.js → chunk-NWFOY3L7.js} +5 -0
- package/dist/{chunk-L72FKI7P.js → chunk-YCW66WKQ.js} +54 -3
- package/dist/cli.js +4 -4
- package/dist/{client-HM2x2-Ut.d.ts → client-B4Emyeek.d.ts} +11 -2
- package/dist/client.d.ts +2 -2
- package/dist/{event-delivery-C7rYiNPs.d.ts → event-delivery-BfSL9sGo.d.ts} +139 -1
- package/dist/execution-agent.js +1 -1
- package/dist/execution-daemon.js +1 -1
- package/dist/execution-loader.js +108 -8
- package/dist/index.d.ts +9 -5
- package/dist/index.js +42 -5
- package/dist/voice.d.ts +81 -3
- package/dist/voice.js +322 -21
- package/docs/architecture.md +8 -0
- package/docs/building-with-foundry.md +1 -0
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
memoryTopologyStore,
|
|
44
44
|
serializeInboundTransmissionXml,
|
|
45
45
|
writeGeneratedTypes
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-YCW66WKQ.js";
|
|
47
47
|
import {
|
|
48
48
|
FoundryClient,
|
|
49
49
|
FoundryRunHandle,
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
defineWorkingEnvironment,
|
|
64
64
|
foundryDataEnvironmentPersistence,
|
|
65
65
|
foundryGuidanceSubject
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-LCDEHWRB.js";
|
|
67
67
|
import {
|
|
68
68
|
DEFAULT_APPROVAL_EXPIRES_AFTER_MS,
|
|
69
69
|
DEFAULT_APPROVAL_WAIT_MS,
|
|
@@ -121,10 +121,15 @@ import {
|
|
|
121
121
|
toGloveRequestInput,
|
|
122
122
|
transmissionPredicate,
|
|
123
123
|
withFoundryPermissions
|
|
124
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-4WBQ7XVF.js";
|
|
125
125
|
import {
|
|
126
|
+
assertEventReceipt,
|
|
127
|
+
eventReceiptStore,
|
|
128
|
+
eventTranscriptMessageId,
|
|
129
|
+
lateChatEffectId,
|
|
130
|
+
matchesReceiptFilter,
|
|
126
131
|
meshIdentity
|
|
127
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-2JCISE2U.js";
|
|
128
133
|
import {
|
|
129
134
|
EMPTY_CAPABILITY_REGISTRY,
|
|
130
135
|
EMPTY_NATIVE_REGISTRY,
|
|
@@ -171,7 +176,7 @@ import {
|
|
|
171
176
|
mountFoundrySurfaces,
|
|
172
177
|
restrictApp,
|
|
173
178
|
routeFromInternalAgentName
|
|
174
|
-
} from "./chunk-
|
|
179
|
+
} from "./chunk-NWFOY3L7.js";
|
|
175
180
|
|
|
176
181
|
// src/file-data.ts
|
|
177
182
|
import { randomUUID } from "node:crypto";
|
|
@@ -189,6 +194,7 @@ function emptyState(environment) {
|
|
|
189
194
|
approvals: [],
|
|
190
195
|
activations: [],
|
|
191
196
|
occurrences: [],
|
|
197
|
+
receipts: [],
|
|
192
198
|
conversations: [],
|
|
193
199
|
workspaceEntries: [],
|
|
194
200
|
workingEnvironments: [],
|
|
@@ -299,6 +305,7 @@ var FileFoundryDataAdapter = class {
|
|
|
299
305
|
approvals: parsed.approvals ?? [],
|
|
300
306
|
activations: parsed.activations ?? [],
|
|
301
307
|
occurrences: parsed.occurrences ?? [],
|
|
308
|
+
receipts: parsed.receipts ?? [],
|
|
302
309
|
conversations: parsed.conversations ?? [],
|
|
303
310
|
workspaceEntries: parsed.workspaceEntries ?? [],
|
|
304
311
|
workingEnvironments: parsed.workingEnvironments ?? [],
|
|
@@ -424,6 +431,7 @@ var FileFoundryDataAdapter = class {
|
|
|
424
431
|
state.approvals = state.approvals.filter((item) => item.agentId !== agentId);
|
|
425
432
|
state.activations = state.activations.filter((item) => item.agentId !== agentId);
|
|
426
433
|
state.occurrences = state.occurrences.filter((item) => item.agentId !== agentId);
|
|
434
|
+
state.receipts = state.receipts.filter((item) => item.agentId !== agentId);
|
|
427
435
|
state.conversations = state.conversations.filter((item) => item.agentId !== agentId);
|
|
428
436
|
state.workingEnvironments = state.workingEnvironments.filter((item) => item.owner.agentId !== agentId);
|
|
429
437
|
state.inbox = state.inbox.filter((item) => item.agentId !== agentId && !ids.has(item.conversationId ?? ""));
|
|
@@ -515,6 +523,32 @@ var FileFoundryDataAdapter = class {
|
|
|
515
523
|
listEvents() {
|
|
516
524
|
return effect(async () => structuredClone((await this.snapshot()).events));
|
|
517
525
|
}
|
|
526
|
+
claimEventReceipt(receipt) {
|
|
527
|
+
return effect(async () => {
|
|
528
|
+
assertEventReceipt(receipt);
|
|
529
|
+
await this.ensureInitialized();
|
|
530
|
+
return this.mutate((state) => {
|
|
531
|
+
if (state.receipts.some((item) => item.id === receipt.id)) return false;
|
|
532
|
+
state.receipts.push(structuredClone(receipt));
|
|
533
|
+
return true;
|
|
534
|
+
});
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
putEventReceipt(receipt) {
|
|
538
|
+
return effect(async () => {
|
|
539
|
+
assertEventReceipt(receipt);
|
|
540
|
+
await this.ensureInitialized();
|
|
541
|
+
await this.mutate((state) => {
|
|
542
|
+
replaceById(state.receipts, receipt);
|
|
543
|
+
});
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
getEventReceipt(id) {
|
|
547
|
+
return effect(async () => structuredClone((await this.snapshot()).receipts.find((item) => item.id === id) ?? null));
|
|
548
|
+
}
|
|
549
|
+
listEventReceipts(filter) {
|
|
550
|
+
return effect(async () => structuredClone((await this.snapshot()).receipts.filter((item) => matchesReceiptFilter(item, filter))));
|
|
551
|
+
}
|
|
518
552
|
claimScheduleOccurrence(occurrence) {
|
|
519
553
|
return effect(async () => {
|
|
520
554
|
assertScheduleOccurrence(occurrence);
|
|
@@ -995,6 +1029,8 @@ export {
|
|
|
995
1029
|
defineTransmissionPredicate,
|
|
996
1030
|
defineWorkingEnvironment,
|
|
997
1031
|
discoverAgents,
|
|
1032
|
+
eventReceiptStore,
|
|
1033
|
+
eventTranscriptMessageId,
|
|
998
1034
|
fileTopologyStore,
|
|
999
1035
|
findAgentFiles,
|
|
1000
1036
|
foundryDataEnvironmentPersistence,
|
|
@@ -1016,6 +1052,7 @@ export {
|
|
|
1016
1052
|
isFoundryTransmission,
|
|
1017
1053
|
isInboxCapableStore,
|
|
1018
1054
|
isMeshTransport,
|
|
1055
|
+
lateChatEffectId,
|
|
1019
1056
|
listFoundryApprovals,
|
|
1020
1057
|
memoryAccountDirectory,
|
|
1021
1058
|
memoryEventStore,
|
package/dist/voice.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IGloveRunnable } from 'glove-core';
|
|
1
|
+
import { AgentEvent, IGloveRunnable } from 'glove-core';
|
|
2
2
|
import { RealtimeAgent, RealtimeAgentConfig } from 'glove-voice-s2s';
|
|
3
|
-
import { A as AgentHandlerContext,
|
|
3
|
+
import { F as FoundryEventPreparation, a as FoundryEventReceipt, A as AgentHandlerContext, b as FoundryDelegationUpdate, c as FoundryMeshMessage } from './event-delivery-BfSL9sGo.js';
|
|
4
4
|
import 'effect';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import 'glove-mesh';
|
|
@@ -15,6 +15,73 @@ import 'glove-facts';
|
|
|
15
15
|
import 'glove-memory/goals';
|
|
16
16
|
import 'glove-memory/forms';
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Addressed events on a voice call: told at a pause in speech, from facts
|
|
20
|
+
* read just before telling, as product context rather than as the caller,
|
|
21
|
+
* with a durable receipt so that no restart says one twice.
|
|
22
|
+
*
|
|
23
|
+
* Each event moves through a receipt (see event-receipts.ts):
|
|
24
|
+
*
|
|
25
|
+
* queued ──prepare──▶ suppressed (nothing due: silent)
|
|
26
|
+
* │
|
|
27
|
+
* └─▶ dispatching ──inject──▶ accepted ──▶ transcript written ──▶ ack
|
|
28
|
+
* │
|
|
29
|
+
* └─ (crash here: the outcome is unknown; never replayed)
|
|
30
|
+
*
|
|
31
|
+
* queued at call end ──afterCall──▶ redirecting ──▶ redirected ──▶ ack
|
|
32
|
+
*
|
|
33
|
+
* The receipt is written before every step that has an effect, so recovery
|
|
34
|
+
* knows which steps happened. "accepted" means the provider's transport took
|
|
35
|
+
* the text locally: not that anyone heard it.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
interface VoiceEventContext {
|
|
39
|
+
readonly runId: string;
|
|
40
|
+
/** This call: with the run id, the generation a dispatch belongs to. */
|
|
41
|
+
readonly callId: string;
|
|
42
|
+
readonly agentId: string;
|
|
43
|
+
readonly conversationId: string;
|
|
44
|
+
readonly workspaceId: string;
|
|
45
|
+
/** The event's journal id: the same on every redelivery. */
|
|
46
|
+
readonly eventRecordId: string;
|
|
47
|
+
readonly signal: AbortSignal;
|
|
48
|
+
}
|
|
49
|
+
interface VoiceCallEvents {
|
|
50
|
+
/** Which addressed events (agent messages and transmissions) this call tells. Others are left to the run. */
|
|
51
|
+
readonly accept: (event: AgentEvent) => boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Read current facts just before telling, once the call has paused. Return
|
|
54
|
+
* `{ say }` with what to tell now or `{ suppress }` when nothing is due any
|
|
55
|
+
* more (cancelled, moved, too late). Throwing tells nothing and keeps the
|
|
56
|
+
* event for a later pause. Default: say the event's text.
|
|
57
|
+
*/
|
|
58
|
+
readonly prepare?: (event: AgentEvent, context: VoiceEventContext) => FoundryEventPreparation | Promise<FoundryEventPreparation>;
|
|
59
|
+
/** The transcript line for a told event. Default: `[event from <source>] <text>`. */
|
|
60
|
+
readonly transcript?: (event: AgentEvent, said: string) => string;
|
|
61
|
+
/**
|
|
62
|
+
* Tell an event some other way (a chat message, say) when its call ended
|
|
63
|
+
* before it was ever attempted, or when it arrives with no call open. Runs
|
|
64
|
+
* only for events never dispatched to the call, and under an `effectId`
|
|
65
|
+
* derived from the event that is the same on every retry: make the effect
|
|
66
|
+
* idempotent on it. Without this, such events stay pending for the
|
|
67
|
+
* conversation's next run.
|
|
68
|
+
*/
|
|
69
|
+
readonly afterCall?: (event: AgentEvent, context: VoiceEventContext & {
|
|
70
|
+
readonly effectId: string;
|
|
71
|
+
}) => Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* An event whose dispatch began on another run or call and whose outcome
|
|
74
|
+
* is unknown (the process died mid-dispatch). Return "accepted" or
|
|
75
|
+
* "suppressed" when the product can tell, from a provider receipt for
|
|
76
|
+
* instance. Anything else keeps it held: it is never spoken again or sent
|
|
77
|
+
* to chat automatically.
|
|
78
|
+
*/
|
|
79
|
+
readonly resolveUncertain?: (receipt: FoundryEventReceipt, context: VoiceEventContext) => Promise<"accepted" | "suppressed" | undefined>;
|
|
80
|
+
/** Ask the model to say something about a told event. Default true. */
|
|
81
|
+
readonly respond?: boolean;
|
|
82
|
+
}
|
|
83
|
+
declare function defaultEventTranscript(event: AgentEvent, said: string): string;
|
|
84
|
+
|
|
18
85
|
/**
|
|
19
86
|
* Foundry tools that have no place in a spoken conversation. Durable,
|
|
20
87
|
* long-running or bookkeeping work belongs to a delegate, not the call.
|
|
@@ -86,6 +153,15 @@ interface VoiceCallOptions {
|
|
|
86
153
|
* call starts knowing it.
|
|
87
154
|
*/
|
|
88
155
|
readonly offCall?: (agent: IGloveRunnable, context: AgentHandlerContext) => unknown;
|
|
156
|
+
/**
|
|
157
|
+
* Tell addressed events (agent messages and transmissions) on the call:
|
|
158
|
+
* the ones `accept` takes wait for a pause, are prepared from current facts
|
|
159
|
+
* just before they are told, go to the model as system context rather than
|
|
160
|
+
* as the caller, and keep a durable receipt so that no restart tells one
|
|
161
|
+
* twice. A run started only by such events, with no call to tell them on,
|
|
162
|
+
* opens no room: `afterCall` handles them, or they stay pending.
|
|
163
|
+
*/
|
|
164
|
+
readonly events?: VoiceCallEvents;
|
|
89
165
|
}
|
|
90
166
|
interface VoiceCallResult {
|
|
91
167
|
readonly endedBecause: string;
|
|
@@ -94,6 +170,8 @@ interface VoiceCallResult {
|
|
|
94
170
|
readonly turns: number;
|
|
95
171
|
/** Delegation updates and mesh messages put to the caller during the call. */
|
|
96
172
|
readonly updatesSpoken: number;
|
|
173
|
+
/** Addressed events told on the call (accepted by the provider, which is not proof they were heard). */
|
|
174
|
+
readonly eventsTold?: number;
|
|
97
175
|
}
|
|
98
176
|
/** The default way a delegation update is put to the model mid-call. */
|
|
99
177
|
declare function announceDelegationUpdate(update: FoundryDelegationUpdate): string;
|
|
@@ -169,4 +247,4 @@ interface WebSocketRoomOptions {
|
|
|
169
247
|
*/
|
|
170
248
|
declare function webSocketRoom(options: WebSocketRoomOptions): FoundryVoiceRoom;
|
|
171
249
|
|
|
172
|
-
export { type FoundryVoiceCall, type FoundryVoiceRoom, VOICE_EXCLUDED_FOUNDRY_TOOLS, type VoiceCallOptions, type VoiceCallResult, type VoiceRoomClientMessage, type VoiceRoomServerMessage, type WebSocketRoomOptions, announceDelegationUpdate, announceMeshMessage, voiceCall, webSocketRoom };
|
|
250
|
+
export { type FoundryVoiceCall, type FoundryVoiceRoom, VOICE_EXCLUDED_FOUNDRY_TOOLS, type VoiceCallEvents, type VoiceCallOptions, type VoiceCallResult, type VoiceEventContext, type VoiceRoomClientMessage, type VoiceRoomServerMessage, type WebSocketRoomOptions, announceDelegationUpdate, announceMeshMessage, defaultEventTranscript, voiceCall, webSocketRoom };
|