glove-foundry 0.8.0 → 0.9.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-DTFCEX67.js → chunk-LI7VIGVH.js} +575 -40
- package/dist/cli.js +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/execution-loader.js +83 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/docs/inspector.md +191 -7
- package/package.json +11 -11
- package/dist/{client-CekanYLW.d.ts → client-CCY4_vqN.d.ts} +1 -1
package/dist/cli.js
CHANGED
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'glove-core';
|
|
2
2
|
import './event-delivery-CNCsVqi8.js';
|
|
3
|
-
export { k as FoundryClient, l as FoundryClientAuthorizationAdapter, m as FoundryClientOptions, q as FoundryHealth, y as FoundryRunHandle, G as FoundrySteerHandleResult, W as WaitOptions, N as createFoundryClient } from './client-
|
|
3
|
+
export { k as FoundryClient, l as FoundryClientAuthorizationAdapter, m as FoundryClientOptions, q as FoundryHealth, y as FoundryRunHandle, G as FoundrySteerHandleResult, W as WaitOptions, N as createFoundryClient } from './client-CCY4_vqN.js';
|
|
4
4
|
import 'effect';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import 'glove-mesh';
|
package/dist/execution-loader.js
CHANGED
|
@@ -87,6 +87,38 @@ import { mountMesh } from "glove-mesh";
|
|
|
87
87
|
import { Effect } from "effect";
|
|
88
88
|
import { signal } from "station-signal";
|
|
89
89
|
import { z } from "zod";
|
|
90
|
+
|
|
91
|
+
// src/assembly-trace.ts
|
|
92
|
+
var FOUNDRY_ASSEMBLY_COMPOSED_EVENT = "foundry.assembly.composed";
|
|
93
|
+
function assemblyRecorder(glove, now = Date.now) {
|
|
94
|
+
const started = now();
|
|
95
|
+
let last = started;
|
|
96
|
+
const known = /* @__PURE__ */ new Set();
|
|
97
|
+
const steps = [];
|
|
98
|
+
return {
|
|
99
|
+
mark(step, label, options = {}) {
|
|
100
|
+
const names = (options.glove ?? glove).tools.map((tool) => tool.name);
|
|
101
|
+
const added = names.filter((name) => !known.has(name));
|
|
102
|
+
for (const name of names) known.add(name);
|
|
103
|
+
const at = now();
|
|
104
|
+
const ms = at - last;
|
|
105
|
+
last = at;
|
|
106
|
+
if (!added.length && ms < 1 && !options.keep) return;
|
|
107
|
+
steps.push({
|
|
108
|
+
step,
|
|
109
|
+
label,
|
|
110
|
+
...options.kind ? { kind: options.kind } : {},
|
|
111
|
+
...options.id ? { id: options.id } : {},
|
|
112
|
+
tools: added,
|
|
113
|
+
ms
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
steps,
|
|
117
|
+
elapsedMs: () => now() - started
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// src/agent-runtime.ts
|
|
90
122
|
var DEFAULT_ANSWER_WAIT_MS = 9e4;
|
|
91
123
|
var INBOX_ITEMS_SCHEMA = z.array(z.object({
|
|
92
124
|
id: z.string().min(1),
|
|
@@ -396,6 +428,8 @@ async function executeDefinition(definition, id, runtimeValue) {
|
|
|
396
428
|
...definition.enableToolResultSummary !== void 0 ? { enableToolResultSummary: definition.enableToolResultSummary } : {}
|
|
397
429
|
}).build();
|
|
398
430
|
base.addSubscriber(subscriber);
|
|
431
|
+
const assembly = assemblyRecorder(base);
|
|
432
|
+
assembly.mark("glove", "Glove built-ins");
|
|
399
433
|
const [tools, hooks, skills, subagents, delegates, memory, inboxItems, layers, subscribers, calls, playbooks, schedules, mesh, workingEnvironment, repl] = await Promise.all([
|
|
400
434
|
resolveOptional("tools", definition.tools, []),
|
|
401
435
|
resolveOptional("hooks", definition.hooks, []),
|
|
@@ -491,6 +525,7 @@ async function executeDefinition(definition, id, runtimeValue) {
|
|
|
491
525
|
playbooks: desiredPlaybooks,
|
|
492
526
|
applications: registry.capabilities.applications
|
|
493
527
|
})) base.fold(tool);
|
|
528
|
+
assembly.mark("foundry-core", "Foundry core tools");
|
|
494
529
|
const applicationTransmissionTools = createInstalledApplicationTransmissionTools(
|
|
495
530
|
assemblyContext,
|
|
496
531
|
registry.capabilities.applications,
|
|
@@ -498,6 +533,7 @@ async function executeDefinition(definition, id, runtimeValue) {
|
|
|
498
533
|
desiredPlaybooks
|
|
499
534
|
);
|
|
500
535
|
for (const tool of applicationTransmissionTools) base.fold(tool);
|
|
536
|
+
assembly.mark("transmissions", "App transmissions");
|
|
501
537
|
if (applicationTransmissionTools.length > 0) {
|
|
502
538
|
controls.emit({
|
|
503
539
|
type: "foundry.application.transmission-tools.mounted",
|
|
@@ -510,6 +546,7 @@ async function executeDefinition(definition, id, runtimeValue) {
|
|
|
510
546
|
for (const hook of hooks) base.defineHook(hook.name, hook.handler);
|
|
511
547
|
for (const skill of skills) base.defineSkill(skill);
|
|
512
548
|
for (const subagent of subagents) base.defineSubAgent(subagent);
|
|
549
|
+
assembly.mark("definition", "Definition tools, skills and subagents");
|
|
513
550
|
const mailboxDirectory = process.env[FOUNDRY_MAILBOX_DIRECTORY_ENV];
|
|
514
551
|
const emitDelegationCommand = (command) => {
|
|
515
552
|
controls.commands.push(command);
|
|
@@ -676,7 +713,9 @@ async function executeDefinition(definition, id, runtimeValue) {
|
|
|
676
713
|
const pendingReply = {};
|
|
677
714
|
const ownThread = assemblyContext.thread;
|
|
678
715
|
const hostedMesh = hostedMeshOptions(definition.mesh);
|
|
679
|
-
if (
|
|
716
|
+
if (ownDelegation || normalizedDelegates.length || durableNames.length) assembly.mark("delegation", "Delegation");
|
|
717
|
+
const meshHosted = Boolean(hostedMesh && (hostedMesh.mount?.(assemblyContext) ?? true));
|
|
718
|
+
if (hostedMesh && meshHosted) {
|
|
680
719
|
for (const tool of createMeshTools({
|
|
681
720
|
definitionId: id,
|
|
682
721
|
agentId: request.agentId,
|
|
@@ -691,6 +730,7 @@ async function executeDefinition(definition, id, runtimeValue) {
|
|
|
691
730
|
type: "foundry.mesh.mounted",
|
|
692
731
|
data: { open: assemblyContext.threads.length, thread: ownThread?.id ?? null }
|
|
693
732
|
});
|
|
733
|
+
assembly.mark("mesh", "Hosted mesh");
|
|
694
734
|
}
|
|
695
735
|
if (hostedMesh || assemblyContext.threads.length > 0 || ownThread) {
|
|
696
736
|
base.addContextProvider(() => [
|
|
@@ -709,6 +749,7 @@ async function executeDefinition(definition, id, runtimeValue) {
|
|
|
709
749
|
apps: () => installedApps
|
|
710
750
|
});
|
|
711
751
|
cleanups.push(workbench.dispose);
|
|
752
|
+
assembly.mark("workbench", "Working environment");
|
|
712
753
|
const callByName = /* @__PURE__ */ new Map();
|
|
713
754
|
const invoke = async (name, callInput) => {
|
|
714
755
|
const call = callByName.get(name);
|
|
@@ -749,6 +790,7 @@ async function executeDefinition(definition, id, runtimeValue) {
|
|
|
749
790
|
guidance.dispose();
|
|
750
791
|
}
|
|
751
792
|
});
|
|
793
|
+
assembly.mark("guidance", "Goals, facts and forms");
|
|
752
794
|
const callContext = {
|
|
753
795
|
...surfaceContext,
|
|
754
796
|
...guidance.handles,
|
|
@@ -795,12 +837,14 @@ async function executeDefinition(definition, id, runtimeValue) {
|
|
|
795
837
|
});
|
|
796
838
|
}
|
|
797
839
|
}
|
|
840
|
+
assembly.mark("calls", "Calls");
|
|
798
841
|
disposeSurfaces = await mountFoundrySurfaces({
|
|
799
842
|
registry: registry.native,
|
|
800
843
|
layers,
|
|
801
844
|
subscribers,
|
|
802
845
|
context: surfaceContext
|
|
803
846
|
});
|
|
847
|
+
assembly.mark("surfaces", "Layers and subscribers");
|
|
804
848
|
await Effect.runPromise(
|
|
805
849
|
installRegistry({
|
|
806
850
|
registry: registry.capabilities,
|
|
@@ -830,7 +874,14 @@ async function executeDefinition(definition, id, runtimeValue) {
|
|
|
830
874
|
messages,
|
|
831
875
|
glove: base,
|
|
832
876
|
store: base.store,
|
|
833
|
-
|
|
877
|
+
// Each installation's tools are folded just before it reports completing.
|
|
878
|
+
emit: (event) => {
|
|
879
|
+
if (event.type === "foundry.installation.completed") {
|
|
880
|
+
const installed = event.data;
|
|
881
|
+
assembly.mark("installation", installed.id ?? "installation", { keep: true, ...installed.kind ? { kind: installed.kind } : {}, ...installed.id ? { id: installed.id } : {} });
|
|
882
|
+
}
|
|
883
|
+
controls.emit(event);
|
|
884
|
+
}
|
|
834
885
|
},
|
|
835
886
|
...definition.mcpAdapter ? { mcpAdapter: definition.mcpAdapter } : {},
|
|
836
887
|
...definition.accountSessions ? { accountSessions: definition.accountSessions } : {},
|
|
@@ -842,6 +893,7 @@ async function executeDefinition(definition, id, runtimeValue) {
|
|
|
842
893
|
}
|
|
843
894
|
})
|
|
844
895
|
);
|
|
896
|
+
assembly.mark("mcp", "MCP servers");
|
|
845
897
|
await Effect.runPromise(
|
|
846
898
|
mountAgentDefinitionMemory({
|
|
847
899
|
registry: registry.capabilities,
|
|
@@ -865,6 +917,7 @@ async function executeDefinition(definition, id, runtimeValue) {
|
|
|
865
917
|
}
|
|
866
918
|
})
|
|
867
919
|
);
|
|
920
|
+
assembly.mark("memory", "Memory");
|
|
868
921
|
if (definition.inboxes) {
|
|
869
922
|
await hydrateInbox(base.store, inboxItems, controls.emit);
|
|
870
923
|
}
|
|
@@ -888,12 +941,16 @@ async function executeDefinition(definition, id, runtimeValue) {
|
|
|
888
941
|
}
|
|
889
942
|
});
|
|
890
943
|
cleanups.push(() => mesh.adapter.unregister());
|
|
944
|
+
assembly.mark("mesh", "Mesh transport");
|
|
891
945
|
}
|
|
892
946
|
if (definition.configure) {
|
|
893
947
|
await resolveResolvable(definition.configure(base, callContext));
|
|
948
|
+
assembly.mark("configure", "configure()");
|
|
894
949
|
}
|
|
895
950
|
await workbench.mountRepl();
|
|
951
|
+
assembly.mark("repl", "REPL");
|
|
896
952
|
const glove = definition.build ? await resolveResolvable(definition.build(base, assemblyContext)) ?? base : base;
|
|
953
|
+
if (glove !== base) assembly.mark("build", "build()", { glove });
|
|
897
954
|
if (glove !== base) {
|
|
898
955
|
base.removeSubscriber(subscriber);
|
|
899
956
|
base.removeSubscriber(deliverySubscriber);
|
|
@@ -905,6 +962,30 @@ async function executeDefinition(definition, id, runtimeValue) {
|
|
|
905
962
|
glove.removeSubscriber(deliverySubscriber);
|
|
906
963
|
});
|
|
907
964
|
eventRecipient = glove;
|
|
965
|
+
controls.emit({
|
|
966
|
+
type: FOUNDRY_ASSEMBLY_COMPOSED_EVENT,
|
|
967
|
+
data: {
|
|
968
|
+
durationMs: assembly.elapsedMs(),
|
|
969
|
+
steps: assembly.steps,
|
|
970
|
+
tools: glove.tools.map((tool) => tool.name),
|
|
971
|
+
installations: effectiveInstallations.map((installation) => ({ kind: installation.kind, id: installation.id, ...installation.accountId ? { accountId: installation.accountId } : {} })),
|
|
972
|
+
apps: installedApps.map((app) => ({ id: app.id, description: app.description, ...app.accountId ? { accountId: app.accountId } : {}, tools: app.tools })),
|
|
973
|
+
playbooks: desiredPlaybooks.map((playbook) => ({ id: playbook.id, ...playbook.playbookName ? { name: playbook.playbookName } : {} })),
|
|
974
|
+
schedules: desiredSchedules.map((schedule) => ({ name: schedule.name, timing: schedule.timing, enabled: schedule.enabled })),
|
|
975
|
+
delegates: normalizedDelegates.map((delegate) => ({ agent: delegate.agent, ...delegate.description ? { description: delegate.description } : {} })),
|
|
976
|
+
durableSubagents: durableNames,
|
|
977
|
+
openDelegations: assemblyContext.delegations.length,
|
|
978
|
+
...ownDelegation ? { delegation: { id: ownDelegation.id, from: ownDelegation.from.definitionId, task: ownDelegation.task } } : {},
|
|
979
|
+
mesh: { hosted: meshHosted, transport: Boolean(mesh), threads: assemblyContext.threads.length, ...ownThread ? { thread: ownThread.id } : {} },
|
|
980
|
+
hooks: hooks.map((hook) => hook.name),
|
|
981
|
+
skills: skills.map((skill) => skill.name),
|
|
982
|
+
subagents: subagents.map((subagent) => subagent.name),
|
|
983
|
+
calls: calls.map((call) => ({ name: call.name, exposed: call.exposeToAgent ?? true })),
|
|
984
|
+
workingEnvironment: Boolean(workbench.workingEnvironment),
|
|
985
|
+
repl: Boolean(workbench.repl),
|
|
986
|
+
events: { initial: initialDeliveries.length, buffered: bufferedDeliveries.length }
|
|
987
|
+
}
|
|
988
|
+
});
|
|
908
989
|
await forwardDeliveries(bufferedDeliveries.splice(0));
|
|
909
990
|
const runtimeContext = { ...callContext, glove };
|
|
910
991
|
let initialEventsPending = initialDeliveries.length > 0;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { b as FoundryDataAdapter, E as EnvironmentValue, c as AgentInstance, C a
|
|
|
2
2
|
export { u as AccountContract, v as AccountId, w as AccountNotFound, x as AccountSessionUnavailable, y as AccountSummary, z as AgentApplicationContribution, B as AgentApplicationInstallContext, D as AgentApplicationOptions, G as AgentAssemblyContext, H as AgentAssemblyOptions, J as AgentDefinitionId, K as AgentDefinitionSurfaceContext, L as AgentFactoryContext, A as AgentHandlerContext, M as AgentId, N as AgentInstallContext, Q as AgentInstallation, R as AgentInstallationKind, T as AgentMessageReceipt, U as AgentPlaybookInput, V as AgentProvisioningPolicy, X as AgentRuntimeControls, Y as AnyFoundryAgent, Z as AppRestrictions, _ as ApplicationConnectionContext, $ as ApplicationConnectionState, a0 as ApplicationConnectionStatus, a1 as BindingId, a2 as BindingNotFound, a3 as CapabilityId, a4 as ComposedAgentPlaybook, a5 as ComposedAgentPlaybookInput, a6 as ConnectionReceiveInput, a7 as CreateAgentInstanceOptions, a8 as CreateConversationOptions, a9 as CustomProvisionedAgent, aa as CustomProvisioningContext, ab as DEFAULT_APPROVAL_EXPIRES_AFTER_MS, ac as DEFAULT_APPROVAL_WAIT_MS, ad as DefineAgentOptions, ae as DefineConnectionOptions, af as DefineFoundryReplOptions, ag as DefineFoundryScheduleOptions, ah as DefineFoundrySubagentOptions, ai as DefineFoundryWorkingEnvironmentOptions, aj as DefinePlaybookSubscriptionOptions, ak as DefinitionConfigInput, al as DurableSubagentOptions, am as DurableSubagentOwnership, an as DurableSubagents, ao as EMPTY_AGENT_COMPOSITION, ap as EMPTY_CAPABILITY_REGISTRY, aq as EMPTY_NATIVE_REGISTRY, ar as EgressAdapter, as as EgressContext, at as EventId, au as EventNotFound, av as EventReference, aw as FOUNDRY_AGENT_APPLICATION_BRAND, ax as FOUNDRY_AGENT_BRAND, ay as FOUNDRY_AGENT_DEFINITION_BRAND, az as FOUNDRY_AGENT_FILE_ENV, aA as FOUNDRY_AGENT_ROUTE_ENV, aB as FOUNDRY_APPLICATION_ENV, aC as FOUNDRY_APPROVAL_DIRECTORY_ENV, aD as FOUNDRY_COMPOSED_PLAYBOOK_BRAND, aE as FOUNDRY_CONNECTION_BRAND, aF as FOUNDRY_CORE_COMMAND_EVENT, aG as FOUNDRY_EVENT_PREFIX, aH as FOUNDRY_EXECUTION_MARKER, aI as FOUNDRY_LAYER_BRAND, aJ as FOUNDRY_MCP_BRAND, aK as FOUNDRY_MEMORY_BRAND, aL as FOUNDRY_PLAYBOOK_ACTION_BRAND, aM as FOUNDRY_REPL_BRAND, aN as FOUNDRY_SCHEDULE_BRAND, aO as FOUNDRY_SHARED_TOOL_BRAND, aP as FOUNDRY_SUBSCRIBER_BRAND, aQ as FOUNDRY_TRANSMISSION_BRAND, aR as FOUNDRY_TRANSMISSION_EVENT_BRAND, aS as FOUNDRY_TRANSMISSION_PREDICATE_BRAND, aT as FOUNDRY_WORKING_ENVIRONMENT_BRAND, aU as FoundryAccountSessionAdapter, aV as FoundryAgent, aW as FoundryAgentComponent, aX as FoundryAgentComposition, aY as FoundryAgentConventionModule, aZ as FoundryAgentDefinition, a_ as FoundryAgentMode, a$ as FoundryApp, b0 as FoundryAppMcp, b1 as FoundryAppMcpTool, b2 as FoundryAppToolDecision, b3 as FoundryApplicationConnection, b4 as FoundryApprovalDecision, b5 as FoundryApprovalDisplayManager, b6 as FoundryApprovalPolicy, b7 as FoundryApprovalStatus, b8 as FoundryCall, b9 as FoundryCallContext, ba as FoundryCallOptions, bb as FoundryCapabilityKind, bc as FoundryCapabilityManifest, bd as FoundryCapabilityManifestEntry, be as FoundryCapabilityRegistry, bf as FoundryCompositionSource, bg as FoundryContextProvider, bh as FoundryCoreCommand, bi as FoundryDelegate, bj as FoundryDelegateOptions, bk as FoundryDelegation, bl as FoundryDelegationReply, bm as FoundryDelegationStatus, F as FoundryDelegationUpdate, bn as FoundryDomainError, bo as FoundryEventPolicy, bp as FoundryEventTarget, bq as FoundryExecutionContext, br as FoundryFactsOptions, bs as FoundryFormsOptions, bt as FoundryGoalsOptions, bu as FoundryGuidanceHandles, bv as FoundryGuidanceScope, bw as FoundryHookDefinition, bx as FoundryInstallable, by as FoundryInstalledApp, bz as FoundryInstanceProvisioner, bA as FoundryJavaScriptReplDefinition, bB as FoundryLayer, bC as FoundryLayerOptions, bD as FoundryLayerReference, bE as FoundryLayerSelection, bF as FoundryLispReplDefinition, bG as FoundryListResolver, bH as FoundryMcp, bI as FoundryMcpOptions, bJ as FoundryMemoryProfile, bK as FoundryMemoryProfileOptions, bL as FoundryMemoryReference, bM as FoundryMemorySelection, bN as FoundryMeshConfig, a as FoundryMeshMessage, bO as FoundryMeshOptions, bP as FoundryMeshParty, bQ as FoundryMeshThread, bR as FoundryMeshThreadStatus, bS as FoundryMessageInput, bT as FoundryMessageOptions, bU as FoundryMountedRepl, bV as FoundryNativeManifest, bW as FoundryNativeManifestEntry, bX as FoundryNativeRegistry, bY as FoundryPlaybookAction, bZ as FoundryProgrammaticToolContext, b_ as FoundryProgrammaticToolSelection, b$ as FoundryProgrammaticTools, c0 as FoundryPythonReplDefinition, c1 as FoundryReplApp, c2 as FoundryReplDefinition, c3 as FoundryRequest, c4 as FoundryResolvedMcp, c5 as FoundryResolver, c6 as FoundryResult, c7 as FoundryRouteMap, c8 as FoundryScheduleDefinition, c9 as FoundryScheduleTiming, ca as FoundryScheduleTimingInput, cb as FoundrySharedTool, cc as FoundrySubagentToolContext, cd as FoundrySubscriber, ce as FoundrySubscriberOptions, cf as FoundrySubscriberSelection, cg as FoundrySurfaceContext, ch as FoundrySuspension, ci as FoundryToolBody, cj as FoundryTransmission, ck as FoundryTransmissionDelivery, cl as FoundryTransmissionEvent, cm as FoundryTransmissionPredicate, cn as FoundryVfs, co as FoundryVfsHandle, cp as FoundryWorkingEnvironmentCreateContext, cq as FoundryWorkingEnvironmentDefinition, cr as FoundryWorkingEnvironmentPersistenceAdapter, cs as FoundryWorkingEnvironmentPersistenceContext, ct as GrantResolutionError, cu as InboundContract, cv as InferAgentInput, cw as InferAgentOutput, cx as InferInboundEvent, cy as InferOutboundInput, cz as InferOutboundOutput, cA as IngressAdapter, cB as IngressContext, cC as InstallationSelection, cD as McpAdapterFactory, cE as MemoryFoundryDataAdapter, cF as OutboundContract, cG as PlaybookActionOptions, cH as PlaybookDirective, cI as PlaybookDirectiveInput, cJ as PlaybookMatch, cK as PlaybookMatchInput, cL as PlaybookOutboundDirective, cM as PlaybookOutboundInput, cN as PlaybookSubscriptionTarget, cO as PlaybookSubscriptionTargetInput, cP as ReplyPolicy, cQ as Route, cR as RouteId, cS as RouteNotFound, cT as RunGrant, cU as RunId, cV as SharedToolOptions, cW as TopologyConflict, cX as TransmissionEventDirection, cY as TransmissionEventOptions, cZ as TransmissionId, c_ as TransmissionOptions, c$ as TransmissionPredicateOptions, d0 as TransmissionSerializationContext, d1 as UpdateAgentInstanceOptions, d2 as UpdateConversationOptions, d3 as composeAgent, d4 as composePlaybook, d5 as configureLayer, d6 as configureMemory, d7 as createAgentInstance, d8 as createConversation, d9 as createFoundryApproval, da as createFoundryCoreTools, db as createInstalledApplicationTransmissionTools, dc as defineAgent, dd as defineAgentApplication, de as defineAgentFromModule, df as defineAgentInstance, dg as defineApp, dh as defineCall, di as defineConnection, dj as defineFacts, dk as defineForms, dl as defineGoals, dm as defineLayer, dn as defineMcp, dp as defineMemory, dq as definePlaybookAction, dr as definePlaybookSubscription, ds as defineRepl, dt as defineRoutes, du as defineSchedule, dv as defineSharedTool, dw as defineSubagent, dx as defineSubscriber, dy as defineTransmission, dz as defineTransmissionEvent, dA as defineTransmissionPredicate, dB as defineWorkingEnvironment, dC as foundryDataEnvironmentPersistence, dD as foundryGuidanceSubject, dE as hostedMeshOptions, dF as install, dG as installRegistry, dH as installationKey, dI as installedApplicationTransmissionToolName, dJ as internalAgentName, dK as isFoundryAgent, dL as isFoundryAgentDefinition, dM as isFoundryCapability, dN as isFoundryLayer, dO as isFoundrySchedule, dP as isFoundrySubscriber, dQ as isFoundryTransmission, dR as isInboxCapableStore, dS as isMeshTransport, dT as listFoundryApprovals, dU as meshIdentity, dV as mountAgentDefinitionMemory, dW as mountFoundrySurfaces, dX as reconstructAgentInstance, dY as reconstructPlaybook, dZ as reconstructPlaybookSubscription, d_ as resolveFoundryApproval, d$ as restrictApp, e0 as routeFromInternalAgentName, e1 as toGloveMessage, e2 as toGloveRequestInput, e3 as transmissionPredicate, e4 as withFoundryPermissions } from './event-delivery-CNCsVqi8.js';
|
|
3
3
|
import { Effect, Layer } from 'effect';
|
|
4
4
|
import { EnvSnapshot } from 'glove-working-environment';
|
|
5
|
-
import { T as TopologyStore, F as FoundryRuntime, D as DiscoveredAgent, a as FoundryManifest } from './client-
|
|
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 FoundryApplication, i as FoundryApplicationManifest, j as FoundryApplicationOptions, k as FoundryClient, l as FoundryClientAuthorizationAdapter, m as FoundryClientOptions, n as FoundryConversationTranscript, o as FoundryEvent, p as FoundryEventCategory, q as FoundryHealth, r as FoundryManifestAgent, s as FoundryManifestCapability, t as FoundryManifestTransmission, u as FoundryObservabilityAdapter, v as FoundryRequestAuthorizationAdapter, w as FoundryRequestAuthorizationInput, x as FoundryRun, y as FoundryRunHandle, z as FoundryRuntimeError, C as FoundryRuntimeOptions, G as FoundrySteerHandleResult, H as FoundrySteerResult, I as GrantResolver, M as ManifestCompilationError, J as MemoryObservabilityAdapter, R as ResolveGrantRequest, K as RouteFilter, W as WaitOptions, L as compileApplicationManifest, N as createFoundryClient, O as createManifest, P as defineApplication, Q as discoverAgents, S as findAgentFiles, U as grantResolverLive, V as isFoundryApplication, X as memoryAccountDirectory, Y as memoryEventStore, Z as memoryTopologyStore, _ as routeFromAgentFile } from './client-
|
|
5
|
+
import { T as TopologyStore, F as FoundryRuntime, D as DiscoveredAgent, a as FoundryManifest } from './client-CCY4_vqN.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 FoundryApplication, i as FoundryApplicationManifest, j as FoundryApplicationOptions, k as FoundryClient, l as FoundryClientAuthorizationAdapter, m as FoundryClientOptions, n as FoundryConversationTranscript, o as FoundryEvent, p as FoundryEventCategory, q as FoundryHealth, r as FoundryManifestAgent, s as FoundryManifestCapability, t as FoundryManifestTransmission, u as FoundryObservabilityAdapter, v as FoundryRequestAuthorizationAdapter, w as FoundryRequestAuthorizationInput, x as FoundryRun, y as FoundryRunHandle, z as FoundryRuntimeError, C as FoundryRuntimeOptions, G as FoundrySteerHandleResult, H as FoundrySteerResult, I as GrantResolver, M as ManifestCompilationError, J as MemoryObservabilityAdapter, R as ResolveGrantRequest, K as RouteFilter, W as WaitOptions, L as compileApplicationManifest, N as createFoundryClient, O as createManifest, P as defineApplication, Q as discoverAgents, S as findAgentFiles, U as grantResolverLive, V as isFoundryApplication, X as memoryAccountDirectory, Y as memoryEventStore, Z as memoryTopologyStore, _ as routeFromAgentFile } from './client-CCY4_vqN.js';
|
|
7
7
|
import { AddressInfo } from 'node:net';
|
|
8
8
|
import { FoundryBrandingConfig } from './config.js';
|
|
9
9
|
export { FoundryConfig, FoundryExecutionConfig, defineConfig } from './config.js';
|
package/dist/index.js
CHANGED
package/docs/inspector.md
CHANGED
|
@@ -5,8 +5,53 @@ The development server includes a runtime inspector. Most pages follow Foundry's
|
|
|
5
5
|
- **Network** lists every model request and tool call.
|
|
6
6
|
- **Console** is the run's log.
|
|
7
7
|
- **Context** shows what the agent had to work with.
|
|
8
|
+
- **Composition** shows what Foundry assembled the agent from, and which app or feature each tool came from.
|
|
9
|
+
- **Queues** lists everything that crossed the run's boundary, in and out.
|
|
10
|
+
- **Call chain** shows the runs this one came from and the runs it started.
|
|
8
11
|
- **Summary** gives the outcome.
|
|
9
12
|
|
|
13
|
+
## Running it
|
|
14
|
+
|
|
15
|
+
The inspector is part of the Foundry server. Start your app with:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm glove foundry dev
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
It prints the inspector's address (the port is `server.port` in `foundry.config.ts`). Open **Chat** to send a message, or **New run** from any page; each opens or links to its run. On a run, `1`–`7` switch between the views.
|
|
22
|
+
|
|
23
|
+
### Try it without an API key
|
|
24
|
+
|
|
25
|
+
Two examples run offline on scripted models, so every view has something to show. From the repository root, build the examples' packages, then install again so pnpm links the `glove` command (it can only link it once `glove-foundry` is built):
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm install
|
|
29
|
+
pnpm --filter "glove-foundry-layered-assistant^..." --filter "glove-foundry-example^..." build
|
|
30
|
+
pnpm install
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**A delegation across four runs** ([layered assistant](../../../examples/foundry-layered-assistant)):
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pnpm --filter glove-foundry-layered-assistant dev
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Open http://127.0.0.1:4142, then **Chat**, Maya's chat, and send `Write me a slugify function, please.` Without `ANTHROPIC_API_KEY` each agent runs a scripted model. The assistant delegates to a coder, the coder asks which language, the assistant answers, and the coder reports back: four runs. Open **Runs** and look at:
|
|
40
|
+
|
|
41
|
+
- the assistant's first run: **Call chain** (delegated, asked, replied, reported back) and **Queues** (the delegation it sent, and the coder's run it started);
|
|
42
|
+
- the coder's run: **Queues** (the task that started it, its question, and the answer handed to it while it ran);
|
|
43
|
+
- any run: **Composition** (the delegates and the tools each step added).
|
|
44
|
+
|
|
45
|
+
**Apps, MCP, a working environment, schedules and playbooks** ([reference app](../../../examples/foundry-agent)):
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pnpm --filter glove-foundry-example dev
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Open http://127.0.0.1:4242 and start a run of `release-planner` with **New run**. Without `OPENROUTER_API_KEY` it runs a deterministic model. **Composition** lists 47 tools under the steps and installations that added them, plus the playbooks and schedules it loaded.
|
|
52
|
+
|
|
53
|
+
For the waterfall and Timing panes you need a model with real latency: set the example's key, or run your own app.
|
|
54
|
+
|
|
10
55
|
## Navigation
|
|
11
56
|
|
|
12
57
|
| Page | Question it answers |
|
|
@@ -40,9 +85,9 @@ The inspector and APIs share one authorization boundary:
|
|
|
40
85
|
|
|
41
86
|
## Following a run
|
|
42
87
|
|
|
43
|
-
Open **Runs**, then a run. A strip at the top gives its status, duration, number of model requests and tool calls, tokens and agent instance. Below it are
|
|
88
|
+
Open **Runs**, then a run. A strip at the top gives its status, duration, number of model requests and tool calls, tokens and agent instance. Below it are seven views:
|
|
44
89
|
|
|
45
|
-
- Switch between them with `1`–`
|
|
90
|
+
- Switch between them with `1`–`7`.
|
|
46
91
|
- The view, the open request and its pane are all in the URL, so a link opens someone else on the same step.
|
|
47
92
|
|
|
48
93
|
The screenshots below are runs of Meta Muse, the [personal agent example](../../../examples/foundry-personal-agent), on Claude Sonnet 5.5 through OpenRouter. They use the example's sample accounts and its offline stand-in for Kuiper's browsers.
|
|
@@ -51,6 +96,8 @@ The screenshots below are runs of Meta Muse, the [personal agent example](../../
|
|
|
51
96
|
|
|
52
97
|

|
|
53
98
|
|
|
99
|
+

|
|
100
|
+
|
|
54
101
|
In this run Muse tries to book a restaurant:
|
|
55
102
|
|
|
56
103
|
1. The Sentinel blocks a site Rosa hasn't allowed (the first red row).
|
|
@@ -59,7 +106,7 @@ In this run Muse tries to book a restaurant:
|
|
|
59
106
|
4. Midway, at #5, Glove compacts the conversation.
|
|
60
107
|
5. The calls a REPL program makes sit under the `execute_js` call that ran them.
|
|
61
108
|
|
|
62
|
-
Each row is one model request (a square), one tool call (a circle), or a subagent. The columns:
|
|
109
|
+
Each row is one model request (a square), one tool call (a circle), or a subagent. A subagent's own requests and tool calls sit indented under it. When a run has more than one turn (it resumed after an approval, or events woke it), a divider marks where each turn began and how it ended. The columns:
|
|
63
110
|
|
|
64
111
|
| Column | Meaning |
|
|
65
112
|
| --- | --- |
|
|
@@ -68,7 +115,7 @@ Each row is one model request (a square), one tool call (a circle), or a subagen
|
|
|
68
115
|
| Status | `ok`, `error`, `aborted`, `denied`, `pending`, or `approval` while a person hasn't decided. |
|
|
69
116
|
| Initiator | What led to the row. A request follows `run input` or the tools of the previous request (`after search`). A tool call comes from the request whose response asked for it. Click it to jump there. |
|
|
70
117
|
| Size | Tokens in → out for a model request; the size of the result for a tool. |
|
|
71
|
-
| Time and Waterfall | How long it took, and when, across the whole run. |
|
|
118
|
+
| Time and Waterfall | How long it took, and when, across the whole run. A model request's bar is light until its first token and solid while it streams. A tool call's bar is light while its permission is checked (or a person decides) and solid while it runs; a thin line before it is the time it waited behind the calls ahead of it in the same step. |
|
|
72
119
|
|
|
73
120
|
Filter rows by text (name, input, result or reply) and by **All**, **Model**, **Tools** or **Errors**. The footer totals requests, tool calls, tokens (and cache reads), and the time spent in the model and in tools.
|
|
74
121
|
|
|
@@ -82,6 +129,7 @@ Click a row, or walk them with `j` and `k`, to open it beside the list. `Esc` cl
|
|
|
82
129
|
| Context | The runtime context added at the end of this request: memory, goals, forms, or any context provider. Each entry is marked new, changed or the same as the previous request. |
|
|
83
130
|
| Tools | Each tool the model was offered, with its description and input schema. |
|
|
84
131
|
| Response | What the model sent back, its stop reason and tokens, or the error that ended the request. |
|
|
132
|
+
| Timing | Like DevTools' Timing tab: waiting for the first token, then streaming, with the text it streamed. |
|
|
85
133
|
| Raw | The recorded events. |
|
|
86
134
|
|
|
87
135
|
**Copy request** copies the request as JSON: model, system prompt, messages, runtime context and tools. Use it to replay a step against a model, or to attach it to an issue.
|
|
@@ -95,6 +143,7 @@ A tool call has these panes:
|
|
|
95
143
|
- **Overview**: call id, duration, the request that made it, and its approval (who decided, and when).
|
|
96
144
|
- **Input**: what the model passed.
|
|
97
145
|
- **Result**: status, message and data. JSON held inside a string opens as a tree.
|
|
146
|
+
- **Timing**: when the model asked for the call, how long it was queued behind earlier calls, how long its permission check or approval took, and how long it ran.
|
|
98
147
|
- **Raw**: the recorded events.
|
|
99
148
|
|
|
100
149
|

|
|
@@ -106,7 +155,8 @@ A tool call has these panes:
|
|
|
106
155
|
The run as a log, one line per event:
|
|
107
156
|
|
|
108
157
|
- **Levels.** Errors and warnings are coloured: a failed tool, a run that failed or retried, stderr, an approval being waited on. **Default levels** hides verbose detail, such as assembly steps and streamed text. **All levels** shows it. You can also show only warnings and errors, or only errors.
|
|
109
|
-
- **Streamed text.** A streamed reply is one line, not one line per chunk.
|
|
158
|
+
- **Streamed text.** A streamed reply is one line per request, not one line per chunk, even when a subagent streams in between.
|
|
159
|
+
- **Turns and arrivals.** Lines mark each turn starting and how it ended (finished, failed, aborted, or suspended at an approval), events arriving and when they joined the conversation, and resolved inbox items joining it.
|
|
110
160
|
- **Filters.** Filter by text and by source (`run`, `model`, `tool`, `stdout`, `stderr`, `assembly`, …).
|
|
111
161
|
- **Expanding a line.** Click a line to see its data as a tree and to copy it. Lines about a request or tool call have **Open in Network**.
|
|
112
162
|
- **Live runs.** While the run is live, the console stays at the bottom unless you have scrolled up.
|
|
@@ -124,6 +174,45 @@ Like DevTools' Application panel, a tree on the left and the selected item on th
|
|
|
124
174
|
| Agent | The instance's stored context, installations and playbooks, with links to the instance, workspace and conversation. |
|
|
125
175
|
| Memory | Goals, facts and forms (see [guidance](./guidance.md)), and the memory events the run recorded. What memory put in front of the model is in each request's runtime context. |
|
|
126
176
|
|
|
177
|
+
### Composition
|
|
178
|
+
|
|
179
|
+

|
|
180
|
+
|
|
181
|
+
What Foundry assembled the run's agent from, like DevTools' Sources panel. A tree on the left, the selected item on the right:
|
|
182
|
+
|
|
183
|
+
| Item | What it shows |
|
|
184
|
+
| --- | --- |
|
|
185
|
+
| Timeline | Each definition field resolving, then each assembly step (Foundry core tools, app transmissions, the definition's tools, delegation, mesh, working environment, guidance, calls, layers and subscribers, each installation, MCP servers, memory, `configure()`, the REPL, `build()`), with how long it took. |
|
|
186
|
+
| Tools by origin | Each tool the agent had, under the step that added it, with how many times it was called. Click a tool to see its calls in Network. |
|
|
187
|
+
| Apps and installations | What the instance has installed and the tools each installation gave this run; an app's tools that change things are marked. |
|
|
188
|
+
| Working environment and REPL | What the working environment and REPL mounted. |
|
|
189
|
+
| Playbooks | The playbooks the definition composed and the ones stored on the instance. |
|
|
190
|
+
| Schedules | The definition's schedules, the schedules and sleeps this run created, and the instance's activations with their next and last runs. |
|
|
191
|
+
| Delegates and workers | The agents this one can hand work to, its durable subagents, and, for a worker, the delegation it works on. |
|
|
192
|
+
| Mesh | Whether the hosted mesh or your own transport is mounted, and the open threads. |
|
|
193
|
+
| Memory, layers and subscribers; Hooks, skills, subagents and calls | The rest of the definition. |
|
|
194
|
+
|
|
195
|
+
A run records its assembly as one `foundry.assembly.composed` event, just before its first turn. It compares the agent's tools before and after each step, so every tool is listed under the step that folded it.
|
|
196
|
+
|
|
197
|
+
### Queues
|
|
198
|
+
|
|
199
|
+

|
|
200
|
+
|
|
201
|
+
Everything that crossed the run's boundary, like the Messages pane of a WebSocket in DevTools: one row per message, inbound (↓) or outbound (↑).
|
|
202
|
+
|
|
203
|
+
- **Inbound**: what started the run (a message, a transmission, a delegated task or result, a schedule or sleep firing, a spawn); events that arrived while it ran (transmission follow-ups, delegation updates, agent and mesh messages, approval decisions); deliveries handed to it live; and resolved inbox items.
|
|
204
|
+
- **Outbound**: transmissions, delegations and replies, questions to the delegator, agent and mesh messages, spawns, background runs, schedules and sleeps, inbox items posted, and approvals asked for.
|
|
205
|
+
|
|
206
|
+
**Status** follows each row: an event is queued, deferred, woke the agent or was dropped, then joined the conversation as the turn's message, before a request, or between tool steps. A command is sent, then accepted, delivered, scheduled or started. **Reached** is, for an inbound row, the model request that first saw it, and for an outbound one, the run it started. Click a row for its detail and the events behind it.
|
|
207
|
+
|
|
208
|
+
### Call chain
|
|
209
|
+
|
|
210
|
+

|
|
211
|
+
|
|
212
|
+
The runs this one came from and the runs it started, like DevTools' initiator chain across runs. Above the run: what started its chain (a transmission, a schedule) and each run that led to it. Below: what it started, as a tree. The edges say how: delegated to a worker, the worker asked, the answer replied, the worker reported back, spawned, scheduled, woke from sleep, steered. Each run links to its own Call chain.
|
|
213
|
+
|
|
214
|
+
The chain is read from the runtime's retained events (`delegation.started`, `delegation.replied`, `core.command.accepted`, `run.steered` and the commands runs sent), so runs older than what the runtime keeps show as *not retained*.
|
|
215
|
+
|
|
127
216
|
### Summary
|
|
128
217
|
|
|
129
218
|
The run's phases (accepted, assembled, agent work, outcome), its recorded output and input, the slowest steps and every failed request or tool call, each linking to its row in Network. A failed run states its error at the top of the page, and pending approvals show there with their exact input. **Export trace** downloads the run and every event as JSON. **Run again** reopens the run drawer with the same instance and message.
|
|
@@ -149,6 +238,18 @@ export default defineConfig({ observability: { modelRequests: false } });
|
|
|
149
238
|
|
|
150
239
|
Runs recorded before this, or with model requests off, still list their tool calls, model responses and log.
|
|
151
240
|
|
|
241
|
+
### What else a run records
|
|
242
|
+
|
|
243
|
+
The run's subscriber also records these Glove events, and the views above read them:
|
|
244
|
+
|
|
245
|
+
- `turn_start` and `turn_end` bracket each turn: a request, events waking the agent, or a resumed tool step, with how it ended.
|
|
246
|
+
- `tool_use_start` marks when a tool call starts running, after the calls ahead of it and its permission check. `tool_use` marks when the model asked for it.
|
|
247
|
+
- Streamed text and tool calls carry the `request_id` of the request they came from, which gives each request's time to first token.
|
|
248
|
+
- `subagent_invoked` and `subagent_completed` name the tool call that ran the subagent.
|
|
249
|
+
- `event_received` previews what arrived, and `inbox_injected` reports resolved inbox items joining the conversation.
|
|
250
|
+
|
|
251
|
+
Runs recorded before these events show a single bar per row and no turns.
|
|
252
|
+
|
|
152
253
|
## Talking to an agent
|
|
153
254
|
|
|
154
255
|
**Chat** is a browser conversation client, not a second transcript system. Select a
|
|
@@ -206,17 +307,99 @@ Press `Command-K` or `Control-K` to search pages, definitions, instances, and re
|
|
|
206
307
|
| Key | Action |
|
|
207
308
|
| --- | --- |
|
|
208
309
|
| `j` / `k` | Move down and up the current list; on a run's Network view, open the next or previous request |
|
|
209
|
-
| `1`–`
|
|
310
|
+
| `1`–`7` | On a run: Summary, Network, Console, Context, Composition, Queues, Call chain |
|
|
210
311
|
| `Enter` or `o` | Open the highlighted row |
|
|
211
312
|
| `/` | Focus the filter (runs, Network, Console), or open search elsewhere |
|
|
212
313
|
| `c` | Start a run |
|
|
213
314
|
| `r` | Refresh runtime data |
|
|
214
315
|
| `Command-K` / `Control-K` | Search |
|
|
215
|
-
| `Escape` | Close the drawer or search; on a run, close the open request, or leave a filter box |
|
|
316
|
+
| `Escape` | Close the drawer or search; on a run, close the open request or message, or leave a filter box |
|
|
216
317
|
| `Command-Enter` | Submit the run drawer |
|
|
217
318
|
|
|
218
319
|
Every truncated identifier in the inspector has a copy button, so the full run, instance, or conversation id is always retrievable.
|
|
219
320
|
|
|
321
|
+
## Testing with it
|
|
322
|
+
|
|
323
|
+
### Assert on what a run recorded
|
|
324
|
+
|
|
325
|
+
Everything the views show comes from the run's recorded events, so a test can read the same events. This passes against the layered assistant, offline:
|
|
326
|
+
|
|
327
|
+
```ts
|
|
328
|
+
import assert from "node:assert/strict";
|
|
329
|
+
|
|
330
|
+
const run = await runtime.send("maya", "maya-chat", "Write me a slugify function, please.");
|
|
331
|
+
await runtime.waitForRun(run.id, { timeoutMs: 60_000 });
|
|
332
|
+
const events = runtime.observability.list({ runId: run.id });
|
|
333
|
+
const of = (type: string) => events.filter((event) => event.type === `agent.${type}`).map((event) => event.data as any);
|
|
334
|
+
|
|
335
|
+
// What Foundry assembled, and which step added each tool.
|
|
336
|
+
const [composed] = of("foundry.assembly.composed");
|
|
337
|
+
const attributed = new Set(composed.steps.flatMap((step: { tools: string[] }) => step.tools));
|
|
338
|
+
assert.deepEqual(composed.tools.filter((name: string) => !attributed.has(name)), []);
|
|
339
|
+
assert.ok(composed.delegates.some((delegate: { agent: string }) => delegate.agent === "coder"));
|
|
340
|
+
|
|
341
|
+
// How the turn ended, and the tool call that delegated.
|
|
342
|
+
assert.equal(of("turn_end").at(-1).status, "success");
|
|
343
|
+
assert.ok(of("tool_use_start").some((call) => call.name === "glove_foundry_delegate"));
|
|
344
|
+
|
|
345
|
+
// The delegation it started, recorded by the runtime under this run.
|
|
346
|
+
const started = events.find((event) => event.type === "delegation.started");
|
|
347
|
+
assert.equal((started?.data as { to: string }).to, "coder");
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Agent events are prefixed `agent.`. The runtime's own events about a run (`delegation.started`, `core.command.accepted`, `transmission.outbound.delivered`, `run.steered`) aren't. Over HTTP, the same list is `GET /api/runs/:id/events`.
|
|
351
|
+
|
|
352
|
+
### Read the same events in your own subscriber
|
|
353
|
+
|
|
354
|
+
The Glove events the inspector reads reach any subscriber, with or without Foundry. This one logs each turn, each request's time to first token, and how long each tool call waited before it ran:
|
|
355
|
+
|
|
356
|
+
```ts
|
|
357
|
+
import type { SubscriberAdapter } from "glove-core";
|
|
358
|
+
|
|
359
|
+
const sentAt = new Map<string, number>(); // request_id → when it was sent
|
|
360
|
+
const askedAt = new Map<string, number>(); // call id → when the model asked for it
|
|
361
|
+
|
|
362
|
+
export const timings: SubscriberAdapter = {
|
|
363
|
+
modelRequests: true, // also receive model_request and model_request_end
|
|
364
|
+
async record(type, data: any) {
|
|
365
|
+
const now = Date.now();
|
|
366
|
+
if (type === "turn_start") console.log(`turn (${data.trigger}) started`);
|
|
367
|
+
if (type === "turn_end") console.log(`turn ${data.status} after ${data.duration_ms}ms`);
|
|
368
|
+
if (type === "model_request") sentAt.set(data.request_id, now);
|
|
369
|
+
if ((type === "text_delta" || type === "tool_use") && sentAt.has(data.request_id)) {
|
|
370
|
+
console.log(`first token after ${now - sentAt.get(data.request_id)!}ms`);
|
|
371
|
+
sentAt.delete(data.request_id);
|
|
372
|
+
}
|
|
373
|
+
if (type === "tool_use") askedAt.set(data.id, now);
|
|
374
|
+
if (type === "tool_use_start") console.log(`${data.name} started ${now - (askedAt.get(data.id) ?? now)}ms after the model asked`);
|
|
375
|
+
if (type === "tool_use_result") console.log(`${data.name} ${data.result.status} after ${data.duration_ms}ms`);
|
|
376
|
+
},
|
|
377
|
+
};
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
Add it with `glove.addSubscriber(timings)`, or list it in a Foundry definition's `subscribers`.
|
|
381
|
+
|
|
382
|
+
### Test the inspector itself
|
|
383
|
+
|
|
384
|
+
The views are built by plain functions over `/api/runs/:id/events`: `buildRunTrace` and `buildConsole` in `src/dashboard-trace.ts`, and `buildComposition`, `buildQueues` and `buildRunChain` in `src/dashboard-foundry.ts`. Their tests evaluate the same source the browser runs:
|
|
385
|
+
|
|
386
|
+
```ts
|
|
387
|
+
import { DASHBOARD_TRACE_SCRIPT } from "../src/dashboard-trace.js";
|
|
388
|
+
import { DASHBOARD_FOUNDRY_SCRIPT } from "../src/dashboard-foundry.js";
|
|
389
|
+
|
|
390
|
+
const kit = new Function(`${DASHBOARD_TRACE_SCRIPT}\n${DASHBOARD_FOUNDRY_SCRIPT}; return { buildRunTrace, buildQueues };`)();
|
|
391
|
+
const rows = kit.buildQueues(events, run, kit.buildRunTrace(events, run));
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
Run them, then the integration test that checks a real run's assembly is fully attributed:
|
|
395
|
+
|
|
396
|
+
```bash
|
|
397
|
+
pnpm --filter glove-foundry exec node --test --import tsx tests/dashboard-trace.test.ts tests/dashboard-foundry.test.ts
|
|
398
|
+
pnpm --filter glove-foundry exec node --test --import tsx tests/integration.test.ts
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
`pnpm --filter glove-core test` covers the events themselves (`tests/observability-events.test.ts`).
|
|
402
|
+
|
|
220
403
|
## Operator API used by the inspector
|
|
221
404
|
|
|
222
405
|
The inspector is an API client and adds no hidden runtime state. Its primary read surfaces are:
|
|
@@ -227,6 +410,7 @@ The inspector is an API client and adds no hidden runtime state. Its primary rea
|
|
|
227
410
|
- `PATCH /api/conversations/:id` for an instance-owned title or context update
|
|
228
411
|
- `/api/runs`, `/api/runs/:id`, and `/api/events`
|
|
229
412
|
- `/api/runs/:id/events`, with `?after=<sequence>` for only what's new, for one run's trace
|
|
413
|
+
- `/api/events?category=system`, for the runs a run started or came from (Call chain)
|
|
230
414
|
- `/api/activations` and `/api/playbook-subscriptions`
|
|
231
415
|
- `/api/application-connections`
|
|
232
416
|
- `/api/transmissions`, `/api/accounts`, `/api/routes`, and `/api/bindings`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glove-foundry",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "An Effect-native, file-routed framework for typed, observable Glove agent applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -77,16 +77,16 @@
|
|
|
77
77
|
"station-client": "^3.0.0",
|
|
78
78
|
"station-beacon": "^3.0.0",
|
|
79
79
|
"station-broadcast": "^3.0.0",
|
|
80
|
-
"glove-
|
|
81
|
-
"glove-
|
|
82
|
-
"glove-facts": "0.1.
|
|
83
|
-
"glove-
|
|
84
|
-
"glove-mcp": "1.2.
|
|
85
|
-
"glove-
|
|
86
|
-
"glove-
|
|
87
|
-
"glove-
|
|
88
|
-
"glove-voice-s2s": "0.4.
|
|
89
|
-
"glove-
|
|
80
|
+
"glove-lisp": "0.5.7",
|
|
81
|
+
"glove-core": "4.8.0",
|
|
82
|
+
"glove-facts": "0.1.9",
|
|
83
|
+
"glove-js": "0.5.7",
|
|
84
|
+
"glove-mcp": "1.2.7",
|
|
85
|
+
"glove-memory": "2.3.4",
|
|
86
|
+
"glove-mesh": "0.2.4",
|
|
87
|
+
"glove-working-environment": "0.7.0",
|
|
88
|
+
"glove-voice-s2s": "0.4.7",
|
|
89
|
+
"glove-python": "0.4.7"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
@@ -614,10 +614,10 @@ declare class FoundryRuntime {
|
|
|
614
614
|
installCapability(agentId: string, installation: AgentInstallation): Promise<AgentInstance>;
|
|
615
615
|
uninstallCapability(agentId: string, installation: AgentInstallation): Promise<AgentInstance>;
|
|
616
616
|
listAccounts(): Promise<{
|
|
617
|
-
label?: string | undefined;
|
|
618
617
|
id: string & effect_Brand.Brand<"FoundryAccountId">;
|
|
619
618
|
transmissionId: string & effect_Brand.Brand<"FoundryTransmissionId">;
|
|
620
619
|
externalAccountId: string;
|
|
620
|
+
label?: string | undefined;
|
|
621
621
|
metadata: {
|
|
622
622
|
readonly [x: string]: unknown;
|
|
623
623
|
};
|