Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions agentic/agent-conversation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,26 @@ owns all of it.

```ts
import {
createGraphQLConversationClient,
createHttpGraphQLClient,
Inbox,
isApprovalEvent,
loadOrCreateThread,
TaskWriter,
Transcript,
createHttpGraphQLClient
Transcript
} from '@agentic-kit/agent-conversation';

const client = createHttpGraphQLClient({ url, token });
const thread = await loadOrCreateThread({ client, databaseId, threadId, title });

const transcript = new Transcript(client, { databaseId, threadId: thread.id, model });
// Messages and tasks inherit their scope from the thread; only the thread
// creation above names the database.
const conversation = createGraphQLConversationClient({ client, threadId: thread.id, actorId });

const transcript = new Transcript(conversation, { model });
await transcript.appendText('Reading the tests first.');

const inbox = new Inbox({ client, threadId: thread.id, since: thread.createdAt! });
const inbox = new Inbox({ client: conversation, since: thread.createdAt! });
const { event, cancelled } = await inbox.waitFor(isApprovalEvent, { timeoutMs: 900_000 });
```

Expand Down
1 change: 0 additions & 1 deletion agentic/agent-conversation/__tests__/conversation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const DATABASE_ID = '00000000-0000-0000-0000-0000000000db';
const conversation = (api: FakeAgentApi, threadId: string) =>
createGraphQLConversationClient({
client: api,
databaseId: DATABASE_ID,
threadId,
actorId: 'actor-1',
});
Expand Down
11 changes: 6 additions & 5 deletions agentic/agent-conversation/src/graphql-conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ const UPDATE_TASK = `mutation CodeTaskUpdateTask($input: UpdateAgentTaskInput!)

export interface GraphQLConversationClientOptions {
client: GraphQLClient;
databaseId: string;
/** The thread every write lands on. */
/**
* The thread every write lands on. Scope (`database_id` / `entity_id`,
* `visibility`) is inherited from it by the agent module's insert triggers,
* so the client never names it.
*/
threadId: string;
/** The agent row the run speaks as, when the tenant has one. */
agentId?: string | null;
Expand All @@ -68,7 +71,7 @@ export interface GraphQLConversationClientOptions {
export function createGraphQLConversationClient(
options: GraphQLConversationClientOptions
): ConversationClient {
const { client, databaseId, threadId } = options;
const { client, threadId } = options;
const parent: TaskParent = options.taskParent ?? { column: 'threadId', id: threadId };
const attribution = {
...(options.agentId ? { agentId: options.agentId } : {}),
Expand All @@ -82,7 +85,6 @@ export function createGraphQLConversationClient(
}>(CREATE_MESSAGE, {
input: {
agentMessage: {
databaseId,
threadId,
authorRole: input.authorRole,
...attribution,
Expand Down Expand Up @@ -123,7 +125,6 @@ export function createGraphQLConversationClient(
{
input: {
agentTask: {
databaseId,
[parent.column]: parent.id,
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
description: input.description,
status: input.status,
Expand Down
2 changes: 0 additions & 2 deletions agentic/pi-host/__tests__/events.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import { createGraphQLConversationClient, TaskWriter, Transcript } from '@agenti
import { FakeAgentApi } from '../../agent-conversation/__tests__/fake-client';
import { parseTodos, TranscriptWriter } from '../src/events';

const DATABASE_ID = '00000000-0000-0000-0000-0000000000db';
const THREAD_ID = '00000000-0000-0000-0000-0000000000ad';

function setup(withTasks = true) {
const api = new FakeAgentApi();
const conversation = createGraphQLConversationClient({
client: api,
databaseId: DATABASE_ID,
threadId: THREAD_ID
});
const transcript = new Transcript(conversation);
Expand Down
3 changes: 0 additions & 3 deletions agentic/pi-host/__tests__/gate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { createGraphQLConversationClient, Inbox, requestApproval, respondToAppro
import { FakeAgentApi } from '../../agent-conversation/__tests__/fake-client';
import { createThreadGateHost } from '../src/gate';

const DATABASE_ID = '00000000-0000-0000-0000-0000000000db';
const THREAD_ID = '00000000-0000-0000-0000-0000000000ad';

interface Harness {
Expand All @@ -29,7 +28,6 @@ function harness(): Harness {

const conversation = createGraphQLConversationClient({
client: api,
databaseId: DATABASE_ID,
threadId: THREAD_ID
});

Expand Down Expand Up @@ -128,7 +126,6 @@ describe('thread gate host', () => {
const inbox = new Inbox({
client: createGraphQLConversationClient({
client: h.api,
databaseId: DATABASE_ID,
threadId: THREAD_ID
}),
since: new Date(0).toISOString(),
Expand Down
Loading