The open-source agent harness - the runtime layer that turns an LLM into a working agent.
Fix: add support for filtering sessions created by the user (#664)
harshil-2096b32d2beef17d
diff --git a/.changeset/filter-sessions-created-by-me.md b/.changeset/filter-sessions-created-by-me.mdnew file mode 100644index 000000000..6c2384c4b--- /dev/null+++ b/.changeset/filter-sessions-created-by-me.md@@ -0,0 +1,6 @@+---+"@truefoundry/trueforge-ui": patch+"@truefoundry/trueforge": patch+---++Filter chat history to sessions created by the current user, and bump `@truefoundry/assistant-ui-runtime` to `0.1.34`.diff --git a/packages/frontend/package.json b/packages/frontend/package.jsonindex b6fee13a4..b686314a6 100644--- a/packages/frontend/package.json+++ b/packages/frontend/package.json@@ -26,7 +26,7 @@"@assistant-ui/core": "0.2.22","@assistant-ui/react": "0.14.27","@assistant-ui/store": "0.2.21",- "@truefoundry/assistant-ui-runtime": "0.1.33",+ "@truefoundry/assistant-ui-runtime": "0.1.34","@truefoundry/trueforge-sdk": "workspace:*","@truefoundry/trueforge-ui": "workspace:*","monaco-editor": "^0.52.0",diff --git a/packages/trueforge-ui/package.json b/packages/trueforge-ui/package.jsonindex 9d5f7ffa1..f475898fe 100644--- a/packages/trueforge-ui/package.json+++ b/packages/trueforge-ui/package.json@@ -95,7 +95,7 @@"@openuidev/react-headless": "^0.9.4","@openuidev/react-lang": "^0.2.9","@openuidev/react-ui": "^0.13.2",- "@truefoundry/assistant-ui-runtime": "0.1.33",+ "@truefoundry/assistant-ui-runtime": "0.1.34","@truefoundry/trueforge-sdk": "workspace:*","chart.js": "^4.5.1","clsx": "^2.1.1",diff --git a/packages/trueforge-ui/src/containers/TrueFoundryChatProvider.tsx b/packages/trueforge-ui/src/containers/TrueFoundryChatProvider.tsxindex e985d9269..215173079 100644--- a/packages/trueforge-ui/src/containers/TrueFoundryChatProvider.tsx+++ b/packages/trueforge-ui/src/containers/TrueFoundryChatProvider.tsx@@ -80,6 +80,7 @@ function ChatRuntimeScope({agent,agentName,listSessionsAgentId,+ listSessionsCreatedByMe: true,initialSessionId,onError: resolvedOnError,adapters: {diff --git a/packages/trueforge-ui/src/plugins/trueforge-agent-server-adapter/agentSessionsServer.ts b/packages/trueforge-ui/src/plugins/trueforge-agent-server-adapter/agentSessionsServer.tsindex f57f7b01d..748a3d783 100644--- a/packages/trueforge-ui/src/plugins/trueforge-agent-server-adapter/agentSessionsServer.ts+++ b/packages/trueforge-ui/src/plugins/trueforge-agent-server-adapter/agentSessionsServer.ts@@ -66,6 +66,7 @@ export function createHarnessAgentSessionsServer(...(requestParams.agentId === undefined || requestParams.agentId.length === 0? {}: { agentId: requestParams.agentId }),+ ...(requestParams.createdByMe === undefined ? {} : { createdByMe: requestParams.createdByMe }),});return toListResult(page, toSessionListEntry);},diff --git a/packages/trueforge-ui/src/plugins/trueforge-agent-server-adapter/chatServer.ts b/packages/trueforge-ui/src/plugins/trueforge-agent-server-adapter/chatServer.tsindex 7c0d50c6c..c011102bb 100644--- a/packages/trueforge-ui/src/plugins/trueforge-agent-server-adapter/chatServer.ts+++ b/packages/trueforge-ui/src/plugins/trueforge-agent-server-adapter/chatServer.ts@@ -200,6 +200,7 @@ export function createHarnessChatServer(...(request.order === undefined ? {} : { order: request.order }),...(request.pageToken === undefined ? {} : { pageToken: request.pageToken }),...(request.agentId === undefined || request.agentId.length === 0 ? {} : { agentId: request.agentId }),+ ...(request.createdByMe === undefined ? {} : { createdByMe: request.createdByMe }),});return toListResult(page, toUiSession);},diff --git a/packages/trueforge-ui/test/containers/TrueFoundryChatProvider.test.tsx b/packages/trueforge-ui/test/containers/TrueFoundryChatProvider.test.tsxindex f41243fb4..1b419d467 100644--- a/packages/trueforge-ui/test/containers/TrueFoundryChatProvider.test.tsx+++ b/packages/trueforge-ui/test/containers/TrueFoundryChatProvider.test.tsx@@ -48,6 +48,7 @@ describe('TrueFoundryChatProvider', () => {expect.objectContaining({agentName: 'my-agent',initialSessionId: 'session-123',+ listSessionsCreatedByMe: true,adapters: { attachments: defaultAttachmentAdapter },}),);diff --git a/packages/trueforge-ui/test/plugins/trueforge-agent-server-adapter/harnessServer.test.ts b/packages/trueforge-ui/test/plugins/trueforge-agent-server-adapter/harnessServer.test.tsindex b7561dc64..81ca6582b 100644--- a/packages/trueforge-ui/test/plugins/trueforge-agent-server-adapter/harnessServer.test.ts+++ b/packages/trueforge-ui/test/plugins/trueforge-agent-server-adapter/harnessServer.test.ts@@ -206,6 +206,24 @@ describe('createHarnessChatServer', () => {assert.equal(page.data[0]?.isMutable, false);});+ it('forwards createdByMe to listSessions as created_by_me', async () => {+ let listUrl: string | undefined;+ const fetchNamed: typeof fetch = async input => {+ const url = input instanceof Request ? input.url : String(input);+ if (url.includes('/api/v1/sessions?')) {+ listUrl = url;+ return Response.json({ data: [], pagination: { limit: 20 } });+ }+ return new Response(`Unexpected request: ${url}`, { status: 500 });+ };++ const server = createHarnessChatServer({ fetch: fetchNamed });+ await server.listSessions({ createdByMe: true, limit: 10 });++ assert.ok(listUrl !== undefined);+ assert.equal(new URL(listUrl, 'http://test.local').searchParams.get('created_by_me'), 'true');+ });+it('listSessions forwards an unknown agentId to the API (empty page from the server)', async () => {let listUrl: string | undefined;const fetchNamed: typeof fetch = async input => {diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 2f7a34e12..9e72d4363 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -69,8 +69,8 @@ importers:specifier: 0.2.21version: 0.2.21(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected])'@truefoundry/assistant-ui-runtime':- specifier: 0.1.33- version: 0.1.33(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected](@opentelemetry/[email protected])))([email protected])([email protected](@opentelemetry/[email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected])))+ specifier: 0.1.34+ version: 0.1.34(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected](@opentelemetry/[email protected])))([email protected])([email protected](@opentelemetry/[email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected])))'@truefoundry/trueforge-sdk':specifier: workspace:*version: link:../trueforge-sdk@@ -363,8 +363,8 @@ importers:specifier: ^0.13.2version: 0.13.3(@openuidev/[email protected]([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected]))))(@openuidev/[email protected](@modelcontextprotocol/[email protected]([email protected])([email protected]))([email protected])([email protected]))(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected])))'@truefoundry/assistant-ui-runtime':- specifier: 0.1.33- version: 0.1.33(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected](@opentelemetry/[email protected])))([email protected])([email protected](@opentelemetry/[email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected])))+ specifier: 0.1.34+ version: 0.1.34(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected](@opentelemetry/[email protected])))([email protected])([email protected](@opentelemetry/[email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected])))'@truefoundry/trueforge-sdk':specifier: workspace:*version: link:../trueforge-sdk@@ -3642,8 +3642,8 @@ packages:'@types/react-dom':optional: true- '@truefoundry/[email protected]':- resolution: {integrity: sha512-HMHB9UDy6NmIwVMLTSSTzkGCN1cP4PSDP5T6IU9kwVWT2+MEZxpyX8/GFgX7jvHbCPTIXU9DmveTF+pQJb9Ccw==}+ '@truefoundry/[email protected]':+ resolution: {integrity: sha512-WeUGHCLD2OC1sWwxl4BwFe8AI26bWZFyAzm7BQA5CxR7O4zmIcEILVsgLMbPyyMzZlyrswubTEdeX50s5qHh5A==}peerDependencies:'@types/react': '*'react: ^18 || ^19@@ -10897,7 +10897,7 @@ snapshots:'@types/react': 19.2.18'@types/react-dom': 19.2.5(@types/[email protected])- '@truefoundry/[email protected](@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected](@opentelemetry/[email protected])))([email protected])([email protected](@opentelemetry/[email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected])))':+ '@truefoundry/[email protected](@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected](@opentelemetry/[email protected])))([email protected])([email protected](@opentelemetry/[email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected])))':dependencies:'@assistant-ui/core': 0.2.22(@assistant-ui/[email protected](@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]))(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected](@opentelemetry/[email protected])))([email protected])([email protected](@opentelemetry/[email protected]))([email protected](@types/[email protected])([email protected])([email protected]([email protected])))'@assistant-ui/store': 0.2.21(@assistant-ui/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected])diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yamlindex b08354327..f368955ea 100644--- a/pnpm-workspace.yaml+++ b/pnpm-workspace.yaml@@ -17,7 +17,7 @@ allowBuilds:# Silence peer mismatches between trueforge-ui peers and the versions we pin.peerDependencyRules:allowedVersions:- '@truefoundry/assistant-ui-runtime': '0.1.33'+ '@truefoundry/assistant-ui-runtime': '0.1.34'# One Context module for assistant-ui (avoids "requires an AuiProvider").overrides: