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
36 changes: 0 additions & 36 deletions packages/features/src/coding-agent-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { fakeCloudApi, HTTP_STATUS, type JsonValue, recordingHttpClient } from "
import { Effect, Fiber } from "effect";
import { TestClock } from "effect/testing";
import { accountBearer } from "./account-call.js";
import { MEMBER_KIND } from "./chat-wire.js";
import { HostedCodingAgentClient } from "./coding-agent-client.js";
import { CODING_AGENT_CALL_FAILURE } from "./coding-agent-view.js";
import { CODING_AGENT_STATUS } from "./coding-agent-wire.js";
Expand Down Expand Up @@ -445,41 +444,6 @@ it.effect(
}),
);

it.effect(
"reads a workspace's chat past the cursor it names, and a workspace the account is not in as not found",
() =>
Effect.gen(function* () {
const self = "4e2b8c1d-5f3a-4b6c-9d7e-8f1a2b3c4d5e";
const chat = {
self,
readSeq: 0,
members: [
{ id: self, kind: MEMBER_KIND.HUMAN, name: "Ada", userId: "user-1", left: false },
],
channels: [],
messages: [],
cursor: "12",
};
const api = fakeCloudApi({ "GET /api/workspaces/chat": { answer: () => chat } });
const refusing = fakeCloudApi({
"GET /api/workspaces/chat": {
answer: () => ({ error: HOSTED_API_ERROR.NOT_FOUND }),
status: HTTP_STATUS.NOT_FOUND,
},
});

const read = yield* Effect.provide(client().chat(WORKSPACE_ID, "7"), api.layer);
const refused = yield* Effect.provide(client().chat(WORKSPACE_ID, "0"), refusing.layer);

assert.deepEqual(read, chat);
assert.equal(
api.requests()[0]?.url,
`https://tryluke.dev/api/workspaces/chat?workspaceId=${WORKSPACE_ID}&after=7`,
);
assert.deepEqual(refused, { failure: CODING_AGENT_CALL_FAILURE.NOT_FOUND });
}),
);

it.effect(
"reads a chat message's picture by the workspace, the message, and the attachment, as base64 under the type it was kept as, a type no picture is as unanswered, and a refusal as its failure",
() =>
Expand Down
12 changes: 0 additions & 12 deletions packages/features/src/coding-agent-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
type CodingAgentCallFailure,
type CodingAgentCallsAnswerView,
type CodingAgentChangesAnswerView,
type CodingAgentChatAnswerView,
type CodingAgentChatWriteAnswerView,
type CodingAgentDefaultAnswer,
type CodingAgentGitHubImageView,
Expand Down Expand Up @@ -1051,17 +1050,6 @@ export class HostedCodingAgentClient {
);
}

