The open-source agent harness - the runtime layer that turns an LLM into a working agent.
Rename CapabilityStateValue to JsonValue.
debajyoti-truefoundrya64ead757204
diff --git a/packages/harness/src/agent-session/store/ISessionStore.ts b/packages/harness/src/agent-session/store/ISessionStore.tsindex 1533818ce..af4b589ad 100644--- a/packages/harness/src/agent-session/store/ISessionStore.ts+++ b/packages/harness/src/agent-session/store/ISessionStore.ts@@ -2,8 +2,8 @@ import type { MCPServerInitInfo, ThreadOverwriteContextEvent } from '../../core/import type { CompletionUsage } from '../../core/llm/LLMTypes';import type {AgentThreadSnapshot,- CapabilityStateValue,ContextMessage,+ JsonValue,SubAgentCompletionMarker,} from '../../core/runtime/AgentThread.types';import type { SandboxInfo } from '../../core/sandbox/Sandbox';@@ -124,7 +124,7 @@ export interface PatchThreadCapabilityStateInput {turn_id: string;thread_id: string;key: string;- state: CapabilityStateValue;+ state: JsonValue;}export interface ListTurnEventsInput {diff --git a/packages/harness/src/core/capabilities/AgentCapability.ts b/packages/harness/src/core/capabilities/AgentCapability.tsindex b35b64420..d8bc831b1 100644--- a/packages/harness/src/core/capabilities/AgentCapability.ts+++ b/packages/harness/src/core/capabilities/AgentCapability.ts@@ -1,6 +1,6 @@import type { InstructionBuilder } from '../InstructionBuilder';import type { IToolSet } from '../mcp/IMCPServer';-import type { CapabilityStateValue } from '../runtime/AgentThread.types';+import type { JsonValue } from '../runtime/AgentThread.types';import type {PostToolCallAgentContextProcessor,PreLLMAgentContextProcessor,@@ -22,5 +22,5 @@ export interface AgentCapability {* thread (`tfy.` reserved for builtins). `load` hydrates from the previous* turn's capability_state; writes go through CAPABILITY_STATE events.*/- readonly state?: { key: string; load(state: CapabilityStateValue): void };+ readonly state?: { key: string; load(state: JsonValue): void };}diff --git a/packages/harness/src/core/index.ts b/packages/harness/src/core/index.tsindex 1d0fe7aa7..07b227960 100644--- a/packages/harness/src/core/index.ts+++ b/packages/harness/src/core/index.ts@@ -116,12 +116,7 @@ export type {ThreadOverwriteContextEvent,} from './events/schema';export { InternalEventType } from './runtime/AgentThread.types';-export type {- AgentThreadSendBatch,- CapabilityState,- CapabilityStateValue,- ContextMessage,-} from './runtime/AgentThread.types';+export type { AgentThreadSendBatch, CapabilityState, ContextMessage, JsonValue } from './runtime/AgentThread.types';export type { AgentThreadMetrics } from './runtime/metrics';// Tracingdiff --git a/packages/harness/src/core/runtime/AgentThread.types.ts b/packages/harness/src/core/runtime/AgentThread.types.tsindex 1176c88cc..64996de41 100644--- a/packages/harness/src/core/runtime/AgentThread.types.ts+++ b/packages/harness/src/core/runtime/AgentThread.types.ts@@ -50,14 +50,13 @@ export const InternalEventType = {} as const;/**- * JSON-serializable capability state value. Excludes `undefined` — durability is- * jsonb/JSON, so clears use `null` and absent data omits the key or the map.+ * JSON-serializable value. Excludes `undefined` — durability is jsonb/JSON, so+ * clears use `null` and absent data omits the key or the map.*/-export type CapabilityStateValue =- null | boolean | number | string | CapabilityStateValue[] | { [key: string]: CapabilityStateValue };+export type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue };/** Cross-turn capability KV map. Keys: capability.state.key; `tfy.` reserved for builtins. */-export type CapabilityState = Record<string, CapabilityStateValue>;+export type CapabilityState = Record<string, JsonValue>;/*** Cross-turn capability KV write. Processors emit without `thread_id`@@ -67,7 +66,7 @@ export interface InternalCapabilityStateEvent {type: typeof InternalEventType.CAPABILITY_STATE;thread_id: string;key: string;- state: CapabilityStateValue;+ state: JsonValue;}export interface InternalPassthroughEvent {diff --git a/packages/harness/tests/agent-session/capabilityState.test.ts b/packages/harness/tests/agent-session/capabilityState.test.tsindex 8e02599c3..e3132e05b 100644--- a/packages/harness/tests/agent-session/capabilityState.test.ts+++ b/packages/harness/tests/agent-session/capabilityState.test.ts@@ -10,14 +10,14 @@ import { InMemorySessionStore } from '../../src/agent-session/store/InMemorySessimport type { AgentCapability } from '../../src/core/capabilities/AgentCapability';import type { AgentContextProcessorOutput } from '../../src/core/capabilities/AgentContextProcessor';import { AgentThread } from '../../src/core/runtime/AgentThread';-import { InternalEventType, type CapabilityStateValue } from '../../src/core/runtime/AgentThread.types';+import { InternalEventType, type JsonValue } from '../../src/core/runtime/AgentThread.types';import { NOOP_AGENT_TRACING } from '../../src/core/tracing/NoopAgentTracing';import { emptyLlmStream, makeAgentSpec, makeMockILLM, makeSilentLogger, makeTestResolver } from './testHelpers';function makePlanShapedCapability(options: {enabled: boolean;- emitState?: CapabilityStateValue;- onLoad?: (state: CapabilityStateValue) => void;+ emitState?: JsonValue;+ onLoad?: (state: JsonValue) => void;}): AgentCapability {const emitState = options.emitState;const processor = {@@ -37,7 +37,7 @@ function makePlanShapedCapability(options: {preLLMProcessors: [processor],state: {key: 'tfy.plan',- load(state: CapabilityStateValue) {+ load(state: JsonValue) {options.onLoad?.(state);},},@@ -58,10 +58,10 @@ describe('capability_state (tfy.plan fixture)', () => {agent_spec: makeAgentSpec(),});- const planV1: CapabilityStateValue = {+ const planV1: JsonValue = {todo: [{ title: 'step', description: 'do it', status: 'wip' }],};- let loads: CapabilityStateValue[] = [];+ let loads: JsonValue[] = [];const turn1 = await session.createTurn({input: [{ type: EventType.USER_MESSAGE, content: 'start' }],@@ -128,7 +128,7 @@ describe('capability_state (tfy.plan fixture)', () => {session_id: 's1',agent_spec: makeAgentSpec(),});- const planV1: CapabilityStateValue = {+ const planV1: JsonValue = {todo: [{ title: 'step', description: 'do it', status: 'done' }],};