Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
2ac1248
feat: add project skill queries and authorization
jaaydenh Oct 15, 2026
836c956
refactor(coderd/database): share chat project config authorization he…
jaaydenh Oct 15, 2026
7bc17ba
test(coderd/database): assert project skill reads stay scoped to thei…
jaaydenh Oct 15, 2026
1c9e8f1
feat: add project skill API routes
jaaydenh Oct 15, 2026
d623418
chore(coderd): clarify chat project skill limit comment
jaaydenh Oct 15, 2026
dda45bc
feat(coderd/x): load project skills in chats
jaaydenh Oct 15, 2026
27c808d
feat(site): list project skills in the chat slash menu
jaaydenh Oct 15, 2026
009432c
refactor(site/src/pages/AgentsPage): share stored skill source loadin…
jaaydenh Oct 15, 2026
a3a2f5d
refactor(site/src/pages/AgentsPage/components/ChatMessageInput): simp…
jaaydenh Oct 15, 2026
23a5168
refactor(site/src/pages/AgentsPage): name stored skill source flags a…
jaaydenh Oct 15, 2026
5533023
refactor(site/src/pages/AgentsPage/components): clarify skill source …
jaaydenh Oct 15, 2026
681b374
test: cover project skill loader and gating gaps
jaaydenh Oct 15, 2026
2a72a92
test(site/src/pages/AgentsPage/components): assert the project skills…
jaaydenh Oct 15, 2026
26deda5
fix(site/src/pages/AgentsPage): use the root chat's project for subag…
jaaydenh Oct 15, 2026
549a030
fix(site/src/pages/AgentsPage): keep inherited project skills pending…
jaaydenh Oct 15, 2026
7b6c3e3
test(site/src/pages/AgentsPage/components): restore Range geometry st…
jaaydenh Oct 15, 2026
a14b495
refactor(site/src/pages/AgentsPage): extract SkillEditorForm and shar…
jaaydenh Oct 15, 2026
3a6e22b
feat(site): add the project skills dialog
jaaydenh Oct 15, 2026
d8b9163
feat: manage project skills from the project page
jaaydenh Oct 15, 2026
f8c6ca7
feat: send skill invocations as structured message parts
jaaydenh Oct 15, 2026
e1a4429
fix(site/src/pages/AgentsPage/components): keep the edited skill name…
jaaydenh Oct 15, 2026
dd7a120
Merge branch 'chat-project-skills/skill-editor-form' into chat-projec…
jaaydenh Oct 15, 2026
4345722
test(coderd): cover skill invocation rejection on message edit
jaaydenh Oct 15, 2026
43b64fc
fix(site/src/pages/AgentsPage/components/ProjectPage): keep skill edi…
jaaydenh Oct 15, 2026
ffc6165
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 15, 2026
fc6f82d
test(site/src/pages/AgentsPage/components/ProjectPage): move download…
jaaydenh Oct 15, 2026
f412310
test(site/src/pages/AgentsPage/components/ProjectPage): cover dialog …
jaaydenh Oct 15, 2026
358cb86
Merge branch 'chat-project-skills/project-skills-details' into chat-p…
jaaydenh Oct 15, 2026
85fcc37
refactor(site/src/pages/AgentsPage/components): drop a JSDoc that res…
jaaydenh Oct 15, 2026
ff7f8d8
fix(site/src/pages/AgentsPage/components/ProjectPage): drop stale ski…
jaaydenh Oct 15, 2026
91be0f4
Merge branch 'chat-project-skills/skill-editor-form' into chat-projec…
jaaydenh Oct 15, 2026
f3a7564
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 15, 2026
2890acf
fix(site/src/pages/AgentsPage/components/ProjectPage): surface skill …
jaaydenh Oct 15, 2026
f0a09ce
fix: bound skill invocations per message
jaaydenh Oct 15, 2026
0683472
test(site/src/pages/AgentsPage/components/ProjectPage): cover skill d…
jaaydenh Oct 15, 2026
732d052
Merge branch 'chat-project-skills/project-skills-details' into chat-p…
jaaydenh Oct 15, 2026
553df7e
refactor(site/src/pages/AgentsPage/components): drop comments that re…
jaaydenh Oct 15, 2026
78f6a19
Merge branch 'chat-project-skills/skill-editor-form' into chat-projec…
jaaydenh Oct 15, 2026
a3a6cdb
docs: keep the shared skill name docs variant-neutral
jaaydenh Oct 15, 2026
316ad1e
fix(site/src/pages/AgentsPage/components/ProjectPage): cancel stale s…
jaaydenh Oct 15, 2026
492e634
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 15, 2026
fb91fda
test(site/src/pages/AgentsPage/components/ProjectPage): cover cancell…
jaaydenh Oct 15, 2026
bd2a6d9
fix(site/src/pages/AgentsPage/components/ProjectPage): wait for the s…
jaaydenh Oct 15, 2026
0cdc313
Merge branch 'chat-project-skills/project-skills-details' into chat-p…
jaaydenh Oct 15, 2026
6c07758
fix(site/src/pages/AgentsPage/components/ProjectPage): keep New disab…
jaaydenh Oct 15, 2026
76bfc9d
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 15, 2026
c2d7bc9
Merge branch 'chat-project-skills/project-skills-details' into chat-p…
jaaydenh Oct 15, 2026
16d5d85
feat(site/src): insert skills as chips in the composer
jaaydenh Oct 15, 2026
c7fa38a
fix(site/src/pages/AgentsPage/components/ChatMessageInput): keep chip…
jaaydenh Oct 15, 2026
8defe30
docs(site/src/api/queries): correct the project skill 409 comment
jaaydenh Oct 15, 2026
ecab89a
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 15, 2026
d600f00
docs(site/src/pages/AgentsPage/components/ChatMessageInput): update t…
jaaydenh Oct 15, 2026
fdea7a7
fix(coderd/x/chatd): keep skill bodies out of lifecycle hook payloads
jaaydenh Oct 15, 2026
3dbefc5
Merge branch 'chat-project-skills/project-skills-details' into chat-p…
jaaydenh Oct 15, 2026
b99a463
Merge branch 'chat-project-skills/invocation-api' into chat-project-s…
jaaydenh Oct 15, 2026
805a802
docs(site/src/pages/AgentsPage): document exported skill helpers
jaaydenh Oct 15, 2026
aa90018
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 15, 2026
f1af0dd
Merge branch 'chat-project-skills/project-skills-details' into chat-p…
jaaydenh Oct 16, 2026
052186a
Merge branch 'chat-project-skills/invocation-api' into chat-project-s…
jaaydenh Oct 16, 2026
0344df4
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 16, 2026
74b1f39
refactor(site/src/pages/AgentsPage): tighten the project skills dialog
jaaydenh Oct 16, 2026
3f422e3
refactor(site/src/pages/AgentsPage/components/ChatMessageInput): simp…
jaaydenh Oct 16, 2026
e0961b4
Merge branch 'chat-project-skills/project-skills-details' into chat-p…
jaaydenh Oct 16, 2026
82f6b3b
Merge branch 'chat-project-skills/invocation-api' into chat-project-s…
jaaydenh Oct 16, 2026
827356c
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 16, 2026
540ea7b
refactor(site/src/pages/AgentsPage/components/ProjectPage): scope the…
jaaydenh Oct 16, 2026
908547b
Merge branch 'chat-project-skills/project-skills-details' into chat-p…
jaaydenh Oct 16, 2026
105916a
Merge branch 'chat-project-skills/invocation-api' into chat-project-s…
jaaydenh Oct 16, 2026
6667893
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 16, 2026
14066aa
docs(site/src/pages/AgentsPage): document project skill cache and dia…
jaaydenh Oct 16, 2026
67e9170
test(site/src/pages/AgentsPage/components/ProjectPage): cover the ski…
jaaydenh Oct 16, 2026
e27d1bf
fix(site/src/pages/AgentsPage/components/ChatMessageInput): paste com…
jaaydenh Oct 16, 2026
d985249
fix(site/src/pages/AgentsPage/components/ChatMessageInput): name the …
jaaydenh Oct 16, 2026
3d5c2e0
Merge branch 'chat-project-skills/project-skills-details' into chat-p…
jaaydenh Oct 16, 2026
e1dc262
Merge branch 'chat-project-skills/invocation-api' into chat-project-s…
jaaydenh Oct 16, 2026
062166f
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 16, 2026
4adbfba
test(site/src/pages/AgentsPage/components/ProjectPage): drop a render…
jaaydenh Oct 16, 2026
ecb0ede
test(site/src): tighten project skill test helpers and comments
jaaydenh Oct 16, 2026
3f0bfcb
Merge branch 'chat-project-skills/project-skills-details' into chat-p…
jaaydenh Oct 16, 2026
6507e9c
Merge branch 'chat-project-skills/invocation-api' into chat-project-s…
jaaydenh Oct 16, 2026
83bc08e
docs(site/src/pages/AgentsPage/components/ChatConversation): describe…
jaaydenh Oct 16, 2026
dd721a6
test(site/src/pages/AgentsPage/components/ProjectPage): name local sk…
jaaydenh Oct 16, 2026
4b880f1
Merge branch 'chat-project-skills/project-skills-details' into chat-p…
jaaydenh Oct 16, 2026
8577250
Merge branch 'chat-project-skills/invocation-api' into chat-project-s…
jaaydenh Oct 16, 2026
f6c25f5
fix(site/src/pages/AgentsPage/components/ProjectPage): wait for backg…
jaaydenh Oct 16, 2026
08c167d
test(site/src/pages/AgentsPage/components/ChatMessageInput): drop a c…
jaaydenh Oct 16, 2026
2c527ff
Merge branch 'chat-project-skills/invocation-api' into chat-project-s…
jaaydenh Oct 16, 2026
0eedf68
Merge branch 'chat-project-skills/project-skills-details' into chat-p…
jaaydenh Oct 16, 2026
77dd873
test(site/src/pages/AgentsPage/components/ProjectPage): cover project…
jaaydenh Oct 16, 2026
1226a70
fix(site/src/pages/AgentsPage/components/ChatMessageInput): let Escap…
jaaydenh Oct 16, 2026
d130bf2
Merge branch 'chat-project-skills/project-skills-details' into chat-p…
jaaydenh Oct 16, 2026
1fb8b2f
Merge branch 'chat-project-skills/invocation-api' into chat-project-s…
jaaydenh Oct 16, 2026
d2c797c
feat(site/src/pages/AgentsPage/components/ProjectPage): show an edit …
jaaydenh Oct 16, 2026
3c0edb8
Merge branch 'chat-project-skills/project-skills-details' into chat-p…
jaaydenh Oct 16, 2026
20ad3ad
Merge branch 'chat-project-skills/invocation-api' into chat-project-s…
jaaydenh Oct 16, 2026
e6af784
Merge remote-tracking branch 'origin/main' into HEAD
jaaydenh Oct 16, 2026
ebb0776
fix(coderd/database/migrations): renumber chat project skill audit mi…
jaaydenh Oct 16, 2026
2ea1fca
Merge branch 'chat-project-skills/queries' into chat-project-skills/api
jaaydenh Oct 16, 2026
f317b07
Merge branch 'chat-project-skills/api' into chat-project-skills/chatd
jaaydenh Oct 16, 2026
958d217
Merge branch 'chat-project-skills/chatd' into chat-project-skills/sub…
jaaydenh Oct 16, 2026
483db17
Merge branch 'chat-project-skills/subagent-project' into chat-project…
jaaydenh Oct 16, 2026
29b7356
Merge branch 'chat-project-skills/skill-editor-form' into chat-projec…
jaaydenh Oct 16, 2026
7e7aab2
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 16, 2026
048646e
Merge branch 'chat-project-skills/project-skills-details' into chat-p…
jaaydenh Oct 16, 2026
017d681
Merge branch 'chat-project-skills/invocation-api' into chat-project-s…
jaaydenh Oct 16, 2026
f010477
chore(coderd): remove non-essential project skill comments
jaaydenh Oct 18, 2026
cbb4bf7
Merge remote-tracking branch 'origin/main' into rs-queries
jaaydenh Oct 18, 2026
1799827
fix(coderd/database/migrations): renumber chat project skill audit mi…
jaaydenh Oct 18, 2026
d1c3934
Merge branch 'rs-queries' into rs-api
jaaydenh Oct 18, 2026
a63de89
Merge branch 'rs-api' into rs-chatd
jaaydenh Oct 18, 2026
8e1aa52
feat: add project skill API routes
jaaydenh Oct 15, 2026
34c10cd
chore(coderd): clarify chat project skill limit comment
jaaydenh Oct 15, 2026
c20a345
Merge branch 'chat-project-skills/api' into chat-project-skills/chatd
jaaydenh Oct 18, 2026
ec1b625
Merge remote-tracking branch 'origin/main' into chat-project-skills/c…
jaaydenh Oct 18, 2026
c39c1e0
Merge branch 'chat-project-skills/chatd' into chat-project-skills/sub…
jaaydenh Oct 18, 2026
e848b00
Merge branch 'chat-project-skills/subagent-project' into chat-project…
jaaydenh Oct 18, 2026
9d3f01c
Merge branch 'chat-project-skills/skill-editor-form' into chat-projec…
jaaydenh Oct 18, 2026
ace1ded
Merge branch 'chat-project-skills/project-skills-dialog' into chat-pr…
jaaydenh Oct 18, 2026
d1c6cde
Merge branch 'chat-project-skills/project-skills-details' into chat-p…
jaaydenh Oct 18, 2026
4140d58
Merge branch 'chat-project-skills/invocation-api' into chat-project-s…
jaaydenh Oct 18, 2026
52ba82d
Merge remote-tracking branch 'origin/main' into skills-chatd-fix
jaaydenh Oct 20, 2026
1c06855
chore: update architecture.md
jaaydenh Oct 20, 2026
0c938f1
fix: gate project skills on project usability and fail open in the co…
jaaydenh Oct 20, 2026
379ae2e
fix(site/src/pages/AgentsPage): keep loaded project skills after a fa…
jaaydenh Oct 20, 2026
ee7773e
Merge remote-tracking branch 'origin/chat-project-skills/chatd' into …
jaaydenh Oct 20, 2026
8288725
docs(site/src/pages/AgentsPage/components/ChatMessageInput): clarify …
jaaydenh Oct 20, 2026
894beaf
fix(site/src): count only lost project access as no project skills
jaaydenh Oct 20, 2026
019f52f
fix(site/src): let lost project access override cached project skills
jaaydenh Oct 20, 2026
2964653
test(site/src/pages/AgentsPage/components/ChatMessageInput): cover lo…
jaaydenh Oct 20, 2026
b0a3bbc
revert(site/src/pages/AgentsPage): drop the root-chat project fallbac…
jaaydenh Oct 20, 2026
b1e7cf2
Merge remote-tracking branch 'origin/chat-project-skills/chatd' into …
jaaydenh Oct 20, 2026
9bb55f3
Merge remote-tracking branch 'origin/chat-project-skills/skill-editor…
jaaydenh Oct 20, 2026
147becf
Merge branch 'skills-dialog-resync' into skills-details-resync
jaaydenh Oct 20, 2026
e25ca2e
fix(site/src/pages/AgentsPage/components/ProjectPage): take skill edi…
jaaydenh Oct 20, 2026
c505116
test(site/src/pages/AgentsPage/components/ProjectPage): assert a shar…
jaaydenh Oct 20, 2026
89a2e9a
fix(site/src): hide project skills the caller's chats cannot use
jaaydenh Oct 20, 2026
7ad1778
test(site/src/pages/AgentsPage/components/ProjectPage): name the proj…
jaaydenh Oct 20, 2026
9231e4e
fix(site/src/api/queries): treat a cached project list as unknown unt…
jaaydenh Oct 20, 2026
7c88cf1
test(site/src/pages/AgentsPage/components/ProjectPage): seed project …
jaaydenh Oct 20, 2026
6349cb1
test(site/src/pages/AgentsPage/components/ProjectPage): cover a faile…
jaaydenh Oct 20, 2026
5f55038
test(site/src/pages/AgentsPage/components/ProjectPage): wait for the …
jaaydenh Oct 20, 2026
98ad675
test(site/src/pages/AgentsPage/components/ProjectPage): type the refe…
jaaydenh Oct 20, 2026
8383b23
test(site/src/pages/AgentsPage/components/ProjectPage): refetch the s…
jaaydenh Oct 20, 2026
cfb1716
test(site/src/pages/AgentsPage/components/ProjectPage): capture the f…
jaaydenh Oct 20, 2026
17ba94d
Merge remote-tracking branch 'origin/main' into wyav/sk-chatd
jaaydenh Oct 20, 2026
b79ed20
Merge branch 'wyav/sk-chatd' into wyav/sk-skill-editor-form
jaaydenh Oct 20, 2026
0384e1b
Merge branch 'wyav/sk-skill-editor-form' into wyav/sk-project-skills-…
jaaydenh Oct 20, 2026
fede53b
Merge branch 'wyav/sk-project-skills-dialog' into wyav/sk-project-ski…
jaaydenh Oct 20, 2026
f3cc275
Merge branch 'wyav/sk-project-skills-details' into wyav/sk-invocation…
jaaydenh Oct 20, 2026
6707a7d
Merge branch 'wyav/sk-invocation-api' into wyav/sk-skill-chips-composer
jaaydenh Oct 20, 2026
29e32ef
fix(coderd/x/chatd): document the chatd read for project skill invoca…
jaaydenh Oct 20, 2026
267d700
Merge branch 'wyav/sk-invocation-api' into wyav/sk-skill-chips-composer
jaaydenh Oct 20, 2026
90de6c8
refactor(coderd/x/chatd): remove the unused resolveProjectInstructions
jaaydenh Oct 21, 2026
e9117ba
chore: update architecture.md
jaaydenh Oct 21, 2026
f83fb91
Merge branch 'chat-project-skills/chatd' of https://github.com/coder/…
jaaydenh Oct 21, 2026
e9a4adf
fix(site/src/pages/AgentsPage/components/ChatMessageInput): drop the …
jaaydenh Oct 21, 2026
fe2c0b3
Merge commit 'e9a4adf7c68e6bf80c9633591e8a99345b3f1dbf' into resync-s…
jaaydenh Oct 21, 2026
9d80261
Merge commit '3216580614^' into resync-skill-editor-form
jaaydenh Oct 21, 2026
793e989
Merge commit '3216580614' into resync-skill-editor-form
jaaydenh Oct 21, 2026
e5f1e0a
Merge commit '793e989a07d92b87e39aa15f5f0f9c853a9d317c' into pr-30855…
jaaydenh Oct 21, 2026
78f232d
Merge commit 'c1d4907f6c^' into project-skills-dialog
jaaydenh Oct 21, 2026
d581a38
Merge commit 'c1d4907f6c' into project-skills-dialog
jaaydenh Oct 21, 2026
4dbd39e
Merge commit 'd581a3864e' into details-resync-30856
jaaydenh Oct 21, 2026
e7220ac
Merge remote-tracking branch 'origin/main' into details-resync-30856
jaaydenh Oct 21, 2026
cdd278c
Merge commit 'e7220ace1d46174a22cf4b67ef49e1bae2b0f8a0' into resolve-…
jaaydenh Oct 21, 2026
334e844
Merge commit '7253bd127bd53248e3588ef1ec93cbe95ad6253a^' into resolve…
jaaydenh Oct 21, 2026
a3f23b7
Merge commit '7253bd127bd53248e3588ef1ec93cbe95ad6253a' into resolve-…
jaaydenh Oct 21, 2026
57c45db
fix(site/src/pages/AgentsPage/components/ChatMessageInput): use the i…
jaaydenh Oct 21, 2026
56586eb
Merge commit 'a3f23b7e97' into resync-30880
jaaydenh Oct 22, 2026
44015d8
Merge commit 'ffd24861a1^' into resync-30880
jaaydenh Oct 22, 2026
032f8e5
Merge commit 'ffd24861a1' into resync-30880
jaaydenh Oct 22, 2026
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
2 changes: 1 addition & 1 deletion site/src/api/queries/organizationSkills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { QueryClient } from "react-query";
import { API } from "#/api/api";
import type * as TypesGen from "#/api/typesGenerated";