/** A workspace's chat past the cursor: what a person in it sees, held by the service while nothing moved. */
chat(
workspaceId: string,
after: string,
): Effect.Effect<CodingAgentChatAnswerView, never, HttpClient.HttpClient> {
return hostedAnswer(
askHosted(this.#hosted.messages.chat, { workspaceId, after }, HOSTED_DEADLINE.HELD),
ROW_REFUSALS,
);
}

/**
* One picture a chat message carries, by the attachment its image block
* names, fetched under the account: its bytes in base64 under the media
Expand Down
10 changes: 1 addition & 9 deletions packages/features/src/coding-agent-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -702,16 +702,8 @@ export const codingAgentGitHubImageViewSchema = EffectSchema.Union([

export type CodingAgentGitHubImageView = typeof codingAgentGitHubImageViewSchema.Type;

/** A workspace's chat past a cursor, as the window asks it: the workspace, and the cursor the service last handed back or the start. */
export const codingAgentChatParamsSchema = EffectSchema.Struct({
workspaceId: EffectSchema.NonEmptyString,
after: EffectSchema.NonEmptyString,
});

export type CodingAgentChatParams = typeof codingAgentChatParamsSchema.Type;

/** A workspace's chat past a cursor, as the window hears it: the roster, the channels, the messages past it, and the cursor to read on from, or why there is none. */
export const codingAgentChatAnswerViewSchema = EffectSchema.Union([chatAnswerSchema, failed]);
const codingAgentChatAnswerViewSchema = EffectSchema.Union([chatAnswerSchema, failed]);

export type CodingAgentChatAnswerView = typeof codingAgentChatAnswerViewSchema.Type;

Expand Down
2 changes: 0 additions & 2 deletions packages/gateway/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,6 @@ export const GATEWAY_METHOD = {
CODING_AGENTS_INBOX_READ_STATE: "codingAgents.inboxReadState",
/** Every item of the account's Inbox marked read, in one workspace or in all; how many were unread, or why there is no answer. */
CODING_AGENTS_INBOX_READ_ALL: "codingAgents.inboxReadAll",
/** A workspace's chat past a cursor: what a person in it sees of it, held open by the service while nothing moved. */
CODING_AGENTS_CHAT: "codingAgents.chat",
/** A write to a workspace's chat as the account's own member: a post, an answer to an ask, a resolve, or how far it has read; what the write came to, or why there is no answer. */
CODING_AGENTS_CHAT_POST: "codingAgents.chatPost",
/**
Expand Down
18 changes: 3 additions & 15 deletions packages/host/src/act-port/agent-inbox-procedures.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import assert from "node:assert/strict";
import { setImmediate as nextTurn } from "node:timers/promises";
import { afterEach, it } from "@effect/vitest";
import { CHAT_CURSOR_START, MEMBER_KIND } from "@luke/features/chat-wire";
import { MEMBER_KIND } from "@luke/features/chat-wire";
import {
CODING_AGENT_CALL_FAILURE,
type CodingAgentChatChanged,
Expand Down Expand Up @@ -97,7 +97,6 @@ const REFUSAL = {
"Could not read the inbox item's image on this system.",
[AGENT_INBOX_ACT_KIND.CODING_AGENTS_PICTURE]:
"Could not read the agent's picture on this system.",
[AGENT_INBOX_ACT_KIND.CODING_AGENTS_CHAT]: "Could not read the workspace's chat on this system.",
[AGENT_INBOX_ACT_KIND.CODING_AGENTS_CHAT_POST]:
"Could not write to the workspace's chat on this system.",
[AGENT_INBOX_ACT_KIND.CODING_AGENTS_CHAT_ATTACHMENT]:
Expand Down Expand Up @@ -157,11 +156,6 @@ const ACTS: readonly {
payload: { agentId: AGENT_ID, pictureId: PICTURE_ID },
ask: "codingAgentPicture",
},
{
kind: AGENT_INBOX_ACT_KIND.CODING_AGENTS_CHAT,
payload: { workspaceId: WORKSPACE_ID, after: CHAT_CURSOR_START },
ask: "codingAgentChat",
},
{
kind: AGENT_INBOX_ACT_KIND.CODING_AGENTS_CHAT_POST,
payload: {
Expand Down Expand Up @@ -375,20 +369,17 @@ it("a panel's read of an inbox image, an agent's or a worker's picture, or a cha
]);
});

it("a panel's chat read and write reach the host with the workspace, the cursor, and the write as sent, and hear the answer; a write naming two places is refused before the host", async () => {
it("a panel's chat write reaches the host with the workspace and the write as sent, and hears the answer; a write naming two places is refused before the host", async () => {
const { call, asked } = windowPort(PANEL, {
answers: {
codingAgentChat: () => Effect.succeed(CHAT),
codingAgentChatPost: () => Effect.succeed({ readSeq: 4 }),
},
});
const read = { workspaceId: WORKSPACE_ID, after: CHAT_CURSOR_START };
const write = {
workspaceId: WORKSPACE_ID,
write: { text: "Morning, @agent-2.", to: "#general", clientKey: "send-1" },
};

assert.deepEqual(await call(AGENT_INBOX_ACT_KIND.CODING_AGENTS_CHAT, read), { answer: CHAT });
assert.deepEqual(await call(AGENT_INBOX_ACT_KIND.CODING_AGENTS_CHAT_POST, write), {
answer: { readSeq: 4 },
});
Expand All @@ -399,10 +390,7 @@ it("a panel's chat read and write reach the host with the workspace, the cursor,
}),
{ refused: REFUSAL[AGENT_INBOX_ACT_KIND.CODING_AGENTS_CHAT_POST] },
);
assert.deepEqual(asked, [
["codingAgentChat", read],
["codingAgentChatPost", write],
]);
assert.deepEqual(asked, [["codingAgentChatPost", write]]);
});

it("a host that dies, or answers what the kind cannot carry, is refused in the kind's own words", async () => {
Expand Down
8 changes: 0 additions & 8 deletions packages/host/src/act-port/agent-inbox-procedures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import type {
CodingAgentChatAnswerView,
CodingAgentChatAttachmentParams,
CodingAgentChatChanged,
CodingAgentChatParams,
CodingAgentChatPostParams,
CodingAgentChatWriteAnswerView,
CodingAgentInboxAnsweredView,
Expand Down Expand Up @@ -69,7 +68,6 @@ export interface AgentInboxProceduresDependencies {
codingAgentPicture(
params: CodingAgentPictureParams,
): Effect.Effect<CodingAgentInboxAttachmentView>;
codingAgentChat(params: CodingAgentChatParams): Effect.Effect<CodingAgentChatAnswerView>;
codingAgentChatPost(
params: CodingAgentChatPostParams,
): Effect.Effect<CodingAgentChatWriteAnswerView>;
Expand Down Expand Up @@ -237,12 +235,6 @@ export function agentInboxProcedures(dependencies: AgentInboxProceduresDependenc
yield* refuseUnlessPanel(context.actor, () => errors.REFUSED());
return yield* host.codingAgentPicture(input);
}),
[AGENT_INBOX_ACT_KIND.CODING_AGENTS_CHAT]: actPort[
AGENT_INBOX_ACT_KIND.CODING_AGENTS_CHAT
].effect(function* ({ input, context, errors }) {
yield* refuseUnlessPanel(context.actor, () => errors.REFUSED());
return yield* host.codingAgentChat(input);
}),
[AGENT_INBOX_ACT_KIND.CODING_AGENTS_CHAT_POST]: actPort[
AGENT_INBOX_ACT_KIND.CODING_AGENTS_CHAT_POST
].effect(function* ({ input, context, errors }) {
Expand Down
17 changes: 2 additions & 15 deletions packages/host/src/compose-coding-agents.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from "node:assert/strict";
import { it } from "@effect/vitest";
import type { AccountInboxEntry } from "@luke/features/account-inbox-wire";
import { CHAPTERS_MODEL } from "@luke/features/chapters-model-choice";
import { CHAT_CURSOR_START, MEMBER_KIND } from "@luke/features/chat-wire";
import { MEMBER_KIND } from "@luke/features/chat-wire";
import { CODING_AGENT_CALL_FAILURE, TRANSCRIPT_KIND } from "@luke/features/coding-agent-view";
import {
CHANGED_FILE_STATUS,
Expand Down Expand Up @@ -77,7 +77,7 @@ const WORKSPACE_ID = "2a9c4e6f-1b3d-4f5a-8c7e-9d0b1a2c3e4f";
const MEMBER_ID = "4e2b8c1d-5f3a-4b6c-9d7e-8f1a2b3c4d5e";

/** A workspace's chat as the service answers it: the reader alone, nothing posted yet. */
const CHAT = {
const _CHAT = {
self: MEMBER_ID,
readSeq: 0,
members: [{ id: MEMBER_ID, kind: MEMBER_KIND.HUMAN, name: "Ada", left: false }],
Expand Down Expand Up @@ -576,11 +576,6 @@ function fakeService() {
asked.push(`account-inbox:${after}`);
return { items: [WAITING], plans: [], cursor: "9", readAt: ITEM.updatedAt };
}),
chat: (workspaceId, after) =>
Effect.sync(() => {
asked.push(`chat:${workspaceId}:${after}`);
return CHAT;
}),
chatPost: (workspaceId, write) =>
Effect.sync(() => {
asked.push(`chat-post:${workspaceId}:${JSON.stringify(write)}`);
Expand Down Expand Up @@ -1006,13 +1001,6 @@ it.effect("each method asks the service once and answers what it said, whole", (
yield* call(GATEWAY_METHOD.CODING_AGENTS_ACCOUNT_INBOX, { after: INBOX_CURSOR_START }),
{ items: [WAITING], plans: [], cursor: "9", readAt: ITEM.updatedAt },
);
assert.deepEqual(
yield* call(GATEWAY_METHOD.CODING_AGENTS_CHAT, {
workspaceId: WORKSPACE_ID,
after: CHAT_CURSOR_START,
}),
CHAT,
);
assert.deepEqual(
yield* call(GATEWAY_METHOD.CODING_AGENTS_CHAT_POST, {
workspaceId: WORKSPACE_ID,
Expand Down Expand Up @@ -1073,7 +1061,6 @@ it.effect("each method asks the service once and answers what it said, whole", (
`inbox-read:${ITEM.id}`,
`inbox-read-all:${WORKSPACE_ID}`,
`account-inbox:${INBOX_CURSOR_START}`,
`chat:${WORKSPACE_ID}:${CHAT_CURSOR_START}`,
`chat-post:${WORKSPACE_ID}:{"readTo":4}`,
`chat-attachment:${WORKSPACE_ID}:message-1:${ATTACHMENT_ID}`,
]);
Expand Down
12 changes: 0 additions & 12 deletions packages/host/src/compose-coding-agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {
codingAgentArchiveParamsSchema,
codingAgentChatAttachmentParamsSchema,
codingAgentChatFollowParamsSchema,
codingAgentChatParamsSchema,
codingAgentChatPostParamsSchema,
codingAgentChooseParamsSchema,
codingAgentDefaultWriteParamsSchema,
Expand Down Expand Up @@ -188,7 +187,6 @@ export type CodingAgentClient = Pick<
| "accountInbox"
| "inboxAttachment"
| "agentPicture"
| "chat"
| "chatPost"
| "chatJoin"
| "workspaceChatLive"
Expand Down Expand Up @@ -843,16 +841,6 @@ function composed(
const answer = yield* asked(client.markInboxRead(request));
return carried<CodingAgentInboxReadAllView>(answer);
}),
[GATEWAY_METHOD.CODING_AGENTS_CHAT]: (params) =>
Effect.gen(function* () {
const { workspaceId, after } = yield* read(
codingAgentChatParamsSchema,
params,
"reading a workspace's chat names the workspace and a cursor",
);
const answer = yield* asked(client.chat(workspaceId, after));
return carried<CodingAgentChatAnswerView>(answer);
}),
[GATEWAY_METHOD.CODING_AGENTS_CHAT_POST]: (params) =>
Effect.gen(function* () {
const { workspaceId, write } = yield* read(
Expand Down
7 changes: 0 additions & 7 deletions packages/host/src/contract/agent-inbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
import {
type CodingAgentChatAnswerView,
codingAgentAgentInboxParamsSchema,
codingAgentChatAnswerViewSchema,
codingAgentChatAttachmentParamsSchema,
codingAgentChatFollowParamsSchema,
codingAgentChatParamsSchema,
codingAgentChatPostParamsSchema,
codingAgentChatWriteAnswerViewSchema,
codingAgentInboxAnsweredViewSchema,
Expand Down Expand Up @@ -92,11 +90,6 @@ export const agentInboxActsContract = {
)
.input(exactInput(codingAgentPictureParamsSchema))
.output(EffectSchema.toType(codingAgentInboxAttachmentViewSchema)),
[AGENT_INBOX_ACT_KIND.CODING_AGENTS_CHAT]: actProcedure(
"Could not read the workspace's chat on this system.",
)
.input(exactInput(codingAgentChatParamsSchema))
.output(EffectSchema.toType(codingAgentChatAnswerViewSchema)),
[AGENT_INBOX_ACT_KIND.CODING_AGENTS_CHAT_POST]: actProcedure(
"Could not write to the workspace's chat on this system.",
)
Expand Down
1 change: 0 additions & 1 deletion packages/host/src/contract/kinds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ export const AGENT_INBOX_ACT_KIND = {
/** One image of an inbox item, fetched by the host under the account, so the window holds no bearer and no address. */
CODING_AGENTS_INBOX_ATTACHMENT: "codingAgents.inboxAttachment",
CODING_AGENTS_PICTURE: "codingAgents.picture",
CODING_AGENTS_CHAT: "codingAgents.chat",
CODING_AGENTS_CHAT_POST: "codingAgents.chatPost",
CODING_AGENTS_CHAT_ATTACHMENT: "codingAgents.chatAttachment",
/**
Expand Down
13 changes: 0 additions & 13 deletions packages/host/src/host-operator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ import {
type CodingAgentArchiveParams,
type CodingAgentCallsAnswerView,
type CodingAgentChangesAnswerView,
type CodingAgentChatAnswerView,
type CodingAgentChatAttachmentParams,
type CodingAgentChatChanged,
type CodingAgentChatParams,
type CodingAgentChatPostParams,
type CodingAgentChatWriteAnswerView,
type CodingAgentChooseParams,
Expand Down Expand Up @@ -89,7 +87,6 @@ import {
codingAgentAgentAnswerSchema,
codingAgentCallsAnswerViewSchema,
codingAgentChangesAnswerViewSchema,
codingAgentChatAnswerViewSchema,
codingAgentChatChangedSchema,
codingAgentChatWriteAnswerViewSchema,
codingAgentDefaultAnswerViewSchema,
Expand Down Expand Up @@ -760,8 +757,6 @@ export interface HostOperator {
codingAgentPicture(
params: CodingAgentPictureParams,
): Effect.Effect<CodingAgentInboxAttachmentView>;
/** A workspace's chat past a cursor, held by the service while nothing moved; or why there is none. */
codingAgentChat(params: CodingAgentChatParams): Effect.Effect<CodingAgentChatAnswerView>;
/** A workspace's chat, followed from now until let go or signed out, heard through `onChatChanged`; following again starts over. */
codingAgentChatFollow(workspaceId: string): Effect.Effect<void>;
/** A workspace's chat let go: nothing more is heard of it until it is followed again. */
Expand Down Expand Up @@ -2155,14 +2150,6 @@ export function createHostOperator(options: HostOperatorOptions): HostOperator {
client.call(GATEWAY_METHOD.CODING_AGENTS_PICTURE, params),
codingAgentAnswer(codingAgentInboxAttachmentViewSchema),
),
codingAgentChat: (params) =>
Effect.map(
client.call(GATEWAY_METHOD.CODING_AGENTS_CHAT, {
workspaceId: params.workspaceId,
after: params.after,
}),
codingAgentAnswer(codingAgentChatAnswerViewSchema),
),
codingAgentChatFollow: (workspaceId) =>
fire(client.call(GATEWAY_METHOD.CODING_AGENTS_CHAT_FOLLOW, { workspaceId })),
codingAgentChatUnfollow: (workspaceId) =>
Expand Down
1 change: 0 additions & 1 deletion packages/panel/src/tasks/use-tasks-tab.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2714,7 +2714,6 @@ test("a live run follows the listed workspace's chat only while the account has
"Chat on follows its chat",
);
});
assert.ok(!on.agentActs.includes(ACT_KIND.CODING_AGENTS_CHAT), "nothing reads the held chat");
});

test("a channel chosen in Chat is the listed workspace's, so another workspace listed puts Chat back on For you", () => {
Expand Down
Loading