glove-foundry 0.5.2 → 0.6.1
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 +77 -0
- package/dist/chunk-B36BGF5R.js +530 -0
- package/dist/{chunk-PVOKR4CN.js → chunk-K2EU63MB.js} +5 -0
- package/dist/{chunk-6Q2LGPSC.js → chunk-OBTOFA7W.js} +15 -1
- package/dist/{chunk-NHV64WNO.js → chunk-RSU7NEDK.js} +9 -3
- package/dist/{chunk-MABLKZVO.js → chunk-TFGETZYH.js} +188 -10
- package/dist/{chunk-D2AHSYOB.js → chunk-X6EWEWWM.js} +875 -53
- package/dist/cli.js +4 -3
- package/dist/client-DWPYe_Nc.d.ts +888 -0
- package/dist/client.d.ts +2 -1
- package/dist/{client-CLTds1uV.d.ts → definition-A8o11aez.d.ts} +193 -822
- package/dist/execution-agent.js +5 -4
- package/dist/execution-daemon.js +37 -2
- package/dist/execution-loader.js +5 -4
- package/dist/index.d.ts +8 -3
- package/dist/index.js +29 -4
- package/dist/voice.d.ts +168 -0
- package/dist/voice.js +348 -0
- package/docs/building-with-foundry.md +28 -19
- package/docs/durable-execution.md +56 -0
- package/package.json +16 -9
package/dist/execution-agent.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
compileAgentModule
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-TFGETZYH.js";
|
|
4
|
+
import "./chunk-RSU7NEDK.js";
|
|
5
5
|
import {
|
|
6
6
|
bindAgentLocalDefinitions
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-OBTOFA7W.js";
|
|
8
|
+
import "./chunk-B36BGF5R.js";
|
|
8
9
|
import {
|
|
9
10
|
FOUNDRY_AGENT_FILE_ENV,
|
|
10
11
|
FOUNDRY_AGENT_ROUTE_ENV
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-K2EU63MB.js";
|
|
12
13
|
|
|
13
14
|
// src/execution-agent.ts
|
|
14
15
|
import { pathToFileURL } from "node:url";
|
package/dist/execution-daemon.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
FOUNDRY_APPLICATION_ENV,
|
|
6
6
|
internalAgentName
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-K2EU63MB.js";
|
|
8
8
|
|
|
9
9
|
// src/execution-daemon.ts
|
|
10
10
|
import { randomBytes } from "node:crypto";
|
|
@@ -15,12 +15,13 @@ import { pathToFileURL } from "node:url";
|
|
|
15
15
|
import { createStation, MemoryKeyStorage, MemoryLogStorage } from "station-daemon/server";
|
|
16
16
|
import { resolveConfig } from "station-daemon";
|
|
17
17
|
import { StationClient, StationApiError } from "station-client";
|
|
18
|
-
import { MemoryAdapter, configure } from "station-signal";
|
|
18
|
+
import { MemoryAdapter, configure, notifyLocalEnqueue } from "station-signal";
|
|
19
19
|
import { ScheduleMemoryAdapter } from "station-schedules";
|
|
20
20
|
import { MemoryEnvStorage } from "station-env";
|
|
21
21
|
var station;
|
|
22
22
|
var client;
|
|
23
23
|
var queue = new MemoryAdapter();
|
|
24
|
+
var PARKED_UNTIL = /* @__PURE__ */ new Date("9999-12-31T00:00:00.000Z");
|
|
24
25
|
var schedules = new ScheduleMemoryAdapter();
|
|
25
26
|
var definitions = /* @__PURE__ */ new Map();
|
|
26
27
|
var stopping;
|
|
@@ -110,9 +111,43 @@ export default await loadExecutionAgent(${JSON.stringify(agent.route)}, ${JSON.s
|
|
|
110
111
|
case "trigger": {
|
|
111
112
|
const definition = definitions.get(command.name);
|
|
112
113
|
if (!definition) throw new Error("Unknown agent definition.");
|
|
114
|
+
if (command.parked) {
|
|
115
|
+
const input = definition.inputSchema.parse(command.input);
|
|
116
|
+
const id = queue.generateId();
|
|
117
|
+
await queue.addRun({
|
|
118
|
+
id,
|
|
119
|
+
signalName: definition.name,
|
|
120
|
+
kind: "trigger",
|
|
121
|
+
input: JSON.stringify(input),
|
|
122
|
+
status: "pending",
|
|
123
|
+
attempts: 0,
|
|
124
|
+
maxAttempts: definition.maxAttempts,
|
|
125
|
+
timeout: definition.timeout,
|
|
126
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
127
|
+
nextRunAt: PARKED_UNTIL
|
|
128
|
+
});
|
|
129
|
+
value = id;
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
113
132
|
value = await definition.trigger(command.input);
|
|
114
133
|
break;
|
|
115
134
|
}
|
|
135
|
+
case "release": {
|
|
136
|
+
const run = await queue.getRun(command.id);
|
|
137
|
+
if (!run || run.status !== "pending") {
|
|
138
|
+
value = false;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
const definition = definitions.get(run.signalName);
|
|
142
|
+
if (!definition) throw new Error("Unknown agent definition.");
|
|
143
|
+
await queue.updateRun(command.id, {
|
|
144
|
+
input: JSON.stringify(definition.inputSchema.parse(command.input)),
|
|
145
|
+
nextRunAt: void 0
|
|
146
|
+
});
|
|
147
|
+
notifyLocalEnqueue();
|
|
148
|
+
value = true;
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
116
151
|
case "get":
|
|
117
152
|
value = await queue.getRun(command.id);
|
|
118
153
|
break;
|
package/dist/execution-loader.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
compileAgentModule
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-TFGETZYH.js";
|
|
4
|
+
import "./chunk-RSU7NEDK.js";
|
|
5
5
|
import {
|
|
6
6
|
bindAgentLocalDefinitions
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-OBTOFA7W.js";
|
|
8
|
+
import "./chunk-B36BGF5R.js";
|
|
9
|
+
import "./chunk-K2EU63MB.js";
|
|
9
10
|
|
|
10
11
|
// src/execution-loader.ts
|
|
11
12
|
import { dirname } from "node:path";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { a as FoundryDataAdapter, E as EnvironmentValue, b as AgentInstance, C as Conversation, P as PlaybookSubscription, c as FoundryActivationRecord, d as ProvisionAgentOptions, I as InboundDeliveryClaim, e as FoundryPendingInbound, W as WorkspaceEntry, f as FoundryWorkingEnvironmentSnapshotOwner, S as SharedInboxItem, g as FoundryTask, h as AgentPlaybook, i as AnyFoundryTransmission, j as AccountReference, k as InferAccountMetadata, l as AgentBinding, m as FoundryAgentApplication, n as InboundRoute, O as OutboundRoute, o as CapabilityDefinition, p as InferInboundConfig, q as InferOutboundConfig } from './definition-A8o11aez.js';
|
|
2
|
+
export { r as AccountContract, s as AccountId, t as AccountNotFound, u as AccountSessionUnavailable, v as AccountSummary, w as AgentApplicationContribution, x as AgentApplicationInstallContext, y as AgentApplicationOptions, z as AgentAssemblyContext, B as AgentAssemblyOptions, D as AgentDefinitionId, G as AgentDefinitionSurfaceContext, H as AgentFactoryContext, A as AgentHandlerContext, J as AgentId, K as AgentInstallContext, L as AgentInstallation, M as AgentInstallationKind, N as AgentPlaybookInput, Q as AgentProvisioningPolicy, R as AgentRuntimeControls, T as AnyFoundryAgent, U as ApplicationConnectionContext, V as ApplicationConnectionState, X as ApplicationConnectionStatus, Y as BindingId, Z as BindingNotFound, _ as CapabilityId, $ as ComposedAgentPlaybook, a0 as ComposedAgentPlaybookInput, a1 as ConnectionReceiveInput, a2 as CreateAgentInstanceOptions, a3 as CreateConversationOptions, a4 as CustomProvisionedAgent, a5 as CustomProvisioningContext, a6 as DefineAgentOptions, a7 as DefineConnectionOptions, a8 as DefineFoundryReplOptions, a9 as DefineFoundryScheduleOptions, aa as DefineFoundrySubagentOptions, ab as DefineFoundryWorkingEnvironmentOptions, ac as DefinePlaybookSubscriptionOptions, ad as DefinitionConfigInput, ae as EMPTY_AGENT_COMPOSITION, af as EMPTY_CAPABILITY_REGISTRY, ag as EMPTY_NATIVE_REGISTRY, ah as EgressAdapter, ai as EgressContext, aj as EventId, ak as EventNotFound, al as EventReference, am as FOUNDRY_AGENT_APPLICATION_BRAND, an as FOUNDRY_AGENT_BRAND, ao as FOUNDRY_AGENT_DEFINITION_BRAND, ap as FOUNDRY_AGENT_FILE_ENV, aq as FOUNDRY_AGENT_ROUTE_ENV, ar as FOUNDRY_APPLICATION_ENV, as as FOUNDRY_COMPOSED_PLAYBOOK_BRAND, at as FOUNDRY_CONNECTION_BRAND, au as FOUNDRY_CORE_COMMAND_EVENT, av as FOUNDRY_EVENT_PREFIX, aw as FOUNDRY_EXECUTION_MARKER, ax as FOUNDRY_LAYER_BRAND, ay as FOUNDRY_MCP_BRAND, az as FOUNDRY_MEMORY_BRAND, aA as FOUNDRY_PLAYBOOK_ACTION_BRAND, aB as FOUNDRY_REPL_BRAND, aC as FOUNDRY_SCHEDULE_BRAND, aD as FOUNDRY_SHARED_TOOL_BRAND, aE as FOUNDRY_SUBSCRIBER_BRAND, aF as FOUNDRY_TRANSMISSION_BRAND, aG as FOUNDRY_TRANSMISSION_EVENT_BRAND, aH as FOUNDRY_TRANSMISSION_PREDICATE_BRAND, aI as FOUNDRY_WORKING_ENVIRONMENT_BRAND, aJ as FoundryAccountSessionAdapter, aK as FoundryAgent, aL as FoundryAgentComponent, aM as FoundryAgentComposition, aN as FoundryAgentConventionModule, aO as FoundryAgentDefinition, aP as FoundryAgentMode, aQ as FoundryApp, aR as FoundryApplicationConnection, aS as FoundryCall, aT as FoundryCallContext, aU as FoundryCallOptions, aV as FoundryCapabilityKind, aW as FoundryCapabilityManifest, aX as FoundryCapabilityManifestEntry, aY as FoundryCapabilityRegistry, aZ as FoundryCompositionSource, a_ as FoundryContextProvider, a$ as FoundryCoreCommand, b0 as FoundryDelegate, b1 as FoundryDelegateOptions, b2 as FoundryDelegation, b3 as FoundryDelegationReply, b4 as FoundryDelegationStatus, F as FoundryDelegationUpdate, b5 as FoundryDomainError, b6 as FoundryExecutionContext, b7 as FoundryFactsOptions, b8 as FoundryFormsOptions, b9 as FoundryGoalsOptions, ba as FoundryGuidanceHandles, bb as FoundryGuidanceScope, bc as FoundryHookDefinition, bd as FoundryInstallable, be as FoundryInstanceProvisioner, bf as FoundryJavaScriptReplDefinition, bg as FoundryLayer, bh as FoundryLayerOptions, bi as FoundryLayerReference, bj as FoundryLayerSelection, bk as FoundryLispReplDefinition, bl as FoundryListResolver, bm as FoundryMcp, bn as FoundryMcpOptions, bo as FoundryMemoryProfile, bp as FoundryMemoryProfileOptions, bq as FoundryMemoryReference, br as FoundryMemorySelection, bs as FoundryMeshConfig, bt as FoundryMessageInput, bu as FoundryMountedRepl, bv as FoundryNativeManifest, bw as FoundryNativeManifestEntry, bx as FoundryNativeRegistry, by as FoundryPlaybookAction, bz as FoundryProgrammaticToolContext, bA as FoundryProgrammaticToolSelection, bB as FoundryProgrammaticTools, bC as FoundryPythonReplDefinition, bD as FoundryReplDefinition, bE as FoundryRequest, bF as FoundryResolvedMcp, bG as FoundryResolver, bH as FoundryResult, bI as FoundryRouteMap, bJ as FoundryScheduleDefinition, bK as FoundryScheduleTiming, bL as FoundryScheduleTimingInput, bM as FoundrySharedTool, bN as FoundrySubagentToolContext, bO as FoundrySubscriber, bP as FoundrySubscriberOptions, bQ as FoundrySubscriberSelection, bR as FoundrySurfaceContext, bS as FoundrySuspension, bT as FoundryToolBody, bU as FoundryTransmission, bV as FoundryTransmissionDelivery, bW as FoundryTransmissionEvent, bX as FoundryTransmissionPredicate, bY as FoundryVfs, bZ as FoundryVfsHandle, b_ as FoundryWorkingEnvironmentCreateContext, b$ as FoundryWorkingEnvironmentDefinition, c0 as FoundryWorkingEnvironmentPersistenceAdapter, c1 as FoundryWorkingEnvironmentPersistenceContext, c2 as GrantResolutionError, c3 as InboundContract, c4 as InferAgentInput, c5 as InferAgentOutput, c6 as InferInboundEvent, c7 as InferOutboundInput, c8 as InferOutboundOutput, c9 as IngressAdapter, ca as IngressContext, cb as InstallationSelection, cc as McpAdapterFactory, cd as MemoryFoundryDataAdapter, ce as OutboundContract, cf as PlaybookActionOptions, cg as PlaybookDirective, ch as PlaybookDirectiveInput, ci as PlaybookMatch, cj as PlaybookMatchInput, ck as PlaybookOutboundDirective, cl as PlaybookOutboundInput, cm as PlaybookSubscriptionTarget, cn as PlaybookSubscriptionTargetInput, co as ReplyPolicy, cp as Route, cq as RouteId, cr as RouteNotFound, cs as RunGrant, ct as RunId, cu as SharedToolOptions, cv as TopologyConflict, cw as TransmissionEventDirection, cx as TransmissionEventOptions, cy as TransmissionId, cz as TransmissionOptions, cA as TransmissionPredicateOptions, cB as TransmissionSerializationContext, cC as UpdateAgentInstanceOptions, cD as UpdateConversationOptions, cE as composeAgent, cF as composePlaybook, cG as configureLayer, cH as configureMemory, cI as createAgentInstance, cJ as createConversation, cK as createFoundryCoreTools, cL as createInstalledApplicationTransmissionTools, cM as defineAgent, cN as defineAgentApplication, cO as defineAgentFromModule, cP as defineAgentInstance, cQ as defineApp, cR as defineCall, cS as defineConnection, cT as defineFacts, cU as defineForms, cV as defineGoals, cW as defineLayer, cX as defineMcp, cY as defineMemory, cZ as definePlaybookAction, c_ as definePlaybookSubscription, c$ as defineRepl, d0 as defineRoutes, d1 as defineSchedule, d2 as defineSharedTool, d3 as defineSubagent, d4 as defineSubscriber, d5 as defineTransmission, d6 as defineTransmissionEvent, d7 as defineTransmissionPredicate, d8 as defineWorkingEnvironment, d9 as foundryDataEnvironmentPersistence, da as foundryGuidanceSubject, db as install, dc as installRegistry, dd as installationKey, de as installedApplicationTransmissionToolName, df as internalAgentName, dg as isFoundryAgent, dh as isFoundryAgentDefinition, di as isFoundryCapability, dj as isFoundryLayer, dk as isFoundrySchedule, dl as isFoundrySubscriber, dm as isFoundryTransmission, dn as isInboxCapableStore, dp as mountAgentDefinitionMemory, dq as mountFoundrySurfaces, dr as reconstructAgentInstance, ds as reconstructPlaybook, dt as reconstructPlaybookSubscription, du as routeFromInternalAgentName, dv as toGloveMessage, dw as toGloveRequestInput, dx as transmissionPredicate } from './definition-A8o11aez.js';
|
|
3
3
|
import { Effect } from 'effect';
|
|
4
4
|
import { EnvSnapshot } from 'glove-working-environment';
|
|
5
|
+
import { F as FoundryRuntime, D as DiscoveredAgent, a as FoundryManifest } from './client-DWPYe_Nc.js';
|
|
6
|
+
export { A as AccountDirectory, b as AccountFilter, c as AccountSessionAdapter, d as AccountSessionRequest, B as BindingFilter, E as EMPTY_FOUNDRY_APPLICATION, e as EventFilter, f as EventStore, g as FOUNDRY_APPLICATION_BRAND, h as FOUNDRY_APPROVAL_DIRECTORY_ENV, i as FoundryApplication, j as FoundryApplicationManifest, k as FoundryApplicationOptions, l as FoundryApproval, m as FoundryApprovalDecision, n as FoundryApprovalDisplayManager, o as FoundryApprovalStatus, p as FoundryClient, q as FoundryClientAuthorizationAdapter, r as FoundryClientOptions, s as FoundryConversationTranscript, t as FoundryEvent, u as FoundryEventCategory, v as FoundryHealth, w as FoundryManifestAgent, x as FoundryManifestCapability, y as FoundryManifestTransmission, z as FoundryObservabilityAdapter, C as FoundryRequestAuthorizationAdapter, G as FoundryRequestAuthorizationInput, H as FoundryRun, I as FoundryRunHandle, J as FoundryRuntimeError, K as FoundryRuntimeOptions, L as FoundrySteerHandleResult, M as FoundrySteerResult, N as GrantResolver, O as ManifestCompilationError, P as MemoryObservabilityAdapter, R as ResolveGrantRequest, Q as RouteFilter, T as TopologyStore, W as WaitOptions, S as compileApplicationManifest, U as createFoundryApproval, V as createFoundryClient, X as createManifest, Y as defineApplication, Z as discoverAgents, _ as findAgentFiles, $ as grantResolverLive, a0 as isFoundryApplication, a1 as listFoundryApprovals, a2 as memoryAccountDirectory, a3 as memoryEventStore, a4 as memoryTopologyStore, a5 as resolveFoundryApproval, a6 as routeFromAgentFile, a7 as withFoundryPermissions } from './client-DWPYe_Nc.js';
|
|
5
7
|
import { AddressInfo } from 'node:net';
|
|
6
8
|
import { FoundryBrandingConfig } from './config.js';
|
|
7
9
|
export { FoundryConfig, FoundryExecutionConfig, defineConfig } from './config.js';
|
|
@@ -70,6 +72,9 @@ declare class FileFoundryDataAdapter implements FoundryDataAdapter {
|
|
|
70
72
|
getInboundDelivery(key: string): Effect.Effect<InboundDeliveryClaim | null, unknown, never>;
|
|
71
73
|
claimInboundDelivery(key: string): Effect.Effect<boolean, unknown, never>;
|
|
72
74
|
completeInboundDelivery(key: string, runIds: ReadonlyArray<string>): Effect.Effect<void, unknown, never>;
|
|
75
|
+
putPendingInbound(record: FoundryPendingInbound): Effect.Effect<void, unknown, never>;
|
|
76
|
+
deletePendingInbound(id: string): Effect.Effect<void, unknown, never>;
|
|
77
|
+
listPendingInbound(): Effect.Effect<FoundryPendingInbound[], unknown, never>;
|
|
73
78
|
releaseInboundDelivery(key: string): Effect.Effect<void, unknown, never>;
|
|
74
79
|
getActivation(id: string): Effect.Effect<FoundryActivationRecord | null, unknown, never>;
|
|
75
80
|
putActivation(activation: FoundryActivationRecord): Effect.Effect<void, unknown, never>;
|
|
@@ -188,4 +193,4 @@ interface DefineBindingOptions extends Omit<AgentBinding, "id" | "agentId" | "tr
|
|
|
188
193
|
}
|
|
189
194
|
declare function defineBinding(options: DefineBindingOptions): AgentBinding;
|
|
190
195
|
|
|
191
|
-
export { AccountReference, AgentBinding, AgentInstance, AgentPlaybook, AnyFoundryTransmission, CapabilityDefinition, Conversation, type DefineAccountOptions, type DefineBindingOptions, type DefineInboundRouteOptions, type DefineOutboundRouteOptions, DiscoveredAgent, EnvironmentValue, FileFoundryDataAdapter, type FileFoundryDataAdapterOptions, FoundryActivationRecord, FoundryAgentApplication, FoundryBrandingConfig, FoundryDataAdapter, FoundryManifest, FoundryRuntime, FoundryServer, type FoundryServerOptions, FoundryTask, FoundryWorkingEnvironmentSnapshotOwner, InboundDeliveryClaim, InboundRoute, InferAccountMetadata, InferInboundConfig, InferOutboundConfig, OutboundRoute, PlaybookSubscription, ProvisionAgentOptions, SharedInboxItem, WorkspaceEntry, defineAccount, defineBinding, defineInboundRoute, defineOutboundRoute, serializeInboundTransmissionXml, writeGeneratedTypes };
|
|
196
|
+
export { AccountReference, AgentBinding, AgentInstance, AgentPlaybook, AnyFoundryTransmission, CapabilityDefinition, Conversation, type DefineAccountOptions, type DefineBindingOptions, type DefineInboundRouteOptions, type DefineOutboundRouteOptions, DiscoveredAgent, EnvironmentValue, FileFoundryDataAdapter, type FileFoundryDataAdapterOptions, FoundryActivationRecord, FoundryAgentApplication, FoundryBrandingConfig, FoundryDataAdapter, FoundryManifest, FoundryPendingInbound, FoundryRuntime, FoundryServer, type FoundryServerOptions, FoundryTask, FoundryWorkingEnvironmentSnapshotOwner, InboundDeliveryClaim, InboundRoute, InferAccountMetadata, InferInboundConfig, InferOutboundConfig, OutboundRoute, PlaybookSubscription, ProvisionAgentOptions, SharedInboxItem, WorkspaceEntry, defineAccount, defineBinding, defineInboundRoute, defineOutboundRoute, serializeInboundTransmissionXml, writeGeneratedTypes };
|
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-X6EWEWWM.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-RSU7NEDK.js";
|
|
67
67
|
import {
|
|
68
68
|
EMPTY_AGENT_COMPOSITION,
|
|
69
69
|
EMPTY_CAPABILITY_REGISTRY,
|
|
@@ -129,7 +129,8 @@ import {
|
|
|
129
129
|
toGloveRequestInput,
|
|
130
130
|
transmissionPredicate,
|
|
131
131
|
withFoundryPermissions
|
|
132
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-OBTOFA7W.js";
|
|
133
|
+
import "./chunk-B36BGF5R.js";
|
|
133
134
|
import {
|
|
134
135
|
EMPTY_NATIVE_REGISTRY,
|
|
135
136
|
FOUNDRY_AGENT_BRAND,
|
|
@@ -156,7 +157,7 @@ import {
|
|
|
156
157
|
isFoundrySubscriber,
|
|
157
158
|
mountFoundrySurfaces,
|
|
158
159
|
routeFromInternalAgentName
|
|
159
|
-
} from "./chunk-
|
|
160
|
+
} from "./chunk-K2EU63MB.js";
|
|
160
161
|
|
|
161
162
|
// src/file-data.ts
|
|
162
163
|
import { randomUUID } from "node:crypto";
|
|
@@ -169,6 +170,7 @@ function emptyState(environment) {
|
|
|
169
170
|
agents: [],
|
|
170
171
|
subscriptions: [],
|
|
171
172
|
inboundDeliveries: [],
|
|
173
|
+
pendingInbound: [],
|
|
172
174
|
activations: [],
|
|
173
175
|
conversations: [],
|
|
174
176
|
workspaceEntries: [],
|
|
@@ -275,6 +277,7 @@ var FileFoundryDataAdapter = class {
|
|
|
275
277
|
agents: parsed.agents ?? [],
|
|
276
278
|
subscriptions: parsed.subscriptions ?? [],
|
|
277
279
|
inboundDeliveries: parsed.inboundDeliveries ?? [],
|
|
280
|
+
pendingInbound: parsed.pendingInbound ?? [],
|
|
278
281
|
activations: parsed.activations ?? [],
|
|
279
282
|
conversations: parsed.conversations ?? [],
|
|
280
283
|
workspaceEntries: parsed.workspaceEntries ?? [],
|
|
@@ -447,6 +450,28 @@ var FileFoundryDataAdapter = class {
|
|
|
447
450
|
});
|
|
448
451
|
});
|
|
449
452
|
}
|
|
453
|
+
putPendingInbound(record) {
|
|
454
|
+
return effect(async () => {
|
|
455
|
+
await this.ensureInitialized();
|
|
456
|
+
await this.mutate((state) => {
|
|
457
|
+
state.pendingInbound = [
|
|
458
|
+
...state.pendingInbound.filter((item) => item.id !== record.id),
|
|
459
|
+
structuredClone(record)
|
|
460
|
+
];
|
|
461
|
+
});
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
deletePendingInbound(id) {
|
|
465
|
+
return effect(async () => {
|
|
466
|
+
await this.ensureInitialized();
|
|
467
|
+
await this.mutate((state) => {
|
|
468
|
+
state.pendingInbound = state.pendingInbound.filter((item) => item.id !== id);
|
|
469
|
+
});
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
listPendingInbound() {
|
|
473
|
+
return effect(async () => structuredClone((await this.snapshot()).pendingInbound));
|
|
474
|
+
}
|
|
450
475
|
releaseInboundDelivery(key) {
|
|
451
476
|
return effect(async () => {
|
|
452
477
|
await this.ensureInitialized();
|
package/dist/voice.d.ts
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { IGloveRunnable } from 'glove-core';
|
|
2
|
+
import { RealtimeAgent, RealtimeAgentConfig } from 'glove-voice-s2s';
|
|
3
|
+
import { A as AgentHandlerContext, F as FoundryDelegationUpdate } from './definition-A8o11aez.js';
|
|
4
|
+
import 'effect';
|
|
5
|
+
import 'zod';
|
|
6
|
+
import 'glove-mesh';
|
|
7
|
+
import 'glove-mcp';
|
|
8
|
+
import 'glove-memory';
|
|
9
|
+
import 'glove-memory/tools';
|
|
10
|
+
import 'glove-working-environment';
|
|
11
|
+
import 'glove-js';
|
|
12
|
+
import 'glove-lisp';
|
|
13
|
+
import 'glove-python';
|
|
14
|
+
import 'glove-facts';
|
|
15
|
+
import 'glove-memory/goals';
|
|
16
|
+
import 'glove-memory/forms';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Foundry tools that have no place in a spoken conversation. Durable,
|
|
20
|
+
* long-running or bookkeeping work belongs to a delegate, not the call.
|
|
21
|
+
*/
|
|
22
|
+
declare const VOICE_EXCLUDED_FOUNDRY_TOOLS: ReadonlyArray<string>;
|
|
23
|
+
/**
|
|
24
|
+
* Where a call's audio comes from and goes to: a WebSocket the browser
|
|
25
|
+
* connects to, a LiveKit room, a phone bridge. `voiceCall` starts the
|
|
26
|
+
* realtime session, then hands it to the room.
|
|
27
|
+
*/
|
|
28
|
+
interface FoundryVoiceRoom {
|
|
29
|
+
/** Connect the session to callers. Call `joined()` and `left()` as they come and go. */
|
|
30
|
+
open(call: FoundryVoiceCall): void | Promise<void>;
|
|
31
|
+
/** The call is over: release ports and connections. */
|
|
32
|
+
close(): void | Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
interface FoundryVoiceCall {
|
|
35
|
+
/** The live session: feed it caller audio, listen to its `audio` and speech events. */
|
|
36
|
+
readonly realtime: RealtimeAgent;
|
|
37
|
+
readonly runId: string;
|
|
38
|
+
/** Record an event on the run's trace. */
|
|
39
|
+
readonly emit: (event: {
|
|
40
|
+
type: string;
|
|
41
|
+
data?: unknown;
|
|
42
|
+
}) => void;
|
|
43
|
+
/** A caller connected. The first one hears the greeting. */
|
|
44
|
+
joined(): void;
|
|
45
|
+
/** A caller went away. The call ends after `idleMs` with nobody connected. */
|
|
46
|
+
left(): void;
|
|
47
|
+
/** The caller typed instead of speaking: saved to the transcript and answered. */
|
|
48
|
+
say(text: string): void;
|
|
49
|
+
/** Hang up now. */
|
|
50
|
+
end(reason: string): void;
|
|
51
|
+
}
|
|
52
|
+
interface VoiceCallOptions {
|
|
53
|
+
/**
|
|
54
|
+
* The room the call happens in. Rooms are usually per call (a port and a
|
|
55
|
+
* token, a LiveKit room name), so this can be a function of the run.
|
|
56
|
+
*/
|
|
57
|
+
readonly room: FoundryVoiceRoom | ((context: AgentHandlerContext) => FoundryVoiceRoom | Promise<FoundryVoiceRoom>);
|
|
58
|
+
/**
|
|
59
|
+
* What to tell the model when the first caller joins, such as "Greet the
|
|
60
|
+
* caller in one short sentence." Omit it to wait for the caller to speak.
|
|
61
|
+
*/
|
|
62
|
+
readonly greeting?: string;
|
|
63
|
+
/** End the call after this long with nobody connected. Default 2 minutes. */
|
|
64
|
+
readonly idleMs?: number;
|
|
65
|
+
/** End the call after this long in any case. Default 30 minutes. */
|
|
66
|
+
readonly maxDurationMs?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Wait this long after the session connects before opening the room. Some
|
|
69
|
+
* providers confirm their setup just after the socket opens. Default 0.
|
|
70
|
+
*/
|
|
71
|
+
readonly openDelayMs?: number;
|
|
72
|
+
/** Save what both sides say to the conversation's store. Default true. */
|
|
73
|
+
readonly transcript?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Passed to RealtimeAgent: an explicit `adapter`, `voice`, `instructions`,
|
|
76
|
+
* `excludeTools` (added to the defaults) and `onToolCall`.
|
|
77
|
+
*/
|
|
78
|
+
readonly realtime?: Omit<RealtimeAgentConfig, "agent">;
|
|
79
|
+
/** How a delegation update is put to the model. Return null to keep it silent. */
|
|
80
|
+
readonly announce?: (update: FoundryDelegationUpdate) => string | null;
|
|
81
|
+
/**
|
|
82
|
+
* A run that is not a call: a delegation result that arrived after the
|
|
83
|
+
* caller hung up. By default it is saved to the conversation, so the next
|
|
84
|
+
* call starts knowing it.
|
|
85
|
+
*/
|
|
86
|
+
readonly offCall?: (agent: IGloveRunnable, context: AgentHandlerContext) => unknown;
|
|
87
|
+
}
|
|
88
|
+
interface VoiceCallResult {
|
|
89
|
+
readonly endedBecause: string;
|
|
90
|
+
readonly durationMs: number;
|
|
91
|
+
/** How many times the agent spoke. */
|
|
92
|
+
readonly turns: number;
|
|
93
|
+
/** Delegation updates put to the caller during the call. */
|
|
94
|
+
readonly updatesSpoken: number;
|
|
95
|
+
}
|
|
96
|
+
/** The default way a delegation update is put to the model mid-call. */
|
|
97
|
+
declare function announceDelegationUpdate(update: FoundryDelegationUpdate): string;
|
|
98
|
+
/**
|
|
99
|
+
* Run an agent as a live voice call: use it as a definition's `run`.
|
|
100
|
+
*
|
|
101
|
+
* The agent's prompt, tools and context configure a realtime speech session
|
|
102
|
+
* (its model must be `s2sDrivenModel(...)`, or pass `realtime.adapter`). The
|
|
103
|
+
* room connects callers. What both sides say is saved to the conversation.
|
|
104
|
+
* Delegation results and questions are spoken at the next pause instead of
|
|
105
|
+
* waiting for the call to end. Foundry's bookkeeping tools and any tool that
|
|
106
|
+
* needs an approval are kept off the call; delegate that work instead.
|
|
107
|
+
*/
|
|
108
|
+
declare function voiceCall(options: VoiceCallOptions): (agent: IGloveRunnable, context: AgentHandlerContext) => Promise<VoiceCallResult | unknown>;
|
|
109
|
+
/** Sent by the caller's page: typed text, or "stop talking". Audio is binary PCM16. */
|
|
110
|
+
type VoiceRoomClientMessage = {
|
|
111
|
+
readonly t: "say";
|
|
112
|
+
readonly text: string;
|
|
113
|
+
} | {
|
|
114
|
+
readonly t: "barge_in";
|
|
115
|
+
};
|
|
116
|
+
/** Sent to the caller's page. Audio is binary PCM16 at the room's sample rate. */
|
|
117
|
+
type VoiceRoomServerMessage = {
|
|
118
|
+
readonly t: "ready";
|
|
119
|
+
readonly sessionId: string;
|
|
120
|
+
readonly agent: string;
|
|
121
|
+
readonly model: string;
|
|
122
|
+
readonly tools: ReadonlyArray<string>;
|
|
123
|
+
} | {
|
|
124
|
+
readonly t: "utterance";
|
|
125
|
+
readonly text: string;
|
|
126
|
+
} | {
|
|
127
|
+
readonly t: "speech";
|
|
128
|
+
readonly turnId: number;
|
|
129
|
+
readonly text: string;
|
|
130
|
+
} | {
|
|
131
|
+
readonly t: "speech_end";
|
|
132
|
+
readonly turnId: number;
|
|
133
|
+
} | {
|
|
134
|
+
readonly t: "tool";
|
|
135
|
+
readonly name: string;
|
|
136
|
+
readonly phase: "start" | "done" | "error";
|
|
137
|
+
} | {
|
|
138
|
+
readonly t: "state";
|
|
139
|
+
readonly state: "listening" | "thinking" | "speaking";
|
|
140
|
+
} | {
|
|
141
|
+
readonly t: "clear";
|
|
142
|
+
} | {
|
|
143
|
+
readonly t: "error";
|
|
144
|
+
readonly message: string;
|
|
145
|
+
};
|
|
146
|
+
interface WebSocketRoomOptions {
|
|
147
|
+
readonly port: number;
|
|
148
|
+
/** Default 127.0.0.1. Put the room behind your own proxy to reach it from elsewhere. */
|
|
149
|
+
readonly host?: string;
|
|
150
|
+
/** Default "/call". */
|
|
151
|
+
readonly path?: string;
|
|
152
|
+
/** A caller connects with `?token=…`; anything else is refused. */
|
|
153
|
+
readonly token: string;
|
|
154
|
+
/** PCM16 mono sample rate on the wire. Default 16000. */
|
|
155
|
+
readonly sampleRate?: number;
|
|
156
|
+
/** Shown to the caller's page in the ready message. */
|
|
157
|
+
readonly agentName?: string;
|
|
158
|
+
readonly model?: string;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* A call room a browser joins over one WebSocket: binary PCM16 both ways,
|
|
162
|
+
* plus small JSON messages for captions, state and typed text. One caller at
|
|
163
|
+
* a time; a new connection replaces the old. `GET /health` reports whether
|
|
164
|
+
* someone is connected.
|
|
165
|
+
*/
|
|
166
|
+
declare function webSocketRoom(options: WebSocketRoomOptions): FoundryVoiceRoom;
|
|
167
|
+
|
|
168
|
+
export { type FoundryVoiceCall, type FoundryVoiceRoom, VOICE_EXCLUDED_FOUNDRY_TOOLS, type VoiceCallOptions, type VoiceCallResult, type VoiceRoomClientMessage, type VoiceRoomServerMessage, type WebSocketRoomOptions, announceDelegationUpdate, voiceCall, webSocketRoom };
|