const organizationSkillsKey = (organizationId: string) =>
export const organizationSkillsKey = (organizationId: string) =>
["organization-skills", organizationId] as const;

const organizationSkillKey = (organizationId: string, name: string) =>
Expand Down
2 changes: 1 addition & 1 deletion site/src/api/queries/userSkills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { QueryClient } from "react-query";
import { API } from "#/api/api";
import type * as TypesGen from "#/api/typesGenerated";

const userSkillsKey = (user = "me") => ["user-skills", user] as const;
export const userSkillsKey = (user = "me") => ["user-skills", user] as const;

const userSkillKey = (name: string, user = "me") =>
[...userSkillsKey(user), name] as const;
Expand Down
11 changes: 6 additions & 5 deletions site/src/pages/AgentsPage/AgentCreatePage/AgentCreatePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ import { ChimeButton } from "../components/ChimeButton";
import { ProjectPage } from "../components/ProjectPage/ProjectPage";
import { WebPushButton } from "../components/WebPushButton";
import { isAbortError } from "../utils/chatAttachments";
import { toWorkspaceFileReferencePart } from "../utils/chatInputContent";
import {
buildChatInputContent,
toWorkspaceFileReferencePart,
} from "../utils/chatInputContent";
import { getChimeEnabled, setChimeEnabled } from "../utils/chime";
import { type DeepLinkState, readDeepLinkState } from "../utils/deepLinkState";
import { buildAgentChatPath } from "../utils/navigation";
Expand Down Expand Up @@ -260,6 +263,7 @@ const AgentCreatePageContent: React.FC<AgentCreatePageContentProps> = ({

const handleCreateChat = async ({
message,
composerParts,
fileIDs,
workspaceId,
model,
Expand All @@ -270,10 +274,7 @@ const AgentCreatePageContent: React.FC<AgentCreatePageContentProps> = ({
planMode,
uploadWorkspaceFiles,
}: CreateChatOptions) => {
const content: TypesGen.ChatInputPart[] = [];
if (message.trim()) {
content.push({ type: "text", text: message });
}
const content = buildChatInputContent({ message, composerParts }).content;
if (fileIDs) {
for (const fileID of fileIDs) {
content.push({ type: "file", file_id: fileID });
Expand Down
27 changes: 25 additions & 2 deletions site/src/pages/AgentsPage/components/AgentChatInput.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
act,
fireEvent,
render,
screen,
Expand Down Expand Up @@ -221,7 +222,25 @@ describe("AgentChatInput", () => {
await user.click(
await screen.findByRole("option", { name: /release-notes/ }),
);
expect(inputRef.current?.getValue()).toBe("/release-notes");
expect(inputRef.current?.getContentParts()).toContainEqual({
type: "skill-invocation",
source: "org",
name: "release-notes",
});
});

it("sends a message that holds only a skill chip", async () => {
const user = userEvent.setup();
const inputRef = createRef<ChatMessageInputRef>();
const onSend = vi.fn();
renderInput(
<AgentChatInput {...inputProps} onSend={onSend} inputRef={inputRef} />,
);
await waitFor(() => expect(inputRef.current).not.toBeNull());

act(() => inputRef.current?.insertSkill("project", "triage"));
await user.click(screen.getByRole("button", { name: "Send" }));
expect(onSend).toHaveBeenCalledTimes(1);
});

it("offers the chat project's skills in the slash menu", async () => {
Expand Down Expand Up @@ -252,7 +271,11 @@ describe("AgentChatInput", () => {
await user.click(
await screen.findByRole("option", { name: /project-conventions/ }),
);
expect(inputRef.current?.getValue()).toBe("/project-conventions");
expect(inputRef.current?.getContentParts()).toContainEqual({
type: "skill-invocation",
source: "project",
name: "project-conventions",
});
expect(getChatProjectSkills).toHaveBeenCalledWith("org-1", "project-1");
});

Expand Down
21 changes: 11 additions & 10 deletions site/src/pages/AgentsPage/components/AgentChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ type AgentChatInputProps = {
onContentChange: (
content: string,
serializedEditorState: string,
hasFileReferences: boolean,
hasChips: boolean,
) => void;
// Model selector.
selectedModel: string;
Expand Down Expand Up @@ -625,7 +625,7 @@ export const AgentChatInput: React.FC<AgentChatInputProps> = ({
disconnectMCPServerOAuth2(queryClient),
);

const [hasFileReferences, setHasFileReferences] = useState(false);
const [hasChips, setHasChips] = useState(false);
const [cycleIndex, setCycleIndex] = useState<number | null>(null);
const [cycleSavedDraft, setCycleSavedDraft] = useState<string | null>(null);
const cycleHistorySnapshotRef = useRef<readonly string[] | null>(null);
Expand Down Expand Up @@ -689,6 +689,8 @@ export const AgentChatInput: React.FC<AgentChatInputProps> = ({
focus: () => internalRef.current?.focus(),
getValue: () => internalRef.current?.getValue() ?? "",
addFileReference: (ref) => internalRef.current?.addFileReference(ref),
insertSkill: (source, name) =>
internalRef.current?.insertSkill(source, name),
getContentParts: () => internalRef.current?.getContentParts() ?? [],
}),
[],
Expand Down Expand Up @@ -1081,7 +1083,7 @@ export const AgentChatInput: React.FC<AgentChatInputProps> = ({
const handleContentChange = (
content: string,
serializedEditorState: string,
hasRefs: boolean,
hasChipsInEditor: boolean,
) => {
// Lexical fires onChange synchronously from editor.setValue().
// While cycling, compare incoming content to currentCycleValueRef,
Expand All @@ -1094,9 +1096,9 @@ export const AgentChatInput: React.FC<AgentChatInputProps> = ({
resetPromptCycle();
}
setHasContent(Boolean(content.trim()));
setHasFileReferences(hasRefs);
setHasChips(hasChipsInEditor);
setInvisibleCharCount(countInvisibleCharacters(content));
onContentChange(content, serializedEditorState, hasRefs);
onContentChange(content, serializedEditorState, hasChipsInEditor);
};

// Re-focus the editor after a send completes (isLoading goes
Expand Down Expand Up @@ -1129,10 +1131,9 @@ export const AgentChatInput: React.FC<AgentChatInputProps> = ({
hasContent ||
attachments.length > 0 ||
workspaceUploadEntries.length > 0 ||
hasFileReferences;
hasChips;
const isComposerEffectivelyEmpty = !hasDraftContext;
const hasSendableContent =
hasContent || hasUploadedAttachments || hasFileReferences;
const hasSendableContent = hasContent || hasUploadedAttachments || hasChips;
const canSend =
!isDisabled &&
!isReadOnly &&
Expand All @@ -1148,7 +1149,7 @@ export const AgentChatInput: React.FC<AgentChatInputProps> = ({
if (
!text &&
!hasUploadedAttachments &&
!hasFileReferences &&
!hasChips &&
!isDisabled &&
!isReadOnly &&
!isLoading &&
Expand All @@ -1161,7 +1162,7 @@ export const AgentChatInput: React.FC<AgentChatInputProps> = ({
}

if (
(!text && !hasUploadedAttachments && !hasFileReferences) ||
(!text && !hasUploadedAttachments && !hasChips) ||
isDisabled ||
isReadOnly ||
isLoading ||
Expand Down
24 changes: 24 additions & 0 deletions site/src/pages/AgentsPage/components/AgentCreateForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ import {
organizationChatModelsKey,
userChatPersonalModelOverrides,
} from "#/api/queries/chats";
import { organizationSkillsKey } from "#/api/queries/organizationSkills";
import { permittedOrganizationsKey } from "#/api/queries/organizations";
import { userSkillsKey } from "#/api/queries/userSkills";
import { preferenceSettingsKey } from "#/api/queries/users";
import type * as TypesGen from "#/api/typesGenerated";
import { toast } from "#/components/Toaster/toast";
Expand All @@ -43,6 +45,7 @@ import {
} from "#/testHelpers/entities";
import { createTestQueryClient } from "#/testHelpers/renderHelpers";
import { server } from "#/testHelpers/server";
import { MockSkill } from "#/testHelpers/skills";
import { persistedAttachmentsStorageKey } from "../hooks/useFileAttachments";
import { readAgentAttachmentText } from "../utils/fileAttachmentLimits";
import { mcpSelectionStorageKey } from "../utils/mcpSelection";
Expand Down Expand Up @@ -298,6 +301,27 @@ describe("AgentCreateForm workspace file uploads", () => {
expect(submittedOptions(onCreateChat).uploadWorkspaceFiles).toBeUndefined();
});

it("submits a skill chosen from the slash menu as a composer part", async () => {
const queryClient = createQueryClient();
queryClient.setQueryData(userSkillsKey(), [MockSkill]);
queryClient.setQueryData(
organizationSkillsKey(MockDefaultOrganization.id),
[],
);
const { onCreateChat } = renderForm({}, { queryClient });

await typeMessage("/");
await user().click(await screen.findByRole("option", { name: /skill/ }));
await clickSend();

await waitFor(() => expect(onCreateChat).toHaveBeenCalledTimes(1));
expect(submittedOptions(onCreateChat).composerParts).toContainEqual({
type: "skill-invocation",
source: "personal",
name: MockSkill.name,
});
});

it("rejects workspace files when no workspace is selected", async () => {
const { onCreateChat } = renderForm();

Expand Down
8 changes: 7 additions & 1 deletion site/src/pages/AgentsPage/components/AgentCreateForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
useWorkspaceFileUploads,
type WorkspaceFileUpload,
} from "../hooks/useWorkspaceFileUploads";
import type { ChatComposerContentPart } from "../utils/chatInputContent";
import { parseStoredDraft } from "../utils/draftStorage";
import {
getDefaultMCPSelection,
Expand All @@ -48,7 +49,7 @@ import {
pickReasoningEffort,
saveReasoningEffortForModel,
} from "../utils/reasoningEffort";
import { AgentChatInput } from "./AgentChatInput";
import { AgentChatInput, type ChatMessageInputRef } from "./AgentChatInput";
import { ChatAccessDeniedAlert } from "./ChatAccessDeniedAlert";
import {
isChatHookDeniedResponse,
Expand Down Expand Up @@ -77,6 +78,8 @@ const attachDuringSubmitMessage =

export type CreateChatOptions = {
message: string;
/** Composer text and chips in document order. */
composerParts?: readonly ChatComposerContentPart[];
fileIDs?: string[];
workspaceId?: string;
model?: string;
Expand Down Expand Up @@ -750,6 +753,7 @@ const AgentCreateFormContent: React.FC<AgentCreateFormProps> = ({
(agent) => !agent.parent_id && agent.status === "connected",
);

const chatInputRef = useRef<ChatMessageInputRef>(null);
const handleSend = async (
message: string,
fileIDs?: string[],
Expand All @@ -758,6 +762,7 @@ const AgentCreateFormContent: React.FC<AgentCreateFormProps> = ({
submitDraft();
await onCreateChat({
message,
composerParts: chatInputRef.current?.getContentParts(),
Comment thread
jaaydenh marked this conversation as resolved.
Resolved
fileIDs,
workspaceId: effectiveWorkspaceId ?? undefined,
model: submittedModel,
Expand Down Expand Up @@ -1024,6 +1029,7 @@ const AgentCreateFormContent: React.FC<AgentCreateFormProps> = ({
<AgentChatInput
fillWidth={fillWidth}
onSend={handleSendWithAttachments}
inputRef={chatInputRef}
placeholder="Ask Coder to build, fix bugs, or explore your project..."
isDisabled={
isSubmitPending ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ const getInlineParts = (
blocks: readonly UserInlineRenderBlock[],
): InlinePart[] => {
return blocks.map((block) => {
if (block.type === "file-reference") {
return { type: "file-reference" };
if (block.type === "response") {
return { type: "text", text: block.text };
}
return { type: "text", text: block.text };
return { type: "chip" };
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,13 @@ export const ClickSelectsSkill: Story = {
},
};

export const SkillChipBetweenText: Story = {
play: async ({ canvasElement }) => {
await typeInEditor(canvasElement, "Use /rev");
await userEvent.keyboard("{Enter}on the latest diff");
},
};

export const OpensWithPersonalAndWorkspaceSkills: Story = {
args: {
hasWorkspace: true,
Expand Down
Loading
Loading